[Previous] [Contents] [Index] [Next]

dn_comp()

Compress an Internet domain name

Synopsis:

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

int dn_comp( const char * exp_dn,
             u_char * comp_dn,
             int length, 
             u_char ** dnptrs,
             u_char ** lastdnptr );

Library:

socket3r.lib, socket3s.lib

Description:

The dn_comp() routine is a low-level routine used by res_query() to compress an Internet domain name. This routine compresses the domain name exp_dn and stores it in comp_dn.

The size of the array pointed to by comp_dn is given by length. The compression uses an array of pointers, dnptrs, to previously compressed names in the current message. The first pointer points to the beginning of the message and the list ends with NULL. The limit to the array is specified by lastdnptr. As a side effect, dn_comp() updates the list of pointers for labels inserted into the message as the name is compressed. If dnptrs is NULL, names aren't compressed. If lastdnptr is NULL, the list of labels isn't updated.

Returns:

The size of the compressed domain name, in bytes; or -1 if an error occurs.

Classification:

Unix

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

dn_expand(), gethostbyname(), res_init(), res_mkquery(), res_query(), res_search(), res_send()

/etc/resolv.conf, hostname, named in the TCP/IP User's Guide

RFC 974, RFC 1032, RFC 1033, RFC 1034, RFC 1035


[Previous] [Contents] [Index] [Next]