From: Jelte Jansen Date: Thu, 9 Dec 2004 09:54:17 +0000 (+0000) Subject: doxygen doc X-Git-Tag: release-0.50~744 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e173d89d447f3571a00e6ee2cc3800c99ca0c2ca;p=thirdparty%2Fldns.git doxygen doc --- diff --git a/libdns.doxygen b/libdns.doxygen index 825f92fe..785f16a9 100644 --- a/libdns.doxygen +++ b/libdns.doxygen @@ -432,7 +432,7 @@ INPUT = . # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm -FILE_PATTERNS = +FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. diff --git a/packet.h b/packet.h index 9ff1f63f..1ccd2137 100644 --- a/packet.h +++ b/packet.h @@ -17,32 +17,61 @@ #include "rdata.h" #include "rr.h" +/** + * \brief Header of a dns packet + * + * Contains the information about the packet itself + */ struct struct_header_type { - uint16_t id; /* id of a packet */ + /** \brief Id of a packet */ + uint16_t id; + /** \brief Query bit (0=query, 1=answer) */ uint8_t qr:1; + /** \brief Authoritative answer */ uint8_t aa:1; + /** \brief Packet truncated */ uint8_t tc:1; + /** \brief Recursion desired */ uint8_t rd:1; + /** \brief Checking disabled */ uint8_t cd:1; + /** \brief Recursion available */ uint8_t ra:1; + /** \brief Authentic data */ uint8_t ad:1; + /** \brief Query type */ uint8_t opcode; + /** \brief Response code */ uint8_t rcode; - uint8_t qdcount; /* question sec */ - uint8_t ancount; /* answer sec */ - uint8_t nscount; /* auth sec */ - uint8_t acount; /* add sec */ + /** \brief question sec */ + uint8_t qdcount + /** \brief answer sec */ + uint8_t ancount + /** \brief auth sec */ + uint8_t nscount + /** \brief add sec */ + uint8_t acount; }; typedef struct struct_header_type header_t; +/** + * \brief DNS packet + * + * This structure contains a complete DNS packet (either a query or an answer) + */ struct struct_packet_type { - header_t *header; /* header section */ - rrset_t *question; /* question section */ - rrset_t *answer; /* answer section */ - rrset_t *authority; /* auth section */ - rrset_t *additional; /* add section */ + /** \brief header section */ + header_t *header + /** \brief question section */ + rrset_t *question + /** \brief answer section */ + rrset_t *answer + /** \brief auth section */ + rrset_t *authority + /** \brief add section */ + rrset_t *additional }; typedef struct struct_packet_type packet_t; diff --git a/rdata.h b/rdata.h index 6b3e85d1..fcd80f41 100644 --- a/rdata.h +++ b/rdata.h @@ -17,49 +17,73 @@ enum enum_rdata_type { - RD_DNAME_T, /* domain name */ - RD_INT8_T, /* 8 bits */ - RD_INT16_T, /* 16 bits */ - RD_INT32_T, /* 32 bits */ - RD_INT48_T, /* 48 bits? */ - RD_A_T, /* A record */ - RD_AAAA_T, /* AAAA record */ - RD_STR_T, /* txt string */ - RD_B64_T, /* b64 string */ - RD_HEX_T, /* hex string */ - RD_NSEC_T, /* nsec type codes */ - RD_TYPE_T, /* a RR type */ - RD_CLASS_T, /* a class */ - RD_CERT_T, /* certificates */ - RD_ALG_T, /* a key algorithm */ - RD_UNKNOWN_T, /* unknown types */ - RD_TIME_T, /* time */ - RD_SERVICE_T, /* protocol and port bitmaps */ - RD_LOC_T /* location data */ + /** domain name */ + RD_DNAME_T, + /** 8 bits */ + RD_INT8_T, + /** 16 bits */ + RD_INT16_T, + /** 32 bits */ + RD_INT32_T, + /** 48 bits? */ + RD_INT48_T, + /** A record */ + RD_A_T, + /** AAAA record */ + RD_AAAA_T, + /** txt string */ + RD_STR_T, + /** b64 string */ + RD_B64_T, + /** hex string */ + RD_HEX_T, + /** nsec type codes */ + RD_NSEC_T, + /** a RR type */ + RD_TYPE_T, + /** a class */ + RD_CLASS_T, + /** certificates */ + RD_CERT_T, + /** a key algorithm */ + RD_ALG_T, + /** unknown types */ + RD_UNKNOWN_T, + /** time */ + RD_TIME_T, + /** protocol and port bitmaps */ + RD_SERVICE_T, + /** location data */ + RD_LOC_T }; typedef enum enum_rdata_type rd_type_t; enum enum_class_type { + /** the Internet */ CLASS_IN = 1, + /** Chaos class */ CLASS_CHAOS = 3, + /** Hesiod (Dyer 87) */ CLASS_HS = 4, + /** Any class */ CLASS_ANY = 255 }; typedef enum enum_class_type class_t; -/* - * the basic data type - * 16 bits size - * 16 bits type - * size uint8_t's bytes of the actual data - * data = network order, expanded (no compression) +/** + * \brief Resource record data + * + * 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 { + /** \brief The size of the data (in bytes) */ uint16_t _size; + /** \brief The type of the data */ rd_type_t _type; + /** \brief Pointer to the data (byte buffer) */ uint8_t *_data; }; typedef struct struct_rdata_t rdata_t; diff --git a/rr.h b/rr.h index d9d2f7e1..d9f87614 100644 --- a/rr.h +++ b/rr.h @@ -1,3 +1,4 @@ + /* * rr.h * @@ -19,80 +20,138 @@ #include "rr.h" /* the different RR types */ -#define TYPE_A 1 /* a host address */ -#define TYPE_NS 2 /* an authoritative name server */ -#define TYPE_MD 3 /* a mail destination (Obsolete - use MX) */ -#define TYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */ -#define TYPE_CNAME 5 /* the canonical name for an alias */ -#define TYPE_SOA 6 /* marks the start of a zone of authority */ -#define TYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */ -#define TYPE_MG 8 /* a mail group member (EXPERIMENTAL) */ -#define TYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */ -#define TYPE_NULL 10 /* a null RR (EXPERIMENTAL) */ -#define TYPE_WKS 11 /* a well known service description */ -#define TYPE_PTR 12 /* a domain name pointer */ -#define TYPE_HINFO 13 /* host information */ -#define TYPE_MINFO 14 /* mailbox or mail list information */ -#define TYPE_MX 15 /* mail exchange */ -#define TYPE_TXT 16 /* text strings */ -#define TYPE_RP 17 /* RFC1183 */ -#define TYPE_AFSDB 18 /* RFC1183 */ -#define TYPE_X25 19 /* RFC1183 */ -#define TYPE_ISDN 20 /* RFC1183 */ -#define TYPE_RT 21 /* RFC1183 */ -#define TYPE_NSAP 22 /* RFC1706 */ - -#define TYPE_SIG 24 /* 2535typecode */ -#define TYPE_KEY 25 /* 2535typecode */ -#define TYPE_PX 26 /* RFC2163 */ - -#define TYPE_AAAA 28 /* ipv6 address */ -#define TYPE_LOC 29 /* LOC record RFC1876 */ -#define TYPE_NXT 30 /* 2535typecode */ - -#define TYPE_SRV 33 /* SRV record RFC2782 */ - -#define TYPE_NAPTR 35 /* RFC2915 */ -#define TYPE_KX 36 /* RFC2230 */ -#define TYPE_CERT 37 /* RFC2538 */ - -#define TYPE_DNAME 39 /* RFC2672 */ - -#define TYPE_OPT 41 /* Pseudo OPT record... */ -#define TYPE_APL 42 /* RFC3123 */ -#define TYPE_DS 43 /* draft-ietf-dnsext-delegation */ -#define TYPE_SSHFP 44 /* SSH Key Fingerprint */ - -#define TYPE_RRSIG 46 /* draft-ietf-dnsext-dnssec-25 */ +/** a host address */ +#define TYPE_A 1 +/** an authoritative name server */ +#define TYPE_NS 2 +/** a mail destination (Obsolete - use MX) */ +#define TYPE_MD 3 +/** a mail forwarder (Obsolete - use MX) */ +#define TYPE_MF 4 +/** the canonical name for an alias */ +#define TYPE_CNAME 5 +/** marks the start of a zone of authority */ +#define TYPE_SOA 6 +/** a mailbox domain name (EXPERIMENTAL) */ +#define TYPE_MB 7 +/** a mail group member (EXPERIMENTAL) */ +#define TYPE_MG 8 +/** a mail rename domain name (EXPERIMENTAL) */ +#define TYPE_MR 9 +/** a null RR (EXPERIMENTAL) */ +#define TYPE_NULL 10 +/** a well known service description */ +#define TYPE_WKS 11 +/** a domain name pointer */ +#define TYPE_PTR 12 +/** host information */ +#define TYPE_HINFO 13 +/** mailbox or mail list information */ +#define TYPE_MINFO 14 +/** mail exchange */ +#define TYPE_MX 15 +/** text strings */ +#define TYPE_TXT 16 +/** RFC1183 */ +#define TYPE_RP 17 +/** RFC1183 */ +#define TYPE_AFSDB 18 +/** RFC1183 */ +#define TYPE_X25 19 +/** RFC1183 */ +#define TYPE_ISDN 20 +/** RFC1183 */ +#define TYPE_RT 21 +/** RFC1706 */ +#define TYPE_NSAP 22 + +/** 2535typecode */ +#define TYPE_SIG 24 +/** 2535typecode */ +#define TYPE_KEY 25 +/** RFC2163 */ +#define TYPE_PX 26 + +/** ipv6 address */ +#define TYPE_AAAA 28 +/** LOC record RFC1876 */ +#define TYPE_LOC 29 +/** 2535typecode */ +#define TYPE_NXT 30 + +/** SRV record RFC2782 */ +#define TYPE_SRV 33 + +/** RFC2915 */ +#define TYPE_NAPTR 35 +/** RFC2230 */ +#define TYPE_KX 36 +/** RFC2538 */ +#define TYPE_CERT 37 + +/** RFC2672 */ +#define TYPE_DNAME 39 + +/** Pseudo OPT record... */ +#define TYPE_OPT 41 +/** RFC3123 */ +#define TYPE_APL 42 +/** draft-ietf-dnsext-delegation */ +#define TYPE_DS 43 +/** SSH Key Fingerprint */ +#define TYPE_SSHFP 44 + +/** draft-ietf-dnsext-dnssec-25 */ +#define TYPE_RRSIG 46 #define TYPE_NSEC 47 #define TYPE_DNSKEY 48 #define TYPE_TSIG 250 #define TYPE_IXFR 251 #define TYPE_AXFR 252 -#define TYPE_MAILB 253 /* A request for mailbox-related records (MB, MG or MR) */ -#define TYPE_MAILA 254 /* A request for mail agent RRs (Obsolete - see MX) */ -#define TYPE_ANY 255 /* any type (wildcard) */ - +/** A request for mailbox-related records (MB, MG or MR) */ +#define TYPE_MAILB 25 +/** A request for mail agent RRs (Obsolete - see MX) */ +#define TYPE_MAILA 25 +/** any type (wildcard) */ +#define TYPE_ANY 25 + +/** Maximum length of a dname label */ #define MAXLABELLEN 63 +/** Maximum length of a complete dname */ #define MAXDOMAINLEN 255 -/* the general rr type */ +/** + * \brief Resource Record type + * + * This is the basic DNS element that contains actual data + */ struct struct_rr_type { - uint8_t *owner; /* owner name, uncompressed */ - uint32_t ttl; /* ttl */ - uint16_t rd_count; /* amount of rdata */ - uint16_t type; /* the type of the RR. A, MX etc. */ - class_t klass; /* avoid clash with class keyword */ + /** \brief Owner name, uncompressed */ + uint8_t *owner; + /** \brief Time to live */ + uint32_t ttl; + /** \brief Number of data fields */ + uint16_t rd_count; + /** \brief the type of the RR. A, MX etc. */ + uint16_t type; + /** \brief Class of the resource record. + * + * name chosen to avoid clash with class keyword + */ + class_t klass; /* everything in the rdata is in network order */ - rdata_t *rdata; /* a list of data's */ - + /** \brief The list of data's */ + rdata_t *rdata; }; typedef struct struct_rr_type rr_t; -/* rrset contain a list of rr's - * no official RFC-like checks are made +/** + * \brief Resource Record Set + * + * Contains a list of rr's
+ * No official RFC-like checks are made */ struct t_rrset_type {