---
name: "dns_mx_packet"
section: "3diet"
platform: "linux"
package: "libowfat-dev"
version: "0.28-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/dns_mx_packet/3diet"
---

# dns\_mx\_packet(3diet)

extract MX records from DNS answer packet

## NAME

dns\_mx\_packet - extract MX records from DNS answer packet

## SYNTAX

**#include \<dns.h\>**

int **dns\_mx\_packet**(stralloc\* *out*,const char\* *buf*,\
                   unsigned int *len*);

## DESCRIPTION

dns\_mx\_packet is a low-level component of dns\_mx, designed to support asynchronous DNS lookups. It reads a DNS packet of length *len* from *buf*, extracts the MX records from the answer section of the packet, puts the result into *out*, and returns 0 or -1 the same way as dns\_mx.

## SEE ALSO

[dns\_mx(3)](/dns_mx/3.md), [dns\_ip4(3)](/dns_ip4/3.md), [dns\_ip6(3)](/dns_ip6/3.md)
