srv_getserverbyname

Description

Returns the connection information for server_name, allocating memory as needed. 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

server_name

Name of the server to be looked up.

namelen

Length of server_name. Can be specified as CS_NULLTERM.

querytype

Selects master (CS_ACCESS_CLIENT_MASTER) or query (CS_ACCESS_CLIENT_QUERY) entries for server_name.

result_type

Indicates the data format of connection information. result_type can be specified as SRV_C_GETADDRS or SRV_C_GETSTRS.

resultptr

A pointer allocated by srv_getserverbyname to hold the results of a query. resultptr is the address of a pointer which will receive the address of the query results.

result_cnt

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

Usage

result_type 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 pointers 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”.

See also

srv_freeserveraddrs, srv_send_ctlinfo