1
2
3
4 #ifndef __SYS_LIBNETBOOT_NETIF_H
5 #define __SYS_LIBNETBOOT_NETIF_H
6 #include "iodesc.h"
7
8 struct netif_driver {
9 char *netif_bname;
10 int (*netif_match)(struct netif *, void *);
11 int (*netif_probe)(struct netif *, void *);
12 void (*netif_init)(struct iodesc *, void *);
13 int (*netif_get)(struct iodesc *, void *, size_t, time_t);
14 int (*netif_put)(struct iodesc *, void *, size_t);
15 void (*netif_end)(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
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 void *nif_devdata;
44 };
45
46 extern struct netif_driver *netif_drivers[];
47 extern int n_netif_drivers;
48
49 extern int netif_debug;
50
51 void netif_init(void);
52 struct netif *netif_select(void *);
53 int netif_probe(struct netif *, void *);
54 void netif_attach(struct netif *, struct iodesc *, void *);
55 void netif_detach(struct netif *);
56 ssize_t netif_get(struct iodesc *, void *, size_t, time_t);
57 ssize_t netif_put(struct iodesc *, void *, size_t);
58
59 int netif_open(void *);
60 int netif_close(int);
61
62 struct iodesc *socktodesc(int);
63
64 #endif