Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
9.1 KiB

  1. /*
  2. Copyright (C) Microsoft Corporation, 1998 - 1999
  3. Module Name:
  4. nettst.h
  5. Abstract:
  6. This will be the header file for nettest.dll
  7. It is intended to be used by both the user of the dll and the source code
  8. for the dll.
  9. Author:
  10. Aug-13-1998 ( t-rajkup )
  11. */
  12. //
  13. // Before including this file, the source files for dll will redefine NETTESTAPI
  14. // to _declspec(dllexport)
  15. // - Rajkumar
  16. //
  17. #ifndef NETTESTAPI
  18. #define NETTESTAPI _declspec(dllimport)
  19. #endif
  20. /*=============================< Defines >=======================================*/
  21. // defines used in ipconfig structures
  22. #define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb.
  23. #define MAX_ADAPTER_NAME_LENGTH 256 // arb.
  24. #define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb.
  25. #define MAX_HOSTNAME_LEN 128 // arb.
  26. #define MAX_DOMAIN_NAME_LEN 128 // arb.
  27. #define MAX_SCOPE_ID_LEN 256 // arb.
  28. // defines used in dhcp response info
  29. #define MAX_SUBNET_MASK 32 // arb.
  30. #define MAX_IP_ADDR 32 // arb.
  31. #define MAX_EXPIRY_TIME_LEN 128 // arb.
  32. #define DHCP_BOOT_REPLY 2 // arb.
  33. // defines used in wins test
  34. // status values returned by wins name query test
  35. #define WINS_QUERY_SUCCEEDED 0x00000001
  36. #define WINS_QUERY_FAILED 0x00000002
  37. // defines used in netstat test
  38. #define MAX_PHYSADDR_SIZE 8
  39. // defines used in dhcp test
  40. #define EXPIRY_TIME_LEN 128 //arb.
  41. /*=============================< Data Structures >================================*/
  42. // NOTE: Need to include iptypes.h for definition of IP_ADDR_STRING.
  43. // This structure contains the fixed information returned by ipconfig test
  44. typedef struct _IPCONFIG_FIXED_INFO {
  45. char HostName[MAX_HOSTNAME_LEN + 4] ;
  46. char DomainName[MAX_DOMAIN_NAME_LEN + 4];
  47. PIP_ADDR_STRING CurrentDnsServer;
  48. IP_ADDR_STRING DnsServerList;
  49. UINT NodeType; // see node type related definitions in iptypes.h
  50. char ScopeId[MAX_SCOPE_ID_LEN + 4];
  51. UINT EnableRouting;
  52. UINT EnableProxy;
  53. UINT EnableDns;
  54. } IPCONFIG_FIXED_INFO, *PIPCONFIG_FIXED_INFO;
  55. // This structure contains per adapter information returned by ipconfig test
  56. typedef struct _IPCONFIG_ADAPTER_INFO {
  57. struct _IPCONFIG_ADAPTER_INFO *Next;
  58. char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
  59. char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
  60. UINT AddressLength;
  61. BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
  62. DWORD Index;
  63. UINT Type; // adapter type. See iptypes for definitions on type of adapters
  64. UINT DhcpEnabled;
  65. PIP_ADDR_STRING CurrentIpAddress;
  66. IP_ADDR_STRING IpAddressList;
  67. IP_ADDR_STRING GatewayList;
  68. IP_ADDR_STRING DhcpServer;
  69. BOOL PingDhcp; // whether pinging of dhcp server succeeded
  70. BOOL HaveWins;
  71. //
  72. // NOTE: According to KarolyS, it is possible to list upto 12 wins servers
  73. // and this is supposed to be included in nettest code. - Rajkumar
  74. //
  75. IP_ADDR_STRING PrimaryWinsServer;
  76. BOOL PingPrimary; // whether pinging of primary WINS succeeded
  77. IP_ADDR_STRING SecondaryWinsServer;
  78. BOOL PingSecondary; // whether pinging of secondary WINS succeeded
  79. time_t LeaseObtained;
  80. time_t LeaseExpires;
  81. char DhcpClassID[MAX_DOMAIN_NAME_LEN];
  82. UINT AutoconfigEnabled; // is autoconfiguration possible ?
  83. UINT AutoconfigActive; // is the adapter currently autoconfigured ?
  84. UINT NodeType;
  85. char DomainName[MAX_DOMAIN_NAME_LEN + 1];
  86. IP_ADDR_STRING DnsServerList;
  87. } IPCONFIG_ADAPTER_INFO, *PIPCONFIG_ADAPTER_INFO;
  88. //
  89. // Structure used in dhcp response
  90. //
  91. typedef struct _DHCP_RESPONSE_INFO {
  92. USHORT MessageType; // BOOT_REPLY always
  93. struct in_addr SubnetMask;
  94. struct in_addr ServerIp;
  95. struct in_addr DomainName;
  96. char ExpiryTime[EXPIRY_TIME_LEN];
  97. } DHCP_RESPONSE_INFO, *PDHCP_RESPONSE_INFO;
  98. //
  99. // structures returned by netstat test
  100. //
  101. typedef struct _INTERFACESTATS{
  102. ulong if_index;
  103. ulong if_type;
  104. ulong if_mtu;
  105. ulong if_speed;
  106. ulong if_physaddrlen;
  107. uchar if_physaddr[MAX_PHYSADDR_SIZE];
  108. ulong if_adminstatus;
  109. ulong if_operstatus;
  110. ulong if_lastchange;
  111. ulong if_inoctets;
  112. ulong if_inucastpkts;
  113. ulong if_innucastpkts;
  114. ulong if_indiscards;
  115. ulong if_inerrors;
  116. ulong if_inunknownprotos;
  117. ulong if_outoctets;
  118. ulong if_outucastpkts;
  119. ulong if_outnucastpkts;
  120. ulong if_outdiscards;
  121. ulong if_outerrors;
  122. ulong if_outqlen;
  123. ulong if_descrlen;
  124. uchar if_descr[1];
  125. } INTERFACESTATS, *PINTERFACESTATS;
  126. typedef struct _TCPCONNECTIONSTATS {
  127. ulong tct_state;
  128. ulong tct_localaddr;
  129. ulong tct_localport;
  130. ulong tct_remoteaddr;
  131. ulong tct_remoteport;
  132. struct _TCPCONNECTIONSTATS *Next;
  133. } TCPCONNECTIONSTATS, *PTCPCONNECTIONSTATS;
  134. typedef struct _UDPCONNECTIONSTATS {
  135. ulong ue_localaddr;
  136. ulong ue_localport;
  137. struct _UDPCONNECTIONSTATS *Next;
  138. } UDPCONNECTIONSTATS, *PUDPCONNECTIONSTATS;
  139. typedef struct _IPINFO {
  140. ulong ipsi_forwarding;
  141. ulong ipsi_defaultttl;
  142. ulong ipsi_inreceives;
  143. ulong ipsi_inhdrerrors;
  144. ulong ipsi_inaddrerrors;
  145. ulong ipsi_forwdatagrams;
  146. ulong ipsi_inunknownprotos;
  147. ulong ipsi_indiscards;
  148. ulong ipsi_indelivers;
  149. ulong ipsi_outrequests;
  150. ulong ipsi_routingdiscards;
  151. ulong ipsi_outdiscards;
  152. ulong ipsi_outnoroutes;
  153. ulong ipsi_reasmtimeout;
  154. ulong ipsi_reasmreqds;
  155. ulong ipsi_reasmoks;
  156. ulong ipsi_reasmfails;
  157. ulong ipsi_fragoks;
  158. ulong ipsi_fragfails;
  159. ulong ipsi_fragcreates;
  160. ulong ipsi_numif;
  161. ulong ipsi_numaddr;
  162. ulong ipsi_numroutes;
  163. } IPINFO, *PIPINFO;
  164. typedef struct _TCP_STATS {
  165. ulong ts_rtoalgorithm;
  166. ulong ts_rtomin;
  167. ulong ts_rtomax;
  168. ulong ts_maxconn;
  169. ulong ts_activeopens;
  170. ulong ts_passiveopens;
  171. ulong ts_attemptfails;
  172. ulong ts_estabresets;
  173. ulong ts_currestab;
  174. ulong ts_insegs;
  175. ulong ts_outsegs;
  176. ulong ts_retranssegs;
  177. ulong ts_inerrs;
  178. ulong ts_outrsts;
  179. ulong ts_numconns;
  180. } TCP_STATS, *PTCP_STATS;
  181. typedef struct _UDP_STATS {
  182. ulong us_indatagrams; // datagrams received
  183. ulong us_noports; // no ports
  184. ulong us_inerrors; // Receive Errors
  185. ulong us_outdatagrams; // datagrams sent
  186. } UDP_STATS, *PUDP_STATS;
  187. typedef struct _ICMPSTATS {
  188. ulong icmps_msgs; // messages
  189. ulong icmps_errors; // Errors
  190. ulong icmps_destunreachs; // destination unreachable
  191. ulong icmps_timeexcds; // time exceedeed
  192. ulong icmps_parmprobs; // parameter problems
  193. ulong icmps_srcquenchs; // source quenchs
  194. ulong icmps_redirects; // redirects
  195. ulong icmps_echos; // echos
  196. ulong icmps_echoreps; // echo replies
  197. ulong icmps_timestamps; // timestamps
  198. ulong icmps_timestampreps; // timestamps replies
  199. ulong icmps_addrmasks; // address masks
  200. ulong icmps_addrmaskreps; // address mask replies
  201. } ICMPSTATS, *PICMPSTATS;
  202. /*================================< Entry Points >===============================*/
  203. // The user of this entry point must allocate memory for these structures
  204. NETTESTAPI BOOL IpConfigTest(PIPCONFIG_FIXED_INFO pIpFixedInfo,
  205. PULONG pFixedSize,
  206. PIPCONFIG_ADAPTER_INFO pIpAdapterInfo,
  207. PULONG pAdapterInfo);
  208. NETTESTAPI BOOL CheckDhcp(PIPCONFIG_ADAPTER_INFO pIpAdapterInfo,PDHCP_RESPONSE_INFO pDhcpResponse);
  209. NETTESTAPI DWORD QueryWINS(PIP_ADDRESS_STRING WinsServerAddr);
  210. //
  211. // This entry point will allocate the memory needed. It will not expect the user
  212. // to allocate memory for these structures. Freeing of this allcoated memory is
  213. // user's reponsibility. There can be additional entry points which can be supplied
  214. // which can be used to free this memory
  215. //
  216. NETTESTAPI BOOL NetstatInfo(PINTERFACESTATS pIfcStat,
  217. PTCPCONNECTIONSTATS pTcpConnStats,
  218. PUDPCONNECTIONSTATS pUdpConnStats,
  219. PIPINFO pIpInfo,
  220. PTCP_STATS pTcpStats,
  221. PUDP_STATS pUdpStats,
  222. ICMPSTATS pIcmpStats);