Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 1 | // 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. |
| 4 | include "aos/configuration.fbs"; |
| 5 | include "aos/network/connect.fbs"; |
| 6 | |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 7 | namespace aos.web_proxy; |
| 8 | |
| 9 | // SDP is Session Description Protocol. We only handle OFFER (starting a |
| 10 | // transaction) and ANSWER responding to an offer. |
| 11 | enum 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. |
| 18 | table 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. |
| 26 | table WebSocketIce { |
| 27 | candidate:string; |
| 28 | sdpMid:string; |
| 29 | sdpMLineIndex:int; |
| 30 | } |
| 31 | |
| 32 | union Payload {WebSocketSdp, WebSocketIce} |
| 33 | |
| 34 | // We only send a single type of message on the websocket to simplify parsing. |
| 35 | table WebSocketMessage { |
| 36 | payload:Payload; |
| 37 | } |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 38 | |
| 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. |
| 43 | table 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 Kuszmaul | 48413bf | 2020-09-01 19:19:05 -0700 | [diff] [blame] | 60 | |
| 61 | // Time at which the message was sent, in nanoseconds. |
| 62 | monotonic_sent_time:long; |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 63 | } |