NDISWAN is an intermediate NDIS driver that presents an 802.3 miniport NIC driver interface to the protocol driver(s) above it and a protocol driver interface to a WAN miniport below it that manages a WAN-capable NIC. NDISWAN has a private interface to the kernel-mode NDISTAPI driver for dynamically setting up and tearing down TAPI links.
NDISWAN converts an out-going packet from LAN to PPP format. NDISWAN uses simple HDLC framing. Most of the media-specific framing must be done in the miniport. NDISWAN gets hints about the WAN miniport NIC driver framing from the miniport’s response to the OID_WAN_MEDIA_SUBTYPE.
Before a WAN miniport can send or receive packets on the network, an application must set up a connection that originates on the sending node or accept a connection that originates on a remote node by making or accepting a call. The setup, supervision and tear-down of a connection is done through TAPI. TAPI requests and status indications to TAPI all go through NDISWAN. See Chapter 6 for details of setting up a miniport to use TAPI services.
After a connection is established with a remote node, packets can be exchanged. The typical path of a WAN connection from a protocol driver to the miniport NIC driver begins when a protocol driver calls NdisSend with a packet. NDISWAN examines the packet header and decides over which link the packet will be sent. NDISWAN copies the typically discontiguous data packet into a contiguous buffer with the appropriate header and tail padding specified by the WAN miniport during its initialization and registration. The link then has several possible configuration options: header compression, data compression, and encryption. These configuration options are applied in that order on the link. On the receive side, the reverse path is applied. Anytime a configuration option such as compression or encryption is enabled, the WAN miniport NIC driver is informed.
Finally, before sending the packet to the WAN miniport’s MiniportWanSend function, NDISWAN does simple PPP HDLC framing unless the WAN miniport has indicated that it will perform these operations in the adapter. Simple PPP HDLC framing is PPP's HDLC framing without the FCS, bit or byte stuffing, and any beginning or end flags. (See later sections on media-specific framing for more information.)
After the packet is received by the WAN miniport, it should send the packet out on the WAN link. The default number of outstanding packets the WAN miniport can have per data channel is specified by the driver as the MaxTransmit value it provides when it responds to the OID_WAN_GET_INFO request. However, the miniport can manage the send window dynamically and on a per-line basis when it calls NdisMIndicateStatus with a line-up indication by providing a new nonzero value for the SendWindow member of the NDIS_MAC_LINE_UP structure passed in the call. If a WAN miniport that makes a line-up indication sets the value of the SendWindow to zero, NDISWAN uses the default value MaxTransmit for that line.
The WAN miniport NIC driver might have to modify or add to the header as well as add to the end (tail) of the packet (for example, to add the FCS). Appropriate padding at the beginning and end of the packet is provided for. The WAN miniport can alter the data in the packet in any way it sees fit to send it on the WAN medium.