Bewerken

Delen via


Multiplex ID Management

RDBSS defines a multiplex ID (MID), a 16-bit value, that can be used by both the network client (mini-redirector) and the server to distinguish between the concurrently active requests on any connection. A network redirector can associate a MID with any arbitrary context or internal data structure that it uses. It is completely at the option of the network redirector whether MIDs are allocated and used.

A MID, as defined by RDBSS, is part of a MID_ATLAS data structure that has been designed to meet several criterion. Associated with a MID_ATLAS data structure are a series of one or more MID_MAP data structures used to map MIDs to associated contexts.

The MID_ATLAS data structure, the MID_MAP structure, and MIDs should scale well to handle the differing capabilities of various remote servers. For example, the typical LAN Manager server on Windows permits 50 outstanding requests on any connection. Some types of servers may support as few as one outstanding request, while gateway servers may desire this number to be very high (on the order of thousands of outstanding connections).

The two primary operations that need to be handled well are:

  • Mapping a MID to the context associated with it. This routine will be invoked to process every packet received along any connection at both the client and the server (assuming the servers use MIDs).

  • Generating a new MID for sending requests to the server. This routine will be used at the client for enforcement of maximum connection limits as well as for tagging each concurrent request with a unique ID.

The MID must be able to efficiently manage the unique tagging and identification of a number of MIDs (typically 50) from a possible combination of 65,536 values. In some cases, it might make sense to create a small MID_ATLAS structure to save kernel memory used by the MID_MAP structure and expand the size of the MID_ATLAS structure if needed to efficiently handle greater usage. To ensure a proper time-space tradeoff, the lookup is organized as a three-level hierarchy. The 16 bits used to represent a MID are split up into three-bitfields. The length of the right-most field (least significant ) is decided by the maximum number of MIDs that are allowed in the initial atlas. This maximum value is a parameter passed to the RxCreateMidAtlas routine when the MID_ATLAS data structure is first created. This maximum value determines the initial size of the MID_ATLAS data structure that is created and how many MID_MAP data structures can be accommodated. The remaining length is split up equally between the next two fields, which determine the maximum size of possible subordinate MID_ATLAS structures that can be defined to expand and extend an existing MID_ATLAS into a three-level hierarchy of MID_MAP data structures. So, each MID_ATLAS data structure can contain the maximum number of MID_MAP structures or a pointer to one subordinate MID_ATLAS and the MID_MAP structures.

For example, if a maximum of 50 MIDs are allocated on creation , the length of the first field is 6 (64 ( 2 ** 6 ) is greater than 50 ). The remaining length is split into two fields of 5 bits each for the second and third hierarchical levels so that an existing MID_ATLAS data structure can be expanded to accommodate more MID_MAP entries.

RDBSS provides the following routines for creating and manipulating a MID_ATLAS data structure, associated MID_MAP data structures, and Multiplex IDs.

Routine Description

RxAssociateContextWithMid

This routine associates the supplied opaque context with an available MID from a MID_ATLAS structure.

RxCreateMidAtlas

This routine allocates a new instance of the MID_ATLAS data structure and initializes it.

RxDestroyMidAtlas

This routine destroys an existing instance of a MID_ATLAS data structure and frees the memory allocated to it. As a side effect it invokes the passed in context destructor on every valid context in the MID_ATLAS structure.

RxMapMidToContext

This routine maps a MID to its associated context in a MID_ATLAS structure.

RxMapAndDissociateMidFromContext

This routine maps a MID to its associated context in a MID_ATLAS structure and then disassociates the MID from the context.

RxReassociateMid

This routine reassociates a MID with an alternate context.