From: Miek Gieben Date: Thu, 9 Dec 2004 11:28:14 +0000 (+0000) Subject: renamed all types to t_ X-Git-Tag: release-0.50~742 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8f67ded19dd38bf81a66e3121bbe3ffeea413b70;p=thirdparty%2Fldns.git renamed all types to t_ sane name of structs sane name of rdata field, namely t_rdata_field and much, much more --- diff --git a/main.c b/main.c index 7bc8ae08..755e2772 100644 --- a/main.c +++ b/main.c @@ -13,10 +13,9 @@ int main(void) { - rdata_t *new; - printf("size %u\n", (unsigned int)sizeof(struct struct_rdata_t)); + t_rdata_field *new; new = rd_new(20, RD_DNAME_T, (uint8_t*)"hallo.nl"); - xprintf_rd(new); + xprintf_rd_field(new); return 0; } diff --git a/packet.h b/packet.h index a954f0cb..bb352ad2 100644 --- a/packet.h +++ b/packet.h @@ -22,7 +22,7 @@ * * Contains the information about the packet itself */ -struct struct_header_type +struct type_struct_header { /** \brief Id of a packet */ uint16_t id; @@ -41,19 +41,19 @@ struct struct_header_type /** \brief Authentic data */ uint8_t ad:1; /** \brief Query type */ - uint8_t opcode; + uint8_t opcode; /* XXX 8 bits? */ /** \brief Response code */ uint8_t rcode; /** \brief question sec */ - uint8_t qdcount; + uint16_t qdcount; /** \brief answer sec */ - uint8_t ancount; + uint16_t ancount; /** \brief auth sec */ - uint8_t nscount; + uint16_t nscount; /** \brief add sec */ - uint8_t acount; + uint16_t acount; }; -typedef struct struct_header_type header_t; +typedef struct type_struct_header t_header; /** * \brief DNS packet @@ -63,16 +63,16 @@ typedef struct struct_header_type header_t; struct struct_packet_type { /** \brief header section */ - header_t *header; + t_header *header; /** \brief question section */ - rrset_t *question; + t_rrset *question; /** \brief answer section */ - rrset_t *answer; + t_rrset *answer; /** \brief auth section */ - rrset_t *authority; + t_rrset *authority; /** \brief add section */ - rrset_t *additional; + t_rrset *additional; }; -typedef struct struct_packet_type packet_t; +typedef struct type_struct_packet t_packet; #endif /* _PACKET_H */ diff --git a/prototype.h b/prototype.h index 9243b472..8d573b01 100644 --- a/prototype.h +++ b/prototype.h @@ -18,6 +18,6 @@ /* util.c */ void *xmalloc(size_t); -void xprintf_rd(rdata_t *); +void xprintf_rd_field(t_rdata_field *); #endif /* _PROTOTYPE_H */ diff --git a/rdata.c b/rdata.c index db3e58e4..55014434 100644 --- a/rdata.c +++ b/rdata.c @@ -22,51 +22,51 @@ /* read */ uint16_t -rd_size(rdata_t *rd) +rd_size(t_rdata_field *rd) { return rd->_size; } -rd_type_t -rd_type(rdata_t *rd) +t_rd_type +rd_type(t_rdata_field *rd) { return rd->_type; } uint8_t * -rd_data(rdata_t *rd) +rd_data(t_rdata_field *rd) { return rd->_data; } /* write */ void -rd_set_size(rdata_t *rd, uint16_t s) +rd_set_size(t_rdata_field *rd, uint16_t s) { rd->_size = s; } void -rd_set_type(rdata_t *rd, rd_type_t t) +rd_set_type(t_rdata_field *rd, t_rd_type t) { rd->_type = t; } void -rd_set_data(rdata_t *rd, uint8_t *d, uint16_t s) +rd_set_data(t_rdata_field *rd, uint8_t *d, uint16_t s) { rd->_data = xmalloc(s); memcpy(rd->_data, d, s); } -/* allocate a new rdata_t structure +/* allocate a new t_rdata_field structure * and return it */ -rdata_t * -rd_new(uint16_t s, rd_type_t t, uint8_t *d) +t_rdata_field * +rd_new(uint16_t s, t_rd_type t, uint8_t *d) { - rdata_t *new; - new = xmalloc(sizeof(rdata_t)); + t_rdata_field *new; + new = xmalloc(sizeof(t_rdata_field)); if (NULL == new) return NULL; @@ -78,17 +78,17 @@ rd_new(uint16_t s, rd_type_t t, uint8_t *d) return(new); } -/* allocate a new rdata_t from +/* allocate a new t_rdata_field from * a NULL terminated string * and return it * * uint8_t == char !!!! */ -rdata_t * -rd_new_frm_string(rd_type_t t, char *s) +t_rdata_field * +rd_new_frm_string(t_rd_type t, char *s) { - rdata_t *new; - new = xmalloc(sizeof(rdata_t)); + t_rdata_field *new; + new = xmalloc(sizeof(t_rdata_field)); if (NULL == new) return NULL; @@ -100,7 +100,7 @@ rd_new_frm_string(rd_type_t t, char *s) return(new); } -void rd_destroy(rdata_t *rd) +void rd_destroy(t_rdata_field *rd) { rd = NULL; /* kuch */ /* empty */ diff --git a/rdata.h b/rdata.h index fcd80f41..36cb46b0 100644 --- a/rdata.h +++ b/rdata.h @@ -15,7 +15,7 @@ #include -enum enum_rdata_type +enum type_enum_rdata { /** domain name */ RD_DNAME_T, @@ -56,9 +56,9 @@ enum enum_rdata_type /** location data */ RD_LOC_T }; -typedef enum enum_rdata_type rd_type_t; +typedef enum type_enum_rdata t_rd_type; -enum enum_class_type +enum type_enum_class { /** the Internet */ CLASS_IN = 1, @@ -69,7 +69,7 @@ enum enum_class_type /** Any class */ CLASS_ANY = 255 }; -typedef enum enum_class_type class_t; +typedef enum type_enum_class t_class; /** * \brief Resource record data @@ -77,25 +77,25 @@ typedef enum enum_class_type class_t; * The data is a network ordered array of bytes, which size is specified by the (16-bit) size field.
* To correctly parse it, use the type specified in the (16-bit) type field. */ -struct struct_rdata_t +struct type_struct_rdata_field { /** \brief The size of the data (in bytes) */ uint16_t _size; /** \brief The type of the data */ - rd_type_t _type; + t_rd_type _type; /** \brief Pointer to the data (byte buffer) */ uint8_t *_data; }; -typedef struct struct_rdata_t rdata_t; +typedef struct type_struct_rdata_field t_rdata_field; /* prototypes */ -uint16_t rd_size(rdata_t *); -uint8_t *rd_data(rdata_t *); -void rd_set_size(rdata_t *, uint16_t); -void rd_set_type(rdata_t *, rd_type_t); -void rd_set_data(rdata_t *, uint8_t *, uint16_t); -rd_type_t rd_type(rdata_t *); -rdata_t *rd_new(uint16_t, rd_type_t, uint8_t *); -void rd_destroy(rdata_t *); +uint16_t rd_size(t_rdata_field *); +uint8_t *rd_data(t_rdata_field *); +void rd_set_size(t_rdata_field *, uint16_t); +void rd_set_type(t_rdata_field *, t_rd_type); +void rd_set_data(t_rdata_field *, uint8_t *, uint16_t); +t_rd_type rd_type(t_rdata_field *); +t_rdata_field *rd_new(uint16_t, t_rd_type, uint8_t *); +void rd_destroy(t_rdata_field *); #endif /* _RDATA_H */ diff --git a/rr.h b/rr.h index d9f87614..9b3cee6a 100644 --- a/rr.h +++ b/rr.h @@ -126,7 +126,7 @@ * * This is the basic DNS element that contains actual data */ -struct struct_rr_type +struct type_struct_rr { /** \brief Owner name, uncompressed */ uint8_t *owner; @@ -140,12 +140,12 @@ struct struct_rr_type * * name chosen to avoid clash with class keyword */ - class_t klass; + t_class klass; /* everything in the rdata is in network order */ /** \brief The list of data's */ - rdata_t *rdata; + t_rdata_field *rdata_fields; }; -typedef struct struct_rr_type rr_t; +typedef struct type_struct_rr t_rr; /** * \brief Resource Record Set @@ -153,11 +153,11 @@ typedef struct struct_rr_type rr_t; * Contains a list of rr's
* No official RFC-like checks are made */ -struct t_rrset_type +struct type_struct_rrset { - rr_t *rrs; + t_rr *rrs; }; -typedef struct t_rrset_type rrset_t; +typedef struct type_struct_rrset t_rrset; #endif /* _RR_H */ diff --git a/util.c b/util.c index 04ac0183..b4b82366 100644 --- a/util.c +++ b/util.c @@ -29,7 +29,7 @@ xmalloc(size_t s) /* put this here tmp. for debugging */ void -xprintf_rd(rdata_t *rd) +xprintf_rd_field(t_rdata_field *rd) { /* assume printable string */ fprintf(stdout, "size\t:%u\n", (unsigned int)rd_size(rd));