PNRP and WSALookupServiceNext
PNRP uses the WSALookupServiceNext function to match queries specified in a previous call to WSALookupServiceBegin. The results of the WSALookupServiceNext function are determined by settings in the WSAQUERYSET structure passed in the initial WSALookupServiceBegin function call. This function is used to perform the following two functions:
- Resolving a peer name to a list of addresses
- Enumerating network clouds
By using WSANSPIoctl, the lookup service can be used asynchronously. For information about using the lookup service functions asynchronously, see PNRP and WSANSPIoctl.
The WSALookupServiceNext function blocks even if WSANSPIoctl is called. Before calling WSALookupServiceNext, an application must wait until it receives a notification—if blocking is an issue.
Resolving a Peer Name to a List of Addresses
When resolving a peer name to a list of addresses, the LPWSAQUERYSET structure returned in the lpqsResults parameter contains the following values:
-
dwSize
-
Returns the size of the structure.
-
lpszServiceInstanceName
-
Returns a peer name—if LUP_RETURN_NAME, LUP_RETURN_ALL, or NULL are specified.
-
lpServiceClassID
-
Returns SVCID_PNRPNAME.
-
lpVersion
-
Returns NULL.
-
lpszComment
-
Returns a comment—if LUP_RETURN_COMMENT, LUP_RETURN_ALL, or NULL are specified.
-
dwNameSpace
-
Returns NS_PNRPNAME.
-
lpNSProviderID
-
Returns NS_PROVIDER_PNRPNAME.
-
lpszContext
-
Returns the cloud name if LUP_RETURN_NAME, LUP_RETURN_ALL, or NULL are specified.
-
dwNumberOfProtocols
-
Returns zero (0).
-
lpszQueryString
-
Returns NULL.
-
dwNumberOfCsAddrs
-
Returns the number of entries in the CSADDR_INFO array if LUP_RETURN_ADDR, LUP_RETURN_ALL, or NULL are specified. This value and the information in lpcsaBuffer are the key bits of information returned in this structure.
-
lpcsaBuffer
-
Returns a pointer to an array of CSADDR_INFO structures if LUP_RETURN_ADDR, LUP_RETURN_ALL, or NULL are specified. This buffer and the value in dwNumberOfCsAddrs are the key information bits returned in this structure.
-
dwOutputFlags
-
Returns zero (0).
-
lpBlob
-
Returns NULL.
Enumerating Network Clouds
When enumerating clouds, the LPWSAQUERYSET structure returned in the lpqsResults parameter contains the following values:
-
dwSize
-
Returns the size of the structure.
-
lpszServiceInstanceName
-
Returns a cloud name—if LUP_RETURN_NAME, LUP_RETURN_ALL, or NULL are specified.
-
lpServiceClassID
-
Returns SVCID_PNRPCLOUD.
-
lpVersion
-
Returns NULL.
-
lpszComment
-
Returns NULL.
-
dwNameSpace
-
Returns NS_PNRPCLOUD.
-
lpNSProviderID
-
Returns NS_PROVIDER_PNRPCLOUD.
-
lpszContext
-
Returns NULL.
-
dwNumberOfProtocols
-
Returns zero (0).
-
lpszQueryString
-
Returns NULL.
-
dwNumberOfCsAddrs
-
Returns zero (0).
-
lpcsaBuffer
-
Returns NULL.
-
dwOutputFlags
-
Returns zero (0).
-
lpBlob
-
Returns a pointer to a BLOB structure that points to a PNRPCLOUDINFO structure—if LUP_RETURN_BLOB, LUP_RETURN_ALL, or NULL are specified.
PNRPCLOUDINFO Structure
When enumerating cloud names, the following values are returned in the PNRPCLOUDINFO structure:
-
dwSize
-
The size of this structure.
-
Cloud
-
The actual cloud value.
-
enCloudState
-
The current state of a cloud. PNRP_CLOUD_STATE specifies the valid values.
-
enCloudFlags
-
Indicates that a cloud name is valid on a network, or only valid on a current computer. PNRP_CLOUD_FLAGS specifies the valid values. Some cloud names are valid on any computer on the same network. Other cloud names are valid only on a current computer, and may be valid only for a period of time.
- If enCloudFlags is set to PNRP_CLOUD_NAME_LOCAL, the name is only valid locally.
- If enCloudFlags is not set, then the cloud name can be transferred to other computers.
Related topics