OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
osc_factory.hpp
1#pragma once
2#include <ossia/detail/variant.hpp>
3#include <ossia/network/base/protocol.hpp>
4#include <ossia/network/context_functions.hpp>
5#include <ossia/network/sockets/configuration.hpp>
6
7namespace ossia::net
8{
9using osc_server_configuration = ossia::variant<
10 udp_server_configuration, tcp_server_configuration, unix_dgram_server_configuration,
11 unix_stream_server_configuration, serial_configuration, ws_server_configuration>;
12
13using osc_transport_configuration = ossia::variant<
14 udp_configuration, tcp_client_configuration, tcp_server_configuration,
15 unix_dgram_configuration, unix_stream_configuration, serial_configuration,
16 ws_client_configuration, ws_server_configuration>;
17
18struct osc_protocol_configuration
19{
20 // libossia semantic level: host can change any parameter, mirror can only
21 // change BI / SET
22 enum
23 {
24 HOST,
25 MIRROR
26 } mode{HOST};
27
28 enum
29 {
30 OSC1_0,
31 OSC1_1,
32 EXTENDED
33 } version{OSC1_0};
34
35 // Only relevant for stream protocols (TCP, SERIAL, UNIX_STREAM), unused for
36 // UDP, UNIX_DGRAM, WEBSOCKETS
37 enum
38 {
39 SIZE_PREFIX,
40 SLIP
41 } framing{SLIP};
42
43 enum
44 {
45 NEVER_BUNDLE,
46 ALWAYS_BUNDLE
47 } bundle_strategy{NEVER_BUNDLE};
48
49 osc_transport_configuration transport;
50};
51
52using osc_protocol_base = can_learn<protocol_base>;
53[[nodiscard]] OSSIA_EXPORT std::unique_ptr<osc_protocol_base>
54make_osc_protocol(network_context_ptr ctx, osc_protocol_configuration config);
55}