1 #ifndef IPPRIVATE_H 2 #define IPPRIVATE_H 3 4 #define NtCurrentTeb NtXCurrentTeb 5 6 #include <stdio.h> 7 #include <stdlib.h> 8 //#include <sys/types.h> 9 #ifdef HAVE_NETINET_IN_H 10 # include <netinet/in.h> 11 #endif 12 #ifdef HAVE_ARPA_INET_H 13 # include <arpa/inet.h> 14 #endif 15 #ifdef HAVE_ARPA_NAMESER_H 16 # include <arpa/nameser.h> 17 #endif 18 #ifdef HAVE_RESOLV_H 19 # include <resolv.h> 20 #endif 21 22 #define WIN32_NO_STATUS 23 #define _INC_WINDOWS 24 #define COM_NO_WINDOWS_H 25 26 #include <windef.h> 27 #include <winbase.h> 28 #include <winreg.h> 29 #include <winnls.h> 30 #include <ws2tcpip.h> 31 #define NTOS_MODE_USER 32 #include <ndk/iofuncs.h> 33 #include <ndk/obfuncs.h> 34 #include <ndk/rtlfuncs.h> 35 #include <iphlpapi.h> 36 #include "resinfo.h" 37 #include <wine/debug.h> 38 39 #include "dhcp.h" 40 #include <dhcpcsdk.h> 41 #include <dhcpcapi.h> 42 43 #include <tdiinfo.h> 44 #include <tcpioctl.h> 45 46 #include <tdilib.h> 47 48 #include "ifenum.h" 49 #include "ipstats.h" 50 #include "route.h" 51 52 #ifndef ETH_ALEN 53 #define ETH_ALEN 6 54 #endif 55 56 #ifndef INADDR_NONE 57 #define INADDR_NONE (~0U) 58 #endif 59 60 #ifndef IFENT_SOFTWARE_LOOPBACK 61 #define IFENT_SOFTWARE_LOOPBACK 24 /* This is an SNMP constant from rfc1213 */ 62 #endif/*IFENT_SOFTWARE_LOOPBACK*/ 63 64 #define INDEX_IS_LOOPBACK 0x00800000 65 66 /* Type declarations */ 67 68 #ifndef IFNAMSIZ 69 #define IFNAMSIZ 0x20 70 #endif/*IFNAMSIZ*/ 71 72 #define TCP_REQUEST_QUERY_INFORMATION_INIT { { { 0 } } } 73 #define TCP_REQUEST_SET_INFORMATION_INIT { { 0 } } 74 75 /* FIXME: ROS headers suck */ 76 #ifndef GAA_FLAG_SKIP_UNICAST 77 #define GAA_FLAG_SKIP_UNICAST 0x0001 78 #endif 79 80 #ifndef GAA_FLAG_SKIP_FRIENDLY_NAME 81 #define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 82 #endif 83 84 // As in the mib from RFC 1213 85 86 typedef struct _IPRouteEntry { 87 ULONG ire_dest; 88 ULONG ire_index; //matches if_index in IFEntry and iae_index in IPAddrEntry 89 ULONG ire_metric1; 90 ULONG ire_metric2; 91 ULONG ire_metric3; 92 ULONG ire_metric4; 93 ULONG ire_gw; 94 ULONG ire_type; 95 ULONG ire_proto; 96 ULONG ire_age; 97 ULONG ire_mask; 98 ULONG ire_metric5; 99 ULONG ire_info; 100 } IPRouteEntry; 101 102 /* No caddr_t in reactos headers */ 103 typedef char *caddr_t; 104 105 typedef union _IFEntrySafelySized { 106 CHAR MaxSize[sizeof(DWORD) + 107 sizeof(IFEntry) + 108 MAX_ADAPTER_DESCRIPTION_LENGTH + 1]; 109 IFEntry ent; 110 } IFEntrySafelySized; 111 112 typedef union _TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY { 113 CHAR MaxSize[sizeof(TCP_REQUEST_SET_INFORMATION_EX) - 1 + 114 sizeof(IPRouteEntry)]; 115 TCP_REQUEST_SET_INFORMATION_EX Req; 116 } TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY, 117 *PTCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY; 118 119 typedef union _TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY { 120 CHAR MaxSize[sizeof(TCP_REQUEST_SET_INFORMATION_EX) - 1 + 121 sizeof(MIB_IPNETROW)]; 122 TCP_REQUEST_SET_INFORMATION_EX Req; 123 } TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY, 124 *PTCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY; 125 126 /* Encapsulates information about an interface */ 127 typedef struct _IFInfo { 128 TDIEntityID entity_id; 129 IFEntrySafelySized if_info; 130 IPAddrEntry ip_addr; 131 } IFInfo; 132 133 typedef struct _IP_SET_DATA { 134 ULONG NteContext; 135 ULONG NewAddress; 136 ULONG NewNetmask; 137 } IP_SET_DATA, *PIP_SET_DATA; 138 139 typedef enum _IPHLPAddrType { 140 IPAAddr, IPABcast, IPAMask, IFMtu, IFStatus 141 } IPHLPAddrType; 142 143 /** Prototypes **/ 144 NTSTATUS getNthIpEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ); 145 NTSTATUS tdiGetIpAddrsForIpEntity( HANDLE tcpFile, TDIEntityID *ent, 146 IPAddrEntry **addrs, PDWORD numAddrs ); 147 int GetLongestChildKeyName( HANDLE RegHandle ); 148 LONG OpenChildKeyRead( HANDLE RegHandle, 149 PWCHAR ChildKeyName, 150 PHKEY ReturnHandle ); 151 PWCHAR GetNthChildKeyName( HANDLE RegHandle, DWORD n ); 152 void ConsumeChildKeyName( PWCHAR Name ); 153 PWCHAR QueryRegistryValueString( HANDLE RegHandle, PWCHAR ValueName ); 154 PWCHAR *QueryRegistryValueStringMulti( HANDLE RegHandle, PWCHAR ValueName ); 155 void ConsumeRegValueString( PWCHAR NameServer ); 156 BOOL isInterface( TDIEntityID *if_maybe ); 157 BOOL hasArp( HANDLE tcpFile, TDIEntityID *arp_maybe ); 158 159 typedef VOID (*EnumNameServersFunc)( PWCHAR Interface, 160 PWCHAR NameServer, 161 PVOID Data ); 162 LSTATUS EnumNameServers( HKEY RegHandle, LPWSTR Interface, PVOID Data, EnumNameServersFunc cb ); 163 NTSTATUS getIPAddrEntryForIf(HANDLE tcpFile, 164 char *name, 165 DWORD index, 166 IFInfo *ifInfo); 167 DWORD TCPSendIoctl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, PULONG pInBufferSize, LPVOID lpOutBuffer, PULONG pOutBufferSize); 168 169 #include <w32api.h> 170 /* This is here until we switch to version 2.5 of the mingw headers */ 171 #if (__W32API_MAJOR_VERSION < 2 || __W32API_MINOR_VERSION < 5) 172 BOOL WINAPI 173 GetComputerNameExA(COMPUTER_NAME_FORMAT,LPSTR,LPDWORD); 174 #endif 175 176 #endif /* IPPRIVATE_H */ 177