dn_comp()--Compress Domain Name
Syntax
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int dn_comp(unsigned char *expanded_domain_name,
unsigned char *compressed_domain_name,
int answer_buffer_length,
unsigned char **domain_name_pointers,
unsigned char **last_domain_name)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The dn_comp() function is used to compress an expanded domain name.
Authorities and Locks
None.
Parameters
- expanded_domain_name
- (Input) The pointer to the expanded domain name.
- compressed_domain_name
- (Output) The pointer to where the compressed domain name will be
stored.
- answer_buffer_length
- (Input) The size of the compressed_domain_name buffer.
- domain_name_pointers
- (Input) The pointer to an array of pointers to previously compressed domain
names in the current message.
- last_domain_name
- (Input) The pointer to the end of the array specified by domain_name_pointers.
Return Value
dn_comp() returns an integer. Possible values are:
- -1 (unsuccessful)
- n (successful), where n is the size of the compressed domain name.
dn_comp() compresses the domain name pointed to by expanded_domain_name. The result is placed in compressed_domain_name.
Error Conditions
When the dn_comp() 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.
- Compressed_domain_name too small for the compressed domain name.
Usage Notes
- domain_name_pointers[0] points to the beginning of the DNS packet.
The list of pointers ends with a NULL pointer. After
domain_name_pointers[0] is initialized to the beginning of the packet
and domain_name_pointers[1] is initialized to NULL, dn_comp()
updates the list each time it is called.
- dn_comp() calls dn_find() to attempt to locate the
different parts of the domain name being compressed.
- dn_comp() expects EBCDIC data as input. The output from dn_comp() is also EBCDIC.
Related Information
- dn_expand()--Expand Domain Name
- dn_find()--Search for Compressed Domain Name
- dn_skipname()--Skip over Compressed Domain Name
API introduced: V3R1