xref: /reactos/drivers/network/lan/include/net_lan.h (revision c2c66aff)
1*c2c66affSColin Finck #pragma once
2*c2c66affSColin Finck 
3*c2c66affSColin Finck #include "net_wh.h"
4*c2c66affSColin Finck 
5*c2c66affSColin Finck #define FSCTL_LAN_BASE FILE_DEVICE_NETWORK
6*c2c66affSColin Finck #define _LAN_CONTROL_CODE(Function, Method) \
7*c2c66affSColin Finck     CTL_CODE(FSCTL_LAN_BASE, Function, Method, FILE_WRITE_ACCESS)
8*c2c66affSColin Finck 
9*c2c66affSColin Finck #define LAN_ENUM_ADAPTERS         0
10*c2c66affSColin Finck #define LAN_BUFFERED_MODE         1
11*c2c66affSColin Finck #define LAN_ADAPTER_INFO          2
12*c2c66affSColin Finck 
13*c2c66affSColin Finck #define IOCTL_IF_ENUM_ADAPTERS    \
14*c2c66affSColin Finck     _LAN_CONTROL_CODE(LAN_ENUM_ADAPTERS,METHOD_BUFFERED)
15*c2c66affSColin Finck #define IOCTL_IF_BUFFERED_MODE    \
16*c2c66affSColin Finck     _LAN_CONTROL_CODE(LAN_BUFFERED_MODE,METHOD_BUFFERED)
17*c2c66affSColin Finck #define IOCTL_IF_ADAPTER_INFO     \
18*c2c66affSColin Finck     _LAN_CONTROL_CODE(LAN_ADAPTER_INFO,METHOD_BUFFERED)
19*c2c66affSColin Finck 
20*c2c66affSColin Finck typedef struct _LAN_PACKET_HEADER_T {
21*c2c66affSColin Finck     UINT  Adapter;
22*c2c66affSColin Finck     UINT  AddressType;
23*c2c66affSColin Finck     UINT  AddressLen;
24*c2c66affSColin Finck     UINT  PacketType;
25*c2c66affSColin Finck     PVOID Mdl;
26*c2c66affSColin Finck } LAN_PACKET_HEADER_T, *PLAN_PACKET_HEADER_T;
27*c2c66affSColin Finck 
28*c2c66affSColin Finck typedef struct _LAN_PACKET_HEADER {
29*c2c66affSColin Finck     LAN_PACKET_HEADER_T Fixed;
30*c2c66affSColin Finck     CHAR Address[1];
31*c2c66affSColin Finck } LAN_PACKET_HEADER, *PLAN_PACKET_HEADER;
32*c2c66affSColin Finck 
33*c2c66affSColin Finck typedef struct _LAN_ADDRESS {
34*c2c66affSColin Finck     UINT Adapter;
35*c2c66affSColin Finck     UINT Flags;
36*c2c66affSColin Finck     USHORT AddressType;
37*c2c66affSColin Finck     USHORT AddressLen;
38*c2c66affSColin Finck     USHORT HWAddressType;
39*c2c66affSColin Finck     USHORT HWAddressLen;
40*c2c66affSColin Finck     CHAR Address[1];
41*c2c66affSColin Finck } LAN_ADDRESS, *PLAN_ADDRESS;
42*c2c66affSColin Finck 
43*c2c66affSColin Finck typedef struct _LAN_ADAPTER_INFO_S {
44*c2c66affSColin Finck     UINT Index;
45*c2c66affSColin Finck     UINT Media;
46*c2c66affSColin Finck     UINT Speed;
47*c2c66affSColin Finck     USHORT AddressLen;
48*c2c66affSColin Finck     USHORT Overhead;
49*c2c66affSColin Finck     USHORT MTU;
50*c2c66affSColin Finck     USHORT RegKeySize;
51*c2c66affSColin Finck } LAN_ADAPTER_INFO_S, *PLAN_ADAPTER_INFO_S;
52*c2c66affSColin Finck 
53*c2c66affSColin Finck #define LAN_DATA_PTR(PH) \
54*c2c66affSColin Finck   ((PH)->Address + (PH)->Fixed.AddressLen)
55*c2c66affSColin Finck #define LAN_ALLOC_SIZE(AddrLen,PayloadLen) \
56*c2c66affSColin Finck   (sizeof(LAN_PACKET_HEADER_T) + (AddrLen) + (PayloadLen))
57*c2c66affSColin Finck #define LAN_PAYLOAD_SIZE(PH,Size) \
58*c2c66affSColin Finck   (Size - (PH)->Fixed.AddressLen - sizeof(LAN_PACKET_HEADER_T))
59*c2c66affSColin Finck 
60*c2c66affSColin Finck #define LAN_ADDR_SIZE(AddrLen,HWAddrLen) \
61*c2c66affSColin Finck   (sizeof(LAN_ADDRESS) - 1 + (AddrLen) + (HWAddrLen))
62*c2c66affSColin Finck #define LAN_ADDR_PTR(LA) \
63*c2c66affSColin Finck   ((LA)->Address)
64*c2c66affSColin Finck #define LAN_HWADDR_PTR(LA) \
65*c2c66affSColin Finck   ((LA)->Address + (LA)->AddressLen)
66*c2c66affSColin Finck 
67*c2c66affSColin Finck #define LAN_EA_INFO_SIZE(NumTypes) \
68*c2c66affSColin Finck   sizeof(FILE_FULL_EA_INFORMATION) + (6 + sizeof(USHORT) * NumTypes)
69*c2c66affSColin Finck #define LAN_FILL_EA_INFO(Ea,NumTypes,Types) \
70*c2c66affSColin Finck   { \
71*c2c66affSColin Finck     RtlCopyMemory( (Ea)->EaName, "TYPES", 6 ); \
72*c2c66affSColin Finck     (Ea)->EaNameLength = 6; \
73*c2c66affSColin Finck     (Ea)->EaValueLength = sizeof(USHORT) * (NumTypes); \
74*c2c66affSColin Finck     RtlCopyMemory( (Ea)->EaName + (Ea)->EaNameLength, \
75*c2c66affSColin Finck 		   (Types), \
76*c2c66affSColin Finck 		   sizeof(USHORT) * (NumTypes) ); \
77*c2c66affSColin Finck   }
78