summaryrefslogtreecommitdiff
path: root/sys/lib/libnetboot/netif.h
blob: a82a7964cf9bd5dd5f088007b2efe004088eccfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*	$NetBSD: netif.h,v 1.3 1994/10/26 06:43:15 cgd Exp $	*/

#ifndef __SYS_LIBNETBOOT_NETIF_H
#define __SYS_LIBNETBOOT_NETIF_H
#include "iodesc.h"

#define NENTS(x)	sizeof(x)/sizeof(x[0])

struct netif_driver {
	char	*netif_bname;
	int	(*netif_match) __P((struct netif *, void *));
	int	(*netif_probe) __P((struct netif *, void *));
	void	(*netif_init) __P((struct iodesc *, void *));
	int	(*netif_get) __P((struct iodesc *, void *, int, time_t));
	int	(*netif_put) __P((struct iodesc *, void *, int));
	void	(*netif_end) __P((struct netif *));
	struct	netif_dif *netif_ifs;
	int	netif_nifs;
};

struct netif_dif {
	int		dif_unit;
	int		dif_nsel;
	struct netif_stats *dif_stats;
	void		*dif_private;
	/* the following fields are used internally by the netif layer */
	u_long		dif_used;
};

struct netif_stats {
	int	collisions;
	int	collision_error;
	int	missed;
	int	sent;
	int	received;
	int	deferred;
	int	overflow;
};

struct netif {
	struct netif_driver	*nif_driver;
	int			nif_unit;
	int			nif_sel;
};

extern struct netif_driver	*netif_drivers[];	/* machdep */
extern int			n_netif_drivers;
#ifdef DEBUG
extern int			netif_debug;
#endif

void		netif_init __P((void));
struct netif	*netif_select __P((void *));
int		netif_probe __P((struct netif *, void *));
void		netif_attach __P((struct netif *, struct iodesc *, void *));
void		netif_detach __P((struct netif *));
int		netif_get __P((struct iodesc *, void *, int, time_t));
int		netif_put __P((struct iodesc *, void *, int));

#endif /* __SYS_LIBNETBOOT_NETIF_H */