1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 13:34:27 +01:00

Code cleanup and use same syntax on the entire project

Initial code cleanup

More code cleanup

Cleanup more code

Cleanup Dot11 code

Fix OSX build issue

Cleanup examples

Fix ref and pointer declaration syntax

Fix braces
This commit is contained in:
Matias Fontanini
2016-01-02 08:17:59 -08:00
parent f5a82b1a17
commit d84f10cf08
177 changed files with 13203 additions and 12272 deletions

View File

@@ -22,14 +22,14 @@ const uint8_t Dot11AckTest::expected_packet[] = {
213, 1, 79, 35, 0, 1, 2, 3, 4, 5
};
void test_equals(const Dot11Ack &dot1, const Dot11Ack &dot2) {
void test_equals(const Dot11Ack& dot1, const Dot11Ack& dot2) {
test_equals(
static_cast<const Dot11&>(dot1),
static_cast<const Dot11&>(dot2)
);
}
void test_equals_expected(const Dot11Ack &dot11) {
void test_equals_expected(const Dot11Ack& dot11) {
EXPECT_EQ(dot11.protocol(), 1);
EXPECT_EQ(dot11.type(), Dot11::CONTROL);
EXPECT_EQ(dot11.subtype(), Dot11::ACK);
@@ -89,7 +89,7 @@ TEST_F(Dot11AckTest, ClonePDU) {
TEST_F(Dot11AckTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11Ack *inner = dot11->find_pdu<Dot11Ack>();
const Dot11Ack* inner = dot11->find_pdu<Dot11Ack>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -23,7 +23,7 @@ const uint8_t Dot11AssocRequestTest::expected_packet[] = {
0, 0, 21, 32, 243, 146
};
void test_equals(const Dot11AssocRequest &dot1, const Dot11AssocRequest &dot2) {
void test_equals(const Dot11AssocRequest& dot1, const Dot11AssocRequest& dot2) {
test_equals(dot1.capabilities(), dot2.capabilities());
EXPECT_EQ(dot1.listen_interval(), dot2.listen_interval());
test_equals(
@@ -32,7 +32,7 @@ void test_equals(const Dot11AssocRequest &dot1, const Dot11AssocRequest &dot2) {
);
}
void test_equals_expected(const Dot11AssocRequest &dot11) {
void test_equals_expected(const Dot11AssocRequest& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.listen_interval(), 0x92f3);
EXPECT_EQ(dot11.subtype(), Dot11::ASSOC_REQ);
@@ -78,7 +78,7 @@ TEST_F(Dot11AssocRequestTest, ClonePDU) {
TEST_F(Dot11AssocRequestTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11AssocRequest *inner = dot11->find_pdu<Dot11AssocRequest>();
const Dot11AssocRequest* inner = dot11->find_pdu<Dot11AssocRequest>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -22,7 +22,7 @@ const uint8_t Dot11AssocResponseTest::expected_packet[] = {
0, 0, 21, 32, 243, 146, 58, 242
};
void test_equals(const Dot11AssocResponse &dot1, const Dot11AssocResponse &dot2) {
void test_equals(const Dot11AssocResponse& dot1, const Dot11AssocResponse& dot2) {
test_equals(dot1.capabilities(), dot2.capabilities());
EXPECT_EQ(dot1.status_code(), dot2.status_code());
EXPECT_EQ(dot1.aid(), dot2.aid());
@@ -32,7 +32,7 @@ void test_equals(const Dot11AssocResponse &dot1, const Dot11AssocResponse &dot2)
);
}
void test_equals_expected(const Dot11AssocResponse &dot11) {
void test_equals_expected(const Dot11AssocResponse& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.status_code(), 0x92f3);
EXPECT_EQ(dot11.aid(), 0xf23a);
@@ -86,7 +86,7 @@ TEST_F(Dot11AssocResponseTest, ClonePDU) {
TEST_F(Dot11AssocResponseTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11AssocResponse *inner = dot11->find_pdu<Dot11AssocResponse>();
const Dot11AssocResponse* inner = dot11->find_pdu<Dot11AssocResponse>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -22,7 +22,7 @@ const uint8_t Dot11AuthenticationTest::expected_packet[] = {
7, 0, 0, 162, 40, 58, 242, 243, 146
};
void test_equals(const Dot11Authentication &dot1, const Dot11Authentication &dot2) {
void test_equals(const Dot11Authentication& dot1, const Dot11Authentication& dot2) {
EXPECT_EQ(dot1.status_code(), dot2.status_code());
EXPECT_EQ(dot1.auth_seq_number(), dot2.auth_seq_number());
EXPECT_EQ(dot1.auth_algorithm(), dot2.auth_algorithm());
@@ -32,7 +32,7 @@ void test_equals(const Dot11Authentication &dot1, const Dot11Authentication &dot
);
}
void test_equals_expected(const Dot11Authentication &dot11) {
void test_equals_expected(const Dot11Authentication& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.status_code(), 0x92f3);
EXPECT_EQ(dot11.auth_seq_number(), 0xf23a);
@@ -94,7 +94,7 @@ TEST_F(Dot11AuthenticationTest, ClonePDU) {
TEST_F(Dot11AuthenticationTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11Authentication *inner = dot11->find_pdu<Dot11Authentication>();
const Dot11Authentication* inner = dot11->find_pdu<Dot11Authentication>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -27,12 +27,12 @@ const uint8_t Dot11BeaconTest::expected_packet[] = {
7, 0, 0, 250, 1, 147, 40, 65, 35, 173, 31, 250, 20, 149, 32
};
void test_equals_expected(const Dot11Beacon &dot11) {
void test_equals_expected(const Dot11Beacon& dot11) {
EXPECT_EQ(dot11.subtype(), 8);
EXPECT_EQ(dot11.timestamp(), 0x1fad2341289301faULL);
EXPECT_EQ(dot11.interval(), 0x14fa);
const Dot11Beacon::capability_information &info = dot11.capabilities();
const Dot11Beacon::capability_information& info = dot11.capabilities();
EXPECT_EQ(info.ess(), true);
EXPECT_EQ(info.ibss(), false);
EXPECT_EQ(info.cf_poll(), true);
@@ -111,7 +111,7 @@ TEST_F(Dot11BeaconTest, SeqNum) {
TEST_F(Dot11BeaconTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11Beacon *beacon = dot11->find_pdu<Dot11Beacon>();
const Dot11Beacon* beacon = dot11->find_pdu<Dot11Beacon>();
ASSERT_TRUE(beacon != NULL);
test_equals_expected(*beacon);
}

View File

@@ -22,13 +22,13 @@ const uint8_t Dot11BlockAckRequestTest::expected_packet[] = {
0, 176, 33
};
void test_equals(const Dot11BlockAckRequest &dot1, const Dot11BlockAckRequest &dot2) {
void test_equals(const Dot11BlockAckRequest& dot1, const Dot11BlockAckRequest& dot2) {
EXPECT_EQ(dot1.fragment_number(), dot2.fragment_number());
EXPECT_EQ(dot1.start_sequence(), dot2.start_sequence());
EXPECT_EQ(dot1.bar_control(), dot2.bar_control());
}
void test_equals_expected(const Dot11BlockAckRequest &dot11) {
void test_equals_expected(const Dot11BlockAckRequest& dot11) {
EXPECT_EQ(dot11.type(), Dot11::CONTROL);
EXPECT_EQ(dot11.subtype(), Dot11::BLOCK_ACK_REQ);
EXPECT_EQ(dot11.bar_control(), 4);
@@ -82,7 +82,7 @@ TEST_F(Dot11BlockAckRequestTest, ClonePDU) {
TEST_F(Dot11BlockAckRequestTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11BlockAckRequest *inner = dot11->find_pdu<Dot11BlockAckRequest>();
const Dot11BlockAckRequest* inner = dot11->find_pdu<Dot11BlockAckRequest>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -21,14 +21,14 @@ const uint8_t Dot11CFEndTest::expected_packet[] = {
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) {
void test_equals(const Dot11CFEnd& dot1, const Dot11CFEnd& dot2) {
test_equals(
static_cast<const Dot11ControlTA&>(dot1),
static_cast<const Dot11ControlTA&>(dot2)
);
}
void test_equals_expected(const Dot11CFEnd &dot11) {
void test_equals_expected(const Dot11CFEnd& dot11) {
test_equals_expected(static_cast<const Dot11ControlTA&>(dot11));
EXPECT_EQ(dot11.subtype(), Dot11::CF_END);
}
@@ -66,7 +66,7 @@ TEST_F(Dot11CFEndTest, ClonePDU) {
TEST_F(Dot11CFEndTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11CFEnd *inner = dot11->find_pdu<Dot11CFEnd>();
const Dot11CFEnd* inner = dot11->find_pdu<Dot11CFEnd>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -21,14 +21,14 @@ const uint8_t Dot11EndCFAckTest::expected_packet[] = {
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) {
void test_equals(const Dot11EndCFAck& dot1, const Dot11EndCFAck& dot2) {
test_equals(
static_cast<const Dot11ControlTA&>(dot1),
static_cast<const Dot11ControlTA&>(dot2)
);
}
void test_equals_expected(const Dot11EndCFAck &dot11) {
void test_equals_expected(const Dot11EndCFAck& dot11) {
test_equals_expected(static_cast<const Dot11ControlTA&>(dot11));
EXPECT_EQ(dot11.subtype(), Dot11::CF_END_ACK);
}
@@ -66,7 +66,7 @@ TEST_F(Dot11EndCFAckTest, ClonePDU) {
TEST_F(Dot11EndCFAckTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11EndCFAck *inner = dot11->find_pdu<Dot11EndCFAck>();
const Dot11EndCFAck* inner = dot11->find_pdu<Dot11EndCFAck>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -104,7 +104,7 @@ TEST_F(Dot11DataTest, ClonePDU) {
TEST_F(Dot11DataTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11Data *inner = dot11->find_pdu<Dot11Data>();
const Dot11Data* inner = dot11->find_pdu<Dot11Data>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -22,7 +22,7 @@ const uint8_t Dot11DeauthenticationTest::expected_packet[] = {
7, 0, 0, 243, 146
};
void test_equals(const Dot11Deauthentication &dot1, const Dot11Deauthentication &dot2) {
void test_equals(const Dot11Deauthentication& dot1, const Dot11Deauthentication& dot2) {
EXPECT_EQ(dot1.reason_code(), dot2.reason_code());
test_equals(
static_cast<const Dot11ManagementFrame&>(dot1),
@@ -30,7 +30,7 @@ void test_equals(const Dot11Deauthentication &dot1, const Dot11Deauthentication
);
}
void test_equals_expected(const Dot11Deauthentication &dot11) {
void test_equals_expected(const Dot11Deauthentication& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.reason_code(), 0x92f3);
EXPECT_EQ(dot11.subtype(), Dot11::DEAUTH);
@@ -76,7 +76,7 @@ TEST_F(Dot11DeauthenticationTest, ClonePDU) {
TEST_F(Dot11DeauthenticationTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11Deauthentication *inner = dot11->find_pdu<Dot11Deauthentication>();
const Dot11Deauthentication* inner = dot11->find_pdu<Dot11Deauthentication>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -23,7 +23,7 @@ const uint8_t Dot11DisassocTest::expected_packet[] = {
7, 0, 0, 18, 35
};
void test_equals(const Dot11Disassoc &dot1, const Dot11Disassoc &dot2) {
void test_equals(const Dot11Disassoc& dot1, const Dot11Disassoc& dot2) {
EXPECT_EQ(dot1.reason_code(), dot2.reason_code());
test_equals(
static_cast<const Dot11ManagementFrame&>(dot1),
@@ -31,7 +31,7 @@ void test_equals(const Dot11Disassoc &dot1, const Dot11Disassoc &dot2) {
);
}
void test_equals_expected(const Dot11Disassoc &dot11) {
void test_equals_expected(const Dot11Disassoc& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.reason_code(), 0x2312);
EXPECT_EQ(dot11.subtype(), Dot11::DISASSOC);
@@ -77,7 +77,7 @@ TEST_F(Dot11DisassocTest, ClonePDU) {
TEST_F(Dot11DisassocTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11Disassoc *inner = dot11->find_pdu<Dot11Disassoc>();
const Dot11Disassoc* inner = dot11->find_pdu<Dot11Disassoc>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -151,7 +151,7 @@ TEST_F(Dot11Test, Addr1) {
TEST_F(Dot11Test, AddTaggedOption) {
Dot11 dot11;
dot11.add_option(Dot11::option(Dot11::SSID, hwaddr.begin(), hwaddr.end()));
const Dot11::option *option = dot11.search_option(Dot11::SSID);
const Dot11::option* option = dot11.search_option(Dot11::SSID);
ASSERT_TRUE(option != NULL);
EXPECT_EQ(option->data_size(), hwaddr.size());
EXPECT_EQ(option->option(), Dot11::SSID);

View File

@@ -22,14 +22,14 @@ const uint8_t Dot11ProbeRequestTest::expected_packet[] = {
0, 0
};
void test_equals(const Dot11ProbeRequest &dot1, const Dot11ProbeRequest &dot2) {
void test_equals(const Dot11ProbeRequest& dot1, const Dot11ProbeRequest& dot2) {
test_equals(
static_cast<const Dot11ManagementFrame&>(dot1),
static_cast<const Dot11ManagementFrame&>(dot2)
);
}
void test_equals_expected(const Dot11ProbeRequest &dot11) {
void test_equals_expected(const Dot11ProbeRequest& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.subtype(), Dot11::PROBE_REQ);
}
@@ -67,7 +67,7 @@ TEST_F(Dot11ProbeRequestTest, ClonePDU) {
TEST_F(Dot11ProbeRequestTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11ProbeRequest *inner = dot11->find_pdu<Dot11ProbeRequest>();
const Dot11ProbeRequest* inner = dot11->find_pdu<Dot11ProbeRequest>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -22,7 +22,7 @@ const uint8_t Dot11ProbeResponseTest::expected_packet[] = {
0, 0, 145, 138, 131, 39, 223, 152, 166, 23, 141, 146, 0, 0
};
void test_equals(const Dot11ProbeResponse &dot1, const Dot11ProbeResponse &dot2) {
void test_equals(const Dot11ProbeResponse& dot1, const Dot11ProbeResponse& dot2) {
EXPECT_EQ(dot1.interval(), dot2.interval());
EXPECT_EQ(dot1.timestamp(), dot2.timestamp());
test_equals(
@@ -31,7 +31,7 @@ void test_equals(const Dot11ProbeResponse &dot1, const Dot11ProbeResponse &dot2)
);
}
void test_equals_expected(const Dot11ProbeResponse &dot11) {
void test_equals_expected(const Dot11ProbeResponse& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.timestamp(), 0x17a698df27838a91ULL);
EXPECT_EQ(dot11.interval(), 0x928d);
@@ -85,7 +85,7 @@ TEST_F(Dot11ProbeResponseTest, ClonePDU) {
TEST_F(Dot11ProbeResponseTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11ProbeResponse *inner = dot11->find_pdu<Dot11ProbeResponse>();
const Dot11ProbeResponse* inner = dot11->find_pdu<Dot11ProbeResponse>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -21,14 +21,14 @@ const uint8_t Dot11PSPollTest::expected_packet[] = {
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) {
void test_equals(const Dot11PSPoll& dot1, const Dot11PSPoll& dot2) {
test_equals(
static_cast<const Dot11ControlTA&>(dot1),
static_cast<const Dot11ControlTA&>(dot2)
);
}
void test_equals_expected(const Dot11PSPoll &dot11) {
void test_equals_expected(const Dot11PSPoll& dot11) {
test_equals_expected(static_cast<const Dot11ControlTA&>(dot11));
EXPECT_EQ(dot11.subtype(), Dot11::PS);
}
@@ -66,7 +66,7 @@ TEST_F(Dot11PSPollTest, ClonePDU) {
TEST_F(Dot11PSPollTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11PSPoll *inner = dot11->find_pdu<Dot11PSPoll>();
const Dot11PSPoll* inner = dot11->find_pdu<Dot11PSPoll>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -22,7 +22,7 @@ const uint8_t Dot11ReAssocRequestTest::expected_packet[] = {
0, 0, 21, 32, 243, 146, 3, 4, 5, 6, 7, 8
};
void test_equals(const Dot11ReAssocRequest &dot1, const Dot11ReAssocRequest &dot2) {
void test_equals(const Dot11ReAssocRequest& dot1, const Dot11ReAssocRequest& dot2) {
test_equals(dot1.capabilities(), dot2.capabilities());
EXPECT_EQ(dot1.listen_interval(), dot2.listen_interval());
EXPECT_EQ(dot1.current_ap(), dot2.current_ap());
@@ -32,7 +32,7 @@ void test_equals(const Dot11ReAssocRequest &dot1, const Dot11ReAssocRequest &dot
);
}
void test_equals_expected(const Dot11ReAssocRequest &dot11) {
void test_equals_expected(const Dot11ReAssocRequest& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.listen_interval(), 0x92f3);
EXPECT_EQ(dot11.subtype(), Dot11::REASSOC_REQ);
@@ -85,7 +85,7 @@ TEST_F(Dot11ReAssocRequestTest, ClonePDU) {
TEST_F(Dot11ReAssocRequestTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11ReAssocRequest *inner = dot11->find_pdu<Dot11ReAssocRequest>();
const Dot11ReAssocRequest* inner = dot11->find_pdu<Dot11ReAssocRequest>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -22,7 +22,7 @@ const uint8_t Dot11ReAssocResponseTest::expected_packet[] = {
0, 0, 21, 32, 243, 146, 58, 242
};
void test_equals(const Dot11ReAssocResponse &dot1, const Dot11ReAssocResponse &dot2) {
void test_equals(const Dot11ReAssocResponse& dot1, const Dot11ReAssocResponse& dot2) {
test_equals(dot1.capabilities(), dot2.capabilities());
EXPECT_EQ(dot1.status_code(), dot2.status_code());
EXPECT_EQ(dot1.aid(), dot2.aid());
@@ -32,7 +32,7 @@ void test_equals(const Dot11ReAssocResponse &dot1, const Dot11ReAssocResponse &d
);
}
void test_equals_expected(const Dot11ReAssocResponse &dot11) {
void test_equals_expected(const Dot11ReAssocResponse& dot11) {
test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
EXPECT_EQ(dot11.status_code(), 0x92f3);
EXPECT_EQ(dot11.aid(), 0xf23a);
@@ -74,7 +74,7 @@ TEST_F(Dot11ReAssocResponseTest, ClonePDU) {
TEST_F(Dot11ReAssocResponseTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11ReAssocResponse *inner = dot11->find_pdu<Dot11ReAssocResponse>();
const Dot11ReAssocResponse* inner = dot11->find_pdu<Dot11ReAssocResponse>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}

View File

@@ -21,14 +21,14 @@ const uint8_t Dot11RTSTest::expected_packet[] = {
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) {
void test_equals(const Dot11RTS& dot1, const Dot11RTS& dot2) {
test_equals(
static_cast<const Dot11ControlTA&>(dot1),
static_cast<const Dot11ControlTA&>(dot2)
);
}
void test_equals_expected(const Dot11RTS &dot11) {
void test_equals_expected(const Dot11RTS& dot11) {
test_equals_expected(static_cast<const Dot11ControlTA&>(dot11));
EXPECT_EQ(dot11.subtype(), Dot11::RTS);
}
@@ -66,7 +66,7 @@ TEST_F(Dot11RTSTest, ClonePDU) {
TEST_F(Dot11RTSTest, FromBytes) {
Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
ASSERT_TRUE(dot11.get() != NULL);
const Dot11RTS *inner = dot11->find_pdu<Dot11RTS>();
const Dot11RTS* inner = dot11->find_pdu<Dot11RTS>();
ASSERT_TRUE(inner != NULL);
test_equals_expected(*inner);
}