/** \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
*/
struct type_struct_rrset
{
- t_rr *rrs;
+ ldns_rr_type *rrs;
};
typedef struct type_struct_rrset t_rrset;
/* 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);
packet_set_arcount(packet, ARCOUNT(wire));
*pos += QHEADERSZ;
-
/* TODO t_status succ. */
return 0;
}
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;
}
/*
* rr.c
*
- * access function for t_rr
+ * access function for ldns_rr_type
*
* a Net::DNS like library for C
*
/**
* 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;
}
* 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;
}
* 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;
}
* 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;
}
* 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;
}
* 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;
* 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;
}
* 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;
}
* 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;
}
}
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
return descriptor->_variable;
}
}
+
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();
}
void
-xprintf_rr(t_rr *rr)
+xprintf_rr(ldns_rr_type *rr)
{
/* assume printable string */
uint16_t count, i;
/* prototypes */
void xprintf_rd_field(t_rdata_field *);
-void xprintf_rr(t_rr *);
+void xprintf_rr(ldns_rr_type *);
#endif /* !_UTIL_H */