#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int res_nsendsigned(state* res, const unsigned char *query_buffer, int query_buffer_length, ns_tsig_key * key, unsigned char *answer_buffer, int answer_buffer_length)
The res_nsendsigned() function is similar to res_nsend() but it uses the specified key to create a transaction signature (TSIG) to sign the query or update packet and to authenticate the response.
No authorization is required.
res_nsendsigned() returns an integer. Possible values are:
When the res_nsendsigned() function fails, res_nsendsigned() can set errno to one of the following:
Not able to connect to a server.
Either the input packet could not be translated to ASCII or the answer received could not be translated to the coded character set identifier (CCSID) currently in effect for the job.
The system detected a pointer that was invalid while attempting to access an input pointer.
One of the following reasons:
An invalid length or NULL pointer was passed to res_nsendsigned()
The res appears to be initialized but the reserved field is not set to zeros.
Note: No attempt is made to initialize the res structure if it was initialized previous to the res_nsendsigned() being issued.
The message buffer was too small to add the TSIG. The return value was NS_TSIG_ERROR_NO_SPACE.
The message or reply couldn't be verified. See extended_error in the res structure:
The message is malformed.
The message does not contain a TSIG record.
The TSIG original ID field does not match the message ID.
Verification failed due to an invalid key.
Verification failed due to an invalid signature.
Verification failed due to an invalid timestamp.
Verification succeeded but the message had an error (rcode) of ns_r_badkey.
Verification succeeded but the message had an error (rcode) of ns_r_badsig.
Verification succeeded but the message had an error (rcode) of ns_r_badtime.
A timeout received from a connected server.
Either the input packet could not be translated to ASCII or the answer received could not be translated to the coded character set identifier (CCSID) currently in effect for the job.
An invalid length or NULL pointer was passed to res_nsendsigned() or the res could not be initialized properly.
Notes:
After receiving an error reply packet, res_nsendsigned() will set the extended_error field in the state structure to the last reply return code from the DNS server. See <arpa/nameser.h> for all possible values of ns_rcode.
Top | UNIX-Type APIs | APIs by category |