media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

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 #ifndef _CC_SIPCCCALL_H
michael@0 6 #define _CC_SIPCCCALL_H
michael@0 7
michael@0 8 #include "CC_Call.h"
michael@0 9
michael@0 10 #include <map>
michael@0 11
michael@0 12 #if defined(__cplusplus) && __cplusplus >= 201103L
michael@0 13 typedef struct Timecard Timecard;
michael@0 14 #else
michael@0 15 #include "timecard.h"
michael@0 16 #endif
michael@0 17
michael@0 18 #include "common/Wrapper.h"
michael@0 19 #include "common/csf_common.h"
michael@0 20 #include "mozilla/Mutex.h"
michael@0 21 #include "base/lock.h"
michael@0 22
michael@0 23 namespace CSF
michael@0 24 {
michael@0 25 struct StreamInfo
michael@0 26 {
michael@0 27 // a bit of overkill having a structure just for video, but we may have other properties later
michael@0 28 bool isVideo;
michael@0 29 };
michael@0 30 typedef std::map<int, StreamInfo> StreamMapType;
michael@0 31
michael@0 32 DECLARE_NS_PTR(CC_SIPCCCallMediaData);
michael@0 33
michael@0 34 class CC_SIPCCCallMediaData
michael@0 35 {
michael@0 36 public:
michael@0 37 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_SipCCCAllMediaData)
michael@0 38 CC_SIPCCCallMediaData():
michael@0 39 remoteWindow(nullptr),
michael@0 40 streamMapMutex("CC_SIPCCCallMediaData"),
michael@0 41 audioMuteState(false),
michael@0 42 videoMuteState(false),
michael@0 43 volume(-1){}
michael@0 44 CC_SIPCCCallMediaData(VideoWindowHandle remoteWindow,
michael@0 45 bool audioMuteState, bool videoMuteState, int volume):
michael@0 46 remoteWindow(remoteWindow),
michael@0 47 streamMapMutex("CC_SIPCCCallMediaData"),
michael@0 48 audioMuteState(audioMuteState),
michael@0 49 videoMuteState(videoMuteState),
michael@0 50 volume(volume) {}
michael@0 51 VideoWindowHandle remoteWindow;
michael@0 52 ExternalRendererHandle extRenderer;
michael@0 53 VideoFormat videoFormat;
michael@0 54 mozilla::Mutex streamMapMutex;
michael@0 55 StreamMapType streamMap;
michael@0 56 bool audioMuteState;
michael@0 57 bool videoMuteState;
michael@0 58 int volume;
michael@0 59 private:
michael@0 60 CC_SIPCCCallMediaData(const CC_SIPCCCallMediaData&);
michael@0 61 CC_SIPCCCallMediaData& operator=(const CC_SIPCCCallMediaData&);
michael@0 62 };
michael@0 63
michael@0 64 DECLARE_NS_PTR(CC_SIPCCCall);
michael@0 65 class CC_SIPCCCall : public CC_Call
michael@0 66 {
michael@0 67
michael@0 68 CSF_DECLARE_WRAP(CC_SIPCCCall, cc_call_handle_t);
michael@0 69 private:
michael@0 70 cc_call_handle_t callHandle;
michael@0 71 CC_SIPCCCall (cc_call_handle_t aCallHandle);
michael@0 72 CC_SIPCCCallMediaDataPtr pMediaData;
michael@0 73 std::string peerconnection; // The peerconnection handle
michael@0 74
michael@0 75 public:
michael@0 76 virtual inline std::string toString() {
michael@0 77 std::string result;
michael@0 78 char tmpString[11];
michael@0 79 csf_sprintf(tmpString, sizeof(tmpString), "%X", callHandle);
michael@0 80 result = tmpString;
michael@0 81 return result;
michael@0 82 };
michael@0 83
michael@0 84 virtual void setRemoteWindow (VideoWindowHandle window);
michael@0 85 virtual int setExternalRenderer(VideoFormat vFormat, ExternalRendererHandle renderer);
michael@0 86 virtual void sendIFrame();
michael@0 87
michael@0 88 virtual CC_CallInfoPtr getCallInfo ();
michael@0 89
michael@0 90 virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits);
michael@0 91 virtual bool answerCall (cc_sdp_direction_t video_pref);
michael@0 92 virtual bool hold (cc_hold_reason_t reason);
michael@0 93 virtual bool resume (cc_sdp_direction_t video_pref);
michael@0 94 virtual bool endCall();
michael@0 95 virtual bool sendDigit (cc_digit_t digit);
michael@0 96 virtual bool backspace();
michael@0 97 virtual bool redial (cc_sdp_direction_t video_pref);
michael@0 98 virtual bool initiateCallForwardAll();
michael@0 99 virtual bool endConsultativeCall();
michael@0 100 virtual bool conferenceStart (cc_sdp_direction_t video_pref);
michael@0 101 virtual bool conferenceComplete (CC_CallPtr otherLog, cc_sdp_direction_t video_pref);
michael@0 102 virtual bool transferStart (cc_sdp_direction_t video_pref);
michael@0 103 virtual bool transferComplete (CC_CallPtr otherLeg,
michael@0 104 cc_sdp_direction_t video_pref);
michael@0 105 virtual bool cancelTransferOrConferenceFeature();
michael@0 106 virtual bool directTransfer (CC_CallPtr target);
michael@0 107 virtual bool joinAcrossLine (CC_CallPtr target);
michael@0 108 virtual bool blfCallPickup (cc_sdp_direction_t video_pref, const std::string & speed);
michael@0 109 virtual bool select();
michael@0 110 virtual bool updateVideoMediaCap (cc_sdp_direction_t video_pref);
michael@0 111 virtual bool sendInfo (const std::string & infopackage, const std::string & infotype, const std::string & infobody);
michael@0 112 virtual bool muteAudio();
michael@0 113 virtual bool unmuteAudio();
michael@0 114 virtual bool muteVideo();
michael@0 115 virtual bool unmuteVideo();
michael@0 116 virtual void addStream(int streamId, bool isVideo);
michael@0 117 virtual void removeStream(int streamId);
michael@0 118 virtual bool setVolume(int volume);
michael@0 119 virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip);
michael@0 120 virtual void createOffer(cc_media_constraints_t *constraints, Timecard *);
michael@0 121 virtual void createAnswer(cc_media_constraints_t *constraints, Timecard *);
michael@0 122 virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *);
michael@0 123 virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *);
michael@0 124 virtual void setPeerConnection(const std::string& handle);
michael@0 125 virtual const std::string& getPeerConnection() const;
michael@0 126 virtual void addStream(cc_media_stream_id_t stream_id,
michael@0 127 cc_media_track_id_t track_id,
michael@0 128 cc_media_type_t media_type,
michael@0 129 cc_media_constraints_t *constraints);
michael@0 130 virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
michael@0 131 virtual CC_SIPCCCallMediaDataPtr getMediaData();
michael@0 132 virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level, Timecard *);
michael@0 133
michael@0 134 private:
michael@0 135 virtual bool setAudioMute(bool mute);
michael@0 136 virtual bool setVideoMute(bool mute);
michael@0 137
michael@0 138 mozilla::Mutex m_lock;
michael@0 139 };
michael@0 140
michael@0 141 }
michael@0 142
michael@0 143
michael@0 144 #endif

mercurial