Service Installation in the Windows Sockets 2 SPI
When the required service class does not already exist, a namespace SPI client uses NSPInstallServiceClass to install a new service class by supplying a service class name, a GUID for the service class identifier, and a series of WSANSCLASSINFO structures. These structures are each specific to a particular namespace, and supply common values such as recommended TCP port numbers or NetWare SAP Identifiers. A service class can be removed by calling NSPRemoveServiceClass and supplying the GUID corresponding to the class identifier.
Once a service class exists, specific instances of a service can be installed or removed via NSPSetService. This function takes a WSAQUERYSET structure as an input parameter along with an operation code and operation flags. The operation code indicates whether the service is being installed or removed. The WSAQUERYSET structure provides all of the relevant information about the service including service class identifier, service name (for this instance), applicable namespace identifier and protocol information, and a set of transport addresses to which the service listens.