ReactOS 0.4.16-dev-122-g325d74c
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 */
18typedef 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 */
39typedef 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 UINT 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
97
100
102 PULONG Result );
103
105 PLAN_ADAPTER Adapter,
109 UINT Length);
110
111/* EOF */
unsigned char BOOLEAN
Type
Definition: Type.h:7
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
struct ETH_HEADER * PETH_HEADER
struct LAN_ADAPTER LAN_ADAPTER
VOID LANUnregisterProtocol(VOID)
Unregisters this protocol driver with NDIS.
Definition: lan.c:943
struct LAN_ADAPTER * PLAN_ADAPTER
NDIS_STATUS LANRegisterAdapter(PNDIS_STRING AdapterName, PNDIS_STRING RegistryPath)
Registers protocol with an NDIS adapter.
Definition: lan.c:637
NDIS_STATUS LANUnregisterAdapter(PLAN_ADAPTER Adapter)
Unregisters protocol with NDIS adapter.
Definition: lan.c:847
NTSTATUS LANRegisterProtocol(PNDIS_STRING Name)
Registers this protocol driver with NDIS.
Definition: lan.c:893
struct ETH_HEADER ETH_HEADER
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
UINT64 OID
Definition: marshal.c:88
unsigned int UINT
Definition: ndis.h:50
enum _NDIS_REQUEST_TYPE NDIS_REQUEST_TYPE
_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:6016
enum _NDIS_MEDIUM NDIS_MEDIUM
int NDIS_STATUS
Definition: ntddndis.h:475
ULONG NDIS_OID
Definition: ntddndis.h:230
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
Definition: lan.h:33
UCHAR SrcAddr[IEEE_802_ADDR_LENGTH]
Definition: lan.h:35
USHORT EType
Definition: lan.h:36
UCHAR DstAddr[IEEE_802_ADDR_LENGTH]
Definition: lan.h:34
UINT PacketFilter
Definition: lan.h:80
UCHAR OldState
Definition: lan.h:42
PVOID Context
Definition: lan.h:64
UINT MinFrameSize
Definition: lan.h:75
UCHAR HWAddress[IEEE_802_ADDR_LENGTH]
Definition: lan.h:68
KSPIN_LOCK Lock
Definition: lan.h:60
UCHAR HeaderSize
Definition: lan.h:73
KEVENT Event
Definition: lan.h:63
UINT MTU
Definition: lan.h:55
BOOLEAN CompletingReset
Definition: lan.h:43
UCHAR State
Definition: lan.h:62
NDIS_STATUS NdisStatus
Definition: lan.h:66
UINT HWAddressLength
Definition: lan.h:69
UINT MacOptions
Definition: lan.h:78
LIST_ENTRY ListEntry
Definition: lan.h:57
NDIS_HANDLE NdisHandle
Definition: lan.h:65
UINT MaxSendPackets
Definition: lan.h:77
UCHAR BCastMask
Definition: lan.h:70
UCHAR BCastCheck
Definition: lan.h:71
NDIS_MEDIUM Media
Definition: lan.h:67
UCHAR BCastOffset
Definition: lan.h:72
UINT Speed
Definition: lan.h:79
UINT MaxPacketSize
Definition: lan.h:76
Definition: typedefs.h:120
VOID LANStartup(VOID)
NTSTATUS TcpipLanGetDwordOid(PIP_INTERFACE Interface, NDIS_OID Oid, PULONG Result)
Definition: lan.c:184
#define IEEE_802_ADDR_LENGTH
Definition: lan.h:15
VOID LANShutdown(VOID)
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_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:409
unsigned char UCHAR
Definition: xmlstorage.h:181