Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef _JSEPTRANSPORT_H_
6 : #define _JSEPTRANSPORT_H_
7 :
8 : #include <string>
9 : #include <vector>
10 :
11 : #include <mozilla/RefPtr.h>
12 : #include <mozilla/UniquePtr.h>
13 : #include "nsISupportsImpl.h"
14 :
15 : #include "signaling/src/sdp/SdpAttribute.h"
16 :
17 : namespace mozilla {
18 :
19 : class JsepDtlsTransport
20 : {
21 : public:
22 0 : JsepDtlsTransport() : mRole(kJsepDtlsInvalidRole) {}
23 :
24 0 : virtual ~JsepDtlsTransport() {}
25 :
26 : enum Role {
27 : kJsepDtlsClient,
28 : kJsepDtlsServer,
29 : kJsepDtlsInvalidRole
30 : };
31 :
32 : virtual const SdpFingerprintAttributeList&
33 0 : GetFingerprints() const
34 : {
35 0 : return mFingerprints;
36 : }
37 :
38 : virtual Role
39 0 : GetRole() const
40 : {
41 0 : return mRole;
42 : }
43 :
44 : private:
45 : friend class JsepSessionImpl;
46 :
47 : SdpFingerprintAttributeList mFingerprints;
48 : Role mRole;
49 : };
50 :
51 : class JsepIceTransport
52 : {
53 : public:
54 0 : JsepIceTransport() {}
55 :
56 0 : virtual ~JsepIceTransport() {}
57 :
58 : const std::string&
59 0 : GetUfrag() const
60 : {
61 0 : return mUfrag;
62 : }
63 : const std::string&
64 0 : GetPassword() const
65 : {
66 0 : return mPwd;
67 : }
68 : const std::vector<std::string>&
69 0 : GetCandidates() const
70 : {
71 0 : return mCandidates;
72 : }
73 :
74 : private:
75 : friend class JsepSessionImpl;
76 :
77 : std::string mUfrag;
78 : std::string mPwd;
79 : std::vector<std::string> mCandidates;
80 : };
81 :
82 : class JsepTransport
83 : {
84 : public:
85 0 : JsepTransport()
86 0 : : mComponents(0)
87 : {
88 0 : }
89 :
90 0 : void Close()
91 : {
92 0 : mComponents = 0;
93 0 : mTransportId.clear();
94 0 : mIce.reset();
95 0 : mDtls.reset();
96 0 : }
97 :
98 : // Unique identifier for this transport within this call. Group?
99 : std::string mTransportId;
100 :
101 : // ICE stuff.
102 : UniquePtr<JsepIceTransport> mIce;
103 : UniquePtr<JsepDtlsTransport> mDtls;
104 :
105 : // Number of required components.
106 : size_t mComponents;
107 :
108 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(JsepTransport);
109 :
110 : protected:
111 0 : ~JsepTransport() {}
112 : };
113 :
114 : } // namespace mozilla
115 :
116 : #endif
|