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 */ 22 } ETH_HEADER, *PETH_HEADER; 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 */ 62 } LAN_ADAPTER, *PLAN_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 85 NDIS_STATUS LANRegisterAdapter( 86 PNDIS_STRING AdapterName, 87 PNDIS_STRING RegistryPath); 88 89 NDIS_STATUS LANUnregisterAdapter( 90 PLAN_ADAPTER Adapter); 91 92 NTSTATUS LANRegisterProtocol( 93 PNDIS_STRING Name); 94 95 VOID NTAPI 96 LANUnregisterProtocol(VOID); 97 98 VOID LANStartup(VOID); 99 VOID LANShutdown(VOID); 100 101 NTSTATUS TcpipLanGetDwordOid( PIP_INTERFACE Interface, NDIS_OID Oid, 102 PULONG Result ); 103 104 NDIS_STATUS NDISCall( 105 PLAN_ADAPTER Adapter, 106 NDIS_REQUEST_TYPE Type, 107 NDIS_OID OID, 108 PVOID Buffer, 109 UINT Length); 110 111 /* EOF */ 112