SAPGetAllServers(3sapd)


SAPGetAllServers -- get all server information

Synopsis

#include <sap_app.h> 

int SAPGetAllServers(uint16 ServerType, int *ServerEntry, SAPI *ServerBuf, int MaxEntries);

Description

SAPGetAllServers fills the provided buffer with one or more SAPI structures. The SAPI structure contains information about the server type requested. All integer values are returned in machine order, including those values in the netInfo_t structure. However, the serverAddress field is returned in network order.

The SAPI structure has the following format:

   typedef struct sap_info { 
      uint16    serverType; 
      uint8      serverName[SAP_MAX_SERVER_NAME_LENGTH]; 
      ipxAddr_t serverAddress; 
      uint16    serverHops; 
      netInfo_t netInfo; 
   } SAPI, *SAPIP; 
The SAPI structure is similar to the information obtained from SAP information packets except that it includes an additional structure, netInfo_t, which describes the local network used to access the server. All values in the netInfo_t structure are returned in machine order.

The netInfo_t structure has the following format:

   typedef struct netInfo { 
      uint32   netIDNumber; 
      uint16   timeToNet; 
      uint8    hopsToNet; 
      uint8    netStatus; 
      uint32   lanIndex; 
   } netInfo_t; 
The following table describes the fields of the netInfo_t structure:

Field Description
netIDNumber Network address
timeToNet Number of ticks to the network (tick = 1/18 second)
hopsToNet Intermediate networks
netStatus Network status (defined in <ripx_app.h>)
lanIndex Index to the network's LANs

 
 -------------------------------------------------------------------- 
| Field      |  Description                                         | 
|------------|------------------------------------------------------| 
| netIDNumber|  Network address                                     | 
|------------|------------------------------------------------------| 
| timeToNet  |  Number of ticks to the network (tick = 1/18 second) | 
|------------|------------------------------------------------------| 
| hopsToNet  |  Intermediate networks                               | 
|------------|------------------------------------------------------| 
| netStatus  |  Network status (defined in <ripx_app.h>)            | 
|------------|------------------------------------------------------| 
| lanIndex   |  Index to the network's LANs                         | 
|------------|------------------------------------------------------| 
If your host configuration is set so that the SAP daemon is running, the netInfo_t structure will be filled. If SAPD is not active, SAPGetAllServers retrieves its information from the network and the netInfo_t structure is then set to NULL.

Parameters

(IN) ServerType
Specifies either a type of server or ALL_SERVER_TYPE to obtain information on all servers. Server types are defined in the include file.

(IN/OUT) ServerEntry
Pointer to an index value that indicates the position in SAP responses from which the next MaxEntries will be returned. Modified on return. Should initially be set to 0.

(OUT) ServerBuf
Specifies the address of a buffer, calculated as follows:
sizeof(SAPI * MaxEntries) 
which will be filled with SAPI entries.

(IN) MaxEntries
Specifies the maximum number of SAPI entries which can be put in ServerBuf.

Usage

The ServerEntry argument must be set to zero on the first call and is updated by the SAPGetAllServers function. The updated value should be passed on subsequent calls. You should not modify the contents of ServerEntry except to set the initial value of zero.

If successful, the function returns the number of SAPI entries placed in ServerBuf. The ServerEntry argument is set to the index of the next server entry to be read when the next function call is made. All server entries have been returned when the function return value is less than the value of MaxEntries or zero.

Return values

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

>=0
successful

< 0
unsuccessful

Examples

   ServerType = FILE_SERVER_TYPE; 
   ServerEntry = 0; 
   MaxEntries = 1; 
   

ret=SAPGetAllServers(ServerType,&ServerEntry,&ServerBuf,MaxEntries);


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.