QueryServices(3sapd)


QueryServices -- get all server information

Synopsis

#include <sap_dos.h> 

int QueryServices(uint16 QueryType, uint16 ServerType, int ReturnSize, SAP_ID_PACKET *ServiceBuffer);

Description

QueryServices is compatible with native NetWare® and it fills the provided buffer with one or more SAP_ID_PACKET structures.

The number of structures returned is calculated by the following:

   ReturnSize/sizeof(SAP_ID_PACKET) 
If less than one, a -1 value is returned.

The SAP_ID_PACKET structure contains information about the server type requested. All integer values are returned in machine order.

The SAP_ID_PACKET structure has the following format:

   typedef struct { 
      uint16  serverType; 
      char    serverName[SAP_MAX_SERVER_NAME_LENGTH]; 
      uint8   network[IPX_NET_SIZE]; 
      uint8   node[IPX_NODE_SIZE]; 
      uint16  socket; 
      uint16  hops; 
   } SAP_ID_PACKET; 
When the SAP daemon is not running, QueryServices retrieves its information from the network.

Parameters

(IN) QueryType
Specifies type of SAP request to broadcast.

(IN) ServerType
Specifies either a type of server or ALL_SERVER_TYPE to obtain information on all servers.

(IN) ReturnSize
Specifies the size in bytes of the buffer pointed to by ServiceBuffer.

(OUT) ServiceBuffer
Pointer to the address of a buffer which will be filled with SAP_ID_PACKET entries.

Usage

QueryServices does not provide an index value for retrieving SAP information in small batches. If more replies are received than can be placed in ServiceBuffer, the replies are discarded.

If successful, the function returns the number of SAP_ID_PACKET entries placed in ServiceBuffer.

Return values

If an error occurs, the function returns a negative number which is the negative of the error code.

-9
unable to allocate local memory

-3
ReturnSize is less than the size of SAP_ID_PACKET

-2
invalid QueryType

-1
no servers found

>0
successful

<0
unsuccessful

Examples

   QueryType = SAP_NSQ; 
   ServerType = FILE_SERVER_TYPE; 
   ReturnSize = sizeof(SAP_ID_PACKET); 
   

ret=QueryServices(QueryType, ServerType, ReturnSize, &ServiceBuffer);

See also

SAPGetAllServers(3sapd), SAPGetNearestServer(3sapd)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.