SAPGetServerByAddr(3sapd)


SAPGetServerByAddr -- get server information by address

Synopsis

#include <sap_app.h> 

int SAPGetServerByAddr(ipxAddr_t *ServerAddr, uint16 ServerType, int *ServerEntry, SAPI *ServerBuf, int MaxEntries);

Description

SAPGetServerByAddr requests server entries by address and type. If the specified type is ALL_SERVER_TYPE, then all servers at the specified address are returned. For example, a NetWare® file server and its print server can be on the same machine.

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, SAPGetServerByAddr retrieves its information from the network and the netInfo_t structure is then set to NULL.

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 call is made. All server entries have been returned when the function return value is zero or less than the MaxEntries.

Parameters

(IN) ServerAddr
Pointer to the address structure of the requested server.

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

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

(OUT) ServerBuf
Pointer to the address of a buffer whose size is 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 ServerAddr argument specifies the net and node address of the requested service. The socket number is not checked. Therefore, all services on a host machine will have the same address.

The ServerType argument specifies either the type of server desired or ALL_SERVER_TYPE to obtain information on all servers at that address.

The ServerEntry argument must be set to zero (0) on the first call and is updated by SAPGetServerByAddr. The updated value should be returned on subsequent calls. You should not modify the contents of ServerEntry except to set the initial value to zero.

The ServerBuf argument specifies the address of a buffer whose size is calculated as follows:

   sizeof(SAPI * MaxEntries) 
which will be filled with SAPI entries.

The MaxEntries argument specifies the maximum number of SAPI entries which can be put in ServerBuf.

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

   memset ((char*) &addr, 0, sizeof(ipxAddr_t)); 
   addr.net[0] = 0x01; 
   addr.net[1] = 0x23; 
   addr.net[2] = 0x45; 
   addr.net[3] = 0x67; 
   addr.node[5] = 0x01; 
   ServerType = FILE_SERVER_TYPE; 
   ServerEntry = 0; 
   MaxEntries = 1; 
   ret=SAPGetServerByAddr(ServerAddr,ServerType,&ServerEntry,&ServerBuf,MaxEntries); 

References

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