roo_transport
API Documentation for roo_transport
Loading...
Searching...
No Matches
packet_sender.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "roo_io/core/output_stream.h"
6
7namespace roo_transport {
8
9/// Abstraction for sending packets over an underlying medium.
10///
11/// Packets are up to `kMaxPacketSize` bytes. Implementations may use
12/// unreliable media where loss/corruption can occur.
14 public:
15 /// Maximum packet size that can be sent.
16 constexpr static int kMaxPacketSize = 250;
17
18 virtual ~PacketSender() = default;
19
20 /// Sends one data packet.
21 virtual void send(const roo::byte* buf, size_t len) = 0;
22
23 /// Flushes pending output.
24 virtual void flush() {}
25};
26
27} // namespace roo_transport
Abstraction for sending packets over an underlying medium.
virtual void flush()
Flushes pending output.
static constexpr int kMaxPacketSize
Maximum packet size that can be sent.
virtual void send(const roo::byte *buf, size_t len)=0
Sends one data packet.
virtual ~PacketSender()=default