OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebRTCConfiguration_h | 31 #ifndef WebRTCConfiguration_h |
32 #define WebRTCConfiguration_h | 32 #define WebRTCConfiguration_h |
33 | 33 |
34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
35 #include "WebNonCopyable.h" | 35 #include "WebRTCCertificate.h" |
36 #include "WebPrivatePtr.h" | 36 #include "WebURL.h" |
37 #include "WebVector.h" | 37 #include "WebVector.h" |
38 | 38 |
| 39 #include <memory> |
| 40 |
39 namespace blink { | 41 namespace blink { |
40 | 42 |
41 class RTCIceServer; | |
42 class RTCConfiguration; | |
43 class WebRTCCertificate; | |
44 class WebString; | 43 class WebString; |
45 class WebURL; | |
46 | 44 |
47 class WebRTCICEServer { | 45 struct WebRTCIceServer { |
48 public: | 46 WebURL url; |
49 WebRTCICEServer() {} | 47 WebString username; |
50 WebRTCICEServer(const WebRTCICEServer& other) { assign(other); } | 48 WebString credential; |
51 ~WebRTCICEServer() { reset(); } | |
52 | |
53 WebRTCICEServer& operator=(const WebRTCICEServer& other) { | |
54 assign(other); | |
55 return *this; | |
56 } | |
57 | |
58 BLINK_PLATFORM_EXPORT void assign(const WebRTCICEServer&); | |
59 | |
60 BLINK_PLATFORM_EXPORT void reset(); | |
61 bool isNull() const { return m_private.isNull(); } | |
62 | |
63 BLINK_PLATFORM_EXPORT WebURL uri() const; | |
64 BLINK_PLATFORM_EXPORT WebString username() const; | |
65 BLINK_PLATFORM_EXPORT WebString credential() const; | |
66 | |
67 #if INSIDE_BLINK | |
68 BLINK_PLATFORM_EXPORT WebRTCICEServer(RTCIceServer*); | |
69 #endif | |
70 | |
71 private: | |
72 WebPrivatePtr<RTCIceServer> m_private; | |
73 }; | 49 }; |
74 | 50 |
75 enum WebRTCIceTransports { | 51 enum class WebRTCIceTransports { kNone, kRelay, kAll }; |
76 WebRTCIceTransportsNone, | |
77 WebRTCIceTransportsRelay, | |
78 WebRTCIceTransportsAll | |
79 }; | |
80 | 52 |
81 enum WebRTCBundlePolicy { | 53 enum class WebRTCBundlePolicy { kBalanced, kMaxCompat, kMaxBundle }; |
82 WebRTCBundlePolicyBalanced, | |
83 WebRTCBundlePolicyMaxCompat, | |
84 WebRTCBundlePolicyMaxBundle | |
85 }; | |
86 | 54 |
87 enum WebRTCRtcpMuxPolicy { | 55 enum class WebRTCRtcpMuxPolicy { kNegotiate, kRequire }; |
88 WebRTCRtcpMuxPolicyNegotiate, | |
89 WebRTCRtcpMuxPolicyRequire | |
90 }; | |
91 | 56 |
92 class WebRTCConfiguration { | 57 struct WebRTCConfiguration { |
93 public: | 58 WebVector<WebRTCIceServer> iceServers; |
94 WebRTCConfiguration() {} | 59 WebRTCIceTransports iceTransports = WebRTCIceTransports::kAll; |
95 WebRTCConfiguration(const WebRTCConfiguration& other) { assign(other); } | 60 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced; |
96 ~WebRTCConfiguration() { reset(); } | 61 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate; |
97 | 62 WebVector<std::unique_ptr<WebRTCCertificate>> certificates; |
98 WebRTCConfiguration& operator=(const WebRTCConfiguration& other) { | |
99 assign(other); | |
100 return *this; | |
101 } | |
102 | |
103 BLINK_PLATFORM_EXPORT void assign(const WebRTCConfiguration&); | |
104 | |
105 BLINK_PLATFORM_EXPORT void reset(); | |
106 bool isNull() const { return m_private.isNull(); } | |
107 | |
108 BLINK_PLATFORM_EXPORT WebRTCIceTransports iceTransports() const; | |
109 | |
110 BLINK_PLATFORM_EXPORT WebRTCBundlePolicy bundlePolicy() const; | |
111 | |
112 BLINK_PLATFORM_EXPORT WebRTCRtcpMuxPolicy rtcpMuxPolicy() const; | |
113 BLINK_PLATFORM_EXPORT size_t numberOfServers() const; | |
114 BLINK_PLATFORM_EXPORT WebRTCICEServer server(size_t index) const; | |
115 | |
116 BLINK_PLATFORM_EXPORT size_t numberOfCertificates() const; | |
117 BLINK_PLATFORM_EXPORT WebRTCCertificate* certificate(size_t index) const; | |
118 | |
119 #if INSIDE_BLINK | |
120 BLINK_PLATFORM_EXPORT WebRTCConfiguration(RTCConfiguration*); | |
121 #endif | |
122 | |
123 private: | |
124 WebPrivatePtr<RTCConfiguration> m_private; | |
125 }; | 63 }; |
126 | 64 |
127 } // namespace blink | 65 } // namespace blink |
128 | 66 |
129 #endif // WebRTCConfiguration_h | 67 #endif // WebRTCConfiguration_h |
OLD | NEW |