1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 13:04:28 +01:00

Fixed lots of warnings in test cases, due to narrowing conversions.

This commit is contained in:
Matias Fontanini
2013-03-18 11:32:34 -03:00
parent a8edc2af74
commit 0f27b04a92
37 changed files with 216 additions and 305 deletions

View File

@@ -68,7 +68,6 @@ void Dot1Q::cfi(small_uint<1> new_cfi) {
}
void Dot1Q::id(small_uint<12> new_id) {
uint16_t value = new_id;
_header.idL = new_id & 0xff;
_header.idH = new_id >> 8;
}

View File

@@ -29,10 +29,8 @@ const address_type ARPTest::empty_addr;
const address_type ARPTest::hw_addr1("13:da:de:f1:01:85");
const address_type ARPTest::hw_addr2("7a:1f:f4:39:ab:0d");
const uint8_t ARPTest::expected_packet[] = {
'\x00', '\x01', '\x08', '\x00', '\x06', '\x04', '\x00', '\x02',
'\x03', '\xde', '\xf5', '\x12', '\t', '\xfa', '\xc0', '\xa8', '-',
'\xe7', '\xf5', '\x12', '\xda', 'g', '\xbd', '\r', ' ', '\x9b', 'Q',
'\xfe'
0, 1, 8, 0, 6, 4, 0, 2, 3, 222, 245, 18, 9, 250, 192, 168, 45, 231,
245, 18, 218, 103, 189, 13, 32, 155, 81, 254
};
const IPv4Address ARPTest::addr1(0x1234), ARPTest::addr2(0xa3f1);

View File

@@ -40,37 +40,19 @@ const uint8_t DHCPTest::file[] = "\x16\xab\x54\x12\xfa\xca\x56\x7f\x1b\x65\x11\x
const IPv4Address DHCPTest::addr("192.168.8.1");
const uint8_t DHCPTest::expected_packet[] = {
'\x01', '\x01', '\x06', '\x1f', '?', '\xab', '#', '\xde', '\x9f',
'\x1a', '\x00', '\x00', '\xc0', '\xa8', '\x00', 'f', '\xf3', '\x16',
'"', 'b', '\xa7', ' ', '\x0b', '\x9a', '{', '+', '7', '\xfe', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'c', '\x82', 'S', 'c', '6', '\x04', '\xc0', '\xa8', '\x04', '\x02',
'\x01', '\x04', '\xff', '\xff', ' ', '\x0b', '5', '\x01', '\x04', '\x03',
'\x08', '\xc0', '\xa8', '\x00', '\x01', '\x7f', '\x00', '\x00', '\x01',
'\x06', '\x08', '\xc0', '\xa8', '\x00', '\x02', '\x7f', '\x00', '\x00',
'\x01'
1, 1, 6, 31, 63, 171, 35, 222, 159, 26, 0, 0, 192, 168, 0, 102, 243,
22, 34, 98, 167, 32, 11, 154, 123, 43, 55, 254, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 130, 83, 99,
54, 4, 192, 168, 4, 2, 1, 4, 255, 255, 32, 11, 53, 1, 4, 3, 8, 192,
168, 0, 1, 127, 0, 0, 1, 6, 8, 192, 168, 0, 2, 127, 0, 0, 1
};
TEST_F(DHCPTest, DefaultConstructor) {

View File

@@ -14,12 +14,9 @@ public:
};
const uint8_t DHCPv6Test::expected_packet[] = {
'\x01', '\xe8', '(', '\xb9', '\x00', '\x01', '\x00', '\n', '\x00',
'\x03', '\x00', '\x01', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x00', '\x03', '\x00', '\x0c', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x08', '\x00', '\x02', '\x00', '\x00', '\x00',
'\x06', '\x00', '\x02', '\x00', '\x03'
1, 232, 40, 185, 0, 1, 0, 10, 0, 3, 0, 1, 0, 1, 2, 3, 4, 5, 0, 3, 0,
12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 2, 0, 0, 0, 6, 0,
2, 0, 3
};
TEST_F(DHCPv6Test, DefaultConstructor) {

View File

@@ -17,7 +17,10 @@ public:
};
const uint8_t DNSTest::expected_packet[] = {
'\x00', '\x13', '\xd7', '\x9a', '\x00', '\x01', '\x00', '\x01', '\x00', '\x00', '\x00', '\x00', '\x03', 'w', 'w', 'w', '\x07', 'e', 'x', 'a', 'm', 'p', 'l', 'e', '\x03', 'c', 'o', 'm', '\x00', '\x00', '\x01', '\x00', '\x01', '\x03', 'w', 'w', 'w', '\x07', 'e', 'x', 'a', 'm', 'p', 'l', 'e', '\x03', 'c', 'o', 'm', '\x00', '\x00', '\x01', '\x00', '\x01', '\x00', '\x00', '\x12', '4', '\x00', '\x04', '\xc0', '\xa8', '\x00', '\x01'
0, 19, 215, 154, 0, 1, 0, 1, 0, 0, 0, 0, 3, 119, 119, 119, 7, 101,
120, 97, 109, 112, 108, 101, 3, 99, 111, 109, 0, 0, 1, 0, 1, 3, 119,
119, 119, 7, 101, 120, 97, 109, 112, 108, 101, 3, 99, 111, 109, 0,
0, 1, 0, 1, 0, 0, 18, 52, 0, 4, 192, 168, 0, 1
};

View File

