[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

dn_expand Subroutine


Expands a compressed domain name.


Standard C Library (libc.a)


#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;


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 _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.


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.


                          Defines name server and domain name constants, structures, and values.

Related Information

The dn_comp subroutine, _getlong subroutine, getshort subroutine, putlong subroutine, putshort subroutine, res_init subroutine, res_mkquery subroutine, res_ninit Subroutine, res_query subroutine, res_search subroutine, res_send subroutine.

TCP/IP Name Resolution in AIX 5L Version 5.2 System Management Guide: Communications and Networks.

Sockets Overview, and Understanding Domain Name Resolution in AIX 5L Version 5.2 Communications Programming Concepts.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]