4.1 The Network Driver Interface Specification (NDIS)
The Network Driver Interface Specification (NDIS) describes the interface by which one or multiple NIC drivers communicate with one or multiple underlying network interface cards, one or multiple overlying transport drivers, and the operating system. NDIS includes provisions that enable:
·a transport driver to set specific configuration parameters for a network interface card or a NIC driver.
·a transport driver to query a NIC driver for specific configuration and statistics from the underlying network interface card or the NIC driver.
·a transport driver to pass a network packet to any one of several underlying NIC drivers for transmission on the network via any one of multiple network interface cards.
·a NIC driver to asynchronously inform an overlying transport driver of changes in network status.
·a NIC driver to accept a network packet from any one of several underlying network interface cards, and pass it up to one or multiple transport drivers that are interested in receiving it.
NDIS 3 defines a fully abstracted environment for NIC driver development. For every external function that a NIC driver needs to perform, it can rely on NDIS 3 APIs to perform the function. This includes the entire range of tasks performed by a NIC driver from communicating with transport drivers to registering and intercepting NIC hardware interrupts and communicating with underlying network interface cards via manipulating registers, port I/O, etc. Therefore, NIC drivers can be written entirely in platform-independent high-level languages such as C (some NIC drivers may optionally use small portions of platform-specific assembly language for performance optimization). These drivers can then be recompiled to run in any NDIS environment including Windows 95 on 80x86 systems, and Windows NT on 80x86, MIPS, DEC Alpha, and PowerPC platforms.
To provide this level of abstraction and portability, NDIS 3 uses an export library referred to as the NDIS interface library or NDIS wrapper. All interactions between a NIC driver and transport drivers, a NIC driver and the operating system, and a NIC driver and network interface cards are executed via calls to the NDIS library functions. The NDIS library is packaged in an export library (NDIS.SYS) as a set of abstract functions, with emphasis on in-line macros for maximum performance. Both transport and NIC drivers link against this library. When called, an NDIS library function calls an associated function in a transport or NIC driver, calls the operating system, or performs a local action internally.
Figure 4.1 NDIS 3 Driver Architecture
In effect, the NDIS interface library forms a wrapper around a NIC driver, as shown in Figure 4.1. At the upper edge, the NDIS library interfaces between the NIC driver and various transport protocols. At the lower edge, the NDIS library provides functions that are common across NIC drivers that interface between the NIC driver and network interface cards.
The NDIS library also includes a special Filter Library with which a set of NIC driver upper-edge functions are associated. The filter libraries provide an environment where a transport driver can specify destination addresses or address types for packets that it is interested in receiving. Thereafter, each incoming packet will be routed to one, multiple, or all bound transport drivers based on the packet's destination address.