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
41 std::optional<int> multicast_ttl;
42 std::string multicast_interface{};
43 std::optional<bool> multicast_loopback;
44};
45struct inbound_socket_configuration
46{
47 std::string bind{"0.0.0.0"};
48 uint16_t port{};
49 std::string multicast_group{};
50 std::string multicast_interface{"0.0.0.0"};
51};
52
53struct double_fd_configuration
54{
55 std::optional<receive_fd_configuration> local;
56 std::optional<send_fd_configuration> remote;
57};
58
59struct double_socket_configuration
60{
61 std::optional<inbound_socket_configuration> local;
62 std::optional<outbound_socket_configuration> remote;
63};
64
65struct serial_configuration
66{
67 // the serial device name ("COM1", "/dev/ttyUSB1"...)
68 std::string port;
69
70 int baud_rate{19200};
71 int character_size{8};
72 enum
73 {
74 no_flow_control,
75 software,
76 hardware
77 } flow_control{no_flow_control};
78 enum
79 {
80 no_parity,
81 odd,
82 even
83 } parity{no_parity};
84 enum
85 {
86 one,
87 onepointfive,
88 two
89 } stop_bits{one};
90};
91
92struct ws_client_configuration
93{
94 std::string url;
95};
96
97struct ws_server_configuration
98{
99 int port{};
100};
101
102// first / second: the unix sockets name.
103// Must be reverted between host and mirror as they are symmetrical.
104struct unix_dgram_configuration : double_fd_configuration
105{
106};
107
108struct unix_stream_configuration : fd_configuration
109{
110};
111
112struct udp_configuration : double_socket_configuration
113{
114};
115
116struct tcp_client_configuration : outbound_socket_configuration
117{
118};
119
120struct udp_server_configuration : inbound_socket_configuration
121{
122};
123struct tcp_server_configuration : inbound_socket_configuration
124{
125};
126struct unix_dgram_server_configuration : receive_fd_configuration
127{
128};
129struct unix_stream_server_configuration : receive_fd_configuration
130{
131};
132}