当前位置: 首页>>代码示例>>C++>>正文


C++ serialization_type::end方法代码示例

本文整理汇总了C++中pdu::serialization_type::end方法的典型用法代码示例。如果您正苦于以下问题:C++ serialization_type::end方法的具体用法?C++ serialization_type::end怎么用?C++ serialization_type::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdu::serialization_type的用法示例。


在下文中一共展示了serialization_type::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eth

TEST_F(EthernetIITest, SerializeSmallEthernetWithPadding) {
    EthernetII eth(smallip_packet, sizeof(smallip_packet));
    ASSERT_TRUE(eth.inner_pdu() != NULL);
    PDU::serialization_type serialized = eth.serialize();
    EXPECT_EQ(serialized.size(), sizeof(smallip_packet));
    EXPECT_TRUE(std::equal(serialized.begin(), serialized.end(), smallip_packet));
}
开发者ID:CityOfSolitude,项目名称:libtins,代码行数:7,代码来源:ethernetII.cpp

示例2: sizeof

TEST_F(DHCPTest, Serialize) {
    DHCP dhcp1(expected_packet, sizeof(expected_packet));
    PDU::serialization_type buffer = dhcp1.serialize();
    
    ASSERT_EQ(buffer.size(), sizeof(expected_packet));
    EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));

    DHCP dhcp2(&buffer[0], (uint32_t)buffer.size());
    test_equals(dhcp1, dhcp2);
}
开发者ID:gtdsj,项目名称:libtins,代码行数:10,代码来源:dhcp.cpp

示例3: pdu_from_flag

PDU *IPv4Stream::allocate_pdu() const {
    PDU::serialization_type buffer;
    buffer.reserve(total_size);
    // Check if we actually have all the data we need. Otherwise return nullptr;
    uint16_t expected = 0;
    for(fragments_type::const_iterator it = fragments.begin(); it != fragments.end(); ++it) {
        if(expected != it->offset())
            return 0;
        expected = static_cast<uint16_t>(it->offset() + it->payload().size());
        buffer.insert(buffer.end(), it->payload().begin(), it->payload().end());
    }
    return Internals::pdu_from_flag(
        static_cast<Constants::IP::e>(transport_proto),
        buffer.empty() ? 0 : &buffer[0],
        static_cast<uint32_t>(buffer.size())
    );
}
开发者ID:Imva,项目名称:libtins,代码行数:17,代码来源:ip_reassembler.cpp

示例4: tim

TEST_F(Dot11BeaconTest, PCAPLoad1) {
    const uint8_t buffer[] = {
        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 byte_array country_container;
    Dot11Beacon dot11(buffer, sizeof(buffer));
    float rates[] = { 1.0f, 2.0f, 5.5f, 11.0f, 6.0f, 9.0f, 12.0f, 18.0f},
           ext_rates[] = { 24.0f, 36.0f, 48.0f, 54.0f };
    Dot11Beacon::rates_type rates_parsed = dot11.supported_rates();
    Dot11Beacon::rates_type ext_rates_parsed = dot11.extended_supported_rates();
    Dot11Beacon::tim_type tim(0, 1, 0, byte_array(1)), 
                             tim_parsed = dot11.tim();
    Dot11Beacon::country_params country("US ", 
                                            country_container(1, 1),
                                            country_container(1, 13),
                                            country_container(1, 20)),
                                    country_parsed = dot11.country();
    EXPECT_EQ(dot11.ssid(), "Segundo");
    ASSERT_EQ(rates_parsed.size(), sizeof(rates) / sizeof(float));
    EXPECT_TRUE(std::equal(rates_parsed.begin(), rates_parsed.end(), rates));
    ASSERT_EQ(ext_rates_parsed.size(), sizeof(ext_rates) / sizeof(float));
    EXPECT_TRUE(std::equal(ext_rates_parsed.begin(), ext_rates_parsed.end(), ext_rates));
    EXPECT_EQ(1, dot11.ds_parameter_set());
    EXPECT_EQ(tim.dtim_count, tim_parsed.dtim_count);
    EXPECT_EQ(tim.dtim_period, tim_parsed.dtim_period);
    EXPECT_EQ(tim.bitmap_control, tim_parsed.bitmap_control);
    EXPECT_EQ(tim.partial_virtual_bitmap, tim_parsed.partial_virtual_bitmap);
    EXPECT_EQ(country.country, country_parsed.country);
    EXPECT_EQ(country.first_channel, country_parsed.first_channel);
    EXPECT_EQ(country.number_channels, country_parsed.number_channels);
    EXPECT_EQ(country.max_transmit_power, country_parsed.max_transmit_power);
    EXPECT_EQ(dot11.erp_information(), 0);
    
    PDU::serialization_type serialized = dot11.serialize();
    ASSERT_EQ(sizeof(buffer), serialized.size());
    EXPECT_TRUE(std::equal(serialized.begin(), serialized.end(), buffer));
}
开发者ID:gtdsj,项目名称:libtins,代码行数:44,代码来源:beacon.cpp

示例5: sizeof

TEST_F(TCPTest, Serialize) {
    TCP tcp1(expected_packet, sizeof(expected_packet));
    PDU::serialization_type buffer = tcp1.serialize();
    ASSERT_EQ(buffer.size(), sizeof(expected_packet));
    EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
}
开发者ID:Temptationx,项目名称:libtins,代码行数:6,代码来源:tcp.cpp

示例6: pdu

TEST_F(Dot11PSPollTest, Serialize) {
    Dot11PSPoll pdu(expected_packet, sizeof(expected_packet));
    PDU::serialization_type buffer = pdu.serialize();
    ASSERT_EQ(sizeof(expected_packet), buffer.size());
    EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
}
开发者ID:DaTrollMon,项目名称:libtins,代码行数:6,代码来源:pspoll.cpp


注:本文中的pdu::serialization_type::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。