[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, 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.


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.

Implementation Specifics

The dn_expand subroutine is part of Base Operating System (BOS) Runtime.

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.


                          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_query subroutine, res_search subroutine, res_send subroutine.

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

Sockets Overview, and Understanding Domain Name Resolution in AIX Version 4.3 Communications Programming Concepts.

[ Previous | Next | Contents | Glossary | Home | Search ]