Chapter Contents |
Previous |
Next |
dn_comp |
Portability: | UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
PORTABILITY | |
IMPLEMENTATION | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int dn_comp(char *exp_dn, char *comp_dn, int length, char **dnptrs, char **lastdnptr);
DESCRIPTION |
dn_comp
is part of the resolver, which is a set of routines that provides
a programming interface for communicating with Internet name servers.
dn_comp
translates domain names
in conventional character string format to the compressed format used by name
servers. The compression process merges common suffixes among the names included
in a name server query.
exp_dn
is an EBCDIC string that contains a DNS name, such as a host name.
dn_comp
stores the equivalent compressed string
in the buffer pointed to by
comp_dn
.
length
is the
size of this buffer in bytes.
dn_comp
also maintains a list of compressed name elements. This list
is used as a reference to eliminate common suffixes during a series of calls
to
dn_comp
when multiple
names are stored in the same buffer.
dnptrs
points to the beginning of an array of pointers that points to the list of
compressed name elements. The calling program allocates this array by using
a convenient size, such as 10 elements.
lastdnptr
points to the last element of the array.
dnptrs[0]
should point to the beginning of the message. Initially,
dnptrs[1]
should be
NULL
.
In the interests of greater portability, the SAS/C version
of
dn_comp
performs EBCDIC-to-ASCII
translation of
exp_dn
before
beginning its compression process. If
dnptr
is
NULL
, the
domain name is not compressed. Alternatively, if
lastdnptr
is
NULL
,
the list of labels is not updated.
RETURN VALUE |
If
dn_comp
is successful, it returns the size of the compressed domain
name. Otherwise, it returns a
-1
and sets
errno
to indicate the type of error.
PORTABILITY |
dn_comp
is available on most versions of the UNIX operating system.
IMPLEMENTATION |
The SAS/C version of
dn_comp
is a direct port from the BSD UNIX socket
library. The EBCDIC-to-ASCII translation feature is the only change.
RELATED FUNCTIONS |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.