Changeset View
Changeset View
Standalone View
Standalone View
contrib/ldns/ldns/wire2host.h
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | |||||
#define LDNS_ARCOUNT_OFF 10 | #define LDNS_ARCOUNT_OFF 10 | ||||
#define LDNS_ARCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF)) | #define LDNS_ARCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF)) | ||||
/** | /** | ||||
* converts the data on the uint8_t bytearray (in wire format) to a DNS packet. | * 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 | * This function will initialize and allocate memory space for the packet | ||||
* structure. | * structure. | ||||
* | * | ||||
* \param[in] packet pointer to the structure to hold the packet | * \param[out] packet pointer to the structure to hold the packet | ||||
* \param[in] data pointer to the buffer with the data | * \param[in] data pointer to the buffer with the data | ||||
* \param[in] len the length of the data buffer (in bytes) | * \param[in] len the length of the data buffer (in bytes) | ||||
* \return LDNS_STATUS_OK if everything succeeds, error otherwise | * \return LDNS_STATUS_OK if everything succeeds, error otherwise | ||||
*/ | */ | ||||
ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len); | ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len); | ||||
/** | /** | ||||
* converts the data in the ldns_buffer (in wire format) to a DNS packet. | * 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 | * This function will initialize and allocate memory space for the packet | ||||
* structure. | * structure. | ||||
* | * | ||||
* \param[in] packet pointer to the structure to hold the packet | * \param[out] packet pointer to the structure to hold the packet | ||||
* \param[in] buffer the buffer with the data | * \param[in] buffer the buffer with the data | ||||
* \return LDNS_STATUS_OK if everything succeeds, error otherwise | * \return LDNS_STATUS_OK if everything succeeds, error otherwise | ||||
*/ | */ | ||||
ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, const ldns_buffer *buffer); | ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, const ldns_buffer *buffer); | ||||
/** | /** | ||||
* converts the data on the uint8_t bytearray (in wire format) to a DNS | * converts the data on the uint8_t bytearray (in wire format) to a DNS | ||||
* dname rdata field. This function will initialize and allocate memory | * dname rdata field. This function will initialize and allocate memory | ||||
* space for the dname structure. The length of the wiredata of this rdf | * space for the dname structure. The length of the wiredata of this rdf | ||||
* is added to the *pos value. | * is added to the *pos value. | ||||
* | * | ||||
* \param[in] dname pointer to the structure to hold the rdata value | * \param[out] dname pointer to the structure to hold the rdata value | ||||
* \param[in] wire pointer to the buffer with the data | * \param[in] wire pointer to the buffer with the data | ||||
* \param[in] max the length of the data buffer (in bytes) | * \param[in] max the length of the data buffer (in bytes) | ||||
* \param[in] pos the position of the rdf in the buffer (ie. the number of bytes | * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes | ||||
* from the start of the buffer) | * from the start of the buffer) | ||||
* \return LDNS_STATUS_OK if everything succeeds, error otherwise | * \return LDNS_STATUS_OK if everything succeeds, error otherwise | ||||
*/ | */ | ||||
ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos); | ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos); | ||||
Show All 18 Lines | |||||
/** | /** | ||||
* converts the data on the uint8_t bytearray (in wire format) to a DNS | * converts the data on the uint8_t bytearray (in wire format) to a DNS | ||||
* resource record. | * resource record. | ||||
* This function will initialize and allocate memory space for the rr | * This function will initialize and allocate memory space for the rr | ||||
* structure. | * structure. | ||||
* The length of the wiredata of this rr is added to the *pos value. | * The length of the wiredata of this rr is added to the *pos value. | ||||
* | * | ||||
* \param[in] rr pointer to the structure to hold the rdata value | * \param[out] rr pointer to the structure to hold the rdata value | ||||
* \param[in] wire pointer to the buffer with the data | * \param[in] wire pointer to the buffer with the data | ||||
* \param[in] max the length of the data buffer (in bytes) | * \param[in] max the length of the data buffer (in bytes) | ||||
* \param[in] pos the position of the rr in the buffer (ie. the number of bytes | * \param[in] pos the position of the rr in the buffer (ie. the number of bytes | ||||
* from the start of the buffer) | * from the start of the buffer) | ||||
* \param[in] section the section in the packet the rr is meant for | * \param[in] section the section in the packet the rr is meant for | ||||
* \return LDNS_STATUS_OK if everything succeeds, error otherwise | * \return LDNS_STATUS_OK if everything succeeds, error otherwise | ||||
*/ | */ | ||||
ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section); | ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } | ||||
#endif | #endif | ||||
#endif /* LDNS_WIRE2HOST_H */ | #endif /* LDNS_WIRE2HOST_H */ |