James Kuszmaul | 1ec7443 | 2020-07-30 20:26:45 -0700 | [diff] [blame^] | 1 | #include "absl/types/span.h" |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 2 | #include "aos/network/web_proxy_generated.h" |
| 3 | #include "aos/events/event_loop.h" |
James Kuszmaul | 1ec7443 | 2020-07-30 20:26:45 -0700 | [diff] [blame^] | 4 | #include "aos/flatbuffers.h" |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 5 | |
| 6 | namespace aos { |
| 7 | namespace web_proxy { |
| 8 | |
| 9 | int GetPacketCount(const Context &context); |
| 10 | |
| 11 | /* |
| 12 | * Packs a message embedded in context into a MessageHeader on fbb. Handles |
| 13 | * multipart messages by use of the packet_index. |
| 14 | * TODO(alex): make this an iterator that returns each packet sequentially |
| 15 | */ |
| 16 | flatbuffers::Offset<MessageHeader> PackMessage( |
| 17 | flatbuffers::FlatBufferBuilder *fbb, const Context &context, |
| 18 | int channel_index, int packet_index); |
| 19 | |
James Kuszmaul | 1ec7443 | 2020-07-30 20:26:45 -0700 | [diff] [blame^] | 20 | // Packs the provided raw data into a series of MessageHeader's of the |
| 21 | // appropriate length. |
| 22 | std::vector<FlatbufferDetachedBuffer<MessageHeader>> PackBuffer( |
| 23 | absl::Span<const uint8_t> span); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 24 | |
| 25 | } // namespace web_proxy |
| 26 | } // namespace aos |