ARES\_PARSE\_NS\_REPLY(3) Library Functions Manual ARES\_PARSE\_NS\_REPLY(3)

# [NAME](#NAME)

ares\_parse\_ns\_reply - Parse a reply to a DNS query of type NS into a hostent

# [SYNOPSIS](#SYNOPSIS)

```
#include <ares.h>
int ares_parse_ns_reply(const unsigned char *abuf, int alen,


                        struct hostent **host);
```

# [DESCRIPTION](#DESCRIPTION)

The **ares\_parse\_ns\_reply** function parses the response to a query of type NS into a **struct hostent**. The parameters *abuf* and *alen* give the contents of the response. The result is stored in allocated memory and a pointer to it stored into the variable pointed to by *host*. The nameservers are stored into the **aliases** field of the *host* structure. It is the caller's responsibility to free the resulting host structure using [**ares\_free\_hostent**(3)](/man/os/c-ares/ares_free_hostent.3) when it is no longer needed.

# [RETURN VALUES](#RETURN_VALUES)

**ares\_parse\_ns\_reply** can return any of the following values:

[**ARES\_SUCCESS**](#ARES_SUCCESS)

The response was successfully parsed.

[**ARES\_EBADRESP**](#ARES_EBADRESP)

The response was malformatted.

[**ARES\_ENODATA**](#ARES_ENODATA)

The response did not contain an answer to the query.

[**ARES\_ENOMEM**](#ARES_ENOMEM)

Memory was exhausted.

# [SEE ALSO](#SEE_ALSO)

[**ares\_query**(3)](/man/os/c-ares/ares_query.3), [**ares\_free\_hostent**(3)](/man/os/c-ares/ares_free_hostent.3)

10 February 2007

---

Document: ares_parse_ns_reply(3) from c-ares 1.34.9-r0 (Chainguard OS)
Source: https://github.com/c-ares/c-ares
