[TCPIP/AFD]
authorJérôme Gardou <jerome.gardou@reactos.org>
Tue, 4 Nov 2014 10:38:26 +0000 (10:38 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Tue, 4 Nov 2014 10:38:26 +0000 (10:38 +0000)
 - Use less weird internal structures and more public headers.

svn path=/trunk/; revision=65241

reactos/drivers/network/afd/afd/tdi.c
reactos/drivers/network/afd/include/afd.h
reactos/drivers/network/tcpip/include/info.h
reactos/drivers/network/tcpip/tcpip/ninfo.c

index 333462e..27b8444 100644 (file)
@@ -768,7 +768,7 @@ NTSTATUS TdiQueryAddress(
     TDIEntityID *Entities;
     ULONG EntityCount;
     ULONG EntityType;
-    IPSNMP_INFO SnmpInfo;
+    IPSNMPInfo SnmpInfo;
     PIPADDR_ENTRY IpAddress;
     ULONG BufferSize;
     NTSTATUS Status = STATUS_SUCCESS;
@@ -832,15 +832,15 @@ NTSTATUS TdiQueryAddress(
                                            IP_MIB_STATS_ID,             /* Entity id */
                                            &SnmpInfo,                   /* Output buffer */
                                            &BufferSize);                /* Output buffer size */
-            if (!NT_SUCCESS(Status) || (SnmpInfo.NumAddr == 0)) {
+            if (!NT_SUCCESS(Status) || (SnmpInfo.ipsi_numaddr == 0)) {
                 AFD_DbgPrint(MIN_TRACE, ("Unable to get SNMP information or no IP addresses available (Status = 0x%X).\n", Status));
                 break;
             }
 
             /* Query device for all IP addresses */
 
-            if (SnmpInfo.NumAddr != 0) {
-                BufferSize = SnmpInfo.NumAddr * sizeof(IPADDR_ENTRY);
+            if (SnmpInfo.ipsi_numaddr != 0) {
+                BufferSize = SnmpInfo.ipsi_numaddr * sizeof(IPADDR_ENTRY);
                 IpAddress = (PIPADDR_ENTRY)ExAllocatePool(NonPagedPool, BufferSize);
                 if (!IpAddress) {
                     AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
@@ -861,7 +861,7 @@ NTSTATUS TdiQueryAddress(
                     break;
                 }
 
-                if (SnmpInfo.NumAddr != 1) {
+                if (SnmpInfo.ipsi_numaddr != 1) {
                     /* Skip loopback address */
                     *Address = DN2H(IpAddress[1].Addr);
                 } else {
index 36aed14..f3ae253 100644 (file)
@@ -14,6 +14,7 @@
 #include <ntifs.h>
 #include <ndk/obtypes.h>
 #include <tdi.h>
+#include <tcpioctl.h>
 #define _WINBASE_
 #define _WINDOWS_H
 #define _INC_WINDOWS
 #define MIN(x,y) (((x)<(y))?(x):(y))
 #endif
 
-#define IOCTL_TCP_QUERY_INFORMATION_EX \
-       CTL_CODE(FILE_DEVICE_NETWORK, 0, METHOD_NEITHER, FILE_ANY_ACCESS)
-
 #define TL_INSTANCE 0
 #define        IP_MIB_STATS_ID 1
 #define        IP_MIB_ADDRTABLE_ENTRY_ID 0x102
 
-typedef struct IPSNMP_INFO {
-       ULONG Forwarding;
-       ULONG DefaultTTL;
-       ULONG InReceives;
-       ULONG InHdrErrors;
-       ULONG InAddrErrors;
-       ULONG ForwDatagrams;
-       ULONG InUnknownProtos;
-       ULONG InDiscards;
-       ULONG InDelivers;
-       ULONG OutRequests;
-       ULONG RoutingDiscards;
-       ULONG OutDiscards;
-       ULONG OutNoRoutes;
-       ULONG ReasmTimeout;
-       ULONG ReasmReqds;
-       ULONG ReasmOks;
-       ULONG ReasmFails;
-       ULONG FragOks;
-       ULONG FragFails;
-       ULONG FragCreates;
-       ULONG NumIf;
-       ULONG NumAddr;
-       ULONG NumRoutes;
-} IPSNMP_INFO, *PIPSNMP_INFO;
-
 typedef struct IPADDR_ENTRY {
        ULONG  Addr;
        ULONG  Index;
index 2bf4edb..222f3d5 100644 (file)
 #define MAX_PHYSADDR_LEN 8
 #define MAX_IFDESCR_LEN  256
 
-typedef struct IPSNMP_INFO {
-       ULONG Forwarding;
-       ULONG DefaultTTL;
-       ULONG InReceives;
-       ULONG InHdrErrors;
-       ULONG InAddrErrors;
-       ULONG ForwDatagrams;
-       ULONG InUnknownProtos;
-       ULONG InDiscards;
-       ULONG InDelivers;
-       ULONG OutRequests;
-       ULONG RoutingDiscards;
-       ULONG OutDiscards;
-       ULONG OutNoRoutes;
-       ULONG ReasmTimeout;
-       ULONG ReasmReqds;
-       ULONG ReasmOks;
-       ULONG ReasmFails;
-       ULONG FragOks;
-       ULONG FragFails;
-       ULONG FragCreates;
-       ULONG NumIf;
-       ULONG NumAddr;
-       ULONG NumRoutes;
-} IPSNMP_INFO, *PIPSNMP_INFO;
-
 typedef struct IPADDR_ENTRY {
        ULONG  Addr;
        ULONG  Index;
index 40710cc..bd9e7b9 100644 (file)
@@ -156,18 +156,18 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID,
                                       PIP_INTERFACE IF,
                                      PNDIS_BUFFER Buffer,
                                      PUINT BufferSize ) {
-    IPSNMP_INFO SnmpInfo;
+    IPSNMPInfo SnmpInfo;
     UINT IfCount = CountInterfaces();
     UINT RouteCount = CountFIBs(IF);
     TDI_STATUS Status = TDI_INVALID_REQUEST;
 
     TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
 
-    RtlZeroMemory(&SnmpInfo, sizeof(IPSNMP_INFO));
+    RtlZeroMemory(&SnmpInfo, sizeof(SnmpInfo));
 
-    SnmpInfo.NumIf = IfCount;
-    SnmpInfo.NumAddr = 1;
-    SnmpInfo.NumRoutes = RouteCount;
+    SnmpInfo.ipsi_numif = IfCount;
+    SnmpInfo.ipsi_numaddr = 1;
+    SnmpInfo.ipsi_numroutes = RouteCount;
 
     Status = InfoCopyOut( (PCHAR)&SnmpInfo, sizeof(SnmpInfo),
                          Buffer, BufferSize );