separate the netif interface from the rest of the networking code,

so that it can be replaced easily in md code
This commit is contained in:
drochner 2003-03-12 14:49:19 +00:00
parent 552efeab39
commit 7816074c59
3 changed files with 12 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iodesc.h,v 1.4 1995/09/23 03:31:50 gwr Exp $ */
/* $NetBSD: iodesc.h,v 1.5 2003/03/12 14:49:19 drochner Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -48,7 +48,11 @@ struct iodesc {
u_short myport; /* local port, net order */
u_long xid; /* transaction identification */
u_char myea[6]; /* my ethernet address */
struct netif *io_netif;
void *io_netif;
};
struct iodesc *socktodesc __P((int));
ssize_t netif_get __P((struct iodesc *, void *, size_t, time_t));
ssize_t netif_put __P((struct iodesc *, void *, size_t));
#endif /* __SYS_LIBNETBOOT_IODESC_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif.c,v 1.17 2002/09/27 15:37:48 provos Exp $ */
/* $NetBSD: netif.c,v 1.18 2003/03/12 14:49:19 drochner Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -44,7 +44,6 @@
#include <netinet/in_systm.h>
#include "stand.h"
#include "net.h"
#include "netif.h"
struct iodesc sockets[SOPEN_MAX];
@ -230,10 +229,8 @@ netif_get(desc, pkt, len, timo)
size_t len;
time_t timo;
{
#ifdef NETIF_DEBUG
struct netif *nif = desc->io_netif;
#endif
struct netif_driver *drv = desc->io_netif->nif_driver;
struct netif_driver *drv = nif->nif_driver;
ssize_t rv;
#ifdef NETIF_DEBUG
@ -260,10 +257,8 @@ netif_put(desc, pkt, len)
void *pkt;
size_t len;
{
#ifdef NETIF_DEBUG
struct netif *nif = desc->io_netif;
#endif
struct netif_driver *drv = desc->io_netif->nif_driver;
struct netif_driver *drv = nif->nif_driver;
ssize_t rv;
#ifdef NETIF_DEBUG

View File

@ -1,10 +1,11 @@
/* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */
/* $NetBSD: netif.h,v 1.5 2003/03/12 14:49:19 drochner Exp $ */
#ifndef __SYS_LIBNETBOOT_NETIF_H
#define __SYS_LIBNETBOOT_NETIF_H
#include "iodesc.h"
#define NENTS(x) sizeof(x)/sizeof(x[0])
struct netif; /* forward */
struct netif_driver {
char *netif_bname;
@ -54,12 +55,8 @@ struct netif *netif_select __P((void *));
int netif_probe __P((struct netif *, void *));
void netif_attach __P((struct netif *, struct iodesc *, void *));
void netif_detach __P((struct netif *));
ssize_t netif_get __P((struct iodesc *, void *, size_t, time_t));
ssize_t netif_put __P((struct iodesc *, void *, size_t));
int netif_open __P((void *));
int netif_close __P((int));
struct iodesc *socktodesc __P((int));
#endif /* __SYS_LIBNETBOOT_NETIF_H */