srv_getserverbyname

Description

Returns the connection information for server_name, allocating memory as needed. server_name is the name of the server to be looked up. Memory allocated by srv_getserverbyname can be freed by calling srv_freeserveraddrs.

Syntax

CS_RETCODE srv_getserverbyname(CS_CHAR *server_name,
CS_INT namelen, CS_INT querytype, CS_INT result_type, void
*resultptr, CS_INT *result_cnt)

Parameters

namelen

Length of server_name. Can be specified as CS_NULLTERM.

querytype

Allows master (CS_ACCESS_CLIENT_MASTER) or query (CS_ACCESS_CLIENT_QUERY) entries for a given server name.

result_type

Indicates the data format the information will be returned as. Can be specified as SRV_C_GETADDRS, where the information will be returned as an array of CS_TRANADDR structures. Alternatively, you can specify result_type as SRV_C_GETSTRS, which returns an array of points to character strings in the network-protocol protocol-address filter-information format. For example, where network-protocol is “tcp”, protocol-address is “myhost 4000”, and filter-information is “ssl”, you will receive a result of “tcp myhost 4000 ssl”.

resultptr

A pointer allocated by srv_getserverbyname to hold the results of a query.

result_cnt

A pointer to CS_INT that contains the number of addresses returned for server_name.