LIBDNS_OBJECTS = $(LIBDNS_SOURCES:.c=.o)
-TEST_SOURCES = run-test0.c run-test1.c run-test2.c run-test3.c \
- run-test4.c run-test5.c run-test6.c run-test7.c \
- run-test8.c run-test9.c run-test10.c run-test11.c \
- run-test13.c run-test14.c run-test15.c run-test16.c \
- run-test17.c run-test18.c
+TEST_SOURCES = run-test7.c run-test11.c run-test18.c
#ALL_SOURCES = $(TEST_SOURCES) $(LIBDNS_SOURCES) $(PROG_SOURCES)
ALL_SOURCES = $(LIBDNS_SOURCES) $(PROG_SOURCES)
# tests
-run-test0: run-test0.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test1: run-test1.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test2: run-test2.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test3: run-test3.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test4: run-test4.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test5: run-test5.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test6: run-test6.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
run-test7: run-test7.o $(LIBDNS_OBJECTS) $(LIBOBJS)
$(LINK) ${LIBS} -o $@ $+
-run-test8: run-test8.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test9: run-test9.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test10: run-test10.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
run-test11: run-test11.o $(LIBDNS_OBJECTS) $(LIBOBJS)
$(LINK) ${LIBS} -o $@ $+
-run-test12: run-test12.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) -lpcap ${LIBS} -o $@ $+
-run-test13: run-test13.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test14: run-test14.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test15: run-test15.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test16: run-test16.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
-run-test17: run-test17.o $(LIBDNS_OBJECTS) $(LIBOBJS)
- $(LINK) ${LIBS} -o $@ $+
run-test18: run-test18.o $(LIBDNS_OBJECTS) $(LIBOBJS)
$(LINK) ${LIBS} -o $@ $+
rm -rf doc/man/
rm -rf doc/latex/
-test0: run-test0
- ./run-test0
-test1: run-test1
- ./run-test1
-test2: run-test2
- ./run-test2
-test3: run-test3
- ./run-test3
-test4: run-test4
- ./run-test4
-test5: run-test5
- ./run-test5
-test6: run-test6
- ./run-test6
test7: run-test7
./run-test7
-test8: run-test8
- ./run-test8
-test9: run-test9
- ./run-test9
-test10: run-test10
- ./run-test10
test11: run-test11
./run-test11
-test12: run-test12
- ./run-test11
-test13: run-test13
- ./run-test11
-test14: run-test14
- ./run-test11
-test15: run-test15
- ./run-test15
-test16: run-test16
- ./run-test16
-test17: run-test17
- ./run-test17
test18: run-test18
./run-test18
-test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
- test13 test14 test15 test16 test17 test18
+test: test7 test11 test18
## No need for changes here
--- /dev/null
+/*
+ * test main.c
+ *
+ */
+
+#include <config.h>
+
+
+#include <ldns/ldns.h>
+
+#include "util.h"
+
+/*
+ 0xc2, 0xb4, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
+ 0x00, 0x02, 0x00, 0x02, 0x03, 0x77, 0x77, 0x77,
+ 0x0b, 0x6b, 0x61, 0x6e, 0x61, 0x72, 0x69, 0x65,
+ 0x70, 0x69, 0x65, 0x74, 0x03, 0x63, 0x6f, 0x6d,
+ 0x00, 0x00, 0x01, 0x00, 0x01
+};
+*/
+/*
+static const uint8_t wire[] = {
+ 0xd0, 0x0e, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00,
+ 0x02, 0x03, 0x77, 0x77, 0x77, 0x0b, 0x6b, 0x61, 0x6e, 0x61, 0x72,
+ 0x69, 0x65, 0x70, 0x69, 0x65, 0x74, 0x03, 0x63, 0x6f, 0x6d, 0x00,
+ 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x45, 0xf2, 0x00, 0x04, 0xd5, 0x85, 0x27, 0xcf, 0xc0, 0x10,
+ 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x45, 0xf2, 0x00, 0x11, 0x03,
+ 0x6e, 0x73, 0x32, 0x08, 0x68, 0x65, 0x78, 0x6f, 0x6e, 0x2d, 0x69,
+ 0x73, 0x02, 0x6e, 0x6c, 0x00, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01,
+ 0x00, 0x01, 0x45, 0xf2, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x31, 0xc0,
+ 0x45, 0xc0, 0x5e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xfb, 0x2e,
+ 0x00, 0x04, 0xd5, 0x85, 0x27, 0xcb, 0xc0, 0x41, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x00, 0xfb, 0x2c, 0x00, 0x04, 0xd4, 0xcc, 0xdb, 0x5b
+};
+*/
+static const uint8_t wire[] = {
+0x4c, 0xf2, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x05
+, 0x6a, 0x65, 0x6c, 0x74, 0x65, 0x09, 0x6e,
+0x6c, 0x6e, 0x65, 0x74, 0x6c, 0x61, 0x62, 0x73, 0x02, 0x6e, 0x6c, 0x00, 0x00, 0x0f, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0f,
+0x00, 0x01, 0x00, 0x00, 0x02, 0x54, 0x00, 0x08, 0x00, 0x0a, 0x03, 0x73, 0x6f, 0x6c, 0xc0, 0x12, 0xc0, 0x0c, 0x00, 0x02,
+0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x32, 0xc0, 0x0c, 0xc0, 0x0c, 0x00, 0x02, 0x00, 0x01,
+0x00, 0x00, 0x00, 0x73, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x31, 0xc0, 0x0c, 0xc0, 0x56, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+0x00, 0x73, 0x00, 0x04, 0xc3, 0xa9, 0xd7, 0x9b, 0xc0, 0x44, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x04,
+0xc3, 0xa9, 0xd7, 0x9b
+};
+
+int
+main(void)
+{
+ ldns_rdf *rd_f;
+ ldns_rr *rr;
+ ldns_pkt *packet;
+ ldns_status status;
+ char *rdfstr;
+ uint8_t *rdf_data;
+
+ rr = ldns_rr_new();
+
+ rdf_data = (uint8_t *) XMALLOC(char, MAX_DOMAINLEN);
+ rdf_data[0] = 3;
+ memcpy(rdf_data+1, "www", 3);
+ rdf_data[4] = 4;
+ memcpy(rdf_data+5, "test", 4);
+ rdf_data[9] = 3;
+ memcpy(rdf_data+10, "net", 3);
+ rdf_data[13] = 0;
+ rd_f = ldns_rdf_new(LDNS_RDF_TYPE_DNAME, 20, rdf_data);
+
+ ldns_rr_push_rdf(rr, rd_f);
+ status = ldns_wire2pkt(&packet, wire, sizeof(wire));
+ if (status == LDNS_STATUS_OK) {
+ printf("packet id: %d\n", (int) ldns_pkt_id(packet));
+ printf("qr bit: %d\n", (int) ldns_pkt_qr(packet));
+ printf("opcode: %d\n",(int) ldns_pkt_opcode(packet));
+ printf("aa bit: %d\n",(int) ldns_pkt_aa(packet));
+ printf("tc bit: %d\n",(int) ldns_pkt_tc(packet));
+ printf("rd bit: %d\n",(int) ldns_pkt_rd(packet));
+ printf("cd bit: %d\n",(int) ldns_pkt_cd(packet));
+ printf("ra bit: %d\n",(int) ldns_pkt_ra(packet));
+ printf("ad bit: %d\n",(int) ldns_pkt_ad(packet));
+ printf("rcode: %d\n",(int) ldns_pkt_rcode(packet));
+ printf("qdcount: %d\n",(int) ldns_pkt_qdcount(packet));
+ printf("ancount: %d\n",(int) ldns_pkt_ancount(packet));
+ printf("nscount: %d\n",(int) ldns_pkt_nscount(packet));
+ printf("arcount: %d\n",(int) ldns_pkt_arcount(packet));
+ printf("pkt2str:\n");
+ rdfstr = ldns_pkt2str(packet);
+ if (rdfstr) {
+ printf("%s\n", rdfstr);
+ } else {
+ printf("error\n");
+ }
+ ldns_pkt_free(packet);
+ } else {
+ printf("error in wire2packet: %d\n", status);
+ }
+
+/*
+ printf("host2str:\n");
+ rdfstr = ldns_rdf2str(rr->_rdata_fields[0]);
+ if (rdfstr) {
+ printf("%s\n", rdfstr);
+ } else {
+ printf("error\n");
+ }
+
+ printf("rr2str:\n");
+ rdfstr = ldns_rr2str(rr);
+ if (rdfstr) {
+ printf("%s\n", rdfstr);
+ } else {
+ printf("error\n");
+ }
+
+
+*/
+
+
+ return 0;
+}
+