netif.h revision 1.2 1 /* $NetBSD: netif.h,v 1.2 1994/10/26 05:44:54 cgd 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 };
45
46 extern struct netif_driver *netif_drivers[]; /* machdep */
47 extern int n_netif_drivers;
48
49 extern int netif_debug;
50
51 void netif_init __P((void));
52 struct netif *netif_select __P((void *));
53 int netif_probe __P((struct netif *, void *));
54 void netif_attach __P((struct netif *, struct iodesc *, void *));
55 void netif_detach __P((struct netif *));
56 int netif_get __P((struct iodesc *, void *, int, time_t));
57 int netif_put __P((struct iodesc *, void *, int));
58
59 int netif_open __P((void *));
60 int netif_close __P((int));
61
62 struct iodesc *socktodesc __P((int));
63
64 #endif /* __SYS_LIBNETBOOT_NETIF_H */
65