Name Resolution Division of Responsibilities Between DLL and Service Providers

The following paragraphs describe how the WS2_32.DLL and the name space providers cooperate together to implement the name resolution services supported by the Windows Sockets 2 API.

WS2_32.DLL Functionality for Name Resolution

The WS2_32.DLL manages the registration and demand loading of individual name space provider DLLs. It also is responsible for routing name space operations from a Windows Sockets 2 application to the appropriate set of name space providers. This mapping is governed by the value of name space and service provider ID parameters that are found in individual API functions. As a general rule, when a specific name space provider is referenced, the operation is only routed to identified provider. If the name space provider ID is NULL but a particular name space is referenced, the operation is routed to all name space providers that support the identified name space. If the name space provider ID is NULL and the name space identifier is given as NS_ALL, then the operation is routed to all active name space providers.

As part of starting a query to one or more service providers the WS2_32.DLL allocates an object to keep track of the ongoing state of the query. An opaque handle representing this object is returned to the application that started the query. The application supplies this handle as a parameter each time it repetitively calls an application interface function to retrieve the next unit of data resulting from the query. In response to these application interface procedure calls, the WS2_32.DLL uses the information it stores in the object make corresponding calls to the name space providers involved in the query. The WS2_32.DLL updates the information in its object as each successive application interface call occurs so that the corresponding calls to name space providers progress appropriately through all of the name space providers involved in the query.

Name Space Provider Functionality

Each name space provider is responsible for mapping the set of functions appearing in the Windows Sockets 2 name resolution SPI to the appropriate transactions with the supported name space. In some cases, this is primarily a matter of mapping the SPI interface to whatever native interface exists for the name space. In others, the name space provider must conduct transactions with the name space provider over the network. Some name space providers will do this by making calls to the Windows Sockets API, others will use private interfaces to associated transport stacks.