WSAESETSERVICEOP Enumeration

The NSPSetService function registers or deregisters a service instance within a namespace.

Syntax

typedef enum _WSAESETSERVICEOP
{
    RNRSERVICE_REGISTER = 0,
    RNRSERVICE_DEREGISTER,
    RNRSERVICE_DELETE
} WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;  

Remarks

The following table lists the available values for essOperation and dwControlFlags.

Operation Flags Service already exists Service does not exist
RNRSERVICE_REGISTER None Overwrites the object. Uses only addresses specified. Object is REGISTERED. Creates a new object. Uses only addresses specified. Object is REGISTERED.
RNRSERVICE_REGISTER SERVICE_MULTIPLE Updates object. Adds new addresses to existing set. Object is REGISTERED. Creates a new object. Uses all addresses specified. Object is REGISTERED.
RNRSERVICE_DEREGISTER None Removes all addresses, but does not remove object from namespace. Object is DEREGISTERED. WSASERVICE_NOT_FOUND
RNRSERVICE_DEREGISTER SERVICE_MULTIPLE Updates object. Removes only addresses that are specified. Only mark object as DEREGISTERED if no addresses are present. Does not remove from the namespace. WSASERVICE_NOT_FOUND
RNRSERVICE_DELETE None Removes object from the namespace. WSASERVICE_NOT_FOUND
RNRSERVICE_DELETE SERVICE_MULTIPLE Removes only addresses that are specified. Only removes object from the namespace if no addresses remain. WSASERVICE_NOT_FOUND

When the dwControlFlags parameter is set to SERVICE_MULTIPLE, this enables an application to manage its addresses independently. This is useful when the application must manage its protocols individually or when the service resides on more than one computer. For example, when a service uses more than one protocol, one listening socket may abort, but the other sockets remain operational. In this example, the service could deregister the aborted address without affecting the other addresses.

When using SERVICE_MULTIPLE, an application must not let old addresses remain in the object. This can happen if the application aborts without issuing a RNRSERVICE_DEREGISTER request. When a service registers, it should store its addresses. On its next call, the service should explicitly deregister these old addresses before registering new addresses.

Service Properties

The following table lists WSAQUERYSET member names and describes how service property data is represented. Members labeled as (Optional) can be supplied with a null pointer.

WSAQUERYSET member name Service property description
dwSize Set to the sizeof(WSAQUERYSET). This is a versioning mechanism.
lpszServiceInstanceName The referenced string contains the service instance name.
lpServiceClassId The GUID that corresponds to this service class.
lpVersion Optional. Supplies the service instance version number.
lpszComment Optional. An optional comment string.
dwNameSpace Ignored for this operation.
lpNSProviderId Ignored for this operation. The provider identifier is contained in the lpProviderId parameter.
lpszContext Optional. The starting point of the query in a hierarchical namespace.
dwNumberOfProtocols Ignored for this operation.
lpafpProtocols Ignored for this operation.
pszQueryString Ignored for this operation.
dwNumberOfCsAddrs The number of elements in the array of CSADDR_INFO structures referenced by lpcsaBuffer.
lpcsaBuffer A pointer to an array of CSADDR_INFO structures that contain the address or addresses that the service is listening on.
dwOutputFlags Ignored for this operation.
lpBlob Optional. Pointer to a provider-specific entity.

Note

It is acceptable for the iProtocol member of the CSADDR_INFO structure to contain the manifest constant IPROTOCOL_ANY, indicating a wildcard value. The namespace provider should substitute an acceptable value for the given address family and socket type.

Constants

Constant Description
RNRSERVICE_REGISTER  
RNRSERVICE_DEREGISTER  
RNRSERVICE_DELETE  

Requirements

Header: Declared in winsock2.h.

Library: Use ws2_32.lib.