blob: e35708ae52a2d3bd677acd40a8059a333d5780e1 [file] [log] [blame]
James Kuszmaul1ec74432020-07-30 20:26:45 -07001#include "absl/types/span.h"
Philipp Schrader790cb542023-07-05 21:06:52 -07002
Alex Perry5f474f22020-02-01 12:14:24 -08003#include "aos/events/event_loop.h"
James Kuszmaul1ec74432020-07-30 20:26:45 -07004#include "aos/flatbuffers.h"
Austin Schuh60e77942022-05-16 17:48:24 -07005#include "aos/network/web_proxy_generated.h"
Alex Perry5f474f22020-02-01 12:14:24 -08006
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -08007namespace aos::web_proxy {
Alex Perry5f474f22020-02-01 12:14:24 -08008
9int GetPacketCount(const Context &context);
10
Austin Schuh52e5e3a2021-04-24 22:30:02 -070011// Packs a message embedded in context into a MessageHeader on fbb. Handles
12// multipart messages by use of the packet_index.
Alex Perry5f474f22020-02-01 12:14:24 -080013flatbuffers::Offset<MessageHeader> PackMessage(
14 flatbuffers::FlatBufferBuilder *fbb, const Context &context,
15 int channel_index, int packet_index);
16
Austin Schuhd16ef442021-04-25 14:44:42 -070017// Returns the size that the overall packed message packed by PackMessage will
18// be for the provided packet index.
19size_t PackedMessageSize(const Context &context, int packet_index);
20
James Kuszmaul1ec74432020-07-30 20:26:45 -070021// Packs the provided raw data into a series of MessageHeader's of the
22// appropriate length.
23std::vector<FlatbufferDetachedBuffer<MessageHeader>> PackBuffer(
24 absl::Span<const uint8_t> span);
Alex Perry5f474f22020-02-01 12:14:24 -080025
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080026} // namespace aos::web_proxy