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