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