2 #include <ossia/detail/lockfree_queue.hpp>
3 #include <ossia/detail/mutex.hpp>
4 #include <ossia/network/base/listening.hpp>
5 #include <ossia/network/base/protocol.hpp>
6 #include <ossia/network/context_functions.hpp>
7 #include <ossia/network/generic/generic_device.hpp>
8 #include <ossia/network/sockets/websocket_reply.hpp>
9 #include <ossia/network/zeroconf/zeroconf.hpp>
11 #include <ossia/detail/hash_map.hpp>
13 #include <nano_signal_slot.hpp>
24 class ReceivedMessage;
31 class websocket_server;
36 class get_query_answerer;
37 struct json_query_answerer;
39 namespace oscquery_asio
41 struct oscquery_client;
42 using clients = std::vector<std::unique_ptr<oscquery_client>>;
46 friend struct oscquery_client;
47 friend class ossia::oscquery::query_answerer;
52 using connection_handler = std::weak_ptr<void>;
54 ossia::net::network_context_ptr ctx, uint16_t osc_port = 1234,
55 uint16_t ws_port = 5678);
63 bool push_bundle(
const std::vector<const ossia::net::parameter_base*>&)
override;
64 bool push_raw_bundle(
const std::vector<ossia::net::full_parameter_data>&)
override;
65 bool echo_incoming_message(
76 int get_osc_port()
const {
return m_oscPort; }
78 int get_ws_port()
const {
return m_wsPort; }
80 Nano::Signal<void(
const std::string&)> onClientConnected;
81 Nano::Signal<void(
const std::string&)> onClientDisconnected;
85 oscquery_client* find_client(
const connection_handler& hdl);
87 void add_node(std::string_view path,
const string_map<std::string>& parameters);
88 void remove_node(std::string_view path,
const std::string& node);
89 void rename_node(std::string_view node,
const std::string& new_name);
92 void on_osc_message(
const oscpack::ReceivedMessage& m);
93 void process_raw_osc_data(
const char* data, std::size_t sz);
96 void on_connectionOpen(
const connection_handler& hdl);
97 void on_connectionClosed(
const connection_handler& hdl);
106 template <
typename T>
109 bool write_impl(std::string_view data,
bool critical);
111 void update_zeroconf();
114 ossia::net::server_reply
115 on_text_ws_message(
const connection_handler& hdl,
const std::string&
message);
116 ossia::net::server_reply
117 on_binary_ws_message(
const connection_handler& hdl,
const std::string&
message);
119 ossia::net::network_context_ptr m_context;
121 struct osc_receiver_impl;
122 std::unique_ptr<osc_receiver_impl> m_oscServer;
123 std::unique_ptr<ossia::net::websocket_server> m_websocketServer;
125 net::zeroconf_server m_zeroconfServerWS;
126 net::zeroconf_server m_zeroconfServerOSC;
129 net::listened_parameters m_listening;
133 std::atomic_int m_clientCount{};
138 mutex_t m_clientsMutex;
141 uint16_t m_oscPort{};
Root of a device tree.
Definition: ossia/network/base/device.hpp:58
The node_base class.
Definition: network/base/node.hpp:48
The parameter_base class.
Definition: ossia/network/base/parameter.hpp:48
The protocol_base class.
Definition: protocol.hpp:40
OSCQuery get query-answering logic.
Definition: get_query_parser.hpp:26
Implementation of an oscquery server.
Definition: oscquery_server_asio.hpp:45
The value class.
Definition: value.hpp:173
The message struct.
Definition: message.hpp:29
Full information about a parameter.
Definition: parameter_data.hpp:61
OSCQuery JSON query-answering logic.
Definition: json_query_parser.hpp:16