OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
configuration.hpp
1#pragma once
2#include <cstdint>
3#include <optional>
4#include <string>
5
6namespace ossia::net
7{
8enum class framing
9{
10 none,
11 size_prefix, // 4-byte big-endian (backward compatible)
12 slip,
13 line_delimiter,
14 cobs,
15 stx_etx,
16 size_prefix_1byte,
17 size_prefix_2byte_be,
18 size_prefix_2byte_le,
19 size_prefix_4byte_le,
20 fixed_length
21};
22
23struct fd_configuration
24{
25 std::string fd;
26};
27
28struct send_fd_configuration : fd_configuration
29{
30};
31struct receive_fd_configuration : fd_configuration
32{
33};
34
35struct outbound_socket_configuration
36{
37 std::string host;
38 uint16_t port{};
39 bool broadcast{};
40};
41struct inbound_socket_configuration
42{
43 std::string bind{"0.0.0.0"};
44 uint16_t port{};
45};
46
47struct double_fd_configuration
48{
49 std::optional<receive_fd_configuration> local;
50 std::optional<send_fd_configuration> remote;
51};
52
53struct double_socket_configuration
54{
55 std::optional<inbound_socket_configuration> local;
56 std::optional<outbound_socket_configuration> remote;
57};
58
59struct serial_configuration
60{
61 // the serial device name ("COM1", "/dev/ttyUSB1"...)
62 std::string port;
63
64 int baud_rate{19200};
65 int character_size{8};
66 enum
67 {
68 no_flow_control,
69 software,
70 hardware
71 } flow_control{no_flow_control};
72 enum
73 {
74 no_parity,
75 odd,
76 even
77 } parity{no_parity};
78 enum
79 {
80 one,
81 onepointfive,
82 two
83 } stop_bits{one};
84};
85
86struct ws_client_configuration
87{
88 std::string url;
89};
90
91struct ws_server_configuration
92{
93 int port{};
94};
95
96// first / second: the unix sockets name.
97// Must be reverted between host and mirror as they are symmetrical.
98struct unix_dgram_configuration : double_fd_configuration
99{
100};
101
102struct unix_stream_configuration : fd_configuration
103{
104};
105
106struct udp_configuration : double_socket_configuration
107{
108};
109
110struct tcp_client_configuration : outbound_socket_configuration
111{
112};
113
114struct udp_server_configuration : inbound_socket_configuration
115{
116};
117struct tcp_server_configuration : inbound_socket_configuration
118{
119};
120struct unix_dgram_server_configuration : receive_fd_configuration
121{
122};
123struct unix_stream_server_configuration : receive_fd_configuration
124{
125};
126}