xref: /freebsd/contrib/ntp/include/ntif.h (revision c0b746e5)
1 /* this is a hacked version of if.h from unix to contain the stuff we need only to build named (bind) with
2    the minimal amount of changes... by l. kahn */
3 
4    /*
5  * Copyright (c) 1982, 1986 Regents of the University of California.
6  * All rights reserved.  The Berkeley software License Agreement
7  * specifies the terms and conditions for redistribution.
8  */
9 
10 #ifndef	_NET_IF_H
11 #define	_NET_IF_H
12 
13 
14 /* #pragma ident	"@(#)if.h	1.3	93/06/30 SMI"
15 /* if.h 1.26 90/05/29 SMI; from UCB 7.1 6/4/86		*/
16 
17 #ifdef	__cplusplus
18 extern "C" {
19 #endif
20 
21 /*
22  * Structures defining a network interface, providing a packet
23  * transport mechanism (ala level 0 of the PUP protocols).
24  *
25  * Each interface accepts output datagrams of a specified maximum
26  * length, and provides higher level routines with input datagrams
27  * received from its medium.
28  *
29  * Output occurs when the routine if_output is called, with three parameters:
30  *	(*ifp->if_output)(ifp, m, dst)
31  * Here m is the mbuf chain to be sent and dst is the destination address.
32  * The output routine encapsulates the supplied datagram if necessary,
33  * and then transmits it on its medium.
34  *
35  * On input, each interface unwraps the data received by it, and either
36  * places it on the input queue of a internetwork datagram routine
37  * and posts the associated software interrupt, or passes the datagram to a raw
38  * packet input routine.
39  *
40  * Routines exist for locating interfaces by their addresses
41  * or for locating a interface on a certain network, as well as more general
42  * routing and gateway routines maintaining information used to locate
43  * interfaces.  These routines live in the files if.c and route.c
44  */
45 
46 /*
47  * Structure defining a queue for a network interface.
48  *
49  * (Would like to call this struct ``if'', but C isn't PL/1.)
50  */
51 /*
52  * Interface request structure used for socket
53  * ioctl's.  All interface ioctl's must have parameter
54  * definitions which begin with ifr_name.  The
55  * remainder may be interface specific.
56  */
57 #ifdef FD_SETSIZE
58 #undef FD_SETSIZE
59 #endif
60 #define FD_SETSIZE 512
61 #include <winsock.h>
62 typedef char *caddr_t;
63 
64 int get_winnt_interfaces();
65 
66 struct	ifreq {
67 #define	IFNAMSIZ	16
68 	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
69 	struct	sockaddr ifru_addr;
70     char    nt_mask[IFNAMSIZ];      /* new field to store mask returned from nt lookup l. kahn */
71 
72 #define	ifr_addr	ifru_addr	/* address */
73 #define	ifr_mask	nt_mask	    /* nt mask in character form */
74 
75 };
76 
77 /*
78  * Structure used in SIOCGIFCONF request.
79  * Used to retrieve interface configuration
80  * for machine (useful for programs which
81  * must know all networks accessible).
82  */
83 struct	ifconf {
84 	int	ifc_len;		/* size of associated buffer */
85 	union {
86 		caddr_t	ifcu_buf;
87 		struct	ifreq *ifcu_req;
88 	} ifc_ifcu;
89 #define	ifc_buf	ifc_ifcu.ifcu_buf	/* buffer address */
90 #define	ifc_req	ifc_ifcu.ifcu_req	/* array of structures returned */
91 };
92 
93 #ifdef	__cplusplus
94 }
95 #endif
96 
97 #endif	/* _NET_IF_H */
98 
99