o NSEC generation??
o openssl's setup function (esp. random)
o -lssl in library creation
+o parse on \n segfaults
Implementation:
---------------
}
}
+ (void)ldns_get_rr_list_hosts_frm_file("/etc/hosts");
+
version = ldns_dname_new_frm_str("version.bind");
id = ldns_dname_new_frm_str("hostname.bind");
#include <openssl/ssl.h>
#include <openssl/sha.h>
#include <ldns/higher.h>
+#include <ldns/parse.h>
+#include <ldns/resolver.h>
+
#include "util.h"
ldns_rr_list *
}
return names;
}
+
+ldns_rr_list *
+ldns_get_rr_list_hosts_frm_fp(FILE *fp)
+{
+ ssize_t i;
+ char *word;
+
+
+ for(
+ i = ldns_fget_token(fp, word, LDNS_PARSE_NORMAL, 0);
+ i > 0;
+ i = ldns_fget_token(fp, word, LDNS_PARSE_NORMAL, 0)
+ ) {
+ /* # is comment */
+ if (word[0] == '#') {
+ printf("comment\n");
+ continue;
+ }
+
+ fprintf(stderr, "%d [%s]\n",i ,word);
+ }
+
+
+}
+
+
+ldns_rr_list *
+ldns_get_rr_list_hosts_frm_file(char *filename)
+{
+ ldns_rr_list *names;
+ FILE *fp;
+
+ if (!filename) {
+ fp = fopen(RESOLV_HOSTS, "r");
+
+ } else {
+ fp = fopen(filename, "r");
+ }
+ if (!fp) {
+ return NULL;
+ }
+
+ names = ldns_get_rr_list_hosts_frm_fp(fp);
+ fclose(fp);
+ return names;
+}
ldns_rr_list *
ldns_get_rr_list_name_by_addr(ldns_resolver *r, ldns_rdf *addr, ldns_rr_class c, uint16_t flags);
#endif /* _LDNS_HIGHER_H */
+
+/**
+ * wade through fp (a /etc/hosts like file)
+ * and return a rr_list containing all the
+ * defined hosts in there
+ * \param[in] fp the file pointer to use
+ * \return ldns_rr_list * with the names
+ */
+ldns_rr_list * ldns_get_rr_list_host_frm_fp(FILE *fp);
+
+/**
+ * wade through fp (a /etc/hosts like file)
+ * and return a rr_list containing all the
+ * defined hosts in there
+ * \param[in] filename the filename to use (NULL for /etc/hosts)
+ * \return ldns_rr_list * with the names
+ */
+ldns_rr_list * ldns_get_rr_list_host_frm_file(char *filename);
#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v"
#define LDNS_PARSE_NORMAL " \f\n\r\t\v"
+#define LDNS_PARSE_NO_NL " \t"
#define MAXLINE_LEN 512
#define MAXKEYWORD_LEN 32
/** \brief where to find the resolv.conf file */
#define RESOLV_CONF "/etc/resolv.conf"
+#define RESOLV_HOSTS "/etc/hosts"
#define RESOLV_KEYWORD 0
#define RESOLV_DEFDOMAIN 1