BIND 10 trac1186, updated. e4ad0dcba0cd6ab978b826b824f663596349875c [1186] Part 4 of review changes
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Oct 11 17:49:06 UTC 2011
The branch, trac1186 has been updated
via e4ad0dcba0cd6ab978b826b824f663596349875c (commit)
from 071661c3064767f3dfc3699bdae32cf10bd2d2f9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e4ad0dcba0cd6ab978b826b824f663596349875c
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Tue Oct 11 19:48:55 2011 +0200
[1186] Part 4 of review changes
- added consts in packOption6, unpackOptions6
- removed version() method
- alignments fixed in dhcp6.h
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcp/Makefile.am | 1 -
src/lib/dhcp/dhcp6.h | 20 ++++++++++----------
src/lib/dhcp/libdhcp.cc | 14 +++++---------
src/lib/dhcp/libdhcp.h | 11 ++---------
src/lib/dhcp/tests/libdhcp_unittest.cc | 6 ------
5 files changed, 17 insertions(+), 35 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/Makefile.am b/src/lib/dhcp/Makefile.am
index f87e2b5..e146adb 100644
--- a/src/lib/dhcp/Makefile.am
+++ b/src/lib/dhcp/Makefile.am
@@ -22,5 +22,4 @@ EXTRA_DIST = README
libdhcp_la_CXXFLAGS = $(AM_CXXFLAGS)
libdhcp_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES)
-libdhcp_la_LDFLAGS = $(LOG4CPLUS_LDFLAGS)
libdhcp_la_LIBADD = $(top_builddir)/src/lib/util/libutil.la
diff --git a/src/lib/dhcp/dhcp6.h b/src/lib/dhcp/dhcp6.h
index b3ee0bf..6012003 100644
--- a/src/lib/dhcp/dhcp6.h
+++ b/src/lib/dhcp/dhcp6.h
@@ -22,18 +22,18 @@
#define D6O_IA_NA 3
#define D6O_IA_TA 4
#define D6O_IAADDR 5
-#define D6O_ORO 6
+#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_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_VENDOR_OPTS 17
#define D6O_INTERFACE_ID 18
#define D6O_RECONF_MSG 19
#define D6O_RECONF_ACCEPT 20
@@ -43,7 +43,7 @@
#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_NIS_SERVERS 27 /* RFC3898 */
#define D6O_NISP_SERVERS 28 /* RFC3898 */
#define D6O_NIS_DOMAIN_NAME 29 /* RFC3898 */
#define D6O_NISP_DOMAIN_NAME 30 /* RFC3898 */
@@ -55,13 +55,13 @@
#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_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_ERO 43 /* RFC4994 */
#define D6O_LQ_QUERY 44 /* RFC5007 */
-#define D6O_CLIENT_DATA 45 /* 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 */
@@ -76,7 +76,7 @@
#define STATUS_NotOnLink 4
#define STATUS_UseMulticast 5
#define STATUS_NoPrefixAvail 6
-#define STATUS_UnknownQueryType 7
+#define STATUS_UnknownQueryType 7
#define STATUS_MalformedQuery 8
#define STATUS_NotConfigured 9
#define STATUS_NotAllowed 10
@@ -106,8 +106,8 @@ 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_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 */
diff --git a/src/lib/dhcp/libdhcp.cc b/src/lib/dhcp/libdhcp.cc
index 62326ba..df817b7 100644
--- a/src/lib/dhcp/libdhcp.cc
+++ b/src/lib/dhcp/libdhcp.cc
@@ -28,13 +28,9 @@ using namespace isc::dhcp;
// static array with factories for options
std::map<unsigned short, Option::Factory*> LibDHCP::v6factories_;
-std::string
-LibDHCP::version() {
- return PACKAGE_VERSION;
-}
-
unsigned int
-LibDHCP::unpackOptions6(boost::shared_array<uint8_t> buf, unsigned int buf_len,
+LibDHCP::unpackOptions6(const boost::shared_array<uint8_t> buf,
+ unsigned int buf_len,
unsigned int offset, unsigned int parse_len,
isc::dhcp::Option::Option6Lst& options) {
if (offset + parse_len > buf_len) {
@@ -44,7 +40,7 @@ LibDHCP::unpackOptions6(boost::shared_array<uint8_t> buf, unsigned int buf_len,
}
unsigned int end = offset + parse_len;
- while (offset<end) {
+ while ( offset +4 <= end ) {
unsigned int opt_type = buf[offset]*256 + buf[offset+1];
offset += 2;
unsigned int opt_len = buf[offset]*256 + buf[offset+1];
@@ -92,9 +88,9 @@ unsigned int
LibDHCP::packOptions6(boost::shared_array<uint8_t> data,
unsigned int data_len,
unsigned int offset,
- isc::dhcp::Option::Option6Lst& options) {
+ const isc::dhcp::Option::Option6Lst& options) {
try {
- for (isc::dhcp::Option::Option6Lst::iterator it = options.begin();
+ for (isc::dhcp::Option::Option6Lst::const_iterator it = options.begin();
it != options.end();
++it) {
unsigned short opt_len = (*it).second->len();
diff --git a/src/lib/dhcp/libdhcp.h b/src/lib/dhcp/libdhcp.h
index e1fc10f..857e5d1 100644
--- a/src/lib/dhcp/libdhcp.h
+++ b/src/lib/dhcp/libdhcp.h
@@ -24,13 +24,6 @@ namespace dhcp {
class LibDHCP {
public:
- /// Returns version of the library.
- ///
- /// @return string that contains libdhcp version.
- ///
- static std::string
- version();
-
/// Builds collection of options.
///
/// Builds raw (on-wire) data for provided collection of options.
@@ -46,7 +39,7 @@ public:
static unsigned int
packOptions6(boost::shared_array<uint8_t> buf, unsigned int buf_len,
unsigned int offset,
- isc::dhcp::Option::Option6Lst& options);
+ const isc::dhcp::Option::Option6Lst& options);
///
/// Parses provided buffer and creates Option objects.
@@ -62,7 +55,7 @@ public:
/// @return offset to first byte after last parsed option
///
static unsigned int
- unpackOptions6(boost::shared_array<uint8_t> buf, unsigned int buf_len,
+ unpackOptions6(const boost::shared_array<uint8_t> buf, unsigned int buf_len,
unsigned int offset, unsigned int parse_len,
isc::dhcp::Option::Option6Lst& options_);
diff --git a/src/lib/dhcp/tests/libdhcp_unittest.cc b/src/lib/dhcp/tests/libdhcp_unittest.cc
index 0766df9..e553a24 100644
--- a/src/lib/dhcp/tests/libdhcp_unittest.cc
+++ b/src/lib/dhcp/tests/libdhcp_unittest.cc
@@ -33,12 +33,6 @@ public:
}
};
-TEST_F(LibDhcpTest, basic) {
- // dummy test
-
- EXPECT_EQ(LibDHCP::version(), PACKAGE_VERSION);
-}
-
TEST_F(LibDhcpTest, packOptions6) {
boost::shared_array<uint8_t> buf(new uint8_t[512]);
isc::dhcp::Option::Option6Lst opts; // list of options
More information about the bind10-changes
mailing list