blob: 196d38c7ade8b9859b8a9a779b8f8de4a23e46bf [file] [log] [blame]
Alex Perry5f474f22020-02-01 12:14:24 -08001// Typescript namespaces are weird when coming from multiple files. We generate
2// all transitive dependencies into the same file in typescript so we can
3// include all 'aos' flatbuffers we care about here.
4include "aos/configuration.fbs";
5include "aos/network/connect.fbs";
6
Alex Perryb3b50792020-01-18 16:13:45 -08007namespace aos.web_proxy;
8
9// SDP is Session Description Protocol. We only handle OFFER (starting a
10// transaction) and ANSWER responding to an offer.
11enum SdpType : byte {
12 OFFER,
13 ANSWER
14}
15
16// The SDP payload is an opaque string that describes what (media/data) we
17// want to transmit.
18table WebSocketSdp {
19 type:SdpType;
20 payload:string;
21}
22
23// ICE is way for different peers to learn how to connect to each other.
24// Because we will only be running in a local network, we don't have to support
25// advaced features.
26table WebSocketIce {
27 candidate:string;
28 sdpMid:string;
29 sdpMLineIndex:int;
30}
31
32union Payload {WebSocketSdp, WebSocketIce}
33
34// We only send a single type of message on the websocket to simplify parsing.
35table WebSocketMessage {
36 payload:Payload;
37}
Alex Perry5f474f22020-02-01 12:14:24 -080038
39// WebRTC has size limits on the messages sent on datachannels. This message
40// ensures that parts are recieved in the correct order. If there is any
41// mismatch, all the existing work should be dropped and restart when reasonable
42// data starts again.
43table MessageHeader {
44 // Index of the channel in config
45 channel_index:uint;
46
47 // How many packets will be required for the message being sent.
48 packet_count:uint;
49 // What index into the the total packets for the multipart message, this
50 // header is parts of.
51 packet_index:uint;
52
53 // Total number of bytes in the message
54 length:uint;
55
56 // Index into the sequence of messages. This will not always increase.
57 queue_index:uint;
58
59 data:[ubyte];
James Kuszmaul48413bf2020-09-01 19:19:05 -070060
61 // Time at which the message was sent, in nanoseconds.
62 monotonic_sent_time:long;
Alex Perry5f474f22020-02-01 12:14:24 -080063}