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 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 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
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.