ReactOS  0.4.15-dev-2972-gda2a567
lan.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS TCP/IP protocol driver
4  * FILE: include/lan.h
5  * PURPOSE: LAN adapter definitions
6  */
7 
8 #pragma once
9 
10 /* Media we support */
11 #define MEDIA_ETH 0
12 
13 #define MAX_MEDIA 1
14 
15 #define IEEE_802_ADDR_LENGTH 6
16 
17 /* Ethernet header layout */
18 typedef struct ETH_HEADER {
19  UCHAR DstAddr[IEEE_802_ADDR_LENGTH]; /* Destination MAC address */
20  UCHAR SrcAddr[IEEE_802_ADDR_LENGTH]; /* Source MAC address */
21  USHORT EType; /* Ethernet protocol type */
23 
24 #define MAX_MEDIA_ETH sizeof(ETH_HEADER)
25 
26 /* Broadcast masks */
27 #define BCAST_ETH_MASK 0x01
28 
29 /* Broadcast values to check against */
30 #define BCAST_ETH_CHECK 0x01
31 
32 /* Offset of broadcast address */
33 #define BCAST_ETH_OFFSET 0x00
34 
35 /* Max packets queued for a single adapter */
36 #define IP_MAX_RECV_BACKLOG 0x20
37 
38 /* Per adapter information */
39 typedef struct LAN_ADAPTER {
40  LIST_ENTRY ListEntry; /* Entry on list */
41  KSPIN_LOCK Lock; /* Lock for this structure */
42  UCHAR State, OldState; /* State of the adapter */
43  BOOLEAN CompletingReset; /* Reset is finishing */
44  KEVENT Event; /* Opening event */
45  PVOID Context; /* Upper layer context information */
46  NDIS_HANDLE NdisHandle; /* NDIS binding handle */
47  NDIS_STATUS NdisStatus; /* NDIS status of last request */
48  NDIS_MEDIUM Media; /* Media type */
49  UCHAR HWAddress[IEEE_802_ADDR_LENGTH]; /* Local HW address */
50  UINT HWAddressLength; /* Length of HW address */
51  UCHAR BCastMask; /* Mask for checking broadcast */
52  UCHAR BCastCheck; /* Value to check against */
53  UCHAR BCastOffset; /* Offset in frame to check against */
54  UCHAR HeaderSize; /* Size of link-level header */
55  USHORT MTU; /* Maximum Transfer Unit */
56  UINT MinFrameSize; /* Minimum frame size in bytes */
57  UINT MaxPacketSize; /* Maximum packet size when sending */
58  UINT MaxSendPackets; /* Maximum number of packets per send */
59  UINT MacOptions; /* MAC options for NIC driver/adapter */
60  UINT Speed; /* Link speed */
61  UINT PacketFilter; /* Packet filter for this adapter */
63 
64 /* LAN adapter state constants */
65 #define LAN_STATE_OPENING 0
66 #define LAN_STATE_RESETTING 1
67 #define LAN_STATE_STARTED 2
68 #define LAN_STATE_STOPPED 3
69 
70 /* Size of out lookahead buffer */
71 #define LOOKAHEAD_SIZE 128
72 
73 /* Ethernet types. We swap constants so we can compare values at runtime
74  without swapping them there */
75 #define ETYPE_IPv4 WH2N(0x0800)
76 #define ETYPE_IPv6 WH2N(0x86DD)
77 #define ETYPE_ARP WH2N(0x0806)
78 
79 /* Protocols */
80 #define LAN_PROTO_IPv4 0x0000 /* Internet Protocol version 4 */
81 #define LAN_PROTO_IPv6 0x0001 /* Internet Protocol version 6 */
82 #define LAN_PROTO_ARP 0x0002 /* Address Resolution Protocol */
83 
84 
88 
90  PLAN_ADAPTER Adapter);
91 
94 
95 VOID NTAPI
97 
100 
102  PULONG Result );
103 
105  PLAN_ADAPTER Adapter,
107  NDIS_OID OID,
108  PVOID Buffer,
109  UINT Length);
110 
111 /* EOF */
PVOID Context
Definition: lan.h:64
UINT PacketFilter
Definition: lan.h:80
NDIS_STATUS NDISCall(PLAN_ADAPTER Adapter, NDIS_REQUEST_TYPE Type, NDIS_OID OID, PVOID Buffer, UINT Length)
Send a request to NDIS.
Definition: lan.c:29
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
enum _NDIS_MEDIUM NDIS_MEDIUM
UCHAR BCastOffset
Definition: lan.h:72
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
ULONG NDIS_OID
Definition: ntddndis.h:230
UCHAR OldState
Definition: lan.h:42
UINT Speed
Definition: lan.h:79
UINT HWAddressLength
Definition: lan.h:69
UINT MinFrameSize
Definition: lan.h:75
UCHAR SrcAddr[IEEE_802_ADDR_LENGTH]
Definition: lan.h:35
int NDIS_STATUS
Definition: ntddndis.h:471
LIST_ENTRY ListEntry
Definition: lan.h:57
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS TcpipLanGetDwordOid(PIP_INTERFACE Interface, NDIS_OID Oid, PULONG Result)
Definition: lan.c:184
Definition: lan.h:33
UCHAR BCastCheck
Definition: lan.h:71
USHORT MTU
Definition: lan.h:74
UCHAR BCastMask
Definition: lan.h:70
NDIS_STATUS NdisStatus
Definition: lan.h:66
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
UCHAR DstAddr[IEEE_802_ADDR_LENGTH]
Definition: lan.h:34
struct LAN_ADAPTER * PLAN_ADAPTER
NDIS_MEDIUM Media
Definition: lan.h:67
KSPIN_LOCK Lock
Definition: lan.h:60
Type
Definition: Type.h:6
UCHAR HeaderSize
Definition: lan.h:73
UINT64 OID
Definition: marshal.c:88
UINT MacOptions
Definition: lan.h:78
unsigned char UCHAR
Definition: xmlstorage.h:181
NDIS_STATUS LANRegisterAdapter(PNDIS_STRING AdapterName, PNDIS_STRING RegistryPath)
Registers protocol with an NDIS adapter.
Definition: lan.c:637
Definition: typedefs.h:119
NDIS_HANDLE NdisHandle
Definition: lan.h:65
NDIS_STATUS LANUnregisterAdapter(PLAN_ADAPTER Adapter)
Unregisters protocol with NDIS adapter.
Definition: lan.c:847
UCHAR HWAddress[IEEE_802_ADDR_LENGTH]
Definition: lan.h:68
KEVENT Event
Definition: lan.h:63
enum _NDIS_REQUEST_TYPE NDIS_REQUEST_TYPE
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
unsigned short USHORT
Definition: pedump.c:61
UCHAR State
Definition: lan.h:62
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
struct LAN_ADAPTER LAN_ADAPTER
unsigned int * PULONG
Definition: retypes.h:1
#define IEEE_802_ADDR_LENGTH
Definition: lan.h:15
unsigned int UINT
Definition: ndis.h:50
NTSTATUS LANRegisterProtocol(PNDIS_STRING Name)
Registers this protocol driver with NDIS.
Definition: lan.c:893
struct ETH_HEADER ETH_HEADER
BOOLEAN CompletingReset
Definition: lan.h:43
UINT MaxSendPackets
Definition: lan.h:77
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT _In_ NDIS_HANDLE _In_ NDIS_HANDLE _In_ PNDIS_STRING AdapterName
Definition: ndis.h:6013
VOID LANUnregisterProtocol(VOID)
Unregisters this protocol driver with NDIS.
Definition: lan.c:943
struct ETH_HEADER * PETH_HEADER
VOID LANShutdown(VOID)
USHORT EType
Definition: lan.h:36
VOID LANStartup(VOID)
UINT MaxPacketSize
Definition: lan.h:76