- improve WsControl error checking
[wine] / dlls / wsock32 / wscontrol.h
1 /* wscontrol.h
2  *
3  * This header file includes #defines, structure and type definitions,
4  * and function declarations that support the implementation of the
5  * (undocumented) Winsock 1 call WsControl.
6  *
7  * The functionality of WsControl was created by observing its behaviour
8  * in Windows 98, so there are likely to be bugs with the assumptions
9  * that were made.  A significant amount of help came from
10  * http://tangentsoft.net/wskfaq/articles/wscontrol.html , especially the
11  * trace by Thomas Divine (www.pcausa.net).
12  *
13  * Copyright 2000 James Hatheway
14  * Copyright 2003 Juan Lang
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29  */
30
31 #ifndef WSCONTROL_H_INCLUDED
32 #define WSCONTROL_H_INCLUDED
33
34 #define WSCTL_SUCCESS        0
35
36 /*
37  *      TCP/IP action codes.
38  */
39 #define WSCNTL_TCPIP_QUERY_INFO             0x00000000
40 #define WSCNTL_TCPIP_SET_INFO               0x00000001
41 #define WSCNTL_TCPIP_ICMP_ECHO              0x00000002
42 #define WSCNTL_TCPIP_TEST                   0x00000003
43
44
45 /* Structure of an entity ID */
46 typedef struct TDIEntityID
47 {
48    unsigned long tei_entity;
49    unsigned long tei_instance;
50 } TDIEntityID;
51
52 /* Structure of an object ID */
53 typedef struct TDIObjectID
54 {
55    TDIEntityID   toi_entity;
56    unsigned long toi_class;
57    unsigned long toi_type;
58    unsigned long toi_id;
59 } TDIObjectID;
60
61 #ifdef if_type
62 #undef if_type
63 #endif
64 #ifdef if_mtu
65 #undef if_mtu
66 #endif
67 #ifdef if_lastchange
68 #undef if_lastchange
69 #endif
70
71 #define MAX_PHYSADDR_SIZE    8
72 #define MAX_IFDESCR_LEN      256
73 typedef struct IFEntry
74 {
75    unsigned long if_index;
76    unsigned long if_type;
77    unsigned long if_mtu;
78    unsigned long if_speed;
79    unsigned long if_physaddrlen;
80    unsigned char if_physaddr[MAX_PHYSADDR_SIZE];
81    unsigned long if_adminstatus;
82    unsigned long if_operstatus;
83    unsigned long if_lastchange;
84    unsigned long if_inoctets;
85    unsigned long if_inucastpkts;
86    unsigned long if_innucastpkts;
87    unsigned long if_indiscards;
88    unsigned long if_inerrors;
89    unsigned long if_inunknownprotos;
90    unsigned long if_outoctets;
91    unsigned long if_outucastpkts;
92    unsigned long if_outnucastpkts;
93    unsigned long if_outdiscards;
94    unsigned long if_outerrors;
95    unsigned long if_outqlen;
96    unsigned long if_descrlen;
97    unsigned char if_descr[1];
98 } IFEntry;
99
100
101 /* FIXME: real name and definition of this struct that contains
102  * an IP route table entry is unknown */
103 typedef struct IPRouteEntry {
104    unsigned long ire_addr;
105    unsigned long ire_index;  /*matches if_index in IFEntry and iae_index in IPAddrEntry */
106    unsigned long ire_metric;
107    unsigned long ire_option4;
108    unsigned long ire_option5;
109    unsigned long ire_option6;
110    unsigned long ire_gw;
111    unsigned long ire_option8;
112    unsigned long ire_option9;
113    unsigned long ire_option10;
114    unsigned long ire_mask;
115    unsigned long ire_option12;
116 } IPRouteEntry;
117
118
119 /* Constants for use in the toi_id field */
120 #define ENTITY_LIST_ID 0 /* to get the list of entity IDs */
121 #define ENTITY_TYPE_ID 1 /* it's an interface; what type of interface is it? */
122 #define IP_MIB_ROUTETABLE_ENTRY_ID 0x101 /* not real name */
123 #define IP_MIB_ADDRTABLE_ENTRY_ID  0x102
124
125 /* Constants for use in the toi_class field */
126 #define INFO_CLASS_GENERIC  0x100
127 #define INFO_CLASS_PROTOCOL 0x200
128
129 /* Constants for use in the toi_type field */
130 #define INFO_TYPE_PROVIDER 0x100
131
132 /* Interface types.  The first one can be returned in the entity ID list--it's
133  * an interface, and it can be further queried for what type of interface it is.
134  */
135 #define IF_GENERIC 0x200 /* generic interface */
136 #define IF_MIB     0x202 /* supports MIB-2 interface */
137
138 /* address translation types.  The first can be turned in the entity ID list--
139  * it supports address translation of some type, and it can be further queried
140  * for what type of address translation it supports (I think).
141  */
142 #define AT_ENTITY 0x280
143 #define AT_ARP    0x280
144 #define AT_NULL   0x282 /* doesn't do address translation after all (liar) */
145
146 /* network layer service providers.  The first one can be returned in the
147  * entity list ID--it supports a network layer (datagram) service, and it can
148  * be further queried for what type of network layer service it provides.
149  */
150 #define CL_NL_ENTITY 0x301
151 #define CL_NL_IPX    0x301 /* implements IPX--probably won't see this, since
152                             * we're querying the TCP protocol */
153 #define CL_NL_IP     0x303 /* implements IP */
154
155 /* echo request/response types.  The first can be returned in the entity ID
156  * list--it can be further queried for what type of echo it supports (I think).
157  */
158 #define ER_ENTITY 0x380
159 #define ER_ICMP   0x380
160
161 /* connection-oriented transport layer protocols--you know the drill by now */
162 #define CO_TL_ENTITY 0x400
163 #define CO_TL_NBF    0x400
164 #define CO_TL_SPX    0x402
165 #define CO_TL_TCP    0x404
166 #define CO_TL_SPP    0x406
167
168 /* connectionless transport layer protocols--you know the drill by now */
169 #define CL_TL_ENTITY 0x401
170 #define CL_TL_NBF    0x401
171 #define CL_TL_UDP    0x403
172
173 #endif /* WSCONTROL_H_INCLUDED */