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.
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
12 #ifndef WSCONTROL_H_INCLUDED
13 #define WSCONTROL_H_INCLUDED
15 typedef unsigned char uchar; /* This doesn't seem to be in any standard headers */
17 #define WSCTL_SUCCESS 0
18 #define PROCFS_NETDEV_FILE "/proc/net/dev" /* Points to the file in the /proc fs
19 that lists the network devices.
20 Do we need an #ifdef LINUX for this? */
21 #define PROCFS_ROUTE_FILE "/proc/net/route" /* Points to the file in the /proc fs
22 that contains the routing table */
23 #define WSCNTL_COUNT_INTERFACES 1
24 #define WSCNTL_COUNT_ROUTES 2
26 /* struct contains a routing table entry */
27 typedef struct wscntl_routeentry
29 unsigned long wre_intf;
30 unsigned long wre_dest;
32 unsigned long wre_mask;
33 unsigned long wre_metric;
36 /* WsControl Helper Functions */
37 int WSCNTL_GetEntryCount(const int); /* Obtains the number of network interfaces/routes */
38 int WSCNTL_GetInterfaceName(int, char *); /* Obtains the name of an interface */
39 int WSCNTL_GetTransRecvStat(int intNumber, unsigned long *transBytes,
40 unsigned long *recvBytes); /* Obtains bytes recv'd/trans by interface */
41 int WSCNTL_GetRouteTable(int numRoutes, wscntl_routeentry *routeTable); /* get the routing for the interface intf */
44 * TCP/IP action codes.
46 #define WSCNTL_TCPIP_QUERY_INFO 0x00000000
47 #define WSCNTL_TCPIP_SET_INFO 0x00000001
48 #define WSCNTL_TCPIP_ICMP_ECHO 0x00000002
49 #define WSCNTL_TCPIP_TEST 0x00000003
52 /* Structure of an entity ID */
53 typedef struct TDIEntityID
55 unsigned long tei_entity;
56 unsigned long tei_instance;
59 /* Structure of an object ID */
60 typedef struct TDIObjectID
62 TDIEntityID toi_entity;
63 unsigned long toi_class;
64 unsigned long toi_type;
68 typedef struct IPSNMPInfo
70 unsigned long ipsi_forwarding;
71 unsigned long ipsi_defaultttl;
72 unsigned long ipsi_inreceives;
73 unsigned long ipsi_inhdrerrors;
74 unsigned long ipsi_inaddrerrors;
75 unsigned long ipsi_forwdatagrams;
76 unsigned long ipsi_inunknownprotos;
77 unsigned long ipsi_indiscards;
78 unsigned long ipsi_indelivers;
79 unsigned long ipsi_outrequests;
80 unsigned long ipsi_routingdiscards;
81 unsigned long ipsi_outdiscards;
82 unsigned long ipsi_outnoroutes;
83 unsigned long ipsi_reasmtimeout;
84 unsigned long ipsi_reasmreqds;
85 unsigned long ipsi_reasmoks;
86 unsigned long ipsi_reasmfails;
87 unsigned long ipsi_fragoks;
88 unsigned long ipsi_fragfails;
89 unsigned long ipsi_fragcreates;
90 unsigned long ipsi_numif;
91 unsigned long ipsi_numaddr;
92 unsigned long ipsi_numroutes;
95 typedef struct IPAddrEntry
97 unsigned long iae_addr;
98 unsigned long iae_index;
99 unsigned long iae_mask;
100 unsigned long iae_bcastaddr;
101 unsigned long iae_reasmsize;
112 #define MAX_PHYSADDR_SIZE 8
113 #define MAX_IFDESCR_LEN 256
114 typedef struct IFEntry
116 unsigned long if_index;
117 unsigned long if_type;
118 unsigned long if_mtu;
119 unsigned long if_speed;
120 unsigned long if_physaddrlen;
121 uchar if_physaddr[MAX_PHYSADDR_SIZE];
122 unsigned long if_adminstatus;
123 unsigned long if_operstatus;
124 unsigned long if_lastchange;
125 unsigned long if_inoctets;
126 unsigned long if_inucastpkts;
127 unsigned long if_innucastpkts;
128 unsigned long if_indiscards;
129 unsigned long if_inerrors;
130 unsigned long if_inunknownprotos;
131 unsigned long if_outoctets;
132 unsigned long if_outucastpkts;
133 unsigned long if_outnucastpkts;
134 unsigned long if_outdiscards;
135 unsigned long if_outerrors;
136 unsigned long if_outqlen;
137 unsigned long if_descrlen;
142 /* FIXME: real name and definition of this struct that contains
143 * an IP route table entry is unknown */
144 typedef struct IPRouteEntry {
145 unsigned long ire_addr;
146 unsigned long ire_index; //matches if_index in IFEntry and iae_index in IPAddrEntry
147 unsigned long ire_metric;
148 unsigned long ire_option4;
149 unsigned long ire_option5;
150 unsigned long ire_option6;
151 unsigned long ire_gw;
152 unsigned long ire_option8;
153 unsigned long ire_option9;
154 unsigned long ire_option10;
155 unsigned long ire_mask;
156 unsigned long ire_option12;
160 /* Not sure what EXACTLY most of this stuff does.
161 WsControl was implemented mainly by observing
162 its behaviour in Win98 ************************/
163 #define INFO_CLASS_GENERIC 0x100
164 #define INFO_CLASS_PROTOCOL 0x200
165 #define INFO_TYPE_PROVIDER 0x100
166 #define ENTITY_LIST_ID 0
167 #define CL_NL_ENTITY 0x301
168 #define IF_ENTITY 0x200
169 #define ENTITY_TYPE_ID 1
170 #define IP_MIB_ADDRTABLE_ENTRY_ID 0x102
171 #define IP_MIB_ROUTETABLE_ENTRY_ID 0x101 /* FIXME: not real name */
172 /************************************************/
174 /* Valid values to get back from entity type ID query */
175 #define CO_TL_NBF 0x400 /* Entity implements NBF prot. */
176 #define CO_TL_SPX 0x402 /* Entity implements SPX prot. */
177 #define CO_TL_TCP 0x404 /* Entity implements TCP prot. */
178 #define CO_TL_SPP 0x406 /* Entity implements SPP prot. */
179 #define CL_TL_NBF 0x401 /* CL NBF protocol */
180 #define CL_TL_UDP 0x403 /* Entity implements UDP */
181 #define ER_ICMP 0x380 /* The ICMP protocol */
182 #define CL_NL_IPX 0x301 /* Entity implements IPX */
183 #define CL_NL_IP 0x303 /* Entity implements IP */
184 #define AT_ARP 0x280 /* Entity implements ARP */
185 #define AT_NULL 0x282 /* Entity does no address */
186 #define IF_GENERIC 0x200 /* Generic interface */
187 #define IF_MIB 0x202 /* Supports MIB-2 interface */
190 #endif /* WSCONTROL_H_INCLUDED */