--- /dev/null
+CC = gcc
+CFLAGS = -g -Wall -Wwrite-strings -Wunused-value -Wunused-parameter
+
+LIBOBJ=rdata.o util.o
+HEADER=rdata.h prototype.h
+
+COMPILE = $(CC) $(CFLAGS)
+LINK = $(CC) $(CFLAGS) $(LDFLAGS)
+
+%.o: %.c $(HEADER)
+ $(CC) $(CFLAGS) -c $<
+
+main: main.o $(LIBOBJ)
+ $(LINK) -o $@ main.o $(LIBOBJ)
*
*/
+#include <stdio.h>
+
#include "rdata.h"
int
main(void)
{
-
printf("Hallo\n");
+ return(0);
}
--- /dev/null
+/*
+ * prototype.h
+ *
+ * general prototyps
+ *
+ * a Net::DNS like library for C
+ *
+ * (c) NLnet Labs, 2004
+ *
+ * See the file LICENSE for the license
+ */
+#include <stdint.h>
+#include <stdlib.h>
+
+/* util.c */
+void * xmalloc(size_t);
#include <stdint.h>
+#include "prototype.h"
#include "rdata.h"
/* Access functions
}
void
-rd_type(rdata_t *rd, rd_type_t t)
+rd_set_type(rdata_t *rd, rd_type_t t)
{
rd->_type = t;
}
void
-rd_data(rdata_t *rd, uint8_t *d)
+rd_set_data(rdata_t *rd, uint8_t *d)
{
rd->_data = d;
}
+
+/* allocate a new rdata_t structure
+ * and return it
+ */
+rdata_t *
+rd_new(uint16_t s, rd_type_t t, uint8_t *d)
+{
+ rdata_t *new;
+ new = xmalloc(sizeof(rdata_t));
+
+ if (NULL == new)
+ return NULL;
+
+ rd_set_size(new, s);
+ rd_set_type(new, t);
+ rd_set_data(new, d);
+
+ return(new);
+}
--- /dev/null
+/*
+ * util.c
+ *
+ * some general memory functions
+ *
+ * a Net::DNS like library for C
+ *
+ * (c) NLnet Labs, 2004
+ *
+ * See the file LICENSE for the license
+ */
+
+void *
+xmalloc(size_t s)
+{
+ void *p;
+
+ p = (void*)malloc(s);
+
+ return p;
+}