1/*	$NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $	*/
2
3/* $FreeBSD$ */
4
5#ifndef __SYS_LIBNETBOOT_NETIF_H
6#define __SYS_LIBNETBOOT_NETIF_H
7#include "iodesc.h"
8
9struct netif_driver {
10	const	char *netif_bname;
11	int	(*netif_match)(struct netif *, void *);
12	int	(*netif_probe)(struct netif *, void *);
13	void	(*netif_init)(struct iodesc *, void *);
14	ssize_t	(*netif_get)(struct iodesc *, void **, time_t);
15	ssize_t	(*netif_put)(struct iodesc *, void *, size_t);
16	void	(*netif_end)(struct netif *);
17	struct	netif_dif *netif_ifs;
18	int	netif_nifs;
19};
20
21struct 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
30struct 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
40struct netif {
41	struct netif_driver	*nif_driver;
42	int			nif_unit;
43	int			nif_sel;
44	void			*nif_devdata;
45};
46
47extern struct netif_driver	*netif_drivers[];	/* machdep */
48extern int			n_netif_drivers;
49
50extern int			netif_debug;
51
52void		netif_init(void);
53struct netif	*netif_select(void *);
54int		netif_probe(struct netif *, void *);
55void		netif_attach(struct netif *, struct iodesc *, void *);
56void		netif_detach(struct netif *);
57ssize_t		netif_get(struct iodesc *, void **, time_t);
58ssize_t		netif_put(struct iodesc *, void *, size_t);
59
60int		netif_open(void *);
61int		netif_close(int);
62
63struct iodesc	*socktodesc(int);
64
65#endif /* __SYS_LIBNETBOOT_NETIF_H */
66