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