Commit 3fe2d6e5 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

include: Update the nldef.h and *mib.h headers.

parent 129f48a6
......@@ -21,6 +21,9 @@
#include <stdarg.h>
#include <stdlib.h>
#include <limits.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "snmp.h"
......@@ -669,7 +672,7 @@ static void mib2IpStatsInit(void)
}
static struct structToAsnValue mib2IpMap[] = {
{ FIELD_OFFSET(MIB_IPSTATS, dwForwarding), copyInt }, /* 1 */
{ FIELD_OFFSET(MIB_IPSTATS, u.dwForwarding), copyInt }, /* 1 */
{ FIELD_OFFSET(MIB_IPSTATS, dwDefaultTTL), copyInt }, /* 2 */
{ FIELD_OFFSET(MIB_IPSTATS, dwInReceives), copyInt }, /* 3 */
{ FIELD_OFFSET(MIB_IPSTATS, dwInHdrErrors), copyInt }, /* 4 */
......@@ -826,8 +829,8 @@ static struct structToAsnValue mib2IpRouteMap[] = {
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardMetric3), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardMetric4), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardNextHop), copyIpAddr },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardType), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardProto), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, u1.dwForwardType), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, u2.dwForwardProto), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardAge), copyInt },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardMask), copyIpAddr },
{ FIELD_OFFSET(MIB_IPFORWARDROW, dwForwardMetric5), copyInt },
......@@ -924,7 +927,7 @@ static struct structToAsnValue mib2IpNetMap[] = {
{ FIELD_OFFSET(MIB_IPNETROW, dwIndex), copyInt },
{ FIELD_OFFSET(MIB_IPNETROW, dwPhysAddrLen), copyIpNetPhysAddr },
{ FIELD_OFFSET(MIB_IPNETROW, dwAddr), copyIpAddr },
{ FIELD_OFFSET(MIB_IPNETROW, dwType), copyInt },
{ FIELD_OFFSET(MIB_IPNETROW, u.dwType), copyInt },
};
static void mib2IpNetInit(void)
......@@ -1079,7 +1082,7 @@ static void mib2TcpInit(void)
}
static struct structToAsnValue mib2TcpMap[] = {
{ FIELD_OFFSET(MIB_TCPSTATS, dwRtoAlgorithm), copyInt },
{ FIELD_OFFSET(MIB_TCPSTATS, u.dwRtoAlgorithm), copyInt },
{ FIELD_OFFSET(MIB_TCPSTATS, dwRtoMin), copyInt },
{ FIELD_OFFSET(MIB_TCPSTATS, dwRtoMax), copyInt },
{ FIELD_OFFSET(MIB_TCPSTATS, dwMaxConn), copyInt },
......
......@@ -122,12 +122,12 @@ static int isLoopbackInterface(int fd, const char *name)
/* The comments say MAX_ADAPTER_NAME is required, but really only IF_NAMESIZE
* bytes are necessary.
*/
char *getInterfaceNameByIndex(DWORD index, char *name)
char *getInterfaceNameByIndex(IF_INDEX index, char *name)
{
return if_indextoname(index, name);
}
DWORD getInterfaceIndexByName(const char *name, PDWORD index)
DWORD getInterfaceIndexByName(const char *name, IF_INDEX *index)
{
DWORD ret;
unsigned int idx;
......@@ -542,7 +542,7 @@ static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr
}
#endif
DWORD getInterfacePhysicalByIndex(DWORD index, PDWORD len, PBYTE addr,
DWORD getInterfacePhysicalByIndex(IF_INDEX index, PDWORD len, PBYTE addr,
PDWORD type)
{
char nameBuf[IF_NAMESIZE];
......@@ -752,7 +752,7 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags)
return ret;
}
ULONG v6addressesFromIndex(DWORD index, SOCKET_ADDRESS **addrs, ULONG *num_addrs)
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs)
{
struct ifaddrs *ifa;
ULONG ret;
......@@ -937,7 +937,7 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags)
return ret;
}
ULONG v6addressesFromIndex(DWORD index, SOCKET_ADDRESS **addrs, ULONG *num_addrs)
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs)
{
*addrs = NULL;
*num_addrs = 0;
......
......@@ -51,7 +51,7 @@ BOOL isIfIndexLoopback(ULONG idx) DECLSPEC_HIDDEN;
/* A table of interface indexes, see get*InterfaceTable(). */
typedef struct _InterfaceIndexTable {
DWORD numIndexes;
DWORD indexes[1];
IF_INDEX indexes[1];
} InterfaceIndexTable;
/* Returns a table with all known interface indexes, or NULL if one could not
......@@ -68,13 +68,13 @@ InterfaceIndexTable *getNonLoopbackInterfaceIndexTable(void) DECLSPEC_HIDDEN;
* if not. Overwrites your buffer, which should be at least of size
* MAX_ADAPTER_NAME.
*/
char *getInterfaceNameByIndex(DWORD index, char *name) DECLSPEC_HIDDEN;
char *getInterfaceNameByIndex(IF_INDEX index, char *name) DECLSPEC_HIDDEN;
/* Fills index with the index of name, if found. Returns
* ERROR_INVALID_PARAMETER if name or index is NULL, ERROR_INVALID_DATA if name
* is not found, and NO_ERROR on success.
*/
DWORD getInterfaceIndexByName(const char *name, PDWORD index) DECLSPEC_HIDDEN;
DWORD getInterfaceIndexByName(const char *name, IF_INDEX *index) DECLSPEC_HIDDEN;
/* Gets a few physical characteristics of a device: MAC addr len, MAC addr,
* and type as one of the MIB_IF_TYPEs.
......@@ -89,7 +89,7 @@ DWORD getInterfaceIndexByName(const char *name, PDWORD index) DECLSPEC_HIDDEN;
* if internal errors occur.
* Returns NO_ERROR on success.
*/
DWORD getInterfacePhysicalByIndex(DWORD index, PDWORD len, PBYTE addr,
DWORD getInterfacePhysicalByIndex(IF_INDEX index, PDWORD len, PBYTE addr,
PDWORD type) DECLSPEC_HIDDEN;
/* Fills in the MIB_IFROW by name. Doesn't fill in interface statistics,
......@@ -111,7 +111,7 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags)
/* Returns the IPv6 addresses for a particular interface index.
* Returns NO_ERROR on success, something else on failure.
*/
ULONG v6addressesFromIndex(DWORD index, SOCKET_ADDRESS **addrs, ULONG *num_addrs) DECLSPEC_HIDDEN;
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs) DECLSPEC_HIDDEN;
/* Converts the network-order bytes in addr to a printable string. Returns
* string.
......
......@@ -583,7 +583,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
* is the default gateway for this adapter */
for (i = 0; i < routeTable->dwNumEntries; i++)
if (routeTable->table[i].dwForwardIfIndex == ptr->Index
&& routeTable->table[i].dwForwardType ==
&& routeTable->table[i].u1.ForwardType ==
MIB_IPROUTE_TYPE_INDIRECT)
toIPAddressString(routeTable->table[i].dwForwardNextHop,
ptr->GatewayList.IpAddress.String);
......@@ -628,7 +628,7 @@ static DWORD typeFromMibType(DWORD mib_type)
}
}
static DWORD connectionTypeFromMibType(DWORD mib_type)
static NET_IF_CONNECTION_TYPE connectionTypeFromMibType(DWORD mib_type)
{
switch (mib_type)
{
......@@ -638,7 +638,7 @@ static DWORD connectionTypeFromMibType(DWORD mib_type)
}
}
static ULONG v4addressesFromIndex(DWORD index, DWORD **addrs, ULONG *num_addrs)
static ULONG v4addressesFromIndex(IF_INDEX index, DWORD **addrs, ULONG *num_addrs)
{
ULONG ret, i, j;
MIB_IPADDRTABLE *at;
......@@ -715,7 +715,7 @@ static ULONG count_v4_gateways(DWORD index, PMIB_IPFORWARDTABLE routeTable)
for (i = 0; i < routeTable->dwNumEntries; i++)
{
if (routeTable->table[i].dwForwardIfIndex == index &&
routeTable->table[i].dwForwardType == MIB_IPROUTE_TYPE_INDIRECT)
routeTable->table[i].u1.ForwardType == MIB_IPROUTE_TYPE_INDIRECT)
num_gateways++;
}
return num_gateways;
......@@ -730,13 +730,13 @@ static PMIB_IPFORWARDROW findIPv4Gateway(DWORD index,
for (i = 0; !row && i < routeTable->dwNumEntries; i++)
{
if (routeTable->table[i].dwForwardIfIndex == index &&
routeTable->table[i].dwForwardType == MIB_IPROUTE_TYPE_INDIRECT)
routeTable->table[i].u1.ForwardType == MIB_IPROUTE_TYPE_INDIRECT)
row = &routeTable->table[i];
}
return row;
}
static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, DWORD index,
static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index,
IP_ADAPTER_ADDRESSES *aa, ULONG *size)
{
ULONG ret = ERROR_SUCCESS, i, num_v4addrs = 0, num_v4_gateways = 0, num_v6addrs = 0, total_size;
......@@ -1212,7 +1212,7 @@ DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDRO
DWORD ndx, matchedBits, matchedNdx = table->dwNumEntries;
for (ndx = 0, matchedBits = 0; ndx < table->dwNumEntries; ndx++) {
if (table->table[ndx].dwForwardType != MIB_IPROUTE_TYPE_INVALID &&
if (table->table[ndx].u1.ForwardType != MIB_IPROUTE_TYPE_INVALID &&
(dwDestAddr & table->table[ndx].dwForwardMask) ==
(table->table[ndx].dwForwardDest & table->table[ndx].dwForwardMask)) {
DWORD numShifts, mask;
......
......@@ -129,6 +129,7 @@
#define ADVANCE(x, n) (x += ROUNDUP(((struct sockaddr *)n)->sa_len))
#endif
#define NONAMELESSUNION
#include "ifenum.h"
#include "ipstats.h"
......@@ -590,7 +591,7 @@ DWORD WINAPI GetIpStatistics(PMIB_IPSTATS stats)
{
ptr += sizeof(hdr);
sscanf( ptr, "%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u",
&stats->dwForwarding,
&stats->u.dwForwarding,
&stats->dwDefaultTTL,
&stats->dwInReceives,
&stats->dwInHdrErrors,
......@@ -628,7 +629,7 @@ DWORD WINAPI GetIpStatistics(PMIB_IPSTATS stats)
kstat_read( kc, ksp, NULL ) != -1 &&
ksp->ks_type == KSTAT_TYPE_NAMED)
{
stats->dwForwarding = kstat_get_ui32( ksp, "forwarding" );
stats->u.dwForwarding = kstat_get_ui32( ksp, "forwarding" );
stats->dwDefaultTTL = kstat_get_ui32( ksp, "defaultTTL" );
stats->dwInReceives = kstat_get_ui32( ksp, "inReceives" );
stats->dwInHdrErrors = kstat_get_ui32( ksp, "inHdrErrors" );
......@@ -681,7 +682,7 @@ DWORD WINAPI GetIpStatistics(PMIB_IPSTATS stats)
return ERROR_NOT_SUPPORTED;
}
stats->dwForwarding = ip_forwarding;
stats->u.dwForwarding = ip_forwarding;
stats->dwDefaultTTL = ip_ttl;
stats->dwInDelivers = ip_stat.ips_delivered;
stats->dwInHdrErrors = ip_stat.ips_badhlen + ip_stat.ips_badsum + ip_stat.ips_tooshort + ip_stat.ips_badlen;
......@@ -745,7 +746,7 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
{
ptr += sizeof(hdr);
sscanf( ptr, "%u %u %u %u %u %u %u %u %u %u %u %u %u %u",
&stats->dwRtoAlgorithm,
&stats->u.dwRtoAlgorithm,
&stats->dwRtoMin,
&stats->dwRtoMax,
&stats->dwMaxConn,
......@@ -782,7 +783,7 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
kstat_read( kc, ksp, NULL ) != -1 &&
ksp->ks_type == KSTAT_TYPE_NAMED)
{
stats->dwRtoAlgorithm = kstat_get_ui32( ksp, "rtoAlgorithm" );
stats->u.dwRtoAlgorithm = kstat_get_ui32( ksp, "rtoAlgorithm" );
stats->dwRtoMin = kstat_get_ui32( ksp, "rtoMin" );
stats->dwRtoMax = kstat_get_ui32( ksp, "rtoMax" );
stats->dwMaxConn = kstat_get_ui32( ksp, "maxConn" );
......@@ -815,7 +816,7 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
if(sysctl(mib, MIB_LEN, &tcp_stat, &needed, NULL, 0) != -1)
{
stats->dwRtoAlgorithm = MIB_TCP_RTO_VANJ;
stats->u.RtoAlgorithm = MIB_TCP_RTO_VANJ;
stats->dwRtoMin = TCPTV_MIN;
stats->dwRtoMax = TCPTV_REXMTMAX;
stats->dwMaxConn = -1;
......@@ -970,7 +971,7 @@ static int compare_ipforward_rows(const void *a, const void *b)
int ret;
if ((ret = rowA->dwForwardDest - rowB->dwForwardDest) != 0) return ret;
if ((ret = rowA->dwForwardProto - rowB->dwForwardProto) != 0) return ret;
if ((ret = rowA->u2.dwForwardProto - rowB->u2.dwForwardProto) != 0) return ret;
if ((ret = rowA->dwForwardPolicy - rowB->dwForwardPolicy) != 0) return ret;
return rowA->dwForwardNextHop - rowB->dwForwardNextHop;
}
......@@ -1032,9 +1033,9 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
row.dwForwardNextHop = strtoul(ptr + 1, &ptr, 16);
flags = strtoul(ptr + 1, &ptr, 16);
if (!(flags & RTF_UP)) row.dwForwardType = MIB_IPROUTE_TYPE_INVALID;
else if (flags & RTF_GATEWAY) row.dwForwardType = MIB_IPROUTE_TYPE_INDIRECT;
else row.dwForwardType = MIB_IPROUTE_TYPE_DIRECT;
if (!(flags & RTF_UP)) row.u1.ForwardType = MIB_IPROUTE_TYPE_INVALID;
else if (flags & RTF_GATEWAY) row.u1.ForwardType = MIB_IPROUTE_TYPE_INDIRECT;
else row.u1.ForwardType = MIB_IPROUTE_TYPE_DIRECT;
strtoul(ptr + 1, &ptr, 16); /* refcount, skip */
strtoul(ptr + 1, &ptr, 16); /* use, skip */
......@@ -1042,7 +1043,7 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
row.dwForwardMask = strtoul(ptr + 1, &ptr, 16);
/* FIXME: other protos might be appropriate, e.g. the default
* route is typically set with MIB_IPPROTO_NETMGMT instead */
row.dwForwardProto = MIB_IPPROTO_LOCAL;
row.u2.ForwardProto = MIB_IPPROTO_LOCAL;
if (!(table = append_ipforward_row( heap, flags, table, &count, &row )))
break;
......@@ -1068,8 +1069,8 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
row.dwForwardMask = entry->ipRouteMask;
row.dwForwardPolicy = 0;
row.dwForwardNextHop = entry->ipRouteNextHop;
row.dwForwardType = entry->ipRouteType;
row.dwForwardProto = entry->ipRouteProto;
row.u1.dwForwardType = entry->ipRouteType;
row.u2.dwForwardProto = entry->ipRouteProto;
row.dwForwardAge = entry->ipRouteAge;
row.dwForwardNextHopAS = 0;
row.dwForwardMetric1 = entry->ipRouteMetric1;
......@@ -1138,9 +1139,9 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
memset( &row, 0, sizeof(row) );
row.dwForwardIfIndex = rtm->rtm_index;
row.dwForwardType = MIB_IPROUTE_TYPE_INDIRECT;
row.u1.ForwardType = MIB_IPROUTE_TYPE_INDIRECT;
row.dwForwardMetric1 = rtm->rtm_rmx.rmx_hopcount;
row.dwForwardProto = MIB_IPPROTO_LOCAL;
row.u2.ForwardProto = MIB_IPPROTO_LOCAL;
addrPtr = (char *)(rtm + 1);
......@@ -1288,14 +1289,14 @@ DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BO
flags = strtoul(ptr + 1, &ptr, 16);
#ifdef ATF_COM
if (flags & ATF_COM) row.dwType = MIB_IPNET_TYPE_DYNAMIC;
if (flags & ATF_COM) row.u.Type = MIB_IPNET_TYPE_DYNAMIC;
else
#endif
#ifdef ATF_PERM
if (flags & ATF_PERM) row.dwType = MIB_IPNET_TYPE_STATIC;
if (flags & ATF_PERM) row.u.Type = MIB_IPNET_TYPE_STATIC;
else
#endif
row.dwType = MIB_IPNET_TYPE_OTHER;
row.u.Type = MIB_IPNET_TYPE_OTHER;
while (*ptr && isspace(*ptr)) ptr++;
while (*ptr && !isspace(*ptr))
......@@ -1331,7 +1332,7 @@ DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BO
row.dwPhysAddrLen = min( entry->ipNetToMediaPhysAddress.o_length, MAXLEN_PHYSADDR );
memcpy( row.bPhysAddr, entry->ipNetToMediaPhysAddress.o_bytes, row.dwPhysAddrLen );
row.dwAddr = entry->ipNetToMediaNetAddress;
row.dwType = entry->ipNetToMediaType;
row.u.Type = entry->ipNetToMediaType;
namelen = min( sizeof(name) - 1, entry->ipNetToMediaIfIndex.o_length );
memcpy( name, entry->ipNetToMediaIfIndex.o_bytes, namelen );
name[namelen] = 0;
......@@ -1388,10 +1389,10 @@ DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BO
row.dwIndex = sdl->sdl_index;
row.dwPhysAddrLen = min( 8, sdl->sdl_alen );
memcpy( row.bPhysAddr, &sdl->sdl_data[sdl->sdl_nlen], row.dwPhysAddrLen );
if(rtm->rtm_rmx.rmx_expire == 0) row.dwType = MIB_IPNET_TYPE_STATIC;
else if(sinarp->sin_other & SIN_PROXY) row.dwType = MIB_IPNET_TYPE_OTHER;
else if(rtm->rtm_rmx.rmx_expire != 0) row.dwType = MIB_IPNET_TYPE_DYNAMIC;
else row.dwType = MIB_IPNET_TYPE_INVALID;
if(rtm->rtm_rmx.rmx_expire == 0) row.u.Type = MIB_IPNET_TYPE_STATIC;
else if(sinarp->sin_other & SIN_PROXY) row.u.Type = MIB_IPNET_TYPE_OTHER;
else if(rtm->rtm_rmx.rmx_expire != 0) row.u.Type = MIB_IPNET_TYPE_DYNAMIC;
else row.u.Type = MIB_IPNET_TYPE_INVALID;
if (!(table = append_ipnet_row( heap, flags, table, &count, &row )))
break;
......@@ -1639,7 +1640,7 @@ static MIB_TCPTABLE *append_tcp_row( HANDLE heap, DWORD flags, MIB_TCPTABLE *tab
/* Why not a lookup table? Because the TCPS_* constants are different
on different platforms */
static inline DWORD TCPStateToMIBState (int state)
static inline MIB_TCP_STATE TCPStateToMIBState (int state)
{
switch (state)
{
......@@ -1720,11 +1721,11 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack( PMIB_TCPTABLE *ppTcpTable, BOOL bO
while ((ptr = fgets(buf, sizeof(buf), fp)))
{
if (sscanf( ptr, "%x: %x:%x %x:%x %x", &dummy, &row.dwLocalAddr, &row.dwLocalPort,
&row.dwRemoteAddr, &row.dwRemotePort, &row.dwState ) != 6)
&row.dwRemoteAddr, &row.dwRemotePort, &row.u.dwState ) != 6)
continue;
row.dwLocalPort = htons( row.dwLocalPort );
row.dwRemotePort = htons( row.dwRemotePort );
row.dwState = TCPStateToMIBState( row.dwState );
row.u.State = TCPStateToMIBState( row.u.dwState );
if (!(table = append_tcp_row( heap, flags, table, &count, &row )))
break;
}
......@@ -1748,7 +1749,7 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack( PMIB_TCPTABLE *ppTcpTable, BOOL bO
row.dwLocalPort = htons( entry->tcpConnLocalPort );
row.dwRemoteAddr = entry->tcpConnRemAddress;
row.dwRemotePort = htons( entry->tcpConnRemPort );
row.dwState = entry->tcpConnState;
row.u.dwState = entry->tcpConnState;
if (!(table = append_tcp_row( heap, flags, table, &count, &row ))) break;
}
HeapFree( GetProcessHeap(), 0, data );
......@@ -1827,7 +1828,7 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack( PMIB_TCPTABLE *ppTcpTable, BOOL bO
row.dwLocalPort = pINData->inp_lport;
row.dwRemoteAddr = pINData->inp_faddr.s_addr;
row.dwRemotePort = pINData->inp_fport;
row.dwState = TCPStateToMIBState (pTCPData->t_state);
row.u.State = TCPStateToMIBState (pTCPData->t_state);
if (!(table = append_tcp_row( heap, flags, table, &count, &row ))) break;
}
......
......@@ -354,7 +354,7 @@ static void testGetIpForwardTable(void)
sprintf( buffer + strlen(buffer), " mask %s", ntoa( buf->table[i].dwForwardMask ));
trace( "%u: %s gw %s if %u type %u\n", i, buffer,
ntoa( buf->table[i].dwForwardNextHop ),
buf->table[i].dwForwardIfIndex, buf->table[i].dwForwardType );
buf->table[i].dwForwardIfIndex, U1(buf->table[i]).dwForwardType );
}
}
HeapFree(GetProcessHeap(), 0, buf);
......@@ -474,7 +474,7 @@ static void testGetIpStatistics(void)
if (apiReturn == NO_ERROR && winetest_debug > 1)
{
trace( "IP stats:\n" );
trace( " dwForwarding: %u\n", stats.dwForwarding );
trace( " dwForwarding: %u\n", U(stats).dwForwarding );
trace( " dwDefaultTTL: %u\n", stats.dwDefaultTTL );
trace( " dwInReceives: %u\n", stats.dwInReceives );
trace( " dwInHdrErrors: %u\n", stats.dwInHdrErrors );
......@@ -521,7 +521,7 @@ static void testGetTcpStatistics(void)
if (apiReturn == NO_ERROR && winetest_debug > 1)
{
trace( "TCP stats:\n" );
trace( " dwRtoAlgorithm: %u\n", stats.dwRtoAlgorithm );
trace( " dwRtoAlgorithm: %u\n", U(stats).dwRtoAlgorithm );
trace( " dwRtoMin: %u\n", stats.dwRtoMin );
trace( " dwRtoMax: %u\n", stats.dwRtoMax );
trace( " dwMaxConn: %u\n", stats.dwMaxConn );
......@@ -603,7 +603,7 @@ static void testGetTcpTable(void)
ntoa(buf->table[i].dwLocalAddr), ntohs(buf->table[i].dwLocalPort) );
trace( "%u: %s remote %s:%u state %u\n",
i, buffer, ntoa( buf->table[i].dwRemoteAddr ),
ntohs(buf->table[i].dwRemotePort), buf->table[i].dwState );
ntohs(buf->table[i].dwRemotePort), U(buf->table[i]).dwState );
}
}
HeapFree(GetProcessHeap(), 0, buf);
......
......@@ -321,7 +321,7 @@ struct per_thread_data
/* internal: routing description information */
struct route {
struct in_addr addr;
DWORD interface;
IF_INDEX interface;
DWORD metric;
};
......@@ -4487,9 +4487,10 @@ static struct WS_hostent* WS_get_local_ips( char *hostname )
/* Store the interface associated with each route */
for (i = 0; i < routes->dwNumEntries; i++)
{
DWORD ifindex, ifmetric, exists = FALSE;
IF_INDEX ifindex;
DWORD ifmetric, exists = FALSE;
if (routes->table[i].dwForwardType != MIB_IPROUTE_TYPE_DIRECT)
if (routes->table[i].u1.ForwardType != MIB_IPROUTE_TYPE_DIRECT)
continue;
ifindex = routes->table[i].dwForwardIfIndex;
ifmetric = routes->table[i].dwForwardMetric1;
......
......@@ -20,6 +20,11 @@
#include <ifdef.h>
typedef struct _MIB_IFNUMBER
{
DWORD dwValue;
} MIB_IFNUMBER, *PMIB_IFNUMBER;
/* Interface table */
......@@ -35,9 +40,9 @@ typedef struct _MIB_IFROW
DWORD dwMtu;
DWORD dwSpeed;
DWORD dwPhysAddrLen;
BYTE bPhysAddr[MAXLEN_PHYSADDR];
UCHAR bPhysAddr[MAXLEN_PHYSADDR];
DWORD dwAdminStatus;
DWORD dwOperStatus;
INTERNAL_IF_OPER_STATUS dwOperStatus;
DWORD dwLastChange;
DWORD dwInOctets;
DWORD dwInUcastPkts;
......
......@@ -27,7 +27,7 @@
typedef struct _MIB_IPADDRROW
{
DWORD dwAddr;
DWORD dwIndex;
IF_INDEX dwIndex;
DWORD dwMask;
DWORD dwBCastAddr;
DWORD dwReasmSize;
......@@ -49,10 +49,15 @@ typedef struct _MIB_IPFORWARDNUMBER
DWORD dwValue;
} MIB_IPFORWARDNUMBER, *PMIB_IPFORWARDNUMBER;
#define MIB_IPROUTE_TYPE_OTHER 1
#define MIB_IPROUTE_TYPE_INVALID 2
#define MIB_IPROUTE_TYPE_DIRECT 3
#define MIB_IPROUTE_TYPE_INDIRECT 4
typedef enum
{
MIB_IPROUTE_TYPE_OTHER = 1,
MIB_IPROUTE_TYPE_INVALID = 2,
MIB_IPROUTE_TYPE_DIRECT = 3,
MIB_IPROUTE_TYPE_INDIRECT = 4,
} MIB_IPFORWARD_TYPE;
typedef NL_ROUTE_PROTOCOL MIB_IPFORWARD_PROTO;
typedef struct _MIB_IPFORWARDROW
{
......@@ -60,9 +65,17 @@ typedef struct _MIB_IPFORWARDROW
DWORD dwForwardMask;
DWORD dwForwardPolicy;
DWORD dwForwardNextHop;
DWORD dwForwardIfIndex;
DWORD dwForwardType;
DWORD dwForwardProto;
IF_INDEX dwForwardIfIndex;
union
{
DWORD dwForwardType;
MIB_IPFORWARD_TYPE ForwardType;
} DUMMYUNIONNAME1;
union
{
DWORD dwForwardProto;
MIB_IPFORWARD_PROTO ForwardProto;
} DUMMYUNIONNAME2;
DWORD dwForwardAge;
DWORD dwForwardNextHopAS;
DWORD dwForwardMetric1;
......@@ -81,10 +94,13 @@ typedef struct _MIB_IPFORWARDTABLE
/* IPNET table */
#define MIB_IPNET_TYPE_OTHER 1
#define MIB_IPNET_TYPE_INVALID 2
#define MIB_IPNET_TYPE_DYNAMIC 3
#define MIB_IPNET_TYPE_STATIC 4
typedef enum
{
MIB_IPNET_TYPE_OTHER = 1,
MIB_IPNET_TYPE_INVALID = 2,
MIB_IPNET_TYPE_DYNAMIC = 3,
MIB_IPNET_TYPE_STATIC = 4,
} MIB_IPNET_TYPE;
typedef struct _MIB_IPNETROW
{
......@@ -92,7 +108,11 @@ typedef struct _MIB_IPNETROW
DWORD dwPhysAddrLen;
BYTE bPhysAddr[MAXLEN_PHYSADDR];
DWORD dwAddr;
DWORD dwType;
union
{
DWORD dwType;
MIB_IPNET_TYPE Type;
} DUMMYUNIONNAME;
} MIB_IPNETROW, *PMIB_IPNETROW;
typedef struct _MIB_IPNETTABLE
......@@ -104,9 +124,19 @@ typedef struct _MIB_IPNETTABLE
/* IP statistics */
typedef enum
{
MIB_IP_FORWARDING = 1,
MIB_IP_NOT_FORWARDING = 2,
} MIB_IPSTATS_FORWARDING, *PMIB_IPSTATS_FORWARDING;
typedef struct _MIB_IPSTATS
{
DWORD dwForwarding;
union
{
DWORD dwForwarding;
MIB_IPSTATS_FORWARDING Forwarding;
} DUMMYUNIONNAME;
DWORD dwDefaultTTL;
DWORD dwInReceives;
DWORD dwInHdrErrors;
......@@ -149,7 +179,7 @@ typedef struct _MIBICMPSTATS
DWORD dwTimestampReps;
DWORD dwAddrMasks;
DWORD dwAddrMaskReps;
} MIBICMPSTATS;
} MIBICMPSTATS, *PMIBICMPSTATS;
typedef struct _MIBICMPINFO
{
......
......@@ -48,23 +48,32 @@ typedef enum
IpDadStatePreferred,
} NL_DAD_STATE;
#define MIB_IPPROTO_OTHER 1
#define MIB_IPPROTO_LOCAL 2
#define MIB_IPPROTO_NETMGMT 3
#define MIB_IPPROTO_ICMP 4
#define MIB_IPPROTO_EGP 5
#define MIB_IPPROTO_GGP 6
#define MIB_IPPROTO_HELLO 7
#define MIB_IPPROTO_RIP 8
#define MIB_IPPROTO_IS_IS 9
#define MIB_IPPROTO_ES_IS 10
#define MIB_IPPROTO_CISCO 11
#define MIB_IPPROTO_BBN 12
#define MIB_IPPROTO_OSPF 13
#define MIB_IPPROTO_BGP 14
#define MIB_IPPROTO_NT_AUTOSTATIC 10002
#define MIB_IPPROTO_NT_STATIC 10006
#define MIB_IPPROTO_NT_STATIC_NON_DOD 10007
typedef enum
{
#define MAKE_ROUTE_PROTOCOL(name, value) \
MIB_IPPROTO_ ## name = value, \
PROTO_IP_ ## name = value
MAKE_ROUTE_PROTOCOL(OTHER, 1),
MAKE_ROUTE_PROTOCOL(LOCAL, 2),
MAKE_ROUTE_PROTOCOL(NETMGMT, 3),
MAKE_ROUTE_PROTOCOL(ICMP, 4),
MAKE_ROUTE_PROTOCOL(EGP, 5),
MAKE_ROUTE_PROTOCOL(GGP, 6),
MAKE_ROUTE_PROTOCOL(HELLO, 7),
MAKE_ROUTE_PROTOCOL(RIP, 8),
MAKE_ROUTE_PROTOCOL(IS_IS, 9),
MAKE_ROUTE_PROTOCOL(ES_IS, 10),
MAKE_ROUTE_PROTOCOL(CISCO, 11),
MAKE_ROUTE_PROTOCOL(BBN, 12),
MAKE_ROUTE_PROTOCOL(OSPF, 13),
MAKE_ROUTE_PROTOCOL(BGP, 14),
MAKE_ROUTE_PROTOCOL(NT_AUTOSTATIC, 10002),
MAKE_ROUTE_PROTOCOL(NT_STATIC, 10006),
MAKE_ROUTE_PROTOCOL(NT_STATIC_NON_DOD, 10007),
} NL_ROUTE_PROTOCOL, *PNL_ROUTE_PROTOCOL;
#endif /* __WINE_NLDEF_H */
......@@ -18,25 +18,43 @@
#ifndef __WINE_TCPMIB_H
#define __WINE_TCPMIB_H
#define TCPIP_OWNING_MODULE_SIZE 16
/* TCP tables */
#define MIB_TCP_STATE_CLOSED 1
#define MIB_TCP_STATE_LISTEN 2
#define MIB_TCP_STATE_SYN_SENT 3
#define MIB_TCP_STATE_SYN_RCVD 4
#define MIB_TCP_STATE_ESTAB 5
#define MIB_TCP_STATE_FIN_WAIT1 6
#define MIB_TCP_STATE_FIN_WAIT2 7
#define MIB_TCP_STATE_CLOSE_WAIT 8
#define MIB_TCP_STATE_CLOSING 9
#define MIB_TCP_STATE_LAST_ACK 10
#define MIB_TCP_STATE_TIME_WAIT 11
#define MIB_TCP_STATE_DELETE_TCB 12
typedef enum
{
MIB_TCP_STATE_CLOSED = 1,
MIB_TCP_STATE_LISTEN = 2,
MIB_TCP_STATE_SYN_SENT = 3,
MIB_TCP_STATE_SYN_RCVD = 4,
MIB_TCP_STATE_ESTAB = 5,
MIB_TCP_STATE_FIN_WAIT1 = 6,
MIB_TCP_STATE_FIN_WAIT2 = 7,
MIB_TCP_STATE_CLOSE_WAIT = 8,
MIB_TCP_STATE_CLOSING = 9,
MIB_TCP_STATE_LAST_ACK = 10,
MIB_TCP_STATE_TIME_WAIT = 11,
MIB_TCP_STATE_DELETE_TCB = 12,
} MIB_TCP_STATE;
typedef enum
{
TcpConnectionOffloadStateInHost,
TcpConnectionOffloadStateOffloading,
TcpConnectionOffloadStateOffloaded,
TcpConnectionOffloadStateUploading,
TcpConnectionOffloadStateMax,
} TCP_CONNECTION_OFFLOAD_STATE, *PTCP_CONNECTION_OFFLOAD_STATE;
typedef struct _MIB_TCPROW
{
DWORD dwState;
union
{
DWORD dwState;
MIB_TCP_STATE State;
} DUMMYUNIONNAME;
DWORD dwLocalAddr;
DWORD dwLocalPort;
DWORD dwRemoteAddr;
......@@ -49,17 +67,62 @@ typedef struct _MIB_TCPTABLE
MIB_TCPROW table[1];
} MIB_TCPTABLE, *PMIB_TCPTABLE;
typedef struct _MIB_TCPROW_OWNER_PID
{
DWORD dwState;
DWORD dwLocalAddr;
DWORD dwLocalPort;
DWORD dwRemoteAddr;
DWORD dwRemotePort;
DWORD dwOwningPid;
} MIB_TCPROW_OWNER_PID, *PMIB_TCPROW_OWNER_PID;
typedef struct _MIB_TCPTABLE_OWNER_PID
{
DWORD dwNumEntries;
MIB_TCPROW_OWNER_PID table[1];
} MIB_TCPTABLE_OWNER_PID, *PMIB_TCPTABLE_OWNER_PID;
typedef struct _MIB_TCPROW2
{
DWORD dwState;
DWORD dwLocalAddr;
DWORD dwLocalPort;
DWORD dwRemoteAddr;
DWORD dwRemotePort;
DWORD dwOwningPid;
TCP_CONNECTION_OFFLOAD_STATE dwOffloadState;
} MIB_TCPROW2, *PMIB_TCPROW2;
typedef struct _MIB_TCPTABLE2
{
DWORD dwNumEntries;
MIB_TCPROW2 table[1];
} MIB_TCPTABLE2, *PMIB_TCPTABLE2;
/* TCP stats */
#define MIB_TCP_RTO_OTHER 1
#define MIB_TCP_RTO_CONSTANT 2
#define MIB_TCP_RTO_RSRE 3
#define MIB_TCP_RTO_VANJ 4
typedef enum
{
TcpRtoAlgorithmOther = 0,
TcpRtoAlgorithmConstant = 1,
TcpRtoAlgorithmRsre = 2,
TcpRtoAlgorithmVanj = 3,
MIB_TCP_RTO_OTHER = 1,
MIB_TCP_RTO_CONSTANT = 2,
MIB_TCP_RTO_RSRE = 3,
MIB_TCP_RTO_VANJ = 4,
} TCP_RTO_ALGORITHM, *PTCP_RTO_ALGORITHM;
typedef struct _MIB_TCPSTATS
{
DWORD dwRtoAlgorithm;
union
{
DWORD dwRtoAlgorithm;
TCP_RTO_ALGORITHM RtoAlgorithm;
} DUMMYUNIONNAME;
DWORD dwRtoMin;
DWORD dwRtoMax;
DWORD dwMaxConn;
......
......@@ -18,6 +18,8 @@
#ifndef __WINE_UDPMIB_H
#define __WINE_UDPMIB_H
#define TCPIP_OWNING_MODULE_SIZE 16
/* UDP table */
......@@ -33,6 +35,18 @@ typedef struct _MIB_UDPTABLE
MIB_UDPROW table[1];
} MIB_UDPTABLE, *PMIB_UDPTABLE;
typedef struct _MIB_UDPROW_OWNER_PID
{
DWORD dwLocalAddr;
DWORD dwLocalPort;
} MIB_UDPROW_OWNER_PID, *PMIB_UDPROW_OWNER_PID;
typedef struct _MIB_UDPTABLE_OWNER_PID
{
DWORD dwNumEntries;
MIB_UDPROW_OWNER_PID table[1];
} MIB_UDPTABLE_OWNER_PID, *PMIB_UDPTABLE_OWNER_PID;
/* UDP statistics */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment