xref: /freebsd/stand/libsa/netif.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*	$NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $	*/
2 
3 
4 #ifndef __SYS_LIBNETBOOT_NETIF_H
5 #define __SYS_LIBNETBOOT_NETIF_H
6 #include "iodesc.h"
7 
8 struct netif_driver {
9 	const	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 	ssize_t	(*netif_get)(struct iodesc *, void **, time_t);
14 	ssize_t	(*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 	/* the following fields are used internally by the netif layer */
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[];	/* machdep */
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 **, 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 /* __SYS_LIBNETBOOT_NETIF_H */
65