1 /* $NetBSD: netif.h,v 1.7 2009/01/17 14:00:36 tsutsui Exp $ */ 2 3 #ifndef __SYS_LIBNETBOOT_NETIF_H 4 #define __SYS_LIBNETBOOT_NETIF_H 5 6 #include "iodesc.h" 7 8 struct netif; /* forward */ 9 10 struct netif_driver { 11 char *netif_bname; 12 int (*netif_match)(struct netif *, void *); 13 int (*netif_probe)(struct netif *, void *); 14 void (*netif_init)(struct iodesc *, void *); 15 int (*netif_get)(struct iodesc *, void *, size_t, saseconds_t); 16 int (*netif_put)(struct iodesc *, void *, size_t); 17 void (*netif_end)(struct netif *); 18 struct netif_dif *netif_ifs; 19 int netif_nifs; 20 }; 21 22 struct netif_dif { 23 int dif_unit; 24 int dif_nsel; 25 struct netif_stats *dif_stats; 26 void *dif_private; 27 /* the following fields are used internally by the netif layer */ 28 u_long dif_used; 29 }; 30 31 struct netif_stats { 32 int collisions; 33 int collision_error; 34 int missed; 35 int sent; 36 int received; 37 int deferred; 38 int overflow; 39 }; 40 41 struct netif { 42 struct netif_driver *nif_driver; 43 int nif_unit; 44 int nif_sel; 45 void *nif_devdata; 46 }; 47 48 extern struct netif_driver *netif_drivers[]; /* machdep */ 49 extern int n_netif_drivers; 50 51 extern int netif_debug; 52 53 void netif_init(void); 54 struct netif *netif_select(void *); 55 int netif_probe(struct netif *, void *); 56 void netif_attach(struct netif *, struct iodesc *, void *); 57 void netif_detach(struct netif *); 58 59 int netif_open(void *); 60 int netif_close(int); 61 62 #endif /* __SYS_LIBNETBOOT_NETIF_H */ 63