]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
compiles. Header files tweaks - more groundwork
authorMiek Gieben <miekg@NLnetLabs.nl>
Tue, 7 Dec 2004 10:55:30 +0000 (10:55 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Tue, 7 Dec 2004 10:55:30 +0000 (10:55 +0000)
Makefile
main.c
prototype.h
rdata.c
rdata.h
util.c

index 74fecf0b4b4850654221ac05631405442e61b88c..06b03dca15400e2d8913905b7685fa825301ba08 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,5 +10,11 @@ LINK         = $(CC) $(CFLAGS) $(LDFLAGS)
 %.o:   %.c $(HEADER)
        $(CC) $(CFLAGS) -c $<
 
+.PHONY:        clean
+
 main:  main.o $(LIBOBJ)
        $(LINK) -o $@ main.o $(LIBOBJ)
+
+clean: 
+       rm -f *.o
+       rm -f main
diff --git a/main.c b/main.c
index 21880272c72744a40d85a7cf2852b4f43096a34e..18133a15191f2be6041f445ae8653c02019058d3 100644 (file)
--- a/main.c
+++ b/main.c
@@ -5,11 +5,15 @@
 
 #include <stdio.h>
 
-#include "rdata.h"
+#include "prototype.h"
 
 int
 main(void)
 {
+       rdata_t *new;
+       printf("size %u\n", sizeof(struct struct_rdata_t));
+       new = rd_new(20, RD_DNAME_T, (uint8_t*)"hallo.nl");
+
        printf("Hallo\n");
-       return(0);
+       return 0;
 }
index 2a8837e467f2ffd8f3ab4a74e0f76c9beed45cfe..18053926e25828b9f289f666917ed249e36ddf56 100644 (file)
 #include <stdint.h>
 #include <stdlib.h>
 
+#include "rdata.h"
 /* util.c */
-void * xmalloc(size_t);
+void           *xmalloc(size_t);
+
+/* rdata.c */
+uint16_t       rd_size(rdata_t *);
+uint8_t        *rd_data(rdata_t *);
+void           rd_set_size(rdata_t *, uint16_t);
+void           rd_set_type(rdata_t *, rd_type_t);
+void           rd_set_data(rdata_t *, uint8_t *);
+rd_type_t      rd_type(rdata_t *);
+rdata_t        *rd_new(uint16_t, rd_type_t, uint8_t *);
diff --git a/rdata.c b/rdata.c
index 8e5eccf89eec85a1ed77eb97bffe6931da21404f..8f939153feb17713b9e023c392a94b699fc3e6cd 100644 (file)
--- a/rdata.c
+++ b/rdata.c
@@ -13,7 +13,6 @@
 #include <stdint.h>
 
 #include "prototype.h"
-#include "rdata.h"
 
 /* Access functions 
  * do this as functions to get type checking
diff --git a/rdata.h b/rdata.h
index 52be1acc38453b3135d396bb546cb4fdfe8d2ab0..9e2cf6ec559b3bcce218ff9fe276805486ef443f 100644 (file)
--- a/rdata.h
+++ b/rdata.h
@@ -27,7 +27,11 @@ enum enum_rdata_type {
        RD_TYPE_T,      /* a RR type */
        RD_CLASS_T,     /* a class */
        RD_CERT_T,      /* certificates */
-       RD_ALG_T        /* a key algorithm */
+       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 */
 };
 typedef enum enum_rdata_type rd_type_t;
 
@@ -39,9 +43,9 @@ typedef enum enum_rdata_type rd_type_t;
  * data = network order, expanded (no compression)
  */
 
-struct {
+struct struct_rdata_t {
        uint16_t _size;
        rd_type_t _type;
        uint8_t  *_data;
-} struct_rdata_t;
+};
 typedef struct struct_rdata_t rdata_t;
diff --git a/util.c b/util.c
index 31f03d91e6596ab97849ff15ce231548e8e93fe9..3e76310c7c46022bd6f75b48d36d1d997fa404bd 100644 (file)
--- a/util.c
+++ b/util.c
@@ -10,6 +10,9 @@
  * See the file LICENSE for the license
  */
 
+#include <stdint.h>
+#include <stdlib.h>
+
 void *
 xmalloc(size_t s)
 {