1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-23 00:00:01 +01:00
VILLASnode/include/villas/nodes/webrtc/signaling_message.hpp
Steffen Vogel 2d4783599f webrtc: signaling almost working
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
2023-06-16 16:27:54 +02:00

68 lines
1.3 KiB
C++

/** WebRTC signaling messages.
*
* @file
* @author Steffen Vogel <svogel2@eonerc.rwth-aachen.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache 2.0
*********************************************************************************/
#pragma once
#include <string>
#include <chrono>
#include <list>
#include <rtc/rtc.hpp>
#include <jansson.h>
namespace villas {
namespace node {
namespace webrtc {
struct Connection {
int id;
std::string remote;
std::string userAgent;
std::chrono::time_point<std::chrono::system_clock> created;
Connection(json_t *j);
json_t * toJSON() const;
};
struct ControlMessage {
int connectionID;
std::list<Connection> connections;
ControlMessage(json_t *j);
json_t * toJSON() const;
};
class SignalingMessage {
public:
enum Type {
TYPE_CONTROL,
TYPE_OFFER,
TYPE_ANSWER,
TYPE_CANDIDATE
};
Type type;
ControlMessage *control;
rtc::Description *description;
rtc::Candidate *candidate;
std::string mid;
SignalingMessage(rtc::Description desc, bool answer = false);
SignalingMessage(rtc::Candidate cand);
SignalingMessage(json_t *j);
~SignalingMessage();
json_t * toJSON() const;
std::string toString() const;
};
} /* namespace webrtc */
} /* namespace node */
} /* namespace villas */