This repository was archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForwarder.h
More file actions
86 lines (70 loc) · 2.41 KB
/
Forwarder.h
File metadata and controls
86 lines (70 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include <string>
#include <memory>
#include <functional>
#include <RtspParser/Request.h>
#include <RtspParser/Response.h>
#include <RtspParser/RtspParser.h>
class Config;
class FrontSession;
class BackSession;
class Forwarder
{
public:
typedef std::map<const std::string, const std::string> AuthTokens;
Forwarder(const Config&);
~Forwarder();
const Config& config() const;
std::unique_ptr<FrontSession>
createFrontSession(
const std::function<void (const rtsp::Request*) noexcept>& sendRequest,
const std::function<void (const rtsp::Response*) noexcept>& sendResponse) noexcept;
std::unique_ptr<BackSession>
createBackSession(
const std::function<void (const rtsp::Request*) noexcept>& sendRequest,
const std::function<void (const rtsp::Response*) noexcept>& sendResponse) noexcept;
bool registerBackSession(
const std::string& name,
const std::string& token,
BackSession*);
void removeBackSession(const std::string& name, BackSession*);
bool swapBackSessionSourcesList(
const std::string& name,
rtsp::Parameters* sourcesList);
const std::string& allSourcesList();
void registerMediaSession(
FrontSession*,
const rtsp::SessionId& frontMediaSession,
BackSession*,
const rtsp::SessionId& backMediaSession);
void unregisterMediaSession(
FrontSession*,
const rtsp::SessionId& frontMediaSession,
BackSession*,
const rtsp::SessionId& backMediaSession);
bool forwardToBackSession(
FrontSession* source,
BackSession* target,
std::unique_ptr<rtsp::Request>&);
bool forwardToBackSession(
BackSession* target,
const rtsp::Response&);
bool forwardToFrontSession(
BackSession* source,
FrontSession* target,
std::unique_ptr<rtsp::Request>&);
bool forwardToFrontSession(
BackSession* source,
FrontSession* target,
const rtsp::Request&,
std::unique_ptr<rtsp::Response>&);
void cancelRequest(BackSession*, const rtsp::CSeq&);
void forceTeardown(BackSession*, const rtsp::SessionId&);
void cancelRequest(FrontSession*, const rtsp::CSeq&);
void forceTeardown(FrontSession*, const rtsp::SessionId&);
private:
void clearCachedSourcesList();
private:
struct Private;
std::unique_ptr<Private> _p;
};