---
title: llarp/routing/transfer_traffic_message.hpp

---

# llarp/routing/transfer_traffic_message.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::routing](Namespaces/namespacellarp_1_1routing.md)**  |

## Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[llarp::routing::TransferTrafficMessage](Classes/structllarp_1_1routing_1_1TransferTrafficMessage.md)**  |




## Source code

```cpp
#pragma once
#include "message.hpp"

#include <llarp/crypto/encrypted.hpp>
#include <llarp/layers/flow/flow_traffic.hpp>
#include <llarp/service/protocol_type.hpp>

#include <vector>

namespace llarp
{
  namespace routing
  {
    constexpr size_t ExitPadSize = 512 - 48;
    constexpr size_t MaxExitMTU = 1500;
    constexpr size_t ExitOverhead = sizeof(uint64_t);
    struct TransferTrafficMessage final : public IMessage
    {
      std::vector<llarp::Encrypted<MaxExitMTU + ExitOverhead>> pkts;
      service::ProtocolType protocol;
      size_t _size = 0;
      decltype(pkts)& X{pkts};

      void
      Clear() override
      {
        IMessage::Clear();
        pkts.clear();
        _size = 0;
        version = 0;
        protocol = service::ProtocolType::TrafficV4;
      }

      size_t
      Size() const
      {
        return _size;
      }

      std::vector<layers::flow::FlowTraffic>
      to_flow_traffic() const;

      bool
      PutBuffer(const llarp_buffer_t& buf, uint64_t counter);

      bool
      BEncode(llarp_buffer_t* buf) const override;

      bool
      DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val) override;

      bool
      HandleMessage(IMessageHandler* h, AbstractRouter* r) const override;
    };
  }  // namespace routing
}  // namespace llarp
```


-------------------------------

Updated on 2023-04-27 at 04:17:17 +0000
