Commit d647a458 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[1186] Initial libdhcp skeleton implementation.

parent 5f9a52ab
......@@ -870,6 +870,8 @@ AC_CONFIG_FILES([Makefile
src/lib/dns/python/Makefile
src/lib/dns/python/tests/Makefile
src/lib/dns/benchmarks/Makefile
src/lib/dhcp/Makefile
src/lib/dhcp/tests/Makefile
src/lib/exceptions/Makefile
src/lib/exceptions/tests/Makefile
src/lib/datasrc/Makefile
......
......@@ -574,7 +574,7 @@ INPUT = ../src/lib/exceptions ../src/lib/cc \
../src/lib/log/compiler ../src/lib/asiolink/ ../src/lib/nsas \
../src/lib/testutils ../src/lib/cache ../src/lib/server_common/ \
../src/bin/sockcreator/ ../src/lib/util/ \
../src/lib/resolve ../src/lib/acl ../src/bin/dhcp6
../src/lib/resolve ../src/lib/acl ../src/bin/dhcp6 ../src/lib/dhcp
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
......@@ -31,11 +31,12 @@ spec_config.h: spec_config.h.pre
BUILT_SOURCES = spec_config.h
pkglibexec_PROGRAMS = b10-dhcp6
b10_dhcp6_SOURCES = main.cc iface_mgr.cc pkt6.cc dhcp6_srv.cc
b10_dhcp6_SOURCES += iface_mgr.h pkt6.h dhcp6_srv.h dhcp6.h
b10_dhcp6_SOURCES = main.cc iface_mgr.cc dhcp6_srv.cc
b10_dhcp6_SOURCES += iface_mgr.h dhcp6_srv.h
b10_dhcp6_LDADD = $(top_builddir)/src/lib/datasrc/libdatasrc.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/util/libutil.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/dhcp/libdhcp.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/cc/libcc.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
......
......@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include "dhcp6/pkt6.h"
#include "dhcp/pkt6.h"
#include "dhcp6/iface_mgr.h"
#include "dhcp6/dhcp6_srv.h"
......
......@@ -18,8 +18,8 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include "dhcp/dhcp6.h"
#include "dhcp6/iface_mgr.h"
#include "dhcp6/dhcp6.h"
#include "exceptions/exceptions.h"
using namespace std;
......
......@@ -17,7 +17,7 @@
#include <list>
#include "io_address.h"
#include "dhcp6/pkt6.h"
#include "dhcp/pkt6.h"
namespace isc {
......
......@@ -45,11 +45,9 @@ if HAVE_GTEST
TESTS += dhcp6_unittests
dhcp6_unittests_SOURCES = ../pkt6.h ../pkt6.cc
dhcp6_unittests_SOURCES += ../iface_mgr.h ../iface_mgr.cc
dhcp6_unittests_SOURCES = ../iface_mgr.h ../iface_mgr.cc
dhcp6_unittests_SOURCES += ../dhcp6_srv.h ../dhcp6_srv.cc
dhcp6_unittests_SOURCES += dhcp6_unittests.cc
dhcp6_unittests_SOURCES += pkt6_unittest.cc
dhcp6_unittests_SOURCES += iface_mgr_unittest.cc
dhcp6_unittests_SOURCES += dhcp6_srv_unittest.cc
......@@ -58,6 +56,7 @@ dhcp6_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
dhcp6_unittests_LDADD = $(GTEST_LDADD)
dhcp6_unittests_LDADD += $(SQLITE_LIBS)
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libdhcp.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/cc/libcc.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
......
......@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
#include "io_address.h"
#include "dhcp6/pkt6.h"
#include "dhcp/pkt6.h"
#include "dhcp6/iface_mgr.h"
using namespace std;
......
SUBDIRS = exceptions util log cryptolink dns cc config acl xfr bench \
asiolink asiodns nsas cache resolve testutils datasrc \
server_common python
SUBDIRS = exceptions util log cryptolink dns cc config python xfr \
bench asiolink asiodns nsas cache resolve testutils datasrc \
acl server_common dhcp
SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/asiolink
AM_CPPFLAGS += -I$(top_builddir)/src/lib/asiolink
AM_CPPFLAGS += $(BOOST_INCLUDES)
CLEANFILES = *.gcno *.gcda
lib_LTLIBRARIES = libdhcp.la
libdhcp_la_SOURCES =
libdhcp_la_SOURCES += libdhcp.cc libdhcp.h
libdhcp_la_SOURCES += dhcp6.h
libdhcp_la_SOURCES += pkt6.cc pkt6.h
EXTRA_DIST = README
EXTRA_DIST += logimpl_messages.mes
EXTRA_DIST += log_messages.mes
# Note: the ordering matters: -Wno-... must follow -Wextra (defined in
# B10_CXXFLAGS)
libdhcp_la_CXXFLAGS = $(AM_CXXFLAGS)
if USE_GXX
libdhcp_la_CXXFLAGS += -Wall
endif
if USE_CLANGPP
# Same for clang++, but we need to turn off -Werror completely.
libdhcp_la_CXXFLAGS += -Wall
endif
libdhcp_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES)
libdhcp_la_LDFLAGS = $(LOG4CPLUS_LDFLAGS)
libdhcp_la_LIBADD = $(top_builddir)/src/lib/util/libutil.la
This directory holds implementation for libdhcp.
Basic Ideas
===========
Notes
=====
This work just begun. Don't expect to see much useful code here.
We are working on it.
\ No newline at end of file
......@@ -17,87 +17,87 @@
/* DHCPv6 Option codes: */
#define D6O_CLIENTID 1 /* RFC3315 */
#define D6O_SERVERID 2
#define D6O_IA_NA 3
#define D6O_IA_TA 4
#define D6O_IAADDR 5
#define D6O_ORO 6
#define D6O_PREFERENCE 7
#define D6O_ELAPSED_TIME 8
#define D6O_RELAY_MSG 9
#define D6O_CLIENTID 1 /* RFC3315 */
#define D6O_SERVERID 2
#define D6O_IA_NA 3
#define D6O_IA_TA 4
#define D6O_IAADDR 5
#define D6O_ORO 6
#define D6O_PREFERENCE 7
#define D6O_ELAPSED_TIME 8
#define D6O_RELAY_MSG 9
/* Option code 10 unassigned. */
#define D6O_AUTH 11
#define D6O_UNICAST 12
#define D6O_STATUS_CODE 13
#define D6O_RAPID_COMMIT 14
#define D6O_USER_CLASS 15
#define D6O_VENDOR_CLASS 16
#define D6O_VENDOR_OPTS 17
#define D6O_INTERFACE_ID 18
#define D6O_RECONF_MSG 19
#define D6O_RECONF_ACCEPT 20
#define D6O_SIP_SERVERS_DNS 21 /* RFC3319 */
#define D6O_SIP_SERVERS_ADDR 22 /* RFC3319 */
#define D6O_NAME_SERVERS 23 /* RFC3646 */
#define D6O_DOMAIN_SEARCH 24 /* RFC3646 */
#define D6O_IA_PD 25 /* RFC3633 */
#define D6O_IAPREFIX 26 /* RFC3633 */
#define D6O_NIS_SERVERS 27 /* RFC3898 */
#define D6O_NISP_SERVERS 28 /* RFC3898 */
#define D6O_NIS_DOMAIN_NAME 29 /* RFC3898 */
#define D6O_NISP_DOMAIN_NAME 30 /* RFC3898 */
#define D6O_SNTP_SERVERS 31 /* RFC4075 */
#define D6O_INFORMATION_REFRESH_TIME 32 /* RFC4242 */
#define D6O_BCMCS_SERVER_D 33 /* RFC4280 */
#define D6O_BCMCS_SERVER_A 34 /* RFC4280 */
#define D6O_AUTH 11
#define D6O_UNICAST 12
#define D6O_STATUS_CODE 13
#define D6O_RAPID_COMMIT 14
#define D6O_USER_CLASS 15
#define D6O_VENDOR_CLASS 16
#define D6O_VENDOR_OPTS 17
#define D6O_INTERFACE_ID 18
#define D6O_RECONF_MSG 19
#define D6O_RECONF_ACCEPT 20
#define D6O_SIP_SERVERS_DNS 21 /* RFC3319 */
#define D6O_SIP_SERVERS_ADDR 22 /* RFC3319 */
#define D6O_NAME_SERVERS 23 /* RFC3646 */
#define D6O_DOMAIN_SEARCH 24 /* RFC3646 */
#define D6O_IA_PD 25 /* RFC3633 */
#define D6O_IAPREFIX 26 /* RFC3633 */
#define D6O_NIS_SERVERS 27 /* RFC3898 */
#define D6O_NISP_SERVERS 28 /* RFC3898 */
#define D6O_NIS_DOMAIN_NAME 29 /* RFC3898 */
#define D6O_NISP_DOMAIN_NAME 30 /* RFC3898 */
#define D6O_SNTP_SERVERS 31 /* RFC4075 */
#define D6O_INFORMATION_REFRESH_TIME 32 /* RFC4242 */
#define D6O_BCMCS_SERVER_D 33 /* RFC4280 */
#define D6O_BCMCS_SERVER_A 34 /* RFC4280 */
/* 35 is unassigned */
#define D6O_GEOCONF_CIVIC 36 /* RFC4776 */
#define D6O_REMOTE_ID 37 /* RFC4649 */
#define D6O_SUBSCRIBER_ID 38 /* RFC4580 */
#define D6O_CLIENT_FQDN 39 /* RFC4704 */
#define D6O_PANA_AGENT 40 /* paa-option */
#define D6O_NEW_POSIX_TIMEZONE 41 /* RFC4833 */
#define D6O_NEW_TZDB_TIMEZONE 42 /* RFC4833 */
#define D6O_ERO 43 /* RFC4994 */
#define D6O_LQ_QUERY 44 /* RFC5007 */
#define D6O_CLIENT_DATA 45 /* RFC5007 */
#define D6O_CLT_TIME 46 /* RFC5007 */
#define D6O_LQ_RELAY_DATA 47 /* RFC5007 */
#define D6O_LQ_CLIENT_LINK 48 /* RFC5007 */
/*
#define D6O_GEOCONF_CIVIC 36 /* RFC4776 */
#define D6O_REMOTE_ID 37 /* RFC4649 */
#define D6O_SUBSCRIBER_ID 38 /* RFC4580 */
#define D6O_CLIENT_FQDN 39 /* RFC4704 */
#define D6O_PANA_AGENT 40 /* paa-option */
#define D6O_NEW_POSIX_TIMEZONE 41 /* RFC4833 */
#define D6O_NEW_TZDB_TIMEZONE 42 /* RFC4833 */
#define D6O_ERO 43 /* RFC4994 */
#define D6O_LQ_QUERY 44 /* RFC5007 */
#define D6O_CLIENT_DATA 45 /* RFC5007 */
#define D6O_CLT_TIME 46 /* RFC5007 */
#define D6O_LQ_RELAY_DATA 47 /* RFC5007 */
#define D6O_LQ_CLIENT_LINK 48 /* RFC5007 */
/*
* Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007.
*/
#define STATUS_Success 0
#define STATUS_UnspecFail 1
#define STATUS_NoAddrsAvail 2
#define STATUS_NoBinding 3
#define STATUS_NotOnLink 4
#define STATUS_UseMulticast 5
#define STATUS_NoPrefixAvail 6
#define STATUS_UnknownQueryType 7
#define STATUS_MalformedQuery 8
#define STATUS_NotConfigured 9
#define STATUS_NotAllowed 10
/*
* DHCPv6 message types, defined in section 5.3 of RFC 3315
#define STATUS_Success 0
#define STATUS_UnspecFail 1
#define STATUS_NoAddrsAvail 2
#define STATUS_NoBinding 3
#define STATUS_NotOnLink 4
#define STATUS_UseMulticast 5
#define STATUS_NoPrefixAvail 6
#define STATUS_UnknownQueryType 7
#define STATUS_MalformedQuery 8
#define STATUS_NotConfigured 9
#define STATUS_NotAllowed 10
/*
* DHCPv6 message types, defined in section 5.3 of RFC 3315
*/
#define DHCPV6_SOLICIT 1
#define DHCPV6_ADVERTISE 2
#define DHCPV6_REQUEST 3
#define DHCPV6_CONFIRM 4
#define DHCPV6_RENEW 5
#define DHCPV6_REBIND 6
#define DHCPV6_REPLY 7
#define DHCPV6_RELEASE 8
#define DHCPV6_DECLINE 9
#define DHCPV6_RECONFIGURE 10
#define DHCPV6_SOLICIT 1
#define DHCPV6_ADVERTISE 2
#define DHCPV6_REQUEST 3
#define DHCPV6_CONFIRM 4
#define DHCPV6_RENEW 5
#define DHCPV6_REBIND 6
#define DHCPV6_REPLY 7
#define DHCPV6_RELEASE 8
#define DHCPV6_DECLINE 9
#define DHCPV6_RECONFIGURE 10
#define DHCPV6_INFORMATION_REQUEST 11
#define DHCPV6_RELAY_FORW 12
#define DHCPV6_RELAY_REPL 13
#define DHCPV6_LEASEQUERY 14
#define DHCPV6_RELAY_FORW 12
#define DHCPV6_RELAY_REPL 13
#define DHCPV6_LEASEQUERY 14
#define DHCPV6_LEASEQUERY_REPLY 15
extern const char *dhcpv6_type_names[];
......@@ -105,9 +105,9 @@ extern const int dhcpv6_type_name_max;
/* DUID type definitions (RFC3315 section 9).
*/
#define DUID_LLT 1
#define DUID_EN 2
#define DUID_LL 3
#define DUID_LLT 1
#define DUID_EN 2
#define DUID_LL 3
/* Offsets into IA_*'s where Option spaces commence. */
#define IA_NA_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
......@@ -123,8 +123,8 @@ extern const int dhcpv6_type_name_max;
/* Offset into LQ_QUERY's where Option spaces commence. */
#define LQ_QUERY_OFFSET 17
/*
* DHCPv6 well-known multicast addressess, from section 5.1 of RFC 3315
/*
* DHCPv6 well-known multicast addressess, from section 5.1 of RFC 3315
*/
#define ALL_DHCP_RELAY_AGENTS_AND_SERVERS "ff02::1:2"
#define ALL_DHCP_SERVERS "ff05::1:3"
......@@ -166,8 +166,8 @@ extern const int dhcpv6_type_name_max;
/* Leasequery query-types (RFC 5007) */
#define LQ6QT_BY_ADDRESS 1
#define LQ6QT_BY_CLIENTID 2
#define LQ6QT_BY_ADDRESS 1
#define LQ6QT_BY_CLIENTID 2
/*
* DUID time starts 2000-01-01.
......@@ -178,7 +178,7 @@ extern const int dhcpv6_type_name_max;
/* Information-Request Time option (RFC 4242) */
#define IRT_DEFAULT 86400
#define IRT_MINIMUM 600
#define IRT_DEFAULT 86400
#define IRT_MINIMUM 600
#endif
......@@ -13,8 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
#include "dhcp6/dhcp6.h"
#include "dhcp6/pkt6.h"
#include "dhcp/dhcp6.h"
#include "dhcp/pkt6.h"
#include <iostream>
namespace isc {
......
SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/asiolink
AM_CPPFLAGS += -I$(top_builddir)/src/lib/asiolink
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(B10_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
CLEANFILES = *.gcno *.gcda
TESTS =
if HAVE_GTEST
TESTS += libdhcp_unittests
libdhcp_unittests_SOURCES = run_unittests.cc
libdhcp_unittests_SOURCES += ../libdhcp.h ../libdhcp.cc libdhcp_unittest.cc
libdhcp_unittests_SOURCES += ../pkt6.h ../pkt6.cc pkt6_unittest.cc
libdhcp_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
libdhcp_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
libdhcp_unittests_CXXFLAGS = $(AM_CXXFLAGS)
if USE_CLANGPP
# This is to workaround unused variables tcout and tcerr in
# log4cplus's streams.h.
libdhcp_unittests_CXXFLAGS += -Wno-unused-variable
endif
libdhcp_unittests_LDADD = $(GTEST_LDADD)
libdhcp_unittests_LDADD += $(top_builddir)/src/lib/log/liblog.la
libdhcp_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
libdhcp_unittests_LDADD += $(top_builddir)/src/lib/util/libutil.la
libdhcp_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
libdhcp_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
libdhcp_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
endif
noinst_PROGRAMS = $(TESTS)
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <iostream>
#include <sstream>
#include <arpa/inet.h>
#include <gtest/gtest.h>
#include "dhcp/libdhcp.h"
using namespace std;
using namespace isc;
using namespace isc::dhcp;
namespace {
class LibDhcpTest : public ::testing::Test {
public:
LibDhcpTest() {
}
};
TEST_F(LibDhcpTest, basic) {
// dummy test
// an attempt to bind this socket will fail.
EXPECT_EQ(LibDHCP::version(), "0");
}
}
......@@ -20,7 +20,7 @@
#include <gtest/gtest.h>
#include "dhcp6/pkt6.h"
#include "dhcp/pkt6.h"
using namespace std;
using namespace isc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment