]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
types and function names conversion
authorMiek Gieben <miekg@NLnetLabs.nl>
Thu, 16 Dec 2004 11:13:06 +0000 (11:13 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Thu, 16 Dec 2004 11:13:06 +0000 (11:13 +0000)
ldns/error.h
ldns/packet.h
ldns/rdata.h
ldns/rr.h
libdns.vim
packet.c
rdata.c
rr.c
run-test0.c
util.c
util.h

index 807d282917fd54696df8882896711c7e77ee5d82..aecc0b0c428c2800e32cac0d577422fb716cf705 100644 (file)
 /* we do negative error codes? */
 #define __X    -1
 
-enum ldns_enum_status_type 
+enum ldns_enum_status 
 {
        LDNS_E_OK               = 0,
        LDNS_E_EMPTY_LABEL      = 1 * __X,
        LDNS_E_DDD_OVERFLOW     = 2 * __X
 
 };
-typedef enum ldns_enum_status_type ldns_status_type;
+typedef enum ldns_enum_status ldns_status;
 
 #endif /* _ERROR_H */
index 5847a9fa17c811fb6a6d32ad0121cc8ad7412ce7..138686bccfb1aa96d19178ba6592fb0d19ff6d6d 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Contains the information about the packet itself
  */
-struct type_struct_header
+struct ldns_struct_hdr
 {
        /** \brief Id of a packet */
        uint16_t _id;
@@ -52,72 +52,72 @@ struct type_struct_header
        /** \brief add sec */
        uint16_t _arcount;
 };
-typedef struct type_struct_header ldns_header_type;
+typedef struct ldns_struct_hdr ldns_hdr;
 
 /**
  * \brief DNS packet
  *
  * This structure contains a complete DNS packet (either a query or an answer)
  */
-struct type_struct_packet
+struct ldns_struct_pkt
 {
        /** \brief header section */
-       ldns_header_type *_header;
+       ldns_hdr *_header;
        /** \brief question section */
-       t_rrset *_question;
+       ldns_rrset      *_question;
        /** \brief answer section */
-       t_rrset *_answer;
+       ldns_rrset      *_answer;
        /** \brief auth section */
-       t_rrset *_authority;
+       ldns_rrset      *_authority;
        /** \brief add section */
-       t_rrset *_additional;
+       ldns_rrset      *_additional;
 };
-typedef struct type_struct_packet ldns_packet_type;
+typedef struct ldns_struct_pkt ldns_pkt;
 
 /* prototypes */
-uint16_t packet_id(ldns_packet_type *);
-bool packet_qr(ldns_packet_type *);
-bool packet_aa(ldns_packet_type *);
-bool packet_tc(ldns_packet_type *);
-bool packet_rd(ldns_packet_type *);
-bool packet_cd(ldns_packet_type *);
-bool packet_ra(ldns_packet_type *);
-bool packet_ad(ldns_packet_type *);
-uint8_t packet_opcode(ldns_packet_type *);
-uint8_t packet_rcode(ldns_packet_type *);
-uint16_t packet_qdcount(ldns_packet_type *);
-uint16_t packet_ancount(ldns_packet_type *);
-uint16_t packet_nscount(ldns_packet_type *);
-uint16_t packet_arcount(ldns_packet_type *);
+uint16_t packet_id(ldns_pkt *);
+bool pkt_qr(ldns_pkt *);
+bool pkt_aa(ldns_pkt *);
+bool pkt_tc(ldns_pkt *);
+bool pkt_rd(ldns_pkt *);
+bool pkt_cd(ldns_pkt *);
+bool pkt_ra(ldns_pkt *);
+bool pkt_ad(ldns_pkt *);
+uint8_t pkt_opcode(ldns_pkt *);
+uint8_t pkt_rcode(ldns_pkt *);
+uint16_t pkt_qdcount(ldns_pkt *);
+uint16_t pkt_ancount(ldns_pkt *);
+uint16_t pkt_nscount(ldns_pkt *);
+uint16_t pkt_arcount(ldns_pkt *);
 
-void packet_set_id(ldns_packet_type *, uint16_t);
-void packet_set_qr(ldns_packet_type *, bool);
-void packet_set_aa(ldns_packet_type *, bool);
-void packet_set_tc(ldns_packet_type *, bool);
-void packet_set_rd(ldns_packet_type *, bool);
-void packet_set_cd(ldns_packet_type *, bool);
-void packet_set_ra(ldns_packet_type *, bool);
-void packet_set_ad(ldns_packet_type *, bool);
-void packet_set_opcode(ldns_packet_type *, uint8_t);
-void packet_set_rcode(ldns_packet_type *, uint8_t);
-void packet_set_qdcount(ldns_packet_type *, uint16_t);
-void packet_set_ancount(ldns_packet_type *, uint16_t);
-void packet_set_nscount(ldns_packet_type *, uint16_t);
-void packet_set_arcount(ldns_packet_type *, uint16_t);
+void pkt_set_id(ldns_pkt *, uint16_t);
+void pkt_set_qr(ldns_pkt *, bool);
+void pkt_set_aa(ldns_pkt *, bool);
+void pkt_set_tc(ldns_pkt *, bool);
+void pkt_set_rd(ldns_pkt *, bool);
+void pkt_set_cd(ldns_pkt *, bool);
+void pkt_set_ra(ldns_pkt *, bool);
+void pkt_set_ad(ldns_pkt *, bool);
+void pkt_set_opcode(ldns_pkt *, uint8_t);
+void pkt_set_rcode(ldns_pkt *, uint8_t);
+void pkt_set_qdcount(ldns_pkt *, uint16_t);
+void pkt_set_ancount(ldns_pkt *, uint16_t);
+void pkt_set_nscount(ldns_pkt *, uint16_t);
+void pkt_set_arcount(ldns_pkt *, uint16_t);
 
 /**
- * Allocates and initializes a ldns_packet_type structure
+ * Allocates and initializes a ldns_pkt structure
  *
  * @return pointer to the new packet
  */
-ldns_packet_type *ldns_packet_new();
+ldns_pkt *ldns_packet_new();
 
 /**
  * Frees the packet structure and all data that it contains
  *
  * @param packet The packet structure to free
  */
-void ldns_packet_free(ldns_packet_type *packet);
+void ldns_packet_free(ldns_pkt *packet);
 
 /**
  * Converts the data on the uint8_t bytearray (in wire format) to a DNS packet
@@ -127,6 +127,6 @@ void ldns_packet_free(ldns_packet_type *packet);
  * @param packet pointer to the structure to hold the packet
  * @return the number of bytes read from the wire
  */
-size_t ldns_wire2packet(ldns_packet_type *packet, const uint8_t *data, size_t len);
+size_t ldns_wire2pkt(ldns_pkt *packet, const uint8_t *data, size_t len);
 
 #endif  /* !_LDNS_PACKET_H */
index 556c416b3051b48dcb35e537374ac66428047bb8..912a78b8b1ebbaf758220e9be49fa4417920e792 100644 (file)
@@ -35,7 +35,7 @@
 
 #define MAXRDATALEN 64
 
-enum ldns_enum_rdata_field_type
+enum ldns_enum_rdf_type
 {
        /** none */
        RD_NONE_T,
@@ -81,9 +81,9 @@ enum ldns_enum_rdata_field_type
        RD_LOC_T
        
 };
-typedef enum ldns_enum_rdata_field_type ldns_rdata_field_type;
+typedef enum ldns_enum_rdf_type ldns_rdf_type;
 
-enum type_enum_class
+enum ldns_enum_class
 {
        /** the Internet */
        CLASS_IN        = 1,
@@ -94,7 +94,7 @@ enum type_enum_class
        /** Any class */
        CLASS_ANY       = 255
 };
-typedef enum type_enum_class t_class;
+typedef enum ldns_enum_class ldns_class;
 
 /**
  * \brief Resource record data
@@ -102,25 +102,25 @@ typedef enum type_enum_class t_class;
  * 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 type_struct_rdata_field 
+struct ldns_struct_rdf
 {
        /** \brief The size of the data (in bytes) */
        uint16_t _size;
        /** \brief The type of the data */
-       ldns_rdata_field_type _type;
+       ldns_rdf_type _type;
        /** \brief Pointer to the data (byte buffer) */
        uint8_t  *_data;
 };
