ares_expand_name.3 (1478B)
1 .\" 2 .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 .\" SPDX-License-Identifier: MIT 4 .\" 5 .TH ARES_EXPAND_NAME 3 "20 Nov 2009" 6 .SH NAME 7 ares_expand_name \- Expand a DNS-encoded domain name 8 .SH SYNOPSIS 9 .nf 10 #include <ares.h> 11 12 int ares_expand_name(const unsigned char *\fIencoded\fP, 13 const unsigned char *\fIabuf\fP, int \fIalen\fP, 14 char **\fIs\fP, long *\fIenclen\fP) 15 .fi 16 .SH DESCRIPTION 17 The 18 .B ares_expand_name 19 function converts a DNS-encoded domain name to a dot-separated C 20 string. The argument 21 .I encoded 22 gives the beginning of the encoded domain name, and the arguments 23 .I abuf 24 and 25 .I alen 26 give the containing message buffer (necessary for the processing of 27 indirection pointers within the encoded domain name). The result is 28 placed in a NUL-terminated allocated buffer, a pointer to which is 29 stored in the variable pointed to by 30 .IR s . 31 The length of the encoded name is stored in the variable pointed to by 32 .I enclen 33 so that the caller can advance past the encoded domain name to read 34 further data in the message. 35 36 Use \fIares_free_string(3)\fP to free the allocated hostname. 37 .SH RETURN VALUES 38 .B ares_expand_name 39 can return any of the following values: 40 .TP 15 41 .B ARES_SUCCESS 42 Expansion of the encoded name succeeded. 43 .TP 15 44 .B ARES_EBADNAME 45 The encoded domain name was malformed and could not be expanded. 46 .TP 15 47 .B ARES_ENOMEM 48 Memory was exhausted. 49 .SH SEE ALSO 50 .BR ares_mkquery (3), 51 .BR ares_free_string (3)