res_xlate()--Translate DNS Packets


  Syntax
 #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:


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:


Usage Notes

  1. 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.

  2. 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.

  3. 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.

  4. In a thread-enabled environment, the _res is shared among all threads within a process.

Related Information


API introduced: V3R1
Top | UNIX-Type APIs | APIs by category