-typedef struct type_struct_rdata_field t_rdata_field;
+typedef struct ldns_struct_rdf ldns_rdf;
 
 /* prototypes */
-uint16_t        _ldns_rd_field_size(t_rdata_field *);
-void            _ldns_rd_field_set_size(t_rdata_field *, uint16_t);
-void            _ldns_rd_field_set_type(t_rdata_field *, ldns_rdata_field_type);
-void            _ldns_rd_field_set_data(t_rdata_field *, uint8_t *);
-ldns_rdata_field_type _ldns_rd_field_type(t_rdata_field *);
-t_rdata_field   *_ldns_rd_field_new(uint16_t, ldns_rdata_field_type, uint8_t *);
-uint8_t         *_ldns_rd_field_data(t_rdata_field *);
-void            _ldns_rd_field_destroy(t_rdata_field *);
+uint16_t        _ldns_rdf_size(ldns_rdf *);
+void            _ldns_rdf_set_size(ldns_rdf *, uint16_t);
+void            _ldns_rdf_set_type(ldns_rdf *, ldns_rdf_type);
+void            _ldns_rdf_set_data(ldns_rdf *, uint8_t *);
+ldns_rdf_type   _ldns_rdf_type(ldns_rdf *);
+ldns_rdf       *_ldns_rdf_new(uint16_t, ldns_rdf_type, uint8_t *);
+uint8_t         *_ldns_rdf_data(ldns_rdf *);
+void            _ldns_rdf_destroy(ldns_rdf *);
 
 #endif /* !_LDNS_RDATA_H */
index 33c81341f8dc6e1c4bd99ecb335c8b9cf2209042..afaf05af9366aad8e3efbe42d1729f679d92dd36 100644 (file)
--- a/ldns/rr.h
+++ b/ldns/rr.h
  *
  * This is the basic DNS element that contains actual data
  */
-struct type_struct_rr
+struct ldns_struct_rr
 {
        /** \brief Owner name, uncompressed */
        uint8_t         *_owner;        
@@ -139,12 +139,12 @@ struct type_struct_rr
         *
         * name chosen to avoid clash with class keyword
         */
-       t_class         _klass; 
+       ldns_class       _klass;
        /* everything in the rdata is in network order */
        /** \brief The list of rdata's */
-       t_rdata_field   **_rdata_fields;
+       ldns_rdf         **_rdata_fields;
 };
-typedef struct type_struct_rr ldns_rr_type;
+typedef struct ldns_struct_rr ldns_rr;
 
 /**
  * \brief Resource Record Set
@@ -152,12 +152,12 @@ typedef struct type_struct_rr ldns_rr_type;
  * Contains a list of rr's <br>
  * No official RFC-like checks are made 
  */
-struct type_struct_rrset
+struct ldns_struct_rrset
 {
-       ldns_rr_type *rrs;
+       ldns_rr *rrs;
 
 };
-typedef struct type_struct_rrset t_rrset;
+typedef struct ldns_struct_rrset ldns_rrset;
 
 /* 
  * \brief struct to hold the whole set of rd_fields
@@ -165,38 +165,37 @@ typedef struct type_struct_rrset t_rrset;
  * How does the whole rdata_field list look. This is called
  * the rdata in dns speak
  */
