本文整理汇总了C++中TCP::dport方法的典型用法代码示例。如果您正苦于以下问题:C++ TCP::dport方法的具体用法?C++ TCP::dport怎么用?C++ TCP::dport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCP
的用法示例。
在下文中一共展示了TCP::dport方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_equals
void TCPTest::test_equals(const TCP &tcp1, const TCP &tcp2) {
EXPECT_EQ(tcp1.dport(), tcp2.dport());
EXPECT_EQ(tcp2.sport(), tcp2.sport());
EXPECT_EQ(tcp1.seq(), tcp2.seq());
EXPECT_EQ(tcp1.ack_seq(), tcp2.ack_seq());
EXPECT_EQ(tcp1.window(), tcp2.window());
EXPECT_EQ(tcp1.checksum(), tcp2.checksum());
EXPECT_EQ(tcp1.urg_ptr(), tcp2.urg_ptr());
EXPECT_EQ(tcp1.data_offset(), tcp2.data_offset());
EXPECT_EQ((bool)tcp1.inner_pdu(), (bool)tcp2.inner_pdu());
}
示例2: IP
TEST_F(PDUTest, OperatorConcat) {
std::string raw_payload = "Test";
IP ip = IP("192.168.0.1") / TCP(22, 52) / RawPDU(raw_payload);
EXPECT_EQ(ip.dst_addr(), "192.168.0.1");
ASSERT_TRUE(ip.inner_pdu() != NULL);
TCP *tcp = ip.find_pdu<TCP>();
ASSERT_TRUE(tcp != NULL);
EXPECT_EQ(tcp->dport(), 22);
EXPECT_EQ(tcp->sport(), 52);
ASSERT_TRUE(tcp->inner_pdu() != NULL);
RawPDU *raw = tcp->find_pdu<RawPDU>();
ASSERT_TRUE(raw != NULL);
ASSERT_EQ(raw->payload_size(), raw_payload.size());
EXPECT_TRUE(std::equal(raw_payload.begin(), raw_payload.end(), raw->payload().begin()));
}
示例3: sizeof
TEST_F(IPv6Test, ConstructorFromBuffer) {
IPv6 ipv6(expected_packet1, sizeof(expected_packet1));
EXPECT_EQ(ipv6.version(), 6);
EXPECT_EQ(ipv6.traffic_class(), 0x9a);
EXPECT_EQ(ipv6.flow_label(), 0x82734U);
EXPECT_EQ(ipv6.payload_length(), 40);
EXPECT_EQ(ipv6.next_header(), 6);
EXPECT_EQ(ipv6.hop_limit(), 64);
EXPECT_EQ(ipv6.dst_addr(), "::1");
EXPECT_EQ(ipv6.src_addr(), "::1");
ASSERT_TRUE(ipv6.inner_pdu() != NULL);
TCP* tcp = ipv6.find_pdu<TCP>();
ASSERT_TRUE(tcp != NULL);
EXPECT_EQ(tcp->sport(), 50828);
EXPECT_EQ(tcp->dport(), 80);
}
示例4:
TEST_F(TCPTest, DPort) {
TCP tcp;
tcp.dport(0x5fad);
EXPECT_EQ(tcp.dport(), 0x5fad);
}