]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
fake event replaces link signture of event handling.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 8 Feb 2007 16:47:06 +0000 (16:47 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 8 Feb 2007 16:47:06 +0000 (16:47 +0000)
git-svn-id: file:///svn/unbound/trunk@83 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
services/listen_dnsport.c
services/outside_network.c
services/outside_network.h
testcode/fake_event.c
util/net_help.c [new file with mode: 0644]
util/net_help.h [new file with mode: 0644]

index d10901e6b81fcfb430b078659d8bc5b4a4526dae..95718a1e573bf83318887ff5bf22c8a5895b062d 100644 (file)
@@ -48,11 +48,11 @@ INSTALL=$(srcdir)/install-sh
 
 COMMON_SRC=$(wildcard services/*.c util/*.c)
 COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.o) $(LIBOBJS))
-UNITTEST_SRC=testcode/unitmain.c
+UNITTEST_SRC=testcode/unitmain.c $(COMMON_SRC)
 UNITTEST_OBJ=$(addprefix $(BUILD),$(UNITTEST_SRC:.c=.o))
-DAEMON_SRC=$(wildcard daemon/*.c)
+DAEMON_SRC=$(wildcard daemon/*.c) $(COMMON_SRC)
 DAEMON_OBJ=$(addprefix $(BUILD),$(DAEMON_SRC:.c=.o))
-TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c daemon/worker.c testcode/replay.c testcode/fake_event.c
+TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c daemon/worker.c testcode/replay.c testcode/fake_event.c $(filter-out util/netevent.c services/listen_dnsport.c services/outside_network.c, $(COMMON_SRC))
 TESTBOUND_OBJ=$(addprefix $(BUILD),$(TESTBOUND_SRC:.c=.o))
 ALL_SRC=$(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) $(TESTBOUND_SRC)
 ALL_OBJ=$(addprefix $(BUILD),$(ALL_SRC:.c=.o) $(LIBOBJS))
@@ -70,15 +70,15 @@ $(BUILD)%.o:    $(srcdir)/%.c
 
 all:   $(COMMON_OBJ) unbound unittest testbound
 
-unbound:       $(COMMON_OBJ) $(DAEMON_OBJ)
+unbound:       $(DAEMON_OBJ)
        $(INFO) Link $@
        $Q$(LINK) -o $@ $^ $(LIBS)
 
-unittest:      $(COMMON_OBJ) $(UNITTEST_OBJ)
+unittest:      $(UNITTEST_OBJ)
        $(INFO) Link $@
        $Q$(LINK) -o $@ $^ $(LIBS)
 
-testbound:     $(COMMON_OBJ) $(TESTBOUND_OBJ)
+testbound:     $(TESTBOUND_OBJ)
        $(INFO) Link $@
        $Q$(LINK) -o $@ $^ $(LIBS)
 
index c72dc6e35a09a0a12142c4a95d002895dcefcc37..a18e84c42791d303c6192514933f41346d3c0d06 100644 (file)
@@ -43,6 +43,7 @@
 #include "services/outside_network.h"
 #include "util/netevent.h"
 #include "util/log.h"
+#include "util/net_help.h"
 
 #ifdef HAVE_SYS_TYPES_H
 #  include <sys/types.h>
index aefad487a1bcbe5f7e1120f61cb32d45e1c65b12..8435f5c2b2c4b8a10504a8244755cedca5bc2be3 100644 (file)
@@ -44,6 +44,7 @@
 #include "services/listen_dnsport.h"
 #include "util/netevent.h"
 #include "util/log.h"
+#include "util/net_help.h"
 
 #ifdef HAVE_SYS_TYPES_H
 #  include <sys/types.h>
@@ -225,15 +226,6 @@ make_udp_range(struct comm_point** coms, const char* ifname,
        return done;
 }
 
-/** returns true is string addr is an ip6 specced address. */
-int 
-str_is_ip6(const char* str)
-{
-       if(strchr(str, ':'))
-               return 1;
-       else    return 0;
-}
-
 /** calculate number of ip4 and ip6 interfaces, times multiplier. */
 static void 
 calc_num46(const char** ifs, int num_ifs, int do_ip4, int do_ip6, 
index 06d55886d2ec6d39cbc415094b57e7810d184f0c..524dcaa78151176072d4f3a86accb9b0a5061a7b 100644 (file)
@@ -151,11 +151,4 @@ void pending_udp_query(struct outside_network* outnet, ldns_buffer* packet,
  */
 void pending_delete(struct outside_network* outnet, struct pending* p);
 
-/** 
- * See if string is ip4 or ip6.
- * @param str: IP specification.
- * @return: true if string addr is an ip6 specced address. 
- */
-int str_is_ip6(const char* str);
-
 #endif /* OUTSIDE_NETWORK_H */
index cad1aeaec9be8bdd7bceaadd30578e25c2ccb230..c772d8dfa926f222cfb86ca97345db74497b738f 100644 (file)
@@ -69,4 +69,94 @@ fake_event_cleanup()
 
 /*********** Dummy routines ***********/
 
+struct listen_dnsport* 
+listen_create(struct comm_base* ATTR_UNUSED(base),
+       int ATTR_UNUSED(num_ifs), const char* ATTR_UNUSED(ifs[]), 
+       const char* ATTR_UNUSED(port),
+       int ATTR_UNUSED(do_ip4), int ATTR_UNUSED(do_ip6), 
+       int ATTR_UNUSED(do_udp), int ATTR_UNUSED(do_tcp),
+       size_t ATTR_UNUSED(bufsize), comm_point_callback_t* ATTR_UNUSED(cb), 
+       void* ATTR_UNUSED(cb_arg))
+{
+       return malloc(1);
+}
+
+void 
+listen_delete(struct listen_dnsport* listen)
+{
+       free(listen);
+}
+
+struct comm_base* comm_base_create()
+{
+       return malloc(1);
+}
+
+void comm_base_delete(struct comm_base* b)
+{
+       free(b);
+}
+
+void comm_base_dispatch(struct comm_base* b)
+{
+       /* TODO run the scenario ! */
+}
+
+void comm_base_exit(struct comm_base* ATTR_UNUSED(b))
+{
+       /* some sort of failure */
+       exit(1);
+}
+
+struct comm_signal* comm_signal_create(struct comm_base* ATTR_UNUSED(base),
+        void ATTR_UNUSED((*callback)(int, void*)), void* ATTR_UNUSED(cb_arg))
+{
+       return malloc(1);
+}
+
+int comm_signal_bind(struct comm_signal* ATTR_UNUSED(comsig), int 
+       ATTR_UNUSED(sig))
+{
+       return 1;
+}
+
+void comm_signal_delete(struct comm_signal* comsig)
+{
+       free(comsig);
+}
+
+void 
+comm_point_send_reply(struct comm_reply* repinfo)
+{
+       /* TODO see if this is checked */
+}
+
+void 
+comm_point_drop_reply(struct comm_reply* repinfo)
+{
+       /* TODO */
+}
+
+struct outside_network* 
+outside_network_create(struct comm_base* ATTR_UNUSED(base),
+       size_t ATTR_UNUSED(bufsize), size_t ATTR_UNUSED(num_ports), 
+       const char** ATTR_UNUSED(ifs), int ATTR_UNUSED(num_ifs),
+       int ATTR_UNUSED(do_ip4), int ATTR_UNUSED(do_ip6), 
+       int ATTR_UNUSED(port_base))
+{
+       return malloc(1);
+}
+
+void 
+outside_network_delete(struct outside_network* outnet)
+{
+       free(outnet);
+}
+
+void pending_udp_query(struct outside_network* outnet, ldns_buffer* packet,
+       struct sockaddr_storage* addr, socklen_t addrlen, int timeout,
+       comm_point_callback_t* callback, void* callback_arg)
+{
+}
+
 /*********** End of Dummy routines ***********/
diff --git a/util/net_help.c b/util/net_help.c
new file mode 100644 (file)
index 0000000..f5e065e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * util/net_help.c - implementation of the network helper code
+ *
+ * Copyright (c) 2007, NLnet Labs. All rights reserved.
+ *
+ * This software is open source.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * Neither the name of the NLNET LABS nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * \file
+ * Implementation of log.h.
+ */
+
+#include "config.h"
+#include "util/net_help.h"
+
+/** returns true is string addr is an ip6 specced address. */
+int
+str_is_ip6(const char* str)
+{
+       if(strchr(str, ':'))
+               return 1;
+       else    return 0;
+}
+
diff --git a/util/net_help.h b/util/net_help.h
new file mode 100644 (file)
index 0000000..a78f1b9
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * util/net_help.h - network help functions 
+ *
+ * Copyright (c) 2007, NLnet Labs. All rights reserved.
+ *
+ * This software is open source.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * Neither the name of the NLNET LABS nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file
+ *
+ * This file contains functions to perform network related tasks.
+ */
+
+#ifndef NET_HELP_H
+#define NET_HELP_H
+
+/**
+ * See if string is ip4 or ip6.
+ * @param str: IP specification.
+ * @return: true if string addr is an ip6 specced address.
+ */
+int str_is_ip6(const char* str);
+
+#endif /* NET_HELP_H */