-struct ldns_struct_rr_descriptor_type
+struct ldns_struct_rr_descriptor
 {
         uint16_t    _type;       /* RR type */
         const char *_name;       /* Textual name.  */
         uint8_t     _minimum;    /* Minimum number of RDATA FIELDs.  */
         uint8_t     _maximum;    /* Maximum number of RDATA FIELDs.  */
-        const ldns_rdata_field_type *_wireformat;
-       ldns_rdata_field_type _variable;
+        const ldns_rdf_type *_wireformat;
+       ldns_rdf_type _variable;
 };
-typedef struct ldns_struct_rr_descriptor_type ldns_rr_descriptor_type;
+typedef struct ldns_struct_rr_descriptor ldns_rr_descriptor;
 
 
 /* prototypes */
-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);
-size_t 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 * ldns_rr_new(void);
+void ldns_rr_set_owner(ldns_rr *, uint8_t *);
+void ldns_rr_set_ttl(ldns_rr *, uint16_t);
+void ldns_rr_set_rd_count(ldns_rr *, uint16_t);
+void ldns_rr_set_class(ldns_rr *, ldns_class);
+bool ldns_rr_push_rdf(ldns_rr *, ldns_rdf *);
+uint8_t *ldns_rr_owner(ldns_rr *);
+uint8_t ldns_rr_ttl(ldns_rr *);
+uint16_t ldns_rr_rd_count(ldns_rr *);
+
+const ldns_rr_descriptor *ldns_rr_descript(uint16_t type);
+size_t ldns_rr_descriptor_minimum(ldns_rr_descriptor *descriptor);
+size_t ldns_rr_descriptor_maximum(ldns_rr_descriptor *descriptor);
+ldns_rdf_type ldns_rr_descriptor_field_type(ldns_rr_descriptor *descriptor, size_t index);
 
 size_t ldns_wire2dname(uint8_t *dname, const uint8_t *wire, size_t max, 
                        size_t *pos);
