]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
renamed all types to t_
authorMiek Gieben <miekg@NLnetLabs.nl>
Thu, 9 Dec 2004 11:28:14 +0000 (11:28 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Thu, 9 Dec 2004 11:28:14 +0000 (11:28 +0000)
sane name of structs
sane name of rdata field, namely t_rdata_field

and much, much more

main.c
packet.h
prototype.h
rdata.c
rdata.h
rr.h
util.c

diff --git a/main.c b/main.c
index 7bc8ae08dc5bc8437f00de260c10226353e4fb0f..755e2772a1d35c6a892aaa800f3da5263e3668ff 100644 (file)
--- a/main.c
+++ b/main.c
 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;
 }
index a954f0cbd398c43a8383f3a0e112cf7315a6b33d..bb352ad27a189a8bca26016fbf2680c171f51aec 100644 (file)
--- 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 */
index 9243b472fc3ff3da22dd6e106c240e6b60322594..8d573b015ab017c2bf932d48092b95a8cdc7bd97 100644 (file)
@@ -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 db3e58e4d00905ee8200d87ac2f316d3781424da..550144341e433a7352d435fcd6a1037c20f5a4e6 100644 (file)
--- a/rdata.c
+++ b/rdata.c
 
 /* 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 fcd80f41c6fe03c057087e63a2e0daa8b5517211..36cb46b02ff59f450e19f89aae4742c4f778ec56 100644 (file)
--- a/rdata.h
+++ b/rdata.h
@@ -15,7 +15,7 @@
 
 #include <stdint.h>
 
-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.<br>
  * 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 d9f8761408122b6303fb1e59163ee7c9544faddf..9b3cee6a0b98b76b6261f97c52b4aff757ed1c74 100644 (file)
--- a/rr.h
+++ b/rr.h
  *
  * 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 <br>
  * 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 04ac0183636713f996470cd851eff94d8128edf5..b4b82366bc863af2f556efd09b2c63045dae3f7f 100644 (file)
--- 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));