1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: Support server hijacker

This commit is contained in:
winlin 2020-08-07 17:04:34 +08:00
parent 73eb60a9d5
commit a1da95c906
2 changed files with 39 additions and 0 deletions

View file

@ -72,6 +72,17 @@ public:
virtual void on_timeout(SrsRtcConnection* session) = 0;
};
// The hijacker to hook server.
class ISrsRtcServerHijacker
{
public:
ISrsRtcServerHijacker();
virtual ~ISrsRtcServerHijacker();
public:
// If consumed set to true, server will ignore the packet.
virtual srs_error_t on_udp_packet(bool* pconsumed) = 0;
};
// The RTC server instance, listen UDP port, handle UDP packet, manage RTC connections.
class SrsRtcServer : virtual public ISrsUdpMuxHandler, virtual public ISrsHourGlass
{
@ -79,6 +90,7 @@ private:
SrsHourGlass* timer;
std::vector<SrsUdpMuxListener*> listeners;
ISrsRtcServerHandler* handler;
ISrsRtcServerHijacker* hijacker;
private:
// TODO: FIXME: Rename it.
std::map<std::string, SrsRtcConnection*> map_username_session; // key: username(local_ufrag + ":" + remote_ufrag)
@ -93,6 +105,7 @@ public:
virtual srs_error_t initialize();
// Set the handler for server events.
void set_handler(ISrsRtcServerHandler* h);
void set_hijacker(ISrsRtcServerHijacker* h);
public:
// TODO: FIXME: Support gracefully quit.
// TODO: FIXME: Support reload.