dn_expand()--Expand Domain Name
Syntax
#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int dn_expand(unsigned char *message_pointer, unsigned char *end_of_message, unsigned char *compressed_domain_name, unsigned char *expanded_domain_name, int answer_buffer_length)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The dn_expand() function is used to expand a compressed domain name.
Authorities and Locks
None.
Parameters
- message_pointer
- (Input) The pointer to the beginning of a DNS packet.
- end_of_message
- (Input) The pointer to the end of the DNS packet.
- compressed_domain_name
- (Input) The pointer to the compressed domain name within the DNS
packet.
- expanded_domain_name
- (Output) The pointer to the expanded domain name.
- answer_buffer_length
- (Input) The size of the expanded_domain_name buffer.
Return Value
dn_expand() returns an integer. Possible values are:
- -1 (unsuccessful)
- n (successful), where n is the size of the compressed domain name.
The dn_expand() routine expands the domain name pointed to by compressed_domain_name. The result is placed in expanded_domain_name.
Error Conditions
When the dn_expand() 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.
- expanded_domain_name too small for the expanded domain name.
- end_of_message reached before the domain name could be expanded.
Usage Notes
- The compressed domain name size is returned rather than the expanded domain
name size because it is used to parse through the DNS packet.
- dn_expand() uses end_of_message to insure that it doesn't
run past the end of the DNS packet.
- dn_expand() expects EBCDIC data as input. The output from dn_expand() is also EBCDIC.
Related Information
- dn_comp()--Compress Domain Name
- dn_find()--Search for Compressed Domain Name
- dn_skipname()--Skip over Compressed Domain Name
API introduced: V3R1