dn_expand Subroutine

Purpose

Expands a compressed domain name.

Library

Standard C Library (libc.a)

Syntax

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>

int dn_expand (MessagePtr, EndofMesOrig, CompDomNam, ExpandDomNam, Length)
u_char * MessagePtr, * EndOfMesOrig;
u_char * CompDomNam, * ExpandDomNam;
int  Length;

Description

The dn_expand subroutine expands a compressed domain name to a full domain name, converting the expanded names to all uppercase letters. A client process compresses domain names to conserve space. Compression consists of removing the longest possible previously occurring suffixes. The dn_expand subroutine restores a domain name compressed by the dn_comp subroutine to its full size.

The dn_expand subroutine is one of a set of subroutines that form the resolver. The resolver is a set of functions that perform a translation between domain names and network addresses. Global information used by the resolver subroutines resides in the _res data structure. The /usr/include/resolv.h file contains the _res data structure definition.

All applications containing the dn_expand subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Parameters

Item Description
MessagePtr Specifies a pointer to the beginning of a message.
EndOfMesOrig Points to the end of the original message that contains the compressed domain name.
CompDomNam Specifies a pointer to a compressed domain name.
ExpandDomNam Specifies a pointer to a buffer that holds the resulting expanded domain name.
Length Specifies the size of the buffer pointed to by the ExpandDomNam parameter.

Return Values

Upon successful completion, the dn_expand subroutine returns the size of the expanded domain name.

If unsuccessful, the dn_expand subroutine returns a value of -1 to the calling program.

Files

Item Description
                       /etc/resolv.conf   Defines name server and domain name constants, structures, and values.