From: Jelte Jansen Date: Wed, 15 Dec 2004 12:47:26 +0000 (+0000) Subject: t_rr -> ldns_rr_type X-Git-Tag: release-0.50~677 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e72c1d9c0fc8a5121940fdb2891f59f301b8e8f;p=thirdparty%2Fldns.git t_rr -> ldns_rr_type --- diff --git a/ldns/rr.h b/ldns/rr.h index cb1ba125..a118065d 100644 --- a/ldns/rr.h +++ b/ldns/rr.h @@ -144,7 +144,7 @@ struct type_struct_rr /** \brief The list of rdata's */ t_rdata_field **_rdata_fields; }; -typedef struct type_struct_rr t_rr; +typedef struct type_struct_rr ldns_rr_type; /** * \brief Resource Record Set @@ -154,7 +154,7 @@ typedef struct type_struct_rr t_rr; */ struct type_struct_rrset { - t_rr *rrs; + ldns_rr_type *rrs; }; typedef struct type_struct_rrset t_rrset; @@ -178,15 +178,15 @@ typedef struct ldns_struct_rr_descriptor_type ldns_rr_descriptor_type; /* prototypes */ -t_rr * ldns_rr_new(void); -void ldns_rr_set_owner(t_rr *, uint8_t *); -void ldns_rr_set_ttl(t_rr *, uint16_t); -void ldns_rr_set_rd_count(t_rr *, uint16_t); -void ldns_rr_set_class(t_rr *, t_class); -bool ldns_rr_push_rd_field(t_rr *, t_rdata_field *); -uint8_t *ldns_rr_owner(t_rr *); -uint8_t ldns_rr_ttl(t_rr *); -uint16_t ldns_rr_rd_count(t_rr *); +ldns_rr_type * ldns_rr_new(void); +void ldns_rr_set_owner(ldns_rr_type *, uint8_t *); +void ldns_rr_set_ttl(ldns_rr_type *, uint16_t); +void ldns_rr_set_rd_count(ldns_rr_type *, uint16_t); +void ldns_rr_set_class(ldns_rr_type *, t_class); +bool ldns_rr_push_rd_field(ldns_rr_type *, t_rdata_field *); +uint8_t *ldns_rr_owner(ldns_rr_type *); +uint8_t ldns_rr_ttl(ldns_rr_type *); +uint16_t ldns_rr_rd_count(ldns_rr_type *); const ldns_rr_descriptor_type *ldns_rr_descriptor(uint16_t type); size_t ldns_rr_descriptor_minimum(ldns_rr_descriptor_type *descriptor); diff --git a/packet.c b/packet.c index 9318d646..46ee2ba7 100644 --- a/packet.c +++ b/packet.c @@ -379,7 +379,6 @@ ldns_wire2packet_header(ldns_packet_type *packet, packet_set_arcount(packet, ARCOUNT(wire)); *pos += QHEADERSZ; - /* TODO t_status succ. */ return 0; } @@ -389,10 +388,13 @@ size_t ldns_wire2packet(ldns_packet_type *packet, const uint8_t *wire, size_t max) { size_t pos = 0; - + uint16_t i; + pos += ldns_wire2packet_header(packet, wire, max, &pos); /* TODO: rrs :) */ + for (i = 0; i < packet_ancount(packet); i++) { + } return pos; } diff --git a/rr.c b/rr.c index 8ae72623..1a395e6e 100644 --- a/rr.c +++ b/rr.c @@ -1,7 +1,7 @@ /* * rr.c * - * access function for t_rr + * access function for ldns_rr_type * * a Net::DNS like library for C * @@ -21,11 +21,11 @@ /** * create a new rr structure. */ -t_rr * +ldns_rr_type * ldns_rr_new(void) { - t_rr *rr; - rr = MALLOC(t_rr); + ldns_rr_type *rr; + rr = MALLOC(ldns_rr_type); if (!rr) { return NULL; } @@ -39,7 +39,7 @@ ldns_rr_new(void) * set the owner in the rr structure */ void -ldns_rr_set_owner(t_rr *rr, uint8_t *owner) +ldns_rr_set_owner(ldns_rr_type *rr, uint8_t *owner) { rr->_owner = owner; } @@ -48,7 +48,7 @@ ldns_rr_set_owner(t_rr *rr, uint8_t *owner) * set the owner in the rr structure */ void -ldns_rr_set_ttl(t_rr *rr, uint16_t ttl) +ldns_rr_set_ttl(ldns_rr_type *rr, uint16_t ttl) { rr->_ttl = ttl; } @@ -57,7 +57,7 @@ ldns_rr_set_ttl(t_rr *rr, uint16_t ttl) * set the rd_count in the rr */ void -ldns_rr_set_rd_count(t_rr *rr, uint16_t count) +ldns_rr_set_rd_count(ldns_rr_type *rr, uint16_t count) { rr->_rd_count = count; } @@ -66,7 +66,7 @@ ldns_rr_set_rd_count(t_rr *rr, uint16_t count) * set the class in the rr */ void -ldns_rr_set_class(t_rr *rr, t_class klass) +ldns_rr_set_class(ldns_rr_type *rr, t_class klass) { rr->_klass = klass; } @@ -76,7 +76,7 @@ ldns_rr_set_class(t_rr *rr, t_class klass) * placed in the next available spot */ bool -ldns_rr_push_rd_field(t_rr *rr, t_rdata_field *f) +ldns_rr_push_rd_field(ldns_rr_type *rr, t_rdata_field *f) { uint16_t rd_count; t_rdata_field **rdata_fields; @@ -102,7 +102,7 @@ ldns_rr_push_rd_field(t_rr *rr, t_rdata_field *f) * return the owner name of an rr structure */ uint8_t * -ldns_rr_owner(t_rr *rr) +ldns_rr_owner(ldns_rr_type *rr) { return rr->_owner; } @@ -111,7 +111,7 @@ ldns_rr_owner(t_rr *rr) * return the owner name of an rr structure */ uint8_t -ldns_rr_ttl(t_rr *rr) +ldns_rr_ttl(ldns_rr_type *rr) { return rr->_ttl; } @@ -120,7 +120,7 @@ ldns_rr_ttl(t_rr *rr) * return the rd_count of an rr structure */ uint16_t -ldns_rr_rd_count(t_rr *rr) +ldns_rr_rd_count(ldns_rr_type *rr) { return rr->_rd_count; } @@ -342,7 +342,8 @@ ldns_rr_descriptor_maximum(ldns_rr_descriptor_type *descriptor) } ldns_rdata_field_type -ldns_rr_descriptor_field_type(ldns_rr_descriptor_type *descriptor, size_t index) +ldns_rr_descriptor_field_type(ldns_rr_descriptor_type *descriptor, + size_t index) { assert(descriptor); assert(index < descriptor->_maximum @@ -353,3 +354,4 @@ ldns_rr_descriptor_field_type(ldns_rr_descriptor_type *descriptor, size_t index) return descriptor->_variable; } } + diff --git a/run-test0.c b/run-test0.c index c3decc23..a78ab4ef 100644 --- a/run-test0.c +++ b/run-test0.c @@ -12,14 +12,16 @@ static const uint8_t wire[] = { 0xc2, 0xb4, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x03, 0x77, 0x77, 0x77, - 0x0b, 0x6b, 0x61, 0x6e + 0x0b, 0x6b, 0x61, 0x6e, 0x61, 0x72, 0x69, 0x65, + 0x70, 0x69, 0x65, 0x74, 0x03, 0x63, 0x6f, 0x6d, + 0x00, 0x00, 0x01, 0x00, 0x01 }; int main(void) { t_rdata_field *rd_f; - t_rr *rr; + ldns_rr_type *rr; ldns_packet_type *packet; rr = ldns_rr_new(); diff --git a/util.c b/util.c index 70a28c80..68eada51 100644 --- a/util.c +++ b/util.c @@ -26,7 +26,7 @@ xprintf_rd_field(t_rdata_field *rd) } void -xprintf_rr(t_rr *rr) +xprintf_rr(ldns_rr_type *rr) { /* assume printable string */ uint16_t count, i; diff --git a/util.h b/util.h index 68daccc1..759496f6 100644 --- a/util.h +++ b/util.h @@ -34,6 +34,6 @@ /* prototypes */ void xprintf_rd_field(t_rdata_field *); -void xprintf_rr(t_rr *); +void xprintf_rr(ldns_rr_type *); #endif /* !_UTIL_H */