A simple adapter neutral driver for sending and receiving packets from NDIS adapters, querying adapters, and assigning and querying protocol addresses.
It supports these operations:
- Read – Get the next packet that matches our target type
- Write – Put a packet on the indicated adapter, building a link layer header as appropriate
- LookupAddress – Match a partial address (either the protocol address or the link layer address) on the indicated adapter and return the full address.
- PushAddress – Set an address mapping, deleting previous matching protocol addresses.
- EraseAddress – Remove matching address mappings.
- EnumAdapters – Return an array of adapter indices.
- Bufferedmode – Set buffered mode to allow userland use of NtReadFile in lan.sys (mostly testing).
- AddAddress – Set an address association for the indicated adapter. This will be considered to be a local address and will be associated with the adapter's link layer address.
- RemAddress – Remove a local address from the indicated adapter.
- AdapterInfo – Return a struct containing information about the indicated adapter, including its ndis registry key, speed, link layer address, etc.
- Sending a packet from LAN.SYS: fill out a LAN_PACKET_HEADER and do WriteFile on it. The specified link layer address will be used as the target address. A zero-length address means broadcast.
- Receiving a packet from LAN.SYS: just do ReadFile on a buffer and wait for a LAN_PACKET_HEADER to appear.