Platform SDK: Windows Sockets |
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.
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 identifier 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 an identified provider. If the name space provider identifier 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 identifier 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 to 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.
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 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.