![Texas TMS320C6000 Programmer'S Reference Manual Download Page 110](http://html.mh-extra.com/html/texas/tms320c6000/tms320c6000_programmers-reference-manual_1093844110.webp)
DNS Support Calls
5-8
The structure differs slightly from the conventional definition. It is defined as
follows:
//
// Host Entry Structure
//
struct _hostent {
char *h_name; // Official name of host
int h_addrtype; // Address Type (AF_INET)
int h_length; // Address Length (4)
int h_addrcnt; // Number of IP addresses found
IPN h_addr[4]; // List of up to 4 IP addrs (network format)
};
typedef struct _hostent HOSTENT;
5.2.3.2
Function Return Codes
DNS functions that return an error code use the following definitions. Those
that are obtained directly from a DNS response packet are so noted:
NOERROR
0
(DNS Reply Code) no error
FORMERR
1
(DNS Reply Code) format error
SERVFAIL
2
(DNS Reply Code) server failure
NXDOMAIN
3
(DNS Reply Code) non existent domain
NOTIMP
4
(DNS Reply Code) not implemented
REFUSED
5
(DNS Reply Code) query refused
OVERFLOW
16
Scrap Buffer Overflow
MEMERROR
17
Memory Allocation Error (used for packets and
temp storage)
SOCKETERROR
18
Socket Error (call fdError() for socket error num-
ber)
NODNSREPLY
19
No DNS server response
5.2.4
DNS Support API Functions
Return the Hostname of the Current Host
DNSGetHostname
Syntax
int DNSGetHostname( char *pNameBuf, int size );
Parameter(s)
pNameBuf
Pointer to a buffer to accept the hostname
size
Size of the supplied buffer in bytes
Return Value
Error code as defined above
Description
This function is quite similar to BSD’s gethostname(). It requests the hostname
of the system’s public IP address (as obtained from NtGetPublicHost()). The
hostname is copied into the buffer pointed to by ‘pNameBuf’ with a max size
of ‘size’. The name is NULL terminated when space allows.