Exemplo n.º 1
0
std::unique_ptr<UpPacket> duplicate_serialize(const ChunkPacket& packet)
{
    ByteBuffer buf_packet;
    for (auto layer : osi_layer_range<OsiLayer::Network, OsiLayer::Application>()) {
        ByteBuffer buf_layer;
        packet[layer].convert(buf_layer);
        buf_packet.insert(buf_packet.end(), buf_layer.begin(), buf_layer.end());
    }
    assert(buf_packet.size() == packet.size(OsiLayer::Network, OsiLayer::Application));

    return std::unique_ptr<UpPacket> { new UpPacket(CohesivePacket(std::move(buf_packet), OsiLayer::Network)) };
}
Exemplo n.º 2
0
 std::size_t operator()(const ChunkPacket& packet)
 {
     return packet.size();
 }