ispx_service_query(3sapd)


ispx_service_query -- query local NetWare subnet for advertised network services

Synopsis

cc ... -lsaprqsts 

#include <netware/sap_srvcs.h>

int ispx_service_query(int service_type, char *server_name, unsigned short server_type, int retries, int delay, char **user_buffer);

Description

The ispx_service_query call performs a local query of a NetWare® subnet for advertised network services. It is typically used by a client application for the general or selective querying of SAPD.

When called with a service_type of GENERAL_SERVICE_REQUEST, the function returns one of the following:

When called with a service_type of NEAREST_SERVICE_REQUEST, the function returns a one-element array of SAP_IDs holding the nearest server of the type specified by server_type.

Parameters

The arguments to this function are:

service_type
specifies either NEAREST_SERVER_REQUEST or GENERAL_SERVICE_REQUEST

server_name
should be either a NULL-terminated character string specifying a server to query, in which case the returned list of services will be limited to those advertised on the server, or NULL for a complete list of services

server_type
specifies an object type

retries
specifies the number of retries; it must be less than or equal to MAX_RETRIES (it is recommended that MAX_RETRIES be used as the number of retries)

delay
specifies the poll delay value; if retries is set to 0, the delay value will be set to MAX_DELAY (it is recommended that MAX_DELAY be used as the poll delay value)

user_buffer
is a doubly indirected pointer; ispx_service_query will dynamically allocate a buffer for the data and set user_buffer to point to it (it is the user's responsibility to free this buffer).

Return values

On completion, the ispx_service_query call returns the number of SAP_ID structures contained in the buffer pointed to by user_buffer, or a value less than zero if unsuccessful. On failure, return values are interpreted as follows:

[IPXDEV_OPEN_FAILED]
the TLI t_open of /dev/ipx failed

[T_BIND_FAILED]
the TLI t_bind call failed

[INVALID_SERVICE_TYPE]
the SAP request type was invalid

[T_SNDUDATA_FAILED]
the TLI t_sndudata call failed and the SAP request was not transmitted

[POLL_FAILED]
the poll call failed

Note that a single SAP query can result in multiple and unknown number of responses. The ispx_service_query function polls the connection end-point until all responses have been processed.

[T_RCVUDATA_FAILED]
the TLI t_rcvudata call failed

[T_UNBIND_FAILED]
the TLI t_unbind call failed

[T_CLOSE_FAILED]
the TLI t_close call failed

[NAME_UNRESOLVED]
the name could not be resolved, that is, an address matching the specified name could not be found

[MALLOC_FAILED]
the call to dynamically allocate the data buffer failed

[REALLOC_FAILED]
the call to dynamically allocate a larger data buffer failed (in cases where the original buffer was insufficient to hold all of the allocated data

References

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