1 /***********************************************************************\ 2 * ipexport.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW Windows headers * 7 * by Stewart Gordon * 8 * * 9 * Placed into public domain * 10 \***********************************************************************/ 11 module win32.ipexport; 12 13 private import win32.windef; 14 15 const size_t MAX_ADAPTER_NAME = 128; 16 17 // IP STATUS flags 18 enum : IP_STATUS { 19 IP_SUCCESS = 0, 20 IP_STATUS_BASE = 11000, 21 IP_BUF_TOO_SMALL, 22 IP_DEST_NET_UNREACHABLE, 23 IP_DEST_HOST_UNREACHABLE, 24 IP_DEST_PROT_UNREACHABLE, 25 IP_DEST_PORT_UNREACHABLE, 26 IP_NO_RESOURCES, 27 IP_BAD_OPTION, 28 IP_HW_ERROR, 29 IP_PACKET_TOO_BIG, 30 IP_REQ_TIMED_OUT, 31 IP_BAD_REQ, 32 IP_BAD_ROUTE, 33 IP_TTL_EXPIRED_TRANSIT, 34 IP_TTL_EXPIRED_REASSEM, 35 IP_PARAM_PROBLEM, 36 IP_SOURCE_QUENCH, 37 IP_OPTION_TOO_BIG, 38 IP_BAD_DESTINATION, 39 IP_ADDR_DELETED, 40 IP_SPEC_MTU_CHANGE, 41 IP_MTU_CHANGE, 42 IP_UNLOAD, // = IP_STATUS_BASE + 22 43 IP_GENERAL_FAILURE = IP_STATUS_BASE + 50, 44 MAX_IP_STATUS = IP_GENERAL_FAILURE, 45 IP_PENDING = IP_STATUS_BASE + 255 46 } 47 48 // IP header Flags values 49 const byte IP_FLAG_DF = 2; 50 51 // IP Option types 52 enum : ubyte { 53 IP_OPT_EOL = 0, 54 IP_OPT_NOP = 0x01, 55 IP_OPT_RR = 0x07, 56 IP_OPT_SECURITY = 0x82, 57 IP_OPT_LSRR = 0x83, 58 IP_OPT_SSRR = 0x89, 59 IP_OPT_TS = 0x44, 60 IP_OPT_SID = 0x88, 61 IP_OPT_ROUTER_ALERT = 0x94 62 } 63 64 const ubyte MAX_OPT_SIZE = 40; 65 66 alias uint IPAddr, IPMask, IP_STATUS; 67 68 struct IP_OPTION_INFORMATION { 69 ubyte Ttl; 70 ubyte Tos; 71 ubyte Flags; 72 ubyte OptionsSize; 73 ubyte* OptionsData; 74 } 75 alias IP_OPTION_INFORMATION* PIP_OPTION_INFORMATION; 76 77 struct ICMP_ECHO_REPLY { 78 IPAddr Address; 79 uint Status; 80 uint RoundTripTime; 81 ushort DataSize; 82 ushort Reserved; 83 void* Data; 84 IP_OPTION_INFORMATION Options; 85 } 86 alias ICMP_ECHO_REPLY* PICMP_ECHO_REPLY; 87 88 struct IP_ADAPTER_INDEX_MAP { 89 ULONG Index; 90 WCHAR[MAX_ADAPTER_NAME] Name; 91 } 92 alias IP_ADAPTER_INDEX_MAP* PIP_ADAPTER_INDEX_MAP; 93 94 struct IP_INTERFACE_INFO { 95 LONG NumAdapters; 96 IP_ADAPTER_INDEX_MAP[1] _Adapter; 97 98 IP_ADAPTER_INDEX_MAP* Adapter() { return _Adapter.ptr; } 99 } 100 alias IP_INTERFACE_INFO* PIP_INTERFACE_INFO; 101 102 struct IP_UNIDIRECTIONAL_ADAPTER_ADDRESS { 103 ULONG NumAdapters; 104 IPAddr[1] _Address; 105 106 IPAddr* Address() { return _Address.ptr; } 107 } 108 alias IP_UNIDIRECTIONAL_ADAPTER_ADDRESS* PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;