From: Miek Gieben Date: Mon, 18 Apr 2005 11:43:45 +0000 (+0000) Subject: moved all available comments to the .h files. Added parameters names as I X-Git-Tag: release-0.50~123 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a50ed3d7b56b0ffa25c3de03ce5c3edc0d4e4fea;p=thirdparty%2Fldns.git moved all available comments to the .h files. Added parameters names as I went along. Not every function has been commented, but we're almost there --- diff --git a/keys.c b/keys.c index 55f2deb4..db33c075 100644 --- a/keys.c +++ b/keys.c @@ -238,12 +238,6 @@ ldns_key_list_set_key_count(ldns_key_list *key, size_t count) key->_key_count = count; } -/** - * Pushes a key to a keylist - * \param[in] key_list the key_list to push to - * \param[in] key the key to push - * \return false on error, otherwise true - */ bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key) { @@ -267,11 +261,6 @@ ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key) return true; } -/** - * Pops the last rr from a keylist - * \param[in] key_list the rr_list to pop from - * \return NULL if nothing to pop. Otherwise the popped RR - */ ldns_key * ldns_key_list_pop_key(ldns_key_list *key_list) { diff --git a/ldns/dnssec.h b/ldns/dnssec.h index b8f6f843..9e4e382c 100644 --- a/ldns/dnssec.h +++ b/ldns/dnssec.h @@ -104,6 +104,7 @@ ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char * */ ldns_rr *ldns_key_rr2ds(const ldns_rr *key); +/* sign functions - these are very much a work in progress */ ldns_rr_list * ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys); ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key); ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key); diff --git a/ldns/keys.h b/ldns/keys.h index e1ee955e..1cb4bcec 100644 --- a/ldns/keys.h +++ b/ldns/keys.h @@ -84,8 +84,13 @@ struct ldns_struct_key_list }; typedef struct ldns_struct_key_list ldns_key_list; + +/* creator functions */ ldns_key_list * ldns_key_list_new(); ldns_key *ldns_key_new(); +ldns_key * ldns_key_new_frm_algorithm(ldns_signing_algorithm a, uint16_t size); + +/* acces write functions */ void ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l); void ldns_key_set_rsa_key(ldns_key *k, RSA *r); void ldns_key_set_dsa_key(ldns_key *k, DSA *d); @@ -96,23 +101,35 @@ void ldns_key_set_expiration(ldns_key *k, uint32_t e); void ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r); void ldns_key_set_keytag(ldns_key *k, uint16_t tag); void ldns_key_set_flags(ldns_key *k, uint16_t flags); +void ldns_key_list_set_key_count(ldns_key_list *key, size_t count); + +/** + * Pushes a key to a keylist + * \param[in] key_list the key_list to push to + * \param[in] key the key to push + * \return false on error, otherwise true + */ +bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key); + +/* access read functions */ size_t ldns_key_list_key_count(ldns_key_list *key_list); ldns_key * ldns_key_list_key(ldns_key_list *key, size_t nr); - -ldns_signing_algorithm ldns_key_algorithm(ldns_key *k); RSA * ldns_key_rsa_key(ldns_key *k); DSA * ldns_key_dsa_key(ldns_key *k); +ldns_signing_algorithm ldns_key_algorithm(ldns_key *k); unsigned char * ldns_key_hmac_key(ldns_key *k); uint32_t ldns_key_origttl(ldns_key *k); uint32_t ldns_key_inception(ldns_key *k); uint32_t ldns_key_expiration(ldns_key *k); uint16_t ldns_key_keytag(ldns_key *k); -void ldns_key_list_set_key_count(ldns_key_list *key, size_t count); ldns_rdf * ldns_key_pubkey_owner(ldns_key *k); -bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key); -ldns_key * ldns_key_list_pop_key(ldns_key_list *key_list); -ldns_key * ldns_key_new_frm_algorithm(ldns_signing_algorithm a, uint16_t size); +/** + * Pops the last rr from a keylist + * \param[in] key_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + */ +ldns_key * ldns_key_list_pop_key(ldns_key_list *key_list); ldns_rr * ldns_key2rr(ldns_key *k); uint16_t ldns_key_flags(ldns_key *k); diff --git a/ldns/net.h b/ldns/net.h index b3f3a961..e214a8ce 100644 --- a/ldns/net.h +++ b/ldns/net.h @@ -24,12 +24,42 @@ #define LDNS_DEFAULT_TIMEOUT_USEC 0 -/* prototypes */ -uint8_t * ldns_send_udp(ldns_buffer *, const struct sockaddr_storage *, socklen_t, struct timeval timeout, size_t *); -uint8_t * ldns_send_tcp(ldns_buffer *, const struct sockaddr_storage *, socklen_t, struct timeval timeout, size_t *); -ldns_pkt * ldns_send(ldns_resolver *, ldns_pkt *); +/** + * Sends a buffer to an ip using udp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \return a packet with the answer + */ +uint8_t * ldns_send_udp(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Sends a buffer to an ip using tcp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \return a packet with the answer + */ +uint8_t * ldns_send_tcp(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); +/** + * Sends ptk to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * \param[in] r the resolver to use + * \param[in] query_pkt the query to send + * \return the pkt received from the nameserver + */ +ldns_pkt * ldns_send(ldns_resolver *r, ldns_pkt *query_pkt); + +/** + * Create a tcp socket to the specified address + */ int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size); diff --git a/ldns/parse.h b/ldns/parse.h index b4c43912..641a8946 100644 --- a/ldns/parse.h +++ b/ldns/parse.h @@ -80,9 +80,4 @@ void ldns_bskipcs(ldns_buffer *buffer, const char *s); */ void ldns_fskipcs(FILE *fp, const char *s); - - - - - #endif /* _PARSE_H */ diff --git a/ldns/resolver.h b/ldns/resolver.h index 35e5c9a0..a59a0cb8 100644 --- a/ldns/resolver.h +++ b/ldns/resolver.h @@ -99,22 +99,34 @@ struct ldns_struct_resolver typedef struct ldns_struct_resolver ldns_resolver; /* prototypes */ +/* read access functions */ uint16_t ldns_resolver_port(ldns_resolver *); -/* ldns_rr_list * ldns_resolver_nameservers(ldns_resolver *) pop>? */ +uint8_t ldns_resolver_retry(ldns_resolver *); +uint8_t ldns_resolver_retrans(ldns_resolver *); +uint8_t ldns_resolver_ip6(ldns_resolver *); +uint16_t ldns_resolver_edns_udp_size(ldns_resolver *); bool ldns_resolver_recursive(ldns_resolver *); bool ldns_resolver_debug(ldns_resolver *); bool ldns_resolver_usevc(ldns_resolver *); bool ldns_resolver_fail(ldns_resolver *); bool ldns_resolver_dnssec(ldns_resolver *); bool ldns_resolver_igntc(ldns_resolver *r); - size_t ldns_resolver_nameserver_count(ldns_resolver *); - ldns_rdf * ldns_resolver_domain(ldns_resolver *); struct timeval ldns_resolver_timeout(ldns_resolver *); ldns_rdf ** ldns_resolver_searchlist(ldns_resolver *); ldns_rdf ** ldns_resolver_nameservers(ldns_resolver *); +char *ldns_resolver_tsig_keyname(ldns_resolver *r); +char *ldns_resolver_tsig_algorithm(ldns_resolver *r); +char *ldns_resolver_tsig_keydata(ldns_resolver *r); +/** + * pop the last nameserver from the resolver. + * \param[in] r the resolver + * \return the popped address or NULL if empty + */ +ldns_rdf * ldns_resolver_pop_nameserver(ldns_resolver *); +/* write access function */ void ldns_resolver_set_port(ldns_resolver *, uint16_t); void ldns_resolver_set_recursive(ldns_resolver *, bool); void ldns_resolver_set_debug(ldns_resolver *, bool); @@ -122,35 +134,9 @@ void ldns_resolver_incr_nameserver_count(ldns_resolver *); void ldns_resolver_dec_nameserver_count(ldns_resolver *); void ldns_resolver_set_nameserver_count(ldns_resolver *, size_t); void ldns_resolver_set_nameservers(ldns_resolver *, ldns_rdf **); - void ldns_resolver_set_domain(ldns_resolver *, ldns_rdf *); void ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout); void ldns_resolver_push_searchlist(ldns_resolver *, ldns_rdf *); -ldns_rdf * ldns_resolver_pop_nameserver(ldns_resolver *); -ldns_status ldns_resolver_push_nameserver(ldns_resolver *, ldns_rdf *); -ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *, ldns_rr *); -ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *, ldns_rr_list *); - -uint8_t ldns_resolver_retry(ldns_resolver *); -uint8_t ldns_resolver_retrans(ldns_resolver *); -uint8_t ldns_resolver_ip6(ldns_resolver *); -uint16_t ldns_resolver_edns_udp_size(ldns_resolver *); - -char *ldns_resolver_tsig_keyname(ldns_resolver *r); -char *ldns_resolver_tsig_algorithm(ldns_resolver *r); -char *ldns_resolver_tsig_keydata(ldns_resolver *r); - - - - -int ldns_resolver_bgsend(); -ldns_pkt * ldns_resolver_send(ldns_resolver *, ldns_rdf*, ldns_rr_type, ldns_rr_class, uint16_t); -ldns_pkt * ldns_resolver_query(ldns_resolver *, ldns_rdf*, ldns_rr_type, ldns_rr_class, uint16_t); -ldns_pkt * ldns_resolver_search(ldns_resolver *, ldns_rdf*, ldns_rr_type, ldns_rr_class, uint16_t); - -ldns_resolver *ldns_resolver_new(void); -ldns_resolver *ldns_resolver_new_frm_file(const char *); -void ldns_resolver_free(ldns_resolver *); void ldns_resolver_set_defnames(ldns_resolver *, bool); void ldns_resolver_set_usevc(ldns_resolver *, bool); void ldns_resolver_set_dnsrch(ldns_resolver *, bool); @@ -166,11 +152,107 @@ void ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm); void ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata); +/** + * push a new nameserver to the resolver. It must be an IP + * address v4 or v6. + * \param[in] r the resolver + * \param[in] n the ip address + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver(ldns_resolver *, ldns_rdf *); + +/** + * push a new nameserver to the resolver. It must be an + * A or AAAA RR record type + * \param[in] r the resolver + * \param[in] rr the resource record + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *, ldns_rr *); + +/** + * push a new nameserver rr_list to the resolver. + * \param[in] r the resolver + * \param[in] rrlist the rr_list to push + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *, ldns_rr_list *); + +/** + * send the query as-is. but return a socket + * \todo TODO + */ +int ldns_resolver_bgsend(); + +/* no comment found */ +ldns_pkt * ldns_resolver_search(ldns_resolver *, ldns_rdf*, ldns_rr_type, ldns_rr_class, uint16_t); + +/** + * \brief Send the query for *name as-is + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] *type query for this type (may be 0, defaults to A) + * \param[in] *class query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_pkt * ldns_resolver_send(ldns_resolver *, ldns_rdf*, ldns_rr_type, ldns_rr_class, uint16_t); + +/** + * Send a qeury to a nameserver + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] *type query for this type (may be 0, defaults to A) + * \param[in] *class query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + * if _defnames is true the default domain will be added + */ +ldns_pkt * ldns_resolver_query(ldns_resolver *, ldns_rdf*, ldns_rr_type, ldns_rr_class, uint16_t); + + +/** + * \brief create a new resolver structure + * \return ldns_resolver* pointer to new strcture + */ +ldns_resolver *ldns_resolver_new(void); + +/** + * Create a resolver structure from a file like /etc/resolv.conf + * \param[in] fp file pointer to create new resolver from + * if NULL use /etc/resolv.conf + * \return ldns_resolver structure + */ +ldns_resolver * ldns_resolver_new_frm_fp(FILE *fp); + +/** + * configure a resolver by means of a resolv.conf file + * The file may be NULL in which case there will be + * looked the RESOLV_CONF (defaults to /etc/resolv.conf + * \param[in] filename the filename to use + * \return ldns_resolver pointer + */ +/* keyword recognized: + * nameserver + * domain + */ +ldns_resolver *ldns_resolver_new_frm_file(const char *); + +/** + * Frees the allocated space for this resolver and all it's data + * \param res resolver to free + */ +void ldns_resolver_free(ldns_resolver *); + /** * Prepares the resolver for an axfr query * The query is sent and the answers can be read with ldns_axfr_next */ ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class); + +/** + * get the next stream of RRs in a AXFR + */ ldns_rr *ldns_axfr_next(ldns_resolver *resolver); #endif /* !_LDNS_RESOLVER_H */ diff --git a/ldns/rr_functions.h b/ldns/rr_functions.h index 5736d015..e748b9ea 100644 --- a/ldns/rr_functions.h +++ b/ldns/rr_functions.h @@ -13,6 +13,12 @@ #ifndef _RR_FUNCTIONS_H #define _RR_FUNCTIONS_H + +/* set rdf's at a specific offset + * The RR need to be created with ldns_rr_new_frm_type which + * allocated enough space for all rdf's and sets them to NULL + */ + /* A/AAAA */ ldns_rdf * ldns_rr_address(ldns_rr *r); bool ldns_rr_set_address(ldns_rr *r, ldns_rdf *f); diff --git a/ldns/str2host.h b/ldns/str2host.h index 37eee9b4..f48dd312 100644 --- a/ldns/str2host.h +++ b/ldns/str2host.h @@ -10,29 +10,196 @@ #include #include -ldns_status ldns_str2rdf_int8(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_int16(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_int32(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_time(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_period(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_a(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_aaaa(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_str(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_apl(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_b64(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_hex(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_nsec(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_type(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_class(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_cert(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_alg(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_unknown(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_tsig(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_service(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_loc(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_wks(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_nsap(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_nsap(ldns_rdf **, const char *); -ldns_status ldns_str2rdf_dname(ldns_rdf **, const char *); +/** + * convert a byte into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] bytestr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *str); + +/** + * convert a string to a int16 in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] shortstr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *str); + +/** + * convert a strings into a 4 byte int in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] longstr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *str); + +/** + * convert a time string to a time value in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] time the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *str); + +/* convert a time period (think TTL's) to wireformat) + * \param[in] + * \param[in] + * return ldns_status + */ +ldns_status ldns_str2rdf_period(ldns_rdf **rd, const char *str); + +/** + * convert str with an A record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str); + +/** + * convert the str with an AAAA record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str); + +/** + * convert a string into wireformat (think txt record) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted (NULL terminated) + * \return ldns_status + */ +ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str); + +/** + * convert str with the apl record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str); + +/** + * convert the string with the b64 data into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str); + +/** + * convert a hex value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str); + +/** + * convert string with nsec into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str); + +/** + * convert a rrtype into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str); + +/** + * convert string with a classname into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str); + +/** + * convert string with a CERT RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_cert(ldns_rdf **rd, const char *str); + +/** + * convert and algorithm value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str); + +/** + * convert a string with a unknown RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str); + +/** + * convert string with a tsig? RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str); + +/** + * convert string with a protocol service into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str); + +/** + * convert a string with a LOC RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str); + +/** + * convert string with a WKS RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str); + +/** + * convert a str with a NSAP RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + * \todo TODO + */ +ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str); + +/** + * convert a dname string into wireformat + * \param[in] d the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); #endif /* _LDNS_2HOST_H */ diff --git a/net.c b/net.c index 9110b0fb..95b0e5ad 100644 --- a/net.c +++ b/net.c @@ -24,14 +24,6 @@ #include "util.h" - -/** - * Sends ptk to the nameserver at the resolver object. Returns the data - * as a ldns_pkt - * \param[in] r the resolver to use - * \param[in] query_pkt the query to send - * \return the pkt received from the nameserver - */ ldns_pkt * ldns_send(ldns_resolver *r, ldns_pkt *query_pkt) { @@ -152,14 +144,6 @@ ldns_send(ldns_resolver *r, ldns_pkt *query_pkt) return reply; } -/** - * Sends a buffer to an ip using udp and return the respons as a ldns_pkt - * \param[in] qbin the ldns_buffer to be send - * \param[in] to the ip addr to send to - * \param[in] tolen length of the ip addr - * \param[in] timeout the timeout value for the network - * \return a packet with the answer - */ uint8_t * ldns_send_udp(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answer_size) { @@ -229,9 +213,6 @@ ldns_send_udp(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t to return answer; } -/** - * Create a tcp socket to the specified address - */ int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) { @@ -258,7 +239,6 @@ ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct time return sockfd; } - ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen) { @@ -335,14 +315,6 @@ ldns_tcp_read_wire(int sockfd, size_t *size) return wire; } -/** - * Send a buffer to an ip using tcp and return the respons as a ldns_pkt - * \param[in] qbin the ldns_buffer to be send - * \param[in] to the ip addr to send to - * \param[in] tolen length of the ip addr - * \param[in] timeout the timeout value for the network - * \return a packet with the answer - */ /* keep in mind that in DNS tcp messages the first 2 bytes signal the * amount data to expect */ @@ -368,4 +340,3 @@ ldns_send_tcp(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t to return answer; } - diff --git a/parse.c b/parse.c index c26af719..aa80d667 100644 --- a/parse.c +++ b/parse.c @@ -290,10 +290,6 @@ ldns_str_remove_comment(char *str) return str2; } -/* fast forwards the buffer, skipping the given char, setting the - * buffer position to the location of the first different char - * (or to the end of the buffer) - */ void ldns_bskipc(ldns_buffer *buffer, char c) { @@ -306,10 +302,6 @@ ldns_bskipc(ldns_buffer *buffer, char c) } } -/* fast forwards the buffer, skipping all chars in the given string, - * setting the buffer position to the first char that is not contained - * in the string (or to the end of the buffer) - */ void ldns_bskipcs(ldns_buffer *buffer, const char *s) { diff --git a/resolver.c b/resolver.c index 988386bc..32dfe95a 100644 --- a/resolver.c +++ b/resolver.c @@ -158,11 +158,6 @@ ldns_resolver_set_port(ldns_resolver *r, uint16_t p) r->_port = p; } -/** - * pop the last nameserver from the resolver. - * \param[in] r the resolver - * \return the popped address or NULL if empty - */ ldns_rdf * ldns_resolver_pop_nameserver(ldns_resolver *r) { @@ -191,13 +186,6 @@ ldns_resolver_pop_nameserver(ldns_resolver *r) return pop; } -/** - * push a new nameserver to the resolver. It must be an IP - * address v4 or v6. - * \param[in] r the resolver - * \param[in] n the ip address - * \return ldns_status a status - */ ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n) { @@ -224,13 +212,6 @@ ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n) return LDNS_STATUS_OK; } -/** - * push a new nameserver to the resolver. It must be an - * A or AAAA RR record type - * \param[in] r the resolver - * \param[in] rr the resource record - * \return ldns_status a status - */ ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr) { @@ -243,12 +224,6 @@ ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr) return ldns_resolver_push_nameserver(r, address); } -/** - * push a new nameserver rr_list to the resolver. - * \param[in] r the resolver - * \param[in] rrlist the rr_list to push - * \return ldns_status a status - */ ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist) { @@ -421,11 +396,6 @@ ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata) } /* more sophisticated functions */ - -/** - * \brief create a new resolver structure - * \return ldns_resolver* pointer to new strcture - */ ldns_resolver * ldns_resolver_new(void) { @@ -550,20 +520,6 @@ ldns_resolver_new_frm_fp(FILE *fp) return r; } - - - -/** - * configure a resolver by means of a resolv.conf file - * The file may be NULL in which case there will be - * looked the RESOLV_CONF (defaults to /etc/resolv.conf - * \param[in] filename the filename to use - * \return ldns_resolver pointer - */ -/* keyword recognized: - * nameserver - * domain - */ ldns_resolver * ldns_resolver_new_frm_file(const char *filename) { @@ -587,12 +543,6 @@ ldns_resolver_new_frm_file(const char *filename) return r; } - -/** - * Frees the allocated space for this resolver and all it's data - * - * \param res resolver to free - */ void ldns_resolver_free(ldns_resolver *res) { @@ -634,16 +584,6 @@ ldns_resolver_search(ldns_resolver *r, ldns_rdf *name, ldns_rr_type type, } #endif -/** - * Send a qeury to a nameserver - * \param[in] *r operate using this resolver - * \param[in] *name query for this name - * \param[in] *type query for this type (may be 0, defaults to A) - * \param[in] *class query for this class (may be 0, default to IN) - * \param[in] flags the query flags - * \return ldns_pkt* a packet with the reply from the nameserver - * if _defnames is true the default domain will be added - */ ldns_pkt * ldns_resolver_query(ldns_resolver *r, ldns_rdf *name, ldns_rr_type type, ldns_rr_class class, uint16_t flags) @@ -668,15 +608,6 @@ ldns_resolver_query(ldns_resolver *r, ldns_rdf *name, ldns_rr_type type, ldns_rr return pkt; } -/** - * \brief Send the query for *name as-is - * \param[in] *r operate using this resolver - * \param[in] *name query for this name - * \param[in] *type query for this type (may be 0, defaults to A) - * \param[in] *class query for this class (may be 0, default to IN) - * \param[in] flags the query flags - * \return ldns_pkt* a packet with the reply from the nameserver - */ ldns_pkt * ldns_resolver_send(ldns_resolver *r, ldns_rdf *name, ldns_rr_type type, ldns_rr_class class, uint16_t flags) @@ -772,16 +703,12 @@ ldns_resolver_send(ldns_resolver *r, ldns_rdf *name, ldns_rr_type type, ldns_rr_ return answer_pkt; } -/* send the query as-is. but return a socket */ int ldns_resolver_bgsend() { return 0; } - -/* - * Start an axfr, send the query and keep the connection open - */ + ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, @@ -922,11 +849,3 @@ ldns_axfr_next(ldns_resolver *resolver) } } - -#if 0 -/* print a resolver state to fp */ -void -ldns_resolver_print(FILE *fp, ldns_resolver *res) -{ -} -#endif diff --git a/str2host.c b/str2host.c index fb9b8d95..b62c81c9 100644 --- a/str2host.c +++ b/str2host.c @@ -28,12 +28,6 @@ #include #endif -/** - * convert a string to a int16 in wireformat - * \param[in] rd the rdf where to put the data - * \param[in] shortstr the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr) { @@ -54,12 +48,6 @@ ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr) } } -/** - * convert a time string to a time value in wireformat - * \param[in] rd the rdf where to put the data - * \param[in] time the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *time) { @@ -95,7 +83,6 @@ ldns_str2rdf_time(ldns_rdf **rd, const char *time) } } -/* convert a time period (think TTL's) to wireformat) */ ldns_status ldns_str2rdf_period(ldns_rdf **rd,const char *period) { @@ -115,12 +102,6 @@ ldns_str2rdf_period(ldns_rdf **rd,const char *period) return LDNS_STATUS_OK; } -/** - * convert a strings into a 4 byte int in wireformat - * \param[in] rd the rdf where to put the data - * \param[in] longstr the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr) { @@ -143,12 +124,6 @@ ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr) } } -/** - * convert a byte into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] bytestr the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr) { @@ -171,14 +146,8 @@ ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr) } /** - * convert a dname string into wireformat - * \param[in] d the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - * * No special care is taken, all dots are translated into * label seperators. - * * \todo make this more efficient... * we do 3 memcpy's in total... * label_chars2 is used for debugging. TODO: remove @@ -270,12 +239,6 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) return LDNS_STATUS_OK; } -/** - * convert str with an A record into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str) { @@ -289,12 +252,6 @@ ldns_str2rdf_a(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str) { @@ -309,12 +266,6 @@ ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert a string into wireformat (think txt record) - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted (NULL terminated) - * \return ldns_status - */ ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str) { @@ -325,12 +276,6 @@ ldns_str2rdf_str(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str) { @@ -339,12 +284,6 @@ ldns_str2rdf_apl(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str) { @@ -356,7 +295,6 @@ ldns_str2rdf_b64(ldns_rdf **rd, const char *str) i = (uint16_t) b64_pton((const char*)str, buffer, b64_ntop_calculate_size(strlen(str))); if (-1 == i) { - /* todo: remove print */ return LDNS_STATUS_INVALID_B64; } else { *rd = ldns_rdf_new_frm_data( @@ -367,12 +305,6 @@ ldns_str2rdf_b64(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert a hex value into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str) { @@ -407,12 +339,6 @@ ldns_str2rdf_hex(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str) { @@ -421,12 +347,6 @@ ldns_str2rdf_nsec(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert a rrtype into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str) { @@ -438,12 +358,6 @@ ldns_str2rdf_type(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str) { @@ -455,12 +369,6 @@ ldns_str2rdf_class(ldns_rdf **rd, const char *str) return LDNS_STATUS_OK; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_cert(ldns_rdf **rd, const char *str) { @@ -469,12 +377,6 @@ ldns_str2rdf_cert(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert and algorithm value into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ /* An alg field can either be specified as a 8 bits number * or by its symbolic name. Handle both */ @@ -501,10 +403,6 @@ ldns_str2rdf_alg(ldns_rdf **rd, const char *str) return st; } -/** - * convert .... into wireformat - * \return ldns_status - */ ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str) { @@ -513,12 +411,6 @@ ldns_str2rdf_unknown(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str) { @@ -527,12 +419,6 @@ ldns_str2rdf_tsig(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str) { @@ -541,12 +427,6 @@ ldns_str2rdf_service(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str) { @@ -555,10 +435,6 @@ ldns_str2rdf_loc(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert .... into wireformat - * \return ldns_status - */ ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str) { @@ -567,12 +443,6 @@ ldns_str2rdf_wks(ldns_rdf **rd, const char *str) return LDNS_STATUS_NOT_IMPL; } -/** - * convert .... into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str) { @@ -580,6 +450,3 @@ ldns_str2rdf_nsap(ldns_rdf **rd, const char *str) str = str; return LDNS_STATUS_NOT_IMPL; } - - -