2 #include <ossia/detail/mutex.hpp>
4 #include <ossia/network/common/network_logger.hpp>
5 #include <ossia/network/context.hpp>
6 #include <ossia/network/osc/detail/sender.hpp>
7 #include <ossia/network/oscquery/detail/outbound_visitor.hpp>
8 #include <ossia/network/sockets/udp_socket.hpp>
9 #include <ossia/network/sockets/websocket_server.hpp>
10 #include <ossia/protocols/oscquery/oscquery_server_asio.hpp>
12 namespace ossia::oscquery_asio
14 struct oscquery_client
16 ossia::net::websocket_server::connection_handler connection;
17 mutex_t listeningMutex;
18 string_map<ossia::net::parameter_base*> listening TS_GUARDED_BY(listeningMutex);
20 std::string client_ip;
21 std::unique_ptr<ossia::net::udp_send_socket> osc_socket;
22 int remote_sender_port{};
25 oscquery_client() =
delete;
26 oscquery_client(
const oscquery_client& other) noexcept =
delete;
27 oscquery_client& operator=(
const oscquery_client& other) noexcept =
delete;
28 oscquery_client(oscquery_client&& other) noexcept =
delete;
29 oscquery_client& operator=(oscquery_client&& other) noexcept =
delete;
31 explicit oscquery_client(ossia::net::websocket_server::connection_handler h)
32 : connection{std::move(h)}
40 std::lock_guard lck{listeningMutex};
41 listening.insert(std::make_pair(std::move(path), addr));
45 void stop_listen(
const std::string& path)
47 std::lock_guard lck{listeningMutex};
48 listening.erase(path);
51 bool operator==(
const ossia::net::websocket_server::connection_handler& h)
const
53 return !connection.expired() && connection.lock() == h.lock();
59 osc_socket = std::make_unique<ossia::net::udp_send_socket>(
60 ossia::net::socket_configuration{client_ip, port}, proto.m_context->context);
61 osc_socket->connect();
The parameter_base class.
Definition: ossia/network/base/parameter.hpp:48
Implementation of an oscquery server.
Definition: oscquery_server_asio.hpp:45