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)
{
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)
{
*/
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);
};
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);
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);
#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);
*/
void ldns_fskipcs(FILE *fp, const char *s);
-
-
-
-
-
#endif /* _PARSE_H */
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);
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);
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 */
#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);
#include <ldns/buffer.h>
#include <ctype.h>
-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 */
#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)
{
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)
{
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)
{
return sockfd;
}
-
ssize_t
ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen)
{
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
*/
return answer;
}
-
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)
{
}
}
-/* 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)
{
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)
{
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)
{
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)
{
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)
{
}
/* more sophisticated functions */
-
-/**
- * \brief create a new resolver structure
- * \return ldns_resolver* pointer to new strcture
- */
ldns_resolver *
ldns_resolver_new(void)
{
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)
{
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)
{
}
#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)
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)
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,
}
}
-
-#if 0
-/* print a resolver state to fp */
-void
-ldns_resolver_print(FILE *fp, ldns_resolver *res)
-{
-}
-#endif
#include <sys/param.h>
#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)
{
}
}
-/**
- * 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)
{
}
}
-/* convert a time period (think TTL's) to wireformat) */
ldns_status
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)
{
}
}
-/**
- * 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)
{
}
/**
- * 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
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)
{
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)
{
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)
{
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)
{
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)
{
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(
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)
{
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)
{
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)
{
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)
{
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)
{
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
*/
return st;
}
-/**
- * convert .... into wireformat
- * \return ldns_status
- */
ldns_status
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)
{
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)
{
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)
{
return LDNS_STATUS_NOT_IMPL;
}
-/**
- * convert .... into wireformat
- * \return ldns_status
- */
ldns_status
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)
{
str = str;
return LDNS_STATUS_NOT_IMPL;
}
-
-
-