Sweden-Number/dlls/wsock32/wscontrol.h

207 lines
6.9 KiB
C
Raw Normal View History

/* wscontrol.h
*
* This header file includes #defines, structure and type definitions,
* and function declarations that support the implementation of the
* (undocumented) Winsock 1 call WsControl.
*
* The functionality of WsControl was created by observing its behaviour
* in Windows 98, so there are likely to be bugs with the assumptions
* that were made.
*
* Copyright 2000 James Hatheway
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WSCONTROL_H_INCLUDED
#define WSCONTROL_H_INCLUDED
typedef unsigned char uchar; /* This doesn't seem to be in any standard headers */
2002-06-01 01:06:46 +02:00
#define WSCTL_SUCCESS 0
#define PROCFS_NETDEV_FILE "/proc/net/dev" /* Points to the file in the /proc fs
that lists the network devices.
Do we need an #ifdef LINUX for this? */
#define PROCFS_ROUTE_FILE "/proc/net/route" /* Points to the file in the /proc fs
that contains the routing table */
#define WSCNTL_COUNT_INTERFACES 1
#define WSCNTL_COUNT_ROUTES 2
/* struct contains a routing table entry */
typedef struct wscntl_routeentry
{
unsigned long wre_intf;
unsigned long wre_dest;
unsigned long wre_gw;
unsigned long wre_mask;
unsigned long wre_metric;
} wscntl_routeentry;
/* WsControl Helper Functions */
int WSCNTL_GetEntryCount(const int); /* Obtains the number of network interfaces/routes */
int WSCNTL_GetInterfaceName(int, char *); /* Obtains the name of an interface */
int WSCNTL_GetTransRecvStat(int intNumber, unsigned long *transBytes,
unsigned long *recvBytes); /* Obtains bytes recv'd/trans by interface */
int WSCNTL_GetRouteTable(int numRoutes, wscntl_routeentry *routeTable); /* get the routing for the interface intf */
/*
* TCP/IP action codes.
*/
#define WSCNTL_TCPIP_QUERY_INFO 0x00000000
#define WSCNTL_TCPIP_SET_INFO 0x00000001
#define WSCNTL_TCPIP_ICMP_ECHO 0x00000002
#define WSCNTL_TCPIP_TEST 0x00000003
/* Structure of an entity ID */
2002-06-01 01:06:46 +02:00
typedef struct TDIEntityID
{
2000-07-25 19:45:50 +02:00
unsigned long tei_entity;
unsigned long tei_instance;
} TDIEntityID;
/* Structure of an object ID */
2002-06-01 01:06:46 +02:00
typedef struct TDIObjectID
{
2000-07-25 19:45:50 +02:00
TDIEntityID toi_entity;
unsigned long toi_class;
unsigned long toi_type;
unsigned long toi_id;
} TDIObjectID;
2002-06-01 01:06:46 +02:00
typedef struct IPSNMPInfo
{
2000-07-25 19:45:50 +02:00
unsigned long ipsi_forwarding;
unsigned long ipsi_defaultttl;
unsigned long ipsi_inreceives;
unsigned long ipsi_inhdrerrors;
unsigned long ipsi_inaddrerrors;
unsigned long ipsi_forwdatagrams;
unsigned long ipsi_inunknownprotos;
unsigned long ipsi_indiscards;
unsigned long ipsi_indelivers;
unsigned long ipsi_outrequests;
unsigned long ipsi_routingdiscards;
unsigned long ipsi_outdiscards;
unsigned long ipsi_outnoroutes;
unsigned long ipsi_reasmtimeout;
unsigned long ipsi_reasmreqds;
unsigned long ipsi_reasmoks;
unsigned long ipsi_reasmfails;
unsigned long ipsi_fragoks;
unsigned long ipsi_fragfails;
unsigned long ipsi_fragcreates;
unsigned long ipsi_numif;
unsigned long ipsi_numaddr;
unsigned long ipsi_numroutes;
} IPSNMPInfo;
2002-06-01 01:06:46 +02:00
typedef struct IPAddrEntry
{
2000-07-25 19:45:50 +02:00
unsigned long iae_addr;
unsigned long iae_index;
unsigned long iae_mask;
unsigned long iae_bcastaddr;
unsigned long iae_reasmsize;
ushort iae_context;
ushort iae_pad;
} IPAddrEntry;
2001-12-14 23:45:42 +01:00
#ifdef __NetBSD__
#undef if_type
#undef if_mtu
#undef if_lastchange
#endif
#define MAX_PHYSADDR_SIZE 8
#define MAX_IFDESCR_LEN 256
2002-06-01 01:06:46 +02:00
typedef struct IFEntry
{
2000-07-25 19:45:50 +02:00
unsigned long if_index;
unsigned long if_type;
unsigned long if_mtu;
unsigned long if_speed;
unsigned long if_physaddrlen;
uchar if_physaddr[MAX_PHYSADDR_SIZE];
unsigned long if_adminstatus;
unsigned long if_operstatus;
unsigned long if_lastchange;
unsigned long if_inoctets;
unsigned long if_inucastpkts;
unsigned long if_innucastpkts;
unsigned long if_indiscards;
unsigned long if_inerrors;
unsigned long if_inunknownprotos;
unsigned long if_outoctets;
unsigned long if_outucastpkts;
unsigned long if_outnucastpkts;
unsigned long if_outdiscards;
unsigned long if_outerrors;
unsigned long if_outqlen;
unsigned long if_descrlen;
uchar if_descr[1];
} IFEntry;
2002-06-01 01:06:46 +02:00
/* FIXME: real name and definition of this struct that contains
* an IP route table entry is unknown */
typedef struct IPRouteEntry {
unsigned long ire_addr;
2002-06-28 19:37:34 +02:00
unsigned long ire_index; /*matches if_index in IFEntry and iae_index in IPAddrEntry */
unsigned long ire_metric;
unsigned long ire_option4;
unsigned long ire_option5;
unsigned long ire_option6;
unsigned long ire_gw;
unsigned long ire_option8;
unsigned long ire_option9;
unsigned long ire_option10;
unsigned long ire_mask;
unsigned long ire_option12;
} IPRouteEntry;
/* Not sure what EXACTLY most of this stuff does.
WsControl was implemented mainly by observing
its behaviour in Win98 ************************/
#define INFO_CLASS_GENERIC 0x100
#define INFO_CLASS_PROTOCOL 0x200
#define INFO_TYPE_PROVIDER 0x100
#define ENTITY_LIST_ID 0
#define CL_NL_ENTITY 0x301
#define IF_ENTITY 0x200
#define ENTITY_TYPE_ID 1
#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102
#define IP_MIB_ROUTETABLE_ENTRY_ID 0x101 /* FIXME: not real name */
/************************************************/
/* Valid values to get back from entity type ID query */
#define CO_TL_NBF 0x400 /* Entity implements NBF prot. */
#define CO_TL_SPX 0x402 /* Entity implements SPX prot. */
#define CO_TL_TCP 0x404 /* Entity implements TCP prot. */
#define CO_TL_SPP 0x406 /* Entity implements SPP prot. */
#define CL_TL_NBF 0x401 /* CL NBF protocol */
#define CL_TL_UDP 0x403 /* Entity implements UDP */
#define ER_ICMP 0x380 /* The ICMP protocol */
#define CL_NL_IPX 0x301 /* Entity implements IPX */
#define CL_NL_IP 0x303 /* Entity implements IP */
#define AT_ARP 0x280 /* Entity implements ARP */
#define AT_NULL 0x282 /* Entity does no address */
#define IF_GENERIC 0x200 /* Generic interface */
#define IF_MIB 0x202 /* Supports MIB-2 interface */
#endif /* WSCONTROL_H_INCLUDED */