6.1 Windows Sockets Helper DLL Architecture

Windows Socket Helper (WSH) DLLs are user-mode components provided by transport driver writers to facilitate the usage of Windows Sockets with their transports. Figure 6.1 shows an overview of this architecture.

Figure 6.1 Windows Sockets Helper DLL Architecture

Windows NT provides a dynamic-link library, msafd.dll, which is a sockets service provider. When a transport driver is installed in the system and it installs a transport-specific WSH DLL, network setup will automatically configure msafd.dll to be the service provider for that WSH DLL. When an application makes a call to a Windows Sockets function, such as WSASocket, MSAFD as the service provider will resolve the call and make a call to the appropriate WSH DLL for assistance as necessary.

Some Windows Sockets functions require no assistance from any WSH DLL. For example, sending or receiving data does not require the WSH DLL as the connections have already been established. In cases such as these, MSAFD can communicate directly with the transport by calling Win32 functions.

However, for function calls that rely on transport-specific features or where the implementation can vary from transport to transport, the transport-specific WSH DLL will be used to resolve these ambiguities. For example, WSAJoinLeaf adds a socket to an established multipoint session. Each transport implements the addition of new connections to a multipoint session differently. Consequently, MSAFD calls the appropriate WSH DLL to support the sockets interface according to the transport-specific implementation. To support application calls to WSAJoinLeaf, MSAFD calls the WSH DLL's WSHJoinLeaf function to validate the options requested and call the transport with the appropriate information to add a new socket to a multipoint session.

If a transport supports the new features of Windows Sockets 2, including multipoint session sockets, socket grouping, and logical representations of socket addresses, the corresponding WSH DLL must export the Windows Sockets 2 functions, summarized later in Section 6.6.