-size_t ldns_wire2rr(ldns_rr_type *rr, const uint8_t *wire, size_t max,
+size_t ldns_wire2rr(ldns_rr *rr, const uint8_t *wire, size_t max,
                     size_t *pos, int section);
 
 #endif /* _LDNS_RR_H */
index 30e361a2a71577af95047e8257176384bbca0368..2c465bd4c4524c7dc8ace104d02834737dfbf0fa 100644 (file)
@@ -4,15 +4,17 @@
 " Last change:  2004-12-15
 
 " ldns/rdata.h
-syn keyword  ldnsType           t_rdata_field
-syn keyword  ldnsType           t_rr
-syn keyword  ldnsType           ldns_rdata_field_type
-syn keyword  ldnsType           ldns_rr_descriptor_type
-syn keyword  ldnsType           ldns_header_type
-syn keyword  ldnsType           ldns_packet_type
-syn keyword  ldnsType           t_rrset
-syn keyword  ldnsType           true
-syn keyword  ldnsType           false
+syn keyword  ldnsType           ldns_rdf_type
+syn keyword  ldnsType           ldns_rdf
+syn keyword  ldnsType           ldns_rr
+syn keyword  ldnsType           ldns_rr_descriptor
+syn keyword  ldnsType           ldns_hdr
+syn keyword  ldnsType           ldns_pkt
+syn keyword  ldnsType           ldns_status
+syn keyword  ldnsType           ldns_rrset
+syn keyword  ldnsType           ldns_class
+syn keyword  ldnsConstant       true
+syn keyword  ldnsConstant       false
 
 " ldns/rr.h 
 syn keyword  ldnsConstant TYPE_A          
index 81f32ce1619f0bcfb97b20f842c2638b66ae4e6d..7b671e76b0bb31d600c7db71eeefaff1c6abb2ae 100644 (file)
--- a/packet.c
+++ b/packet.c
 
 /* read */
 uint16_t
-packet_id(ldns_packet_type *packet)
+pkt_id(ldns_pkt *packet)
 {
        return packet->_header->_id;
 }
 
 bool
-packet_qr(ldns_packet_type *packet)
+pkt_qr(ldns_pkt *packet)
 {
        return packet->_header->_qr;
 }
 
 bool
-packet_aa(ldns_packet_type *packet)
+pkt_aa(ldns_pkt *packet)
 {
        return packet->_header->_aa;
 }
 
 bool
-packet_tc(ldns_packet_type *packet)
+pkt_tc(ldns_pkt *packet)
 {
        return packet->_header->_tc;
 }
 
 bool
-packet_rd(ldns_packet_type *packet)
+pkt_rd(ldns_pkt *packet)
 {
        return packet->_header->_rd;
 }
 
 bool
-packet_cd(ldns_packet_type *packet)
+pkt_cd(ldns_pkt *packet)
 {
        return packet->_header->_cd;
 }
 
 bool
-packet_ra(ldns_packet_type *packet)
+pkt_ra(ldns_pkt *packet)
 {
        return packet->_header->_ra;
 }
 
 bool
-packet_ad(ldns_packet_type *packet)
+pkt_ad(ldns_pkt *packet)
 {
        return packet->_header->_ad;
 }
 
 uint8_t
-packet_opcode(ldns_packet_type *packet)
+pkt_opcode(ldns_pkt *packet)
 {
        return packet->_header->_opcode;
 }
 
 uint8_t
-packet_rcode(ldns_packet_type *packet)
+pkt_rcode(ldns_pkt *packet)
 {
        return packet->_header->_rcode;
 }
 
 uint16_t
-packet_qdcount(ldns_packet_type *packet)
+pkt_qdcount(ldns_pkt *packet)
 {
        return packet->_header->_qdcount;
 }
 
 uint16_t
-packet_ancount(ldns_packet_type *packet)
+pkt_ancount(ldns_pkt *packet)
 {
        return packet->_header->_ancount;
 }
 
 uint16_t
-packet_nscount(ldns_packet_type *packet)
+pkt_nscount(ldns_pkt *packet)
 {
        return packet->_header->_nscount;
 }
 
 uint16_t
-packet_arcount(ldns_packet_type *packet)
+pkt_arcount(ldns_pkt *packet)
 {
        return packet->_header->_arcount;
 }
@@ -222,85 +222,85 @@ packet_arcount(ldns_packet_type *packet)
 
 /* write */
 void
-packet_set_id(ldns_packet_type *packet, uint16_t id)
+pkt_set_id(ldns_pkt *packet, uint16_t id)
 {
        packet->_header->_id = id;
 }
 
 void
-packet_set_qr(ldns_packet_type *packet, bool qr)
+pkt_set_qr(ldns_pkt *packet, bool qr)
 {
        packet->_header->_qr = qr;
 }
 
 void
-packet_set_aa(ldns_packet_type *packet, bool aa)
+pkt_set_aa(ldns_pkt *packet, bool aa)
 {
        packet->_header->_aa = aa;
 }
 
 void
-packet_set_tc(ldns_packet_type *packet, bool tc)
+pkt_set_tc(ldns_pkt *packet, bool tc)
 {
        packet->_header->_tc = tc;
 }
 
 void
-packet_set_rd(ldns_packet_type *packet, bool rd)
+pkt_set_rd(ldns_pkt *packet, bool rd)
 {
        packet->_header->_rd = rd;
 }
 
 void
-packet_set_cd(ldns_packet_type *packet, bool cd)
+pkt_set_cd(ldns_pkt *packet, bool cd)
 {
        packet->_header->_cd = cd;
 }
 
 void
-packet_set_ra(ldns_packet_type *packet, bool ra)
+pkt_set_ra(ldns_pkt *packet, bool ra)
 {
        packet->_header->_ra = ra;
 }
 
 void
-packet_set_ad(ldns_packet_type *packet, bool ad)
+pkt_set_ad(ldns_pkt *packet, bool ad)
 {
        packet->_header->_ad = ad;
 }
 
 void
-packet_set_opcode(ldns_packet_type *packet, uint8_t opcode)
+pkt_set_opcode(ldns_pkt *packet, uint8_t opcode)
 {
        packet->_header->_opcode = opcode;
 }
 
 void
-packet_set_rcode(ldns_packet_type *packet, uint8_t rcode)
+pkt_set_rcode(ldns_pkt *packet, uint8_t rcode)
 {
        packet->_header->_rcode = rcode;
 }
 
 void
-packet_set_qdcount(ldns_packet_type *packet, uint16_t qdcount)
+pkt_set_qdcount(ldns_pkt *packet, uint16_t qdcount)
 {
        packet->_header->_qdcount = qdcount;
 }
 
 void
-packet_set_ancount(ldns_packet_type *packet, uint16_t ancount)
+pkt_set_ancount(ldns_pkt *packet, uint16_t ancount)
 {
        packet->_header->_ancount = ancount;
 }
 
 void
-packet_set_nscount(ldns_packet_type *packet, uint16_t nscount)
+pkt_set_nscount(ldns_pkt *packet, uint16_t nscount)
 {
        packet->_header->_nscount = nscount;
 }
 
 void
-packet_set_arcount(ldns_packet_type *packet, uint16_t arcount)
+pkt_set_arcount(ldns_pkt *packet, uint16_t arcount)
 {
        packet->_header->_arcount = arcount;
 }
@@ -309,16 +309,16 @@ packet_set_arcount(ldns_packet_type *packet, uint16_t arcount)
 /* Create/destroy/convert functions
  */
  
-ldns_packet_type *
-ldns_packet_new()
+ldns_pkt *
+ldns_pkt_new()
 {
-       ldns_packet_type *packet;
-       packet = MALLOC(ldns_packet_type);
+       ldns_pkt *packet;
+       packet = MALLOC(ldns_pkt);
        if (!packet) {
                return NULL;
        }
 
-       packet->_header = MALLOC(ldns_header_type);
+       packet->_header = MALLOC(ldns_hdr);
        if (!packet->_header) {
                FREE(packet);
                return NULL;
@@ -332,7 +332,7 @@ ldns_packet_new()
 }
 
 void
-ldns_packet_free(ldns_packet_type *packet)
+ldns_pkt_free(ldns_pkt *packet)
 {
        FREE(packet->_header);
        if (packet->_question) {
@@ -354,7 +354,7 @@ ldns_packet_free(ldns_packet_type *packet)
 }
 
 static size_t
-ldns_wire2packet_header(ldns_packet_type *packet,
+ldns_wire2pkt_hdr(ldns_pkt *packet,
                        const uint8_t *wire,
                        size_t max,
                        size_t *pos)
@@ -364,22 +364,22 @@ ldns_wire2packet_header(ldns_packet_type *packet,
                return 0;
        } else {
 
-               packet_set_id(packet, ID(wire));
+               pkt_set_id(packet, ID(wire));
 
-               packet_set_qr(packet, QR(wire));
-               packet_set_opcode(packet, OPCODE(wire));
-               packet_set_aa(packet, AA(wire));
-               packet_set_tc(packet, TC(wire));
-               packet_set_rd(packet, RD(wire));
-               packet_set_ra(packet, RA(wire));
-               packet_set_ad(packet, AD(wire));
-               packet_set_cd(packet, CD(wire));
-               packet_set_rcode(packet, RCODE(wire));   
+               pkt_set_qr(packet, QR(wire));
+               pkt_set_opcode(packet, OPCODE(wire));
+               pkt_set_aa(packet, AA(wire));
+               pkt_set_tc(packet, TC(wire));
+               pkt_set_rd(packet, RD(wire));
+               pkt_set_ra(packet, RA(wire));
+               pkt_set_ad(packet, AD(wire));
+               pkt_set_cd(packet, CD(wire));
+               pkt_set_rcode(packet, RCODE(wire));      
 
-               packet_set_qdcount(packet, QDCOUNT(wire));
-               packet_set_ancount(packet, ANCOUNT(wire));
-               packet_set_nscount(packet, NSCOUNT(wire));
-               packet_set_arcount(packet, ARCOUNT(wire));
+               pkt_set_qdcount(packet, QDCOUNT(wire));
+               pkt_set_ancount(packet, ANCOUNT(wire));
+               pkt_set_nscount(packet, NSCOUNT(wire));
+               pkt_set_arcount(packet, ARCOUNT(wire));
 
                *pos += QHEADERSZ;
                /* TODO t_status succ.  */
@@ -389,29 +389,29 @@ ldns_wire2packet_header(ldns_packet_type *packet,
 
 /* TODO: error check, return status (of this and of wire2rrs) */
 size_t
-ldns_wire2packet(ldns_packet_type *packet, const uint8_t *wire, size_t max)
+ldns_wire2pkt(ldns_pkt *packet, const uint8_t *wire, size_t max)
 {
        size_t pos = 0;
        uint16_t i;
-       ldns_rr_type *rr;
+       ldns_rr *rr;
        size_t ret;
        
-       pos += ldns_wire2packet_header(packet, wire, max, &pos);
+       pos += ldns_wire2pkt_hdr(packet, wire, max, &pos);
 
        /* TODO: section enum :) */
-       for (i = 0; i < packet_qdcount(packet); i++) {
+       for (i = 0; i < pkt_qdcount(packet); i++) {
                rr = ldns_rr_new();
                ret = ldns_wire2rr(rr, wire, max, &pos, 0);
        }
-       for (i = 0; i < packet_ancount(packet); i++) {
+       for (i = 0; i < pkt_ancount(packet); i++) {
                rr = ldns_rr_new();
                ret = ldns_wire2rr(rr, wire, max, &pos, 1);
        }
-       for (i = 0; i < packet_nscount(packet); i++) {
+       for (i = 0; i < pkt_nscount(packet); i++) {
                rr = ldns_rr_new();
                ret = ldns_wire2rr(rr, wire, max, &pos, 2);
        }
-       for (i = 0; i < packet_arcount(packet); i++) {
+       for (i = 0; i < pkt_arcount(packet); i++) {
                rr = ldns_rr_new();
                ret = ldns_wire2rr(rr, wire, max, &pos, 3);
        }
diff --git a/rdata.c b/rdata.c
index 979a15feddd2b7afe1f5221dce9a0953a2471370..f93d73dcc6e23459347b4f3806818638c9312fcd 100644 (file)
--- a/rdata.c
+++ b/rdata.c
 
 /* read */
 uint16_t
-_ldns_rd_field_size(t_rdata_field *rd)
+_ldns_rdf_size(ldns_rdf *rd)
 {
        return rd->_size;
 }
 
-ldns_rdata_field_type
-_ldns_rd_field_type(t_rdata_field *rd)
+ldns_rdf_type
+_ldns_rdf_type(ldns_rdf *rd)
 {
        return rd->_type;
 }
 
 uint8_t *
-_ldns_rd_field_data(t_rdata_field *rd)
+_ldns_rdf_data(ldns_rdf *rd)
 {
        return rd->_data;
 }
 
 /* write */
 void
-_ldns_rd_field_set_size(t_rdata_field *rd, uint16_t s)
+_ldns_rdf_set_size(ldns_rdf *rd, uint16_t s)
 {
        rd->_size = s;
 }
 
 void
-_ldns_rd_field_set_type(t_rdata_field *rd, ldns_rdata_field_type t)
+_ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type t)
 {
        rd->_type = t;
 }
 
 void
-_ldns_rd_field_set_data(t_rdata_field *rd, uint8_t *d)
+_ldns_rdf_set_data(ldns_rdf *rd, uint8_t *d)
 {
        /* only copy the pointer */
        rd->_data = d;
 }
 
 /**
- * Allocate a new t_rdata_field structure 
+ * Allocate a new ldns_rdf structure 
  * and return it
  */
-t_rdata_field *
-_ldns_rd_field_new(uint16_t s, ldns_rdata_field_type t, uint8_t *d)
+ldns_rdf *
+_ldns_rdf_new(uint16_t s, ldns_rdf_type t, uint8_t *d)
 {
-       t_rdata_field *rd;
-       rd = MALLOC(t_rdata_field);
+       ldns_rdf *rd;
+       rd = MALLOC(ldns_rdf);
        if (!rd) {
                return NULL;
        }
 
-       _ldns_rd_field_set_size(rd, s);
-       _ldns_rd_field_set_type(rd, t);
-       _ldns_rd_field_set_data(rd, d);
-
+       _ldns_rdf_set_size(rd, s);
+       _ldns_rdf_set_type(rd, t);
+       _ldns_rdf_set_data(rd, d);
        return rd;
 }
 
 /**
- * Allocate a new t_rdata_field from
+ * Allocate a new ldns_rdf from
  * a NULL terminated string
  * and return it
  */
-t_rdata_field *
-_ldns_rd_field_new_frm_string(ldns_rdata_field_type t, char *s)
+ldns_rdf *
+_ldns_rdf_new_frm_str(ldns_rdf_type t, char *s)
 {
        return NULL;
 }
 
 void 
-_ldns_rd_field_destroy(t_rdata_field *rd)
+_ldns_rdf_destroy(ldns_rdf *rd)
 {
        rd = NULL; /* kuch */
        /* empty */
@@ -104,7 +103,7 @@ _ldns_rd_field_destroy(t_rdata_field *rd)
  * Return the length of the string or a negative error
  * code
  */
-ldns_status_type
+ldns_status
 _ldns_octet(char *word, size_t *length)
 {
     char *s; char *p;
diff --git a/rr.c b/rr.c
index b73076ee7ab59d472e1b499853d78c5747df84b2..0f2e603f9c5271e4676508e43e5aaffa819072e9 100644 (file)
--- a/rr.c
+++ b/rr.c
@@ -1,7 +1,7 @@
 /*
  * rr.c
  *
- * access function for ldns_rr_type
+ * access function for ldns_rr
  *
  * a Net::DNS like library for C
  *
 /**
  * create a new rr structure.
  */
-ldns_rr_type *
+ldns_rr *
 ldns_rr_new(void)
 {
-       ldns_rr_type *rr;
-       rr = MALLOC(ldns_rr_type);
+       ldns_rr *rr;
+       rr = MALLOC(ldns_rr);
         if (!rr) {
                 return NULL;
        }
@@ -39,7 +39,7 @@ ldns_rr_new(void)
  * set the owner in the rr structure
  */
 void
-ldns_rr_set_owner(ldns_rr_type *rr, uint8_t *owner)
+ldns_rr_set_owner(ldns_rr *rr, uint8_t *owner)
 {
        rr->_owner = owner;
 }
@@ -48,7 +48,7 @@ ldns_rr_set_owner(ldns_rr_type *rr, uint8_t *owner)
  * set the owner in the rr structure
  */
 void
-ldns_rr_set_ttl(ldns_rr_type *rr, uint16_t ttl)
+ldns_rr_set_ttl(ldns_rr *rr, uint16_t ttl)
 {
        rr->_ttl = ttl;
 }
@@ -57,7 +57,7 @@ ldns_rr_set_ttl(ldns_rr_type *rr, uint16_t ttl)
  * set the rd_count in the rr
  */
 void
-ldns_rr_set_rd_count(ldns_rr_type *rr, uint16_t count)
+ldns_rr_set_rd_count(ldns_rr *rr, uint16_t count)
 {
        rr->_rd_count = count;
 }
@@ -66,7 +66,7 @@ ldns_rr_set_rd_count(ldns_rr_type *rr, uint16_t count)
  * set the class in the rr
  */
 void
-ldns_rr_set_class(ldns_rr_type *rr, t_class klass)
+ldns_rr_set_class(ldns_rr *rr, ldns_class klass)
 {
        rr->_klass = klass;
 }
@@ -76,16 +76,16 @@ ldns_rr_set_class(ldns_rr_type *rr, t_class klass)
  * placed in the next available spot
  */
 bool
-ldns_rr_push_rd_field(ldns_rr_type *rr, t_rdata_field *f)
+ldns_rr_push_rdf(ldns_rr *rr, ldns_rdf *f)
 {
        uint16_t rd_count;
-       t_rdata_field **rdata_fields;
+       ldns_rdf **rdata_fields;
        
        rd_count = ldns_rr_rd_count(rr);
        
        /* grow the array */
        rdata_fields = XREALLOC(
-               rr->_rdata_fields, t_rdata_field *, rd_count + 1);
+               rr->_rdata_fields, ldns_rdf *, rd_count + 1);
        if (!rdata_fields) {
                return false;
        }
@@ -102,7 +102,7 @@ ldns_rr_push_rd_field(ldns_rr_type *rr, t_rdata_field *f)
  * return the owner name of an rr structure
  */
 uint8_t *
-ldns_rr_owner(ldns_rr_type *rr)
+ldns_rr_owner(ldns_rr *rr)
 {
        return rr->_owner;
 }
@@ -111,7 +111,7 @@ ldns_rr_owner(ldns_rr_type *rr)
  * return the owner name of an rr structure
  */
 uint8_t
-ldns_rr_ttl(ldns_rr_type *rr)
+ldns_rr_ttl(ldns_rr *rr)
 {
        return rr->_ttl;
 }
@@ -120,97 +120,97 @@ ldns_rr_ttl(ldns_rr_type *rr)
  * return the rd_count of an rr structure
  */
 uint16_t
-ldns_rr_rd_count(ldns_rr_type *rr)
+ldns_rr_rd_count(ldns_rr *rr)
 {
        return rr->_rd_count;
 }
 
-static const ldns_rdata_field_type type_0_wireformat[] = { RD_UNKNOWN_T };
-static const ldns_rdata_field_type type_a_wireformat[] = { RD_A_T };
-static const ldns_rdata_field_type type_ns_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_md_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_mf_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_cname_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_soa_wireformat[] = {
+static const ldns_rdf_type type_0_wireformat[] = { RD_UNKNOWN_T };
+static const ldns_rdf_type type_a_wireformat[] = { RD_A_T };
+static const ldns_rdf_type type_ns_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_md_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_mf_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_cname_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_soa_wireformat[] = {
        RD_DNAME_T, RD_DNAME_T, RD_INT32_T, RD_INT32_T,
        RD_INT32_T, RD_INT32_T, RD_INT32_T
 };
-static const ldns_rdata_field_type type_mb_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_mg_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_mr_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_wks_wireformat[] = {
+static const ldns_rdf_type type_mb_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_mg_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_mr_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_wks_wireformat[] = {
        RD_A_T, RD_SERVICE_T
 };
-static const ldns_rdata_field_type type_ptr_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_hinfo_wireformat[] = {
+static const ldns_rdf_type type_ptr_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_hinfo_wireformat[] = {
        RD_STR_T, RD_STR_T
 };
-static const ldns_rdata_field_type type_minfo_wireformat[] = {
+static const ldns_rdf_type type_minfo_wireformat[] = {
        RD_DNAME_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_mx_wireformat[] = {
+static const ldns_rdf_type type_mx_wireformat[] = {
        RD_INT8_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_rp_wireformat[] = {
+static const ldns_rdf_type type_rp_wireformat[] = {
        RD_DNAME_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_afsdb_wireformat[] = {
+static const ldns_rdf_type type_afsdb_wireformat[] = {
        RD_INT8_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_x25_wireformat[] = { RD_STR_T };
-static const ldns_rdata_field_type type_isdn_wireformat[] = {
+static const ldns_rdf_type type_x25_wireformat[] = { RD_STR_T };
+static const ldns_rdf_type type_isdn_wireformat[] = {
        RD_STR_T, RD_STR_T
 };
-static const ldns_rdata_field_type type_rt_wireformat[] = {
+static const ldns_rdf_type type_rt_wireformat[] = {
        RD_INT8_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_sig_wireformat[] = {
+static const ldns_rdf_type type_sig_wireformat[] = {
        RD_INT8_T, RD_INT8_T, RD_INT8_T, RD_INT32_T,
        RD_INT32_T, RD_INT32_T, RD_INT16_T,
        RD_DNAME_T, RD_B64_T
 };
-static const ldns_rdata_field_type type_key_wireformat[] = {
+static const ldns_rdf_type type_key_wireformat[] = {
        RD_INT16_T, RD_INT8_T, RD_INT8_T, RD_B64_T
 };
-static const ldns_rdata_field_type type_px_wireformat[] = {
+static const ldns_rdf_type type_px_wireformat[] = {
        RD_INT16_T, RD_DNAME_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_aaaa_wireformat[] = { RD_AAAA_T };
-static const ldns_rdata_field_type type_loc_wireformat[] = { RD_LOC_T };
-static const ldns_rdata_field_type type_nxt_wireformat[] = {
+static const ldns_rdf_type type_aaaa_wireformat[] = { RD_AAAA_T };
+static const ldns_rdf_type type_loc_wireformat[] = { RD_LOC_T };
+static const ldns_rdf_type type_nxt_wireformat[] = {
        RD_DNAME_T, RD_UNKNOWN_T
 };
-static const ldns_rdata_field_type type_srv_wireformat[] = {
+static const ldns_rdf_type type_srv_wireformat[] = {
        RD_INT16_T, RD_INT16_T, RD_INT16_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_naptr_wireformat[] = {
+static const ldns_rdf_type type_naptr_wireformat[] = {
        RD_INT16_T, RD_INT16_T, RD_STR_T, RD_STR_T, RD_STR_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_kx_wireformat[] = {
+static const ldns_rdf_type type_kx_wireformat[] = {
        RD_INT16_T, RD_DNAME_T
 };
-static const ldns_rdata_field_type type_cert_wireformat[] = {
+static const ldns_rdf_type type_cert_wireformat[] = {
         RD_CERT_T, RD_INT16_T, RD_ALG_T, RD_B64_T
 };
-static const ldns_rdata_field_type type_dname_wireformat[] = { RD_DNAME_T };
-static const ldns_rdata_field_type type_ds_wireformat[] = {
+static const ldns_rdf_type type_dname_wireformat[] = { RD_DNAME_T };
+static const ldns_rdf_type type_ds_wireformat[] = {
        RD_INT16_T, RD_INT8_T, RD_INT8_T, RD_HEX_T
 };
-static const ldns_rdata_field_type type_sshfp_wireformat[] = {
+static const ldns_rdf_type type_sshfp_wireformat[] = {
        RD_INT8_T, RD_INT8_T, RD_HEX_T
 };
-static const ldns_rdata_field_type type_rrsig_wireformat[] = {
+static const ldns_rdf_type type_rrsig_wireformat[] = {
        RD_TYPE_T, RD_INT8_T, RD_INT8_T, RD_INT32_T,
        RD_INT32_T, RD_INT32_T, RD_INT16_T, RD_DNAME_T, RD_B64_T
 };
-static const ldns_rdata_field_type type_nsec_wireformat[] = {
+static const ldns_rdf_type type_nsec_wireformat[] = {
        RD_DNAME_T, RD_NSEC_T
 };
-static const ldns_rdata_field_type type_dnskey_wireformat[] = {
+static const ldns_rdf_type type_dnskey_wireformat[] = {
        RD_INT16_T, RD_INT8_T, RD_ALG_T, RD_B64_T
 };
 
-static ldns_rr_descriptor_type rdata_field_descriptors[] = {
+static ldns_rr_descriptor rdata_field_descriptors[] = {
        /* 0 */
        { 0, NULL, 1, 1, type_0_wireformat, RD_NONE_T },
        /* 1 */
@@ -314,8 +314,8 @@ static ldns_rr_descriptor_type rdata_field_descriptors[] = {
 #define RDATA_FIELD_DESCRIPTORS_COUNT \
        (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
 
-const ldns_rr_descriptor_type *
-ldns_rr_descriptor(uint16_t type)
+const ldns_rr_descriptor *
+ldns_rr_descript(uint16_t type)
 {
        if (type < RDATA_FIELD_DESCRIPTORS_COUNT) {
                return &rdata_field_descriptors[type];
@@ -325,13 +325,13 @@ ldns_rr_descriptor(uint16_t type)
 }
 
 size_t
-ldns_rr_descriptor_minimum(ldns_rr_descriptor_type *descriptor)
+ldns_rr_descriptor_minimum(ldns_rr_descriptor *descriptor)
 {
        return descriptor->_minimum;
 }
 
 size_t
-ldns_rr_descriptor_maximum(ldns_rr_descriptor_type *descriptor)
+ldns_rr_descriptor_maximum(ldns_rr_descriptor *descriptor)
 {
        if (descriptor->_variable != RD_NONE_T) {
                /* XXX: Should really be SIZE_MAX... bad FreeBSD.  */
@@ -341,8 +341,8 @@ ldns_rr_descriptor_maximum(ldns_rr_descriptor_type *descriptor)
        }
 }
 
-ldns_rdata_field_type
-ldns_rr_descriptor_field_type(ldns_rr_descriptor_type *descriptor,
+ldns_rdf_type
+ldns_rr_descriptor_field_type(ldns_rr_descriptor *descriptor,
                               size_t index)
 {
        assert(descriptor != NULL);
@@ -461,7 +461,7 @@ ldns_wire2dname(uint8_t *dname, const uint8_t *wire, size_t max, size_t *pos)
          RR_CLASS(wire)?
 */
 size_t
-ldns_wire2rr(ldns_rr_type *rr, const uint8_t *wire, size_t max, 
+ldns_wire2rr(ldns_rr *rr, const uint8_t *wire, size_t max, 
              size_t *pos, int section)
 {
        uint8_t *owner = malloc(MAXDOMAINLEN);
index 61d128b7020663b7722f46694e894e0c6d3a2285..3f17f3bc0f12bc378f6be7e42de0ad76d873850b 100644 (file)
@@ -35,37 +35,37 @@ static const uint8_t wire[] = {
 int
 main(void)
 {
-       t_rdata_field *rd_f;
-       ldns_rr_type *rr;
-       ldns_packet_type *packet;
+       ldns_rdf *rd_f;
+       ldns_rr *rr;
+       ldns_pkt *packet;
        
        rr = ldns_rr_new();
 
-       rd_f = _ldns_rd_field_new(20, RD_DNAME_T, (uint8_t*)"hallo.nl");
-       xprintf_rd_field(rd_f);
+       rd_f = _ldns_rdf_new(20, RD_DNAME_T, (uint8_t*)"hallo.nl");
+       xprintf_rdf(rd_f);
        
-       ldns_rr_push_rd_field(rr, rd_f);
+       ldns_rr_push_rdf(rr, rd_f);
 
        xprintf_rr(rr);
 
-       packet = ldns_packet_new();
-       (void) ldns_wire2packet(packet, wire, sizeof(wire));
+       packet = ldns_pkt_new();
+       (void) ldns_wire2pkt(packet, wire, sizeof(wire));
        
-       printf("packet id: %d\n", (int) packet_id(packet));
-       printf("qr bit: %d\n", (int) packet_qr(packet));
-       printf("opcode: %d\n",(int) packet_opcode(packet));
-       printf("aa bit: %d\n",(int) packet_aa(packet));
-       printf("tc bit: %d\n",(int) packet_tc(packet));
-       printf("rd bit: %d\n",(int) packet_rd(packet));
-       printf("cd bit: %d\n",(int) packet_cd(packet));
-       printf("ra bit: %d\n",(int) packet_ra(packet));
-       printf("ad bit: %d\n",(int) packet_ad(packet));
-       printf("rcode: %d\n",(int) packet_rcode(packet));
-       printf("qdcount: %d\n",(int) packet_qdcount(packet));
-       printf("ancount: %d\n",(int) packet_ancount(packet));
-       printf("nscount: %d\n",(int) packet_nscount(packet));
-       printf("arcount: %d\n",(int) packet_arcount(packet));
+       printf("packet id: %d\n", (int) pkt_id(packet));
+       printf("qr bit: %d\n", (int) pkt_qr(packet));
+       printf("opcode: %d\n",(int) pkt_opcode(packet));
+       printf("aa bit: %d\n",(int) pkt_aa(packet));
+       printf("tc bit: %d\n",(int) pkt_tc(packet));
+       printf("rd bit: %d\n",(int) pkt_rd(packet));
+       printf("cd bit: %d\n",(int) pkt_cd(packet));
+       printf("ra bit: %d\n",(int) pkt_ra(packet));
+       printf("ad bit: %d\n",(int) pkt_ad(packet));
+       printf("rcode: %d\n",(int) pkt_rcode(packet));
+       printf("qdcount: %d\n",(int) pkt_qdcount(packet));
+       printf("ancount: %d\n",(int) pkt_ancount(packet));
+       printf("nscount: %d\n",(int) pkt_nscount(packet));
+       printf("arcount: %d\n",(int) pkt_arcount(packet));
 
-       ldns_packet_free(packet);
+       ldns_pkt_free(packet);
        return 0;
 }
diff --git a/util.c b/util.c
index 68eada5150329f1d389a086e4c5e2d131577895e..e46e1a922debdc6732ddf3e82e4f1a5a946f20b3 100644 (file)
--- a/util.c
+++ b/util.c
 
 /* put this here tmp. for debugging */
 void
-xprintf_rd_field(t_rdata_field *rd)
+xprintf_rdf(ldns_rdf *rd)
 {
        /* assume printable string */
-       fprintf(stdout, "size\t:%u\n", (unsigned int)_ldns_rd_field_size(rd));
-       fprintf(stdout, "type\t:%u\n", (unsigned int)_ldns_rd_field_type(rd));
-       fprintf(stdout, "data\t:[%.*s]\n", (int)_ldns_rd_field_size(rd), (char*)_ldns_rd_field_data(rd));
+       fprintf(stdout, "size\t:%u\n", (unsigned int)_ldns_rdf_size(rd));
+       fprintf(stdout, "type\t:%u\n", (unsigned int)_ldns_rdf_type(rd));
+       fprintf(stdout, "data\t:[%.*s]\n", (int)_ldns_rdf_size(rd), (char*)_ldns_rdf_data(rd));
 }
 
 void
-xprintf_rr(ldns_rr_type *rr)
+xprintf_rr(ldns_rr *rr)
 {
        /* assume printable string */
        uint16_t count, i;
@@ -35,6 +35,6 @@ xprintf_rr(ldns_rr_type *rr)
 
        for(i = 0; i < count; i++) {
                printf("print rd %u\n", (unsigned int) i);
-               xprintf_rd_field(rr->_rdata_fields[i]);
+               xprintf_rdf(rr->_rdata_fields[i]);
        }
 }
diff --git a/util.h b/util.h
index 6a1f4cdb99a09690dd402b55c18cdadae4872dfa..87313d4c6d711a740d14a1d3542978a903ae07c1 100644 (file)
--- a/util.h
+++ b/util.h
@@ -71,7 +71,7 @@ read_uint32(const void *src)
 #endif /* !S_SPLINT_S */
 
 /* prototypes */
-void    xprintf_rd_field(t_rdata_field *);
-void    xprintf_rr(ldns_rr_type *);
+void    xprintf_rdf(ldns_rdf *);
+void    xprintf_rr(ldns_rr *);
 
 #endif /* !_UTIL_H */