#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int res_xlate(int input_ccsid,
char *input_packet,
int input_length,
int output_ccsid,
char *output_packet,
int output_length)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The res_xlate() function is used to translate a standard DNS packet
between ASCII and EBCDIC.
Parameters
input_ccsid
(Input) The CCSID value of the input packet to be translated.
input_packet
(Input) The pointer to where the standard DNS packet to be translated
resides.
input_length
(Input) The length of input_packet.
output_ccsid
(Input) The CCSID value for the output packet.
output_packet
(Output) The pointer to where the translated DNS packet will be stored.
output_length
(Input) The length of output_packet.
Authorities
No authorization is required.
Return Value
res_xlate() returns an integer. Possible values are:
1 (successful)
0 (unsuccessful - translation error)
-1 (unsuccessful - errors other than translation)
Error Conditions
When the res_xlate() function fails, it does not set specific
errno or h_errno values. An error occurs under the following
conditions:
NULL pointer(s) passed to the function.
Invalid pointer(s) passed to the function.
Invalid lengths passed to the function.
An invalid packet format encountered.
Usage Notes
res_xlate() parses through input_packet, determining
which fields need translation. The packet is copied into output_packet
as it is parsed, translating the fields as needed from input_ccsid to
output_ccsid. If a bad format is encountered or a user-supplied length
is too small, res_xlate() returns a -1.
If there is an error in the translation of
input_packet from
input_ccsid to
output_ccsid, res_xlate() returns a value of
0 to the caller.
res_xlate() expects a value of 819 (ASCII) for either the input or
output coded character set identifier (CCSID). If translation from an EBCDIC
CCSID is to occur, the output CCSID needs to be set to 819.
input_packet is then translated to ASCII, and the
result is placed in output_packet If translation to
an EBCDIC CCSID is to occur, the input CCSID needs to be set to 819.
input_packet is then translated from ASCII to the
EBCDIC CCSID specified in output_ccsid, and the
result is placed in output_packet.
res_xlate() returns unsuccessfully with a value of -1 if CCSID 819
is not used for either input_ccsid or
output_ccsid. Also, if both
input_ccsid and
output_ccsid values are 819, res_xlate()
returns a -1.
In a thread-enabled environment, the _res is shared among
all threads within a process.