*
* @return pointer to the new packet
*/
-t_packet *dns_packet_new();
+t_packet *ldns_packet_new();
/**
* Converts the data on the uint8_t bytearray (in wire format) to a DNS packet
* @param packet pointer to the structure to hold the packet
* @return the number of bytes read from the wire
*/
-size_t dns_wire2packet(uint8_t *data, size_t len, t_packet *packet);
+size_t ldns_wire2packet(uint8_t *data, size_t len, t_packet *packet);
#endif /* !_LDNS_PACKET_H */
*/
t_packet *
-dns_packet_new()
+ldns_packet_new()
{
t_packet *packet;
MALLOC(packet, t_packet);
}
size_t
-dns_wire2packet_header(uint8_t *wire, size_t max, size_t *pos, t_packet *packet)
+ldns_wire2packet_header(uint8_t *wire, size_t max, size_t *pos, t_packet *packet)
{
if (*pos + HEADER_SIZE > *wire + max) {
// TODO: set t_status error
}
size_t
-dns_wire2packet(uint8_t *wire, size_t max, t_packet *packet)
+ldns_wire2packet(uint8_t *wire, size_t max, t_packet *packet)
{
size_t pos = 0;
- pos += dns_wire2packet_header(wire, max, &pos, packet);
+ pos += ldns_wire2packet_header(wire, max, &pos, packet);
/* TODO: rrs :) */
wire[18] = 0x61;
wire[19] = 0x6e;
- packet = dns_packet_new();
- (void) dns_wire2packet(wire, 20, packet);
+ packet = ldns_packet_new();
+ (void) ldns_wire2packet(wire, 20, packet);
printf("packet id: %d\n", (int) packet_id(packet));
printf("qr bit: %d\n", (int) packet_qr(packet));