xref: /freebsd/stand/libsa/netif.h (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
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 
9 struct 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 
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 	void			*nif_devdata;
45 };
46 
47 extern struct netif_driver	*netif_drivers[];	/* machdep */
48 extern int			n_netif_drivers;
49 
50 extern int			netif_debug;
51 
52 void		netif_init(void);
53 struct netif	*netif_select(void *);
54 int		netif_probe(struct netif *, void *);
55 void		netif_attach(struct netif *, struct iodesc *, void *);
56 void		netif_detach(struct netif *);
57 ssize_t		netif_get(struct iodesc *, void **, time_t);
58 ssize_t		netif_put(struct iodesc *, void *, size_t);
59 
60 int		netif_open(void *);
61 int		netif_close(int);
62 
63 struct iodesc	*socktodesc(int);
64 
65 #endif /* __SYS_LIBNETBOOT_NETIF_H */
66