work in progress - works for RSA/DSA. I want to
fold in the tsig stuff as well
o install mx, keygen, chaos somewhere, along with manpages??
+o All lookup table stuff in _table types?
#include <ldns/common.h>
#include <ldns/buffer.h>
-
#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 LDNS_MAX_LINELEN 512
#define LDNS_MAX_KEYWORDLEN 32
+/**
+ * different type of directives in zone files
+ * We now deal with $TTL, $ORIGIN and $INCLUDE.
+ * The latter is not implemented in ldns (yet)
+ */
+enum ldns_enum_directive
+{
+ LDNS_DIR_TTL,
+ LDNS_DIR_ORIGIN,
+ LDNS_DIR_INCLUDE
+};
+typedef enum ldns_enum_directive ldns_directive;
+
/**
* returns a token/char from the stream F.
* This function deals with ( and ) in the stream,
*/
bool ldns_zone_rr_is_glue(ldns_zone *z, ldns_rr *rr);
+
+ldns_zone *
+ldns_zone_new_frm_fp(FILE *fp, ldns_rdf **origin, uint16_t *ttl, ldns_rr_class *c);
+
#endif /* LDNS_ZONE_H */
* See the file LICENSE for the license
*/
#include <ldns/config.h>
-
#include <ldns/dns.h>
-
#include <limits.h>
#include <strings.h>
+ldns_lookup_table ldns_directive_types[] = {
+ { LDNS_DIR_TTL, "$TTL" },
+ { LDNS_DIR_ORIGIN, "$ORIGIN" },
+ { LDNS_DIR_INCLUDE, "$INCLUDE" },
+ { 0, NULL }
+};
+
ssize_t
ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data,
const char *d_del, size_t data_limit)
return (ssize_t)i;
}
-#if 0
-# not needed anymore
-
-char *
-ldns_str_remove_comment(char *str)
-{
- char *s;
- int comment;
- char *str2;
-
- comment = 0;
- str2 = strdup(str);
-
- for(s = str2; *s; s++) {
- if (*s == ';') {
- comment = 1;
- }
- if (*s == '\n') {
- *s = ' ';
- comment = 0;
- }
- if (comment == 1) {
- *s = ' ';
- }
- }
- return str2;
-}
-#endif
-
void
ldns_bskipc(ldns_buffer *buffer, char c)
{
}
}
}
+
+ldns_directive
+ldns_directive_new_frm_str(const char *str, void **arg)
+{
+ str = str;
+ arg = arg;
+ /* directive<SPACE>arguments */
+ return LDNS_DIR_TTL;
+}
;
; BIND data file for miek.nl for internal use
;
-$TTL 1H
+$TTL 2H
@ IN SOA elektron.atoom.net. miekg.atoom.net. (
2005060700 ; Serial
6H ; Refresh
@ IN MX 10 elektron.atoom.net.
@ IN A 192.168.1.2
-a IN A 192.168.1.2
-www IN CNAME a
+god IN A 192.168.1.2
+
+
+sub.domain.miek.nl IN NS elektron.atoom.net.
+ IN MX 10 elektron.atoom.net.
+
+www IN CNAME god
return false;
}
+/* we don't want state, so we have to give it as arguments */
+/* we regocnize:
+ * $TTL, $ORIGIN
+ */
+ldns_zone *
+ldns_zone_new_frm_fp(FILE *fp, ldns_rdf **origin, uint16_t *ttl, ldns_rr_class *c)
+{
+#if 0
+ ldns_zone *newzone;
+ ldns_rr *rr;
+#endif
+
+ /* read until we got a soa, all crap above is discarded
+ * except $directives
+ */
+
+ fp = fp;
+ origin = origin;
+ ttl = ttl;
+ c = c;
+
+ /* re-order stuff with rrsets */
+ return NULL;
+}
#if 0
/**