[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 2

dn_comp Subroutine

Purpose

Compresses a 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_comp (ExpDomNam, CompDomNam, Length, DomNamPtr, LastDomNamPtr)
u_char *ExpDomNam, *CompDomNam;
int Length;
u_char **DomNamPtr, **LastDomNamPtr;

Description

The dn_comp subroutine compresses a domain name to conserve space. When compressing names, the client process must keep a record of suffixes that have appeared previously. The dn_comp subroutine compresses a full domain name by comparing suffixes to a list of previously used suffixes and removing the longest possible suffix.

The dn_comp subroutine compresses the domain name pointed to by the ExpDomNam parameter and stores it in the area pointed to by the CompDomNam parameter. The dn_comp subroutine inserts labels into the message as the name is compressed. The dn_comp subroutine also maintains a list of pointers to the message labels and updates the list of label pointers.

The dn_comp 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.

Parameters

ExpDomNam Specifies the address of an expanded domain name.
CompDomNam Points to an array containing the compressed domain name.
Length Specifies the size of the array pointed to by the CompDomNam parameter.
DomNamPtr Specifies a list of pointers to previously compressed names in the current message.
LastDomNamPtr Points to the end of the array specified to by the CompDomNam parameter.

Return Values

Upon successful completion, the dn_comp subroutine returns the size of the compressed domain name.

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

Implementation Specifics

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

All applications containing the dn_comp 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.

Files

/usr/include/resolv.h Contains global information used by the resolver subroutines.

Related Information

The named daemon.

The dn_expand 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


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]