CFLAGS = -g -Wall -Wwrite-strings -Wunused-value -Wunused-parameter
LIBOBJ=rdata.o util.o
-HEADER=rdata.h prototype.h
+HEADER=rdata.h prototype.h rr.h packet.h
COMPILE = $(CC) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS)
#include <stdio.h>
-#include "prototype.h"
#include "rdata.h"
#include "rr.h"
#include "packet.h"
+#include "prototype.h"
int
main(void)
*
* See the file LICENSE for the license
*/
-#ifndef _PACKET_H
-#define _PACKET_H
+#ifdef _PACKET_H
#else
+#define _PACKET_H
#include <stdint.h>
-#include "prototype.h"
-
-struct struct_packet_type
-{
- header_t *header /* header section */
- rrset_t *question; /* question section */
- rrset_t *answer; /* answer section */
- rrset_t *authority; /* auth section */
- rrset_t *additional; /* add section */
-};
-typedef struct struct_packet_type packet_t;
+#include "rdata.h"
+#include "rr.h"
struct struct_header_type
{
uint8_t acount; /* add sec */
};
typedef struct struct_header_type header_t;
+
+struct struct_packet_type
+{
+ header_t *header; /* header section */
+ rrset_t *question; /* question section */
+ rrset_t *answer; /* answer section */
+ rrset_t *authority; /* auth section */
+ rrset_t *additional; /* add section */
+};
+typedef struct struct_packet_type packet_t;
#endif /* _PACKET_H */
*
* See the file LICENSE for the license
*/
-#ifndef _PROTOTYPE_H
-#define _PROTOTYPE_H
+#ifdef _PROTOTYPE_H
#else
+#define _PROTOTYPE_H
#include <stdint.h>
#include <stdlib.h>
-#ifndef _RDATA_H
-#include "rdata.h"
-#endif /* _RDATA_H */
-#ifndef _RR_H
-#include "rr.h"
-#endif /* _RR_H */
-#ifndef _PACKET_H
-#include "packet.h"
-#endif /* _PACKET_H */
-
/* util.c */
void *xmalloc(size_t);
void xprintf_rd(rdata_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 *, uint16_t);
-rd_type_t rd_type(rdata_t *);
-rdata_t *rd_new(uint16_t, rd_type_t, uint8_t *);
-void rd_destroy(rdata_t *);
-
#endif /* _PROTOTYPE_H */
#include <stdint.h>
#include <string.h>
+#include "rdata.h"
#include "prototype.h"
/* Access functions
*
* See the file LICENSE for the license
*/
-#ifndef _RDATA_H
-#define _RDATA_H
+#ifdef _RDATA_H
#else
+#define _RDATA_H
#include <stdint.h>
uint8_t *_data;
};
typedef struct struct_rdata_t rdata_t;
+
+/* prototypes */
+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 *, uint16_t);
+rd_type_t rd_type(rdata_t *);
+rdata_t *rd_new(uint16_t, rd_type_t, uint8_t *);
+void rd_destroy(rdata_t *);
#endif /* _RDATA_H */
+
*
* See the file LICENSE for the license
*/
-#ifndef _RR_H
-#define _RR_H
+#ifdef _RR_H
#else
+#define _RR_H
#include <stdint.h>
#include <string.h>
-#include "prototype.h"
+#include "rdata.h"
+#include "rr.h"
/* the different RR types */
#define TYPE_A 1 /* a host address */
#include <stdlib.h>
#include <stdio.h>
-#include "prototype.h"
+#include "rdata.h"
+#include "rr.h"
void *
xmalloc(size_t s)