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))
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)
#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>
#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>
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,
*/
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 */
/*********** 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 ***********/
--- /dev/null
+/*
+ * 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;
+}
+
--- /dev/null
+/*
+ * 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 */