2.1.3 Protocol Driver Query and Set Operations

After a protocol driver has determined which adapters to open and has successfully bound to one or more, it can call NdisRequest to query the underlying NDIS driver for its characteristics and to set the protocol's own operating characteristics. The protocol can also negotiate certain parameters for the binding.

The driver can make requests with general OID_GEN_XXX types of OIDs, that are independent of the underlying medium. The driver can also make requests with medium-specific OIDs that are defined for a particular medium type. The Network Driver Reference documents both types of OIDs. Some OIDs are mandatory, meaning an underlying driver must support them, others are optional.

The protocol driver uses the general OID_GEN_MAXIMUM_FRAME_SIZE to query the maximum frame size, in bytes, supported by an underlying NIC driver. The size returned does not include the packet header.

The protocol driver queries a binding with the general OID_GEN_MAXIMUM_TOTAL_SIZE to determine the largest packet the underlying NIC driver can accommodate on the NIC it manages. The protocol driver must restrict the size of the packets it subsequently sends to this size. It is an error for a protocol driver to submit a larger packet to the underlying NIC driver than the NIC driver has indicated it can support.

A protocol driver should use OID_GEN_MAXIMUM_SEND_PACKETS to determine the number of send packets an underlying driver can accept each time the protocol calls NdisSendPackets. See Section 2.5 for a discussion of how this request can affect the protocol driver’s subsequent send operations.

The protocol driver can make a query request and/or a set request concerning the size of the lookahead data buffer the underlying driver supplies whenever the protocol's ProtocolReceive function is called. The OID used is OID_GEN_CURRENT_LOOKAHEAD. If the protocol driver issues this as a query request, NDIS returns the current lookahead buffer size for the given binding to the underlying NIC driver. If the protocol driver makes a set request with this OID code, it indicates its preferred lookahead buffer size, but the protocol is not assured that an underlying driver will conform to this request. If the underlying driver returned a value greater than one for a preceding OID_GEN_MAXIMUM_SEND_PACKETS query, that driver always indicates receives with a lookahead buffer containing a full network packet.

The protocol driver can query the underlying NIC driver for its link speed with OID_GEN_LINK_SPEED and use the results to set any internal time-out values it maintains. If the protocol driver is bound to NDISWAN, it cannot determine the link speed until it receives a line-up indication from the WAN NIC driver, meaning a connection has been established between the local node and a remote node.

The protocol driver must also issue an OID_GEN_MAC_OPTIONS query to determine the operating characteristics of the underlying NIC driver. This query returns such information as whether the underlying driver supports full-duplex operations. See the Network Driver Reference for the set of NDIS-defined flags that can be returned for this query.

If needed, the protocol driver issues a set request to inform NDIS of its own operating characteristics, passing OID_GEN_PROTOCOL_OPTIONS.

A protocol driver bound above a WAN-capable NIC must also make the following set-information requests:

The protocol driver queries the medium-dependent current address with a medium-dependent OID, such as OID_WAN_CURRENT_ADDRESS, OID_802_3_CURRENT_ADDRESS, OID_802_5_CURRENT_ADDRESS, or OID_FDDI_LONG_CURRENT_ADDRESS.