@@ -20,7 +20,7 @@ public:
const address_type Dot11AckTest::empty_addr;
const uint8_t Dot11AckTest::expected_packet[] = {
'\xd5', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05'
213, 1, 79, 35, 0, 1, 2, 3, 4, 5
};
void test_equals(const Dot11Ack &dot1, const Dot11Ack &dot2) {

View File

@@ -19,10 +19,8 @@ public:
};
const uint8_t Dot11AssocRequestTest::expected_packet[] = {
'\x01', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\x15',
' ', '\xf3', '\x92'
1, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
0, 0, 21, 32, 243, 146
};
void test_equals(const Dot11AssocRequest &dot1, const Dot11AssocRequest &dot2) {

View File

@@ -18,10 +18,8 @@ public:
};
const uint8_t Dot11AssocResponseTest::expected_packet[] = {
'\x11', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00',
'\x15', ' ', '\xf3', '\x92', ':', '\xf2'
17, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
0, 0, 21, 32, 243, 146, 58, 242
};
void test_equals(const Dot11AssocResponse &dot1, const Dot11AssocResponse &dot2) {

View File

@@ -18,10 +18,8 @@ public:
};
const uint8_t Dot11AuthenticationTest::expected_packet[] = {
'\xb1', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\xa2',
'(', ':', '\xf2', '\xf3', '\x92'
177, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6,
7, 0, 0, 162, 40, 58, 242, 243, 146
};
void test_equals(const Dot11Authentication &dot1, const Dot11Authentication &dot2) {

View File

@@ -23,11 +23,8 @@ const address_type Dot11BeaconTest::empty_addr,
Dot11BeaconTest::hwaddr("72:91:34:fa:de:ad");
const uint8_t Dot11BeaconTest::expected_packet[] = {
'\x81', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\xfa',
'\x01', '\x93', '(', 'A', '#', '\xad', '\x1f', '\xfa', '\x14',
'\x95', ' '
129, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6,
7, 0, 0, 250, 1, 147, 40, 65, 35, 173, 31, 250, 20, 149, 32
};
void test_equals_expected(const Dot11Beacon &dot11) {
@@ -391,22 +388,14 @@ TEST_F(Dot11BeaconTest, RSNInformationTest) {
TEST_F(Dot11BeaconTest, PCAPLoad1) {
const uint8_t buffer[] = {
'\x80', '\x00', '\x00', '\x00', '\xff', '\xff', '\xff', '\xff',
'\xff', '\xff', '\xf4', '\xec', '8', '\xfe', 'M', '\x92', '\xf4',
'\xec', '8', '\xfe', 'M', '\x92', '\xe0', '\xea', '\x80', '\xd1',
'\xd4', '\xce', ',', '\x00', '\x00', '\x00', 'd', '\x00', '1',
'\x04', '\x00', '\x07', 'S', 'e', 'g', 'u', 'n', 'd', 'o', '\x01',
'\x08', '\x82', '\x84', '\x8b', '\x96', '\x0c', '\x12', '\x18', '$',
'\x03', '\x01', '\x01', '\x05', '\x04', '\x00', '\x01', '\x00',
'\x00', '\x07', '\x06', 'U', 'S', ' ', '\x01', '\r', '\x14', '*',
'\x01', '\x00', '0', '\x14', '\x01', '\x00', '\x00', '\x0f', '\xac',
'\x04', '\x01', '\x00', '\x00', '\x0f', '\xac', '\x04', '\x01',
'\x00', '\x00', '\x0f', '\xac', '\x02', '\x00', '\x00', '2', '\x04',
'0', 'H', '`', 'l', '\xdd', '\x18', '\x00', 'P', '\xf2', '\x02',
'\x01', '\x01', '\x03', '\x00', '\x03', '\xa4', '\x00', '\x00',
'\'', '\xa4', '\x00', '\x00', 'B', 'C', '^', '\x00', 'b', '2',
'/', '\x00', '\xdd', '\t', '\x00', '\x03', '\x7f', '\x01', '\x01',
'\x00', '\x00', '\xff', '\x7f'
128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 244, 236, 56, 254, 77,
146, 244, 236, 56, 254, 77, 146, 224, 234, 128, 209, 212, 206, 44,
0, 0, 0, 100, 0, 49, 4, 0, 7, 83, 101, 103, 117, 110, 100, 111, 1,
8, 130, 132, 139, 150, 12, 18, 24, 36, 3, 1, 1, 5, 4, 0, 1, 0, 0, 7,
6, 85, 83, 32, 1, 13, 20, 42, 1, 0, 48, 20, 1, 0, 0, 15, 172, 4, 1,
0, 0, 15, 172, 4, 1, 0, 0, 15, 172, 2, 0, 0, 50, 4, 48, 72, 96, 108,
221, 24, 0, 80, 242, 2, 1, 1, 3, 0, 3, 164, 0, 0, 39, 164, 0, 0, 66,
67, 94, 0, 98, 50, 47, 0, 221, 9, 0, 3, 127, 1, 1, 0, 0, 255, 127
};
typedef Dot11Beacon::country_params::container_type country_container;
Dot11Beacon dot11(buffer, sizeof(buffer));

View File

@@ -18,8 +18,7 @@ public:
};
const uint8_t Dot11CFEndTest::expected_packet[] = {
'\xe5', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06'
229, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6
};
void test_equals(const Dot11CFEnd &dot1, const Dot11CFEnd &dot2) {

View File

@@ -18,8 +18,7 @@ public:
};
const uint8_t Dot11EndCFAckTest::expected_packet[] = {
'\xf5', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06'
245, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6
};
void test_equals(const Dot11EndCFAck &dot1, const Dot11EndCFAck &dot2) {

View File

@@ -18,9 +18,8 @@ public:
};
const uint8_t Dot11DataTest::expected_packet[] = {
'\t', '\x00', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\xda', '\xf1'
9, 0, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
218, 241
};
TEST_F(Dot11DataTest, Constructor) {
@@ -77,22 +76,15 @@ TEST_F(Dot11DataTest, FromBytes) {
TEST_F(Dot11DataTest, PCAPLoad1) {
const uint8_t buffer[] = {
'\x08', 'B', '\xd4', '\x00', '\x00', '$', '!', '\x92', '\xa7',
'S', '\x00', '\x1b', '\x11', '\xd2', '\x1b', '\xeb', '\x00',
'\x1b', '\x11', '\xd2', '\x1b', '\xeb', '\x90', 'y', '\xa3',
'_', '\x00', ' ', '\x00', '\x00', '\x00', '\x00', '\xf0', '\xef',
'\xb5', '\xf9', '4', '\xcb', '\x00', ',', 'D', '\xe4', '\xba',
'"', '\xa7', '/', '/', 'G', '\x04', '\xd5', 'o', 'N', '\xeb',
'6', '[', '\xc3', 'D', 't', 'y', '\xec', '\x84', '\xf2', '`',
' ', 'X', '\x1e', 'p', '\xa2', 'z', '\x02', '\x1a', '7', '\xd2',
'\xf2', '\n', '\x1c', '\xc7', 'z', 'D', '\xc4', '\xc4', '\xbc',
'G', '_', '\x9f', '\xcf', '\xbc', '\xa2', '\xb7', '\xaf', '\xed',
'\xe0', '\xcc', '\xb9', '\x9e', '\x94', ' ', '\xee', 'F', '\x89',
'1', '\xab', '\xe7', '\xb8', 'I', '\xaf', '\xc3', '\xf4', '\xc5',
'\x95', '\x1c', '\x8d', '\x1a', '\xf8', ':', '\xbd', '\x95',
'\xbf', 'y', '\xce', '\xda', 'x', 's', '@', '\xe0', '>', '\xa1',
'B', '\x94', '\xd9', '\xb1', '\xa6', '\x17', '\xee', '\xb4',
'\x95', 'E'
8, 66, 212, 0, 0, 36, 33, 146, 167, 83, 0, 27, 17, 210, 27, 235, 0,
27, 17, 210, 27, 235, 144, 121, 163, 95, 0, 32, 0, 0, 0, 0, 240, 239,
181, 249, 52, 203, 0, 44, 68, 228, 186, 34, 167, 47, 47, 71, 4, 213,
111, 78, 235, 54, 91, 195, 68, 116, 121, 236, 132, 242, 96, 32, 88,
30, 112, 162, 122, 2, 26, 55, 210, 242, 10, 28, 199, 122, 68, 196,
196, 188, 71, 95, 159, 207, 188, 162, 183, 175, 237, 224, 204, 185,
158, 148, 32, 238, 70, 137, 49, 171, 231, 184, 73, 175, 195, 244, 197,
149, 28, 141, 26, 248, 58, 189, 149, 191, 121, 206, 218, 120, 115,
64, 224, 62, 161, 66, 148, 217, 177, 166, 23, 238, 180, 149, 69
};
Dot11Data dot1(buffer, sizeof(buffer));
EXPECT_EQ(dot1.addr1(), "00:24:21:92:a7:53");

View File

@@ -18,10 +18,8 @@ public:
};
const uint8_t Dot11DeauthenticationTest::expected_packet[] = {
'\xc1', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\xf3',
'\x92'
193, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6,
7, 0, 0, 243, 146
};
void test_equals(const Dot11Deauthentication &dot1, const Dot11Deauthentication &dot2) {

View File

@@ -19,9 +19,8 @@ public:
};
const uint8_t Dot11DisassocTest::expected_packet[] = {
'\xa1', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\x12', '#'
161, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6,
7, 0, 0, 18, 35
};
void test_equals(const Dot11Disassoc &dot1, const Dot11Disassoc &dot2) {

View File

@@ -23,7 +23,7 @@ const address_type Dot11Test::empty_addr,
const uint8_t Dot11Test::expected_packet[] = {
'5', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05'
53, 1, 79, 35, 0, 1, 2, 3, 4, 5
};
TEST_F(Dot11Test, DefaultConstructor) {

View File

@@ -18,9 +18,8 @@ public:
};
const uint8_t Dot11ProbeRequestTest::expected_packet[] = {
'A', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00'
65, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
0, 0
};
void test_equals(const Dot11ProbeRequest &dot1, const Dot11ProbeRequest &dot2) {

View File

@@ -18,11 +18,8 @@ public:
};
const uint8_t Dot11ProbeResponseTest::expected_packet[] = {
'Q', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\x91',
'\x8a', '\x83', '\'', '\xdf', '\x98', '\xa6', '\x17', '\x8d',
'\x92', '\x00', '\x00'
81, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
0, 0, 145, 138, 131, 39, 223, 152, 166, 23, 141, 146, 0, 0
};
void test_equals(const Dot11ProbeResponse &dot1, const Dot11ProbeResponse &dot2) {

View File

@@ -18,8 +18,7 @@ public:
};
const uint8_t Dot11PSPollTest::expected_packet[] = {
'\xa5', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06'
165, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6
};
void test_equals(const Dot11PSPoll &dot1, const Dot11PSPoll &dot2) {

View File

@@ -18,10 +18,8 @@ public:
};
const uint8_t Dot11ReAssocRequestTest::expected_packet[] = {
'!', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\x15',
' ', '\xf3', '\x92', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08'
33, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
0, 0, 21, 32, 243, 146, 3, 4, 5, 6, 7, 8
};
void test_equals(const Dot11ReAssocRequest &dot1, const Dot11ReAssocRequest &dot2) {

View File

@@ -18,10 +18,8 @@ public:
};
const uint8_t Dot11ReAssocResponseTest::expected_packet[] = {
'1', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\x15',
' ', '\xf3', '\x92', ':', '\xf2'
49, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7,
0, 0, 21, 32, 243, 146, 58, 242
};
void test_equals(const Dot11ReAssocResponse &dot1, const Dot11ReAssocResponse &dot2) {

View File

@@ -18,8 +18,7 @@ public:
};
const uint8_t Dot11RTSTest::expected_packet[] = {
'\xb5', '\x01', 'O', '#', '\x00', '\x01', '\x02', '\x03', '\x04',
'\x05', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06'
181, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6
};
void test_equals(const Dot11RTS &dot1, const Dot11RTS &dot2) {

View File

@@ -17,14 +17,11 @@ public:
};
const uint8_t Dot1QTest::expected_packet[] = {
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\x00', '\x19', '\x06',
'\xea', '\xb8', '\xc1', '\x81', '\x00', '\xb0', '{', '\x08', '\x06',
'\x00', '\x01', '\x08', '\x00', '\x06', '\x04', '\x00', '\x02', '\x00',
'\x19', '\x06', '\xea', '\xb8', '\xc1', '\xc0', '\xa8', '{', '\x01',
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xc0', '\xa8', '{',
'\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00'
255, 255, 255, 255, 255, 255, 0, 25, 6, 234, 184, 193, 129, 0, 176,
123, 8, 6, 0, 1, 8, 0, 6, 4, 0, 2, 0, 25, 6, 234, 184, 193, 192, 168,
123, 1, 255, 255, 255, 255, 255, 255, 192, 168, 123, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
TEST_F(Dot1QTest, DefaultConstructor) {

View File

@@ -24,24 +24,16 @@ public:
};
const uint8_t EthernetIITest::expected_packet[] = {
'\xaa', '\xbb', '\xcc', '\xdd',
'\xee', '\xff', '\x8a', '\x8b',
'\x8c', '\x8d', '\x8e', '\x8f',
'\xd0', '\xab'
170, 187, 204, 221, 238, 255, 138, 139, 140, 141, 142, 143, 208, 171
},
EthernetIITest::ip_packet[] = {
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x08', '\x00', 'E', '\x00', '\x00', '\x14',
'\x00', '\x01', '\x00', '\x00', '@', '\x00', '|', '\xe7', '\x7f', '\x00',
'\x00', '\x01', '\x7f', '\x00', '\x00', '\x01'
255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 8, 0, 69, 0, 0, 20,
0, 1, 0, 0, 64, 0, 124, 231, 127, 0, 0, 1, 127, 0, 0, 1
},
EthernetIITest::ipv6_packet[] = {
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x86', '\xdd', '`', '\x00', '\x00', '\x00',
'\x00', '\x00', ';', '@', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x01'
255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 134, 221, 96, 0, 0,
0, 0, 0, 59, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
address_type EthernetIITest::src_addr("8a:8b:8c:8d:8e:8f");

View File

@@ -17,8 +17,8 @@ public:
};
const uint8_t ICMPTest::expected_packets[][8] = {
{'\x08', '\x01', '\xad', '{', 'V', '\xd1', '\xf3', '\xb1' },
{'\x0c', '\x00', 't', '\xff', '\x7f', '\x00', '\x00', '\x00'}
{ 8, 1, 173, 123, 86, 209, 243, 177 },
{ 12, 0, 116, 255, 127, 0, 0, 0 }
};
const uint32_t ICMPTest::expected_packet_count = 1;

View File

@@ -19,19 +19,16 @@ public:
};
const uint8_t ICMPv6Test::expected_packet[] = {
'\x88', '\x00', '\xdc', '\x15', '\xc0', '\x00', '\x00', '\x00', '?',
'\xfe', '\x05', '\x07', '\x00', '\x00', '\x00', '\x01', '\x02', '`',
'\x97', '\xff', '\xfe', '\x07', 'i', '\xea'
136, 0, 220, 21, 192, 0, 0, 0, 63, 254, 5, 7, 0, 0, 0, 1, 2, 96, 151,
255, 254, 7, 105, 234
};
const uint8_t ICMPv6Test::expected_packet1[] = {
'\x86', '\x00', 'F', '%', '@', '\x00', '\x07', '\x08', '\x00', '\x00',
'u', '0', '\x00', '\x00', '\x03', '\xe8', '\x01', '\x01', '\x00', '`',
'\x97', '\x07', 'i', '\xea', '\x05', '\x01', '\x00', '\x00', '\x00',
'\x00', '\x05', '\xdc', '\x03', '\x04', '@', '\xc0', '\x00', '6',
'\xee', '\x80', '\x00', '6', '\xee', '\x80', '\x00', '\x00', '\x00',
'\x00', '?', '\xfe', '\x05', '\x07', '\x00', '\x00', '\x00', '\x01',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00'
134, 0, 70, 37, 64, 0, 7, 8, 0, 0, 117, 48, 0, 0, 3, 232, 1, 1, 0,
96, 151, 7, 105, 234, 5, 1, 0, 0, 0, 0, 5, 220, 3, 4, 64, 192, 0, 54,
238, 128, 0, 54, 238, 128, 0, 0, 0, 0, 63, 254, 5, 7, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0
};
TEST_F(ICMPv6Test, Constructor) {

View File

@@ -20,10 +20,8 @@ public:
};
const uint8_t IPTest::expected_packet[] = {
'(', '\x7f', '\x00', ' ', '\x00', 'z', '\x00', 'C', '\x15', '\x01',
'\xfb', 'g', 'T', '4', '\xfe', '\x05', '\xc0', '\xa8', '\t', '+',
'\x82', '\x0b', 't', 'j', 'g', '\xab', 'w', '\xab', 'h', 'e', 'l',
'\x00'
40, 127, 0, 32, 0, 122, 0, 67, 21, 1, 251, 103, 84, 52, 254, 5, 192,
168, 9, 43, 130, 11, 116, 106, 103, 171, 119, 171, 104, 101, 108, 0
};

View File

@@ -21,27 +21,17 @@ public:
};
const uint8_t IPv6Test::expected_packet1[] = {
'i', '\xa8', '\'', '4', '\x00', '(', '\x06', '@', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x01', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x01', '\xc6', '\x8c', '\x00', 'P', 'h', 'H', '\x03',
'\x0c', '\x00', '\x00', '\x00', '\x00', '\xa0', '\x02', '\x7f', '\xf0',
'\x00', '0', '\x00', '\x00', '\x02', '\x04', '?', '\xf8', '\x04',
'\x02', '\x08', '\n', '\x00', '\x84', '\xa3', '\x9c', '\x00', '\x00',
'\x00', '\x00', '\x01', '\x03', '\x03', '\x07'
105, 168, 39, 52, 0, 40, 6, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 198, 140,
0, 80, 104, 72, 3, 12, 0, 0, 0, 0, 160, 2, 127, 240, 0, 48, 0, 0, 2,
4, 63, 248, 4, 2, 8, 10, 0, 132, 163, 156, 0, 0, 0, 0, 1, 3, 3, 7
};
const uint8_t IPv6Test::expected_packet2[] = {
'`', '\x00', '\x00', '\x00', '\x00', '$', '\x00', '\x01', '\xfe',
'\x80', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x02',
'\xd0', '\t', '\xff', '\xfe', '\xe3', '\xe8', '\xde', '\xff', '\x02',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x16', ':', '\x00', '\x05', '\x02',
'\x00', '\x00', '\x01', '\x00', '\x8f', '\x00', 't', '\xfe', '\x00',
'\x00', '\x00', '\x01', '\x04', '\x00', '\x00', '\x00', '\xff', '\x02',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x01', '\xff', '\x98', '\x06', '\xe1'
96, 0, 0, 0, 0, 36, 0, 1, 254, 128, 0, 0, 0, 0, 0, 0, 2, 208, 9, 255,
254, 227, 232, 222, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 58, 0, 5, 2, 0, 0, 1, 0, 143, 0, 116, 254, 0, 0, 0, 1, 4, 0, 0,
0, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 255, 152, 6, 225
};
void IPv6Test::test_equals(IPv6 &ip1, IPv6 &ip2) {

View File

@@ -17,9 +17,15 @@ public:
//void test_equals(const IP &ip1, const IP &ip2);
};
const uint8_t LLCTest::from_buffer_info[] = {'\xfe', '\x48', '\x3c', '\x3b'};
const uint8_t LLCTest::from_buffer_super[] = {'\x4b', '\x19', '\x05', '\x3a'};
const uint8_t LLCTest::from_buffer_unnumbered[] = {'\xaa', '\x17', '\xcf'};
const uint8_t LLCTest::from_buffer_info[] = {
254, 72, 60, 59
};
const uint8_t LLCTest::from_buffer_super[] = {
75, 25, 5, 58
};
const uint8_t LLCTest::from_buffer_unnumbered[] = {
170, 23, 207
};
TEST_F(LLCTest, DefaultConstructor) {

View File

@@ -15,29 +15,38 @@ public:
};
const uint8_t RadioTapTest::expected_packet[] = {
'\x00', '\x00', ' ', '\x00', 'g', '\x08', '\x04', '\x00', 'T', '\xc6',
'\xb8', '$', '\x00', '\x00', '\x00', '\x00', '\x10', '\x0c', '\xda',
'\xa0', '\x02', '\x00', '\x00', '\x00', '@', '\x01', '\x00', '\x00',
'<', '\x14', '$', '\x11', '\x80', '\x00', '\x00', '\x00', '\xff',
'\xff', '\xff', '\xff', '\xff', '\xff', '\x06', '\x03', '\x7f',
'\x07', '\xa0', '\x16', '\x06', '\x03', '\x7f', '\x07', '\xa0',
'\x16', '\xb0', 'w', ':', '@', '\xcb', '&', '\x00', '\x00', '\x00',
'\x00', 'd', '\x00', '\x01', '\x05', '\x00', '\n', 'f', 'r', 'e',
'e', 'b', 's', 'd', '-', 'a', 'p', '\x01', '\x08', '\x8c', '\x12',
'\x98', '$', '\xb0', 'H', '`', 'l', '\x03', '\x01', '$', '\x05',
'\x04', '\x00', '\x01', '\x00', '\x00', '\x07', '*', 'U', 'S', ' ',
'$', '\x01', '\x11', '(', '\x01', '\x11', ',', '\x01', '\x11', '0',
'\x01', '\x11', '4', '\x01', '\x17', '8', '\x01', '\x17', '<', '\x01',
'\x17', '@', '\x01', '\x17', '\x95', '\x01', '\x1e', '\x99', '\x01',
'\x1e', '\x9d', '\x01', '\x1e', '\xa1', '\x01', '\x1e', '\xa5', '\x01',
'\x1e', ' ', '\x01', '\x00', '\xdd', '\x18', '\x00', 'P', '\xf2',
'\x02', '\x01', '\x01', '\x00', '\x00', '\x03', '\xa4', '\x00', '\x00',
'\'', '\xa4', '\x00', '\x00', 'B', 'C', '^', '\x00', 'b', '2', '/', '\x00',
'\xe5', '\x2d', '\x92', '\x11'
0, 0, 32, 0, 103, 8, 4, 0, 84, 198, 184, 36, 0, 0, 0, 0, 16, 12, 218,
160, 2, 0, 0, 0, 64, 1, 0, 0, 60, 20, 36, 17, 128, 0, 0, 0, 255, 255,
255, 255, 255, 255, 6, 3, 127, 7, 160, 22, 6, 3, 127, 7, 160, 22, 176,
119, 58, 64, 203, 38, 0, 0, 0, 0, 100, 0, 1, 5, 0, 10, 102, 114, 101,
101, 98, 115, 100, 45, 97, 112, 1, 8, 140, 18, 152, 36, 176, 72, 96,
108, 3, 1, 36, 5, 4, 0, 1, 0, 0, 7, 42, 85, 83, 32, 36, 1, 17, 40,
1, 17, 44, 1, 17, 48, 1, 17, 52, 1, 23, 56, 1, 23, 60, 1, 23, 64, 1,
23, 149, 1, 30, 153, 1, 30, 157, 1, 30, 161, 1, 30, 165, 1, 30, 32,
1, 0, 221, 24, 0, 80, 242, 2, 1, 1, 0, 0, 3, 164, 0, 0, 39, 164, 0,
0, 66, 67, 94, 0, 98, 50, 47, 0, 229, 45, 146, 17
};
const uint8_t RadioTapTest::expected_packet1[] = {
'\x00', '\x00', '\x1a', '\x00', '/', 'H', '\x00', '\x00', '\x07', '\xd6', 'n', '\xa6', '\x00', '\x00', '\x00', '\x00', '\x10', '\x02', 'l', '\t', '\xa0', '\x00', '\xb0', '\x01', '\x00', '\x00', '\x80', '\x00', '\x00', '\x00', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '|', 'O', '\xb5', '\x93', 'r', '\\', '|', 'O', '\xb5', '\x93', 'r', '\\', '\x80', 'h', 'G', 'Q', '8', '=', '\x91', '\x08', '\x00', '\x00', 'd', '\x00', '\x11', '\x04', '\x00', '\r', 'A', 'R', 'V', '7', '5', '1', '9', '9', '3', '7', '2', '5', 'C', '\x01', '\x08', '\x82', '\x84', '\x8b', '\x96', '\x12', '$', 'H', 'l', '\x03', '\x01', '\x01', '2', '\x04', '\x0c', '\x18', '0', '`', '\x07', '\x06', 'N', 'L', ' ', '\x01', '\r', '\x14', '3', '\x08', ' ', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '3', '\x08', '!', '\x05', '\x06', '\x07', '\x08', '\t', '\n', '\x0b', '\xdd', '\x0e', '\x00', 'P', '\xf2', '\x04', '\x10', 'J', '\x00', '\x01', '\x10', '\x10', 'D', '\x00', '\x01', '\x02', '\x05', '\x04', '\x00', '\x01', '\x00', '\x00', '*', '\x01', '\x04', '-', '\x1a', 'l', '\x00', '\x17', '\xff', '\xff', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '=', '\x16', '\x01', '\x03', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x7f', '\x01', '\x01', '\xdd', '\x18', '\x00', 'P', '\xf2', '\x01', '\x01', '\x00', '\x00', 'P', '\xf2', '\x02', '\x01', '\x00', '\x00', 'P', '\xf2', '\x02', '\x01', '\x00', '\x00', 'P', '\xf2', '\x02', '\x00', '\x00', '0', '\x14', '\x01', '\x00', '\x00', '\x0f', '\xac', '\x02', '\x01', '\x00', '\x00', '\x0f', '\xac', '\x04', '\x01', '\x00', '\x00', '\x0f', '\xac', '\x02', '\x01', '\x00', '\xdd', '\x18', '\x00', 'P', '\xf2', '\x02', '\x01', '\x01', '\x00', '\x00', '\x03', '\xa4', '\x00', '\x00', '\'', '\xa4', '\x00', '\x00', 'B', 'C', '^', '\x00', 'b', '2', '/', '\x00', '\x0b', '\x05', '\x00', '\x00', '\'', 'z', '\x12', '\xdd', '\x1e', '\x00', '\x90', 'L', '3', 'l', '\x00', '\x17', '\xff', '\xff', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\xdd', '\x1a', '\x00', '\x90', 'L', '4', '\x01', '\x03', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x91', '\x8b', '<', '\xb2'
0, 0, 26, 0, 47, 72, 0, 0, 7, 214, 110, 166, 0, 0, 0, 0, 16, 2, 108,
9, 160, 0, 176, 1, 0, 0, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255,
124, 79, 181, 147, 114, 92, 124, 79, 181, 147, 114, 92, 128, 104, 71,
81, 56, 61, 145, 8, 0, 0, 100, 0, 17, 4, 0, 13, 65, 82, 86, 55, 53,
49, 57, 57, 51, 55, 50, 53, 67, 1, 8, 130, 132, 139, 150, 18, 36, 72,
108, 3, 1, 1, 50, 4, 12, 24, 48, 96, 7, 6, 78, 76, 32, 1, 13, 20, 51,
8, 32, 1, 2, 3, 4, 5, 6, 7, 51, 8, 33, 5, 6, 7, 8, 9, 10, 11, 221,
14, 0, 80, 242, 4, 16, 74, 0, 1, 16, 16, 68, 0, 1, 2, 5, 4, 0, 1, 0,
0, 42, 1, 4, 45, 26, 108, 0, 23, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 22, 1, 3, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 1, 1, 221, 24, 0,
80, 242, 1, 1, 0, 0, 80, 242, 2, 1, 0, 0, 80, 242, 2, 1, 0, 0, 80,
242, 2, 0, 0, 48, 20, 1, 0, 0, 15, 172, 2, 1, 0, 0, 15, 172, 4, 1,
0, 0, 15, 172, 2, 1, 0, 221, 24, 0, 80, 242, 2, 1, 1, 0, 0, 3, 164,
0, 0, 39, 164, 0, 0, 66, 67, 94, 0, 98, 50, 47, 0, 11, 5, 0, 0, 39,
122, 18, 221, 30, 0, 144, 76, 51, 108, 0, 23, 255, 255, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221, 26, 0, 144,
76, 52, 1, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 145, 139, 60, 178
};
TEST_F(RadioTapTest, DefaultConstructor) {

View File

@@ -19,48 +19,38 @@ public:
uint8_t empty_iv[RSNEAPOL::key_iv_size] = { 0 };
const uint8_t nonce[RSNEAPOL::nonce_size] = {
'\xb9', 'o', '\xe7', '\xfa', '\xca', '[', '\'', '\xe2', 'M', '\x04',
'\xf1', '\xe6', 'l', '\x06', '\xe1', '\x9b', '\xb3', ':', 'k', '$',
'\xb4', '9', '\xbb', '\xe4', '\xde', '\xd9', '\n', '\xcc', '\xd1',
'3', '\x1e', '\x9e'
185, 111, 231, 250, 202, 91, 39, 226, 77, 4, 241, 230, 108, 6, 225,
155, 179, 58, 107, 36, 180, 57, 187, 228, 222, 217, 10, 204, 209, 51,
30, 158
};
const uint8_t mic[RSNEAPOL::mic_size] = {
'\xb1', '\xba', '\xac', 'U', '\x96', 'J', '\xbd', '0', 'V',
'\x85', 'e', '*', '\xb2', '&', 'u', '\x82'
177, 186, 172, 85, 150, 74, 189, 48, 86, 133, 101, 42, 178, 38, 117,
130
};
const uint8_t key[56] = {
'\xe2', '\xc5', 'O', 'G', '\xf3', '\x0e', '\xc9', '/', 'B', '\xd8',
'\xd5', '\x1e', '1', '\x9d', '\xf5', 'H', '`', 'm', 'N', '\xe3',
'\xd9', '\x84', '\xd3', 'C', 'Z', '\x15', '\xfc', 'X', '\x0f',
'>', 't', '`', '@', '\x91', '\x10', '`', '\xef', '\xb1', 'C',
'\xf8', '\xfd', '\xb6', '\n', '6', '\xcb', '\xa4', 'D', '\x98',
'&', '\x07', '\x1a', '\xff', '\x8b', '\x93', '\xd3', '.'
226, 197, 79, 71, 243, 14, 201, 47, 66, 216, 213, 30, 49, 157, 245,
72, 96, 109, 78, 227, 217, 132, 211, 67, 90, 21, 252, 88, 15, 62, 116,
96, 64, 145, 16, 96, 239, 177, 67, 248, 253, 182, 10, 54, 203, 164,
68, 152, 38, 7, 26, 255, 139, 147, 211, 46
};
const uint8_t rsc[RSNEAPOL::rsc_size] = {
'\xb1', '\x06'
177, 6
};
const uint8_t id[RSNEAPOL::id_size] = {
0
};
const uint8_t RSNEAPOLTest::expected_packet[] = {
'\x01', '\x03', '\x00', '\x97', '\x02', '\x13', '\xca', '\x00',
'\x10', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x02', '\xb9', 'o', '\xe7', '\xfa', '\xca', '[', '\'', '\xe2', 'M',
'\x04', '\xf1', '\xe6', 'l', '\x06', '\xe1', '\x9b', '\xb3', ':',
'k', '$', '\xb4', '9', '\xbb', '\xe4', '\xde', '\xd9', '\n', '\xcc',
'\xd1', '3', '\x1e', '\x9e', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\xb1', '\x06', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\xb1', '\xba', '\xac', 'U', '\x96', 'J', '\xbd', '0', 'V', '\x85',
'e', '*', '\xb2', '&', 'u', '\x82', '\x00', '8', '\xe2', '\xc5', 'O',
'G', '\xf3', '\x0e', '\xc9', '/', 'B', '\xd8', '\xd5', '\x1e', '1',
'\x9d', '\xf5', 'H', '`', 'm', 'N', '\xe3', '\xd9', '\x84', '\xd3',
'C', 'Z', '\x15', '\xfc', 'X', '\x0f', '>', 't', '`', '@', '\x91',
'\x10', '`', '\xef', '\xb1', 'C', '\xf8', '\xfd', '\xb6', '\n', '6',
'\xcb', '\xa4', 'D', '\x98', '&', '\x07', '\x1a', '\xff', '\x8b',
'\x93', '\xd3', '.'
1, 3, 0, 151, 2, 19, 202, 0, 16, 0, 0, 0, 0, 0, 0, 0, 2, 185, 111,
231, 250, 202, 91, 39, 226, 77, 4, 241, 230, 108, 6, 225, 155, 179,
58, 107, 36, 180, 57, 187, 228, 222, 217, 10, 204, 209, 51, 30, 158,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, 6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, 186, 172, 85, 150, 74, 189, 48,
86, 133, 101, 42, 178, 38, 117, 130, 0, 56, 226, 197, 79, 71, 243,
14, 201, 47, 66, 216, 213, 30, 49, 157, 245, 72, 96, 109, 78, 227,
217, 132, 211, 67, 90, 21, 252, 88, 15, 62, 116, 96, 64, 145, 16, 96,
239, 177, 67, 248, 253, 182, 10, 54, 203, 164, 68, 152, 38, 7, 26,
255, 139, 147, 211, 46
};
void RSNEAPOLTest::test_equals(const RSNEAPOL &eapol1, const RSNEAPOL &eapol2) {

View File

@@ -18,20 +18,15 @@ public:
};
const uint8_t SLLTest::expected_packet[] = {
'\x00', '\x00', '\x00', '\x01', '\x00', '\x06', '\x00', '\x1b', '\x11',
'\xd2', '\x1b', '\xeb', '\x00', '\x00', '\x08', '\x00', 'E', '\x00',
'\x00', 't', 'A', '\x12', '\x00', '\x00', ',', '\x06', '\x9c', '6',
'\xad', '\xc2', 'B', 'm', '\xc0', '\xa8', '\x00', 'd', '\x03', '\xe1',
'\x8d', '\x04', '7', '=', '\x96', '\xa1', 'U', 'j', 'I', '\xbd', '\x80',
'\x18', '\x01', '\x00', '\xca', 'w', '\x00', '\x00', '\x01', '\x01',
'\x08', '\n', 'G', '-', '(', '\xab', '\x00', '\x13', 'N', 'V', '\x17',
'\x03', '\x01', '\x00', ';', '\xa8', '\x93', '\xb6', '\x96', '\x9f',
'\xb2', '\xcc', 't', '>', 'U', 'P', '\xa7', '\x17', '\x18', '\xad',
'\xec', '7', '.', '\xbe', '\xcd', '\xff', '\x13', '\xf8', '\x81',
'\xc6', '\x8c', '\xd0', '<', 'O', ';', '&', '\xa5', '\x83', '!', 'i',
'\xd4', 'p', '\xae', 'P', '\xd3', '0', '%', 't', 'l', 'm', '!', '$',
'\xe7', '\x9a', '\x83', 'p', '\xf6', '\x03', '\xb4', '\xc7', '\x9e',
'\xcd', '{', '\xee'
0, 0, 0, 1, 0, 6, 0, 27, 17, 210, 27, 235, 0, 0, 8, 0, 69, 0, 0, 116,
65, 18, 0, 0, 44, 6, 156, 54, 173, 194, 66, 109, 192, 168, 0, 100,
3, 225, 141, 4, 55, 61, 150, 161, 85, 106, 73, 189, 128, 24, 1, 0,
202, 119, 0, 0, 1, 1, 8, 10, 71, 45, 40, 171, 0, 19, 78, 86, 23, 3,
1, 0, 59, 168, 147, 182, 150, 159, 178, 204, 116, 62, 85, 80, 167,
23, 24, 173, 236, 55, 46, 190, 205, 255, 19, 248, 129, 198, 140, 208,
60, 79, 59, 38, 165, 131, 33, 105, 212, 112, 174, 80, 211, 48, 37,
116, 108, 109, 33, 36, 231, 154, 131, 112, 246, 3, 180, 199, 158, 205,
123, 238
};
TEST_F(SLLTest, DefaultConstructor) {

View File

@@ -16,7 +16,7 @@ public:
};
const uint8_t SNAPTest::expected_packet[] = {
'\xaa', '\xaa', '\x03', '\x00', '\x00', '\x01', '\x08', '\x00'
170, 170, 3, 0, 0, 1, 8, 0
};
TEST_F(SNAPTest, DefaultConstructor) {

View File

@@ -16,11 +16,11 @@ public:
void test_equals(const TCP &tcp1, const TCP &tcp2);
};
const uint8_t TCPTest::expected_packet[] = {'\x7f', 'M', 'O', '\x1d', '\xf1', '\xda', '\xe5',
'F', '_', '\xae', '\xd1', '#', '\xd0', '\x02', 'q', '\xda', '\x00', '\x00', '\x1f', '\xae',
'\x02', '\x04', '\x98', '\xfa', '\x08', '\n', 'O', '\xd2', ':', '\xcb', '\x89', '\xfe',
'\x12', '4', '\x03', '\x03', 'z', '\x04', '\x02', '\x05', '\n', '\x00', '\x01', '\x02',
'\x03', '\x04', '\x05', '\x06', '\x07', '\x00', '\x00', '\x00'};
const uint8_t TCPTest::expected_packet[] = {
127, 77, 79, 29, 241, 218, 229, 70, 95, 174, 209, 35, 208, 2, 113,
218, 0, 0, 31, 174, 2, 4, 152, 250, 8, 10, 79, 210, 58, 203, 137, 254,
18, 52, 3, 3, 122, 4, 2, 5, 10, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0
};
TEST_F(TCPTest, DefaultConstructor) {

View File

@@ -16,7 +16,9 @@ public:
void test_equals(const UDP& udp1, const UDP& udp2);
};
const uint8_t UDPTest::expected_packet[] = {'\xf5', '\x1a', 'G', '\xf1', '\x04', 'S', '\x00', '\x00'};
const uint8_t UDPTest::expected_packet[] = {
245, 26, 71, 241, 4, 83, 0, 0
};
void UDPTest::test_equals(const UDP& udp1, const UDP& udp2) {

View File

@@ -24,49 +24,48 @@ public:
const uint32_t UtilsTest::zero_int_ip = 0; // "0.0.0.0"
const uint32_t UtilsTest::full_int_ip = 0xFFFFFFFF; // "255.255.255.255"
const uint32_t UtilsTest::mix_int_ip = 0x0102FF03; // "1.2.255.3"
const uint8_t UtilsTest::zero_hw_addr[] = {'\x00', '\x00', '\x00', '\x00', '\x00', '\x00'};
const uint8_t UtilsTest::full_hw_addr[] = {'\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF'};
const uint8_t UtilsTest::mix_hw_addr[] = {'\x01', '\x02', '\x03', '\x04', '\x05', '\x06'};
const uint8_t UtilsTest::zero_hw_addr[] = {
0, 0, 0, 0, 0, 0
};
const uint8_t UtilsTest::full_hw_addr[] = {
255, 255, 255, 255, 255, 255
};
const uint8_t UtilsTest::mix_hw_addr[] = {
1, 2, 3, 4, 5, 6
};
const uint8_t UtilsTest::data[] = {
215, 3, 132, 147, 170, 153, 240, 223, 227, 47, 144, 146, 52, 154, 192, 106,
195, 167, 160, 119, 154, 134, 59, 150, 6, 236, 67, 216, 7, 19, 110, 226, 228,
99, 103, 18, 39, 23, 157, 192, 38, 37, 23, 211, 77, 86, 176, 103, 62, 226, 235,
236, 114, 39, 216, 202, 236, 251, 158, 249, 89, 248, 80, 95, 245, 35, 61, 97,
242, 90, 122, 196, 187, 202, 15, 197, 204, 180, 183, 68, 65, 99, 209, 172, 80,
189, 188, 18, 216, 82, 103, 53, 3, 246, 183, 4, 56, 201, 5, 42, 94, 108, 30, 90,
183, 203, 193, 19, 128, 79, 156, 189, 18, 163, 67, 152, 153, 114, 151, 125, 114,
87, 105, 31, 212, 238, 154, 238, 82, 216, 244, 2, 33, 137, 126, 67, 176, 224, 95,
175, 205, 175, 91, 41, 101, 34, 178, 199, 88, 211, 91, 235, 42, 21, 182, 138,
185, 61, 205, 61, 245, 85, 18, 119, 253, 214, 127, 164, 31, 225, 140, 58, 103,
235, 231, 226, 119, 97, 86, 11, 56, 95, 218, 207, 137, 216, 141, 46, 82, 39, 158,
243, 131, 217, 197, 177, 239, 30, 145, 249, 162, 141, 252, 213, 132, 87, 42, 130,
213, 92, 47, 163, 113, 230, 59, 205, 19, 90, 65, 134, 181, 44, 150, 254, 73, 186,
194, 122, 96, 65, 114, 233, 245, 25, 194, 80, 174, 223, 158, 45, 131, 188, 222,
52, 212, 250, 96, 172, 181, 115, 252, 40, 249, 99, 65, 23, 118, 71, 124, 112, 228,
204, 106, 169, 40, 148, 72, 183, 252, 234, 83, 116, 109, 54, 233, 58, 231, 5, 88,
36, 77, 253, 75, 90, 250, 177, 159, 199, 180, 134, 211, 161, 175, 75, 161, 72, 80,
73, 163, 76, 160, 119, 226, 248, 231, 62, 91, 74, 32, 156, 9, 64, 170, 79, 38, 45,
204, 58, 144, 76, 226, 130, 21, 151, 239, 40, 116, 52, 77, 18, 6, 199, 42, 200, 213,
232, 12, 61, 156, 51, 23, 165, 11, 7, 149, 30, 27, 119, 216, 246, 93, 24, 111, 105,
218, 100, 45, 57, 69, 229, 168, 105, 99, 35, 41, 71, 255, 80, 255, 22, 7, 61, 211,
134, 113, 48, 255, 220, 26, 32, 6, 184, 204, 40, 194, 47, 201, 249, 133, 194, 203,
172, 123, 186, 77, 39, 92, 64, 52, 91, 187, 83, 58, 73, 65, 192, 150, 103, 230, 187,
165, 149, 84, 71, 142, 55, 69, 87, 102, 97, 20, 134, 184, 107, 133, 57, 57, 220, 121,
211, 241, 97, 172, 67, 208, 9, 151, 14, 200, 73, 31, 140, 34, 176, 215, 111, 4, 143,
13, 173, 193, 145, 255, 112, 249, 191, 88, 181, 113, 221, 50, 45, 34, 176, 203, 154,
65, 193, 6, 120, 182, 235, 250, 21, 136, 44, 21, 29, 6, 150, 194, 117, 118, 237, 0,
223, 207, 161, 58, 229, 174, 101, 101, 195, 17, 249, 12, 137, 177, 161
215, 3, 132, 147, 170, 153, 240, 223, 227, 47, 144, 146, 52, 154, 192, 106,
195, 167, 160, 119, 154, 134, 59, 150, 6, 236, 67, 216, 7, 19, 110, 226, 228,
99, 103, 18, 39, 23, 157, 192, 38, 37, 23, 211, 77, 86, 176, 103, 62, 226, 235,
236, 114, 39, 216, 202, 236, 251, 158, 249, 89, 248, 80, 95, 245, 35, 61, 97,
242, 90, 122, 196, 187, 202, 15, 197, 204, 180, 183, 68, 65, 99, 209, 172, 80,
189, 188, 18, 216, 82, 103, 53, 3, 246, 183, 4, 56, 201, 5, 42, 94, 108, 30, 90,
183, 203, 193, 19, 128, 79, 156, 189, 18, 163, 67, 152, 153, 114, 151, 125, 114,
87, 105, 31, 212, 238, 154, 238, 82, 216, 244, 2, 33, 137, 126, 67, 176, 224, 95,
175, 205, 175, 91, 41, 101, 34, 178, 199, 88, 211, 91, 235, 42, 21, 182, 138,
185, 61, 205, 61, 245, 85, 18, 119, 253, 214, 127, 164, 31, 225, 140, 58, 103,
235, 231, 226, 119, 97, 86, 11, 56, 95, 218, 207, 137, 216, 141, 46, 82, 39, 158,
243, 131, 217, 197, 177, 239, 30, 145, 249, 162, 141, 252, 213, 132, 87, 42, 130,
213, 92, 47, 163, 113, 230, 59, 205, 19, 90, 65, 134, 181, 44, 150, 254, 73, 186,
194, 122, 96, 65, 114, 233, 245, 25, 194, 80, 174, 223, 158, 45, 131, 188, 222,
52, 212, 250, 96, 172, 181, 115, 252, 40, 249, 99, 65, 23, 118, 71, 124, 112, 228,
204, 106, 169, 40, 148, 72, 183, 252, 234, 83, 116, 109, 54, 233, 58, 231, 5, 88,
36, 77, 253, 75, 90, 250, 177, 159, 199, 180, 134, 211, 161, 175, 75, 161, 72, 80,
73, 163, 76, 160, 119, 226, 248, 231, 62, 91, 74, 32, 156, 9, 64, 170, 79, 38, 45,
204, 58, 144, 76, 226, 130, 21, 151, 239, 40, 116, 52, 77, 18, 6, 199, 42, 200, 213,
232, 12, 61, 156, 51, 23, 165, 11, 7, 149, 30, 27, 119, 216, 246, 93, 24, 111, 105,
218, 100, 45, 57, 69, 229, 168, 105, 99, 35, 41, 71, 255, 80, 255, 22, 7, 61, 211,
134, 113, 48, 255, 220, 26, 32, 6, 184, 204, 40, 194, 47, 201, 249, 133, 194, 203,
172, 123, 186, 77, 39, 92, 64, 52, 91, 187, 83, 58, 73, 65, 192, 150, 103, 230, 187,
165, 149, 84, 71, 142, 55, 69, 87, 102, 97, 20, 134, 184, 107, 133, 57, 57, 220, 121,
211, 241, 97, 172, 67, 208, 9, 151, 14, 200, 73, 31, 140, 34, 176, 215, 111, 4, 143,
13, 173, 193, 145, 255, 112, 249, 191, 88, 181, 113, 221, 50, 45, 34, 176, 203, 154,
65, 193, 6, 120, 182, 235, 250, 21, 136, 44, 21, 29, 6, 150, 194, 117, 118, 237, 0,
223, 207, 161, 58, 229, 174, 101, 101, 195, 17, 249, 12, 137, 177, 161
};
const uint32_t UtilsTest::data_len = 500;
/*TEST_F(UtilsTest, ResolveIp) {
IPv4Address localhost_ip("127.0.0.1");
EXPECT_EQ(Utils::resolve_ip("localhost"), localhost_ip);
EXPECT_THROW(Utils::resolve_ip("www.qwertyuiopasdfg.com.ar.edu.gov"), std::runtime_error);
}
*/
TEST_F(UtilsTest, Crc32) {
uint32_t crc = Utils::crc32(data, data_len);

View File

@@ -15,15 +15,12 @@ public:
// packet taken from aircrack's site.
const uint8_t WEPDecryptTest::expected_packet[] = {
'\x08', 'B', '\x00', '\x00', '\xff', '\xff', '\xff', '\xff', '\xff',
'\xff', '\x00', '\x12', '\xbf', '\x12', '2', ')', '\x00', '\r', 'T',
'\xa1', '\xa0', 'L', '\xe0', '{', '\xcd', '\xd2', ':', '\x00', '\xc5',
'\xe4', '\xb0', '\xc3', '\xea', '\x87', '\xa1', '\xcd', '\x9b', 'K',
'#', '\xf7', '\x07', '`', '\x11', '\xea', '\x0f', '\x8d', '\x89',
'\xfb', '\x14', 'D', '0', '\xab', '\x1b', '\x0b', '\xf4', 'L', '+',
'2', '\x82', '(', '\x81', '%', '\x1e', '=', '\x08', ')', '\x91', ']',
'X', '7', '\xc2', '\xd2', '\xf7', '\xed', '\xec', '\x86', '\xb6',
'\xd8', 'U', '\xe1', 'f', '\x8b', ']', '\xb2', '\xd6', '\x9a'
8, 66, 0, 0, 255, 255, 255, 255, 255, 255, 0, 18, 191, 18, 50, 41,
0, 13, 84, 161, 160, 76, 224, 123, 205, 210, 58, 0, 197, 228, 176,
195, 234, 135, 161, 205, 155, 75, 35, 247, 7, 96, 17, 234, 15, 141,
137, 251, 20, 68, 48, 171, 27, 11, 244, 76, 43, 50, 130, 40, 129, 37,
30, 61, 8, 41, 145, 93, 88, 55, 194, 210, 247, 237, 236, 134, 182,
216, 85, 225, 102, 139, 93, 178, 214, 154
};
TEST_F(WEPDecryptTest, Decrypt1) {