1/*	$OpenBSD: netif.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $	*/
2/*	$NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $	*/
3
4#ifndef __SYS_LIBNETBOOT_NETIF_H
5#define __SYS_LIBNETBOOT_NETIF_H
6#include "iodesc.h"
7
8struct 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
20struct 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
29struct 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
39struct netif {
40	struct netif_driver	*nif_driver;
41	int			nif_unit;
42	int			nif_sel;
43	void			*nif_devdata;
44};
45
46extern struct netif_driver	*netif_drivers[];	/* machdep */
47extern int			n_netif_drivers;
48
49extern int			netif_debug;
50
51void		netif_init(void);
52struct netif	*netif_select(void *);
53int		netif_probe(struct netif *, void *);
54void		netif_attach(struct netif *, struct iodesc *, void *);
55void		netif_detach(struct netif *);
56ssize_t		netif_get(struct iodesc *, void *, size_t, time_t);
57ssize_t		netif_put(struct iodesc *, void *, size_t);
58
59int		netif_open(void *);
60int		netif_close(int);
61
62struct iodesc	*socktodesc(int);
63
64#endif /* __SYS_LIBNETBOOT_NETIF_H */
65