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