ldns  1.7.0
Macros | Functions
wire2host.c File Reference

Go to the source code of this file.

Macros

#define LDNS_STATUS_CHECK_RETURN(st)   {if (st != LDNS_STATUS_OK) { return st; }}
 
#define LDNS_STATUS_CHECK_GOTO(st, label)   {if (st != LDNS_STATUS_OK) { /*printf("STG %s:%d: status code %d\n", __FILE__, __LINE__, st);*/ goto label; }}
 

Functions

ldns_status ldns_wire2dname (ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos)
 converts the data on the uint8_t bytearray (in wire format) to a DNS dname rdata field. More...
 
ldns_status ldns_wire2rdf (ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos)
 converts the data on the uint8_t bytearray (in wire format) to DNS rdata fields, and adds them to the list of rdfs of the given rr. More...
 
ldns_status ldns_wire2rr (ldns_rr **rr_p, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section)
 converts the data on the uint8_t bytearray (in wire format) to a DNS resource record. More...
 
ldns_status ldns_buffer2pkt_wire (ldns_pkt **packet, const ldns_buffer *buffer)
 converts the data in the ldns_buffer (in wire format) to a DNS packet. More...
 
ldns_status ldns_wire2pkt (ldns_pkt **packet_p, const uint8_t *wire, size_t max)
 converts the data on the uint8_t bytearray (in wire format) to a DNS packet. More...
 

Macro Definition Documentation

§ LDNS_STATUS_CHECK_RETURN

#define LDNS_STATUS_CHECK_RETURN (   st)    {if (st != LDNS_STATUS_OK) { return st; }}

Definition at line 154 of file wire2host.c.

§ LDNS_STATUS_CHECK_GOTO

#define LDNS_STATUS_CHECK_GOTO (   st,
  label 
)    {if (st != LDNS_STATUS_OK) { /*printf("STG %s:%d: status code %d\n", __FILE__, __LINE__, st);*/ goto label; }}

Definition at line 155 of file wire2host.c.

Function Documentation

§ ldns_wire2dname()

ldns_status ldns_wire2dname ( ldns_rdf **  dname,
const uint8_t *  wire,
size_t  max,
size_t *  pos 
)

converts the data on the uint8_t bytearray (in wire format) to a DNS dname rdata field.

This function will initialize and allocate memory space for the dname structure. The length of the wiredata of this rdf is added to the *pos value.

Parameters
[in]dnamepointer to the structure to hold the rdata value
[in]wirepointer to the buffer with the data
[in]maxthe length of the data buffer (in bytes)
[in]posthe position of the rdf in the buffer (ie. the number of bytes from the start of the buffer)
Returns
LDNS_STATUS_OK if everything succeeds, error otherwise

Definition at line 56 of file wire2host.c.

References LDNS_MAX_DOMAINLEN, LDNS_STATUS_PACKET_OVERFLOW, and LDNS_STATUS_WIRE_RDATA_ERR.

§ ldns_wire2rdf()

ldns_status ldns_wire2rdf ( ldns_rr rr,
const uint8_t *  wire,
size_t  max,
size_t *  pos 
)

converts the data on the uint8_t bytearray (in wire format) to DNS rdata fields, and adds them to the list of rdfs of the given rr.

This function will initialize and allocate memory space for the dname structures. The length of the wiredata of these rdfs is added to the *pos value.

All rdfs belonging to the RR are read; the rr should have no rdfs yet. An error is returned if the format cannot be parsed.

Parameters
[in]rrpointer to the ldns_rr structure to hold the rdata value
[in]wirepointer to the buffer with the data
[in]maxthe length of the data buffer (in bytes)
[in]posthe position of the rdf in the buffer (ie. the number of bytes from the start of the buffer)
Returns
LDNS_STATUS_OK if everything succeeds, error otherwise

Definition at line 158 of file wire2host.c.

References ldns_rr_descript(), ldns_rr_get_type(), and LDNS_STATUS_PACKET_OVERFLOW.

§ ldns_wire2rr()

ldns_status ldns_wire2rr ( ldns_rr **  rr,
const uint8_t *  wire,
size_t  max,
size_t *  pos,
ldns_pkt_section  section 
)

converts the data on the uint8_t bytearray (in wire format) to a DNS resource record.

This function will initialize and allocate memory space for the rr structure. The length of the wiredata of this rr is added to the *pos value.

Parameters
[in]rrpointer to the structure to hold the rdata value
[in]wirepointer to the buffer with the data
[in]maxthe length of the data buffer (in bytes)
[in]posthe position of the rr in the buffer (ie. the number of bytes from the start of the buffer)
[in]sectionthe section in the packet the rr is meant for
Returns
LDNS_STATUS_OK if everything succeeds, error otherwise

Definition at line 319 of file wire2host.c.

References ldns_rr_new(), ldns_rr_set_owner(), ldns_rr_set_type(), LDNS_STATUS_CHECK_GOTO, LDNS_STATUS_PACKET_OVERFLOW, and ldns_wire2dname().

§ ldns_buffer2pkt_wire()

ldns_status ldns_buffer2pkt_wire ( ldns_pkt **  packet,
const ldns_buffer buffer 
)

converts the data in the ldns_buffer (in wire format) to a DNS packet.

This function will initialize and allocate memory space for the packet structure.

Parameters
[in]packetpointer to the structure to hold the packet
[in]bufferthe buffer with the data
Returns
LDNS_STATUS_OK if everything succeeds, error otherwise

Definition at line 395 of file wire2host.c.

References ldns_wire2pkt().

§ ldns_wire2pkt()

ldns_status ldns_wire2pkt ( ldns_pkt **  packet,
const uint8_t *  data,
size_t  len 
)

converts the data on the uint8_t bytearray (in wire format) to a DNS packet.

This function will initialize and allocate memory space for the packet structure.

Parameters
[in]packetpointer to the structure to hold the packet
[in]datapointer to the buffer with the data
[in]lenthe length of the data buffer (in bytes)
Returns
LDNS_STATUS_OK if everything succeeds, error otherwise

Definition at line 404 of file wire2host.c.

References ldns_pkt_new(), and LDNS_STATUS_OK.