1ARES_EXPAND_NAME(3) Library Functions Manual ARES_EXPAND_NAME(3)
2
3
4
6 ares_expand_name - Expand a DNS-encoded domain name
7
9 #include <ares.h>
10
11 int ares_expand_name(const unsigned char *encoded,
12 const unsigned char *abuf, int alen, char **s,
13 long *enclen)
14
16 The ares_expand_name function converts a DNS-encoded domain name to a
17 dot-separated C string. The argument encoded gives the beginning of
18 the encoded domain name, and the arguments abuf and alen give the con‐
19 taining message buffer (necessary for the processing of indirection
20 pointers within the encoded domain name). The result is placed in a
21 NUL-terminated allocated buffer, a pointer to which is stored in the
22 variable pointed to by s. The length of the encoded name is stored in
23 the variable pointed to by enclen so that the caller can advance past
24 the encoded domain name to read further data in the message.
25
26 Use ares_free_string(3) to free the allocated hostname.
27
29 ares_expand_name can return any of the following values:
30
31 ARES_SUCCESS Expansion of the encoded name succeeded.
32
33 ARES_EBADNAME The encoded domain name was malformed and could not be
34 expanded.
35
36 ARES_ENOMEM Memory was exhausted.
37
39 ares_mkquery(3),ares_free_string(3)
40
42 Greg Hudson, MIT Information Systems
43 Copyright 1998 by the Massachusetts Institute of Technology.
44
45
46
47 20 Nov 2009 ARES_EXPAND_NAME(3)