OSDN Git Service

_USE_32BIT_TIME_T resolution and prepare for release.
[mingw/mingw-org-wsl.git] / include / ipexport.h
1 /**
2  * @file ipexport.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _IPEXPORT_H
25 #define _IPEXPORT_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 #ifndef ANY_SIZE
33 #define ANY_SIZE 1
34 #endif
35 #define MAX_ADAPTER_NAME 128
36 /* IP STATUS flags */
37 #define IP_STATUS_BASE 11000
38 #define IP_SUCCESS  0
39 #define IP_BUF_TOO_SMALL    (IP_STATUS_BASE + 1)
40 #define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
41 #define IP_DEST_HOST_UNREACHABLE    (IP_STATUS_BASE + 3)
42 #define IP_DEST_PROT_UNREACHABLE    (IP_STATUS_BASE + 4)
43 #define IP_DEST_PORT_UNREACHABLE    (IP_STATUS_BASE + 5)
44 #define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
45 #define IP_BAD_OPTION   (IP_STATUS_BASE + 7)
46 #define IP_HW_ERROR (IP_STATUS_BASE + 8)
47 #define IP_PACKET_TOO_BIG   (IP_STATUS_BASE + 9)
48 #define IP_REQ_TIMED_OUT    (IP_STATUS_BASE + 10)
49 #define IP_BAD_REQ  (IP_STATUS_BASE + 11)
50 #define IP_BAD_ROUTE    (IP_STATUS_BASE + 12)
51 #define IP_TTL_EXPIRED_TRANSIT  (IP_STATUS_BASE + 13)
52 #define IP_TTL_EXPIRED_REASSEM  (IP_STATUS_BASE + 14)
53 #define IP_PARAM_PROBLEM    (IP_STATUS_BASE + 15)
54 #define IP_SOURCE_QUENCH    (IP_STATUS_BASE + 16)
55 #define IP_OPTION_TOO_BIG   (IP_STATUS_BASE + 17)
56 #define IP_BAD_DESTINATION  (IP_STATUS_BASE + 18)
57 #define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
58 #define IP_SPEC_MTU_CHANGE  (IP_STATUS_BASE + 20)
59 #define IP_MTU_CHANGE   (IP_STATUS_BASE + 21)
60 #define IP_UNLOAD   (IP_STATUS_BASE + 22)
61 #define IP_GENERAL_FAILURE  (IP_STATUS_BASE + 50)
62 #define MAX_IP_STATUS   IP_GENERAL_FAILURE
63 #define IP_PENDING  (IP_STATUS_BASE + 255)
64 /* IP header Flags values */
65 #define IP_FLAG_DF  0x2
66 /*  IP Option types */
67 #define IP_OPT_EOL  0
68 #define IP_OPT_NOP  1
69 #define IP_OPT_SECURITY 0x82
70 #define IP_OPT_LSRR 0x83
71 #define IP_OPT_SSRR 0x89
72 #define IP_OPT_RR   0x7
73 #define IP_OPT_TS   0x44
74 #define IP_OPT_SID  0x88
75 #define IP_OPT_ROUTER_ALERT 0x94
76 #define MAX_OPT_SIZE    40
77
78 typedef unsigned long IPAddr, IPMask, IP_STATUS;
79 typedef struct ip_option_information {
80   unsigned char Ttl;
81   unsigned char Tos;
82   unsigned char Flags;
83   unsigned char OptionsSize;
84   unsigned char* OptionsData;
85 }IP_OPTION_INFORMATION, *PIP_OPTION_INFORMATION;
86 typedef struct icmp_echo_reply {
87   IPAddr        Address;
88   unsigned long Status;
89   unsigned long RoundTripTime;
90   unsigned short    DataSize;
91   unsigned short    Reserved;
92   void* Data;
93   struct ip_option_information   Options;
94 } ICMP_ECHO_REPLY, *PICMP_ECHO_REPLY;
95 typedef struct {
96   ULONG Index;
97   WCHAR  Name[MAX_ADAPTER_NAME];
98 } IP_ADAPTER_INDEX_MAP, *PIP_ADAPTER_INDEX_MAP;
99 typedef struct {
100   LONG NumAdapters;
101   IP_ADAPTER_INDEX_MAP Adapter[ANY_SIZE];
102 } IP_INTERFACE_INFO, *PIP_INTERFACE_INFO;
103 typedef struct _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS {
104   ULONG NumAdapters;
105   IPAddr Address[1];
106 } IP_UNIDIRECTIONAL_ADAPTER_ADDRESS, *PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
107 #ifdef __cplusplus
108 }
109 #endif
110 #endif /* _IPEXPORT_H */