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