7 added + 33 modified, total 40 files
reactos/drivers/net/tcpip
diff -u -r1.16 -r1.16.2.1
--- makefile 4 Mar 2004 20:45:38 -0000 1.16
+++ makefile 29 Mar 2004 07:01:36 -0000 1.16.2.1
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.16 2004/03/04 20:45:38 chorns Exp $
+# $Id: makefile,v 1.16.2.1 2004/03/29 07:01:36 arty Exp $
PATH_TO_TOP = ../../..
@@ -8,7 +8,7 @@
TARGET_NAME = tcpip
-TARGET_CFLAGS = -I./include -DDBG=1 -DNDIS40 -D__USE_W32API
+TARGET_CFLAGS = -I./include -DNDIS40 -D__USE_W32API
TARGET_DDKLIBS = ndis.a
@@ -22,12 +22,13 @@
transport/udp/*.o
TCPIP_OBJECTS = tcpip/main.o tcpip/address.o tcpip/checksum.o \
- tcpip/dispatch.o tcpip/fileobjs.o tcpip/info.o \
- tcpip/pool.o tcpip/routines.o
+ tcpip/dispatch.o tcpip/fileobjs.o \
+ tcpip/pool.o tcpip/routines.o tcpip/interface.o
+INFO_OBJECTS = tcpip/info.o tcpip/ninfo.o tcpip/tinfo.o tcpip/iinfo.o
DATALINK_OBJECTS = datalink/arp.o datalink/lan.o datalink/loopback.o
NETWORK_OBJECTS = network/icmp.o network/ip.o network/neighbor.o \
network/receive.o network/route.o network/router.o \
- network/transmit.o
+ network/transmit.o network/prefix.o
DATAGRAM_OBJECTS = transport/datagram/datagram.o
RAWIP_OBJECTS = transport/rawip/rawip.o
TCP_OBJECTS = transport/tcp/tcp.o transport/tcp/tcpcore.o \
@@ -38,6 +39,7 @@
TARGET_OBJECTS = \
$(TCPIP_OBJECTS) \
+ $(INFO_OBJECTS) \
$(DATALINK_OBJECTS) \
$(NETWORK_OBJECTS) \
$(DATAGRAM_OBJECTS) \
reactos/drivers/net/tcpip/datalink
diff -u -r1.4 -r1.4.18.1
--- arp.c 1 May 2001 22:34:00 -0000 1.4
+++ arp.c 29 Mar 2004 07:01:36 -0000 1.4.18.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <arp.h>
#include <routines.h>
reactos/drivers/net/tcpip/datalink
diff -u -r1.14 -r1.14.2.1
--- lan.c 12 Mar 2004 04:21:59 -0000 1.14
+++ lan.c 29 Mar 2004 07:01:36 -0000 1.14.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <lan.h>
#include <address.h>
@@ -717,6 +718,7 @@
BindInfo.Transmit = LANTransmit;
IF = IPCreateInterface(&BindInfo);
+
if (!IF) {
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
FreeTDPackets(Adapter);
reactos/drivers/net/tcpip/datalink
diff -u -r1.6 -r1.6.2.1
--- loopback.c 25 Feb 2004 20:27:56 -0000 1.6
+++ loopback.c 29 Mar 2004 07:01:36 -0000 1.6.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <loopback.h>
#include <ip.h>
@@ -169,6 +170,7 @@
BindInfo.Transmit = LoopTransmit;
Loopback = IPCreateInterface(&BindInfo);
+
if ((Loopback != NULL) && (IPCreateNTE(Loopback, Address, 8)))
{
/* Reference the interface for the NTE. The reference for
reactos/drivers/net/tcpip/include
diff -N interface.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ interface.h 29 Mar 2004 07:01:36 -0000 1.1.2.1
@@ -0,0 +1,16 @@
+#ifndef _TCPIP_INTERFACE_H
+#define _TCPIP_INTERFACE_H
+
+#include <ip.h>
+
+NTSTATUS GetInterfaceIPv4Address( PIP_INTERFACE Interface,
+ ULONG Type,
+ PULONG Address );
+
+UINT CountInterfaces();
+
+NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed );
+NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer,
+ UINT NameMaxLen );
+
+#endif//_TCPIP_INTERFACE_H
reactos/drivers/net/tcpip/include
diff -N prefix.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ prefix.h 29 Mar 2004 07:01:36 -0000 1.1.2.1
@@ -0,0 +1,28 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS TCP/IP protocol driver
+ * FILE: include/info.h
+ * PURPOSE: TdiQueryInformation definitions
+ */
+#ifndef __PREFIX_H
+#define __PREFIX_H
+
+/* Prefix List Entry */
+typedef struct _PREFIX_LIST_ENTRY {
+ DEFINE_TAG
+ LIST_ENTRY ListEntry; /* Entry on list */
+ ULONG RefCount; /* Reference count */
+ PIP_INTERFACE Interface; /* Pointer to interface */
+ PIP_ADDRESS Prefix; /* Pointer to prefix */
+ UINT PrefixLength; /* Length of prefix */
+} PREFIX_LIST_ENTRY, *PPREFIX_LIST_ENTRY;
+
+extern LIST_ENTRY PrefixListHead;
+extern KSPIN_LOCK PrefixListLock;
+
+VOID InitPLE();
+PPREFIX_LIST_ENTRY CreatePLE(PIP_INTERFACE IF, PIP_ADDRESS Prefix, UINT Len);
+VOID DestroyPLE(PPREFIX_LIST_ENTRY PLE);
+VOID DestroyPLEs();
+
+#endif/*__PREFIX_H*/
reactos/drivers/net/tcpip/include
diff -u -r1.8 -r1.8.6.1
--- debug.h 25 Dec 2003 14:06:14 -0000 1.8
+++ debug.h 29 Mar 2004 07:01:36 -0000 1.8.6.1
@@ -57,6 +57,7 @@
#endif /* _MSC_VER */
+#if 0
#ifdef ASSERT
#undef ASSERT
#endif
@@ -66,6 +67,7 @@
#else /* NASSERT */
#define ASSERT(x) if (!(x)) { TI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
#endif /* NASSERT */
+#endif
#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
@@ -73,8 +75,10 @@
#define TI_DbgPrint(_t_, _x_)
+#if 0
#define ASSERT_IRQL(x)
#define ASSERT(x)
+#endif
#endif /* DBG */
reactos/drivers/net/tcpip/include
diff -u -r1.5 -r1.5.2.1
--- info.h 12 Mar 2004 04:21:59 -0000 1.5
+++ info.h 29 Mar 2004 07:01:36 -0000 1.5.2.1
@@ -48,7 +48,7 @@
typedef struct IPROUTE_ENTRY {
ULONG Dest;
- ULONG Index; //matches if_index in IFEntry and iae_index in IPAddrEntry
+ ULONG Index; //matches if_index in IFEntry and iae_index in IPAddrEntry
ULONG Metric1;
ULONG Metric2;
ULONG Metric3;
@@ -87,13 +87,13 @@
#define IP_MIB_STATS_ID 1
#define IF_MIB_STATS_ID 1
+
+#ifndef IP_MIB_ROUTETABLE_ENTRY_ID
+#define IP_MIB_ROUTETABLE_ENTRY_ID 0x101
+#endif
#ifndef IP_MIB_ADDRTABLE_ENTRY_ID
#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102
#endif
-#ifndef IP_MIB_ROUTETABLE_ENTRY_ID
-#define IP_MIB_ROUTETABLE_ENTRY_ID 0x103
-#endif
-
#ifndef MAX_PHYSADDR_SIZE
#define MAX_PHYSADDR_SIZE 8
#endif
@@ -137,6 +137,59 @@
PVOID Buffer,
UINT BufferSize);
+/* Network layer info functions */
+TDI_STATUS InfoNetworkLayerTdiQueryEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize );
+
+TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize );
+
+TDI_STATUS InfoTransportLayerTdiQueryEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize );
+
+TDI_STATUS InfoTransportLayerTdiSetEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize );
+
+TDI_STATUS InfoInterfaceTdiQueryEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize );
+
+TDI_STATUS InfoInterfaceTdiSetEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize );
+
+/* Insert and remove interface entities */
+VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface );
+VOID RemoveTDIInterfaceEntity( PIP_INTERFACE Interface );
+
#endif /* __INFO_H */
/* EOF */
reactos/drivers/net/tcpip/include
diff -u -r1.10 -r1.10.2.1
--- ip.h 12 Mar 2004 04:21:59 -0000 1.10
+++ ip.h 29 Mar 2004 07:01:36 -0000 1.10.2.1
@@ -9,6 +9,7 @@
typedef VOID (*OBJECT_FREE_ROUTINE)(PVOID Object);
+#define FOURCC(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
/* Raw IPv4 style address */
typedef ULONG IPv4_RAW_ADDRESS;
@@ -93,7 +94,6 @@
/* The ProtocolReserved field is structured as a PACKET_CONTEXT */
#define PC(Packet) ((PPACKET_CONTEXT)(&Packet->ProtocolReserved))
-
/* Address information a.k.a ADE */
typedef struct _ADDRESS_ENTRY {
DEFINE_TAG
@@ -162,17 +162,6 @@
} IP_INTERFACE, *PIP_INTERFACE;
-/* Prefix List Entry */
-typedef struct _PREFIX_LIST_ENTRY {
- DEFINE_TAG
- LIST_ENTRY ListEntry; /* Entry on list */
- ULONG RefCount; /* Reference count */
- PIP_INTERFACE Interface; /* Pointer to interface */
- PIP_ADDRESS Prefix; /* Pointer to prefix */
- UINT PrefixLength; /* Length of prefix */
-} PREFIX_LIST_ENTRY, *PPREFIX_LIST_ENTRY;
-
-
#define IP_PROTOCOL_TABLE_SIZE 0x100
typedef VOID (*IP_PROTOCOL_HANDLER)(
@@ -202,8 +191,6 @@
extern KSPIN_LOCK InterfaceListLock;
extern LIST_ENTRY NetTableListHead;
extern KSPIN_LOCK NetTableListLock;
-extern LIST_ENTRY PrefixListHead;
-extern KSPIN_LOCK PrefixListLock;
extern UINT MaxLLHeaderSize;
extern UINT MinLLFrameSize;
reactos/drivers/net/tcpip/include
diff -u -r1.4 -r1.4.2.1
--- route.h 8 Mar 2004 10:20:17 -0000 1.4
+++ route.h 29 Mar 2004 07:01:36 -0000 1.4.2.1
@@ -55,6 +55,10 @@
NTSTATUS RouteShutdown(
VOID);
+UINT CountRouteNodes( PROUTE_CACHE_NODE Node );
+
+UINT CopyRouteNodes( PROUTE_CACHE_NODE None, PROUTE_CACHE_NODE Target );
+
UINT RouteGetRouteToDestination(
PIP_ADDRESS Destination,
PNET_TABLE_ENTRY NTE,
reactos/drivers/net/tcpip/include
diff -u -r1.8 -r1.8.2.1
--- tcpip.h 12 Mar 2004 04:21:59 -0000 1.8
+++ tcpip.h 29 Mar 2004 07:01:36 -0000 1.8.2.1
@@ -110,6 +110,30 @@
#endif /* i386 */
+typedef TDI_STATUS (*InfoRequest_f)( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize );
+
+typedef TDI_STATUS (*InfoSet_f)( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize );
+
+/* Sufficient information to manage the entity list */
+typedef struct {
+ UINT tei_entity;
+ UINT tei_instance;
+ PVOID context;
+ InfoRequest_f info_req;
+ InfoSet_f info_set;
+} TDIEntityInfo;
/* Global variable */
extern PDEVICE_OBJECT TCPDeviceObject;
@@ -123,7 +147,7 @@
extern NDIS_HANDLE GlobalPacketPool;
extern NDIS_HANDLE GlobalBufferPool;
extern KSPIN_LOCK EntityListLock;
-extern TDIEntityID *EntityList;
+extern TDIEntityInfo *EntityList;
extern ULONG EntityCount;
extern ULONG EntityMax;
extern UDP_STATISTICS UDPStats;
reactos/drivers/net/tcpip/include
diff -u -r1.6 -r1.6.2.1
--- titypes.h 4 Mar 2004 20:45:38 -0000 1.6
+++ titypes.h 29 Mar 2004 07:01:36 -0000 1.6.2.1
@@ -65,7 +65,7 @@
#else /* DBG */
#define DEFINE_TAG
-#define INIT_TAG (Object, Tag)
+#define INIT_TAG(Object, Tag)
/*
* VOID ReferenceObject(
reactos/drivers/net/tcpip/network
diff -N prefix.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ prefix.c 29 Mar 2004 07:01:37 -0000 1.1.2.1
@@ -0,0 +1,139 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS TCP/IP protocol driver
+ * FILE: network/ip.c
+ * PURPOSE: Internet Protocol module
+ * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
+ * Art Yerkes (arty@users.sourceforge.net)
+ * REVISIONS:
+ * CSH 01/08-2000 Created
+ */
+#include <roscfg.h>
+#include <tcpip.h>
+#include <ip.h>
+#include <tcp.h>
+#include <loopback.h>
+#include <neighbor.h>
+#include <receive.h>
+#include <address.h>
+#include <route.h>
+#include <icmp.h>
+#include <prefix.h>
+#include <pool.h>
+
+LIST_ENTRY PrefixListHead;
+KSPIN_LOCK PrefixListLock;
+
+/* --------- The Prefix List ---------- */
+
+VOID InitPLE() {
+ /* Initialize the prefix list and protecting lock */
+ InitializeListHead(&PrefixListHead);
+ KeInitializeSpinLock(&PrefixListLock);
+}
+
+
+PPREFIX_LIST_ENTRY CreatePLE(PIP_INTERFACE IF, PIP_ADDRESS Prefix, UINT Length)
+/*
+ * FUNCTION: Creates a prefix list entry and binds it to an interface
+ * ARGUMENTS:
+ * IF = Pointer to interface
+ * Prefix = Pointer to prefix
+ * Length = Length of prefix
+ * RETURNS:
+ * Pointer to PLE, NULL if there was not enough free resources
+ * NOTES:
+ * The prefix list entry retains a reference to the interface and
+ * the provided address. The caller is responsible for providing
+ * these references
+ */
+{
+ PPREFIX_LIST_ENTRY PLE;
+
+ TI_DbgPrint(DEBUG_IP, ("Called. IF (0x%X) Prefix (0x%X) Length (%d).\n", IF, Prefix, Length));
+
+ TI_DbgPrint(DEBUG_IP, ("Prefix (%s).\n", A2S(Prefix)));
+
+ /* Allocate space for an PLE and set it up */
+ PLE = ExAllocatePool(NonPagedPool, sizeof(PREFIX_LIST_ENTRY));
+ if (!PLE) {
+ TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
+ return NULL;
+ }
+
+ INIT_TAG(PLE, TAG('P','L','E',' '));
+ PLE->RefCount = 1;
+ PLE->Interface = IF;
+ PLE->Prefix = Prefix;
+ PLE->PrefixLength = Length;
+
+ /* Add PLE to the global prefix list */
+ ExInterlockedInsertTailList(&PrefixListHead, &PLE->ListEntry, &PrefixListLock);
+
+ return PLE;
+}
+
+
+VOID DestroyPLE(
+ PPREFIX_LIST_ENTRY PLE)
+/*
+ * FUNCTION: Destroys an prefix list entry
+ * ARGUMENTS:
+ * PLE = Pointer to prefix list entry
+ * NOTES:
+ * The prefix list lock must be held when called
+ */
+{
+ TI_DbgPrint(DEBUG_IP, ("Called. PLE (0x%X).\n", PLE));
+
+ TI_DbgPrint(DEBUG_IP, ("PLE (%s).\n", PLE->Prefix));
+
+ /* Unlink the prefix list entry from the list */
+ RemoveEntryList(&PLE->ListEntry);
+
+ /* Dereference the address */
+ DereferenceObject(PLE->Prefix);
+
+ /* Dereference the interface */
+ DereferenceObject(PLE->Interface);
+
+#ifdef DBG
+ PLE->RefCount--;
+
+ if (PLE->RefCount != 0) {
+ TI_DbgPrint(MIN_TRACE, ("Prefix list entry at (0x%X) has (%d) references (should be 0).\n", PLE, PLE->RefCount));
+ }
+#endif
+
+ /* And free the PLE */
+ ExFreePool(PLE);
+}
+
+
+VOID DestroyPLEs(
+ VOID)
+/*
+ * FUNCTION: Destroys all prefix list entries
+ */
+{
+ KIRQL OldIrql;
+ PLIST_ENTRY CurrentEntry;
+ PLIST_ENTRY NextEntry;
+ PPREFIX_LIST_ENTRY Current;
+
+ TI_DbgPrint(DEBUG_IP, ("Called.\n"));
+
+ KeAcquireSpinLock(&PrefixListLock, &OldIrql);
+
+ /* Search the list and remove every PLE we find */
+ CurrentEntry = PrefixListHead.Flink;
+ while (CurrentEntry != &PrefixListHead) {
+ NextEntry = CurrentEntry->Flink;
+ Current = CONTAINING_RECORD(CurrentEntry, PREFIX_LIST_ENTRY, ListEntry);
+ /* Destroy the PLE */
+ DestroyPLE(Current);
+ CurrentEntry = NextEntry;
+ }
+ KeReleaseSpinLock(&PrefixListLock, OldIrql);
+}
+
reactos/drivers/net/tcpip/network
diff -u -r1.7 -r1.7.2.1
--- icmp.c 4 Mar 2004 20:45:39 -0000 1.7
+++ icmp.c 29 Mar 2004 07:01:36 -0000 1.7.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <icmp.h>
#include <rawip.h>
@@ -202,9 +203,10 @@
((PICMP_HEADER)NewPacket->Data)->Code = 0;
((PICMP_HEADER)NewPacket->Data)->Checksum = 0;
+#ifdef DBG
DisplayIPPacket(IPPacket);
-
DisplayIPPacket(NewPacket);
+#endif
ICMPTransmit(NTE, NewPacket);
reactos/drivers/net/tcpip/network
diff -u -r1.9 -r1.9.4.1
--- ip.c 9 Feb 2004 06:59:01 -0000 1.9
+++ ip.c 29 Mar 2004 07:01:36 -0000 1.9.4.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <ip.h>
#include <tcp.h>
@@ -14,6 +15,7 @@
#include <neighbor.h>
#include <receive.h>
#include <address.h>
+#include <prefix.h>
#include <route.h>
#include <icmp.h>
#include <pool.h>
@@ -25,8 +27,6 @@
KSPIN_LOCK InterfaceListLock;
LIST_ENTRY NetTableListHead;
KSPIN_LOCK NetTableListLock;
-LIST_ENTRY PrefixListHead;
-KSPIN_LOCK PrefixListLock;
UINT MaxLLHeaderSize; /* Largest maximum header size */
UINT MinLLFrameSize; /* Largest minimum frame size */
BOOLEAN IPInitialized = FALSE;
@@ -229,114 +229,6 @@
}
-PPREFIX_LIST_ENTRY CreatePLE(
- PIP_INTERFACE IF,
- PIP_ADDRESS Prefix,
- UINT Length)
-/*
- * FUNCTION: Creates a prefix list entry and binds it to an interface
- * ARGUMENTS:
- * IF = Pointer to interface
- * Prefix = Pointer to prefix
- * Length = Length of prefix
- * RETURNS:
- * Pointer to PLE, NULL if there was not enough free resources
- * NOTES:
- * The prefix list entry retains a reference to the interface and
- * the provided address. The caller is responsible for providing
- * these references
- */
-{
- PPREFIX_LIST_ENTRY PLE;
-
- TI_DbgPrint(DEBUG_IP, ("Called. IF (0x%X) Prefix (0x%X) Length (%d).\n", IF, Prefix, Length));
-
- TI_DbgPrint(DEBUG_IP, ("Prefix (%s).\n", A2S(Prefix)));
-
- /* Allocate space for an PLE and set it up */
- PLE = ExAllocatePool(NonPagedPool, sizeof(PREFIX_LIST_ENTRY));
- if (!PLE) {
- TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
- return NULL;
- }
-
- INIT_TAG(PLE, TAG('P','L','E',' '));
- PLE->RefCount = 1;
- PLE->Interface = IF;
- PLE->Prefix = Prefix;
- PLE->PrefixLength = Length;
-
- /* Add PLE to the global prefix list */
- ExInterlockedInsertTailList(&PrefixListHead, &PLE->ListEntry, &PrefixListLock);
-
- return PLE;
-}
-
-
-VOID DestroyPLE(
- PPREFIX_LIST_ENTRY PLE)
-/*
- * FUNCTION: Destroys an prefix list entry
- * ARGUMENTS:
- * PLE = Pointer to prefix list entry
- * NOTES:
- * The prefix list lock must be held when called
- */
-{
- TI_DbgPrint(DEBUG_IP, ("Called. PLE (0x%X).\n", PLE));
-
- TI_DbgPrint(DEBUG_IP, ("PLE (%s).\n", PLE->Prefix));
-
- /* Unlink the prefix list entry from the list */
- RemoveEntryList(&PLE->ListEntry);
-
- /* Dereference the address */
- DereferenceObject(PLE->Prefix);
-
- /* Dereference the interface */
- DereferenceObject(PLE->Interface);
-
-#ifdef DBG
- PLE->RefCount--;
-
- if (PLE->RefCount != 0) {
- TI_DbgPrint(MIN_TRACE, ("Prefix list entry at (0x%X) has (%d) references (should be 0).\n", PLE, PLE->RefCount));
- }
-#endif
-
- /* And free the PLE */
- ExFreePool(PLE);
-}
-
-
-VOID DestroyPLEs(
- VOID)
-/*
- * FUNCTION: Destroys all prefix list entries
- */
-{
- KIRQL OldIrql;
- PLIST_ENTRY CurrentEntry;
- PLIST_ENTRY NextEntry;
- PPREFIX_LIST_ENTRY Current;
-
- TI_DbgPrint(DEBUG_IP, ("Called.\n"));
-
- KeAcquireSpinLock(&PrefixListLock, &OldIrql);
-
- /* Search the list and remove every PLE we find */
- CurrentEntry = PrefixListHead.Flink;
- while (CurrentEntry != &PrefixListHead) {
- NextEntry = CurrentEntry->Flink;
- Current = CONTAINING_RECORD(CurrentEntry, PREFIX_LIST_ENTRY, ListEntry);
- /* Destroy the PLE */
- DestroyPLE(Current);
- CurrentEntry = NextEntry;
- }
- KeReleaseSpinLock(&PrefixListLock, OldIrql);
-}
-
-
PNET_TABLE_ENTRY IPCreateNTE(
PIP_INTERFACE IF,
PIP_ADDRESS Address,
@@ -821,6 +713,8 @@
KeInitializeSpinLock(&IF->Lock);
+ InsertTDIInterfaceEntity( IF );
+
return IF;
}
@@ -838,6 +732,8 @@
TI_DbgPrint(DEBUG_IP, ("Called. IF (0x%X).\n", IF));
+ RemoveTDIInterfaceEntity( IF );
+
KeAcquireSpinLock(&NetTableListLock, &OldIrql1);
KeAcquireSpinLock(&IF->Lock, &OldIrql2);
DestroyADEs(IF);
@@ -852,6 +748,7 @@
TI_DbgPrint(MIN_TRACE, ("Interface at (0x%X) has (%d) references (should be 0).\n", IF, IF->RefCount));
}
#endif
+
ExFreePool(IF);
}
@@ -891,7 +788,7 @@
KeReleaseSpinLock(&IF->Lock, OldIrql);
return FALSE;
}
-#if 1
+
/* Reference objects for forward information base */
ReferenceObject(Current->Address);
ReferenceObject(Current->PLE->Prefix);
@@ -904,17 +801,16 @@
DereferenceObject(Current);
DereferenceObject(NCE);
}
-#else
+
RCN = RouteAddRouteToDestination(Current->Address, Current, IF, NCE);
if (!RCN) {
TI_DbgPrint(MIN_TRACE, ("Could not create RCN.\n"));
DereferenceObject(Current->Address);
KeReleaseSpinLock(&IF->Lock, OldIrql);
- return FALSE;
}
/* Don't need this any more since the route cache references the NCE */
DereferenceObject(NCE);
-#endif
+
CurrentEntry = CurrentEntry->Flink;
}
@@ -1096,9 +992,7 @@
InitializeListHead(&ReassemblyListHead);
KeInitializeSpinLock(&ReassemblyListLock);
- /* Initialize the prefix list and protecting lock */
- InitializeListHead(&PrefixListHead);
- KeInitializeSpinLock(&PrefixListLock);
+ InitPLE();
/* Initialize our periodic timer and its associated DPC object. When the
timer expires, the IPTimeout deferred procedure call (DPC) is queued */
reactos/drivers/net/tcpip/network
diff -u -r1.4 -r1.4.2.1
--- neighbor.c 25 Feb 2004 20:27:56 -0000 1.4
+++ neighbor.c 29 Mar 2004 07:01:37 -0000 1.4.2.1
@@ -7,10 +7,10 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <neighbor.h>
#include <routines.h>
-#include <neighbor.h>
#include <transmit.h>
#include <address.h>
#include <route.h>
@@ -186,7 +186,7 @@
NdisPacket = NextNdisPacket;
}
-#if DBG
+#ifdef DBG
if (CurNCE->RefCount != 1)
{
TI_DbgPrint(DEBUG_REFCOUNT, ("NCE at (0x%X) has (%d) references (should be 1).\n", CurNCE, CurNCE->RefCount));
@@ -293,7 +293,7 @@
NCE->Interface = Interface;
NCE->Address = Address;
NCE->LinkAddressLength = LinkAddressLength;
- NCE->LinkAddress = (PVOID)((ULONG_PTR)NCE + sizeof(NEIGHBOR_CACHE_ENTRY));
+ NCE->LinkAddress = (PVOID)&NCE[1];
if (LinkAddress != NULL)
{
RtlCopyMemory(NCE->LinkAddress, LinkAddress, LinkAddressLength);
@@ -524,7 +524,7 @@
/* Remove reference to the address */
DereferenceObject(CurNCE->Address);
-#if DBG
+#ifdef DBG
CurNCE->RefCount--;
if (CurNCE->RefCount != 0)
reactos/drivers/net/tcpip/network
diff -u -r1.8 -r1.8.2.1
--- receive.c 4 Mar 2004 20:45:39 -0000 1.8
+++ receive.c 29 Mar 2004 07:01:37 -0000 1.8.2.1
@@ -9,6 +9,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <receive.h>
#include <routines.h>
@@ -596,7 +597,7 @@
if (NCE) {
/* FIXME: Possibly fragment datagram */
/* Forward the packet */
- IPSendFragment(IPPacket, NCE);
+ IPSendFragment(IPPacket, NCE);
} else {
TI_DbgPrint(MIN_TRACE, ("No route to destination (0x%X).\n",
IPPacket->DstAddr.Address.IPv4Address));
reactos/drivers/net/tcpip/network
diff -u -r1.5 -r1.5.2.1
--- route.c 8 Mar 2004 10:20:18 -0000 1.5
+++ route.c 29 Mar 2004 07:01:37 -0000 1.5.2.1
@@ -9,6 +9,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <route.h>
#include <router.h>
@@ -23,7 +24,7 @@
NPAGED_LOOKASIDE_LIST IPRCNList;
-#if DBG
+#ifdef DBG
VOID PrintTree(
PROUTE_CACHE_NODE Node)
/*
@@ -50,7 +51,34 @@
}
#endif
+UINT CountRouteNodes( PROUTE_CACHE_NODE Node ) {
+ if( !Node ) Node = RouteCache;
+ if( IsInternalRCN(Node) )
+ return
+ /* Traverse left subtree */
+ CountRouteNodes(Node->Left) +
+ /* Traverse right subtree */
+ CountRouteNodes(Node->Right) + 1;
+ else
+ return 0;
+}
+
+UINT CopyRouteNodes( PROUTE_CACHE_NODE Node, PROUTE_CACHE_NODE Target ) {
+ UINT NodeCount, Result = 0;
+
+ if( !Node ) Node = RouteCache;
+ if( IsInternalRCN(Node) ) {
+ RtlCopyMemory(Target,Node,sizeof(*Target));
+ Target++;
+ NodeCount = CopyRouteNodes( Node->Left, Target );
+ Target += NodeCount; Result += NodeCount;
+ NodeCount = CopyRouteNodes( Node->Right, Target );
+ Target += NodeCount; Result += NodeCount;
+ }
+
+ return Result;
+}
VOID FreeRCN(
PVOID Object)
/*
@@ -364,7 +392,7 @@
DereferenceObject(Node->NTE);
DereferenceObject(Node->NCE);
-#if DBG
+#ifdef DBG
if (Node->RefCount != 1)
TI_DbgPrint(MIN_TRACE, ("RCN at (0x%X) has (%d) references (should be 1).\n", Node, Node->RefCount));
#endif
reactos/drivers/net/tcpip/network
diff -u -r1.5 -r1.5.16.1
--- router.c 24 Sep 2002 15:11:34 -0000 1.5
+++ router.c 29 Mar 2004 07:01:37 -0000 1.5.16.1
@@ -7,9 +7,11 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <address.h>
#include <router.h>
+#include <prefix.h>
#include <pool.h>
reactos/drivers/net/tcpip/network
diff -u -r1.8 -r1.8.2.1
--- transmit.c 4 Mar 2004 20:45:39 -0000 1.8
+++ transmit.c 29 Mar 2004 07:01:37 -0000 1.8.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <transmit.h>
#include <routines.h>
@@ -307,7 +308,7 @@
NCE = RCN->NCE;
-#if DBG
+#ifdef DBG
if (!NCE) {
TI_DbgPrint(MIN_TRACE, ("No NCE to use.\n"));
FreeNdisPacket(IPPacket->NdisPacket);
reactos/drivers/net/tcpip/tcpip
diff -N iinfo.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ iinfo.c 29 Mar 2004 07:01:37 -0000 1.1.2.1
@@ -0,0 +1,108 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS TCP/IP protocol driver
+ * FILE: tcpip/iinfo.c
+ * PURPOSE: Per-interface information.
+ * PROGRAMMERS: Art Yerkes
+ * REVISIONS:
+ * CSH 01/08-2000 Created
+ */
+#include <roscfg.h>
+#include <tcpip.h>
+#include <lan.h>
+#include <address.h>
+#include <info.h>
+#include <pool.h>
+#include <ip.h>
+
+TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID,
+ PIP_INTERFACE Interface,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize) {
+ TDI_STATUS Status = TDI_INVALID_REQUEST;
+ PIFENTRY OutData;
+ PLAN_ADAPTER IF = (PLAN_ADAPTER)Interface->Context;
+ PCHAR IFDescr;
+ KIRQL OldIrql;
+ ULONG Size;
+ UINT DescrLenMax = MAX_IFDESCR_LEN - 1;
+
+ TI_DbgPrint(MAX_TRACE,
+ ("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n",
+ Interface, IF, ID->tei_entity, ID->tei_instance));
+
+ OutData =
+ (PIFENTRY)ExAllocatePool( NonPagedPool,
+ sizeof(IFENTRY) + MAX_IFDESCR_LEN );
+
+ if( !OutData ) return TDI_INVALID_REQUEST; /* Out of memory */
+
+ RtlZeroMemory( OutData, sizeof(IFENTRY) + MAX_IFDESCR_LEN );
+
+ OutData->Index = ID->tei_instance + 1;
+ /* viz: tcpip keeps those indices */
+ OutData->Type = IF ? 1 : 0; /* XXX other -- for now ... */
+ OutData->Mtu = Interface->MTU;
+ TI_DbgPrint(MAX_TRACE,
+ ("Getting interface speed\n"));
+ OutData->PhysAddrLen = Interface->AddressLength;
+ OutData->AdminStatus = 1; /* XXX Up -- How do I know? */
+ OutData->OperStatus = 1; /* XXX Up -- How do I know? */
+
+ IFDescr = (PCHAR)&OutData[1];
+
+ if( IF ) {
+ GetInterfaceSpeed( Interface, &OutData->Speed );
+ TI_DbgPrint(MAX_TRACE,
+ ("IF Speed = %d * 100bps\n", OutData->Speed));
+ memcpy(OutData->PhysAddr,Interface->Address,Interface->AddressLength);
+ TI_DbgPrint(MAX_TRACE, ("Got HWAddr\n"));
+ GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 );
+ DescrLenMax = strlen( IFDescr ) + 1;
+ }
+
+ IFDescr[DescrLenMax] = 0; /* Terminate ifdescr string */
+
+ TI_DbgPrint(MAX_TRACE, ("Copied in name %s\n", IFDescr));
+ OutData->DescrLen = DescrLenMax;
+ IFDescr += DescrLenMax;
+ Size = IFDescr - (PCHAR)OutData + 1;
+
+ TI_DbgPrint(MAX_TRACE, ("Finished IFEntry MIB (%04x:%d) size %d\n",
+ ID->tei_entity, ID->tei_instance, Size));
+
+ Status = InfoCopyOut( OutData, Size, Buffer, BufferSize );
+ ExFreePool( OutData );
+
+ return Status;
+}
+
+TDI_STATUS InfoInterfaceTdiQueryEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize ) {
+ if( InfoClass == INFO_CLASS_GENERIC &&
+ InfoType == INFO_TYPE_PROVIDER &&
+ InfoId == ENTITY_TYPE_ID ) {
+ ULONG Temp = IF_MIB;
+ return InfoCopyOut( &Temp, sizeof(Temp), Buffer, BufferSize );
+ } else if( InfoClass == INFO_CLASS_PROTOCOL &&
+ InfoType == INFO_TYPE_PROVIDER &&
+ InfoId == IF_MIB_STATS_ID ) {
+ return InfoTdiQueryGetInterfaceMIB( id, Context, Buffer, BufferSize );
+ } else
+ return TDI_INVALID_REQUEST;
+}
+
+TDI_STATUS InfoInterfaceTdiSetEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize ) {
+ return TDI_INVALID_REQUEST;
+}
reactos/drivers/net/tcpip/tcpip
diff -N interface.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ interface.c 29 Mar 2004 07:01:37 -0000 1.1.2.1
@@ -0,0 +1,109 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS TCP/IP protocol driver
+ * FILE: tcpip/interface.c
+ * PURPOSE: Convenient abstraction for getting and setting information
+ * in IP_INTERFACE.
+ * PROGRAMMERS: Art Yerkes
+ * REVISIONS:
+ * CSH 01/08-2000 Created
+ */
+#include <roscfg.h>
+#include <tcpip.h>
+#include <lan.h>
+#include <address.h>
+#include <pool.h>
+#include <ip.h>
+
+NTSTATUS GetInterfaceIPv4Address( PIP_INTERFACE Interface,
+ ULONG TargetType,
+ PULONG Address ) {
+ PLIST_ENTRY CurrentIFEntry;
+ PLIST_ENTRY CurrentADEEntry;
+ PADDRESS_ENTRY CurrentADE;
+
+ CurrentADEEntry = Interface->ADEListHead.Flink;
+ while (CurrentADEEntry != &Interface->ADEListHead)
+ {
+ CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
+ if (CurrentADE->Type == TargetType) {
+ *Address = CurrentADE->Address->Address.IPv4Address;
+ return STATUS_SUCCESS;
+ }
+ CurrentADEEntry = CurrentADEEntry->Flink;
+ }
+
+ return STATUS_UNSUCCESSFUL;
+}
+
+UINT CountInterfaces() {
+ DWORD Count = 0;
+ KIRQL OldIrql;
+ PLIST_ENTRY CurrentIFEntry;
+
+ KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
+
+ CurrentIFEntry = InterfaceListHead.Flink;
+ while (CurrentIFEntry != &InterfaceListHead) {
+ Count++;
+ CurrentIFEntry = CurrentIFEntry->Flink;
+ }
+
+ KeReleaseSpinLock(&InterfaceListLock, OldIrql);
+
+ return Count;
+}
+
+UINT CountInterfaceAddresses( PIP_INTERFACE Interface ) {
+ UINT AddrCount = 0;
+ PADDRESS_ENTRY CurrentADE;
+ PLIST_ENTRY CurrentADEntry;
+
+ CurrentADEntry = Interface->ADEListHead.Flink;
+
+ while( CurrentADEntry != &Interface->ADEListHead ) {
+ CurrentADEntry = CurrentADEntry->Flink;
+ CurrentADE = CONTAINING_RECORD(CurrentADEntry,
+ ADDRESS_ENTRY,
+ ListEntry);
+ if( CurrentADE->Type == ADE_UNICAST )
+ AddrCount++;
+ }
+
+ return AddrCount;
+}
+
+NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed ) {
+ NDIS_STATUS NdisStatus;
+ PLAN_ADAPTER IF = (PLAN_ADAPTER)Interface->Context;
+
+ /* Get maximum link speed */
+ NdisStatus = NDISCall(IF,
+ NdisRequestQueryInformation,
+ OID_GEN_LINK_SPEED,
+ Speed,
+ sizeof(UINT));
+
+ return
+ NdisStatus != NDIS_STATUS_SUCCESS ?
+ STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
+}
+
+NTSTATUS GetInterfaceName( PIP_INTERFACE Interface,
+ PCHAR NameBuffer,
+ UINT Len ) {
+ NDIS_STATUS NdisStatus;
+ PLAN_ADAPTER IF = (PLAN_ADAPTER)Interface->Context;
+
+ /* Get maximum link speed */
+ NdisStatus = NDISCall(IF,
+ NdisRequestQueryInformation,
+ OID_GEN_FRIENDLY_NAME,
+ NameBuffer,
+ Len);
+
+ return
+ NdisStatus != NDIS_STATUS_SUCCESS ?
+ STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
+}
+
reactos/drivers/net/tcpip/tcpip
diff -N ninfo.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ninfo.c 29 Mar 2004 07:01:37 -0000 1.1.2.1
@@ -0,0 +1,273 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS TCP/IP protocol driver
+ * FILE: tcpip/ninfo.c
+ * PURPOSE: Network information
+ * PROGRAMMERS: Art Yerkes
+ * REVISIONS:
+ * CSH 01/08-2000 Created
+ */
+#include <roscfg.h>
+#include <tcpip.h>
+#include <address.h>
+#include <info.h>
+#include <pool.h>
+#include <prefix.h>
+#include <ip.h>
+#include <route.h>
+
+TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer,
+ PUINT BufferSize ) {
+ PIP_INTERFACE CurrentIF;
+ PLIST_ENTRY CurrentIFEntry;
+ TDI_STATUS Status = TDI_INVALID_REQUEST;
+ KIRQL OldIrql;
+ UINT Count = 1; /* Start adapter indices at 1 */
+ UINT IfCount = CountInterfaces();
+ PIPADDR_ENTRY IpAddress =
+ ExAllocatePool( NonPagedPool, sizeof( IPADDR_ENTRY ) * IfCount );
+ PIPADDR_ENTRY IpCurrent = IpAddress;
+
+ TI_DbgPrint(MAX_TRACE, ("Called.\n"));
+
+ KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
+
+ CurrentIFEntry = InterfaceListHead.Flink;
+ while (CurrentIFEntry != &InterfaceListHead)
+ {
+ CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
+
+ IpCurrent->Index = Count;
+ IpCurrent->Addr = 0;
+ IpCurrent->BcastAddr = 0;
+ IpCurrent->Mask = 0;
+
+ /* Locate the diffrent addresses and put them the right place */
+ GetInterfaceIPv4Address( CurrentIF,
+ ADE_UNICAST,
+ &IpAddress->Addr );
+ GetInterfaceIPv4Address( CurrentIF,
+ ADE_MULTICAST,
+ &IpAddress->BcastAddr );
+ GetInterfaceIPv4Address( CurrentIF,
+ ADE_ADDRMASK,
+ &IpAddress->Mask );
+ IpCurrent++;
+ CurrentIFEntry = CurrentIFEntry->Flink;
+ Count++;
+ }
+
+ KeReleaseSpinLock(&InterfaceListLock, OldIrql);
+
+ Status = InfoCopyOut( IpAddress, sizeof(*IpAddress) * Count,
+ Buffer, BufferSize );
+
+ ExFreePool( IpAddress );
+
+ TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status));
+
+ return Status;
+}
+
+/* Get IPRouteEntry s for each of the routes in the system */
+TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) {
+ PIP_INTERFACE CurrentIF;
+ PLIST_ENTRY CurrentIFEntry;
+ TDI_STATUS Status;
+ KIRQL OldIrql;
+ UINT RtCount = CountRouteNodes( NULL ),
+ Size = sizeof( IPROUTE_ENTRY ) * RtCount;
+ PROUTE_CACHE_NODE RCache =
+ ExAllocatePool( NonPagedPool, sizeof( ROUTE_CACHE_NODE ) * RtCount ),
+ RCacheCur = RCache;
+ PIPROUTE_ENTRY RouteEntries = ExAllocatePool( NonPagedPool, Size ),
+ RtCurrent = RouteEntries;
+
+ TI_DbgPrint(MAX_TRACE, ("Called, routes = %d, RCache = %08x\n",
+ RtCount, RCache));
+
+ if( !RCache || !RouteEntries ) {
+ if( RCache ) ExFreePool( RCache );
+ if( RouteEntries ) ExFreePool( RouteEntries );
+ return STATUS_NO_MEMORY;
+ }
+
+ RtlZeroMemory( RouteEntries, Size );
+
+ RtCount = CopyRouteNodes( NULL, RCache );
+
+ while( RtCurrent < RouteEntries + RtCount ) {
+#if 0
+ /* We'll see what we're getting where easier this way */
+ RtCurrent->Dest = FOURCC('d','e','s','t');
+ RtCurrent->Index = FOURCC('i','n','d','x');
+ RtCurrent->Metric1 = FOURCC('m','e','t','1');
+ RtCurrent->Metric2 = FOURCC('m','e','t','2');
+ RtCurrent->Metric3 = FOURCC('m','e','t','3');
+ RtCurrent->Metric4 = FOURCC('m','e','t','4');
+ RtCurrent->Gw = FOURCC('g','a','t','e');
+ RtCurrent->Type = FOURCC('t','y','p','e');
+ RtCurrent->Proto = FOURCC('p','r','o','t');
+ RtCurrent->Age = FOURCC('a','g','e',' ');
+ RtCurrent->Mask = FOURCC('m','a','s','k');
+ RtCurrent->Metric5 = FOURCC('m','e','t','5');
+ RtCurrent->Info = FOURCC('i','n','f','o');
+#endif
+
+ /* Copy Desitnation */
+ RtlCopyMemory( &RtCurrent->Dest,
+ &RCacheCur->Destination.Address.IPv4Address,
+ sizeof(RtCurrent->Dest) );
+ RtlCopyMemory( &RtCurrent->Gw,
+ &RCacheCur->NTE->Address,
+ sizeof(RtCurrent->Gw) );
+
+ KeAcquireSpinLock(&EntityListLock, &OldIrql);
+ for( RtCurrent->Index = EntityCount;
+ RtCurrent->Index < EntityMax &&
+ RCacheCur->NTE->Interface !=
+ EntityList[RtCurrent->Index].context;
+ RtCurrent->Index++ );
+ KeReleaseSpinLock(&EntityListLock, OldIrql);
+
+ if( RCacheCur->NTE && RCacheCur->NTE->PLE )
+ RtCurrent->Mask =
+ ~((1 << (32 - RCacheCur->NTE->PLE->PrefixLength)) - 1);
+ else
+ TI_DbgPrint
+ (MIN_TRACE,
+ ("RCacheCur->NTE : %08x, RCacheCur->NTE->PLE : %08x\n",
+ RCacheCur->NTE, RCacheCur->NTE->PLE));
+
+ RtCurrent->Metric1 = 1 /* Need to store + get this */;
+ RtCurrent->Type = 2 /* PF_INET */;
+
+ TI_DbgPrint
+ (MAX_TRACE,("RouteEntry %d:\n", RtCurrent - RouteEntries ));
+ TI_DbgPrint(MAX_TRACE,("Source Data:\n"));
+ TI_DbgPrint(MAX_TRACE,("Destination: %08x\n",
+ RCacheCur->Destination.Address.IPv4Address));
+ TI_DbgPrint(MAX_TRACE,("NTE: %08x\n"));
+ TI_DbgPrint(MAX_TRACE,("NCE: %08x\n"));
+ TI_DbgPrint(MAX_TRACE,("Target Data:\n"));
+ TI_DbgPrint(MAX_TRACE,("Dest: %08x\n", RtCurrent->Dest));
+ TI_DbgPrint(MAX_TRACE,("Index: %08x\n", RtCurrent->Index));
+ TI_DbgPrint(MAX_TRACE,("Metric1: %08x\n", RtCurrent->Metric1));
+ TI_DbgPrint(MAX_TRACE,("Metric2: %08x\n", RtCurrent->Metric2));
+ TI_DbgPrint(MAX_TRACE,("Metric3: %08x\n", RtCurrent->Metric3));
+ TI_DbgPrint(MAX_TRACE,("Metric4: %08x\n", RtCurrent->Metric4));
+ TI_DbgPrint(MAX_TRACE,("Gw: %08x\n", RtCurrent->Gw));
+ TI_DbgPrint(MAX_TRACE,("Type: %08x\n", RtCurrent->Type));
+ TI_DbgPrint(MAX_TRACE,("Proto: %08x\n", RtCurrent->Proto));
+ TI_DbgPrint(MAX_TRACE,("Age: %08x\n", RtCurrent->Age));
+ TI_DbgPrint(MAX_TRACE,("Mask: %08x\n", RtCurrent->Mask));
+ TI_DbgPrint(MAX_TRACE,("Metric5: %08x\n", RtCurrent->Metric5));
+ TI_DbgPrint(MAX_TRACE,("Info: %08x\n", RtCurrent->Info));
+
+ RtCurrent++; RCacheCur++;
+ }
+
+ Status = InfoCopyOut( RouteEntries, Size, Buffer, BufferSize );
+
+ ExFreePool( RouteEntries );
+ ExFreePool( RCache );
+
+ TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status));
+
+ return Status;
+}
+
+TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer,
+ PUINT BufferSize ) {
+ KIRQL OldIrql;
+ PIP_INTERFACE CurrentIF;
+ PLIST_ENTRY CurrentIFEntry;
+ IPSNMP_INFO SnmpInfo;
+ UINT IfCount = CountInterfaces();
+ UINT AddrCount = 0;
+ UINT RouteCount = CountRouteNodes( NULL );
+ TDI_STATUS Status = TDI_INVALID_REQUEST;
+
+ TI_DbgPrint(MAX_TRACE, ("Called.\n"));
+
+ RtlZeroMemory(&SnmpInfo, sizeof(IPSNMP_INFO));
+
+ /* Count number of addresses */
+ AddrCount = 0;
+ KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
+
+ CurrentIFEntry = InterfaceListHead.Flink;
+ while (CurrentIFEntry != &InterfaceListHead)
+ {
+ CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
+ AddrCount += CountInterfaceAddresses( CurrentIF );
+ CurrentIFEntry = CurrentIFEntry->Flink;
+ }
+
+ KeReleaseSpinLock(&InterfaceListLock, OldIrql);
+
+ SnmpInfo.NumIf = IfCount;
+ SnmpInfo.NumAddr = AddrCount;
+ SnmpInfo.NumRoutes = RouteCount;
+
+ Status = InfoCopyOut( &SnmpInfo, sizeof(SnmpInfo),
+ Buffer, BufferSize );
+
+ TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status));
+
+ return Status;
+}
+
+TDI_STATUS InfoNetworkLayerTdiQueryEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize ) {
+ TDI_STATUS Status = TDI_INVALID_REQUEST;
+
+ TI_DbgPrint(MAX_TRACE, ("Called.\n"));
+
+ switch( InfoClass ) {
+ case INFO_CLASS_GENERIC:
+ if( InfoType == INFO_TYPE_PROVIDER && InfoId == ENTITY_TYPE_ID ) {
+ ULONG Return = CL_NL_IP;
+ Status = InfoCopyOut( &Return, sizeof(Return),
+ Buffer, BufferSize );
+ }
+ break;
+
+ case INFO_CLASS_PROTOCOL:
+ switch( InfoType ) {
+ case INFO_TYPE_PROVIDER:
+ switch( InfoId ) {
+ case IP_MIB_ADDRTABLE_ENTRY_ID:
+ Status = InfoTdiQueryGetAddrTable( Buffer, BufferSize );
+ break;
+
+ case IP_MIB_ROUTETABLE_ENTRY_ID:
+ Status = InfoTdiQueryGetRouteTable( Buffer, BufferSize );
+ break;
+
+ case IP_MIB_STATS_ID:
+ Status = InfoTdiQueryGetIPSnmpInfo( Buffer, BufferSize );
+ break;
+ }
+ break;
+ }
+ }
+
+ TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status));
+
+ return Status;
+}
+
+TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize ) {
+}
reactos/drivers/net/tcpip/tcpip
diff -N tinfo.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tinfo.c 29 Mar 2004 07:01:37 -0000 1.1.2.1
@@ -0,0 +1,40 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS TCP/IP protocol driver
+ * FILE: tcpip/tinfo.c
+ * PURPOSE: Transport layer information
+ * PROGRAMMERS: Art Yerkes
+ * REVISIONS:
+ * CSH 01/08-2000 Created
+ */
+#include <roscfg.h>
+#include <tcpip.h>
+#include <address.h>
+#include <pool.h>
+#include <ip.h>
+
+TDI_STATUS InfoTransportLayerTdiQueryEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PNDIS_BUFFER Buffer,
+ PUINT BufferSize ) {
+ if( InfoClass == INFO_CLASS_GENERIC &&
+ InfoType == INFO_TYPE_PROVIDER &&
+ InfoId == ENTITY_TYPE_ID ) {
+ ULONG Temp = CL_TL_UDP;
+ return InfoCopyOut( &Temp, sizeof(Temp), Buffer, BufferSize );
+ }
+
+ return TDI_INVALID_REQUEST;
+}
+
+TDI_STATUS InfoTransportLayerTdiSetEx( UINT InfoClass,
+ UINT InfoType,
+ UINT InfoId,
+ PVOID Context,
+ TDIEntityID *id,
+ PCHAR Buffer,
+ UINT BufferSize ) {
+}
reactos/drivers/net/tcpip/tcpip
diff -u -r1.11 -r1.11.2.1
--- address.c 12 Mar 2004 04:21:59 -0000 1.11
+++ address.c 29 Mar 2004 07:01:37 -0000 1.11.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <address.h>
#include <pool.h>
@@ -164,7 +165,9 @@
}
}
- IPAddress = ExAllocatePool(NonPagedPool, sizeof(IP_ADDRESS));
+ IPAddress = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(IP_ADDRESS),
+ FOURCC('I','P','v','4'));
if (IPAddress) {
AddrInitIPv4(IPAddress, ValidAddr->in_addr);
*Address = IPAddress;
reactos/drivers/net/tcpip/tcpip
diff -u -r1.3 -r1.3.2.1
--- checksum.c 4 Mar 2004 20:45:39 -0000 1.3
+++ checksum.c 29 Mar 2004 07:01:37 -0000 1.3.2.1
@@ -8,6 +8,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <checksum.h>
reactos/drivers/net/tcpip/tcpip
diff -u -r1.11 -r1.11.2.1
--- dispatch.c 8 Mar 2004 10:20:18 -0000 1.11
+++ dispatch.c 29 Mar 2004 07:01:37 -0000 1.11.2.1
@@ -8,6 +8,7 @@
* CSH 01/08-2000 Created
* TODO: Validate device object in all dispatch routines
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <dispatch.h>
#include <routines.h>
reactos/drivers/net/tcpip/tcpip
diff -u -r1.12 -r1.12.2.1
--- fileobjs.c 8 Mar 2004 10:20:18 -0000 1.12
+++ fileobjs.c 29 Mar 2004 07:01:37 -0000 1.12.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <datagram.h>
#include <address.h>
reactos/drivers/net/tcpip/tcpip
diff -u -r1.5 -r1.5.2.1
--- info.c 12 Mar 2004 04:21:59 -0000 1.5
+++ info.c 29 Mar 2004 07:01:37 -0000 1.5.2.1
@@ -7,321 +7,110 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <info.h>
#include <routines.h>
+#include <debug.h>
-
-TDI_STATUS IPTdiQueryInformationEx(
- PTDI_REQUEST Request,
- TDIObjectID *ID,
- PNDIS_BUFFER Buffer,
- PUINT BufferSize,
- PVOID Context)
-/*
- * FUNCTION: Returns extended information about network layer
- * ARGUMENTS:
- * Request = Pointer to TDI request structure for the request
- * ID = TDI object ID
- * Buffer = Pointer to buffer with data to use.
- * BufferSize = Pointer to buffer with size of Buffer. On return
- * this is filled with number of bytes returned
- * Context = Pointer to context buffer
- * RETURNS:
- * Status of operation
- */
-{
- PLIST_ENTRY CurrentIFEntry;
- PLIST_ENTRY CurrentADEEntry;
- PADDRESS_ENTRY CurrentADE;
- PIP_INTERFACE CurrentIF;
- IPADDR_ENTRY IpAddress;
- IPSNMP_INFO SnmpInfo;
- KIRQL OldIrql;
- ULONG Entity;
- ULONG Temp;
- UINT Count;
- UINT BufSize;
-
- BufSize = *BufferSize;
-
- /* Make return parameters consistent every time */
- *BufferSize = 0;
-
- Entity = ID->toi_entity.tei_entity;
- if (Entity != CL_NL_ENTITY)
- {
- /* We can't handle this entity */
- return TDI_INVALID_PARAMETER;
+TDI_STATUS InfoCopyOut( PCHAR DataOut, UINT SizeOut,
+ PNDIS_BUFFER ClientBuf, PUINT ClientBufSize ) {
+ UINT RememberedCBSize = *ClientBufSize;
+ *ClientBufSize = SizeOut;
+ if( RememberedCBSize < SizeOut )
+ return TDI_BUFFER_TOO_SMALL;
+ else {
+ CopyBufferToBufferChain( ClientBuf, 0, (PUCHAR)DataOut, SizeOut );
+ return TDI_SUCCESS;
}
+}
- if (ID->toi_entity.tei_instance != TL_INSTANCE)
- {
- /* Only a single instance is supported */
- return TDI_INVALID_REQUEST;
- }
+VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ) {
+ KIRQL OldIrql;
+ UINT Count = 0, i;
- if (ID->toi_class == INFO_CLASS_GENERIC)
- {
- if ((ID->toi_type == INFO_TYPE_PROVIDER) &&
- (ID->toi_id == ENTITY_TYPE_ID))
- {
- if (BufSize < sizeof(ULONG))
- {
- return TDI_BUFFER_TOO_SMALL;
- }
+ TI_DbgPrint(MAX_TRACE,
+ ("Inserting interface %08x (%d entities already)\n",
+ Interface, EntityCount));
+
+ KeAcquireSpinLock( &EntityListLock, &OldIrql );
+
+ /* Count IP Entities */
+ for( i = 0; i < EntityCount; i++ )
+ if( EntityList[i].tei_entity == IF_ENTITY ) {
+ Count++;
+ TI_DbgPrint(MAX_TRACE, ("Entity %d is an IF. Found %d\n",
+ i, Count));
+ }
- Temp = CL_NL_IP;
- Count = CopyBufferToBufferChain(Buffer, 0, (PUCHAR)&Temp, sizeof(ULONG));
+ EntityList[EntityCount].tei_entity = IF_ENTITY;
+ EntityList[EntityCount].tei_instance = Count;
+ EntityList[EntityCount].context = Interface;
+ EntityList[EntityCount].info_req = InfoInterfaceTdiQueryEx;
+ EntityList[EntityCount].info_set = InfoInterfaceTdiSetEx;
+
+ EntityCount++;
- return TDI_SUCCESS;
- }
+ KeReleaseSpinLock( &EntityListLock, OldIrql );
+}
- return TDI_INVALID_PARAMETER;
- }
+VOID RemoveTDIInterfaceEntity( PIP_INTERFACE Interface ) {
+ KIRQL OldIrql;
+ UINT Count = 0, i;
- if (ID->toi_class == INFO_CLASS_PROTOCOL)
- {
- if (ID->toi_type != INFO_TYPE_PROVIDER)
- {
- return TDI_INVALID_PARAMETER;
- }
-
- switch (ID->toi_id)
- {
- case IP_MIB_ADDRTABLE_ENTRY_ID:
- Temp = 0;
-
- KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
-
- CurrentIFEntry = InterfaceListHead.Flink;
- while (CurrentIFEntry != &InterfaceListHead)
- {
- CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
-
- if (Temp + sizeof(IPADDR_ENTRY) > BufSize)
- {
- KeReleaseSpinLock(&InterfaceListLock, OldIrql);
- return TDI_BUFFER_TOO_SMALL;
- }
-
- IpAddress.Addr = 0;
- IpAddress.BcastAddr = 0;
- IpAddress.Mask = 0;
-
- /* Locate the diffrent addresses and put them the right place */
- CurrentADEEntry = CurrentIF->ADEListHead.Flink;
- while (CurrentADEEntry != &CurrentIF->ADEListHead)
- {
- CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
-
- switch (CurrentADE->Type)
- {
- case ADE_UNICAST:
- IpAddress.Addr = CurrentADE->Address->Address.IPv4Address;
- break;
- case ADE_MULTICAST:
- IpAddress.BcastAddr = CurrentADE->Address->Address.IPv4Address;
- break;
- case ADE_ADDRMASK:
- IpAddress.Mask = CurrentADE->Address->Address.IPv4Address;
- break;
- default:
- /* Should not happen */
- TI_DbgPrint(MIN_TRACE, ("Unknown address entry type (0x%X)\n", CurrentADE->Type));
- break;
- }
- CurrentADEEntry = CurrentADEEntry->Flink;
- }
-
- /* Pack the address information into IPADDR_ENTRY structure */
- IpAddress.Index = 0;
- IpAddress.ReasmSize = 0;
- IpAddress.Context = 0;
- IpAddress.Pad = 0;
-
- Count = CopyBufferToBufferChain(Buffer, Temp, (PUCHAR)&IpAddress, sizeof(IPADDR_ENTRY));
- Temp += sizeof(IPADDR_ENTRY);
-
- CurrentIFEntry = CurrentIFEntry->Flink;
- }
-
- KeReleaseSpinLock(&InterfaceListLock, OldIrql);
-
- return TDI_SUCCESS;
-
- case IP_MIB_STATS_ID:
- if (BufSize < sizeof(IPSNMP_INFO))
- {
- return TDI_BUFFER_TOO_SMALL;
- }
-
- RtlZeroMemory(&SnmpInfo, sizeof(IPSNMP_INFO));
-
- /* Count number of interfaces */
- Count = 0;
- KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
-
- CurrentIFEntry = InterfaceListHead.Flink;
- while (CurrentIFEntry != &InterfaceListHead)
- {
- Count++;
- CurrentIFEntry = CurrentIFEntry->Flink;
- }
-
- KeReleaseSpinLock(&InterfaceListLock, OldIrql);
-
- SnmpInfo.NumIf = Count;
-
- /* Count number of addresses */
- Count = 0;
- KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
-
- CurrentIFEntry = InterfaceListHead.Flink;
- while (CurrentIFEntry != &InterfaceListHead)
- {
- CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
- Count++;
- CurrentIFEntry = CurrentIFEntry->Flink;
- }
-
- KeReleaseSpinLock(&InterfaceListLock, OldIrql);
-
- SnmpInfo.NumAddr = Count;
- Count = CopyBufferToBufferChain(Buffer, 0, (PUCHAR)&SnmpInfo, sizeof(IPSNMP_INFO));
-
- return TDI_SUCCESS;
-
- default:
- /* We can't handle this ID */
- return TDI_INVALID_PARAMETER;
- }
+ KeAcquireSpinLock( &EntityListLock, &OldIrql );
+
+ /* Remove entities that have this interface as context
+ * In the future, this might include AT_ENTITY types, too
+ */
+ for( i = 0; i < EntityCount; i++ ) {
+ if( EntityList[i].context == Interface ) {
+ if( i != EntityCount-1 )
+ memcpy( &EntityList[i],
+ &EntityList[--EntityCount],
+ sizeof(EntityList[i]) );
+ }
}
- return TDI_INVALID_PARAMETER;
+ KeReleaseSpinLock( &EntityListLock, OldIrql );
}
TDI_STATUS InfoTdiQueryListEntities(PNDIS_BUFFER Buffer,
- UINT BufSize,
PUINT BufferSize)
{
- UINT Count, Size, Temp;
+ UINT Count, Size, BufSize = *BufferSize;
KIRQL OldIrql;
+ TDIEntityID *EntityOutList;
PLIST_ENTRY CurrentIFEntry;
- /* Count Adapters */
- KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
+ TI_DbgPrint(MAX_TRACE,("About to copy %d TDIEntityIDs to user\n",
+ EntityCount));
- CurrentIFEntry = InterfaceListHead.Flink;
- Count = EntityCount;
-
- while( CurrentIFEntry != &InterfaceListHead ) {
- Count++;
- CurrentIFEntry = CurrentIFEntry->Flink;
- }
-
- KeReleaseSpinLock(&InterfaceListLock, OldIrql);
-
- Size = Count * sizeof(TDIEntityID);
+ KeAcquireSpinLock(&EntityListLock, &OldIrql);
+
+ Size = EntityCount * sizeof(TDIEntityID);
*BufferSize = Size;
if (BufSize < Size)
{
+ KeReleaseSpinLock( &EntityListLock, OldIrql );
/* The buffer is too small to contain requested data */
return TDI_BUFFER_TOO_SMALL;
}
-
- DbgPrint("About to copy %d TDIEntityIDs (%d bytes) to user\n",
- Count, Size);
-
- KeAcquireSpinLock(&EntityListLock, &OldIrql);
-
- /* Update entity list */
- for( Temp = EntityCount; Temp < Count; Temp++ ) {
- EntityList[Temp].tei_entity = IF_ENTITY;
- EntityList[Temp].tei_instance = Temp - EntityCount;
+
+ /* Return entity list -- Copy only the TDIEntityID parts. */
+ for( Count = 0; Count < EntityCount; Count++ ) {
+ CopyBufferToBufferChain(Buffer,
+ Count * sizeof(TDIEntityID),
+ (PUCHAR)&EntityList[Count],
+ sizeof(TDIEntityID));
}
- EntityMax = Count;
-
- /* Return entity list */
- Count = CopyBufferToBufferChain(Buffer, 0, (PUCHAR)EntityList, Size);
KeReleaseSpinLock(&EntityListLock, OldIrql);
- *BufferSize = Size;
-
return TDI_SUCCESS;
}
-TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIObjectID *ID,
- PNDIS_BUFFER Buffer,
- UINT BufSize,
- PUINT BufferSize) {
- PIFENTRY OutData;
- UINT ListedIfIndex, Count, Size;
- PLIST_ENTRY CurrentADEEntry;
- PADDRESS_ENTRY CurrentADE;
- PLIST_ENTRY CurrentIFEntry;
- PIP_INTERFACE CurrentIF;
- PCHAR IFDescr;
- KIRQL OldIrql;
-
- OutData = ExAllocatePool( NonPagedPool,
- sizeof(IFENTRY) + MAX_IFDESCR_LEN );
-
- if( !OutData ) return STATUS_NO_MEMORY;
-
- RtlZeroMemory( OutData,sizeof(IFENTRY) + MAX_IFDESCR_LEN );
-
- KeAcquireSpinLock(&EntityListLock, &OldIrql);
- ListedIfIndex = ID->toi_entity.tei_instance - EntityCount;
- if( ListedIfIndex > EntityMax ) {
- KeReleaseSpinLock(&EntityListLock,OldIrql);
- return TDI_INVALID_REQUEST;
- }
-
- CurrentIFEntry = InterfaceListHead.Flink;
-
- for( Count = 0; Count < ListedIfIndex; Count++ )
- CurrentIFEntry = CurrentIFEntry->Flink;
-
- CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
-
- CurrentADEEntry = CurrentIF->ADEListHead.Flink;
- if( CurrentADEEntry == &CurrentIF->ADEListHead ) {
- KeReleaseSpinLock( &EntityListLock, OldIrql );
- return TDI_INVALID_REQUEST;
- }
-
- CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
-
- OutData->Index = Count + 1; /* XXX - arty What goes here?? */
- OutData->Type = CurrentADE->Type;
- OutData->Mtu = CurrentIF->MTU;
- OutData->Speed = 10000000; /* XXX - arty Not sure */
- memcpy(OutData->PhysAddr,
- CurrentIF->Address,CurrentIF->AddressLength);
- OutData->PhysAddrLen = CurrentIF->AddressLength;
- OutData->AdminStatus = TRUE;
- OutData->OperStatus = TRUE;
- IFDescr = (PCHAR)&OutData[1];
- strcpy(IFDescr,"ethernet adapter");
- OutData->DescrLen = strlen(IFDescr);
- IFDescr = IFDescr + strlen(IFDescr);
- Size = IFDescr - (PCHAR)OutData;
-
- KeReleaseSpinLock(&InterfaceListLock, OldIrql);
-
- *BufferSize = Size;
-
- if( BufSize < Size ) {
- return TDI_BUFFER_TOO_SMALL;
- } else {
- CopyBufferToBufferChain(Buffer, 0, (PUCHAR)&OutData, Size);
- return TDI_SUCCESS;
- }
-}
-
TDI_STATUS InfoTdiQueryInformationEx(
PTDI_REQUEST Request,
TDIObjectID *ID,
@@ -341,170 +130,72 @@
* Status of operation
*/
{
- PLIST_ENTRY CurrentIFEntry;
- PLIST_ENTRY CurrentADEEntry;
- PLIST_ENTRY CurrentADFEntry;
- PADDRESS_FILE CurrentADF;
- PADDRESS_ENTRY CurrentADE;
- PIP_INTERFACE CurrentIF;
- ADDRESS_INFO Info;
- KIRQL OldIrql;
- UINT BufSize;
- UINT Entity;
- UINT Offset;
- ULONG Temp;
- UINT Count;
- UINT Size;
- TDIEntityID EntityId;
-
- Offset = 0;
- BufSize = *BufferSize;
-
- /* Check wether it is a query for a list of entities */
- Entity = ID->toi_entity.tei_entity;
- if (Entity == GENERIC_ENTITY)
- {
- if ((ID->toi_class != INFO_CLASS_GENERIC) ||
- (ID->toi_type != INFO_TYPE_PROVIDER) ||
- (ID->toi_id != ENTITY_LIST_ID))
- {
- return TDI_INVALID_PARAMETER;
- }
-
- return InfoTdiQueryListEntities(Buffer, BufSize, BufferSize);
- }
-
- /* Get an IFENTRY */
- if (ID->toi_class == INFO_CLASS_PROTOCOL &&
- ID->toi_type == INFO_TYPE_PROVIDER &&
- ID->toi_id == IF_MIB_STATS_ID)
- {
- if(ID->toi_entity.tei_entity != IF_ENTITY)
- return TDI_INVALID_REQUEST;
-
- return InfoTdiQueryGetInterfaceMIB(ID, Buffer, BufSize, BufferSize);
- }
-
- if ((Entity != CL_TL_ENTITY) && (Entity != CO_TL_ENTITY))
- {
- /* We can't handle this entity, pass it on */
- return IPTdiQueryInformationEx(
- Request, ID, Buffer, BufferSize, Context);
- }
-
- /* Make return parameters consistent every time */
- *BufferSize = 0;
-
- if (ID->toi_entity.tei_instance != TL_INSTANCE)
- {
- /* We only support a single instance */
- return TDI_INVALID_REQUEST;
- }
-
- if (ID->toi_class == INFO_CLASS_GENERIC)
- {
- if ((ID->toi_type != INFO_TYPE_PROVIDER) ||
- (ID->toi_id != ENTITY_TYPE_ID))
- return TDI_INVALID_PARAMETER;
-
- if (BufSize < sizeof(ULONG))
- {
- return TDI_BUFFER_TOO_SMALL;
- }
-
- if (Entity == CL_TL_ENTITY)
- {
- Temp = CL_TL_UDP;
- }
- else if (Entity == CO_TL_ENTITY)
- {
- Temp = CO_TL_TCP;
- }
+ KIRQL OldIrql;
+ UINT i;
+ PVOID context;
+ NTSTATUS Status = STATUS_SUCCESS;
+ TDIEntityID EntityId;
+ BOOL FoundEntity = FALSE;
+ InfoRequest_f InfoRequest;
+
+ TI_DbgPrint(MAX_TRACE,
+ ("InfoEx Req: %x %x %x!%04x:%d\n",
+ ID->toi_class,
+ ID->toi_type,
+ ID->toi_id,
+ ID->toi_entity.tei_entity,
+ ID->toi_entity.tei_instance));
+
+ /* Check wether it is a query for a list of entities */
+ if (ID->toi_entity.tei_entity == GENERIC_ENTITY)
+ {
+ if ((ID->toi_class != INFO_CLASS_GENERIC) ||
+ (ID->toi_type != INFO_TYPE_PROVIDER) ||
+ (ID->toi_id != ENTITY_LIST_ID))
+ Status = TDI_INVALID_PARAMETER;
else
- {
- return TDI_INVALID_PARAMETER;
- }
-
- Count = CopyBufferToBufferChain(Buffer, 0, (PUCHAR)&Temp, sizeof(ULONG));
-
- return TDI_SUCCESS;
+ Status = InfoTdiQueryListEntities(Buffer, BufferSize);
+ } else {
+ KeAcquireSpinLock( &EntityListLock, &OldIrql );
+
+ for( i = 0; i < EntityCount; i++ ) {
+ if( EntityList[i].tei_entity == ID->toi_entity.tei_entity &&
+ EntityList[i].tei_instance == ID->toi_entity.tei_instance ) {
+ InfoRequest = EntityList[i].info_req;
+ context = EntityList[i].context;
+ FoundEntity = TRUE;
+ break;
+ }
+ }
+
+ KeReleaseSpinLock( &EntityListLock, OldIrql );
+
+ if( FoundEntity ) {
+ TI_DbgPrint(MAX_TRACE,
+ ("Calling Entity %d (%04x:%d) InfoEx (%x,%x,%x)\n",
+ i, ID->toi_entity.tei_entity,
+ ID->toi_entity.tei_instance,
+ ID->toi_class, ID->toi_type, ID->toi_id));
+ Status = InfoRequest( ID->toi_class,
+ ID->toi_type,
+ ID->toi_id,
+ context,
+ &ID->toi_entity,
+ Buffer,
+ BufferSize );
+ }
}
- if (ID->toi_class == INFO_CLASS_PROTOCOL)
- {
- if (ID->toi_type != INFO_TYPE_PROVIDER)
- {
- return TDI_INVALID_PARAMETER;
- }
-
- switch (ID->toi_id)
- {
- case UDP_MIB_STAT_ID:
- if (Entity != CL_TL_ENTITY)
- {
- return TDI_INVALID_PARAMETER;
- }
-
- if (BufSize < sizeof(UDPStats))
- {
- return TDI_BUFFER_TOO_SMALL;
- }
-
- Count = CopyBufferToBufferChain(Buffer, 0, (PUCHAR)&UDPStats, sizeof(UDP_STATISTICS));
-
- return TDI_SUCCESS;
-
- case UDP_MIB_TABLE_ID:
- if (Entity != CL_TL_ENTITY)
- {
- return TDI_INVALID_PARAMETER;
- }
-
- Offset = 0;
-
- KeAcquireSpinLock(&AddressFileListLock, &OldIrql);
-
- CurrentADFEntry = AddressFileListHead.Flink;
- while (CurrentADFEntry != &AddressFileListHead)
- {
- CurrentADF = CONTAINING_RECORD(CurrentADFEntry, ADDRESS_FILE, ListEntry);
-
- if (Offset + sizeof(ADDRESS_INFO) > BufSize)
- {
- KeReleaseSpinLock(&AddressFileListLock, OldIrql);
- *BufferSize = Offset;
- return TDI_BUFFER_OVERFLOW;
- }
-
- Info.LocalAddress = CurrentADF->ADE->Address->Address.IPv4Address;
- Info.LocalPort = CurrentADF->Port;
-
- Count = CopyBufferToBufferChain(Buffer, Offset, (PUCHAR)&Info, sizeof(ADDRESS_INFO));
- Offset += Count;
+ TI_DbgPrint(MAX_TRACE,("Status: %08x\n", Status));
- CurrentADFEntry = CurrentADFEntry->Flink;
- }
-
- KeReleaseSpinLock(&AddressFileListLock, OldIrql);
-
- *BufferSize = Offset;
-
- return STATUS_SUCCESS;
-
- default:
- /* We can't handle this ID */
- return TDI_INVALID_PARAMETER;
- }
- }
-
- return TDI_INVALID_PARAMETER;
+ return Status;
}
-TDI_STATUS InfoTdiSetInformationEx(
- PTDI_REQUEST Request,
- TDIObjectID *ID,
- PVOID Buffer,
- UINT BufferSize)
+TDI_STATUS InfoTdiSetInformationEx
+(PTDI_REQUEST Request,
+ TDIObjectID *ID,
+ PVOID Buffer,
+ UINT BufferSize)
/*
* FUNCTION: Sets extended information
* ARGUMENTS:
@@ -516,30 +207,30 @@
* Status of operation
*/
{
- switch( ID->toi_class ) {
- case INFO_CLASS_PROTOCOL:
- switch( ID->toi_type ) {
- case INFO_TYPE_PROVIDER:
- switch( ID->toi_id ) {
- case IP_MIB_ROUTETABLE_ENTRY_ID:
- if( ID->toi_entity.tei_entity == CL_NL_ENTITY &&
- ID->toi_entity.tei_instance == TL_INSTANCE &&
- BufferSize >= sizeof(IPROUTE_ENTRY) ) {
- /* Add route -- buffer is an IPRouteEntry */
- PIPROUTE_ENTRY ire = (PIPROUTE_ENTRY)Buffer;
- RouteFriendlyAddRoute( ire );
- } else {
- return TDI_INVALID_PARAMETER;
- /* In my experience, we are being over
- protective compared to windows */
+ switch( ID->toi_class ) {
+ case INFO_CLASS_PROTOCOL:
+ switch( ID->toi_type ) {
+ case INFO_TYPE_PROVIDER:
+ switch( ID->toi_id ) {
+ case IP_MIB_ROUTETABLE_ENTRY_ID:
+ if( ID->toi_entity.tei_entity == CL_NL_ENTITY &&
+ ID->toi_entity.tei_instance == TL_INSTANCE &&
+ BufferSize >= sizeof(IPROUTE_ENTRY) ) {
+ /* Add route -- buffer is an IPRouteEntry */
+ PIPROUTE_ENTRY ire = (PIPROUTE_ENTRY)Buffer;
+ RouteFriendlyAddRoute( ire );
+ } else {
+ return TDI_INVALID_PARAMETER;
+ /* In my experience, we are being over
+ protective compared to windows */
+ }
+ break;
+ }
+ break;
}
break;
- }
- break;
}
- break;
- }
-
- return TDI_INVALID_PARAMETER;
-}
+ return TDI_INVALID_PARAMETER;
+}
+
reactos/drivers/net/tcpip/tcpip
diff -u -r1.22 -r1.22.2.1
--- main.c 8 Mar 2004 10:20:18 -0000 1.22
+++ main.c 29 Mar 2004 07:01:37 -0000 1.22.2.1
@@ -17,6 +17,7 @@
#include <udp.h>
#include <tcp.h>
#include <rosrtl/string.h>
+#include <info.h>
#ifdef DBG
DWORD DebugTraceLevel = 0x7fffffff;
@@ -29,7 +30,7 @@
NDIS_HANDLE GlobalPacketPool = NULL;
NDIS_HANDLE GlobalBufferPool = NULL;
KSPIN_LOCK EntityListLock;
-TDIEntityID *EntityList = NULL;
+TDIEntityInfo *EntityList = NULL;
ULONG EntityCount = 0;
ULONG EntityMax = 0;
UDP_STATISTICS UDPStats;
@@ -766,6 +767,28 @@
return Status;
}
+ /* Setup network layer and transport layer entities */
+ KeInitializeSpinLock(&EntityListLock);
+ EntityList = ExAllocatePool(NonPagedPool, sizeof(TDIEntityID) * MAX_TDI_ENTITIES );
+ if (!NT_SUCCESS(Status)) {
+ TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
+ TiUnload(DriverObject);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ EntityList[0].tei_entity = CL_NL_ENTITY;
+ EntityList[0].tei_instance = 0;
+ EntityList[0].context = 0;
+ EntityList[0].info_req = InfoNetworkLayerTdiQueryEx;
+ EntityList[0].info_set = InfoNetworkLayerTdiSetEx;
+ EntityList[1].tei_entity = CL_TL_ENTITY;
+ EntityList[1].tei_instance = 0;
+ EntityList[1].context = 0;
+ EntityList[1].info_req = InfoTransportLayerTdiQueryEx;
+ EntityList[1].info_set = InfoTransportLayerTdiSetEx;
+ EntityCount = 2;
+ EntityMax = MAX_TDI_ENTITIES;
+
/* Allocate NDIS packet descriptors */
NdisAllocatePacketPool(&NdisStatus, &GlobalPacketPool, 100, sizeof(PACKET_CONTEXT));
if (NdisStatus != NDIS_STATUS_SUCCESS) {
@@ -826,22 +849,6 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
- /* Setup network layer and transport layer entities */
- KeInitializeSpinLock(&EntityListLock);
- EntityList = ExAllocatePool(NonPagedPool, sizeof(TDIEntityID) * MAX_TDI_ENTITIES );
- if (!NT_SUCCESS(Status)) {
- TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
- TiUnload(DriverObject);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- EntityList[0].tei_entity = CL_NL_ENTITY;
- EntityList[0].tei_instance = 0;
- EntityList[1].tei_entity = CL_TL_ENTITY;
- EntityList[1].tei_instance = 0;
- EntityCount = 2;
- EntityMax = MAX_TDI_ENTITIES;
-
/* Use direct I/O */
IPDeviceObject->Flags |= DO_DIRECT_IO;
RawIPDeviceObject->Flags |= DO_DIRECT_IO;
reactos/drivers/net/tcpip/tcpip
diff -u -r1.2 -r1.2.18.1
--- pool.c 2 Aug 2000 00:21:37 -0000 1.2
+++ pool.c 29 Mar 2004 07:01:37 -0000 1.2.18.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <pool.h>
reactos/drivers/net/tcpip/tcpip
diff -u -r1.11 -r1.11.2.1
--- routines.c 4 Mar 2004 20:45:39 -0000 1.11
+++ routines.c 29 Mar 2004 07:01:37 -0000 1.11.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <routines.h>
#include <pool.h>
reactos/drivers/net/tcpip/transport/datagram
diff -u -r1.6 -r1.6.2.1
--- datagram.c 25 Feb 2004 20:27:56 -0000 1.6
+++ datagram.c 29 Mar 2004 07:01:37 -0000 1.6.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <datagram.h>
#include <routines.h>
reactos/drivers/net/tcpip/transport/rawip
diff -u -r1.5 -r1.5.18.1
--- rawip.c 4 Jul 2001 20:40:23 -0000 1.5
+++ rawip.c 29 Mar 2004 07:01:37 -0000 1.5.18.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <rawip.h>
#include <routines.h>
reactos/drivers/net/tcpip/transport/tcp
diff -u -r1.10 -r1.10.2.1
--- tcp.c 5 Mar 2004 00:48:11 -0000 1.10
+++ tcp.c 29 Mar 2004 07:01:37 -0000 1.10.2.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <tcp.h>
#include <pool.h>
@@ -621,6 +622,13 @@
return STATUS_SUCCESS;
}
+ TI_DbgPrint(MID_TRACE, ("AF: %08x\n",
+ Connection->AddressFile));
+ TI_DbgPrint(MID_TRACE, ("ADE: %08x\n",
+ Connection->AddressFile->ADE));
+ TI_DbgPrint(MID_TRACE, ("ADEA: %08x\n",
+ Connection->AddressFile->ADE->Address));
+
Connection->LocalAddress = Connection->AddressFile->ADE->Address;
Connection->LocalPort = Connection->AddressFile->Port;
reactos/drivers/net/tcpip/transport/tcp
diff -u -r1.1 -r1.1.16.1
--- tcp_input.c 15 Jan 2003 21:57:31 -0000 1.1
+++ tcp_input.c 29 Mar 2004 07:01:37 -0000 1.1.16.1
@@ -15,7 +15,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_input.c,v 1.1 2003/01/15 21:57:31 chorns Exp $
+ * Version: $Id: tcp_input.c,v 1.1.16.1 2004/03/29 07:01:37 arty Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -72,6 +72,7 @@
* engine. Lots of bugs are found.
*/
+#include <roscfg.h>
#if 0
#include <linux/config.h>
#include <linux/mm.h>
reactos/drivers/net/tcpip/transport/tcp
diff -u -r1.1 -r1.1.16.1
--- tcp_ipv4.c 15 Jan 2003 21:57:31 -0000 1.1
+++ tcp_ipv4.c 29 Mar 2004 07:01:37 -0000 1.1.16.1
@@ -15,7 +15,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_ipv4.c,v 1.1 2003/01/15 21:57:31 chorns Exp $
+ * Version: $Id: tcp_ipv4.c,v 1.1.16.1 2004/03/29 07:01:37 arty Exp $
*
* IPv4 specific functions
*
@@ -57,6 +57,7 @@
* Andi Kleen : Fix accept error reporting.
*/
+#include <roscfg.h>
#if 0
#include <linux/config.h>
#include <linux/types.h>
reactos/drivers/net/tcpip/transport/tcp
diff -u -r1.2 -r1.2.16.1
--- tcp_output.c 24 Jul 2003 18:14:59 -0000 1.2
+++ tcp_output.c 29 Mar 2004 07:01:37 -0000 1.2.16.1
@@ -15,7 +15,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_output.c,v 1.2 2003/07/24 18:14:59 royce Exp $
+ * Version: $Id: tcp_output.c,v 1.2.16.1 2004/03/29 07:01:37 arty Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -46,6 +46,7 @@
*
*/
+#include <roscfg.h>
#if 0
#include <net/tcp.h>
reactos/drivers/net/tcpip/transport/tcp
diff -u -r1.1 -r1.1.16.1
--- tcp_timer.c 15 Jan 2003 21:57:31 -0000 1.1
+++ tcp_timer.c 29 Mar 2004 07:01:37 -0000 1.1.16.1
@@ -15,7 +15,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_timer.c,v 1.1 2003/01/15 21:57:31 chorns Exp $
+ * Version: $Id: tcp_timer.c,v 1.1.16.1 2004/03/29 07:01:37 arty Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -30,6 +30,7 @@
* Jorge Cwik, <jorge@laser.satlink.net>
*/
+#include <roscfg.h>
#if 0
#include <net/tcp.h>
#else
reactos/drivers/net/tcpip/transport/udp
diff -u -r1.6 -r1.6.18.1
--- udp.c 4 Jul 2001 20:40:24 -0000 1.6
+++ udp.c 29 Mar 2004 07:01:38 -0000 1.6.18.1
@@ -7,6 +7,7 @@
* REVISIONS:
* CSH 01/08-2000 Created
*/
+#include <roscfg.h>
#include <tcpip.h>
#include <udp.h>
#include <routines.h>
CVSspam 0.2.8