netif.c revision 199767f8919635c4928607450d9e0abb932109ce
/* $NetBSD: netif.c,v 1.10 1997/09/06 13:57:14 drochner Exp $ */
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
#include <string.h>
#include <netinet/in_systm.h>
#include "stand.h"
#include "net.h"
#include "netif.h"
#ifdef NETIF_DEBUG
int netif_debug = 0;
#endif
/*
* netif_init:
*
* initialize the generic network interface layer
*/
void
{
struct netif_driver *drv;
int d, i;
#ifdef NETIF_DEBUG
if (netif_debug)
printf("netif_init: called\n");
#endif
for (d = 0; netif_drivers[d]; d++) {
drv = netif_drivers[d];
for (i = 0; i < drv->netif_nifs; i++)
}
}
int
void *machdep_hint;
{
#if 0
if (netif_debug)
#endif
}
struct netif *
void *machdep_hint;
{
int d, u, unit_done, s;
struct netif_driver *drv;
int best_val;
int val;
best_val = 0;
for (d = 0; netif_drivers[d] != NULL; d++) {
for (u = 0; u < drv->netif_nifs; u++) {
unit_done = 0;
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
#ifdef NETIF_DEBUG
if (netif_debug)
printf(" [%d used]", s);
#endif
continue;
}
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
}
}
#ifdef NETIF_DEBUG
if (netif_debug)
printf("\n");
#endif
}
}
return NULL;
#ifdef NETIF_DEBUG
if (netif_debug)
printf("netif_select: %s%d(%d) wins\n",
#endif
return &best_if;
}
int
void *machdep_hint;
{
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
}
void
void *machdep_hint;
{
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
#ifdef PARANOID
#endif
sizeof(struct netif_stats));
}
void
{
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
#ifdef PARANOID
#endif
}
void *pkt;
{
#ifdef NETIF_DEBUG
#endif
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
#ifdef PARANOID
#endif
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
return rv;
}
void *pkt;
{
#ifdef NETIF_DEBUG
#endif
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
#ifdef PARANOID
#endif
#ifdef NETIF_DEBUG
if (netif_debug)
#endif
return rv;
}
struct iodesc *
int sock;
{
return (NULL);
}
}
int
void *machdep_hint;
{
int fd;
struct iodesc *s;
/* find a free socket */
goto fnd;
return (-1);
fnd:
bzero(s, sizeof(*s));
netif_init();
if (!nif)
panic("netboot: no interfaces left untried");
printf("netboot: couldn't probe %s%d\n",
return(-1);
}
return(fd);
}
int
int sock;
{
return(-1);
}
return(0);
}