Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
450
Issues
450
List
Boards
Labels
Service Desk
Milestones
Merge Requests
75
Merge Requests
75
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
8f19841c
Commit
8f19841c
authored
May 12, 2015
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[3833] some signed for loop variables aka #3833
parent
39167c04
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
121 additions
and
117 deletions
+121
-117
src/lib/dhcp/classify.cc
src/lib/dhcp/classify.cc
+1
-1
src/lib/dhcp/libdhcp++.cc
src/lib/dhcp/libdhcp++.cc
+2
-2
src/lib/dhcp/option.cc
src/lib/dhcp/option.cc
+1
-1
src/lib/dhcp/option_custom.cc
src/lib/dhcp/option_custom.cc
+1
-1
src/lib/dhcp/option_int_array.h
src/lib/dhcp/option_int_array.h
+2
-2
src/lib/dhcp/option_vendor_class.cc
src/lib/dhcp/option_vendor_class.cc
+2
-2
src/lib/dhcp/pkt6.cc
src/lib/dhcp/pkt6.cc
+1
-1
src/lib/dhcp/tests/iface_mgr_unittest.cc
src/lib/dhcp/tests/iface_mgr_unittest.cc
+5
-5
src/lib/dhcp/tests/libdhcp++_unittest.cc
src/lib/dhcp/tests/libdhcp++_unittest.cc
+3
-3
src/lib/dhcp/tests/opaque_data_tuple_unittest.cc
src/lib/dhcp/tests/opaque_data_tuple_unittest.cc
+4
-4
src/lib/dhcp/tests/option6_addrlst_unittest.cc
src/lib/dhcp/tests/option6_addrlst_unittest.cc
+2
-2
src/lib/dhcp/tests/option6_ia_unittest.cc
src/lib/dhcp/tests/option6_ia_unittest.cc
+2
-2
src/lib/dhcp/tests/option6_iaaddr_unittest.cc
src/lib/dhcp/tests/option6_iaaddr_unittest.cc
+2
-2
src/lib/dhcp/tests/option6_iaprefix_unittest.cc
src/lib/dhcp/tests/option6_iaprefix_unittest.cc
+2
-2
src/lib/dhcp/tests/option_custom_unittest.cc
src/lib/dhcp/tests/option_custom_unittest.cc
+10
-10
src/lib/dhcp/tests/option_definition_unittest.cc
src/lib/dhcp/tests/option_definition_unittest.cc
+12
-10
src/lib/dhcp/tests/option_int_array_unittest.cc
src/lib/dhcp/tests/option_int_array_unittest.cc
+2
-2
src/lib/dhcp/tests/option_int_unittest.cc
src/lib/dhcp/tests/option_int_unittest.cc
+2
-2
src/lib/dhcp/tests/option_unittest.cc
src/lib/dhcp/tests/option_unittest.cc
+5
-5
src/lib/dhcp/tests/pkt4_unittest.cc
src/lib/dhcp/tests/pkt4_unittest.cc
+7
-7
src/lib/dhcp/tests/pkt6_unittest.cc
src/lib/dhcp/tests/pkt6_unittest.cc
+1
-1
src/lib/dhcp/tests/protocol_util_unittest.cc
src/lib/dhcp/tests/protocol_util_unittest.cc
+3
-3
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
+1
-1
src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
+11
-11
src/lib/dhcpsrv/tests/d2_udp_unittest.cc
src/lib/dhcpsrv/tests/d2_udp_unittest.cc
+3
-3
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
+12
-12
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
+2
-2
src/lib/dns/master_loader.cc
src/lib/dns/master_loader.cc
+1
-1
src/lib/dns/tests/rdata_sshfp_unittest.cc
src/lib/dns/tests/rdata_sshfp_unittest.cc
+2
-2
src/lib/dns/tests/zone_checker_unittest.cc
src/lib/dns/tests/zone_checker_unittest.cc
+5
-3
src/lib/hooks/library_manager.cc
src/lib/hooks/library_manager.cc
+3
-3
src/lib/hooks/library_manager_collection.cc
src/lib/hooks/library_manager_collection.cc
+2
-2
src/lib/hooks/tests/server_hooks_unittest.cc
src/lib/hooks/tests/server_hooks_unittest.cc
+2
-2
src/lib/util/csv_file.cc
src/lib/util/csv_file.cc
+5
-5
No files found.
src/lib/dhcp/classify.cc
View file @
8f19841c
...
...
@@ -28,7 +28,7 @@ ClientClasses::ClientClasses(const std::string& class_names)
std
::
vector
<
std
::
string
>
split_text
;
boost
::
split
(
split_text
,
class_names
,
boost
::
is_any_of
(
","
),
boost
::
algorithm
::
token_compress_off
);
for
(
in
t
i
=
0
;
i
<
split_text
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
split_text
.
size
();
++
i
)
{
std
::
string
trimmed
=
util
::
str
::
trim
(
split_text
[
i
]);
// Ignore empty class names.
if
(
!
trimmed
.
empty
())
{
...
...
src/lib/dhcp/libdhcp++.cc
View file @
8f19841c
...
...
@@ -710,7 +710,7 @@ void initOptionSpace(OptionDefContainer& defs,
size_t
params_size
)
{
defs
.
clear
();
for
(
in
t
i
=
0
;
i
<
params_size
;
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
params_size
;
++
i
)
{
std
::
string
encapsulates
(
params
[
i
].
encapsulates
);
if
(
!
encapsulates
.
empty
()
&&
params
[
i
].
array
)
{
isc_throw
(
isc
::
BadValue
,
"invalid standard option definition: "
...
...
@@ -740,7 +740,7 @@ void initOptionSpace(OptionDefContainer& defs,
}
for
(
in
t
rec
=
0
;
rec
<
params
[
i
].
records_size
;
++
rec
)
{
for
(
size_
t
rec
=
0
;
rec
<
params
[
i
].
records_size
;
++
rec
)
{
definition
->
addRecordField
(
params
[
i
].
records
[
rec
]);
}
...
...
src/lib/dhcp/option.cc
View file @
8f19841c
...
...
@@ -151,7 +151,7 @@ uint16_t Option::len() {
// option header)
// length of the whole option is header and data stored in this option...
in
t
length
=
getHeaderLen
()
+
data_
.
size
();
size_
t
length
=
getHeaderLen
()
+
data_
.
size
();
// ... and sum of lengths of all suboptions
for
(
OptionCollection
::
iterator
it
=
options_
.
begin
();
...
...
src/lib/dhcp/option_custom.cc
View file @
8f19841c
...
...
@@ -504,7 +504,7 @@ OptionCustom::unpack(OptionBufferConstIter begin,
uint16_t
OptionCustom
::
len
()
{
// The length of the option is a sum of option header ...
in
t
length
=
getHeaderLen
();
size_
t
length
=
getHeaderLen
();
// ... lengths of all buffers that hold option data ...
for
(
std
::
vector
<
OptionBuffer
>::
const_iterator
buf
=
buffers_
.
begin
();
...
...
src/lib/dhcp/option_int_array.h
View file @
8f19841c
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2013
, 2015
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
...
...
@@ -143,7 +143,7 @@ public:
// Pack option header.
packHeader
(
buf
);
// Pack option data.
for
(
in
t
i
=
0
;
i
<
values_
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
values_
.
size
();
++
i
)
{
// Depending on the data type length we use different utility functions
// writeUint16 or writeUint32 which write the data in the network byte
// order to the provided buffer. The same functions can be safely used
...
...
src/lib/dhcp/option_vendor_class.cc
View file @
8f19841c
// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014
, 2015
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
...
...
@@ -174,7 +174,7 @@ OptionVendorClass::toText(int indent) {
s
<<
"type="
<<
getType
()
<<
", len="
<<
len
()
-
getHeaderLen
()
<<
", "
" enterprise id=0x"
<<
std
::
hex
<<
getVendorId
()
<<
std
::
dec
;
// Iterate over all tuples and print their size and contents.
for
(
int
i
=
0
;
i
<
getTuplesNum
();
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
getTuplesNum
();
++
i
)
{
// The DHCPv4 V-I Vendor Class has enterprise id before every tuple.
if
((
getUniverse
()
==
V4
)
&&
(
i
>
0
))
{
s
<<
", enterprise id=0x"
<<
std
::
hex
<<
getVendorId
()
<<
std
::
dec
;
...
...
src/lib/dhcp/pkt6.cc
View file @
8f19841c
...
...
@@ -575,7 +575,7 @@ void Pkt6::copyRelayInfo(const Pkt6Ptr& question) {
// We use index rather than iterator, because we need that as a parameter
// passed to getRelayOption()
for
(
in
t
i
=
0
;
i
<
question
->
relay_info_
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
question
->
relay_info_
.
size
();
++
i
)
{
RelayInfo
info
;
info
.
msg_type_
=
DHCPV6_RELAY_REPL
;
info
.
hop_count_
=
question
->
relay_info_
[
i
].
hop_count_
;
...
...
src/lib/dhcp/tests/iface_mgr_unittest.cc
View file @
8f19841c
...
...
@@ -77,14 +77,14 @@ TEST(IfaceTest, readBuffer) {
ASSERT_FALSE
(
buf_ptr
==
NULL
);
// Use the pointer to set some data.
for
(
in
t
i
=
0
;
i
<
iface
.
getReadBufferSize
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
iface
.
getReadBufferSize
();
++
i
)
{
buf_ptr
[
i
]
=
i
;
}
// Get the pointer again and validate the data.
buf_ptr
=
iface
.
getReadBuffer
();
ASSERT_EQ
(
256
,
iface
.
getReadBufferSize
());
for
(
in
t
i
=
0
;
i
<
iface
.
getReadBufferSize
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
iface
.
getReadBufferSize
();
++
i
)
{
// Use assert so as it fails on the first failure, no need
// to continue further checks.
ASSERT_EQ
(
i
,
buf_ptr
[
i
]);
...
...
@@ -552,7 +552,7 @@ TEST_F(IfaceMgrTest, closeSockets) {
// Create set of V4 and V6 sockets on the loopback interface.
// They must differ by a port they are bound to.
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
6
;
++
i
)
{
// Every other socket will be IPv4.
if
(
i
%
2
)
{
ASSERT_NO_THROW
(
...
...
@@ -1099,7 +1099,7 @@ TEST_F(IfaceMgrTest, sendReceive6) {
// prepare dummy payload
uint8_t
data
[
128
];
for
(
in
t
i
=
0
;
i
<
128
;
i
++
)
{
for
(
uint8_
t
i
=
0
;
i
<
128
;
i
++
)
{
data
[
i
]
=
i
;
}
Pkt6Ptr
sendPkt
=
Pkt6Ptr
(
new
Pkt6
(
data
,
128
));
...
...
@@ -2115,7 +2115,7 @@ TEST_F(IfaceMgrTest, iface_methods) {
EXPECT_EQ
(
42
,
iface
.
getHWType
());
uint8_t
mac
[
Iface
::
MAX_MAC_LEN
+
10
];
for
(
in
t
i
=
0
;
i
<
Iface
::
MAX_MAC_LEN
+
10
;
i
++
)
for
(
uint8_
t
i
=
0
;
i
<
Iface
::
MAX_MAC_LEN
+
10
;
i
++
)
mac
[
i
]
=
255
-
i
;
EXPECT_EQ
(
"foo"
,
iface
.
getName
());
...
...
src/lib/dhcp/tests/libdhcp++_unittest.cc
View file @
8f19841c
// Copyright (C) 2011-201
4
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
5
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
...
...
@@ -309,7 +309,7 @@ TEST_F(LibDhcpTest, packOptions6) {
isc
::
dhcp
::
OptionCollection
opts
;
// list of options
// generate content for options
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
64
;
i
++
)
{
buf
[
i
]
=
i
+
100
;
}
...
...
@@ -476,7 +476,7 @@ static uint8_t v4_opts[] = {
TEST_F
(
LibDhcpTest
,
packOptions4
)
{
vector
<
uint8_t
>
payload
[
5
];
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
5
;
i
++
)
{
payload
[
i
].
resize
(
3
);
payload
[
i
][
0
]
=
i
*
10
;
payload
[
i
][
1
]
=
i
*
10
+
1
;
...
...
src/lib/dhcp/tests/opaque_data_tuple_unittest.cc
View file @
8f19841c
// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014
, 2015
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
...
...
@@ -267,7 +267,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
EXPECT_THROW
(
tuple
.
pack
(
out_buf
),
OpaqueDataTupleError
);
// Set the data for tuple.
std
::
vector
<
uint8_t
>
data
;
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
100
;
++
i
)
{
data
.
push_back
(
i
);
}
tuple
.
assign
(
data
.
begin
(),
data
.
size
());
...
...
@@ -289,7 +289,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
out_buf
.
clear
();
// Fill in the tuple buffer so as it reaches maximum allowed length. The
// maximum length is 255 when the size of the length field is one byte.
for
(
int
i
=
100
;
i
<
255
;
++
i
)
{
for
(
unsigned
i
=
100
;
i
<
255
;
++
i
)
{
data
.
push_back
(
i
);
}
ASSERT_EQ
(
255
,
data
.
size
());
...
...
@@ -326,7 +326,7 @@ TEST(OpaqueDataTuple, pack2Bytes) {
EXPECT_THROW
(
tuple
.
pack
(
out_buf
),
OpaqueDataTupleError
);
// Set the data for tuple.
std
::
vector
<
uint8_t
>
data
;
for
(
int
i
=
0
;
i
<
512
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
512
;
++
i
)
{
data
.
push_back
(
i
);
}
tuple
.
assign
(
data
.
begin
(),
data
.
size
());
...
...
src/lib/dhcp/tests/option6_addrlst_unittest.cc
View file @
8f19841c
// Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2013
, 2015
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
...
...
@@ -39,7 +39,7 @@ namespace {
class
Option6AddrLstTest
:
public
::
testing
::
Test
{
public:
Option6AddrLstTest
()
:
buf_
(
255
),
outBuf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
src/lib/dhcp/tests/option6_ia_unittest.cc
View file @
8f19841c
// Copyright (C) 2011-2012 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2012
, 2015
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
...
...
@@ -40,7 +40,7 @@ namespace {
class
Option6IATest
:
public
::
testing
::
Test
{
public:
Option6IATest
()
:
buf_
(
255
),
outBuf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
src/lib/dhcp/tests/option6_iaaddr_unittest.cc
View file @
8f19841c
// Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2013
, 2015
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
...
...
@@ -36,7 +36,7 @@ namespace {
class
Option6IAAddrTest
:
public
::
testing
::
Test
{
public:
Option6IAAddrTest
()
:
buf_
(
255
),
outBuf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
src/lib/dhcp/tests/option6_iaprefix_unittest.cc
View file @
8f19841c
// Copyright (C) 2011-201
4
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
5
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
...
...
@@ -37,7 +37,7 @@ namespace {
class
Option6IAPrefixTest
:
public
::
testing
::
Test
{
public:
Option6IAPrefixTest
()
:
buf_
(
255
),
out_buf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
src/lib/dhcp/tests/option_custom_unittest.cc
View file @
8f19841c
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2013
, 2015
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
...
...
@@ -196,7 +196,7 @@ TEST_F(OptionCustomTest, binaryData) {
// used as reference when we read back the data from a created
// option.
OptionBuffer
buf_in
(
14
);
for
(
int
i
=
0
;
i
<
14
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
14
;
++
i
)
{
buf_in
[
i
]
=
i
;
}
...
...
@@ -603,7 +603,7 @@ TEST_F(OptionCustomTest, uint32DataArray) {
// Store these values in a buffer.
OptionBuffer
buf
;
for
(
in
t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
writeInt
<
uint32_t
>
(
values
[
i
],
buf
);
}
// Create custom option using the input buffer.
...
...
@@ -649,7 +649,7 @@ TEST_F(OptionCustomTest, ipv4AddressDataArray) {
// Store the collection of IPv4 addresses into the buffer.
OptionBuffer
buf
;
for
(
in
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
writeAddress
(
addresses
[
i
],
buf
);
}
...
...
@@ -699,7 +699,7 @@ TEST_F(OptionCustomTest, ipv6AddressDataArray) {
// Store the collection of IPv6 addresses into the buffer.
OptionBuffer
buf
;
for
(
in
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
writeAddress
(
addresses
[
i
],
buf
);
}
...
...
@@ -968,7 +968,7 @@ TEST_F(OptionCustomTest, setBinaryData) {
EXPECT_TRUE
(
buf
.
empty
());
// Prepare input buffer with some dummy data.
OptionBuffer
buf_in
(
10
);
for
(
in
t
i
=
0
;
i
<
buf_in
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
buf_in
.
size
();
++
i
)
{
buf_in
[
i
]
=
i
;
}
// Try to override the default binary buffer.
...
...
@@ -1433,7 +1433,7 @@ TEST_F(OptionCustomTest, unpack) {
// Store the collection of IPv4 addresses into the buffer.
OptionBuffer
buf
;
for
(
in
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
writeAddress
(
addresses
[
i
],
buf
);
}
...
...
@@ -1464,7 +1464,7 @@ TEST_F(OptionCustomTest, unpack) {
// Clear the buffer as we need to store new addresses in it.
buf
.
clear
();
for
(
in
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
writeAddress
(
addresses
[
i
],
buf
);
}
...
...
@@ -1495,7 +1495,7 @@ TEST_F(OptionCustomTest, initialize) {
// Store the collection of IPv6 addresses into the buffer.
OptionBuffer
buf
;
for
(
in
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
writeAddress
(
addresses
[
i
],
buf
);
}
...
...
@@ -1525,7 +1525,7 @@ TEST_F(OptionCustomTest, initialize) {
// Clear the buffer as we need to store new addresses in it.
buf
.
clear
();
for
(
in
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addresses
.
size
();
++
i
)
{
writeAddress
(
addresses
[
i
],
buf
);
}
...
...
src/lib/dhcp/tests/option_definition_unittest.cc
View file @
8f19841c
// Copyright (C) 2012-201
4
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-201
5
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
...
...
@@ -356,7 +356,7 @@ TEST_F(OptionDefinitionTest, ipv6AddressArray) {
// Write addresses to the buffer.
OptionBuffer
buf
(
addrs
.
size
()
*
asiolink
::
V6ADDRESS_LEN
);
for
(
in
t
i
=
0
;
i
<
addrs
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addrs
.
size
();
++
i
)
{
const
std
::
vector
<
uint8_t
>&
vec
=
addrs
[
i
].
toBytes
();
ASSERT_EQ
(
asiolink
::
V6ADDRESS_LEN
,
vec
.
size
());
std
::
copy
(
vec
.
begin
(),
vec
.
end
(),
...
...
@@ -454,7 +454,7 @@ TEST_F(OptionDefinitionTest, ipv4AddressArray) {
// Write addresses to the buffer.
OptionBuffer
buf
(
addrs
.
size
()
*
asiolink
::
V4ADDRESS_LEN
);
for
(
in
t
i
=
0
;
i
<
addrs
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
addrs
.
size
();
++
i
)
{
const
std
::
vector
<
uint8_t
>
vec
=
addrs
[
i
].
toBytes
();
ASSERT_EQ
(
asiolink
::
V4ADDRESS_LEN
,
vec
.
size
());
std
::
copy
(
vec
.
begin
(),
vec
.
end
(),
...
...
@@ -613,7 +613,7 @@ TEST_F(OptionDefinitionTest, binary) {
// Prepare some dummy data (serverid): 0, 1, 2 etc.
OptionBuffer
buf
(
14
);
for
(
int
i
=
0
;
i
<
14
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
14
;
++
i
)
{
buf
[
i
]
=
i
;
}
// Create option instance with the factory function.
...
...
@@ -666,7 +666,7 @@ TEST_F(OptionDefinitionTest, recordIA6) {
// Check the positive scenario.
OptionBuffer
buf
(
12
);
for
(
in
t
i
=
0
;
i
<
buf
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
buf
.
size
();
++
i
)
{
buf
[
i
]
=
i
;
}
OptionPtr
option_v6
;
...
...
@@ -708,7 +708,9 @@ TEST_F(OptionDefinitionTest, recordIAAddr6) {
ASSERT_EQ
(
asiolink
::
V6ADDRESS_LEN
,
vec
.
size
());
std
::
copy
(
vec
.
begin
(),
vec
.
end
(),
buf
.
begin
());
for
(
int
i
=
0
;
i
<
option6_iaaddr_len
-
asiolink
::
V6ADDRESS_LEN
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
option6_iaaddr_len
-
asiolink
::
V6ADDRESS_LEN
;
++
i
)
{
buf
.
push_back
(
i
);
}
ASSERT_NO_THROW
(
option_v6
=
opt_def
.
optionFactory
(
Option
::
V6
,
D6O_IAADDR
,
buf
));
...
...
@@ -1030,7 +1032,7 @@ TEST_F(OptionDefinitionTest, uint16Array) {
// multiple of uint16_t size.
// buffer elements will be: 0x112233.
OptionBuffer
buf
(
6
);
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
6
;
++
i
)
{
buf
[
i
]
=
i
/
2
;
}
// Constructor should succeed because buffer has correct size.
...
...
@@ -1042,7 +1044,7 @@ TEST_F(OptionDefinitionTest, uint16Array) {
boost
::
static_pointer_cast
<
OptionIntArray
<
uint16_t
>
>
(
option_v6
);
// Get the values from the initiated options and validate.
std
::
vector
<
uint16_t
>
values
=
option_cast_v6
->
getValues
();
for
(
in
t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
// Expected value is calculated using on the same pattern
// as the one we used to initiate buffer:
// for i=0, expected = 0x00, for i = 1, expected == 0x11 etc.
...
...
@@ -1103,7 +1105,7 @@ TEST_F(OptionDefinitionTest, uint32Array) {
// multiple of uint16_t size.
// buffer elements will be: 0x111122223333.
OptionBuffer
buf
(
12
);
for
(
in
t
i
=
0
;
i
<
buf
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
buf
.
size
();
++
i
)
{
buf
[
i
]
=
i
/
4
;
}
// Constructor should succeed because buffer has correct size.
...
...
@@ -1115,7 +1117,7 @@ TEST_F(OptionDefinitionTest, uint32Array) {
boost
::
static_pointer_cast
<
OptionIntArray
<
uint32_t
>
>
(
option_v6
);
// Get the values from the initiated options and validate.
std
::
vector
<
uint32_t
>
values
=
option_cast_v6
->
getValues
();
for
(
in
t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
// Expected value is calculated using on the same pattern
// as the one we used to initiate buffer:
// for i=0, expected = 0x0000, for i = 1, expected == 0x1111 etc.
...
...
src/lib/dhcp/tests/option_int_array_unittest.cc
View file @
8f19841c
// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012
, 2015
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
...
...
@@ -38,7 +38,7 @@ public:
///
/// Initializes the option buffer with some data.
OptionIntArrayTest
()
:
buf_
(
255
),
out_buf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
src/lib/dhcp/tests/option_int_unittest.cc
View file @
8f19841c
// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012
, 2015
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
...
...
@@ -41,7 +41,7 @@ public:
///
/// Initializes the option buffer with some data.
OptionIntTest
()
:
buf_
(
255
),
out_buf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
src/lib/dhcp/tests/option_unittest.cc
View file @
8f19841c
...
...
@@ -102,7 +102,7 @@ public:
class
OptionTest
:
public
::
testing
::
Test
{
public:
OptionTest
()
:
buf_
(
255
),
outBuf_
(
255
)
{
for
(
int
i
=
0
;
i
<
255
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
255
;
i
++
)
{
buf_
[
i
]
=
255
-
i
;
}
}
...
...
@@ -251,7 +251,7 @@ TEST_F(OptionTest, v6_basic) {
// Tests constructor used in packet reception. Option contains actual data
TEST_F
(
OptionTest
,
v6_data1
)
{
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
32
;
i
++
)
{
buf_
[
i
]
=
100
+
i
;
}
...
...
@@ -324,7 +324,7 @@ TEST_F(OptionTest, v6_data2) {
// +----opt3
//
TEST_F
(
OptionTest
,
v6_suboptions1
)
{
for
(
int
i
=
0
;
i
<
128
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
128
;
i
++
)
{
buf_
[
i
]
=
100
+
i
;
}
...
...
@@ -367,7 +367,7 @@ TEST_F(OptionTest, v6_suboptions1) {
// +----opt3
//
TEST_F
(
OptionTest
,
v6_suboptions2
)
{
for
(
int
i
=
0
;
i
<
128
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
128
;
i
++
)
{
buf_
[
i
]
=
100
+
i
;
}
...
...
@@ -399,7 +399,7 @@ TEST_F(OptionTest, v6_suboptions2) {
}
TEST_F
(
OptionTest
,
v6_addgetdel
)
{
for
(
int
i
=
0
;
i
<
128
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
128
;
i
++
)
{
buf_
[
i
]
=
100
+
i
;
}
...
...
src/lib/dhcp/tests/pkt4_unittest.cc
View file @
8f19841c
...
...
@@ -275,7 +275,7 @@ TEST_F(Pkt4Test, constructor) {
// Just some dummy payload.
uint8_t
testData
[
250
];
for
(
int
i
=
0
;
i
<
250
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
250
;
i
++
)
{
testData
[
i
]
=
i
;
}
...
...
@@ -418,7 +418,7 @@ TEST_F(Pkt4Test, hwAddr) {
mac
[
i
]
=
0
;
expectedChaddr
[
i
]
=
0
;
}
for
(
int
i
=
0
;
i
<
macLen
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
macLen
;
i
++
)
{
mac
[
i
]
=
128
+
i
;
expectedChaddr
[
i
]
=
128
+
i
;
}
...
...
@@ -492,10 +492,10 @@ TEST_F(Pkt4Test, sname) {
scoped_ptr
<
Pkt4
>
pkt
;
// Let's test each sname length, from 0 till 64
for
(
int
snameLen
=
0
;
snameLen
<
Pkt4
::
MAX_SNAME_LEN
;
++
snameLen
)
{
for
(
int
i
=
0
;
i
<
snameLen
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
snameLen
;
++
i
)
{
sname
[
i
]
=
i
+
1
;
}
for
(
int
i
=
snameLen
;
i
<
Pkt4
::
MAX_SNAME_LEN
;
++
i
)
{
for
(
unsigned
i
=
snameLen
;
i
<
Pkt4
::
MAX_SNAME_LEN
;
++
i
)
{
sname
[
i
]
=
0
;
}
...
...
@@ -530,10 +530,10 @@ TEST_F(Pkt4Test, file) {
scoped_ptr
<
Pkt4
>
pkt
;
// Let's test each file length, from 0 till 128.
for
(
int
fileLen
=
0
;
fileLen
<
Pkt4
::
MAX_FILE_LEN
;
++
fileLen
)
{
for
(
int
i
=
0
;
i
<
fileLen
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
fileLen
;
++
i
)
{
file
[
i
]
=
i
+
1
;
}
for
(
int
i
=
fileLen
;
i
<
Pkt4
::
MAX_FILE_LEN
;
++
i
)
{
for
(
unsigned
i
=
fileLen
;
i
<
Pkt4
::
MAX_FILE_LEN
;
++
i
)
{
file
[
i
]
=
0
;
}
...
...
@@ -565,7 +565,7 @@ TEST_F(Pkt4Test, options) {
scoped_ptr
<
Pkt4
>
pkt
(
new
Pkt4
(
DHCPOFFER
,
0
));
vector
<
uint8_t
>
payload
[
5
];
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
5
;
i
++
)
{
payload
[
i
].
push_back
(
i
*
10
);
payload
[
i
].
push_back
(
i
*
10
+
1
);
payload
[
i
].
push_back
(
i
*
10
+
2
);
...
...
src/lib/dhcp/tests/pkt6_unittest.cc
View file @
8f19841c
...
...
@@ -512,7 +512,7 @@ TEST_F(Pkt6Test, Timestamp) {
// packet type names.
TEST_F
(
Pkt6Test
,
getName
)
{
// Check all possible packet types
for
(
int
itype
=
0
;
itype
<
256
;
++
itype
)
{
for
(
unsigned
itype
=
0
;
itype
<
256
;
++
itype
)
{
uint8_t
type
=
itype
;
switch
(
type
)
{
...
...
src/lib/dhcp/tests/protocol_util_unittest.cc
View file @
8f19841c
// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013
, 2015
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
...
...
@@ -247,12 +247,12 @@ TEST(ProtocolUtilTest, writeEthernetHeader) {
// get exact values that are mismatched. If memcmp was used
// the error message would not indicate the values of
// mismatched bytes.
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
6
;
++
i
)
{
EXPECT_EQ
(
dest_hw_addr
[
i
],
buf
[
i
]);
}
// Verify that following 6 bytes comprise the valid source
// HW address.
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
6
;
++
i
)
{
EXPECT_EQ
(
src_hw_addr
[
i
],
buf
[
i
+
6
]);
}
...
...
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
View file @
8f19841c
...
...
@@ -254,7 +254,7 @@ HooksLibrariesParser::build(ConstElementPtr value) {
// Construct the list of libraries in error for the message.
string
error_list
=
error_libs
[
0
];
for
(
in
t
i
=
1
;
i
<
error_libs
.
size
();
++
i
)
{
for
(
size_
t
i
=
1
;
i
<
error_libs
.
size
();
++
i
)
{
error_list
+=
(
string
(
", "
)
+
error_libs
[
i
]);
}
isc_throw
(
DhcpConfigError
,
"hooks libraries failed to validate - "
...
...
src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
View file @
8f19841c
...
...
@@ -62,7 +62,7 @@ CfgHostsTest::CfgHostsTest() {
const
uint8_t
mac_template
[]
=
{
0x01
,
0x02
,
0x0A
,
0xBB
,
0x03
,
0x00
};
for
(
int
i
=
0
;
i
<
50
;
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
50
;
++
i
)
{
std
::
vector
<
uint8_t
>
vec
(
mac_template
,