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