Skip Navigation Links | |
Exit Print View | |
![]() |
man pages section 3: Networking Library Functions Oracle Solaris 10 1/13 Information Library |
gss_create_empty_oid_set(3GSS)
gss_inquire_cred_by_mech(3GSS)
gss_inquire_mechs_for_name(3GSS)
gss_inquire_names_for_mech(3GSS)
gss_process_context_token(3GSS)
ldap_enable_translation(3LDAP)
ldap_get_entry_controls(3LDAP)
ldap_get_lang_values_len(3LDAP)
ldap_init_getfilter_buf(3LDAP)
ldap_init_searchprefs_buf(3LDAP)
ldap_init_templates_buf(3LDAP)
ldap_parse_extended_result(3LDAP)
ldap_parse_sasl_bind_result(3LDAP)
ldap_sasl_interactive_bind_s(3LDAP)
ldap_set_string_translators(3LDAP)
ldap_translate_from_t61(3LDAP)
rpc_gss_get_principal_name(3NSL)
rpc_gss_svc_max_data_length(3NSL)
sasl_auxprop_add_plugin(3SASL)
sasl_canonuser_add_plugin(3SASL)
sasl_client_plug_init_t(3SASL)
sasl_server_plug_init_t(3SASL)
sasl_server_userdb_checkpass_t(3SASL)
sasl_server_userdb_setpass_t(3SASL)
sdp_add_connection(3COMMPUTIL)
sdp_add_information(3COMMPUTIL)
sdp_delete_all_field(3COMMPUTIL)
sdp_delete_all_media_field(3COMMPUTIL)
sdp_delete_attribute(3COMMPUTIL)
sdp_find_attribute(3COMMPUTIL)
sdp_find_media_rtpmap(3COMMPUTIL)
sdp_session_to_str(3COMMPUTIL)
sip_delete_header_by_name(3SIP)
sip_disable_dialog_logging(3SIP)
sip_disable_trans_logging(3SIP)
sip_enable_dialog_logging(3SIP)
sip_enable_trans_logging(3SIP)
sip_get_contact_display_name(3SIP)
sip_get_content_sub_type(3SIP)
sip_get_dialog_local_contact_uri(3SIP)
sip_get_dialog_local_cseq(3SIP)
sip_get_dialog_local_tag(3SIP)
sip_get_dialog_local_uri(3SIP)
sip_get_dialog_remote_cseq(3SIP)
sip_get_dialog_remote_tag(3SIP)
sip_get_dialog_remote_target_uri(3SIP)
sip_get_dialog_remote_uri(3SIP)
sip_get_dialog_route_set(3SIP)
sip_get_from_display_name(3SIP)
sip_get_passertedid_display_name(3SIP)
sip_get_passertedid_uri_str(3SIP)
sip_get_ppreferredid_display_name(3SIP)
sip_get_ppreferredid_uri_str(3SIP)
sip_get_proxy_authen_param(3SIP)
sip_get_proxy_authen_scheme(3SIP)
sip_get_proxy_author_param(3SIP)
sip_get_proxy_author_scheme(3SIP)
sip_get_replyto_display_name(3SIP)
sip_get_retry_after_cmts(3SIP)
sip_get_retry_after_time(3SIP)
sip_get_route_display_name(3SIP)
sip_get_via_sent_by_host(3SIP)
sip_get_via_sent_by_port(3SIP)
sip_get_via_sent_protocol_name(3SIP)
sip_get_via_sent_protocol_version(3SIP)
sip_get_via_sent_transport(3SIP)
sip_get_www_authen_param(3SIP)
sip_get_www_authen_scheme(3SIP)
- resolver routines
BIND 8.2.2 Interfaces
cc [ flag ... ] file ... -lresolv -lsocket -lnsl [ library ... ] #include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> #include <netdb.h> int res_ninit(res_state statp);
void res_ndestroy(res_state statp);
void fp_resstat(const res_state statp, FILE *fp);
const char *res_hostalias(const res_state statp, const char *name, char * name, char *buf, size_tbuflen);
int res_nquery(res_state statp, const char *dname, int class, int type, u_char *answer, int datalen, int anslen);
int res_nsearch(res_state statp, const char *dname, int class, int type, u_char *answer, int anslen);
int res_nquerydomain(res_state statp, const char *name, const char *domain, int class, int type, u_char *answer, int anslen);
int res_nmkquery(res_state statp, int op, const char *dname, int class, int type, u_char *answer, int datalen, int anslen);
int res_nsend(res_state statp, const u_char *msg, int msglen, u_char *answer, int anslen);
void res_nclose(res_state statp);
int res_snendsigned(res_state statp, const u_char *msg, int msglen, ns_tsig_key *key, u_char *answer, int anslen);
int dn_comp(const char *exp_dn, u_char *comp_dn, int length, u_char **dnptrs, **lastdnptr);
int dn_expand(const u_char *msg, *eomorig, *comp_dn, char *exp_dn, int length);
const char *hstrerror(int err);
void res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt);
int res_getservers(res_state statp, union res_sockaddr_union *set, int cnt);
Deprecated Interfaces
cc [ flag ... ] file ... -lresolv -lsocket -lnsl [ library ... ] #include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> #include <netdb.h> int res_init(void)
int res_query(const char *dname, int class, int type, u_char *answer, int anslen);
int res_search(const char *dname, int class, int type, u_char *answer, int anslen);
int res_mkquery(int op, const char *dname, int class, int type, const char *data,int datalen, struct rrec *newrr, u_char *buf, int buflen);
int res_send(const u_char *msg, int msglen, u_char *answer, int anslen);
void herror(const char *s);
These routines are used for making, sending, and interpreting query and reply messages with Internet domain name servers.
State information is kept in statp and is used to control the behavior of these functions. Set statp to all zeros prior to making the first call to any of these functions.
The res_ndestroy() function should be called to free memory allocated by res_ninit() after the last use of statp.
The functions res_init(), res_query(), res_search(), res_mkquery(), res_send(), and herror() are deprecated. They are supplied for backwards compatability. They use global configuration and state information that is kept in the structure _res rather than state information referenced through statp.
Most of the values in statp and _res are initialized to reasonable defaults on the first call to res_ninit() or res_init() and can be ignored. Options stored in statp->options or _res.options are defined in <resolv.h>. They are stored as a simple bit mask containing the bitwise OR of the options enabled.
True if the initial name server address and default domain name are initialized, that is, res_init() or res_ninit() has been called.
Print debugging messages.
Accept authoritative answers only. With this option, res_send() will continue until it finds an authoritative answer or finds an error. Currently this option is not implemented.
Use TCP connections for queries instead of UDP datagrams.
Use with RES_USEVC to keep the TCP connection open between queries. This is a useful option for programs that regularly do many queries. The normal mode used should be UDP.
Ignore truncation errors; that is, do not retry with TCP.
Set the recursion-desired bit in queries. This is the default. res_send() and res_nsend() do not do iterative queries and expect the name server to handle recursion.
If set, res_search() and res_nsearch() append the default domain name to single-component names, that is, names that do not contain a dot. This option is enabled by default.
If this option is set, res_search() and res_nsearch() search for host names in the current domain and in parent domains. See hostname(1). This option is used by the standard host lookup routine gethostbyname(3NSL). This option is enabled by default.
This option turns off the user level aliasing feature controlled by the HOSTALIASES environment variable. Network daemons should set this option.
If the RES_BLAST option is defined, resolver() queries will be sent to all servers. If the RES_BLAST option is not defined, but RES_ROTATE is , the list of nameservers are rotated according to a round-robin scheme. RES_BLAST overrides RES_ROTATE.
This option causes res_nsend() and res_send() to rotate the list of nameservers in statp->nsaddr_list or _res.nsaddr_list.
This option causes res_nsendsigned() to leave the message unchanged after TSIG verification. Otherwise the TSIG record would be removed and the header would be updated.
The res_ninit() and res_init() routines read the configuration file, if any is present, to get the default domain name, search list and the Internet address of the local name server(s). See resolv.conf(4). If no server is configured, res_init() or res_ninit() will try to obtain name resolution services from the host on which it is running. The current domain name is defined by domainname(1M), or by the hostname if it is not specified in the configuration file. Use the environment variable LOCALDOMAIN to override the domain name. This environment variable may contain several blank-separated tokens if you wish to override the search list on a per-process basis. This is similar to the search command in the configuration file. You can set the RES_OPTIONS environment variable to override certain internal resolver options. You can otherwise set them by changing fields in the statp /_res structure. Alternatively, they are inherited from the configuration file's options command. See resolv.conf(4) for information regarding the syntax of the RES_OPTIONS environment variable. Initialization normally occurs on the first call to one of the other resolver routines.
The res_nquery() and res_query() functions provide interfaces to the server query mechanism. They construct a query, send it to the local server, await a response, and make preliminary checks on the reply. The query requests information of the specified type and class for the specified fully-qualified domain name dname. The reply message is left in the answer buffer with length anslen supplied by the caller. res_nquery() and res_query() return the length of the answer, or -1 upon error.
The res_nquery() and res_query() routines return a length that may be bigger than anslen. In that case, retry the query with a larger buf. The answer to the second query may be larger still], so it is recommended that you supply a buf larger than the answer returned by the previous query. answer must be large enough to receive a maximum UDP response from the server or parts of the answer will be silently discarded. The default maximum UDP response size is 512 bytes.
The res_nsearch() and res_search() routines make a query and await a response, just like like res_nquery() and res_query(). In addition, they implement the default and search rules controlled by the RES_DEFNAMES and RES_DNSRCH options. They return the length of the first successful reply which is stored in answer. On error, they reurn –1.
The res_nsearch() and res_search() routines return a length that may be bigger than anslen. In that case, retry the query with a larger buf. The answer to the second query may be larger still], so it is recommended that you supply a buf larger than the answer returned by the previous query. answer must be large enough to receive a maximum UDP response from the server or parts of the answer will be silently discarded. The default maximum UDP response size is 512 bytes.
These routines are used by res_nquery() and res_query(). The res_nmkquery() and res_mkquery() functions construct a standard query message and place it in buf. The routine returns the size of the query, or -1 if the query is larger than buflen. The query type op is usually QUERY, but can be any of the query types defined in <arpa/nameser.h>. The domain name for the query is given by dname. newrr is currently unused but is intended for making update messages.
The res_nsend(), res_send(), and res_nsendsigned() routines send a pre-formatted query that returns an answer. The routine calls res_ninit() or res_init(). If RES_INIT is not set, the routine sends the query to the local name server and handles timeouts and retries. Additionally, the res_nsendsigned() uses TSIG signatures to add authentication to the query and verify the response. In this case, only one name server will be contacted. The routines return the length of the reply message, or -1 if there are errors.
The res_nsend() and res_send() routines return a length that may be bigger than anslen. In that case, retry the query with a larger buf. The answer to the second query may be larger still], so it is recommended that you supply a buf larger than the answer returned by the previous query. answer must be large enough to receive a maximum UDP response from the server or parts of the answer will be silently discarded. The default maximum UDP response size is 512 bytes.
The function fp_resstat() prints out the active flag bits in statp->options preceded by the text “;; res options:” on file.
The function res_hostalias() looks up name in the file referred to by the HOSTALIASES environment variable and returns the fully qualified host name. If name is not found or an error occurs, NULL is returned. res_hostalias() stores the result in buf.
The res_nclose() function closes any open files referenced through statp.
The res_ndestroy() function calls res_nclose(), then frees any memory allocated by res_ninit() referenced through statp.
The dn_comp() function compresses the domain name exp_dn and stores it in comp_dn. The dn_comp() function returns the size of the compressed name, or -1 if there were errors. length is the size of the array pointed to by comp_dn.
The dnptrs parameter is a pointer to the head of the list of pointers to previously compressed names in the current message. The first pointer must point to the beginning of the message. The list ends with NULL. The limit to the array is specified by lastdnptr.
A side effect of calling dn_comp() is to update the list of pointers for labels inserted into the message by dn_comp() as the name is compressed. If dnptrs is NULL, names are not compressed. If lastdnptr is NULL, dn_comp() does not update the list of labels.
The dn_expand() function expands the compressed domain name comp_dn to a full domain name. The compressed name is contained in a query or reply message. msg is a pointer to the beginning of that message. The uncompressed name is placed in the buffer indicated by exp_dn, which is of size length. The dn_expand() function returns the size of the compressed name, or -1 if there was an error.
The variables statp->res_h_errno and _res.res_h_errno and external variable h_errno are set whenever an error occurs during a resolver operation. The following definitions are given in <netdb.h>:
#define NETDB_INTERNAL -1 /* see errno */ #define NETDB_SUCCESS 0 /* no problem */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ #define TRY_AGAIN 2 /* Non-Authoritative not found, or SERVFAIL */ #define NO_RECOVERY 3 /* Non-Recoverable: FORMERR, REFUSED, NOTIMP*/ #define NO_DATA 4 /* Valid name, no data for requested type */
The herror() function writes a message to the diagnostic output consisting of the string parameters, the constant string “:”, and a message corresponding to the value of h_errno.
The hstrerror() function returns a string, which is the message text that corresponds to the value of the err parameter.
The functions res_getservers() and res_setservers() are used to get and set the list of servers to be queried.
resolver configuration file
See attributes(5) for descriptions of the following attributes:
|
domainname(1M), gethostbyname(3NSL), libresolv(3LIB), resolv.conf(4), attributes(5)
Lottor, M. RFC 1033, Domain Administrators Operations Guide. Network Working Group. November 1987.
Mockapetris, Paul. RFC 1034, Domain Names - Concepts and Facilities. Network Working Group. November 1987.
Mockapetris, Paul. RFC 1035, Domain Names - Implementation and Specification. Network Working Group. November 1987.
Partridge, Craig. RFC 974, Mail Routing and the Domain System. Network Working Group. January 1986.
Stahl, M. RFC 1032, Domain Administrators Guide. Network Working Group. November 1987.
Vixie, Paul, Dunlap, Kevin J., Karels, Michael J. Name Server Operations Guide for BIND. Internet Software Consortium, 1996.
When the caller supplies a work buffer, for example the answer buffer argument to res_nsend() or res_send(), the buffer should be aligned on an eight byte boundary. Otherwise, an error such as a SIGBUS may result.