Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #pragma once |
michael@0 | 6 | |
michael@0 | 7 | #include "CC_Common.h" |
michael@0 | 8 | #include "ECC_Types.h" |
michael@0 | 9 | #include "mozilla/RefPtr.h" |
michael@0 | 10 | |
michael@0 | 11 | extern "C" |
michael@0 | 12 | { |
michael@0 | 13 | #include "ccapi_types.h" |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | #if defined(__cplusplus) && __cplusplus >= 201103L |
michael@0 | 17 | typedef struct Timecard Timecard; |
michael@0 | 18 | #else |
michael@0 | 19 | #include "timecard.h" |
michael@0 | 20 | #endif |
michael@0 | 21 | |
michael@0 | 22 | namespace CSF |
michael@0 | 23 | { |
michael@0 | 24 | class ECC_API CC_Call |
michael@0 | 25 | { |
michael@0 | 26 | public: |
michael@0 | 27 | NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_Call) |
michael@0 | 28 | |
michael@0 | 29 | protected: |
michael@0 | 30 | CC_Call () { } |
michael@0 | 31 | |
michael@0 | 32 | public: |
michael@0 | 33 | virtual ~CC_Call () {} |
michael@0 | 34 | |
michael@0 | 35 | virtual void setRemoteWindow (VideoWindowHandle window) = 0; |
michael@0 | 36 | |
michael@0 | 37 | virtual int setExternalRenderer(VideoFormat videoFormat, ExternalRendererHandle renderer) = 0; |
michael@0 | 38 | |
michael@0 | 39 | virtual void sendIFrame () = 0; |
michael@0 | 40 | |
michael@0 | 41 | virtual CC_CallInfoPtr getCallInfo () = 0; |
michael@0 | 42 | |
michael@0 | 43 | virtual std::string toString() = 0; |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | Originate call - API to go offhook and dial specified digits on a given call |
michael@0 | 47 | |
michael@0 | 48 | @param [in] video_pref - video direction desired on call |
michael@0 | 49 | @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook |
michael@0 | 50 | |
michael@0 | 51 | @return true or false. |
michael@0 | 52 | */ |
michael@0 | 53 | virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits) = 0; |
michael@0 | 54 | |
michael@0 | 55 | /** |
michael@0 | 56 | Use this function to answer an incoming call. |
michael@0 | 57 | |
michael@0 | 58 | @param[in] video_pref - video direction desired on call |
michael@0 | 59 | |
michael@0 | 60 | @return true or false. |
michael@0 | 61 | */ |
michael@0 | 62 | virtual bool answerCall (cc_sdp_direction_t video_pref) = 0; |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | Use this function to put an active call on hold. |
michael@0 | 66 | |
michael@0 | 67 | @param[in] reason - If the user chooses to put the call on hold then |
michael@0 | 68 | CC_HOLD_REASON_NONE should be the value passed in here. |
michael@0 | 69 | |
michael@0 | 70 | @return true or false. If it's not appropriate to put this call on |
michael@0 | 71 | hold at the moment then this function will return false. |
michael@0 | 72 | */ |
michael@0 | 73 | virtual bool hold (cc_hold_reason_t reason) = 0; |
michael@0 | 74 | |
michael@0 | 75 | /** |
michael@0 | 76 | Use this function to resume a call that is currently on hold. |
michael@0 | 77 | |
michael@0 | 78 | @param [in] video_pref - video direction desired on call |
michael@0 | 79 | |
michael@0 | 80 | @return true or false |
michael@0 | 81 | */ |
michael@0 | 82 | virtual bool resume (cc_sdp_direction_t video_pref) = 0; |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | Use this function to end an active call. |
michael@0 | 86 | |
michael@0 | 87 | @return true or false |
michael@0 | 88 | */ |
michael@0 | 89 | virtual bool endCall() = 0; |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | Send digits on the call - can be invoked either to dial additional digits or send DTMF |
michael@0 | 93 | |
michael@0 | 94 | @param [in] digit - digit to be dialed |
michael@0 | 95 | |
michael@0 | 96 | @return true or false |
michael@0 | 97 | */ |
michael@0 | 98 | virtual bool sendDigit (cc_digit_t digit) = 0; |
michael@0 | 99 | |
michael@0 | 100 | /** |
michael@0 | 101 | Send Backspace - Delete last digit dialed. |
michael@0 | 102 | |
michael@0 | 103 | @return true or false |
michael@0 | 104 | */ |
michael@0 | 105 | virtual bool backspace() = 0; |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | Redial |
michael@0 | 109 | |
michael@0 | 110 | @param [in] video_pref - video direction desired on call |
michael@0 | 111 | @return true or false |
michael@0 | 112 | */ |
michael@0 | 113 | virtual bool redial (cc_sdp_direction_t video_pref) = 0; |
michael@0 | 114 | |
michael@0 | 115 | /** |
michael@0 | 116 | Initiate Call Forward All |
michael@0 | 117 | |
michael@0 | 118 | @return true or false |
michael@0 | 119 | */ |
michael@0 | 120 | virtual bool initiateCallForwardAll() = 0; |
michael@0 | 121 | |
michael@0 | 122 | /** |
michael@0 | 123 | end Consult leg - used to end consult leg when the user picks active calls list for xfer/conf |
michael@0 | 124 | |
michael@0 | 125 | @return true or false |
michael@0 | 126 | */ |
michael@0 | 127 | virtual bool endConsultativeCall() = 0; |
michael@0 | 128 | |
michael@0 | 129 | /** |
michael@0 | 130 | Initiate a conference |
michael@0 | 131 | |
michael@0 | 132 | @param [in] video_pref - video direction desired on consult call |
michael@0 | 133 | |
michael@0 | 134 | @return true or false |
michael@0 | 135 | */ |
michael@0 | 136 | virtual bool conferenceStart (cc_sdp_direction_t video_pref) = 0; |
michael@0 | 137 | |
michael@0 | 138 | /** |
michael@0 | 139 | complete conference |
michael@0 | 140 | |
michael@0 | 141 | @param [in] otherCall - CC_CallPtr of the other leg |
michael@0 | 142 | @param [in] video_pref - video direction desired on consult call |
michael@0 | 143 | |
michael@0 | 144 | @return true or false |
michael@0 | 145 | */ |
michael@0 | 146 | virtual bool conferenceComplete (CC_CallPtr otherLog, cc_sdp_direction_t video_pref) = 0; |
michael@0 | 147 | |
michael@0 | 148 | /** |
michael@0 | 149 | start transfer |
michael@0 | 150 | |
michael@0 | 151 | @param [in] video_pref - video direction desired on consult call |
michael@0 | 152 | |
michael@0 | 153 | @return true or false |
michael@0 | 154 | */ |
michael@0 | 155 | virtual bool transferStart (cc_sdp_direction_t video_pref) = 0; |
michael@0 | 156 | |
michael@0 | 157 | /** |
michael@0 | 158 | complete transfer |
michael@0 | 159 | |
michael@0 | 160 | @param [in] otherLeg - CC_CallPtr of the other leg |
michael@0 | 161 | @param [in] video_pref - video direction desired on consult call |
michael@0 | 162 | |
michael@0 | 163 | @return true or false |
michael@0 | 164 | */ |
michael@0 | 165 | virtual bool transferComplete (CC_CallPtr otherLeg, |
michael@0 | 166 | cc_sdp_direction_t video_pref) = 0; |
michael@0 | 167 | |
michael@0 | 168 | /** |
michael@0 | 169 | cancel conference or transfer |
michael@0 | 170 | |
michael@0 | 171 | @return true or false |
michael@0 | 172 | */ |
michael@0 | 173 | virtual bool cancelTransferOrConferenceFeature() = 0; |
michael@0 | 174 | |
michael@0 | 175 | /** |
michael@0 | 176 | direct Transfer |
michael@0 | 177 | |
michael@0 | 178 | @param [in] target - call handle for transfer target call |
michael@0 | 179 | @return true or false |
michael@0 | 180 | */ |
michael@0 | 181 | virtual bool directTransfer (CC_CallPtr target) = 0; |
michael@0 | 182 | |
michael@0 | 183 | /** |
michael@0 | 184 | Join Across line |
michael@0 | 185 | |
michael@0 | 186 | @param [in] target - join target |
michael@0 | 187 | @return true or false |
michael@0 | 188 | */ |
michael@0 | 189 | virtual bool joinAcrossLine (CC_CallPtr target) = 0; |
michael@0 | 190 | |
michael@0 | 191 | /** |
michael@0 | 192 | BLF Call Pickup |
michael@0 | 193 | |
michael@0 | 194 | @param [in] video_pref - video direction preference |
michael@0 | 195 | @param [in] speed - speedDial Number |
michael@0 | 196 | @return true or false |
michael@0 | 197 | */ |
michael@0 | 198 | virtual bool blfCallPickup (cc_sdp_direction_t video_pref, const std::string & speed) = 0; |
michael@0 | 199 | |
michael@0 | 200 | /** |
michael@0 | 201 | Select a call |
michael@0 | 202 | |
michael@0 | 203 | @return true or false |
michael@0 | 204 | */ |
michael@0 | 205 | virtual bool select() = 0; |
michael@0 | 206 | |
michael@0 | 207 | /** |
michael@0 | 208 | Update Video Media Cap for the call |
michael@0 | 209 | |
michael@0 | 210 | @param [in] video_pref - video direction desired on call |
michael@0 | 211 | @return true or false |
michael@0 | 212 | */ |
michael@0 | 213 | virtual bool updateVideoMediaCap (cc_sdp_direction_t video_pref) = 0; |
michael@0 | 214 | |
michael@0 | 215 | /** |
michael@0 | 216 | send INFO method for the call |
michael@0 | 217 | @param [in] handle - call handle |
michael@0 | 218 | @param [in] infopackage - Info-Package header value |
michael@0 | 219 | @param [in] infotype - Content-Type header val |
michael@0 | 220 | @param [in] infobody - Body of the INFO message |
michael@0 | 221 | @return true or false |
michael@0 | 222 | */ |
michael@0 | 223 | virtual bool sendInfo (const std::string & infopackage, const std::string & infotype, const std::string & infobody) = 0; |
michael@0 | 224 | |
michael@0 | 225 | /** |
michael@0 | 226 | API to mute audio |
michael@0 | 227 | |
michael@0 | 228 | @return true if the operation succeeded |
michael@0 | 229 | |
michael@0 | 230 | NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
michael@0 | 231 | */ |
michael@0 | 232 | virtual bool muteAudio(void) = 0; |
michael@0 | 233 | |
michael@0 | 234 | |
michael@0 | 235 | /** |
michael@0 | 236 | API to unmute audio |
michael@0 | 237 | |
michael@0 | 238 | @return true if the operation succeeded |
michael@0 | 239 | |
michael@0 | 240 | NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
michael@0 | 241 | */ |
michael@0 | 242 | virtual bool unmuteAudio(void) = 0; |
michael@0 | 243 | /** |
michael@0 | 244 | API to mute video |
michael@0 | 245 | |
michael@0 | 246 | @return true if the operation succeeded |
michael@0 | 247 | |
michael@0 | 248 | NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
michael@0 | 249 | */ |
michael@0 | 250 | virtual bool muteVideo(void) = 0; |
michael@0 | 251 | |
michael@0 | 252 | |
michael@0 | 253 | /** |
michael@0 | 254 | API to unmute video |
michael@0 | 255 | |
michael@0 | 256 | @return true if the operation succeeded |
michael@0 | 257 | |
michael@0 | 258 | NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
michael@0 | 259 | */ |
michael@0 | 260 | virtual bool unmuteVideo(void) = 0; |
michael@0 | 261 | |
michael@0 | 262 | |
michael@0 | 263 | /** |
michael@0 | 264 | API to set the call volume, acceptable values are 0 - 100 |
michael@0 | 265 | @return true if volume set successfully, false if value out of range or change failed |
michael@0 | 266 | */ |
michael@0 | 267 | virtual bool setVolume(int volume) = 0; |
michael@0 | 268 | |
michael@0 | 269 | |
michael@0 | 270 | /** |
michael@0 | 271 | Originate P2P call - API to go offhook and dial specified digits\user on a given call |
michael@0 | 272 | |
michael@0 | 273 | @param [in] video_pref - video direction desired on call |
michael@0 | 274 | @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook |
michael@0 | 275 | @param [in] ip address - the ip address of the peer to call |
michael@0 | 276 | |
michael@0 | 277 | @return void |
michael@0 | 278 | */ |
michael@0 | 279 | virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0; |
michael@0 | 280 | |
michael@0 | 281 | virtual void createOffer (cc_media_constraints_t* constraints, Timecard *) = 0; |
michael@0 | 282 | |
michael@0 | 283 | virtual void createAnswer(cc_media_constraints_t* constraints, Timecard *) = 0; |
michael@0 | 284 | |
michael@0 | 285 | virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *) = 0; |
michael@0 | 286 | |
michael@0 | 287 | virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *) = 0; |
michael@0 | 288 | |
michael@0 | 289 | virtual void setPeerConnection(const std::string& handle) = 0; |
michael@0 | 290 | |
michael@0 | 291 | virtual void addStream(cc_media_stream_id_t stream_id, |
michael@0 | 292 | cc_media_track_id_t track_id, |
michael@0 | 293 | cc_media_type_t media_type, |
michael@0 | 294 | cc_media_constraints_t *constraints) = 0; |
michael@0 | 295 | |
michael@0 | 296 | virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) = 0; |
michael@0 | 297 | |
michael@0 | 298 | virtual const std::string& getPeerConnection() const = 0; |
michael@0 | 299 | |
michael@0 | 300 | virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level, Timecard *) = 0; |
michael@0 | 301 | |
michael@0 | 302 | }; |
michael@0 | 303 | } |
michael@0 | 304 |