diff --git a/build-gnu-linux.sh b/build-gnu-linux.sh new file mode 100755 index 0000000..d3050bf --- /dev/null +++ b/build-gnu-linux.sh @@ -0,0 +1,223 @@ +#!/bin/sh +# Make sure you install chromium build-deps first, e.g. +# +# $ sudo apt-get build-dep chromium-browser/sid +# + +set -x +set -e + +# Build (0) a single .a file, or (1, default) a bunch of *.so files. +# If 1, then you will need to set LD_LIBRARY_PATH at runtime or else install +# the *.so files as system libraries e.g. in /usr/lib/ or /usr/lib/${arch} +COMPONENT_BUILD="${COMPONENT_BUILD:-1}" +test "$COMPONENT_BUILD" = 1 -o "$COMPONENT_BUILD" = 0 || exit 2 + +################################################################################ +# Download everything we need for the build. +# The result can be packed and shipped to offline reproducibility builders. + +CHROMIUM_HOST=https://gsdview.appspot.com +DEBIAN_HOST=https://sources.debian.net +V_MAJOR="49" + +# commented out for now; we don't need this when only building libjingle_peerconnection et al +#which gsutil || { echo >&2 'gsutil not found; try `pip install --user gsutil`;' exit 1; } + +test -d webrtc/.git || git clone https://chromium.googlesource.com/external/webrtc + +( cd webrtc +git config --replace-all remote.origin.fetch \ + +refs/branch-heads/*:refs/remotes/origin/branch-heads/* \ + '^\+refs/branch-heads/' +git fetch +git checkout branch-heads/"$V_MAJOR" +git reset --hard origin/branch-heads/"$V_MAJOR" +git clean -fdX + +# download extra stuff listed in DEPS +test -d third_party/gflags/src || git clone --depth=1 \ + https://chromium.googlesource.com/external/gflags/src third_party/gflags/src +test -d third_party/junit-jar || git clone --depth=1 \ + https://chromium.googlesource.com/external/webrtc/deps/third_party/junit third_party/junit-jar + +# download Google Cloud Storage resources +# commented out for now; we don't need this when only building libjingle_peerconnection et al +#find resources -name '*.sha1' -print0 | xargs -r0 -n1 \ +#sh -c 'gsutil cp "gs://chromium-webrtc-resources/$(cat "$1")" "${1%.sha1}"; +#if [ "$(sha1sum "${1%.sha1}" | cut "-d " -f1)" != "$(echo $(cat "$1"))" ]; then exit 255; fi' 0 + +# download Chromium release tarball +test -d chromium/src || ( cd chromium +CHROMIUM_PATH="$(wget -q -O- "$CHROMIUM_HOST/chromium-browser-official/?marker=chromium-$V_MAJOR" \ + | sed -nr -e 's,.*href="/(chromium-browser-official/chromium-'"$V_MAJOR"'\.[0-9\.]+-lite\.tar\.xz)".*,\1,gp' \ + | tail -n1)" +test -f "$(basename "$CHROMIUM_PATH")" || wget -nc "$CHROMIUM_HOST/$CHROMIUM_PATH" +CHROMIUM_DIR="$(tar xvf "$(basename "$CHROMIUM_PATH")" | sed -e 's@/.*@@' | uniq)" +ln -sf "$CHROMIUM_DIR" src ) + +# download Debian build file; use their config settings instead of figuring out our own +test -f chromium/rules || ( cd chromium +wget -N "$DEBIAN_HOST/$(wget -q -O- "$DEBIAN_HOST/src/chromium-browser/unstable/debian/rules/" | \ + sed -n -re 's/.*id="link_download" href="([^"]+)".*/\1/gp')" ) + +################################################################################ +# Patches to upstream source code + +# Patch chromium 49, upstream is just buggy +# sslv3 support dropped +# commented out for now; we don't need this when only building libjingle_peerconnection et al +#patch -Np1 < + + +- + + + +EOF + +# Patch debian 48 to work for upstream 49 +grep -q use_sysroot=0 chromium/rules || sed -i -e '/^defines=/adefines+=use_sysroot=0' chromium/rules + +################################################################################ +# Add our own build targets + +# Configure chromium +cat >chromium/src/Makefile <<'EOF' +include ../rules +.PHONY: configure_for_go_webrtc +configure_for_go_webrtc: override_dh_auto_configure +EOF + +# Configure webrtc +cat >Makefile <<'EOF' +include chromium/rules +.PHONY: configure_for_go_webrtc +configure_for_go_webrtc: +{TAB_CHARACTER}GYP_DEFINES="$(defines) $(EXTRA_GYP_DEFINES)" python webrtc/build/gyp_webrtc +EOF +sed -i -e 's/{TAB_CHARACTER}/\t/g' Makefile + +# Interim libjingle_peerconnection_internal target +patch -Np1 < -#include - -#include "talk/media/base/videocapturer.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/common_video/include/video_frame_buffer.h" - -namespace webrtc { - -class AndroidVideoCapturer; - -class AndroidVideoCapturerDelegate : public rtc::RefCountInterface { - public: - virtual ~AndroidVideoCapturerDelegate() {} - // Start capturing. The implementation of the delegate must call - // AndroidVideoCapturer::OnCapturerStarted with the result of this request. - virtual void Start(int width, int height, int framerate, - AndroidVideoCapturer* capturer) = 0; - - // Stops capturing. - // The delegate may not call into AndroidVideoCapturer after this call. - virtual void Stop() = 0; - - // Must returns a JSON string "{{width=xxx, height=xxx, framerate = xxx}}" - virtual std::string GetSupportedFormats() = 0; -}; - -// Android implementation of cricket::VideoCapturer for use with WebRtc -// PeerConnection. -class AndroidVideoCapturer : public cricket::VideoCapturer { - public: - explicit AndroidVideoCapturer( - const rtc::scoped_refptr& delegate); - virtual ~AndroidVideoCapturer(); - - // Called from JNI when the capturer has been started. - void OnCapturerStarted(bool success); - - // Called from JNI when a new frame has been captured. - // Argument |buffer| is intentionally by value, for use with rtc::Bind. - void OnIncomingFrame( - const rtc::scoped_refptr& buffer, - int rotation, - int64_t time_stamp); - - // Called from JNI to request a new video format. - void OnOutputFormatRequest(int width, int height, int fps); - - AndroidVideoCapturerDelegate* delegate() { return delegate_.get(); } - - // cricket::VideoCapturer implementation. - bool GetBestCaptureFormat(const cricket::VideoFormat& desired, - cricket::VideoFormat* best_format) override; - - private: - // cricket::VideoCapturer implementation. - // Video frames will be delivered using - // cricket::VideoCapturer::SignalFrameCaptured on the thread that calls Start. - cricket::CaptureState Start( - const cricket::VideoFormat& capture_format) override; - void Stop() override; - bool IsRunning() override; - bool IsScreencast() const override { return false; } - bool GetPreferredFourccs(std::vector* fourccs) override; - - bool running_; - rtc::scoped_refptr delegate_; - - rtc::ThreadChecker thread_checker_; - - class FrameFactory; - FrameFactory* frame_factory_; // Owned by cricket::VideoCapturer. - - cricket::CaptureState current_state_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_ANDROIDVIDEOCAPTURER_H_ diff --git a/include/talk/app/webrtc/audiotrack.h b/include/talk/app/webrtc/audiotrack.h deleted file mode 100644 index 55f4837..0000000 --- a/include/talk/app/webrtc/audiotrack.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_AUDIOTRACK_H_ -#define TALK_APP_WEBRTC_AUDIOTRACK_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/mediastreamtrack.h" -#include "talk/app/webrtc/notifier.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/thread_checker.h" - -namespace webrtc { - -class AudioTrack : public MediaStreamTrack, - public ObserverInterface { - protected: - // Protected ctor to force use of factory method. - AudioTrack(const std::string& label, - const rtc::scoped_refptr& source); - ~AudioTrack() override; - - public: - static rtc::scoped_refptr Create( - const std::string& id, - const rtc::scoped_refptr& source); - - private: - // MediaStreamTrack implementation. - std::string kind() const override; - - // AudioTrackInterface implementation. - AudioSourceInterface* GetSource() const override; - - void AddSink(AudioTrackSinkInterface* sink) override; - void RemoveSink(AudioTrackSinkInterface* sink) override; - - // ObserverInterface implementation. - void OnChanged() override; - - private: - const rtc::scoped_refptr audio_source_; - rtc::ThreadChecker thread_checker_; - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioTrack); -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_AUDIOTRACK_H_ diff --git a/include/talk/app/webrtc/datachannel.h b/include/talk/app/webrtc/datachannel.h deleted file mode 100644 index 2713ae3..0000000 --- a/include/talk/app/webrtc/datachannel.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_DATACHANNEL_H_ -#define TALK_APP_WEBRTC_DATACHANNEL_H_ - -#include -#include -#include - -#include "talk/app/webrtc/datachannelinterface.h" -#include "talk/app/webrtc/proxy.h" -#include "talk/media/base/mediachannel.h" -#include "talk/session/media/channel.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/sigslot.h" - -namespace webrtc { - -class DataChannel; - -class DataChannelProviderInterface { - public: - // Sends the data to the transport. - virtual bool SendData(const cricket::SendDataParams& params, - const rtc::Buffer& payload, - cricket::SendDataResult* result) = 0; - // Connects to the transport signals. - virtual bool ConnectDataChannel(DataChannel* data_channel) = 0; - // Disconnects from the transport signals. - virtual void DisconnectDataChannel(DataChannel* data_channel) = 0; - // Adds the data channel SID to the transport for SCTP. - virtual void AddSctpDataStream(int sid) = 0; - // Removes the data channel SID from the transport for SCTP. - virtual void RemoveSctpDataStream(int sid) = 0; - // Returns true if the transport channel is ready to send data. - virtual bool ReadyToSendData() const = 0; - - protected: - virtual ~DataChannelProviderInterface() {} -}; - -struct InternalDataChannelInit : public DataChannelInit { - enum OpenHandshakeRole { - kOpener, - kAcker, - kNone - }; - // The default role is kOpener because the default |negotiated| is false. - InternalDataChannelInit() : open_handshake_role(kOpener) {} - explicit InternalDataChannelInit(const DataChannelInit& base) - : DataChannelInit(base), open_handshake_role(kOpener) { - // If the channel is externally negotiated, do not send the OPEN message. - if (base.negotiated) { - open_handshake_role = kNone; - } - } - - OpenHandshakeRole open_handshake_role; -}; - -// Helper class to allocate unique IDs for SCTP DataChannels -class SctpSidAllocator { - public: - // Gets the first unused odd/even id based on the DTLS role. If |role| is - // SSL_CLIENT, the allocated id starts from 0 and takes even numbers; - // otherwise, the id starts from 1 and takes odd numbers. - // Returns false if no id can be allocated. - bool AllocateSid(rtc::SSLRole role, int* sid); - - // Attempts to reserve a specific sid. Returns false if it's unavailable. - bool ReserveSid(int sid); - - // Indicates that |sid| isn't in use any more, and is thus available again. - void ReleaseSid(int sid); - - private: - // Checks if |sid| is available to be assigned to a new SCTP data channel. - bool IsSidAvailable(int sid) const; - - std::set used_sids_; -}; - -// DataChannel is a an implementation of the DataChannelInterface based on -// libjingle's data engine. It provides an implementation of unreliable or -// reliabledata channels. Currently this class is specifically designed to use -// both RtpDataEngine and SctpDataEngine. - -// DataChannel states: -// kConnecting: The channel has been created the transport might not yet be -// ready. -// kOpen: The channel have a local SSRC set by a call to UpdateSendSsrc -// and a remote SSRC set by call to UpdateReceiveSsrc and the transport -// has been writable once. -// kClosing: DataChannelInterface::Close has been called or UpdateReceiveSsrc -// has been called with SSRC==0 -// kClosed: Both UpdateReceiveSsrc and UpdateSendSsrc has been called with -// SSRC==0. -class DataChannel : public DataChannelInterface, - public sigslot::has_slots<>, - public rtc::MessageHandler { - public: - static rtc::scoped_refptr Create( - DataChannelProviderInterface* provider, - cricket::DataChannelType dct, - const std::string& label, - const InternalDataChannelInit& config); - - virtual void RegisterObserver(DataChannelObserver* observer); - virtual void UnregisterObserver(); - - virtual std::string label() const { return label_; } - virtual bool reliable() const; - virtual bool ordered() const { return config_.ordered; } - virtual uint16_t maxRetransmitTime() const { - return config_.maxRetransmitTime; - } - virtual uint16_t maxRetransmits() const { return config_.maxRetransmits; } - virtual std::string protocol() const { return config_.protocol; } - virtual bool negotiated() const { return config_.negotiated; } - virtual int id() const { return config_.id; } - virtual uint64_t buffered_amount() const; - virtual void Close(); - virtual DataState state() const { return state_; } - virtual bool Send(const DataBuffer& buffer); - - // rtc::MessageHandler override. - virtual void OnMessage(rtc::Message* msg); - - // Called when the channel's ready to use. That can happen when the - // underlying DataMediaChannel becomes ready, or when this channel is a new - // stream on an existing DataMediaChannel, and we've finished negotiation. - void OnChannelReady(bool writable); - - // Sigslots from cricket::DataChannel - void OnDataReceived(cricket::DataChannel* channel, - const cricket::ReceiveDataParams& params, - const rtc::Buffer& payload); - void OnStreamClosedRemotely(uint32_t sid); - - // The remote peer request that this channel should be closed. - void RemotePeerRequestClose(); - - // The following methods are for SCTP only. - - // Sets the SCTP sid and adds to transport layer if not set yet. Should only - // be called once. - void SetSctpSid(int sid); - // Called when the transport channel is created. - // Only needs to be called for SCTP data channels. - void OnTransportChannelCreated(); - // Called when the transport channel is destroyed. - void OnTransportChannelDestroyed(); - - // The following methods are for RTP only. - - // Set the SSRC this channel should use to send data on the - // underlying data engine. |send_ssrc| == 0 means that the channel is no - // longer part of the session negotiation. - void SetSendSsrc(uint32_t send_ssrc); - // Set the SSRC this channel should use to receive data from the - // underlying data engine. - void SetReceiveSsrc(uint32_t receive_ssrc); - - cricket::DataChannelType data_channel_type() const { - return data_channel_type_; - } - - // Emitted when state transitions to kClosed. - // In the case of SCTP channels, this signal can be used to tell when the - // channel's sid is free. - sigslot::signal1 SignalClosed; - - protected: - DataChannel(DataChannelProviderInterface* client, - cricket::DataChannelType dct, - const std::string& label); - virtual ~DataChannel(); - - private: - // A packet queue which tracks the total queued bytes. Queued packets are - // owned by this class. - class PacketQueue { - public: - PacketQueue(); - ~PacketQueue(); - - size_t byte_count() const { - return byte_count_; - } - - bool Empty() const; - - DataBuffer* Front(); - - void Pop(); - - void Push(DataBuffer* packet); - - void Clear(); - - void Swap(PacketQueue* other); - - private: - std::deque packets_; - size_t byte_count_; - }; - - // The OPEN(_ACK) signaling state. - enum HandshakeState { - kHandshakeInit, - kHandshakeShouldSendOpen, - kHandshakeShouldSendAck, - kHandshakeWaitingForAck, - kHandshakeReady - }; - - bool Init(const InternalDataChannelInit& config); - void DoClose(); - void UpdateState(); - void SetState(DataState state); - void DisconnectFromProvider(); - - void DeliverQueuedReceivedData(); - - void SendQueuedDataMessages(); - bool SendDataMessage(const DataBuffer& buffer, bool queue_if_blocked); - bool QueueSendDataMessage(const DataBuffer& buffer); - - void SendQueuedControlMessages(); - void QueueControlMessage(const rtc::Buffer& buffer); - bool SendControlMessage(const rtc::Buffer& buffer); - - std::string label_; - InternalDataChannelInit config_; - DataChannelObserver* observer_; - DataState state_; - cricket::DataChannelType data_channel_type_; - DataChannelProviderInterface* provider_; - HandshakeState handshake_state_; - bool connected_to_provider_; - bool send_ssrc_set_; - bool receive_ssrc_set_; - bool writable_; - uint32_t send_ssrc_; - uint32_t receive_ssrc_; - // Control messages that always have to get sent out before any queued - // data. - PacketQueue queued_control_data_; - PacketQueue queued_received_data_; - PacketQueue queued_send_data_; -}; - -// Define proxy for DataChannelInterface. -BEGIN_PROXY_MAP(DataChannel) - PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*) - PROXY_METHOD0(void, UnregisterObserver) - PROXY_CONSTMETHOD0(std::string, label) - PROXY_CONSTMETHOD0(bool, reliable) - PROXY_CONSTMETHOD0(bool, ordered) - PROXY_CONSTMETHOD0(uint16_t, maxRetransmitTime) - PROXY_CONSTMETHOD0(uint16_t, maxRetransmits) - PROXY_CONSTMETHOD0(std::string, protocol) - PROXY_CONSTMETHOD0(bool, negotiated) - PROXY_CONSTMETHOD0(int, id) - PROXY_CONSTMETHOD0(DataState, state) - PROXY_CONSTMETHOD0(uint64_t, buffered_amount) - PROXY_METHOD0(void, Close) - PROXY_METHOD1(bool, Send, const DataBuffer&) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_DATACHANNEL_H_ diff --git a/include/talk/app/webrtc/datachannelinterface.h b/include/talk/app/webrtc/datachannelinterface.h deleted file mode 100644 index d70972f..0000000 --- a/include/talk/app/webrtc/datachannelinterface.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains interfaces for DataChannels -// http://dev.w3.org/2011/webrtc/editor/webrtc.html#rtcdatachannel - -#ifndef TALK_APP_WEBRTC_DATACHANNELINTERFACE_H_ -#define TALK_APP_WEBRTC_DATACHANNELINTERFACE_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/checks.h" -#include "webrtc/base/refcount.h" - - -namespace webrtc { - -struct DataChannelInit { - DataChannelInit() - : reliable(false), - ordered(true), - maxRetransmitTime(-1), - maxRetransmits(-1), - negotiated(false), - id(-1) { - } - - bool reliable; // Deprecated. - bool ordered; // True if ordered delivery is required. - int maxRetransmitTime; // The max period of time in milliseconds in which - // retransmissions will be sent. After this time, no - // more retransmissions will be sent. -1 if unset. - int maxRetransmits; // The max number of retransmissions. -1 if unset. - std::string protocol; // This is set by the application and opaque to the - // WebRTC implementation. - bool negotiated; // True if the channel has been externally negotiated - // and we do not send an in-band signalling in the - // form of an "open" message. - int id; // The stream id, or SID, for SCTP data channels. -1 - // if unset. -}; - -struct DataBuffer { - DataBuffer(const rtc::Buffer& data, bool binary) - : data(data), - binary(binary) { - } - // For convenience for unit tests. - explicit DataBuffer(const std::string& text) - : data(text.data(), text.length()), - binary(false) { - } - size_t size() const { return data.size(); } - - rtc::Buffer data; - // Indicates if the received data contains UTF-8 or binary data. - // Note that the upper layers are left to verify the UTF-8 encoding. - // TODO(jiayl): prefer to use an enum instead of a bool. - bool binary; -}; - -class DataChannelObserver { - public: - // The data channel state have changed. - virtual void OnStateChange() = 0; - // A data buffer was successfully received. - virtual void OnMessage(const DataBuffer& buffer) = 0; - // The data channel's buffered_amount has changed. - virtual void OnBufferedAmountChange(uint64_t previous_amount){}; - - protected: - virtual ~DataChannelObserver() {} -}; - -class DataChannelInterface : public rtc::RefCountInterface { - public: - // Keep in sync with DataChannel.java:State and - // RTCDataChannel.h:RTCDataChannelState. - enum DataState { - kConnecting, - kOpen, // The DataChannel is ready to send data. - kClosing, - kClosed - }; - - static const char* DataStateString(DataState state) { - switch (state) { - case kConnecting: - return "connecting"; - case kOpen: - return "open"; - case kClosing: - return "closing"; - case kClosed: - return "closed"; - } - RTC_CHECK(false) << "Unknown DataChannel state: " << state; - return ""; - } - - virtual void RegisterObserver(DataChannelObserver* observer) = 0; - virtual void UnregisterObserver() = 0; - // The label attribute represents a label that can be used to distinguish this - // DataChannel object from other DataChannel objects. - virtual std::string label() const = 0; - virtual bool reliable() const = 0; - - // TODO(tommyw): Remove these dummy implementations when all classes have - // implemented these APIs. They should all just return the values the - // DataChannel was created with. - virtual bool ordered() const { return false; } - virtual uint16_t maxRetransmitTime() const { return 0; } - virtual uint16_t maxRetransmits() const { return 0; } - virtual std::string protocol() const { return std::string(); } - virtual bool negotiated() const { return false; } - - virtual int id() const = 0; - virtual DataState state() const = 0; - // The buffered_amount returns the number of bytes of application data - // (UTF-8 text and binary data) that have been queued using SendBuffer but - // have not yet been transmitted to the network. - virtual uint64_t buffered_amount() const = 0; - virtual void Close() = 0; - // Sends |data| to the remote peer. - virtual bool Send(const DataBuffer& buffer) = 0; - - protected: - virtual ~DataChannelInterface() {} -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_DATACHANNELINTERFACE_H_ diff --git a/include/talk/app/webrtc/dtlsidentitystore.h b/include/talk/app/webrtc/dtlsidentitystore.h deleted file mode 100644 index 2a5309d..0000000 --- a/include/talk/app/webrtc/dtlsidentitystore.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ -#define TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ - -#include -#include -#include - -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/sslidentity.h" -#include "webrtc/base/thread.h" - -namespace webrtc { - -// Passed to SSLIdentity::Generate. -extern const char kIdentityName[]; - -class SSLIdentity; -class Thread; - -// Used to receive callbacks of DTLS identity requests. -class DtlsIdentityRequestObserver : public rtc::RefCountInterface { - public: - virtual void OnFailure(int error) = 0; - // TODO(hbos): Unify the OnSuccess method once Chrome code is updated. - virtual void OnSuccess(const std::string& der_cert, - const std::string& der_private_key) = 0; - // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the - // client has to get the ownership of the object to make use of it. - virtual void OnSuccess(rtc::scoped_ptr identity) = 0; - - protected: - virtual ~DtlsIdentityRequestObserver() {} -}; - -// This interface defines an in-memory DTLS identity store, which generates DTLS -// identities. -// APIs calls must be made on the signaling thread and the callbacks are also -// called on the signaling thread. -class DtlsIdentityStoreInterface { - public: - virtual ~DtlsIdentityStoreInterface() { } - - // The |observer| will be called when the requested identity is ready, or when - // identity generation fails. - // TODO(torbjorng,hbos): The following RequestIdentity is about to be removed, - // see below todo. - virtual void RequestIdentity( - rtc::KeyType key_type, - const rtc::scoped_refptr& observer) { - // Add default parameterization. - RequestIdentity(rtc::KeyParams(key_type), observer); - } - // TODO(torbjorng,hbos): Parameterized key types! The following - // RequestIdentity should replace the old one that takes rtc::KeyType. When - // the new one is implemented by Chromium and WebRTC the old one should be - // removed. crbug.com/544902, webrtc:5092. - virtual void RequestIdentity( - rtc::KeyParams key_params, - const rtc::scoped_refptr& observer) { - // Drop parameterization. - RequestIdentity(key_params.type(), observer); - } -}; - -// The WebRTC default implementation of DtlsIdentityStoreInterface. -// Identity generation is performed on the worker thread. -class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, - public rtc::MessageHandler { - public: - // This will start to preemptively generating an RSA identity in the - // background if the worker thread is not the same as the signaling thread. - DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, - rtc::Thread* worker_thread); - ~DtlsIdentityStoreImpl() override; - - // DtlsIdentityStoreInterface override; - void RequestIdentity( - rtc::KeyType key_type, - const rtc::scoped_refptr& observer) override; - - // rtc::MessageHandler override; - void OnMessage(rtc::Message* msg) override; - - // Returns true if there is a free RSA identity, used for unit tests. - bool HasFreeIdentityForTesting(rtc::KeyType key_type) const; - - private: - void GenerateIdentity( - rtc::KeyType key_type, - const rtc::scoped_refptr& observer); - void OnIdentityGenerated(rtc::KeyType key_type, - rtc::scoped_ptr identity); - - class WorkerTask; - typedef rtc::ScopedMessageData - WorkerTaskMessageData; - - // A key type-identity pair. - struct IdentityResult { - IdentityResult(rtc::KeyType key_type, - rtc::scoped_ptr identity) - : key_type_(key_type), identity_(std::move(identity)) {} - - rtc::KeyType key_type_; - rtc::scoped_ptr identity_; - }; - - typedef rtc::ScopedMessageData IdentityResultMessageData; - - sigslot::signal0<> SignalDestroyed; - - rtc::Thread* const signaling_thread_; - // TODO(hbos): RSA generation is slow and would be VERY slow if we switch over - // to 2048, DtlsIdentityStore should use a new thread and not the "general - // purpose" worker thread. - rtc::Thread* const worker_thread_; - - struct RequestInfo { - RequestInfo() - : request_observers_(), gen_in_progress_counts_(0), free_identity_() {} - - std::queue> - request_observers_; - size_t gen_in_progress_counts_; - rtc::scoped_ptr free_identity_; - }; - - // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. - RequestInfo request_info_[rtc::KT_LAST]; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ diff --git a/include/talk/app/webrtc/dtmfsender.h b/include/talk/app/webrtc/dtmfsender.h deleted file mode 100644 index 6d23610..0000000 --- a/include/talk/app/webrtc/dtmfsender.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_DTMFSENDER_H_ -#define TALK_APP_WEBRTC_DTMFSENDER_H_ - -#include - -#include "talk/app/webrtc/dtmfsenderinterface.h" -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/proxy.h" -#include "webrtc/base/common.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/refcount.h" - -// DtmfSender is the native implementation of the RTCDTMFSender defined by -// the WebRTC W3C Editor's Draft. -// http://dev.w3.org/2011/webrtc/editor/webrtc.html - -namespace rtc { -class Thread; -} - -namespace webrtc { - -// This interface is called by DtmfSender to talk to the actual audio channel -// to send DTMF. -class DtmfProviderInterface { - public: - // Returns true if the audio track with given id (|track_id|) is capable - // of sending DTMF. Otherwise returns false. - virtual bool CanInsertDtmf(const std::string& track_id) = 0; - // Sends DTMF |code| via the audio track with given id (|track_id|). - // The |duration| indicates the length of the DTMF tone in ms. - // Returns true on success and false on failure. - virtual bool InsertDtmf(const std::string& track_id, - int code, int duration) = 0; - // Returns a |sigslot::signal0<>| signal. The signal should fire before - // the provider is destroyed. - virtual sigslot::signal0<>* GetOnDestroyedSignal() = 0; - - protected: - virtual ~DtmfProviderInterface() {} -}; - -class DtmfSender - : public DtmfSenderInterface, - public sigslot::has_slots<>, - public rtc::MessageHandler { - public: - static rtc::scoped_refptr Create( - AudioTrackInterface* track, - rtc::Thread* signaling_thread, - DtmfProviderInterface* provider); - - // Implements DtmfSenderInterface. - void RegisterObserver(DtmfSenderObserverInterface* observer) override; - void UnregisterObserver() override; - bool CanInsertDtmf() override; - bool InsertDtmf(const std::string& tones, - int duration, - int inter_tone_gap) override; - const AudioTrackInterface* track() const override; - std::string tones() const override; - int duration() const override; - int inter_tone_gap() const override; - - protected: - DtmfSender(AudioTrackInterface* track, - rtc::Thread* signaling_thread, - DtmfProviderInterface* provider); - virtual ~DtmfSender(); - - private: - DtmfSender(); - - // Implements MessageHandler. - virtual void OnMessage(rtc::Message* msg); - - // The DTMF sending task. - void DoInsertDtmf(); - - void OnProviderDestroyed(); - - void StopSending(); - - rtc::scoped_refptr track_; - DtmfSenderObserverInterface* observer_; - rtc::Thread* signaling_thread_; - DtmfProviderInterface* provider_; - std::string tones_; - int duration_; - int inter_tone_gap_; - - RTC_DISALLOW_COPY_AND_ASSIGN(DtmfSender); -}; - -// Define proxy for DtmfSenderInterface. -BEGIN_PROXY_MAP(DtmfSender) - PROXY_METHOD1(void, RegisterObserver, DtmfSenderObserverInterface*) - PROXY_METHOD0(void, UnregisterObserver) - PROXY_METHOD0(bool, CanInsertDtmf) - PROXY_METHOD3(bool, InsertDtmf, const std::string&, int, int) - PROXY_CONSTMETHOD0(const AudioTrackInterface*, track) - PROXY_CONSTMETHOD0(std::string, tones) - PROXY_CONSTMETHOD0(int, duration) - PROXY_CONSTMETHOD0(int, inter_tone_gap) -END_PROXY() - -// Get DTMF code from the DTMF event character. -bool GetDtmfCode(char tone, int* code); - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_DTMFSENDER_H_ diff --git a/include/talk/app/webrtc/dtmfsenderinterface.h b/include/talk/app/webrtc/dtmfsenderinterface.h deleted file mode 100644 index 7fbf57a..0000000 --- a/include/talk/app/webrtc/dtmfsenderinterface.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_DTMFSENDERINTERFACE_H_ -#define TALK_APP_WEBRTC_DTMFSENDERINTERFACE_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "webrtc/base/common.h" -#include "webrtc/base/refcount.h" - -// This file contains interfaces for DtmfSender. - -namespace webrtc { - -// DtmfSender callback interface. Application should implement this interface -// to get notifications from the DtmfSender. -class DtmfSenderObserverInterface { - public: - // Triggered when DTMF |tone| is sent. - // If |tone| is empty that means the DtmfSender has sent out all the given - // tones. - virtual void OnToneChange(const std::string& tone) = 0; - - protected: - virtual ~DtmfSenderObserverInterface() {} -}; - -// The interface of native implementation of the RTCDTMFSender defined by the -// WebRTC W3C Editor's Draft. -class DtmfSenderInterface : public rtc::RefCountInterface { - public: - virtual void RegisterObserver(DtmfSenderObserverInterface* observer) = 0; - virtual void UnregisterObserver() = 0; - - // Returns true if this DtmfSender is capable of sending DTMF. - // Otherwise returns false. - virtual bool CanInsertDtmf() = 0; - - // Queues a task that sends the DTMF |tones|. The |tones| parameter is treated - // as a series of characters. The characters 0 through 9, A through D, #, and - // * generate the associated DTMF tones. The characters a to d are equivalent - // to A to D. The character ',' indicates a delay of 2 seconds before - // processing the next character in the tones parameter. - // Unrecognized characters are ignored. - // The |duration| parameter indicates the duration in ms to use for each - // character passed in the |tones| parameter. - // The duration cannot be more than 6000 or less than 70. - // The |inter_tone_gap| parameter indicates the gap between tones in ms. - // The |inter_tone_gap| must be at least 50 ms but should be as short as - // possible. - // If InsertDtmf is called on the same object while an existing task for this - // object to generate DTMF is still running, the previous task is canceled. - // Returns true on success and false on failure. - virtual bool InsertDtmf(const std::string& tones, int duration, - int inter_tone_gap) = 0; - - // Returns the track given as argument to the constructor. - virtual const AudioTrackInterface* track() const = 0; - - // Returns the tones remaining to be played out. - virtual std::string tones() const = 0; - - // Returns the current tone duration value in ms. - // This value will be the value last set via the InsertDtmf() method, or the - // default value of 100 ms if InsertDtmf() was never called. - virtual int duration() const = 0; - - // Returns the current value of the between-tone gap in ms. - // This value will be the value last set via the InsertDtmf() method, or the - // default value of 50 ms if InsertDtmf() was never called. - virtual int inter_tone_gap() const = 0; - - protected: - virtual ~DtmfSenderInterface() {} -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_DTMFSENDERINTERFACE_H_ diff --git a/include/talk/app/webrtc/fakemediacontroller.h b/include/talk/app/webrtc/fakemediacontroller.h deleted file mode 100644 index 5bf3e5f..0000000 --- a/include/talk/app/webrtc/fakemediacontroller.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_FAKEMEDIACONTROLLER_H_ -#define TALK_APP_WEBRTC_FAKEMEDIACONTROLLER_H_ - -#include "talk/app/webrtc/mediacontroller.h" -#include "webrtc/base/checks.h" - -namespace cricket { - -class FakeMediaController : public webrtc::MediaControllerInterface { - public: - explicit FakeMediaController(cricket::ChannelManager* channel_manager, - webrtc::Call* call) - : channel_manager_(channel_manager), call_(call) { - RTC_DCHECK(nullptr != channel_manager_); - RTC_DCHECK(nullptr != call_); - } - ~FakeMediaController() override {} - webrtc::Call* call_w() override { return call_; } - cricket::ChannelManager* channel_manager() const override { - return channel_manager_; - } - - private: - cricket::ChannelManager* channel_manager_; - webrtc::Call* call_; -}; -} // namespace cricket -#endif // TALK_APP_WEBRTC_FAKEMEDIACONTROLLER_H_ diff --git a/include/talk/app/webrtc/fakemetricsobserver.h b/include/talk/app/webrtc/fakemetricsobserver.h deleted file mode 100644 index e3a2284..0000000 --- a/include/talk/app/webrtc/fakemetricsobserver.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ -#define TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ - -#include -#include - -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "webrtc/base/thread_checker.h" - -namespace webrtc { - -class FakeMetricsObserver : public MetricsObserverInterface { - public: - FakeMetricsObserver(); - void Reset(); - - void IncrementEnumCounter(PeerConnectionEnumCounterType, - int counter, - int counter_max) override; - void AddHistogramSample(PeerConnectionMetricsName type, - int value) override; - - // Accessors to be used by the tests. - int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const; - int GetHistogramSample(PeerConnectionMetricsName type) const; - - protected: - ~FakeMetricsObserver() {} - - private: - rtc::ThreadChecker thread_checker_; - // The vector contains maps for each counter type. In the map, it's a mapping - // from individual counter to its count, such that it's memory efficient when - // comes to sparse enum types, like the SSL ciphers in the IANA registry. - std::vector> counters_; - int histogram_samples_[kPeerConnectionMetricsName_Max]; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ diff --git a/include/talk/app/webrtc/fakeportallocatorfactory.h b/include/talk/app/webrtc/fakeportallocatorfactory.h deleted file mode 100644 index eb73b76..0000000 --- a/include/talk/app/webrtc/fakeportallocatorfactory.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file defines a fake port allocator factory used for testing. -// This implementation creates instances of cricket::FakePortAllocator. - -#ifndef TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ -#define TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ - -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "webrtc/p2p/client/fakeportallocator.h" - -namespace webrtc { - -class FakePortAllocatorFactory : public PortAllocatorFactoryInterface { - public: - static FakePortAllocatorFactory* Create() { - rtc::RefCountedObject* allocator = - new rtc::RefCountedObject(); - return allocator; - } - - virtual cricket::PortAllocator* CreatePortAllocator( - const std::vector& stun_configurations, - const std::vector& turn_configurations) { - stun_configs_ = stun_configurations; - turn_configs_ = turn_configurations; - last_created_allocator_ = - new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr); - return last_created_allocator_; - } - - const std::vector& stun_configs() const { - return stun_configs_; - } - - const std::vector& turn_configs() const { - return turn_configs_; - } - - void SetNetworkIgnoreMask(int network_ignore_mask) {} - - // Up to caller to ensure this isn't called after the allocator has been - // destroyed. - cricket::FakePortAllocator* last_created_allocator() { - return last_created_allocator_; - } - - protected: - FakePortAllocatorFactory() {} - ~FakePortAllocatorFactory() {} - - private: - std::vector stun_configs_; - std::vector turn_configs_; - cricket::FakePortAllocator* last_created_allocator_ = nullptr; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ diff --git a/include/talk/app/webrtc/jsep.h b/include/talk/app/webrtc/jsep.h deleted file mode 100644 index c12ab85..0000000 --- a/include/talk/app/webrtc/jsep.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Interfaces matching the draft-ietf-rtcweb-jsep-01. - -#ifndef TALK_APP_WEBRTC_JSEP_H_ -#define TALK_APP_WEBRTC_JSEP_H_ - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/refcount.h" - -namespace cricket { -class SessionDescription; -class Candidate; -} // namespace cricket - -namespace webrtc { - -struct SdpParseError { - public: - // The sdp line that causes the error. - std::string line; - // Explains the error. - std::string description; -}; - -// Class representation of an ICE candidate. -// An instance of this interface is supposed to be owned by one class at -// a time and is therefore not expected to be thread safe. -class IceCandidateInterface { - public: - virtual ~IceCandidateInterface() {} - /// If present, this contains the identierfier of the "media stream - // identification" as defined in [RFC 3388] for m-line this candidate is - // assocated with. - virtual std::string sdp_mid() const = 0; - // This indeicates the index (starting at zero) of m-line in the SDP this - // candidate is assocated with. - virtual int sdp_mline_index() const = 0; - virtual const cricket::Candidate& candidate() const = 0; - // Creates a SDP-ized form of this candidate. - virtual bool ToString(std::string* out) const = 0; -}; - -// Creates a IceCandidateInterface based on SDP string. -// Returns NULL if the sdp string can't be parsed. -// |error| can be NULL if doesn't care about the failure reason. -IceCandidateInterface* CreateIceCandidate(const std::string& sdp_mid, - int sdp_mline_index, - const std::string& sdp, - SdpParseError* error); - -// This class represents a collection of candidates for a specific m-line. -// This class is used in SessionDescriptionInterface to represent all known -// candidates for a certain m-line. -class IceCandidateCollection { - public: - virtual ~IceCandidateCollection() {} - virtual size_t count() const = 0; - // Returns true if an equivalent |candidate| exist in the collection. - virtual bool HasCandidate(const IceCandidateInterface* candidate) const = 0; - virtual const IceCandidateInterface* at(size_t index) const = 0; -}; - -// Class representation of a Session description. -// An instance of this interface is supposed to be owned by one class at -// a time and is therefore not expected to be thread safe. -class SessionDescriptionInterface { - public: - // Supported types: - static const char kOffer[]; - static const char kPrAnswer[]; - static const char kAnswer[]; - - virtual ~SessionDescriptionInterface() {} - virtual cricket::SessionDescription* description() = 0; - virtual const cricket::SessionDescription* description() const = 0; - // Get the session id and session version, which are defined based on - // RFC 4566 for the SDP o= line. - virtual std::string session_id() const = 0; - virtual std::string session_version() const = 0; - virtual std::string type() const = 0; - // Adds the specified candidate to the description. - // Ownership is not transferred. - // Returns false if the session description does not have a media section that - // corresponds to the |candidate| label. - virtual bool AddCandidate(const IceCandidateInterface* candidate) = 0; - // Returns the number of m- lines in the session description. - virtual size_t number_of_mediasections() const = 0; - // Returns a collection of all candidates that belong to a certain m-line - virtual const IceCandidateCollection* candidates( - size_t mediasection_index) const = 0; - // Serializes the description to SDP. - virtual bool ToString(std::string* out) const = 0; -}; - -// Creates a SessionDescriptionInterface based on SDP string and the type. -// Returns NULL if the sdp string can't be parsed or the type is unsupported. -// |error| can be NULL if doesn't care about the failure reason. -SessionDescriptionInterface* CreateSessionDescription(const std::string& type, - const std::string& sdp, - SdpParseError* error); - -// Jsep CreateOffer and CreateAnswer callback interface. -class CreateSessionDescriptionObserver : public rtc::RefCountInterface { - public: - // The implementation of the CreateSessionDescriptionObserver takes - // the ownership of the |desc|. - virtual void OnSuccess(SessionDescriptionInterface* desc) = 0; - virtual void OnFailure(const std::string& error) = 0; - - protected: - ~CreateSessionDescriptionObserver() {} -}; - -// Jsep SetLocalDescription and SetRemoteDescription callback interface. -class SetSessionDescriptionObserver : public rtc::RefCountInterface { - public: - virtual void OnSuccess() = 0; - virtual void OnFailure(const std::string& error) = 0; - - protected: - ~SetSessionDescriptionObserver() {} -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_JSEP_H_ diff --git a/include/talk/app/webrtc/jsepicecandidate.h b/include/talk/app/webrtc/jsepicecandidate.h deleted file mode 100644 index 1d5ef19..0000000 --- a/include/talk/app/webrtc/jsepicecandidate.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Implements the IceCandidateInterface. - -#ifndef TALK_APP_WEBRTC_JSEPICECANDIDATE_H_ -#define TALK_APP_WEBRTC_JSEPICECANDIDATE_H_ - -#include - -#include "talk/app/webrtc/jsep.h" -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/base/constructormagic.h" - -namespace webrtc { - -class JsepIceCandidate : public IceCandidateInterface { - public: - JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index); - JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index, - const cricket::Candidate& candidate); - ~JsepIceCandidate(); - // |error| can be NULL if don't care about the failure reason. - bool Initialize(const std::string& sdp, SdpParseError* err); - void SetCandidate(const cricket::Candidate& candidate) { - candidate_ = candidate; - } - - virtual std::string sdp_mid() const { return sdp_mid_; } - virtual int sdp_mline_index() const { return sdp_mline_index_; } - virtual const cricket::Candidate& candidate() const { - return candidate_; - } - - virtual bool ToString(std::string* out) const; - - private: - std::string sdp_mid_; - int sdp_mline_index_; - cricket::Candidate candidate_; - - RTC_DISALLOW_COPY_AND_ASSIGN(JsepIceCandidate); -}; - -// Implementation of IceCandidateCollection. -// This implementation stores JsepIceCandidates. -class JsepCandidateCollection : public IceCandidateCollection { - public: - ~JsepCandidateCollection(); - virtual size_t count() const { - return candidates_.size(); - } - virtual bool HasCandidate(const IceCandidateInterface* candidate) const; - // Adds and takes ownership of the JsepIceCandidate. - virtual void add(JsepIceCandidate* candidate) { - candidates_.push_back(candidate); - } - virtual const IceCandidateInterface* at(size_t index) const { - return candidates_[index]; - } - - private: - std::vector candidates_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_JSEPICECANDIDATE_H_ diff --git a/include/talk/app/webrtc/jsepsessiondescription.h b/include/talk/app/webrtc/jsepsessiondescription.h deleted file mode 100644 index 756352c..0000000 --- a/include/talk/app/webrtc/jsepsessiondescription.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Implements the SessionDescriptionInterface. - -#ifndef TALK_APP_WEBRTC_JSEPSESSIONDESCRIPTION_H_ -#define TALK_APP_WEBRTC_JSEPSESSIONDESCRIPTION_H_ - -#include -#include - -#include "talk/app/webrtc/jsep.h" -#include "talk/app/webrtc/jsepicecandidate.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { -class SessionDescription; -} - -namespace webrtc { - -class JsepSessionDescription : public SessionDescriptionInterface { - public: - explicit JsepSessionDescription(const std::string& type); - virtual ~JsepSessionDescription(); - - // |error| can be NULL if don't care about the failure reason. - bool Initialize(const std::string& sdp, SdpParseError* error); - - // Takes ownership of |description|. - bool Initialize(cricket::SessionDescription* description, - const std::string& session_id, - const std::string& session_version); - - virtual cricket::SessionDescription* description() { - return description_.get(); - } - virtual const cricket::SessionDescription* description() const { - return description_.get(); - } - virtual std::string session_id() const { - return session_id_; - } - virtual std::string session_version() const { - return session_version_; - } - virtual std::string type() const { - return type_; - } - // Allow changing the type. Used for testing. - void set_type(const std::string& type) { type_ = type; } - virtual bool AddCandidate(const IceCandidateInterface* candidate); - virtual size_t number_of_mediasections() const; - virtual const IceCandidateCollection* candidates( - size_t mediasection_index) const; - virtual bool ToString(std::string* out) const; - - // Default video encoder settings. The resolution is the max resolution. - // TODO(perkj): Implement proper negotiation of video resolution. - static const int kDefaultVideoCodecId; - static const int kDefaultVideoCodecFramerate; - static const char kDefaultVideoCodecName[]; - static const int kMaxVideoCodecWidth; - static const int kMaxVideoCodecHeight; - static const int kDefaultVideoCodecPreference; - - private: - rtc::scoped_ptr description_; - std::string session_id_; - std::string session_version_; - std::string type_; - std::vector candidate_collection_; - - bool GetMediasectionIndex(const IceCandidateInterface* candidate, - size_t* index); - - RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription); -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_JSEPSESSIONDESCRIPTION_H_ diff --git a/include/talk/app/webrtc/localaudiosource.h b/include/talk/app/webrtc/localaudiosource.h deleted file mode 100644 index 5158eb1..0000000 --- a/include/talk/app/webrtc/localaudiosource.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_LOCALAUDIOSOURCE_H_ -#define TALK_APP_WEBRTC_LOCALAUDIOSOURCE_H_ - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/notifier.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/media/base/mediachannel.h" -#include "webrtc/base/scoped_ptr.h" - -// LocalAudioSource implements AudioSourceInterface. -// This contains settings for switching audio processing on and off. - -namespace webrtc { - -class MediaConstraintsInterface; - -class LocalAudioSource : public Notifier { - public: - // Creates an instance of LocalAudioSource. - static rtc::scoped_refptr Create( - const PeerConnectionFactoryInterface::Options& options, - const MediaConstraintsInterface* constraints); - - SourceState state() const override { return source_state_; } - bool remote() const override { return false; } - - virtual const cricket::AudioOptions& options() const { return options_; } - - void AddSink(AudioTrackSinkInterface* sink) override {} - void RemoveSink(AudioTrackSinkInterface* sink) override {} - - protected: - LocalAudioSource() : source_state_(kInitializing) {} - ~LocalAudioSource() override {} - - private: - void Initialize(const PeerConnectionFactoryInterface::Options& options, - const MediaConstraintsInterface* constraints); - - cricket::AudioOptions options_; - SourceState source_state_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_LOCALAUDIOSOURCE_H_ diff --git a/include/talk/app/webrtc/mediaconstraintsinterface.h b/include/talk/app/webrtc/mediaconstraintsinterface.h deleted file mode 100644 index 68ed9f7..0000000 --- a/include/talk/app/webrtc/mediaconstraintsinterface.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains the interface for MediaConstraints, corresponding to -// the definition at -// http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also -// used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints. - -#ifndef TALK_APP_WEBRTC_MEDIACONSTRAINTSINTERFACE_H_ -#define TALK_APP_WEBRTC_MEDIACONSTRAINTSINTERFACE_H_ - -#include -#include - -namespace webrtc { - -// MediaConstraintsInterface -// Interface used for passing arguments about media constraints -// to the MediaStream and PeerConnection implementation. -class MediaConstraintsInterface { - public: - struct Constraint { - Constraint() {} - Constraint(const std::string& key, const std::string value) - : key(key), value(value) { - } - std::string key; - std::string value; - }; - - class Constraints : public std::vector { - public: - bool FindFirst(const std::string& key, std::string* value) const; - }; - - virtual const Constraints& GetMandatory() const = 0; - virtual const Constraints& GetOptional() const = 0; - - // Constraint keys used by a local video source. - // Specified by draft-alvestrand-constraints-resolution-00b - static const char kMinAspectRatio[]; // minAspectRatio - static const char kMaxAspectRatio[]; // maxAspectRatio - static const char kMaxWidth[]; // maxWidth - static const char kMinWidth[]; // minWidth - static const char kMaxHeight[]; // maxHeight - static const char kMinHeight[]; // minHeight - static const char kMaxFrameRate[]; // maxFrameRate - static const char kMinFrameRate[]; // minFrameRate - - // Constraint keys used by a local audio source. - static const char kEchoCancellation[]; // echoCancellation - - // These keys are google specific. - static const char kGoogEchoCancellation[]; // googEchoCancellation - - static const char kExtendedFilterEchoCancellation[]; // googEchoCancellation2 - static const char kDAEchoCancellation[]; // googDAEchoCancellation - static const char kAutoGainControl[]; // googAutoGainControl - static const char kExperimentalAutoGainControl[]; // googAutoGainControl2 - static const char kNoiseSuppression[]; // googNoiseSuppression - static const char kExperimentalNoiseSuppression[]; // googNoiseSuppression2 - static const char kHighpassFilter[]; // googHighpassFilter - static const char kTypingNoiseDetection[]; // googTypingNoiseDetection - static const char kAudioMirroring[]; // googAudioMirroring - static const char kAecDump[]; // audioDebugRecording - - // Google-specific constraint keys for a local video source - static const char kNoiseReduction[]; // googNoiseReduction - - // Constraint keys for CreateOffer / CreateAnswer - // Specified by the W3C PeerConnection spec - static const char kOfferToReceiveVideo[]; // OfferToReceiveVideo - static const char kOfferToReceiveAudio[]; // OfferToReceiveAudio - static const char kVoiceActivityDetection[]; // VoiceActivityDetection - static const char kIceRestart[]; // IceRestart - // These keys are google specific. - static const char kUseRtpMux[]; // googUseRtpMUX - - // Constraints values. - static const char kValueTrue[]; // true - static const char kValueFalse[]; // false - - // PeerConnection constraint keys. - // Temporary pseudo-constraints used to enable DTLS-SRTP - static const char kEnableDtlsSrtp[]; // Enable DTLS-SRTP - // Temporary pseudo-constraints used to enable DataChannels - static const char kEnableRtpDataChannels[]; // Enable RTP DataChannels - // Google-specific constraint keys. - // Temporary pseudo-constraint for enabling DSCP through JS. - static const char kEnableDscp[]; // googDscp - // Constraint to enable IPv6 through JS. - static const char kEnableIPv6[]; // googIPv6 - // Temporary constraint to enable suspend below min bitrate feature. - static const char kEnableVideoSuspendBelowMinBitrate[]; - // googSuspendBelowMinBitrate - static const char kNumUnsignalledRecvStreams[]; - // googNumUnsignalledRecvStreams - // Constraint to enable combined audio+video bandwidth estimation. - static const char kCombinedAudioVideoBwe[]; // googCombinedAudioVideoBwe - static const char kScreencastMinBitrate[]; // googScreencastMinBitrate - static const char kCpuOveruseDetection[]; // googCpuOveruseDetection - static const char kCpuUnderuseThreshold[]; // googCpuUnderuseThreshold - static const char kCpuOveruseThreshold[]; // googCpuOveruseThreshold - // Low cpu adaptation threshold for relative standard deviation of encode - // time. - static const char kCpuUnderuseEncodeRsdThreshold[]; - // High cpu adaptation threshold for relative standard deviation of encode - // time. - static const char kCpuOveruseEncodeRsdThreshold[]; - static const char kCpuOveruseEncodeUsage[]; // googCpuOveruseEncodeUsage - static const char kHighStartBitrate[]; // googHighStartBitrate - static const char kPayloadPadding[]; // googPayloadPadding - - // The prefix of internal-only constraints whose JS set values should be - // stripped by Chrome before passed down to Libjingle. - static const char kInternalConstraintPrefix[]; - - protected: - // Dtor protected as objects shouldn't be deleted via this interface - virtual ~MediaConstraintsInterface() {} -}; - -bool FindConstraint(const MediaConstraintsInterface* constraints, - const std::string& key, bool* value, - size_t* mandatory_constraints); - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIACONSTRAINTSINTERFACE_H_ diff --git a/include/talk/app/webrtc/mediacontroller.h b/include/talk/app/webrtc/mediacontroller.h deleted file mode 100644 index 1b51be7..0000000 --- a/include/talk/app/webrtc/mediacontroller.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_MEDIACONTROLLER_H_ -#define TALK_APP_WEBRTC_MEDIACONTROLLER_H_ - -#include "webrtc/base/thread.h" - -namespace cricket { -class ChannelManager; -} // namespace cricket - -namespace webrtc { -class Call; -class VoiceEngine; - -// The MediaController currently owns shared state between media channels, but -// in the future will create and own RtpSenders and RtpReceivers. -class MediaControllerInterface { - public: - static MediaControllerInterface* Create( - rtc::Thread* worker_thread, - cricket::ChannelManager* channel_manager); - - virtual ~MediaControllerInterface() {} - virtual webrtc::Call* call_w() = 0; - virtual cricket::ChannelManager* channel_manager() const = 0; -}; -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIACONTROLLER_H_ diff --git a/include/talk/app/webrtc/mediastream.h b/include/talk/app/webrtc/mediastream.h deleted file mode 100644 index 240512d..0000000 --- a/include/talk/app/webrtc/mediastream.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains the implementation of MediaStreamInterface interface. - -#ifndef TALK_APP_WEBRTC_MEDIASTREAM_H_ -#define TALK_APP_WEBRTC_MEDIASTREAM_H_ - -#include -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/notifier.h" - -namespace webrtc { - -class MediaStream : public Notifier { - public: - static rtc::scoped_refptr Create(const std::string& label); - - std::string label() const override { return label_; } - - bool AddTrack(AudioTrackInterface* track) override; - bool AddTrack(VideoTrackInterface* track) override; - bool RemoveTrack(AudioTrackInterface* track) override; - bool RemoveTrack(VideoTrackInterface* track) override; - virtual rtc::scoped_refptr - FindAudioTrack(const std::string& track_id); - virtual rtc::scoped_refptr - FindVideoTrack(const std::string& track_id); - - AudioTrackVector GetAudioTracks() override { return audio_tracks_; } - VideoTrackVector GetVideoTracks() override { return video_tracks_; } - - protected: - explicit MediaStream(const std::string& label); - - private: - template - bool AddTrack(TrackVector* Tracks, Track* track); - template - bool RemoveTrack(TrackVector* Tracks, MediaStreamTrackInterface* track); - - std::string label_; - AudioTrackVector audio_tracks_; - VideoTrackVector video_tracks_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAM_H_ diff --git a/include/talk/app/webrtc/mediastreamhandler.h b/include/talk/app/webrtc/mediastreamhandler.h deleted file mode 100644 index be493f1..0000000 --- a/include/talk/app/webrtc/mediastreamhandler.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// TODO(deadbeef): Remove this file once Chrome build files no longer reference -// it. diff --git a/include/talk/app/webrtc/mediastreaminterface.h b/include/talk/app/webrtc/mediastreaminterface.h deleted file mode 100644 index a1c0c80..0000000 --- a/include/talk/app/webrtc/mediastreaminterface.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains interfaces for MediaStream, MediaTrack and MediaSource. -// These interfaces are used for implementing MediaStream and MediaTrack as -// defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These -// interfaces must be used only with PeerConnection. PeerConnectionManager -// interface provides the factory methods to create MediaStream and MediaTracks. - -#ifndef TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ -#define TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace cricket { - -class AudioRenderer; -class VideoCapturer; -class VideoRenderer; -class VideoFrame; - -} // namespace cricket - -namespace webrtc { - -// Generic observer interface. -class ObserverInterface { - public: - virtual void OnChanged() = 0; - - protected: - virtual ~ObserverInterface() {} -}; - -class NotifierInterface { - public: - virtual void RegisterObserver(ObserverInterface* observer) = 0; - virtual void UnregisterObserver(ObserverInterface* observer) = 0; - - virtual ~NotifierInterface() {} -}; - -// Base class for sources. A MediaStreamTrack have an underlying source that -// provide media. A source can be shared with multiple tracks. -class MediaSourceInterface : public rtc::RefCountInterface, - public NotifierInterface { - public: - enum SourceState { - kInitializing, - kLive, - kEnded, - kMuted - }; - - virtual SourceState state() const = 0; - - virtual bool remote() const = 0; - - protected: - virtual ~MediaSourceInterface() {} -}; - -// Information about a track. -class MediaStreamTrackInterface : public rtc::RefCountInterface, - public NotifierInterface { - public: - enum TrackState { - kInitializing, // Track is beeing negotiated. - kLive = 1, // Track alive - kEnded = 2, // Track have ended - kFailed = 3, // Track negotiation failed. - }; - - static const char kAudioKind[]; - static const char kVideoKind[]; - - virtual std::string kind() const = 0; - virtual std::string id() const = 0; - virtual bool enabled() const = 0; - virtual TrackState state() const = 0; - virtual bool set_enabled(bool enable) = 0; - // These methods should be called by implementation only. - virtual bool set_state(TrackState new_state) = 0; - - protected: - virtual ~MediaStreamTrackInterface() {} -}; - -// Interface for rendering VideoFrames from a VideoTrack -class VideoRendererInterface { - public: - // TODO(guoweis): Remove this function. Obsolete. The implementation of - // VideoRendererInterface should be able to handle different frame size as - // well as pending rotation. If it can't apply the frame rotation by itself, - // it should call |frame|.GetCopyWithRotationApplied() to get a frame that has - // the rotation applied. - virtual void SetSize(int width, int height) {} - - // |frame| may have pending rotation. For clients which can't apply rotation, - // |frame|->GetCopyWithRotationApplied() will return a frame that has the - // rotation applied. - virtual void RenderFrame(const cricket::VideoFrame* frame) = 0; - - protected: - // The destructor is protected to prevent deletion via the interface. - // This is so that we allow reference counted classes, where the destructor - // should never be public, to implement the interface. - virtual ~VideoRendererInterface() {} -}; - -class VideoSourceInterface; - -class VideoTrackInterface : public MediaStreamTrackInterface { - public: - // Register a renderer that will render all frames received on this track. - virtual void AddRenderer(VideoRendererInterface* renderer) = 0; - // Deregister a renderer. - virtual void RemoveRenderer(VideoRendererInterface* renderer) = 0; - - virtual VideoSourceInterface* GetSource() const = 0; - - protected: - virtual ~VideoTrackInterface() {} -}; - -// Interface for receiving audio data from a AudioTrack. -class AudioTrackSinkInterface { - public: - virtual void OnData(const void* audio_data, - int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames) = 0; - - protected: - virtual ~AudioTrackSinkInterface() {} -}; - -// AudioSourceInterface is a reference counted source used for AudioTracks. -// The same source can be used in multiple AudioTracks. -class AudioSourceInterface : public MediaSourceInterface { - public: - class AudioObserver { - public: - virtual void OnSetVolume(double volume) = 0; - - protected: - virtual ~AudioObserver() {} - }; - - // TODO(xians): Makes all the interface pure virtual after Chrome has their - // implementations. - // Sets the volume to the source. |volume| is in the range of [0, 10]. - // TODO(tommi): This method should be on the track and ideally volume should - // be applied in the track in a way that does not affect clones of the track. - virtual void SetVolume(double volume) {} - - // Registers/unregisters observer to the audio source. - virtual void RegisterAudioObserver(AudioObserver* observer) {} - virtual void UnregisterAudioObserver(AudioObserver* observer) {} - - // TODO(tommi): Make pure virtual. - virtual void AddSink(AudioTrackSinkInterface* sink) {} - virtual void RemoveSink(AudioTrackSinkInterface* sink) {} -}; - -// Interface of the audio processor used by the audio track to collect -// statistics. -class AudioProcessorInterface : public rtc::RefCountInterface { - public: - struct AudioProcessorStats { - AudioProcessorStats() : typing_noise_detected(false), - echo_return_loss(0), - echo_return_loss_enhancement(0), - echo_delay_median_ms(0), - aec_quality_min(0.0), - echo_delay_std_ms(0) {} - ~AudioProcessorStats() {} - - bool typing_noise_detected; - int echo_return_loss; - int echo_return_loss_enhancement; - int echo_delay_median_ms; - float aec_quality_min; - int echo_delay_std_ms; - }; - - // Get audio processor statistics. - virtual void GetStats(AudioProcessorStats* stats) = 0; - - protected: - virtual ~AudioProcessorInterface() {} -}; - -class AudioTrackInterface : public MediaStreamTrackInterface { - public: - // TODO(xians): Figure out if the following interface should be const or not. - virtual AudioSourceInterface* GetSource() const = 0; - - // Add/Remove a sink that will receive the audio data from the track. - virtual void AddSink(AudioTrackSinkInterface* sink) = 0; - virtual void RemoveSink(AudioTrackSinkInterface* sink) = 0; - - // Get the signal level from the audio track. - // Return true on success, otherwise false. - // TODO(xians): Change the interface to int GetSignalLevel() and pure virtual - // after Chrome has the correct implementation of the interface. - virtual bool GetSignalLevel(int* level) { return false; } - - // Get the audio processor used by the audio track. Return NULL if the track - // does not have any processor. - // TODO(xians): Make the interface pure virtual. - virtual rtc::scoped_refptr - GetAudioProcessor() { return NULL; } - - // Get a pointer to the audio renderer of this AudioTrack. - // The pointer is valid for the lifetime of this AudioTrack. - // TODO(xians): Remove the following interface after Chrome switches to - // AddSink() and RemoveSink() interfaces. - virtual cricket::AudioRenderer* GetRenderer() { return NULL; } - - protected: - virtual ~AudioTrackInterface() {} -}; - -typedef std::vector > - AudioTrackVector; -typedef std::vector > - VideoTrackVector; - -class MediaStreamInterface : public rtc::RefCountInterface, - public NotifierInterface { - public: - virtual std::string label() const = 0; - - virtual AudioTrackVector GetAudioTracks() = 0; - virtual VideoTrackVector GetVideoTracks() = 0; - virtual rtc::scoped_refptr - FindAudioTrack(const std::string& track_id) = 0; - virtual rtc::scoped_refptr - FindVideoTrack(const std::string& track_id) = 0; - - virtual bool AddTrack(AudioTrackInterface* track) = 0; - virtual bool AddTrack(VideoTrackInterface* track) = 0; - virtual bool RemoveTrack(AudioTrackInterface* track) = 0; - virtual bool RemoveTrack(VideoTrackInterface* track) = 0; - - protected: - virtual ~MediaStreamInterface() {} -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ diff --git a/include/talk/app/webrtc/mediastreamobserver.h b/include/talk/app/webrtc/mediastreamobserver.h deleted file mode 100644 index 1dd6c4c..0000000 --- a/include/talk/app/webrtc/mediastreamobserver.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_MEDIASTREAMOBSERVER_H_ -#define TALK_APP_WEBRTC_MEDIASTREAMOBSERVER_H_ - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/sigslot.h" - -namespace webrtc { - -// Helper class which will listen for changes to a stream and emit the -// corresponding signals. -class MediaStreamObserver : public ObserverInterface { - public: - explicit MediaStreamObserver(MediaStreamInterface* stream); - ~MediaStreamObserver(); - - const MediaStreamInterface* stream() const { return stream_; } - - void OnChanged() override; - - sigslot::signal2 - SignalAudioTrackAdded; - sigslot::signal2 - SignalAudioTrackRemoved; - sigslot::signal2 - SignalVideoTrackAdded; - sigslot::signal2 - SignalVideoTrackRemoved; - - private: - rtc::scoped_refptr stream_; - AudioTrackVector cached_audio_tracks_; - VideoTrackVector cached_video_tracks_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAMOBSERVER_H_ diff --git a/include/talk/app/webrtc/mediastreamprovider.h b/include/talk/app/webrtc/mediastreamprovider.h deleted file mode 100644 index 585d51b..0000000 --- a/include/talk/app/webrtc/mediastreamprovider.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_MEDIASTREAMPROVIDER_H_ -#define TALK_APP_WEBRTC_MEDIASTREAMPROVIDER_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -class AudioRenderer; -class VideoCapturer; -class VideoRenderer; -struct AudioOptions; -struct VideoOptions; - -} // namespace cricket - -namespace webrtc { - -class AudioSinkInterface; - -// TODO(deadbeef): Change the key from an ssrc to a "sender_id" or -// "receiver_id" string, which will be the MSID in the short term and MID in -// the long term. - -// TODO(deadbeef): These interfaces are effectively just a way for the -// RtpSenders/Receivers to get to the BaseChannels. These interfaces should be -// refactored away eventually, as the classes converge. - -// This interface is called by AudioRtpSender/Receivers to change the settings -// of an audio track connected to certain PeerConnection. -class AudioProviderInterface { - public: - // Enable/disable the audio playout of a remote audio track with |ssrc|. - virtual void SetAudioPlayout(uint32_t ssrc, bool enable) = 0; - // Enable/disable sending audio on the local audio track with |ssrc|. - // When |enable| is true |options| should be applied to the audio track. - virtual void SetAudioSend(uint32_t ssrc, - bool enable, - const cricket::AudioOptions& options, - cricket::AudioRenderer* renderer) = 0; - - // Sets the audio playout volume of a remote audio track with |ssrc|. - // |volume| is in the range of [0, 10]. - virtual void SetAudioPlayoutVolume(uint32_t ssrc, double volume) = 0; - - // Allows for setting a direct audio sink for an incoming audio source. - // Only one audio sink is supported per ssrc and ownership of the sink is - // passed to the provider. - virtual void SetRawAudioSink( - uint32_t ssrc, - rtc::scoped_ptr sink) = 0; - - protected: - virtual ~AudioProviderInterface() {} -}; - -// This interface is called by VideoRtpSender/Receivers to change the settings -// of a video track connected to a certain PeerConnection. -class VideoProviderInterface { - public: - virtual bool SetCaptureDevice(uint32_t ssrc, - cricket::VideoCapturer* camera) = 0; - // Enable/disable the video playout of a remote video track with |ssrc|. - virtual void SetVideoPlayout(uint32_t ssrc, - bool enable, - cricket::VideoRenderer* renderer) = 0; - // Enable sending video on the local video track with |ssrc|. - virtual void SetVideoSend(uint32_t ssrc, - bool enable, - const cricket::VideoOptions* options) = 0; - - protected: - virtual ~VideoProviderInterface() {} -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAMPROVIDER_H_ diff --git a/include/talk/app/webrtc/mediastreamproxy.h b/include/talk/app/webrtc/mediastreamproxy.h deleted file mode 100644 index bde7dcf..0000000 --- a/include/talk/app/webrtc/mediastreamproxy.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_MEDIASTREAMPROXY_H_ -#define TALK_APP_WEBRTC_MEDIASTREAMPROXY_H_ - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/proxy.h" - -namespace webrtc { - -BEGIN_PROXY_MAP(MediaStream) - PROXY_CONSTMETHOD0(std::string, label) - PROXY_METHOD0(AudioTrackVector, GetAudioTracks) - PROXY_METHOD0(VideoTrackVector, GetVideoTracks) - PROXY_METHOD1(rtc::scoped_refptr, - FindAudioTrack, const std::string&) - PROXY_METHOD1(rtc::scoped_refptr, - FindVideoTrack, const std::string&) - PROXY_METHOD1(bool, AddTrack, AudioTrackInterface*) - PROXY_METHOD1(bool, AddTrack, VideoTrackInterface*) - PROXY_METHOD1(bool, RemoveTrack, AudioTrackInterface*) - PROXY_METHOD1(bool, RemoveTrack, VideoTrackInterface*) - PROXY_METHOD1(void, RegisterObserver, ObserverInterface*) - PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAMPROXY_H_ diff --git a/include/talk/app/webrtc/mediastreamtrack.h b/include/talk/app/webrtc/mediastreamtrack.h deleted file mode 100644 index 2097d90..0000000 --- a/include/talk/app/webrtc/mediastreamtrack.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_MEDIASTREAMTRACK_H_ -#define TALK_APP_WEBRTC_MEDIASTREAMTRACK_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/notifier.h" - -namespace webrtc { - -// MediaTrack implements the interface common to AudioTrackInterface and -// VideoTrackInterface. -template -class MediaStreamTrack : public Notifier { - public: - typedef typename T::TrackState TypedTrackState; - - virtual std::string id() const { return id_; } - virtual MediaStreamTrackInterface::TrackState state() const { - return state_; - } - virtual bool enabled() const { return enabled_; } - virtual bool set_enabled(bool enable) { - bool fire_on_change = (enable != enabled_); - enabled_ = enable; - if (fire_on_change) { - Notifier::FireOnChanged(); - } - return fire_on_change; - } - virtual bool set_state(MediaStreamTrackInterface::TrackState new_state) { - bool fire_on_change = (state_ != new_state); - state_ = new_state; - if (fire_on_change) - Notifier::FireOnChanged(); - return true; - } - - protected: - explicit MediaStreamTrack(const std::string& id) - : enabled_(true), - id_(id), - state_(MediaStreamTrackInterface::kInitializing) { - } - - private: - bool enabled_; - std::string id_; - MediaStreamTrackInterface::TrackState state_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAMTRACK_H_ diff --git a/include/talk/app/webrtc/mediastreamtrackproxy.h b/include/talk/app/webrtc/mediastreamtrackproxy.h deleted file mode 100644 index d97ba3c..0000000 --- a/include/talk/app/webrtc/mediastreamtrackproxy.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file includes proxy classes for tracks. The purpose is -// to make sure tracks are only accessed from the signaling thread. - -#ifndef TALK_APP_WEBRTC_MEDIASTREAMTRACKPROXY_H_ -#define TALK_APP_WEBRTC_MEDIASTREAMTRACKPROXY_H_ - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/proxy.h" - -namespace webrtc { - -BEGIN_PROXY_MAP(AudioTrack) - PROXY_CONSTMETHOD0(std::string, kind) - PROXY_CONSTMETHOD0(std::string, id) - PROXY_CONSTMETHOD0(TrackState, state) - PROXY_CONSTMETHOD0(bool, enabled) - PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource) - PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*) - PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*) - PROXY_METHOD1(bool, GetSignalLevel, int*) - PROXY_METHOD0(rtc::scoped_refptr, - GetAudioProcessor) - PROXY_METHOD0(cricket::AudioRenderer*, GetRenderer) - - PROXY_METHOD1(bool, set_enabled, bool) - PROXY_METHOD1(bool, set_state, TrackState) - - PROXY_METHOD1(void, RegisterObserver, ObserverInterface*) - PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*) -END_PROXY() - -BEGIN_PROXY_MAP(VideoTrack) - PROXY_CONSTMETHOD0(std::string, kind) - PROXY_CONSTMETHOD0(std::string, id) - PROXY_CONSTMETHOD0(TrackState, state) - PROXY_CONSTMETHOD0(bool, enabled) - PROXY_METHOD1(bool, set_enabled, bool) - PROXY_METHOD1(bool, set_state, TrackState) - - PROXY_METHOD1(void, AddRenderer, VideoRendererInterface*) - PROXY_METHOD1(void, RemoveRenderer, VideoRendererInterface*) - PROXY_CONSTMETHOD0(VideoSourceInterface*, GetSource) - - PROXY_METHOD1(void, RegisterObserver, ObserverInterface*) - PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_MEDIASTREAMTRACKPROXY_H_ diff --git a/include/talk/app/webrtc/notifier.h b/include/talk/app/webrtc/notifier.h deleted file mode 100644 index ecc16b9..0000000 --- a/include/talk/app/webrtc/notifier.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_NOTIFIER_H_ -#define TALK_APP_WEBRTC_NOTIFIER_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "webrtc/base/common.h" - -namespace webrtc { - -// Implement a template version of a notifier. -template -class Notifier : public T { - public: - Notifier() { - } - - virtual void RegisterObserver(ObserverInterface* observer) { - ASSERT(observer != NULL); - observers_.push_back(observer); - } - - virtual void UnregisterObserver(ObserverInterface* observer) { - for (std::list::iterator it = observers_.begin(); - it != observers_.end(); it++) { - if (*it == observer) { - observers_.erase(it); - break; - } - } - } - - void FireOnChanged() { - // Copy the list of observers to avoid a crash if the observer object - // unregisters as a result of the OnChanged() call. If the same list is used - // UnregisterObserver will affect the list make the iterator invalid. - std::list observers = observers_; - for (std::list::iterator it = observers.begin(); - it != observers.end(); ++it) { - (*it)->OnChanged(); - } - } - - protected: - std::list observers_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_NOTIFIER_H_ diff --git a/include/talk/app/webrtc/peerconnection.h b/include/talk/app/webrtc/peerconnection.h deleted file mode 100644 index ab3fdcc..0000000 --- a/include/talk/app/webrtc/peerconnection.h +++ /dev/null @@ -1,409 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_PEERCONNECTION_H_ -#define TALK_APP_WEBRTC_PEERCONNECTION_H_ - -#include - -#include "talk/app/webrtc/dtlsidentitystore.h" -#include "talk/app/webrtc/peerconnectionfactory.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/app/webrtc/rtpreceiverinterface.h" -#include "talk/app/webrtc/rtpsenderinterface.h" -#include "talk/app/webrtc/statscollector.h" -#include "talk/app/webrtc/streamcollection.h" -#include "talk/app/webrtc/webrtcsession.h" -#include "webrtc/base/scoped_ptr.h" - -namespace webrtc { - -class MediaStreamObserver; -class RemoteMediaStreamFactory; - -typedef std::vector - StunConfigurations; -typedef std::vector - TurnConfigurations; - -// Populates |session_options| from |rtc_options|, and returns true if options -// are valid. -bool ConvertRtcOptionsForOffer( - const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, - cricket::MediaSessionOptions* session_options); - -// Populates |session_options| from |constraints|, and returns true if all -// mandatory constraints are satisfied. -bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, - cricket::MediaSessionOptions* session_options); - -// Parses the URLs for each server in |servers| to build |stun_config| and -// |turn_config|. -bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, - StunConfigurations* stun_config, - TurnConfigurations* turn_config); - -// PeerConnection implements the PeerConnectionInterface interface. -// It uses WebRtcSession to implement the PeerConnection functionality. -class PeerConnection : public PeerConnectionInterface, - public IceObserver, - public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - explicit PeerConnection(PeerConnectionFactory* factory); - - // TODO(deadbeef): Remove this overload of Initialize once everyone is moved - // to the new version. - bool Initialize( - const PeerConnectionInterface::RTCConfiguration& configuration, - const MediaConstraintsInterface* constraints, - PortAllocatorFactoryInterface* allocator_factory, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer); - - bool Initialize( - const PeerConnectionInterface::RTCConfiguration& configuration, - const MediaConstraintsInterface* constraints, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer); - - rtc::scoped_refptr local_streams() override; - rtc::scoped_refptr remote_streams() override; - bool AddStream(MediaStreamInterface* local_stream) override; - void RemoveStream(MediaStreamInterface* local_stream) override; - - virtual WebRtcSession* session() { return session_.get(); } - - rtc::scoped_refptr CreateDtmfSender( - AudioTrackInterface* track) override; - - rtc::scoped_refptr CreateSender( - const std::string& kind, - const std::string& stream_id) override; - - std::vector> GetSenders() - const override; - std::vector> GetReceivers() - const override; - - rtc::scoped_refptr CreateDataChannel( - const std::string& label, - const DataChannelInit* config) override; - bool GetStats(StatsObserver* observer, - webrtc::MediaStreamTrackInterface* track, - StatsOutputLevel level) override; - - SignalingState signaling_state() override; - - // TODO(bemasc): Remove ice_state() when callers are removed. - IceState ice_state() override; - IceConnectionState ice_connection_state() override; - IceGatheringState ice_gathering_state() override; - - const SessionDescriptionInterface* local_description() const override; - const SessionDescriptionInterface* remote_description() const override; - - // JSEP01 - void CreateOffer(CreateSessionDescriptionObserver* observer, - const MediaConstraintsInterface* constraints) override; - void CreateOffer(CreateSessionDescriptionObserver* observer, - const RTCOfferAnswerOptions& options) override; - void CreateAnswer(CreateSessionDescriptionObserver* observer, - const MediaConstraintsInterface* constraints) override; - void SetLocalDescription(SetSessionDescriptionObserver* observer, - SessionDescriptionInterface* desc) override; - void SetRemoteDescription(SetSessionDescriptionObserver* observer, - SessionDescriptionInterface* desc) override; - bool SetConfiguration( - const PeerConnectionInterface::RTCConfiguration& config) override; - bool AddIceCandidate(const IceCandidateInterface* candidate) override; - - void RegisterUMAObserver(UMAObserver* observer) override; - - void Close() override; - - // Virtual for unit tests. - virtual const std::vector>& - sctp_data_channels() const { - return sctp_data_channels_; - }; - - protected: - ~PeerConnection() override; - - private: - struct TrackInfo { - TrackInfo() : ssrc(0) {} - TrackInfo(const std::string& stream_label, - const std::string track_id, - uint32_t ssrc) - : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {} - bool operator==(const TrackInfo& other) { - return this->stream_label == other.stream_label && - this->track_id == other.track_id && this->ssrc == other.ssrc; - } - std::string stream_label; - std::string track_id; - uint32_t ssrc; - }; - typedef std::vector TrackInfos; - - // Implements MessageHandler. - void OnMessage(rtc::Message* msg) override; - - void CreateAudioReceiver(MediaStreamInterface* stream, - AudioTrackInterface* audio_track, - uint32_t ssrc); - void CreateVideoReceiver(MediaStreamInterface* stream, - VideoTrackInterface* video_track, - uint32_t ssrc); - void DestroyAudioReceiver(MediaStreamInterface* stream, - AudioTrackInterface* audio_track); - void DestroyVideoReceiver(MediaStreamInterface* stream, - VideoTrackInterface* video_track); - void DestroyAudioSender(MediaStreamInterface* stream, - AudioTrackInterface* audio_track, - uint32_t ssrc); - void DestroyVideoSender(MediaStreamInterface* stream, - VideoTrackInterface* video_track); - - // Implements IceObserver - void OnIceConnectionChange(IceConnectionState new_state) override; - void OnIceGatheringChange(IceGatheringState new_state) override; - void OnIceCandidate(const IceCandidateInterface* candidate) override; - void OnIceComplete() override; - void OnIceConnectionReceivingChange(bool receiving) override; - - // Signals from WebRtcSession. - void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state); - void ChangeSignalingState(SignalingState signaling_state); - - // Signals from MediaStreamObserver. - void OnAudioTrackAdded(AudioTrackInterface* track, - MediaStreamInterface* stream); - void OnAudioTrackRemoved(AudioTrackInterface* track, - MediaStreamInterface* stream); - void OnVideoTrackAdded(VideoTrackInterface* track, - MediaStreamInterface* stream); - void OnVideoTrackRemoved(VideoTrackInterface* track, - MediaStreamInterface* stream); - - rtc::Thread* signaling_thread() const { - return factory_->signaling_thread(); - } - - void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, - const std::string& error); - void PostCreateSessionDescriptionFailure( - CreateSessionDescriptionObserver* observer, - const std::string& error); - - bool IsClosed() const { - return signaling_state_ == PeerConnectionInterface::kClosed; - } - - // Returns a MediaSessionOptions struct with options decided by |options|, - // the local MediaStreams and DataChannels. - virtual bool GetOptionsForOffer( - const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, - cricket::MediaSessionOptions* session_options); - - // Returns a MediaSessionOptions struct with options decided by - // |constraints|, the local MediaStreams and DataChannels. - virtual bool GetOptionsForAnswer( - const MediaConstraintsInterface* constraints, - cricket::MediaSessionOptions* session_options); - - // Remove all local and remote tracks of type |media_type|. - // Called when a media type is rejected (m-line set to port 0). - void RemoveTracks(cricket::MediaType media_type); - - // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, - // and existing MediaStreamTracks are removed if there is no corresponding - // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack - // is created if it doesn't exist; if false, it's removed if it exists. - // |media_type| is the type of the |streams| and can be either audio or video. - // If a new MediaStream is created it is added to |new_streams|. - void UpdateRemoteStreamsList( - const std::vector& streams, - bool default_track_needed, - cricket::MediaType media_type, - StreamCollection* new_streams); - - // Triggered when a remote track has been seen for the first time in a remote - // session description. It creates a remote MediaStreamTrackInterface - // implementation and triggers CreateAudioReceiver or CreateVideoReceiver. - void OnRemoteTrackSeen(const std::string& stream_label, - const std::string& track_id, - uint32_t ssrc, - cricket::MediaType media_type); - - // Triggered when a remote track has been removed from a remote session - // description. It removes the remote track with id |track_id| from a remote - // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver. - void OnRemoteTrackRemoved(const std::string& stream_label, - const std::string& track_id, - cricket::MediaType media_type); - - // Finds remote MediaStreams without any tracks and removes them from - // |remote_streams_| and notifies the observer that the MediaStreams no longer - // exist. - void UpdateEndedRemoteMediaStreams(); - - // Set the MediaStreamTrackInterface::TrackState to |kEnded| on all remote - // tracks of type |media_type|. - void EndRemoteTracks(cricket::MediaType media_type); - - // Loops through the vector of |streams| and finds added and removed - // StreamParams since last time this method was called. - // For each new or removed StreamParam, OnLocalTrackSeen or - // OnLocalTrackRemoved is invoked. - void UpdateLocalTracks(const std::vector& streams, - cricket::MediaType media_type); - - // Triggered when a local track has been seen for the first time in a local - // session description. - // This method triggers CreateAudioSender or CreateVideoSender if the rtp - // streams in the local SessionDescription can be mapped to a MediaStreamTrack - // in a MediaStream in |local_streams_| - void OnLocalTrackSeen(const std::string& stream_label, - const std::string& track_id, - uint32_t ssrc, - cricket::MediaType media_type); - - // Triggered when a local track has been removed from a local session - // description. - // This method triggers DestroyAudioSender or DestroyVideoSender if a stream - // has been removed from the local SessionDescription and the stream can be - // mapped to a MediaStreamTrack in a MediaStream in |local_streams_|. - void OnLocalTrackRemoved(const std::string& stream_label, - const std::string& track_id, - uint32_t ssrc, - cricket::MediaType media_type); - - void UpdateLocalRtpDataChannels(const cricket::StreamParamsVec& streams); - void UpdateRemoteRtpDataChannels(const cricket::StreamParamsVec& streams); - void UpdateClosingRtpDataChannels( - const std::vector& active_channels, - bool is_local_update); - void CreateRemoteRtpDataChannel(const std::string& label, - uint32_t remote_ssrc); - - // Creates channel and adds it to the collection of DataChannels that will - // be offered in a SessionDescription. - rtc::scoped_refptr InternalCreateDataChannel( - const std::string& label, - const InternalDataChannelInit* config); - - // Checks if any data channel has been added. - bool HasDataChannels() const; - - void AllocateSctpSids(rtc::SSLRole role); - void OnSctpDataChannelClosed(DataChannel* channel); - - // Notifications from WebRtcSession relating to BaseChannels. - void OnVoiceChannelDestroyed(); - void OnVideoChannelDestroyed(); - void OnDataChannelCreated(); - void OnDataChannelDestroyed(); - // Called when the cricket::DataChannel receives a message indicating that a - // webrtc::DataChannel should be opened. - void OnDataChannelOpenMessage(const std::string& label, - const InternalDataChannelInit& config); - - RtpSenderInterface* FindSenderById(const std::string& id); - - std::vector>::iterator - FindSenderForTrack(MediaStreamTrackInterface* track); - std::vector>::iterator - FindReceiverForTrack(MediaStreamTrackInterface* track); - - TrackInfos* GetRemoteTracks(cricket::MediaType media_type); - TrackInfos* GetLocalTracks(cricket::MediaType media_type); - const TrackInfo* FindTrackInfo(const TrackInfos& infos, - const std::string& stream_label, - const std::string track_id) const; - - // Returns the specified SCTP DataChannel in sctp_data_channels_, - // or nullptr if not found. - DataChannel* FindDataChannelBySid(int sid) const; - - // Storing the factory as a scoped reference pointer ensures that the memory - // in the PeerConnectionFactoryImpl remains available as long as the - // PeerConnection is running. It is passed to PeerConnection as a raw pointer. - // However, since the reference counting is done in the - // PeerConnectionFactoryInterface all instances created using the raw pointer - // will refer to the same reference count. - rtc::scoped_refptr factory_; - PeerConnectionObserver* observer_; - UMAObserver* uma_observer_; - SignalingState signaling_state_; - // TODO(bemasc): Remove ice_state_. - IceState ice_state_; - IceConnectionState ice_connection_state_; - IceGatheringState ice_gathering_state_; - - rtc::scoped_ptr port_allocator_; - rtc::scoped_ptr media_controller_; - - // Streams added via AddStream. - rtc::scoped_refptr local_streams_; - // Streams created as a result of SetRemoteDescription. - rtc::scoped_refptr remote_streams_; - - std::vector> stream_observers_; - - // These lists store track info seen in local/remote descriptions. - TrackInfos remote_audio_tracks_; - TrackInfos remote_video_tracks_; - TrackInfos local_audio_tracks_; - TrackInfos local_video_tracks_; - - SctpSidAllocator sid_allocator_; - // label -> DataChannel - std::map> rtp_data_channels_; - std::vector> sctp_data_channels_; - std::vector> sctp_data_channels_to_free_; - - bool remote_peer_supports_msid_ = false; - rtc::scoped_ptr remote_stream_factory_; - - std::vector> senders_; - std::vector> receivers_; - - // The session_ scoped_ptr is declared at the bottom of PeerConnection - // because its destruction fires signals (such as VoiceChannelDestroyed) - // which will trigger some final actions in PeerConnection... - rtc::scoped_ptr session_; - // ... But stats_ depends on session_ so it should be destroyed even earlier. - rtc::scoped_ptr stats_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ diff --git a/include/talk/app/webrtc/peerconnectionfactory.h b/include/talk/app/webrtc/peerconnectionfactory.h deleted file mode 100644 index cad89d4..0000000 --- a/include/talk/app/webrtc/peerconnectionfactory.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_PEERCONNECTIONFACTORY_H_ -#define TALK_APP_WEBRTC_PEERCONNECTIONFACTORY_H_ - -#include - -#include "talk/app/webrtc/dtlsidentitystore.h" -#include "talk/app/webrtc/mediacontroller.h" -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/session/media/channelmanager.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/thread.h" - -namespace rtc { -class BasicNetworkManager; -class BasicPacketSocketFactory; -} - -namespace webrtc { - -typedef rtc::RefCountedObject - RefCountedDtlsIdentityStore; - -class PeerConnectionFactory : public PeerConnectionFactoryInterface { - public: - virtual void SetOptions(const Options& options) { - options_ = options; - } - - // webrtc::PeerConnectionFactoryInterface override; - // TODO(deadbeef): Get rid of this overload once clients are moved to the - // new version. - rtc::scoped_refptr - CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - const MediaConstraintsInterface* constraints, - PortAllocatorFactoryInterface* allocator_factory, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer) override; - - rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - const MediaConstraintsInterface* constraints, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer) override; - - bool Initialize(); - - rtc::scoped_refptr - CreateLocalMediaStream(const std::string& label) override; - - rtc::scoped_refptr CreateAudioSource( - const MediaConstraintsInterface* constraints) override; - - rtc::scoped_refptr CreateVideoSource( - cricket::VideoCapturer* capturer, - const MediaConstraintsInterface* constraints) override; - - rtc::scoped_refptr - CreateVideoTrack(const std::string& id, - VideoSourceInterface* video_source) override; - - rtc::scoped_refptr - CreateAudioTrack(const std::string& id, - AudioSourceInterface* audio_source) override; - - bool StartAecDump(rtc::PlatformFile file) override; - void StopAecDump() override; - bool StartRtcEventLog(rtc::PlatformFile file) override; - void StopRtcEventLog() override; - - virtual webrtc::MediaControllerInterface* CreateMediaController() const; - virtual rtc::Thread* signaling_thread(); - virtual rtc::Thread* worker_thread(); - const Options& options() const { return options_; } - - protected: - PeerConnectionFactory(); - PeerConnectionFactory( - rtc::Thread* worker_thread, - rtc::Thread* signaling_thread, - AudioDeviceModule* default_adm, - cricket::WebRtcVideoEncoderFactory* video_encoder_factory, - cricket::WebRtcVideoDecoderFactory* video_decoder_factory); - virtual ~PeerConnectionFactory(); - - private: - cricket::MediaEngineInterface* CreateMediaEngine_w(); - - bool owns_ptrs_; - bool wraps_current_thread_; - rtc::Thread* signaling_thread_; - rtc::Thread* worker_thread_; - Options options_; - rtc::scoped_refptr default_allocator_factory_; - // External Audio device used for audio playback. - rtc::scoped_refptr default_adm_; - rtc::scoped_ptr channel_manager_; - // External Video encoder factory. This can be NULL if the client has not - // injected any. In that case, video engine will use the internal SW encoder. - rtc::scoped_ptr - video_encoder_factory_; - // External Video decoder factory. This can be NULL if the client has not - // injected any. In that case, video engine will use the internal SW decoder. - rtc::scoped_ptr - video_decoder_factory_; - rtc::scoped_ptr default_network_manager_; - rtc::scoped_ptr default_socket_factory_; - - rtc::scoped_refptr dtls_identity_store_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PEERCONNECTIONFACTORY_H_ diff --git a/include/talk/app/webrtc/peerconnectionfactoryproxy.h b/include/talk/app/webrtc/peerconnectionfactoryproxy.h deleted file mode 100644 index db34ea7..0000000 --- a/include/talk/app/webrtc/peerconnectionfactoryproxy.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_PEERCONNECTIONFACTORYPROXY_H_ -#define TALK_APP_WEBRTC_PEERCONNECTIONFACTORYPROXY_H_ - -#include -#include - -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/app/webrtc/proxy.h" -#include "webrtc/base/bind.h" - -namespace webrtc { - -BEGIN_PROXY_MAP(PeerConnectionFactory) - PROXY_METHOD1(void, SetOptions, const Options&) - // Can't use PROXY_METHOD5 because scoped_ptr must be moved. - // TODO(tommi,hbos): Use of templates to support scoped_ptr? - rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& a1, - const MediaConstraintsInterface* a2, - PortAllocatorFactoryInterface* a3, - rtc::scoped_ptr a4, - PeerConnectionObserver* a5) override { - return owner_thread_->Invoke>( - rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot1, this, - a1, a2, a3, a4.release(), a5)); - } - rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& a1, - const MediaConstraintsInterface* a2, - rtc::scoped_ptr a3, - rtc::scoped_ptr a4, - PeerConnectionObserver* a5) override { - return owner_thread_->Invoke>( - rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot2, this, - a1, a2, a3.release(), a4.release(), a5)); - } - PROXY_METHOD1(rtc::scoped_refptr, - CreateLocalMediaStream, const std::string&) - PROXY_METHOD1(rtc::scoped_refptr, - CreateAudioSource, const MediaConstraintsInterface*) - PROXY_METHOD2(rtc::scoped_refptr, - CreateVideoSource, cricket::VideoCapturer*, - const MediaConstraintsInterface*) - PROXY_METHOD2(rtc::scoped_refptr, - CreateVideoTrack, const std::string&, VideoSourceInterface*) - PROXY_METHOD2(rtc::scoped_refptr, - CreateAudioTrack, const std::string&, AudioSourceInterface*) - PROXY_METHOD1(bool, StartAecDump, rtc::PlatformFile) - PROXY_METHOD0(void, StopAecDump) - PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile) - PROXY_METHOD0(void, StopRtcEventLog) - - private: - rtc::scoped_refptr CreatePeerConnection_ot1( - const PeerConnectionInterface::RTCConfiguration& a1, - const MediaConstraintsInterface* a2, - PortAllocatorFactoryInterface* a3, - DtlsIdentityStoreInterface* a4, - PeerConnectionObserver* a5) { - rtc::scoped_ptr ptr_a4(a4); - return c_->CreatePeerConnection(a1, a2, a3, std::move(ptr_a4), a5); - } - - rtc::scoped_refptr CreatePeerConnection_ot2( - const PeerConnectionInterface::RTCConfiguration& a1, - const MediaConstraintsInterface* a2, - cricket::PortAllocator* a3, - DtlsIdentityStoreInterface* a4, - PeerConnectionObserver* a5) { - rtc::scoped_ptr ptr_a3(a3); - rtc::scoped_ptr ptr_a4(a4); - return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3), - std::move(ptr_a4), a5); - } -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PEERCONNECTIONFACTORYPROXY_H_ diff --git a/include/talk/app/webrtc/peerconnectioninterface.h b/include/talk/app/webrtc/peerconnectioninterface.h deleted file mode 100644 index 4648176..0000000 --- a/include/talk/app/webrtc/peerconnectioninterface.h +++ /dev/null @@ -1,690 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains the PeerConnection interface as defined in -// http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-connections. -// Applications must use this interface to implement peerconnection. -// PeerConnectionFactory class provides factory methods to create -// peerconnection, mediastream and media tracks objects. -// -// The Following steps are needed to setup a typical call using Jsep. -// 1. Create a PeerConnectionFactoryInterface. Check constructors for more -// information about input parameters. -// 2. Create a PeerConnection object. Provide a configuration string which -// points either to stun or turn server to generate ICE candidates and provide -// an object that implements the PeerConnectionObserver interface. -// 3. Create local MediaStream and MediaTracks using the PeerConnectionFactory -// and add it to PeerConnection by calling AddStream. -// 4. Create an offer and serialize it and send it to the remote peer. -// 5. Once an ice candidate have been found PeerConnection will call the -// observer function OnIceCandidate. The candidates must also be serialized and -// sent to the remote peer. -// 6. Once an answer is received from the remote peer, call -// SetLocalSessionDescription with the offer and SetRemoteSessionDescription -// with the remote answer. -// 7. Once a remote candidate is received from the remote peer, provide it to -// the peerconnection by calling AddIceCandidate. - - -// The Receiver of a call can decide to accept or reject the call. -// This decision will be taken by the application not peerconnection. -// If application decides to accept the call -// 1. Create PeerConnectionFactoryInterface if it doesn't exist. -// 2. Create a new PeerConnection. -// 3. Provide the remote offer to the new PeerConnection object by calling -// SetRemoteSessionDescription. -// 4. Generate an answer to the remote offer by calling CreateAnswer and send it -// back to the remote peer. -// 5. Provide the local answer to the new PeerConnection by calling -// SetLocalSessionDescription with the answer. -// 6. Provide the remote ice candidates by calling AddIceCandidate. -// 7. Once a candidate have been found PeerConnection will call the observer -// function OnIceCandidate. Send these candidates to the remote peer. - -#ifndef TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ -#define TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ - -#include -#include -#include - -#include "talk/app/webrtc/datachannelinterface.h" -#include "talk/app/webrtc/dtlsidentitystore.h" -#include "talk/app/webrtc/dtmfsenderinterface.h" -#include "talk/app/webrtc/dtlsidentitystore.h" -#include "talk/app/webrtc/jsep.h" -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/rtpreceiverinterface.h" -#include "talk/app/webrtc/rtpsenderinterface.h" -#include "talk/app/webrtc/statstypes.h" -#include "talk/app/webrtc/umametrics.h" -#include "webrtc/base/fileutils.h" -#include "webrtc/base/network.h" -#include "webrtc/base/rtccertificate.h" -#include "webrtc/base/sslstreamadapter.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/p2p/base/portallocator.h" - -namespace rtc { -class SSLIdentity; -class Thread; -} - -namespace cricket { -class WebRtcVideoDecoderFactory; -class WebRtcVideoEncoderFactory; -} - -namespace webrtc { -class AudioDeviceModule; -class MediaConstraintsInterface; - -// MediaStream container interface. -class StreamCollectionInterface : public rtc::RefCountInterface { - public: - // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. - virtual size_t count() = 0; - virtual MediaStreamInterface* at(size_t index) = 0; - virtual MediaStreamInterface* find(const std::string& label) = 0; - virtual MediaStreamTrackInterface* FindAudioTrack( - const std::string& id) = 0; - virtual MediaStreamTrackInterface* FindVideoTrack( - const std::string& id) = 0; - - protected: - // Dtor protected as objects shouldn't be deleted via this interface. - ~StreamCollectionInterface() {} -}; - -class StatsObserver : public rtc::RefCountInterface { - public: - virtual void OnComplete(const StatsReports& reports) = 0; - - protected: - virtual ~StatsObserver() {} -}; - -class MetricsObserverInterface : public rtc::RefCountInterface { - public: - - // |type| is the type of the enum counter to be incremented. |counter| - // is the particular counter in that type. |counter_max| is the next sequence - // number after the highest counter. - virtual void IncrementEnumCounter(PeerConnectionEnumCounterType type, - int counter, - int counter_max) {} - - // This is used to handle sparse counters like SSL cipher suites. - // TODO(guoweis): Remove the implementation once the dependency's interface - // definition is updated. - virtual void IncrementSparseEnumCounter(PeerConnectionEnumCounterType type, - int counter) { - IncrementEnumCounter(type, counter, 0 /* Ignored */); - } - - virtual void AddHistogramSample(PeerConnectionMetricsName type, - int value) = 0; - - protected: - virtual ~MetricsObserverInterface() {} -}; - -typedef MetricsObserverInterface UMAObserver; - -class PeerConnectionInterface : public rtc::RefCountInterface { - public: - // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . - enum SignalingState { - kStable, - kHaveLocalOffer, - kHaveLocalPrAnswer, - kHaveRemoteOffer, - kHaveRemotePrAnswer, - kClosed, - }; - - // TODO(bemasc): Remove IceState when callers are changed to - // IceConnection/GatheringState. - enum IceState { - kIceNew, - kIceGathering, - kIceWaiting, - kIceChecking, - kIceConnected, - kIceCompleted, - kIceFailed, - kIceClosed, - }; - - enum IceGatheringState { - kIceGatheringNew, - kIceGatheringGathering, - kIceGatheringComplete - }; - - enum IceConnectionState { - kIceConnectionNew, - kIceConnectionChecking, - kIceConnectionConnected, - kIceConnectionCompleted, - kIceConnectionFailed, - kIceConnectionDisconnected, - kIceConnectionClosed, - kIceConnectionMax, - }; - - struct IceServer { - // TODO(jbauch): Remove uri when all code using it has switched to urls. - std::string uri; - std::vector urls; - std::string username; - std::string password; - }; - typedef std::vector IceServers; - - enum IceTransportsType { - // TODO(pthatcher): Rename these kTransporTypeXXX, but update - // Chromium at the same time. - kNone, - kRelay, - kNoHost, - kAll - }; - - // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1 - enum BundlePolicy { - kBundlePolicyBalanced, - kBundlePolicyMaxBundle, - kBundlePolicyMaxCompat - }; - - // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1 - enum RtcpMuxPolicy { - kRtcpMuxPolicyNegotiate, - kRtcpMuxPolicyRequire, - }; - - enum TcpCandidatePolicy { - kTcpCandidatePolicyEnabled, - kTcpCandidatePolicyDisabled - }; - - enum ContinualGatheringPolicy { - GATHER_ONCE, - GATHER_CONTINUALLY - }; - - // TODO(hbos): Change into class with private data and public getters. - struct RTCConfiguration { - static const int kUndefined = -1; - // Default maximum number of packets in the audio jitter buffer. - static const int kAudioJitterBufferMaxPackets = 50; - // TODO(pthatcher): Rename this ice_transport_type, but update - // Chromium at the same time. - IceTransportsType type; - // TODO(pthatcher): Rename this ice_servers, but update Chromium - // at the same time. - IceServers servers; - BundlePolicy bundle_policy; - RtcpMuxPolicy rtcp_mux_policy; - TcpCandidatePolicy tcp_candidate_policy; - int audio_jitter_buffer_max_packets; - bool audio_jitter_buffer_fast_accelerate; - int ice_connection_receiving_timeout; // ms - int ice_backup_candidate_pair_ping_interval; // ms - ContinualGatheringPolicy continual_gathering_policy; - std::vector> certificates; - bool disable_prerenderer_smoothing; - RTCConfiguration() - : type(kAll), - bundle_policy(kBundlePolicyBalanced), - rtcp_mux_policy(kRtcpMuxPolicyNegotiate), - tcp_candidate_policy(kTcpCandidatePolicyEnabled), - audio_jitter_buffer_max_packets(kAudioJitterBufferMaxPackets), - audio_jitter_buffer_fast_accelerate(false), - ice_connection_receiving_timeout(kUndefined), - ice_backup_candidate_pair_ping_interval(kUndefined), - continual_gathering_policy(GATHER_ONCE), - disable_prerenderer_smoothing(false) {} - }; - - struct RTCOfferAnswerOptions { - static const int kUndefined = -1; - static const int kMaxOfferToReceiveMedia = 1; - - // The default value for constraint offerToReceiveX:true. - static const int kOfferToReceiveMediaTrue = 1; - - int offer_to_receive_video; - int offer_to_receive_audio; - bool voice_activity_detection; - bool ice_restart; - bool use_rtp_mux; - - RTCOfferAnswerOptions() - : offer_to_receive_video(kUndefined), - offer_to_receive_audio(kUndefined), - voice_activity_detection(true), - ice_restart(false), - use_rtp_mux(true) {} - - RTCOfferAnswerOptions(int offer_to_receive_video, - int offer_to_receive_audio, - bool voice_activity_detection, - bool ice_restart, - bool use_rtp_mux) - : offer_to_receive_video(offer_to_receive_video), - offer_to_receive_audio(offer_to_receive_audio), - voice_activity_detection(voice_activity_detection), - ice_restart(ice_restart), - use_rtp_mux(use_rtp_mux) {} - }; - - // Used by GetStats to decide which stats to include in the stats reports. - // |kStatsOutputLevelStandard| includes the standard stats for Javascript API; - // |kStatsOutputLevelDebug| includes both the standard stats and additional - // stats for debugging purposes. - enum StatsOutputLevel { - kStatsOutputLevelStandard, - kStatsOutputLevelDebug, - }; - - // Accessor methods to active local streams. - virtual rtc::scoped_refptr - local_streams() = 0; - - // Accessor methods to remote streams. - virtual rtc::scoped_refptr - remote_streams() = 0; - - // Add a new MediaStream to be sent on this PeerConnection. - // Note that a SessionDescription negotiation is needed before the - // remote peer can receive the stream. - virtual bool AddStream(MediaStreamInterface* stream) = 0; - - // Remove a MediaStream from this PeerConnection. - // Note that a SessionDescription negotiation is need before the - // remote peer is notified. - virtual void RemoveStream(MediaStreamInterface* stream) = 0; - - // Returns pointer to the created DtmfSender on success. - // Otherwise returns NULL. - virtual rtc::scoped_refptr CreateDtmfSender( - AudioTrackInterface* track) = 0; - - // TODO(deadbeef): Make these pure virtual once all subclasses implement them. - // |kind| must be "audio" or "video". - // |stream_id| is used to populate the msid attribute; if empty, one will - // be generated automatically. - virtual rtc::scoped_refptr CreateSender( - const std::string& kind, - const std::string& stream_id) { - return rtc::scoped_refptr(); - } - - virtual std::vector> GetSenders() - const { - return std::vector>(); - } - - virtual std::vector> GetReceivers() - const { - return std::vector>(); - } - - virtual bool GetStats(StatsObserver* observer, - MediaStreamTrackInterface* track, - StatsOutputLevel level) = 0; - - virtual rtc::scoped_refptr CreateDataChannel( - const std::string& label, - const DataChannelInit* config) = 0; - - virtual const SessionDescriptionInterface* local_description() const = 0; - virtual const SessionDescriptionInterface* remote_description() const = 0; - - // Create a new offer. - // The CreateSessionDescriptionObserver callback will be called when done. - virtual void CreateOffer(CreateSessionDescriptionObserver* observer, - const MediaConstraintsInterface* constraints) {} - - // TODO(jiayl): remove the default impl and the old interface when chromium - // code is updated. - virtual void CreateOffer(CreateSessionDescriptionObserver* observer, - const RTCOfferAnswerOptions& options) {} - - // Create an answer to an offer. - // The CreateSessionDescriptionObserver callback will be called when done. - virtual void CreateAnswer(CreateSessionDescriptionObserver* observer, - const MediaConstraintsInterface* constraints) = 0; - // Sets the local session description. - // JsepInterface takes the ownership of |desc| even if it fails. - // The |observer| callback will be called when done. - virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, - SessionDescriptionInterface* desc) = 0; - // Sets the remote session description. - // JsepInterface takes the ownership of |desc| even if it fails. - // The |observer| callback will be called when done. - virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, - SessionDescriptionInterface* desc) = 0; - // Restarts or updates the ICE Agent process of gathering local candidates - // and pinging remote candidates. - // TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration. - virtual bool UpdateIce(const IceServers& configuration, - const MediaConstraintsInterface* constraints) { - return false; - } - // Sets the PeerConnection's global configuration to |config|. - // Any changes to STUN/TURN servers or ICE candidate policy will affect the - // next gathering phase, and cause the next call to createOffer to generate - // new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies - // cannot be changed with this method. - // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of - // PeerConnectionInterface implement it. - virtual bool SetConfiguration( - const PeerConnectionInterface::RTCConfiguration& config) { - return false; - } - // Provides a remote candidate to the ICE Agent. - // A copy of the |candidate| will be created and added to the remote - // description. So the caller of this method still has the ownership of the - // |candidate|. - // TODO(ronghuawu): Consider to change this so that the AddIceCandidate will - // take the ownership of the |candidate|. - virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0; - - virtual void RegisterUMAObserver(UMAObserver* observer) = 0; - - // Returns the current SignalingState. - virtual SignalingState signaling_state() = 0; - - // TODO(bemasc): Remove ice_state when callers are changed to - // IceConnection/GatheringState. - // Returns the current IceState. - virtual IceState ice_state() = 0; - virtual IceConnectionState ice_connection_state() = 0; - virtual IceGatheringState ice_gathering_state() = 0; - - // Terminates all media and closes the transport. - virtual void Close() = 0; - - protected: - // Dtor protected as objects shouldn't be deleted via this interface. - ~PeerConnectionInterface() {} -}; - -// PeerConnection callback interface. Application should implement these -// methods. -class PeerConnectionObserver { - public: - enum StateType { - kSignalingState, - kIceState, - }; - - // Triggered when the SignalingState changed. - virtual void OnSignalingChange( - PeerConnectionInterface::SignalingState new_state) {} - - // Triggered when SignalingState or IceState have changed. - // TODO(bemasc): Remove once callers transition to OnSignalingChange. - virtual void OnStateChange(StateType state_changed) {} - - // Triggered when media is received on a new stream from remote peer. - virtual void OnAddStream(MediaStreamInterface* stream) = 0; - - // Triggered when a remote peer close a stream. - virtual void OnRemoveStream(MediaStreamInterface* stream) = 0; - - // Triggered when a remote peer open a data channel. - virtual void OnDataChannel(DataChannelInterface* data_channel) = 0; - - // Triggered when renegotiation is needed, for example the ICE has restarted. - virtual void OnRenegotiationNeeded() = 0; - - // Called any time the IceConnectionState changes - virtual void OnIceConnectionChange( - PeerConnectionInterface::IceConnectionState new_state) {} - - // Called any time the IceGatheringState changes - virtual void OnIceGatheringChange( - PeerConnectionInterface::IceGatheringState new_state) {} - - // New Ice candidate have been found. - virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; - - // TODO(bemasc): Remove this once callers transition to OnIceGatheringChange. - // All Ice candidates have been found. - virtual void OnIceComplete() {} - - // Called when the ICE connection receiving status changes. - virtual void OnIceConnectionReceivingChange(bool receiving) {} - - protected: - // Dtor protected as objects shouldn't be deleted via this interface. - ~PeerConnectionObserver() {} -}; - -// Factory class used for creating cricket::PortAllocator that is used -// for ICE negotiation. -class PortAllocatorFactoryInterface : public rtc::RefCountInterface { - public: - struct StunConfiguration { - StunConfiguration(const std::string& address, int port) - : server(address, port) {} - // STUN server address and port. - rtc::SocketAddress server; - }; - - struct TurnConfiguration { - TurnConfiguration(const std::string& address, - int port, - const std::string& username, - const std::string& password, - const std::string& transport_type, - bool secure) - : server(address, port), - username(username), - password(password), - transport_type(transport_type), - secure(secure) {} - rtc::SocketAddress server; - std::string username; - std::string password; - std::string transport_type; - bool secure; - }; - - virtual cricket::PortAllocator* CreatePortAllocator( - const std::vector& stun_servers, - const std::vector& turn_configurations) = 0; - - // TODO(phoglund): Make pure virtual when Chrome's factory implements this. - // After this method is called, the port allocator should consider loopback - // network interfaces as well. - virtual void SetNetworkIgnoreMask(int network_ignore_mask) { - } - - protected: - PortAllocatorFactoryInterface() {} - ~PortAllocatorFactoryInterface() {} -}; - -// PeerConnectionFactoryInterface is the factory interface use for creating -// PeerConnection, MediaStream and media tracks. -// PeerConnectionFactoryInterface will create required libjingle threads, -// socket and network manager factory classes for networking. -// If an application decides to provide its own threads and network -// implementation of these classes it should use the alternate -// CreatePeerConnectionFactory method which accepts threads as input and use the -// CreatePeerConnection version that takes a PortAllocatorFactoryInterface as -// argument. -class PeerConnectionFactoryInterface : public rtc::RefCountInterface { - public: - class Options { - public: - Options() : - disable_encryption(false), - disable_sctp_data_channels(false), - disable_network_monitor(false), - network_ignore_mask(rtc::kDefaultNetworkIgnoreMask), - ssl_max_version(rtc::SSL_PROTOCOL_DTLS_10) { - } - bool disable_encryption; - bool disable_sctp_data_channels; - bool disable_network_monitor; - - // Sets the network types to ignore. For instance, calling this with - // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and - // loopback interfaces. - int network_ignore_mask; - - // Sets the maximum supported protocol version. The highest version - // supported by both ends will be used for the connection, i.e. if one - // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. - rtc::SSLProtocolVersion ssl_max_version; - }; - - virtual void SetOptions(const Options& options) = 0; - - // TODO(deadbeef): Remove this overload of CreatePeerConnection once clients - // are moved to the new version. - virtual rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - const MediaConstraintsInterface* constraints, - PortAllocatorFactoryInterface* allocator_factory, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer) { - return nullptr; - } - - // TODO(deadbeef): Make this pure virtual once it's implemented by all - // subclasses. - virtual rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - const MediaConstraintsInterface* constraints, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer) { - return nullptr; - } - - // TODO(hbos): Remove below version after clients are updated to above method. - // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, - // and not IceServers. RTCConfiguration is made up of ice servers and - // ice transport type. - // http://dev.w3.org/2011/webrtc/editor/webrtc.html - inline rtc::scoped_refptr - CreatePeerConnection( - const PeerConnectionInterface::IceServers& servers, - const MediaConstraintsInterface* constraints, - PortAllocatorFactoryInterface* allocator_factory, - rtc::scoped_ptr dtls_identity_store, - PeerConnectionObserver* observer) { - PeerConnectionInterface::RTCConfiguration rtc_config; - rtc_config.servers = servers; - return CreatePeerConnection(rtc_config, constraints, allocator_factory, - std::move(dtls_identity_store), observer); - } - - virtual rtc::scoped_refptr - CreateLocalMediaStream(const std::string& label) = 0; - - // Creates a AudioSourceInterface. - // |constraints| decides audio processing settings but can be NULL. - virtual rtc::scoped_refptr CreateAudioSource( - const MediaConstraintsInterface* constraints) = 0; - - // Creates a VideoSourceInterface. The new source take ownership of - // |capturer|. |constraints| decides video resolution and frame rate but can - // be NULL. - virtual rtc::scoped_refptr CreateVideoSource( - cricket::VideoCapturer* capturer, - const MediaConstraintsInterface* constraints) = 0; - - // Creates a new local VideoTrack. The same |source| can be used in several - // tracks. - virtual rtc::scoped_refptr - CreateVideoTrack(const std::string& label, - VideoSourceInterface* source) = 0; - - // Creates an new AudioTrack. At the moment |source| can be NULL. - virtual rtc::scoped_refptr - CreateAudioTrack(const std::string& label, - AudioSourceInterface* source) = 0; - - // Starts AEC dump using existing file. Takes ownership of |file| and passes - // it on to VoiceEngine (via other objects) immediately, which will take - // the ownerhip. If the operation fails, the file will be closed. - // TODO(grunell): Remove when Chromium has started to use AEC in each source. - // http://crbug.com/264611. - virtual bool StartAecDump(rtc::PlatformFile file) = 0; - - // Stops logging the AEC dump. - virtual void StopAecDump() = 0; - - // Starts RtcEventLog using existing file. Takes ownership of |file| and - // passes it on to VoiceEngine, which will take the ownership. If the - // operation fails the file will be closed. The logging will stop - // automatically after 10 minutes have passed, or when the StopRtcEventLog - // function is called. - // This function as well as the StopRtcEventLog don't really belong on this - // interface, this is a temporary solution until we move the logging object - // from inside voice engine to webrtc::Call, which will happen when the VoE - // restructuring effort is further along. - // TODO(ivoc): Move this into being: - // PeerConnection => MediaController => webrtc::Call. - virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0; - - // Stops logging the RtcEventLog. - virtual void StopRtcEventLog() = 0; - - protected: - // Dtor and ctor protected as objects shouldn't be created or deleted via - // this interface. - PeerConnectionFactoryInterface() {} - ~PeerConnectionFactoryInterface() {} // NOLINT -}; - -// Create a new instance of PeerConnectionFactoryInterface. -rtc::scoped_refptr -CreatePeerConnectionFactory(); - -// Create a new instance of PeerConnectionFactoryInterface. -// Ownership of |factory|, |default_adm|, and optionally |encoder_factory| and -// |decoder_factory| transferred to the returned factory. -rtc::scoped_refptr -CreatePeerConnectionFactory( - rtc::Thread* worker_thread, - rtc::Thread* signaling_thread, - AudioDeviceModule* default_adm, - cricket::WebRtcVideoEncoderFactory* encoder_factory, - cricket::WebRtcVideoDecoderFactory* decoder_factory); - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ diff --git a/include/talk/app/webrtc/peerconnectionproxy.h b/include/talk/app/webrtc/peerconnectionproxy.h deleted file mode 100644 index 3c983d7..0000000 --- a/include/talk/app/webrtc/peerconnectionproxy.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_PEERCONNECTIONPROXY_H_ -#define TALK_APP_WEBRTC_PEERCONNECTIONPROXY_H_ - -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/app/webrtc/proxy.h" - -namespace webrtc { - -// Define proxy for PeerConnectionInterface. -BEGIN_PROXY_MAP(PeerConnection) - PROXY_METHOD0(rtc::scoped_refptr, - local_streams) - PROXY_METHOD0(rtc::scoped_refptr, - remote_streams) - PROXY_METHOD1(bool, AddStream, MediaStreamInterface*) - PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*) - PROXY_METHOD1(rtc::scoped_refptr, - CreateDtmfSender, AudioTrackInterface*) - PROXY_METHOD2(rtc::scoped_refptr, - CreateSender, - const std::string&, - const std::string&) - PROXY_CONSTMETHOD0(std::vector>, - GetSenders) - PROXY_CONSTMETHOD0(std::vector>, - GetReceivers) - PROXY_METHOD3(bool, GetStats, StatsObserver*, - MediaStreamTrackInterface*, - StatsOutputLevel) - PROXY_METHOD2(rtc::scoped_refptr, - CreateDataChannel, const std::string&, const DataChannelInit*) - PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description) - PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description) - PROXY_METHOD2(void, CreateOffer, CreateSessionDescriptionObserver*, - const MediaConstraintsInterface*) - PROXY_METHOD2(void, CreateAnswer, CreateSessionDescriptionObserver*, - const MediaConstraintsInterface*) - PROXY_METHOD2(void, SetLocalDescription, SetSessionDescriptionObserver*, - SessionDescriptionInterface*) - PROXY_METHOD2(void, SetRemoteDescription, SetSessionDescriptionObserver*, - SessionDescriptionInterface*) - PROXY_METHOD1(bool, - SetConfiguration, - const PeerConnectionInterface::RTCConfiguration&); - PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*) - PROXY_METHOD1(void, RegisterUMAObserver, UMAObserver*) - PROXY_METHOD0(SignalingState, signaling_state) - PROXY_METHOD0(IceState, ice_state) - PROXY_METHOD0(IceConnectionState, ice_connection_state) - PROXY_METHOD0(IceGatheringState, ice_gathering_state) - PROXY_METHOD0(void, Close) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PEERCONNECTIONPROXY_H_ diff --git a/include/talk/app/webrtc/portallocatorfactory.h b/include/talk/app/webrtc/portallocatorfactory.h deleted file mode 100644 index 83376d0..0000000 --- a/include/talk/app/webrtc/portallocatorfactory.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file defines the default implementation of -// PortAllocatorFactoryInterface. -// This implementation creates instances of cricket::HTTPPortAllocator and uses -// the BasicNetworkManager and BasicPacketSocketFactory. - -#ifndef TALK_APP_WEBRTC_PORTALLOCATORFACTORY_H_ -#define TALK_APP_WEBRTC_PORTALLOCATORFACTORY_H_ - -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { -class PortAllocator; -} - -namespace rtc { -class BasicNetworkManager; -class BasicPacketSocketFactory; -} - -namespace webrtc { - -class PortAllocatorFactory : public PortAllocatorFactoryInterface { - public: - static rtc::scoped_refptr Create( - rtc::Thread* worker_thread); - - virtual cricket::PortAllocator* CreatePortAllocator( - const std::vector& stun, - const std::vector& turn); - - virtual void SetNetworkIgnoreMask(int network_ignore_mask); - - protected: - explicit PortAllocatorFactory(rtc::Thread* worker_thread); - ~PortAllocatorFactory(); - - private: - rtc::scoped_ptr network_manager_; - rtc::scoped_ptr socket_factory_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PORTALLOCATORFACTORY_H_ diff --git a/include/talk/app/webrtc/proxy.h b/include/talk/app/webrtc/proxy.h deleted file mode 100644 index 76a5c1e..0000000 --- a/include/talk/app/webrtc/proxy.h +++ /dev/null @@ -1,391 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains Macros for creating proxies for webrtc MediaStream and -// PeerConnection classes. - -// -// Example usage: -// -// class TestInterface : public rtc::RefCountInterface { -// public: -// std::string FooA() = 0; -// std::string FooB(bool arg1) const = 0; -// std::string FooC(bool arg1)= 0; -// }; -// -// Note that return types can not be a const reference. -// -// class Test : public TestInterface { -// ... implementation of the interface. -// }; -// -// BEGIN_PROXY_MAP(Test) -// PROXY_METHOD0(std::string, FooA) -// PROXY_CONSTMETHOD1(std::string, FooB, arg1) -// PROXY_METHOD1(std::string, FooC, arg1) -// END_PROXY() -// -// The proxy can be created using TestProxy::Create(Thread*, TestInterface*). - -#ifndef TALK_APP_WEBRTC_PROXY_H_ -#define TALK_APP_WEBRTC_PROXY_H_ - -#include "webrtc/base/event.h" -#include "webrtc/base/thread.h" - -namespace webrtc { - -template -class ReturnType { - public: - template - void Invoke(C* c, M m) { r_ = (c->*m)(); } - template - void Invoke(C* c, M m, T1 a1) { r_ = (c->*m)(a1); } - template - void Invoke(C* c, M m, T1 a1, T2 a2) { r_ = (c->*m)(a1, a2); } - template - void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3) { r_ = (c->*m)(a1, a2, a3); } - template - void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3, T4 a4) { - r_ = (c->*m)(a1, a2, a3, a4); - } - template - void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { - r_ = (c->*m)(a1, a2, a3, a4, a5); - } - - R value() { return r_; } - - private: - R r_; -}; - -template <> -class ReturnType { - public: - template - void Invoke(C* c, M m) { (c->*m)(); } - template - void Invoke(C* c, M m, T1 a1) { (c->*m)(a1); } - template - void Invoke(C* c, M m, T1 a1, T2 a2) { (c->*m)(a1, a2); } - template - void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3) { (c->*m)(a1, a2, a3); } - - void value() {} -}; - -namespace internal { - -class SynchronousMethodCall - : public rtc::MessageData, - public rtc::MessageHandler { - public: - explicit SynchronousMethodCall(rtc::MessageHandler* proxy) - : e_(), proxy_(proxy) {} - ~SynchronousMethodCall() {} - - void Invoke(rtc::Thread* t) { - if (t->IsCurrent()) { - proxy_->OnMessage(NULL); - } else { - e_.reset(new rtc::Event(false, false)); - t->Post(this, 0); - e_->Wait(rtc::Event::kForever); - } - } - - private: - void OnMessage(rtc::Message*) { proxy_->OnMessage(NULL); e_->Set(); } - rtc::scoped_ptr e_; - rtc::MessageHandler* proxy_; -}; - -} // namespace internal - -template -class MethodCall0 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(); - MethodCall0(C* c, Method m) : c_(c), m_(m) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); } - - C* c_; - Method m_; - ReturnType r_; -}; - -template -class ConstMethodCall0 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)() const; - ConstMethodCall0(C* c, Method m) : c_(c), m_(m) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); } - - C* c_; - Method m_; - ReturnType r_; -}; - -template -class MethodCall1 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(T1 a1); - MethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(a1) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_); } - - C* c_; - Method m_; - ReturnType r_; - T1 a1_; -}; - -template -class ConstMethodCall1 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(T1 a1) const; - ConstMethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(a1) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_); } - - C* c_; - Method m_; - ReturnType r_; - T1 a1_; -}; - -template -class MethodCall2 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(T1 a1, T2 a2); - MethodCall2(C* c, Method m, T1 a1, T2 a2) : c_(c), m_(m), a1_(a1), a2_(a2) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_, a2_); } - - C* c_; - Method m_; - ReturnType r_; - T1 a1_; - T2 a2_; -}; - -template -class MethodCall3 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(T1 a1, T2 a2, T3 a3); - MethodCall3(C* c, Method m, T1 a1, T2 a2, T3 a3) - : c_(c), m_(m), a1_(a1), a2_(a2), a3_(a3) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_, a2_, a3_); } - - C* c_; - Method m_; - ReturnType r_; - T1 a1_; - T2 a2_; - T3 a3_; -}; - -template -class MethodCall4 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(T1 a1, T2 a2, T3 a3, T4 a4); - MethodCall4(C* c, Method m, T1 a1, T2 a2, T3 a3, T4 a4) - : c_(c), m_(m), a1_(a1), a2_(a2), a3_(a3), a4_(a4) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_, a2_, a3_, a4_); } - - C* c_; - Method m_; - ReturnType r_; - T1 a1_; - T2 a2_; - T3 a3_; - T4 a4_; -}; - -template -class MethodCall5 : public rtc::Message, - public rtc::MessageHandler { - public: - typedef R (C::*Method)(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); - MethodCall5(C* c, Method m, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) - : c_(c), m_(m), a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5) {} - - R Marshal(rtc::Thread* t) { - internal::SynchronousMethodCall(this).Invoke(t); - return r_.value(); - } - - private: - void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_, a2_, a3_, a4_, a5_); } - - C* c_; - Method m_; - ReturnType r_; - T1 a1_; - T2 a2_; - T3 a3_; - T4 a4_; - T5 a5_; -}; - -#define BEGIN_PROXY_MAP(c) \ - class c##Proxy : public c##Interface { \ - protected: \ - typedef c##Interface C; \ - c##Proxy(rtc::Thread* thread, C* c) : owner_thread_(thread), c_(c) {} \ - ~c##Proxy() { \ - MethodCall0 call(this, &c##Proxy::Release_s); \ - call.Marshal(owner_thread_); \ - } \ - \ - public: \ - static rtc::scoped_refptr Create(rtc::Thread* thread, C* c) { \ - return new rtc::RefCountedObject(thread, c); \ - } - -#define PROXY_METHOD0(r, method) \ - r method() override { \ - MethodCall0 call(c_.get(), &C::method); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_CONSTMETHOD0(r, method) \ - r method() const override { \ - ConstMethodCall0 call(c_.get(), &C::method); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_METHOD1(r, method, t1) \ - r method(t1 a1) override { \ - MethodCall1 call(c_.get(), &C::method, a1); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_CONSTMETHOD1(r, method, t1) \ - r method(t1 a1) const override { \ - ConstMethodCall1 call(c_.get(), &C::method, a1); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_METHOD2(r, method, t1, t2) \ - r method(t1 a1, t2 a2) override { \ - MethodCall2 call(c_.get(), &C::method, a1, a2); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_METHOD3(r, method, t1, t2, t3) \ - r method(t1 a1, t2 a2, t3 a3) override { \ - MethodCall3 call(c_.get(), &C::method, a1, a2, a3); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_METHOD4(r, method, t1, t2, t3, t4) \ - r method(t1 a1, t2 a2, t3 a3, t4 a4) override { \ - MethodCall4 call(c_.get(), &C::method, a1, a2, a3, \ - a4); \ - return call.Marshal(owner_thread_); \ - } - -#define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \ - r method(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) override { \ - MethodCall5 call(c_.get(), &C::method, a1, a2, \ - a3, a4, a5); \ - return call.Marshal(owner_thread_); \ - } - -#define END_PROXY() \ - private:\ - void Release_s() {\ - c_ = NULL;\ - }\ - mutable rtc::Thread* owner_thread_;\ - rtc::scoped_refptr c_;\ - };\ - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_PROXY_H_ diff --git a/include/talk/app/webrtc/remoteaudiosource.h b/include/talk/app/webrtc/remoteaudiosource.h deleted file mode 100644 index d648ba4..0000000 --- a/include/talk/app/webrtc/remoteaudiosource.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ -#define TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ - -#include -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/notifier.h" -#include "talk/media/base/audiorenderer.h" -#include "webrtc/audio/audio_sink.h" -#include "webrtc/base/criticalsection.h" - -namespace rtc { -struct Message; -class Thread; -} // namespace rtc - -namespace webrtc { - -class AudioProviderInterface; - -// This class implements the audio source used by the remote audio track. -class RemoteAudioSource : public Notifier { - public: - // Creates an instance of RemoteAudioSource. - static rtc::scoped_refptr Create( - uint32_t ssrc, - AudioProviderInterface* provider); - - // MediaSourceInterface implementation. - MediaSourceInterface::SourceState state() const override; - bool remote() const override; - - void AddSink(AudioTrackSinkInterface* sink) override; - void RemoveSink(AudioTrackSinkInterface* sink) override; - - protected: - RemoteAudioSource(); - ~RemoteAudioSource() override; - - // Post construction initialize where we can do things like save a reference - // to ourselves (need to be fully constructed). - void Initialize(uint32_t ssrc, AudioProviderInterface* provider); - - private: - typedef std::list AudioObserverList; - - // AudioSourceInterface implementation. - void SetVolume(double volume) override; - void RegisterAudioObserver(AudioObserver* observer) override; - void UnregisterAudioObserver(AudioObserver* observer) override; - - class Sink; - void OnData(const AudioSinkInterface::Data& audio); - void OnAudioProviderGone(); - - class MessageHandler; - void OnMessage(rtc::Message* msg); - - AudioObserverList audio_observers_; - rtc::CriticalSection sink_lock_; - std::list sinks_; - rtc::Thread* const main_thread_; - SourceState state_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_REMOTEAUDIOSOURCE_H_ diff --git a/include/talk/app/webrtc/remoteaudiotrack.h b/include/talk/app/webrtc/remoteaudiotrack.h deleted file mode 100644 index 5f0b23e..0000000 --- a/include/talk/app/webrtc/remoteaudiotrack.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// TODO(tommi): Delete this file when removed from build files in Chromium. diff --git a/include/talk/app/webrtc/remotevideocapturer.h b/include/talk/app/webrtc/remotevideocapturer.h deleted file mode 100644 index b5298d9..0000000 --- a/include/talk/app/webrtc/remotevideocapturer.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_REMOTEVIDEOCAPTURER_H_ -#define TALK_APP_WEBRTC_REMOTEVIDEOCAPTURER_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/media/base/videocapturer.h" -#include "talk/media/base/videorenderer.h" - -namespace webrtc { - -// RemoteVideoCapturer implements a simple cricket::VideoCapturer which -// gets decoded remote video frames from media channel. -// It's used as the remote video source's VideoCapturer so that the remote video -// can be used as a cricket::VideoCapturer and in that way a remote video stream -// can implement the MediaStreamSourceInterface. -class RemoteVideoCapturer : public cricket::VideoCapturer { - public: - RemoteVideoCapturer(); - virtual ~RemoteVideoCapturer(); - - // cricket::VideoCapturer implementation. - cricket::CaptureState Start( - const cricket::VideoFormat& capture_format) override; - void Stop() override; - bool IsRunning() override; - bool GetPreferredFourccs(std::vector* fourccs) override; - bool GetBestCaptureFormat(const cricket::VideoFormat& desired, - cricket::VideoFormat* best_format) override; - bool IsScreencast() const override; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(RemoteVideoCapturer); -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_REMOTEVIDEOCAPTURER_H_ diff --git a/include/talk/app/webrtc/rtpreceiver.h b/include/talk/app/webrtc/rtpreceiver.h deleted file mode 100644 index db021ba..0000000 --- a/include/talk/app/webrtc/rtpreceiver.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains classes that implement RtpReceiverInterface. -// An RtpReceiver associates a MediaStreamTrackInterface with an underlying -// transport (provided by AudioProviderInterface/VideoProviderInterface) - -#ifndef TALK_APP_WEBRTC_RTPRECEIVER_H_ -#define TALK_APP_WEBRTC_RTPRECEIVER_H_ - -#include - -#include "talk/app/webrtc/mediastreamprovider.h" -#include "talk/app/webrtc/rtpreceiverinterface.h" -#include "webrtc/base/basictypes.h" - -namespace webrtc { - -class AudioRtpReceiver : public ObserverInterface, - public AudioSourceInterface::AudioObserver, - public rtc::RefCountedObject { - public: - AudioRtpReceiver(AudioTrackInterface* track, - uint32_t ssrc, - AudioProviderInterface* provider); - - virtual ~AudioRtpReceiver(); - - // ObserverInterface implementation - void OnChanged() override; - - // AudioSourceInterface::AudioObserver implementation - void OnSetVolume(double volume) override; - - // RtpReceiverInterface implementation - rtc::scoped_refptr track() const override { - return track_.get(); - } - - std::string id() const override { return id_; } - - void Stop() override; - - private: - void Reconfigure(); - - const std::string id_; - const rtc::scoped_refptr track_; - const uint32_t ssrc_; - AudioProviderInterface* provider_; // Set to null in Stop(). - bool cached_track_enabled_; -}; - -class VideoRtpReceiver : public rtc::RefCountedObject { - public: - VideoRtpReceiver(VideoTrackInterface* track, - uint32_t ssrc, - VideoProviderInterface* provider); - - virtual ~VideoRtpReceiver(); - - // RtpReceiverInterface implementation - rtc::scoped_refptr track() const override { - return track_.get(); - } - - std::string id() const override { return id_; } - - void Stop() override; - - private: - std::string id_; - rtc::scoped_refptr track_; - uint32_t ssrc_; - VideoProviderInterface* provider_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_RTPRECEIVER_H_ diff --git a/include/talk/app/webrtc/rtpreceiverinterface.h b/include/talk/app/webrtc/rtpreceiverinterface.h deleted file mode 100644 index 099699e..0000000 --- a/include/talk/app/webrtc/rtpreceiverinterface.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains interfaces for RtpReceivers -// http://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface - -#ifndef TALK_APP_WEBRTC_RTPRECEIVERINTERFACE_H_ -#define TALK_APP_WEBRTC_RTPRECEIVERINTERFACE_H_ - -#include - -#include "talk/app/webrtc/proxy.h" -#include "talk/app/webrtc/mediastreaminterface.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace webrtc { - -class RtpReceiverInterface : public rtc::RefCountInterface { - public: - virtual rtc::scoped_refptr track() const = 0; - - // Not to be confused with "mid", this is a field we can temporarily use - // to uniquely identify a receiver until we implement Unified Plan SDP. - virtual std::string id() const = 0; - - virtual void Stop() = 0; - - protected: - virtual ~RtpReceiverInterface() {} -}; - -// Define proxy for RtpReceiverInterface. -BEGIN_PROXY_MAP(RtpReceiver) -PROXY_CONSTMETHOD0(rtc::scoped_refptr, track) -PROXY_CONSTMETHOD0(std::string, id) -PROXY_METHOD0(void, Stop) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_RTPRECEIVERINTERFACE_H_ diff --git a/include/talk/app/webrtc/rtpsender.h b/include/talk/app/webrtc/rtpsender.h deleted file mode 100644 index d5f88a9..0000000 --- a/include/talk/app/webrtc/rtpsender.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains classes that implement RtpSenderInterface. -// An RtpSender associates a MediaStreamTrackInterface with an underlying -// transport (provided by AudioProviderInterface/VideoProviderInterface) - -#ifndef TALK_APP_WEBRTC_RTPSENDER_H_ -#define TALK_APP_WEBRTC_RTPSENDER_H_ - -#include - -#include "talk/app/webrtc/mediastreamprovider.h" -#include "talk/app/webrtc/rtpsenderinterface.h" -#include "talk/app/webrtc/statscollector.h" -#include "talk/media/base/audiorenderer.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" - -namespace webrtc { - -// LocalAudioSinkAdapter receives data callback as a sink to the local -// AudioTrack, and passes the data to the sink of AudioRenderer. -class LocalAudioSinkAdapter : public AudioTrackSinkInterface, - public cricket::AudioRenderer { - public: - LocalAudioSinkAdapter(); - virtual ~LocalAudioSinkAdapter(); - - private: - // AudioSinkInterface implementation. - void OnData(const void* audio_data, - int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames) override; - - // cricket::AudioRenderer implementation. - void SetSink(cricket::AudioRenderer::Sink* sink) override; - - cricket::AudioRenderer::Sink* sink_; - // Critical section protecting |sink_|. - rtc::CriticalSection lock_; -}; - -class AudioRtpSender : public ObserverInterface, - public rtc::RefCountedObject { - public: - // StatsCollector provided so that Add/RemoveLocalAudioTrack can be called - // at the appropriate times. - AudioRtpSender(AudioTrackInterface* track, - const std::string& stream_id, - AudioProviderInterface* provider, - StatsCollector* stats); - - // Randomly generates id and stream_id. - AudioRtpSender(AudioProviderInterface* provider, StatsCollector* stats); - - virtual ~AudioRtpSender(); - - // ObserverInterface implementation - void OnChanged() override; - - // RtpSenderInterface implementation - bool SetTrack(MediaStreamTrackInterface* track) override; - rtc::scoped_refptr track() const override { - return track_.get(); - } - - void SetSsrc(uint32_t ssrc) override; - - uint32_t ssrc() const override { return ssrc_; } - - cricket::MediaType media_type() const override { - return cricket::MEDIA_TYPE_AUDIO; - } - - std::string id() const override { return id_; } - - void set_stream_id(const std::string& stream_id) override { - stream_id_ = stream_id; - } - std::string stream_id() const override { return stream_id_; } - - void Stop() override; - - private: - bool can_send_track() const { return track_ && ssrc_; } - // Helper function to construct options for - // AudioProviderInterface::SetAudioSend. - void SetAudioSend(); - - std::string id_; - std::string stream_id_; - AudioProviderInterface* provider_; - StatsCollector* stats_; - rtc::scoped_refptr track_; - uint32_t ssrc_ = 0; - bool cached_track_enabled_ = false; - bool stopped_ = false; - - // Used to pass the data callback from the |track_| to the other end of - // cricket::AudioRenderer. - rtc::scoped_ptr sink_adapter_; -}; - -class VideoRtpSender : public ObserverInterface, - public rtc::RefCountedObject { - public: - VideoRtpSender(VideoTrackInterface* track, - const std::string& stream_id, - VideoProviderInterface* provider); - - // Randomly generates id and stream_id. - explicit VideoRtpSender(VideoProviderInterface* provider); - - virtual ~VideoRtpSender(); - - // ObserverInterface implementation - void OnChanged() override; - - // RtpSenderInterface implementation - bool SetTrack(MediaStreamTrackInterface* track) override; - rtc::scoped_refptr track() const override { - return track_.get(); - } - - void SetSsrc(uint32_t ssrc) override; - - uint32_t ssrc() const override { return ssrc_; } - - cricket::MediaType media_type() const override { - return cricket::MEDIA_TYPE_VIDEO; - } - - std::string id() const override { return id_; } - - void set_stream_id(const std::string& stream_id) override { - stream_id_ = stream_id; - } - std::string stream_id() const override { return stream_id_; } - - void Stop() override; - - private: - bool can_send_track() const { return track_ && ssrc_; } - // Helper function to construct options for - // VideoProviderInterface::SetVideoSend. - void SetVideoSend(); - - std::string id_; - std::string stream_id_; - VideoProviderInterface* provider_; - rtc::scoped_refptr track_; - uint32_t ssrc_ = 0; - bool cached_track_enabled_ = false; - bool stopped_ = false; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_RTPSENDER_H_ diff --git a/include/talk/app/webrtc/rtpsenderinterface.h b/include/talk/app/webrtc/rtpsenderinterface.h deleted file mode 100644 index f54e8ca..0000000 --- a/include/talk/app/webrtc/rtpsenderinterface.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains interfaces for RtpSenders -// http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface - -#ifndef TALK_APP_WEBRTC_RTPSENDERINTERFACE_H_ -#define TALK_APP_WEBRTC_RTPSENDERINTERFACE_H_ - -#include - -#include "talk/app/webrtc/proxy.h" -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/session/media/mediasession.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace webrtc { - -class RtpSenderInterface : public rtc::RefCountInterface { - public: - // Returns true if successful in setting the track. - // Fails if an audio track is set on a video RtpSender, or vice-versa. - virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; - virtual rtc::scoped_refptr track() const = 0; - - // Used to set the SSRC of the sender, once a local description has been set. - // If |ssrc| is 0, this indiates that the sender should disconnect from the - // underlying transport (this occurs if the sender isn't seen in a local - // description). - virtual void SetSsrc(uint32_t ssrc) = 0; - virtual uint32_t ssrc() const = 0; - - // Audio or video sender? - virtual cricket::MediaType media_type() const = 0; - - // Not to be confused with "mid", this is a field we can temporarily use - // to uniquely identify a receiver until we implement Unified Plan SDP. - virtual std::string id() const = 0; - - // TODO(deadbeef): Support one sender having multiple stream ids. - virtual void set_stream_id(const std::string& stream_id) = 0; - virtual std::string stream_id() const = 0; - - virtual void Stop() = 0; - - protected: - virtual ~RtpSenderInterface() {} -}; - -// Define proxy for RtpSenderInterface. -BEGIN_PROXY_MAP(RtpSender) -PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*) -PROXY_CONSTMETHOD0(rtc::scoped_refptr, track) -PROXY_METHOD1(void, SetSsrc, uint32_t) -PROXY_CONSTMETHOD0(uint32_t, ssrc) -PROXY_CONSTMETHOD0(cricket::MediaType, media_type) -PROXY_CONSTMETHOD0(std::string, id) -PROXY_METHOD1(void, set_stream_id, const std::string&) -PROXY_CONSTMETHOD0(std::string, stream_id) -PROXY_METHOD0(void, Stop) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_RTPSENDERINTERFACE_H_ diff --git a/include/talk/app/webrtc/sctputils.h b/include/talk/app/webrtc/sctputils.h deleted file mode 100644 index f16873c..0000000 --- a/include/talk/app/webrtc/sctputils.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_SCTPUTILS_H_ -#define TALK_APP_WEBRTC_SCTPUTILS_H_ - -#include - -#include "talk/app/webrtc/datachannelinterface.h" - -namespace rtc { -class Buffer; -} // namespace rtc - -namespace webrtc { -struct DataChannelInit; - -// Read the message type and return true if it's an OPEN message. -bool IsOpenMessage(const rtc::Buffer& payload); - -bool ParseDataChannelOpenMessage(const rtc::Buffer& payload, - std::string* label, - DataChannelInit* config); - -bool ParseDataChannelOpenAckMessage(const rtc::Buffer& payload); - -bool WriteDataChannelOpenMessage(const std::string& label, - const DataChannelInit& config, - rtc::Buffer* payload); - -void WriteDataChannelOpenAckMessage(rtc::Buffer* payload); -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_SCTPUTILS_H_ diff --git a/include/talk/app/webrtc/statscollector.h b/include/talk/app/webrtc/statscollector.h deleted file mode 100644 index 56db79d..0000000 --- a/include/talk/app/webrtc/statscollector.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains a class used for gathering statistics from an ongoing -// libjingle PeerConnection. - -#ifndef TALK_APP_WEBRTC_STATSCOLLECTOR_H_ -#define TALK_APP_WEBRTC_STATSCOLLECTOR_H_ - -#include -#include -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/app/webrtc/statstypes.h" -#include "talk/app/webrtc/webrtcsession.h" - -namespace webrtc { - -class PeerConnection; - -// Conversion function to convert candidate type string to the corresponding one -// from enum RTCStatsIceCandidateType. -const char* IceCandidateTypeToStatsType(const std::string& candidate_type); - -// Conversion function to convert adapter type to report string which are more -// fitting to the general style of http://w3c.github.io/webrtc-stats. This is -// only used by stats collector. -const char* AdapterTypeToStatsType(rtc::AdapterType type); - -// A mapping between track ids and their StatsReport. -typedef std::map TrackIdMap; - -class StatsCollector { - public: - // The caller is responsible for ensuring that the pc outlives the - // StatsCollector instance. - explicit StatsCollector(PeerConnection* pc); - virtual ~StatsCollector(); - - // Adds a MediaStream with tracks that can be used as a |selector| in a call - // to GetStats. - void AddStream(MediaStreamInterface* stream); - - // Adds a local audio track that is used for getting some voice statistics. - void AddLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc); - - // Removes a local audio tracks that is used for getting some voice - // statistics. - void RemoveLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc); - - // Gather statistics from the session and store them for future use. - void UpdateStats(PeerConnectionInterface::StatsOutputLevel level); - - // Gets a StatsReports of the last collected stats. Note that UpdateStats must - // be called before this function to get the most recent stats. |selector| is - // a track label or empty string. The most recent reports are stored in - // |reports|. - // TODO(tommi): Change this contract to accept a callback object instead - // of filling in |reports|. As is, there's a requirement that the caller - // uses |reports| immediately without allowing any async activity on - // the thread (message handling etc) and then discard the results. - void GetStats(MediaStreamTrackInterface* track, - StatsReports* reports); - - // Prepare a local or remote SSRC report for the given ssrc. Used internally - // in the ExtractStatsFromList template. - StatsReport* PrepareReport(bool local, - uint32_t ssrc, - const StatsReport::Id& transport_id, - StatsReport::Direction direction); - - // Method used by the unittest to force a update of stats since UpdateStats() - // that occur less than kMinGatherStatsPeriod number of ms apart will be - // ignored. - void ClearUpdateStatsCacheForTest(); - - private: - friend class StatsCollectorTest; - - // Overridden in unit tests to fake timing. - virtual double GetTimeNow(); - - bool CopySelectedReports(const std::string& selector, StatsReports* reports); - - // Helper method for AddCertificateReports. - StatsReport* AddOneCertificateReport( - const rtc::SSLCertificate* cert, const StatsReport* issuer); - - // Helper method for creating IceCandidate report. |is_local| indicates - // whether this candidate is local or remote. - StatsReport* AddCandidateReport(const cricket::Candidate& candidate, - bool local); - - // Adds a report for this certificate and every certificate in its chain, and - // returns the leaf certificate's report. - StatsReport* AddCertificateReports(const rtc::SSLCertificate* cert); - - StatsReport* AddConnectionInfoReport(const std::string& content_name, - int component, int connection_id, - const StatsReport::Id& channel_report_id, - const cricket::ConnectionInfo& info); - - void ExtractDataInfo(); - void ExtractSessionInfo(); - void ExtractVoiceInfo(); - void ExtractVideoInfo(PeerConnectionInterface::StatsOutputLevel level); - void BuildSsrcToTransportId(); - webrtc::StatsReport* GetReport(const StatsReport::StatsType& type, - const std::string& id, - StatsReport::Direction direction); - - // Helper method to get stats from the local audio tracks. - void UpdateStatsFromExistingLocalAudioTracks(); - void UpdateReportFromAudioTrack(AudioTrackInterface* track, - StatsReport* report); - - // Helper method to get the id for the track identified by ssrc. - // |direction| tells if the track is for sending or receiving. - bool GetTrackIdBySsrc(uint32_t ssrc, - std::string* track_id, - StatsReport::Direction direction); - - // Helper method to update the timestamp of track records. - void UpdateTrackReports(); - - // A collection for all of our stats reports. - StatsCollection reports_; - TrackIdMap track_ids_; - // Raw pointer to the peer connection the statistics are gathered from. - PeerConnection* const pc_; - double stats_gathering_started_; - ProxyTransportMap proxy_to_transport_; - - // TODO(tommi): We appear to be holding on to raw pointers to reference - // counted objects? We should be using scoped_refptr here. - typedef std::vector > - LocalAudioTrackVector; - LocalAudioTrackVector local_audio_tracks_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_STATSCOLLECTOR_H_ diff --git a/include/talk/app/webrtc/statstypes.h b/include/talk/app/webrtc/statstypes.h deleted file mode 100644 index 60439b9..0000000 --- a/include/talk/app/webrtc/statstypes.h +++ /dev/null @@ -1,418 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains structures used for retrieving statistics from an ongoing -// libjingle session. - -#ifndef TALK_APP_WEBRTC_STATSTYPES_H_ -#define TALK_APP_WEBRTC_STATSTYPES_H_ - -#include -#include -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/common.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/linked_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/stringencode.h" -#include "webrtc/base/thread_checker.h" - -namespace webrtc { - -class StatsReport { - public: - // Indicates whether a track is for sending or receiving. - // Used in reports for audio/video tracks. - enum Direction { - kSend = 0, - kReceive, - }; - - enum StatsType { - // StatsReport types. - // A StatsReport of |type| = "googSession" contains overall information - // about the thing libjingle calls a session (which may contain one - // or more RTP sessions. - kStatsReportTypeSession, - - // A StatsReport of |type| = "googTransport" contains information - // about a libjingle "transport". - kStatsReportTypeTransport, - - // A StatsReport of |type| = "googComponent" contains information - // about a libjingle "channel" (typically, RTP or RTCP for a transport). - // This is intended to be the same thing as an ICE "Component". - kStatsReportTypeComponent, - - // A StatsReport of |type| = "googCandidatePair" contains information - // about a libjingle "connection" - a single source/destination port pair. - // This is intended to be the same thing as an ICE "candidate pair". - kStatsReportTypeCandidatePair, - - // A StatsReport of |type| = "VideoBWE" is statistics for video Bandwidth - // Estimation, which is global per-session. The |id| field is "bweforvideo" - // (will probably change in the future). - kStatsReportTypeBwe, - - // A StatsReport of |type| = "ssrc" is statistics for a specific rtp stream. - // The |id| field is the SSRC in decimal form of the rtp stream. - kStatsReportTypeSsrc, - - // A StatsReport of |type| = "remoteSsrc" is statistics for a specific - // rtp stream, generated by the remote end of the connection. - kStatsReportTypeRemoteSsrc, - - // A StatsReport of |type| = "googTrack" is statistics for a specific media - // track. The |id| field is the track id. - kStatsReportTypeTrack, - - // A StatsReport of |type| = "localcandidate" or "remotecandidate" is - // attributes on a specific ICE Candidate. It links to its connection pair - // by candidate id. The string value is taken from - // http://w3c.github.io/webrtc-stats/#rtcstatstype-enum*. - kStatsReportTypeIceLocalCandidate, - kStatsReportTypeIceRemoteCandidate, - - // A StatsReport of |type| = "googCertificate" contains an SSL certificate - // transmitted by one of the endpoints of this connection. The |id| is - // controlled by the fingerprint, and is used to identify the certificate in - // the Channel stats (as "googLocalCertificateId" or - // "googRemoteCertificateId") and in any child certificates (as - // "googIssuerId"). - kStatsReportTypeCertificate, - - // A StatsReport of |type| = "datachannel" with statistics for a - // particular DataChannel. - kStatsReportTypeDataChannel, - }; - - enum StatsValueName { - kStatsValueNameActiveConnection, - kStatsValueNameAudioInputLevel, - kStatsValueNameAudioOutputLevel, - kStatsValueNameBytesReceived, - kStatsValueNameBytesSent, - kStatsValueNameCodecImplementationName, - kStatsValueNameDataChannelId, - kStatsValueNamePacketsLost, - kStatsValueNamePacketsReceived, - kStatsValueNamePacketsSent, - kStatsValueNameProtocol, - kStatsValueNameReceiving, - kStatsValueNameSelectedCandidatePairId, - kStatsValueNameSsrc, - kStatsValueNameState, - kStatsValueNameTransportId, - - // Internal StatsValue names. - kStatsValueNameAccelerateRate, - kStatsValueNameActualEncBitrate, - kStatsValueNameAdaptationChanges, - kStatsValueNameAvailableReceiveBandwidth, - kStatsValueNameAvailableSendBandwidth, - kStatsValueNameAvgEncodeMs, - kStatsValueNameBandwidthLimitedResolution, - kStatsValueNameBucketDelay, - kStatsValueNameCaptureStartNtpTimeMs, - kStatsValueNameCandidateIPAddress, - kStatsValueNameCandidateNetworkType, - kStatsValueNameCandidatePortNumber, - kStatsValueNameCandidatePriority, - kStatsValueNameCandidateTransportType, - kStatsValueNameCandidateType, - kStatsValueNameChannelId, - kStatsValueNameCodecName, - kStatsValueNameComponent, - kStatsValueNameContentName, - kStatsValueNameCpuLimitedResolution, - kStatsValueNameCurrentDelayMs, - kStatsValueNameDecodeMs, - kStatsValueNameDecodingCNG, - kStatsValueNameDecodingCTN, - kStatsValueNameDecodingCTSG, - kStatsValueNameDecodingNormal, - kStatsValueNameDecodingPLC, - kStatsValueNameDecodingPLCCNG, - kStatsValueNameDer, - kStatsValueNameDtlsCipher, - kStatsValueNameEchoCancellationQualityMin, - kStatsValueNameEchoDelayMedian, - kStatsValueNameEchoDelayStdDev, - kStatsValueNameEchoReturnLoss, - kStatsValueNameEchoReturnLossEnhancement, - kStatsValueNameEncodeUsagePercent, - kStatsValueNameExpandRate, - kStatsValueNameFingerprint, - kStatsValueNameFingerprintAlgorithm, - kStatsValueNameFirsReceived, - kStatsValueNameFirsSent, - kStatsValueNameFrameHeightInput, - kStatsValueNameFrameHeightReceived, - kStatsValueNameFrameHeightSent, - kStatsValueNameFrameRateDecoded, - kStatsValueNameFrameRateInput, - kStatsValueNameFrameRateOutput, - kStatsValueNameFrameRateReceived, - kStatsValueNameFrameRateSent, - kStatsValueNameFrameWidthInput, - kStatsValueNameFrameWidthReceived, - kStatsValueNameFrameWidthSent, - kStatsValueNameInitiator, - kStatsValueNameIssuerId, - kStatsValueNameJitterBufferMs, - kStatsValueNameJitterReceived, - kStatsValueNameLabel, - kStatsValueNameLocalAddress, - kStatsValueNameLocalCandidateId, - kStatsValueNameLocalCandidateType, - kStatsValueNameLocalCertificateId, - kStatsValueNameMaxDecodeMs, - kStatsValueNameMinPlayoutDelayMs, - kStatsValueNameNacksReceived, - kStatsValueNameNacksSent, - kStatsValueNamePlisReceived, - kStatsValueNamePlisSent, - kStatsValueNamePreemptiveExpandRate, - kStatsValueNamePreferredJitterBufferMs, - kStatsValueNameRemoteAddress, - kStatsValueNameRemoteCandidateId, - kStatsValueNameRemoteCandidateType, - kStatsValueNameRemoteCertificateId, - kStatsValueNameRenderDelayMs, - kStatsValueNameRetransmitBitrate, - kStatsValueNameRtt, - kStatsValueNameSecondaryDecodedRate, - kStatsValueNameSendPacketsDiscarded, - kStatsValueNameSpeechExpandRate, - kStatsValueNameSrtpCipher, - kStatsValueNameTargetDelayMs, - kStatsValueNameTargetEncBitrate, - kStatsValueNameTrackId, - kStatsValueNameTransmitBitrate, - kStatsValueNameTransportType, - kStatsValueNameTypingNoiseState, - kStatsValueNameViewLimitedResolution, - kStatsValueNameWritable, - }; - - class IdBase : public rtc::RefCountInterface { - public: - ~IdBase() override; - StatsType type() const; - - // Users of IdBase will be using the Id typedef, which is compatible with - // this Equals() function. It simply calls the protected (and overridden) - // Equals() method. - bool Equals(const rtc::scoped_refptr& other) const { - return Equals(*other.get()); - } - - virtual std::string ToString() const = 0; - - protected: - // Protected since users of the IdBase type will be using the Id typedef. - virtual bool Equals(const IdBase& other) const; - - IdBase(StatsType type); // Only meant for derived classes. - const StatsType type_; - - static const char kSeparator = '_'; - }; - - typedef rtc::scoped_refptr Id; - - struct Value { - enum Type { - kInt, // int. - kInt64, // int64_t. - kFloat, // float. - kString, // std::string - kStaticString, // const char*. - kBool, // bool. - kId, // Id. - }; - - Value(StatsValueName name, int64_t value, Type int_type); - Value(StatsValueName name, float f); - Value(StatsValueName name, const std::string& value); - Value(StatsValueName name, const char* value); - Value(StatsValueName name, bool b); - Value(StatsValueName name, const Id& value); - - ~Value(); - - // TODO(tommi): This compares name as well as value... - // I think we should only need to compare the value part and - // move the name part into a hash map. - bool Equals(const Value& other) const; - - // Comparison operators. Return true iff the current instance is of the - // correct type and holds the same value. No conversion is performed so - // a string value of "123" is not equal to an int value of 123 and an int - // value of 123 is not equal to a float value of 123.0f. - // One exception to this is that types kInt and kInt64 can be compared and - // kString and kStaticString too. - bool operator==(const std::string& value) const; - bool operator==(const char* value) const; - bool operator==(int64_t value) const; - bool operator==(bool value) const; - bool operator==(float value) const; - bool operator==(const Id& value) const; - - // Getters that allow getting the native value directly. - // The caller must know the type beforehand or else hit a check. - int int_val() const; - int64_t int64_val() const; - float float_val() const; - const char* static_string_val() const; - const std::string& string_val() const; - bool bool_val() const; - const Id& id_val() const; - - // Returns the string representation of |name|. - const char* display_name() const; - - // Converts the native value to a string representation of the value. - std::string ToString() const; - - Type type() const { return type_; } - - // TODO(tommi): Move |name| and |display_name| out of the Value struct. - const StatsValueName name; - - private: - const Type type_; - // TODO(tommi): Use C++ 11 union and make value_ const. - union InternalType { - int int_; - int64_t int64_; - float float_; - bool bool_; - std::string* string_; - const char* static_string_; - Id* id_; - } value_; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(Value); - }; - - // TODO(tommi): Consider using a similar approach to how we store Ids using - // scoped_refptr for values. - typedef rtc::linked_ptr ValuePtr; - typedef std::map Values; - - // Ownership of |id| is passed to |this|. - explicit StatsReport(const Id& id); - - // Factory functions for various types of stats IDs. - static Id NewBandwidthEstimationId(); - static Id NewTypedId(StatsType type, const std::string& id); - static Id NewTypedIntId(StatsType type, int id); - static Id NewIdWithDirection( - StatsType type, const std::string& id, Direction direction); - static Id NewCandidateId(bool local, const std::string& id); - static Id NewComponentId( - const std::string& content_name, int component); - static Id NewCandidatePairId( - const std::string& content_name, int component, int index); - - const Id& id() const { return id_; } - StatsType type() const { return id_->type(); } - double timestamp() const { return timestamp_; } - void set_timestamp(double t) { timestamp_ = t; } - bool empty() const { return values_.empty(); } - const Values& values() const { return values_; } - - const char* TypeToString() const; - - void AddString(StatsValueName name, const std::string& value); - void AddString(StatsValueName name, const char* value); - void AddInt64(StatsValueName name, int64_t value); - void AddInt(StatsValueName name, int value); - void AddFloat(StatsValueName name, float value); - void AddBoolean(StatsValueName name, bool value); - void AddId(StatsValueName name, const Id& value); - - const Value* FindValue(StatsValueName name) const; - - private: - // The unique identifier for this object. - // This is used as a key for this report in ordered containers, - // so it must never be changed. - const Id id_; - double timestamp_; // Time since 1970-01-01T00:00:00Z in milliseconds. - Values values_; - - RTC_DISALLOW_COPY_AND_ASSIGN(StatsReport); -}; - -// Typedef for an array of const StatsReport pointers. -// Ownership of the pointers held by this implementation is assumed to lie -// elsewhere and lifetime guarantees are made by the implementation that uses -// this type. In the StatsCollector, object ownership lies with the -// StatsCollection class. -typedef std::vector StatsReports; - -// A map from the report id to the report. -// This class wraps an STL container and provides a limited set of -// functionality in order to keep things simple. -class StatsCollection { - public: - StatsCollection(); - ~StatsCollection(); - - typedef std::list Container; - typedef Container::iterator iterator; - typedef Container::const_iterator const_iterator; - - const_iterator begin() const; - const_iterator end() const; - size_t size() const; - - // Creates a new report object with |id| that does not already - // exist in the list of reports. - StatsReport* InsertNew(const StatsReport::Id& id); - StatsReport* FindOrAddNew(const StatsReport::Id& id); - StatsReport* ReplaceOrAddNew(const StatsReport::Id& id); - - // Looks for a report with the given |id|. If one is not found, NULL - // will be returned. - StatsReport* Find(const StatsReport::Id& id); - - private: - Container list_; - rtc::ThreadChecker thread_checker_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_STATSTYPES_H_ diff --git a/include/talk/app/webrtc/streamcollection.h b/include/talk/app/webrtc/streamcollection.h deleted file mode 100644 index 07a30a6..0000000 --- a/include/talk/app/webrtc/streamcollection.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_STREAMCOLLECTION_H_ -#define TALK_APP_WEBRTC_STREAMCOLLECTION_H_ - -#include -#include - -#include "talk/app/webrtc/peerconnectioninterface.h" - -namespace webrtc { - -// Implementation of StreamCollection. -class StreamCollection : public StreamCollectionInterface { - public: - static rtc::scoped_refptr Create() { - rtc::RefCountedObject* implementation = - new rtc::RefCountedObject(); - return implementation; - } - - static rtc::scoped_refptr Create( - StreamCollection* streams) { - rtc::RefCountedObject* implementation = - new rtc::RefCountedObject(streams); - return implementation; - } - - virtual size_t count() { - return media_streams_.size(); - } - - virtual MediaStreamInterface* at(size_t index) { - return media_streams_.at(index); - } - - virtual MediaStreamInterface* find(const std::string& label) { - for (StreamVector::iterator it = media_streams_.begin(); - it != media_streams_.end(); ++it) { - if ((*it)->label().compare(label) == 0) { - return (*it); - } - } - return NULL; - } - - virtual MediaStreamTrackInterface* FindAudioTrack( - const std::string& id) { - for (size_t i = 0; i < media_streams_.size(); ++i) { - MediaStreamTrackInterface* track = media_streams_[i]->FindAudioTrack(id); - if (track) { - return track; - } - } - return NULL; - } - - virtual MediaStreamTrackInterface* FindVideoTrack( - const std::string& id) { - for (size_t i = 0; i < media_streams_.size(); ++i) { - MediaStreamTrackInterface* track = media_streams_[i]->FindVideoTrack(id); - if (track) { - return track; - } - } - return NULL; - } - - void AddStream(MediaStreamInterface* stream) { - for (StreamVector::iterator it = media_streams_.begin(); - it != media_streams_.end(); ++it) { - if ((*it)->label().compare(stream->label()) == 0) - return; - } - media_streams_.push_back(stream); - } - - void RemoveStream(MediaStreamInterface* remove_stream) { - for (StreamVector::iterator it = media_streams_.begin(); - it != media_streams_.end(); ++it) { - if ((*it)->label().compare(remove_stream->label()) == 0) { - media_streams_.erase(it); - break; - } - } - } - - protected: - StreamCollection() {} - explicit StreamCollection(StreamCollection* original) - : media_streams_(original->media_streams_) { - } - typedef std::vector > - StreamVector; - StreamVector media_streams_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_STREAMCOLLECTION_H_ diff --git a/include/talk/app/webrtc/test/fakeaudiocapturemodule.h b/include/talk/app/webrtc/test/fakeaudiocapturemodule.h deleted file mode 100644 index 4284b9e..0000000 --- a/include/talk/app/webrtc/test/fakeaudiocapturemodule.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This class implements an AudioCaptureModule that can be used to detect if -// audio is being received properly if it is fed by another AudioCaptureModule -// in some arbitrary audio pipeline where they are connected. It does not play -// out or record any audio so it does not need access to any hardware and can -// therefore be used in the gtest testing framework. - -// Note P postfix of a function indicates that it should only be called by the -// processing thread. - -#ifndef TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ -#define TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/common_types.h" -#include "webrtc/modules/audio_device/include/audio_device.h" - -namespace rtc { -class Thread; -} // namespace rtc - -class FakeAudioCaptureModule - : public webrtc::AudioDeviceModule, - public rtc::MessageHandler { - public: - typedef uint16_t Sample; - - // The value for the following constants have been derived by running VoE - // using a real ADM. The constants correspond to 10ms of mono audio at 44kHz. - static const size_t kNumberSamples = 440; - static const size_t kNumberBytesPerSample = sizeof(Sample); - - // Creates a FakeAudioCaptureModule or returns NULL on failure. - static rtc::scoped_refptr Create(); - - // Returns the number of frames that have been successfully pulled by the - // instance. Note that correctly detecting success can only be done if the - // pulled frame was generated/pushed from a FakeAudioCaptureModule. - int frames_received() const; - - // Following functions are inherited from webrtc::AudioDeviceModule. - // Only functions called by PeerConnection are implemented, the rest do - // nothing and return success. If a function is not expected to be called by - // PeerConnection an assertion is triggered if it is in fact called. - int64_t TimeUntilNextProcess() override; - int32_t Process() override; - - int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override; - - ErrorCode LastError() const override; - int32_t RegisterEventObserver( - webrtc::AudioDeviceObserver* event_callback) override; - - // Note: Calling this method from a callback may result in deadlock. - int32_t RegisterAudioCallback( - webrtc::AudioTransport* audio_callback) override; - - int32_t Init() override; - int32_t Terminate() override; - bool Initialized() const override; - - int16_t PlayoutDevices() override; - int16_t RecordingDevices() override; - int32_t PlayoutDeviceName(uint16_t index, - char name[webrtc::kAdmMaxDeviceNameSize], - char guid[webrtc::kAdmMaxGuidSize]) override; - int32_t RecordingDeviceName(uint16_t index, - char name[webrtc::kAdmMaxDeviceNameSize], - char guid[webrtc::kAdmMaxGuidSize]) override; - - int32_t SetPlayoutDevice(uint16_t index) override; - int32_t SetPlayoutDevice(WindowsDeviceType device) override; - int32_t SetRecordingDevice(uint16_t index) override; - int32_t SetRecordingDevice(WindowsDeviceType device) override; - - int32_t PlayoutIsAvailable(bool* available) override; - int32_t InitPlayout() override; - bool PlayoutIsInitialized() const override; - int32_t RecordingIsAvailable(bool* available) override; - int32_t InitRecording() override; - bool RecordingIsInitialized() const override; - - int32_t StartPlayout() override; - int32_t StopPlayout() override; - bool Playing() const override; - int32_t StartRecording() override; - int32_t StopRecording() override; - bool Recording() const override; - - int32_t SetAGC(bool enable) override; - bool AGC() const override; - - int32_t SetWaveOutVolume(uint16_t volume_left, - uint16_t volume_right) override; - int32_t WaveOutVolume(uint16_t* volume_left, - uint16_t* volume_right) const override; - - int32_t InitSpeaker() override; - bool SpeakerIsInitialized() const override; - int32_t InitMicrophone() override; - bool MicrophoneIsInitialized() const override; - - int32_t SpeakerVolumeIsAvailable(bool* available) override; - int32_t SetSpeakerVolume(uint32_t volume) override; - int32_t SpeakerVolume(uint32_t* volume) const override; - int32_t MaxSpeakerVolume(uint32_t* max_volume) const override; - int32_t MinSpeakerVolume(uint32_t* min_volume) const override; - int32_t SpeakerVolumeStepSize(uint16_t* step_size) const override; - - int32_t MicrophoneVolumeIsAvailable(bool* available) override; - int32_t SetMicrophoneVolume(uint32_t volume) override; - int32_t MicrophoneVolume(uint32_t* volume) const override; - int32_t MaxMicrophoneVolume(uint32_t* max_volume) const override; - - int32_t MinMicrophoneVolume(uint32_t* min_volume) const override; - int32_t MicrophoneVolumeStepSize(uint16_t* step_size) const override; - - int32_t SpeakerMuteIsAvailable(bool* available) override; - int32_t SetSpeakerMute(bool enable) override; - int32_t SpeakerMute(bool* enabled) const override; - - int32_t MicrophoneMuteIsAvailable(bool* available) override; - int32_t SetMicrophoneMute(bool enable) override; - int32_t MicrophoneMute(bool* enabled) const override; - - int32_t MicrophoneBoostIsAvailable(bool* available) override; - int32_t SetMicrophoneBoost(bool enable) override; - int32_t MicrophoneBoost(bool* enabled) const override; - - int32_t StereoPlayoutIsAvailable(bool* available) const override; - int32_t SetStereoPlayout(bool enable) override; - int32_t StereoPlayout(bool* enabled) const override; - int32_t StereoRecordingIsAvailable(bool* available) const override; - int32_t SetStereoRecording(bool enable) override; - int32_t StereoRecording(bool* enabled) const override; - int32_t SetRecordingChannel(const ChannelType channel) override; - int32_t RecordingChannel(ChannelType* channel) const override; - - int32_t SetPlayoutBuffer(const BufferType type, - uint16_t size_ms = 0) override; - int32_t PlayoutBuffer(BufferType* type, uint16_t* size_ms) const override; - int32_t PlayoutDelay(uint16_t* delay_ms) const override; - int32_t RecordingDelay(uint16_t* delay_ms) const override; - - int32_t CPULoad(uint16_t* load) const override; - - int32_t StartRawOutputFileRecording( - const char pcm_file_name_utf8[webrtc::kAdmMaxFileNameSize]) override; - int32_t StopRawOutputFileRecording() override; - int32_t StartRawInputFileRecording( - const char pcm_file_name_utf8[webrtc::kAdmMaxFileNameSize]) override; - int32_t StopRawInputFileRecording() override; - - int32_t SetRecordingSampleRate(const uint32_t samples_per_sec) override; - int32_t RecordingSampleRate(uint32_t* samples_per_sec) const override; - int32_t SetPlayoutSampleRate(const uint32_t samples_per_sec) override; - int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const override; - - int32_t ResetAudioDevice() override; - int32_t SetLoudspeakerStatus(bool enable) override; - int32_t GetLoudspeakerStatus(bool* enabled) const override; - virtual bool BuiltInAECIsAvailable() const { return false; } - virtual int32_t EnableBuiltInAEC(bool enable) { return -1; } - virtual bool BuiltInAGCIsAvailable() const { return false; } - virtual int32_t EnableBuiltInAGC(bool enable) { return -1; } - virtual bool BuiltInNSIsAvailable() const { return false; } - virtual int32_t EnableBuiltInNS(bool enable) { return -1; } - // End of functions inherited from webrtc::AudioDeviceModule. - - // The following function is inherited from rtc::MessageHandler. - void OnMessage(rtc::Message* msg) override; - - protected: - // The constructor is protected because the class needs to be created as a - // reference counted object (for memory managment reasons). It could be - // exposed in which case the burden of proper instantiation would be put on - // the creator of a FakeAudioCaptureModule instance. To create an instance of - // this class use the Create(..) API. - explicit FakeAudioCaptureModule(); - // The destructor is protected because it is reference counted and should not - // be deleted directly. - virtual ~FakeAudioCaptureModule(); - - private: - // Initializes the state of the FakeAudioCaptureModule. This API is called on - // creation by the Create() API. - bool Initialize(); - // SetBuffer() sets all samples in send_buffer_ to |value|. - void SetSendBuffer(int value); - // Resets rec_buffer_. I.e., sets all rec_buffer_ samples to 0. - void ResetRecBuffer(); - // Returns true if rec_buffer_ contains one or more sample greater than or - // equal to |value|. - bool CheckRecBuffer(int value); - - // Returns true/false depending on if recording or playback has been - // enabled/started. - bool ShouldStartProcessing(); - - // Starts or stops the pushing and pulling of audio frames. - void UpdateProcessing(bool start); - - // Starts the periodic calling of ProcessFrame() in a thread safe way. - void StartProcessP(); - // Periodcally called function that ensures that frames are pulled and pushed - // periodically if enabled/started. - void ProcessFrameP(); - // Pulls frames from the registered webrtc::AudioTransport. - void ReceiveFrameP(); - // Pushes frames to the registered webrtc::AudioTransport. - void SendFrameP(); - - // The time in milliseconds when Process() was last called or 0 if no call - // has been made. - uint32_t last_process_time_ms_; - - // Callback for playout and recording. - webrtc::AudioTransport* audio_callback_; - - bool recording_; // True when audio is being pushed from the instance. - bool playing_; // True when audio is being pulled by the instance. - - bool play_is_initialized_; // True when the instance is ready to pull audio. - bool rec_is_initialized_; // True when the instance is ready to push audio. - - // Input to and output from RecordedDataIsAvailable(..) makes it possible to - // modify the current mic level. The implementation does not care about the - // mic level so it just feeds back what it receives. - uint32_t current_mic_level_; - - // next_frame_time_ is updated in a non-drifting manner to indicate the next - // wall clock time the next frame should be generated and received. started_ - // ensures that next_frame_time_ can be initialized properly on first call. - bool started_; - uint32_t next_frame_time_; - - rtc::scoped_ptr process_thread_; - - // Buffer for storing samples received from the webrtc::AudioTransport. - char rec_buffer_[kNumberSamples * kNumberBytesPerSample]; - // Buffer for samples to send to the webrtc::AudioTransport. - char send_buffer_[kNumberSamples * kNumberBytesPerSample]; - - // Counter of frames received that have samples of high enough amplitude to - // indicate that the frames are not faked somewhere in the audio pipeline - // (e.g. by a jitter buffer). - int frames_received_; - - // Protects variables that are accessed from process_thread_ and - // the main thread. - mutable rtc::CriticalSection crit_; - // Protects |audio_callback_| that is accessed from process_thread_ and - // the main thread. - rtc::CriticalSection crit_callback_; -}; - -#endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ diff --git a/include/talk/app/webrtc/test/fakeconstraints.h b/include/talk/app/webrtc/test/fakeconstraints.h deleted file mode 100644 index 8673d85..0000000 --- a/include/talk/app/webrtc/test/fakeconstraints.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_TEST_FAKECONSTRAINTS_H_ -#define TALK_APP_WEBRTC_TEST_FAKECONSTRAINTS_H_ - -#include -#include - -#include "talk/app/webrtc/mediaconstraintsinterface.h" -#include "webrtc/base/stringencode.h" - -namespace webrtc { - -class FakeConstraints : public webrtc::MediaConstraintsInterface { - public: - FakeConstraints() { } - virtual ~FakeConstraints() { } - - virtual const Constraints& GetMandatory() const { - return mandatory_; - } - - virtual const Constraints& GetOptional() const { - return optional_; - } - - template - void AddMandatory(const std::string& key, const T& value) { - mandatory_.push_back(Constraint(key, rtc::ToString(value))); - } - - template - void SetMandatory(const std::string& key, const T& value) { - std::string value_str; - if (mandatory_.FindFirst(key, &value_str)) { - for (Constraints::iterator iter = mandatory_.begin(); - iter != mandatory_.end(); ++iter) { - if (iter->key == key) { - mandatory_.erase(iter); - break; - } - } - } - mandatory_.push_back(Constraint(key, rtc::ToString(value))); - } - - template - void AddOptional(const std::string& key, const T& value) { - optional_.push_back(Constraint(key, rtc::ToString(value))); - } - - void SetMandatoryMinAspectRatio(double ratio) { - SetMandatory(MediaConstraintsInterface::kMinAspectRatio, ratio); - } - - void SetMandatoryMinWidth(int width) { - SetMandatory(MediaConstraintsInterface::kMinWidth, width); - } - - void SetMandatoryMinHeight(int height) { - SetMandatory(MediaConstraintsInterface::kMinHeight, height); - } - - void SetOptionalMaxWidth(int width) { - AddOptional(MediaConstraintsInterface::kMaxWidth, width); - } - - void SetMandatoryMaxFrameRate(int frame_rate) { - SetMandatory(MediaConstraintsInterface::kMaxFrameRate, frame_rate); - } - - void SetMandatoryReceiveAudio(bool enable) { - SetMandatory(MediaConstraintsInterface::kOfferToReceiveAudio, enable); - } - - void SetMandatoryReceiveVideo(bool enable) { - SetMandatory(MediaConstraintsInterface::kOfferToReceiveVideo, enable); - } - - void SetMandatoryUseRtpMux(bool enable) { - SetMandatory(MediaConstraintsInterface::kUseRtpMux, enable); - } - - void SetMandatoryIceRestart(bool enable) { - SetMandatory(MediaConstraintsInterface::kIceRestart, enable); - } - - void SetAllowRtpDataChannels() { - SetMandatory(MediaConstraintsInterface::kEnableRtpDataChannels, true); - SetMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, false); - } - - void SetOptionalVAD(bool enable) { - AddOptional(MediaConstraintsInterface::kVoiceActivityDetection, enable); - } - - void SetAllowDtlsSctpDataChannels() { - SetMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, true); - } - - private: - Constraints mandatory_; - Constraints optional_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_TEST_FAKECONSTRAINTS_H_ diff --git a/include/talk/app/webrtc/test/fakedatachannelprovider.h b/include/talk/app/webrtc/test/fakedatachannelprovider.h deleted file mode 100644 index ff44e58..0000000 --- a/include/talk/app/webrtc/test/fakedatachannelprovider.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_TEST_FAKEDATACHANNELPROVIDER_H_ -#define TALK_APP_WEBRTC_TEST_FAKEDATACHANNELPROVIDER_H_ - -#include "talk/app/webrtc/datachannel.h" - -class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface { - public: - FakeDataChannelProvider() - : send_blocked_(false), - transport_available_(false), - ready_to_send_(false), - transport_error_(false) {} - virtual ~FakeDataChannelProvider() {} - - bool SendData(const cricket::SendDataParams& params, - const rtc::Buffer& payload, - cricket::SendDataResult* result) override { - ASSERT(ready_to_send_ && transport_available_); - if (send_blocked_) { - *result = cricket::SDR_BLOCK; - return false; - } - - if (transport_error_ || payload.size() == 0) { - *result = cricket::SDR_ERROR; - return false; - } - - last_send_data_params_ = params; - return true; - } - - bool ConnectDataChannel(webrtc::DataChannel* data_channel) override { - ASSERT(connected_channels_.find(data_channel) == connected_channels_.end()); - if (!transport_available_) { - return false; - } - LOG(LS_INFO) << "DataChannel connected " << data_channel; - connected_channels_.insert(data_channel); - return true; - } - - void DisconnectDataChannel(webrtc::DataChannel* data_channel) override { - ASSERT(connected_channels_.find(data_channel) != connected_channels_.end()); - LOG(LS_INFO) << "DataChannel disconnected " << data_channel; - connected_channels_.erase(data_channel); - } - - void AddSctpDataStream(int sid) override { - ASSERT(sid >= 0); - if (!transport_available_) { - return; - } - send_ssrcs_.insert(sid); - recv_ssrcs_.insert(sid); - } - - void RemoveSctpDataStream(int sid) override { - ASSERT(sid >= 0); - send_ssrcs_.erase(sid); - recv_ssrcs_.erase(sid); - } - - bool ReadyToSendData() const override { return ready_to_send_; } - - // Set true to emulate the SCTP stream being blocked by congestion control. - void set_send_blocked(bool blocked) { - send_blocked_ = blocked; - if (!blocked) { - // Take a snapshot of the connected channels and check to see whether - // each value is still in connected_channels_ before calling - // OnChannelReady(). This avoids problems where the set gets modified - // in response to OnChannelReady(). - for (webrtc::DataChannel *ch : std::set( - connected_channels_.begin(), connected_channels_.end())) { - if (connected_channels_.count(ch)) { - ch->OnChannelReady(true); - } - } - } - } - - // Set true to emulate the transport channel creation, e.g. after - // setLocalDescription/setRemoteDescription called with data content. - void set_transport_available(bool available) { - transport_available_ = available; - } - - // Set true to emulate the transport ReadyToSendData signal when the transport - // becomes writable for the first time. - void set_ready_to_send(bool ready) { - ASSERT(transport_available_); - ready_to_send_ = ready; - if (ready) { - std::set::iterator it; - for (it = connected_channels_.begin(); - it != connected_channels_.end(); - ++it) { - (*it)->OnChannelReady(true); - } - } - } - - void set_transport_error() { - transport_error_ = true; - } - - cricket::SendDataParams last_send_data_params() const { - return last_send_data_params_; - } - - bool IsConnected(webrtc::DataChannel* data_channel) const { - return connected_channels_.find(data_channel) != connected_channels_.end(); - } - - bool IsSendStreamAdded(uint32_t stream) const { - return send_ssrcs_.find(stream) != send_ssrcs_.end(); - } - - bool IsRecvStreamAdded(uint32_t stream) const { - return recv_ssrcs_.find(stream) != recv_ssrcs_.end(); - } - - private: - cricket::SendDataParams last_send_data_params_; - bool send_blocked_; - bool transport_available_; - bool ready_to_send_; - bool transport_error_; - std::set connected_channels_; - std::set send_ssrcs_; - std::set recv_ssrcs_; -}; -#endif // TALK_APP_WEBRTC_TEST_FAKEDATACHANNELPROVIDER_H_ diff --git a/include/talk/app/webrtc/test/fakedtlsidentitystore.h b/include/talk/app/webrtc/test/fakedtlsidentitystore.h deleted file mode 100644 index 98074c7..0000000 --- a/include/talk/app/webrtc/test/fakedtlsidentitystore.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ -#define TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ - -#include -#include - -#include "talk/app/webrtc/dtlsidentitystore.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "webrtc/base/rtccertificate.h" - -static const struct { - const char* rsa_private_key_pem; - const char* cert_pem; -} kKeysAndCerts[] = { - {"-----BEGIN RSA PRIVATE KEY-----\n" - "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMYRkbhmI7kVA/rM\n" - "czsZ+6JDhDvnkF+vn6yCAGuRPV03zuRqZtDy4N4to7PZu9PjqrRl7nDMXrG3YG9y\n" - "rlIAZ72KjcKKFAJxQyAKLCIdawKRyp8RdK3LEySWEZb0AV58IadqPZDTNHHRX8dz\n" - "5aTSMsbbkZ+C/OzTnbiMqLL/vg6jAgMBAAECgYAvgOs4FJcgvp+TuREx7YtiYVsH\n" - "mwQPTum2z/8VzWGwR8BBHBvIpVe1MbD/Y4seyI2aco/7UaisatSgJhsU46/9Y4fq\n" - "2TwXH9QANf4at4d9n/R6rzwpAJOpgwZgKvdQjkfrKTtgLV+/dawvpxUYkRH4JZM1\n" - "CVGukMfKNrSVH4Ap4QJBAOJmGV1ASPnB4r4nc99at7JuIJmd7fmuVUwUgYi4XgaR\n" - "WhScBsgYwZ/JoywdyZJgnbcrTDuVcWG56B3vXbhdpMsCQQDf9zeJrjnPZ3Cqm79y\n" - "kdqANep0uwZciiNiWxsQrCHztywOvbFhdp8iYVFG9EK8DMY41Y5TxUwsHD+67zao\n" - "ZNqJAkEA1suLUP/GvL8IwuRneQd2tWDqqRQ/Td3qq03hP7e77XtF/buya3Ghclo5\n" - "54czUR89QyVfJEC6278nzA7n2h1uVQJAcG6mztNL6ja/dKZjYZye2CY44QjSlLo0\n" - "MTgTSjdfg/28fFn2Jjtqf9Pi/X+50LWI/RcYMC2no606wRk9kyOuIQJBAK6VSAim\n" - "1pOEjsYQn0X5KEIrz1G3bfCbB848Ime3U2/FWlCHMr6ch8kCZ5d1WUeJD3LbwMNG\n" - "UCXiYxSsu20QNVw=\n" - "-----END RSA PRIVATE KEY-----\n", - "-----BEGIN CERTIFICATE-----\n" - "MIIBmTCCAQKgAwIBAgIEbzBSAjANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDEwZX\n" - "ZWJSVEMwHhcNMTQwMTAyMTgyNDQ3WhcNMTQwMjAxMTgyNDQ3WjARMQ8wDQYDVQQD\n" - "EwZXZWJSVEMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMYRkbhmI7kVA/rM\n" - "czsZ+6JDhDvnkF+vn6yCAGuRPV03zuRqZtDy4N4to7PZu9PjqrRl7nDMXrG3YG9y\n" - "rlIAZ72KjcKKFAJxQyAKLCIdawKRyp8RdK3LEySWEZb0AV58IadqPZDTNHHRX8dz\n" - "5aTSMsbbkZ+C/OzTnbiMqLL/vg6jAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAUflI\n" - "VUe5Krqf5RVa5C3u/UTAOAUJBiDS3VANTCLBxjuMsvqOG0WvaYWP3HYPgrz0jXK2\n" - "LJE/mGw3MyFHEqi81jh95J+ypl6xKW6Rm8jKLR87gUvCaVYn/Z4/P3AqcQTB7wOv\n" - "UD0A8qfhfDM+LK6rPAnCsVN0NRDY3jvd6rzix9M=\n" - "-----END CERTIFICATE-----\n"}, - {"-----BEGIN RSA PRIVATE KEY-----\n" - "MIICXQIBAAKBgQDeYqlyJ1wuiMsi905e3X81/WA/G3ym50PIDZBVtSwZi7JVQPgj\n" - "Bl8CPZMvDh9EwB4Ji9ytA8dZZbQ4WbJWPr73zPpJSCvQqz6sOXSlenBRi72acNaQ\n" - "sOR/qPvviJx5I6Hqo4qemfnjZhAW85a5BpgrAwKgMLIQTHCTLWwVSyrDrwIDAQAB\n" - "AoGARni9eY8/hv+SX+I+05EdXt6MQXNUbQ+cSykBNCfVccLzIFEWUQMT2IHqwl6X\n" - "ShIXcq7/n1QzOAEiuzixauM3YHg4xZ1Um2Ha9a7ig5Xg4v6b43bmMkNE6LkoAtYs\n" - "qnQdfMh442b1liDud6IMb1Qk0amt3fSrgRMc547TZQVx4QECQQDxUeDm94r3p4ng\n" - "5rCLLC1K5/6HSTZsh7jatKPlz7GfP/IZlYV7iE5784/n0wRiCjZOS7hQRy/8m2Gp\n" - "pf4aZq+DAkEA6+np4d36FYikydvUrupLT3FkdRHGn/v83qOll/VmeNh+L1xMZlIP\n" - "tM26hAXCcQb7O5+J9y3cx2CAQsBS11ZXZQJAfGgTo76WG9p5UEJdXUInD2jOZPwv\n" - "XIATolxh6kXKcijLLLlSmT7KB0inNYIpzkkpee+7U1d/u6B3FriGaSHq9QJBAM/J\n" - "ICnDdLCgwNvWVraVQC3BpwSB2pswvCFwq7py94V60XFvbw80Ogc6qIv98qvQxVlX\n" - "hJIEgA/PjEi+0ng94Q0CQQDm8XSDby35gmjO+6eRmJtAjtB7nguLvrPXM6CPXRmD\n" - "sRoBocpHw6j9UdzZ6qYG0FkdXZghezXFY58ro2BYYRR3\n" - "-----END RSA PRIVATE KEY-----\n", - "-----BEGIN CERTIFICATE-----\n" - "MIICWDCCAcGgAwIBAgIJALgDjxMbBOhbMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n" - "BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX\n" - "aWRnaXRzIFB0eSBMdGQwHhcNMTUxMTEzMjIzMjEzWhcNMTYxMTEyMjIzMjEzWjBF\n" - "MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50\n" - "ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" - "gQDeYqlyJ1wuiMsi905e3X81/WA/G3ym50PIDZBVtSwZi7JVQPgjBl8CPZMvDh9E\n" - "wB4Ji9ytA8dZZbQ4WbJWPr73zPpJSCvQqz6sOXSlenBRi72acNaQsOR/qPvviJx5\n" - "I6Hqo4qemfnjZhAW85a5BpgrAwKgMLIQTHCTLWwVSyrDrwIDAQABo1AwTjAdBgNV\n" - "HQ4EFgQUx2tbJdlcSTCepn09UdYORXKuSTAwHwYDVR0jBBgwFoAUx2tbJdlcSTCe\n" - "pn09UdYORXKuSTAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQAmp9Id\n" - "E716gHMqeBG4S2FCgVFCr0a0ugkaneQAN/c2L9CbMemEN9W6jvucUIVOtYd90dDW\n" - "lXuowWmT/JctPe3D2qt4yvYW3puECHk2tVQmrJOZiZiTRtWm6HxkmoUYHYp/DtaS\n" - "1Xe29gSTnZtI5sQCrGMzk3SGRSSs7ejLKiVDBQ==\n" - "-----END CERTIFICATE-----\n"}}; - -class FakeDtlsIdentityStore : public webrtc::DtlsIdentityStoreInterface, - public rtc::MessageHandler { - public: - typedef rtc::TypedMessageData > MessageData; - - FakeDtlsIdentityStore() : should_fail_(false) {} - - void set_should_fail(bool should_fail) { - should_fail_ = should_fail; - } - - void use_original_key() { key_index_ = 0; } - void use_alternate_key() { key_index_ = 1; } - - void RequestIdentity( - rtc::KeyType key_type, - const rtc::scoped_refptr& - observer) override { - // TODO(hbos): Should be able to generate KT_ECDSA too. - RTC_DCHECK(key_type == rtc::KT_RSA || should_fail_); - MessageData* msg = new MessageData( - rtc::scoped_refptr(observer)); - rtc::Thread::Current()->Post( - this, should_fail_ ? MSG_FAILURE : MSG_SUCCESS, msg); - } - - static rtc::scoped_refptr GenerateCertificate() { - std::string cert; - std::string key; - rtc::SSLIdentity::PemToDer("CERTIFICATE", kKeysAndCerts[0].cert_pem, &cert); - rtc::SSLIdentity::PemToDer("RSA PRIVATE KEY", - kKeysAndCerts[0].rsa_private_key_pem, &key); - - std::string pem_cert = rtc::SSLIdentity::DerToPem( - rtc::kPemTypeCertificate, - reinterpret_cast(cert.data()), - cert.length()); - std::string pem_key = rtc::SSLIdentity::DerToPem( - rtc::kPemTypeRsaPrivateKey, - reinterpret_cast(key.data()), - key.length()); - rtc::scoped_ptr identity( - rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert)); - - return rtc::RTCCertificate::Create(std::move(identity)); - } - - private: - enum { - MSG_SUCCESS, - MSG_FAILURE, - }; - - const char* get_key() { - return kKeysAndCerts[key_index_].rsa_private_key_pem; - } - const char* get_cert() { return kKeysAndCerts[key_index_].cert_pem; } - - // rtc::MessageHandler implementation. - void OnMessage(rtc::Message* msg) { - MessageData* message_data = static_cast(msg->pdata); - rtc::scoped_refptr observer = - message_data->data(); - switch (msg->message_id) { - case MSG_SUCCESS: { - std::string cert; - std::string key; - rtc::SSLIdentity::PemToDer("CERTIFICATE", get_cert(), &cert); - rtc::SSLIdentity::PemToDer("RSA PRIVATE KEY", get_key(), &key); - observer->OnSuccess(cert, key); - break; - } - case MSG_FAILURE: - observer->OnFailure(0); - break; - } - delete message_data; - } - - bool should_fail_; - int key_index_ = 0; -}; - -#endif // TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ diff --git a/include/talk/app/webrtc/test/fakeperiodicvideocapturer.h b/include/talk/app/webrtc/test/fakeperiodicvideocapturer.h deleted file mode 100644 index 34e4278..0000000 --- a/include/talk/app/webrtc/test/fakeperiodicvideocapturer.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// FakePeriodicVideoCapturer implements a fake cricket::VideoCapturer that -// creates video frames periodically after it has been started. - -#ifndef TALK_APP_WEBRTC_TEST_FAKEPERIODICVIDEOCAPTURER_H_ -#define TALK_APP_WEBRTC_TEST_FAKEPERIODICVIDEOCAPTURER_H_ - -#include "talk/media/base/fakevideocapturer.h" -#include "webrtc/base/thread.h" - -namespace webrtc { - -class FakePeriodicVideoCapturer : public cricket::FakeVideoCapturer { - public: - FakePeriodicVideoCapturer() { - std::vector formats; - formats.push_back(cricket::VideoFormat(1280, 720, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(640, 480, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(640, 360, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(320, 240, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(160, 120, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - ResetSupportedFormats(formats); - }; - - virtual cricket::CaptureState Start(const cricket::VideoFormat& format) { - cricket::CaptureState state = FakeVideoCapturer::Start(format); - if (state != cricket::CS_FAILED) { - rtc::Thread::Current()->Post(this, MSG_CREATEFRAME); - } - return state; - } - virtual void Stop() { - rtc::Thread::Current()->Clear(this); - } - // Inherited from MesageHandler. - virtual void OnMessage(rtc::Message* msg) { - if (msg->message_id == MSG_CREATEFRAME) { - if (IsRunning()) { - CaptureFrame(); - rtc::Thread::Current()->PostDelayed(static_cast( - GetCaptureFormat()->interval / rtc::kNumNanosecsPerMillisec), - this, MSG_CREATEFRAME); - } - } else { - FakeVideoCapturer::OnMessage(msg); - } - } - - private: - enum { - // Offset 0xFF to make sure this don't collide with base class messages. - MSG_CREATEFRAME = 0xFF - }; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_TEST_FAKEPERIODICVIDEOCAPTURER_H_ diff --git a/include/talk/app/webrtc/test/fakevideotrackrenderer.h b/include/talk/app/webrtc/test/fakevideotrackrenderer.h deleted file mode 100644 index 38b84a6..0000000 --- a/include/talk/app/webrtc/test/fakevideotrackrenderer.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_ -#define TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_ - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/media/base/fakevideorenderer.h" - -namespace webrtc { - -class FakeVideoTrackRenderer : public VideoRendererInterface { - public: - FakeVideoTrackRenderer(VideoTrackInterface* video_track) - : video_track_(video_track), last_frame_(NULL) { - video_track_->AddRenderer(this); - } - ~FakeVideoTrackRenderer() { - video_track_->RemoveRenderer(this); - } - - virtual void RenderFrame(const cricket::VideoFrame* video_frame) override { - last_frame_ = const_cast(video_frame); - if (!fake_renderer_.SetSize(static_cast(video_frame->GetWidth()), - static_cast(video_frame->GetHeight()), - 0)) { - return; - } - - fake_renderer_.RenderFrame(video_frame); - } - - int errors() const { return fake_renderer_.errors(); } - int width() const { return fake_renderer_.width(); } - int height() const { return fake_renderer_.height(); } - int num_rendered_frames() const { - return fake_renderer_.num_rendered_frames(); - } - const cricket::VideoFrame* last_frame() const { return last_frame_; } - - private: - cricket::FakeVideoRenderer fake_renderer_; - rtc::scoped_refptr video_track_; - - // Weak reference for frame pointer comparison only. - cricket::VideoFrame* last_frame_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_TEST_FAKEVIDEOTRACKRENDERER_H_ diff --git a/include/talk/app/webrtc/test/mockpeerconnectionobservers.h b/include/talk/app/webrtc/test/mockpeerconnectionobservers.h deleted file mode 100644 index f1bdbee..0000000 --- a/include/talk/app/webrtc/test/mockpeerconnectionobservers.h +++ /dev/null @@ -1,243 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains mock implementations of observers used in PeerConnection. - -#ifndef TALK_APP_WEBRTC_TEST_MOCKPEERCONNECTIONOBSERVERS_H_ -#define TALK_APP_WEBRTC_TEST_MOCKPEERCONNECTIONOBSERVERS_H_ - -#include - -#include "talk/app/webrtc/datachannelinterface.h" - -namespace webrtc { - -class MockCreateSessionDescriptionObserver - : public webrtc::CreateSessionDescriptionObserver { - public: - MockCreateSessionDescriptionObserver() - : called_(false), - result_(false) {} - virtual ~MockCreateSessionDescriptionObserver() {} - virtual void OnSuccess(SessionDescriptionInterface* desc) { - called_ = true; - result_ = true; - desc_.reset(desc); - } - virtual void OnFailure(const std::string& error) { - called_ = true; - result_ = false; - } - bool called() const { return called_; } - bool result() const { return result_; } - SessionDescriptionInterface* release_desc() { - return desc_.release(); - } - - private: - bool called_; - bool result_; - rtc::scoped_ptr desc_; -}; - -class MockSetSessionDescriptionObserver - : public webrtc::SetSessionDescriptionObserver { - public: - MockSetSessionDescriptionObserver() - : called_(false), - result_(false) {} - virtual ~MockSetSessionDescriptionObserver() {} - virtual void OnSuccess() { - called_ = true; - result_ = true; - } - virtual void OnFailure(const std::string& error) { - called_ = true; - result_ = false; - } - bool called() const { return called_; } - bool result() const { return result_; } - - private: - bool called_; - bool result_; -}; - -class MockDataChannelObserver : public webrtc::DataChannelObserver { - public: - explicit MockDataChannelObserver(webrtc::DataChannelInterface* channel) - : channel_(channel), received_message_count_(0) { - channel_->RegisterObserver(this); - state_ = channel_->state(); - } - virtual ~MockDataChannelObserver() { - channel_->UnregisterObserver(); - } - - void OnBufferedAmountChange(uint64_t previous_amount) override {} - - void OnStateChange() override { state_ = channel_->state(); } - void OnMessage(const DataBuffer& buffer) override { - last_message_.assign(buffer.data.data(), buffer.data.size()); - ++received_message_count_; - } - - bool IsOpen() const { return state_ == DataChannelInterface::kOpen; } - const std::string& last_message() const { return last_message_; } - size_t received_message_count() const { return received_message_count_; } - - private: - rtc::scoped_refptr channel_; - DataChannelInterface::DataState state_; - std::string last_message_; - size_t received_message_count_; -}; - -class MockStatsObserver : public webrtc::StatsObserver { - public: - MockStatsObserver() : called_(false), stats_() {} - virtual ~MockStatsObserver() {} - - virtual void OnComplete(const StatsReports& reports) { - ASSERT(!called_); - called_ = true; - stats_.Clear(); - stats_.number_of_reports = reports.size(); - for (const auto* r : reports) { - if (r->type() == StatsReport::kStatsReportTypeSsrc) { - stats_.timestamp = r->timestamp(); - GetIntValue(r, StatsReport::kStatsValueNameAudioOutputLevel, - &stats_.audio_output_level); - GetIntValue(r, StatsReport::kStatsValueNameAudioInputLevel, - &stats_.audio_input_level); - GetIntValue(r, StatsReport::kStatsValueNameBytesReceived, - &stats_.bytes_received); - GetIntValue(r, StatsReport::kStatsValueNameBytesSent, - &stats_.bytes_sent); - } else if (r->type() == StatsReport::kStatsReportTypeBwe) { - stats_.timestamp = r->timestamp(); - GetIntValue(r, StatsReport::kStatsValueNameAvailableReceiveBandwidth, - &stats_.available_receive_bandwidth); - } else if (r->type() == StatsReport::kStatsReportTypeComponent) { - stats_.timestamp = r->timestamp(); - GetStringValue(r, StatsReport::kStatsValueNameDtlsCipher, - &stats_.dtls_cipher); - GetStringValue(r, StatsReport::kStatsValueNameSrtpCipher, - &stats_.srtp_cipher); - } - } - } - - bool called() const { return called_; } - size_t number_of_reports() const { return stats_.number_of_reports; } - double timestamp() const { return stats_.timestamp; } - - int AudioOutputLevel() const { - ASSERT(called_); - return stats_.audio_output_level; - } - - int AudioInputLevel() const { - ASSERT(called_); - return stats_.audio_input_level; - } - - int BytesReceived() const { - ASSERT(called_); - return stats_.bytes_received; - } - - int BytesSent() const { - ASSERT(called_); - return stats_.bytes_sent; - } - - int AvailableReceiveBandwidth() const { - ASSERT(called_); - return stats_.available_receive_bandwidth; - } - - std::string DtlsCipher() const { - ASSERT(called_); - return stats_.dtls_cipher; - } - - std::string SrtpCipher() const { - ASSERT(called_); - return stats_.srtp_cipher; - } - - private: - bool GetIntValue(const StatsReport* report, - StatsReport::StatsValueName name, - int* value) { - const StatsReport::Value* v = report->FindValue(name); - if (v) { - // TODO(tommi): We should really just be using an int here :-/ - *value = rtc::FromString(v->ToString()); - } - return v != nullptr; - } - - bool GetStringValue(const StatsReport* report, - StatsReport::StatsValueName name, - std::string* value) { - const StatsReport::Value* v = report->FindValue(name); - if (v) - *value = v->ToString(); - return v != nullptr; - } - - bool called_; - struct { - void Clear() { - number_of_reports = 0; - timestamp = 0; - audio_output_level = 0; - audio_input_level = 0; - bytes_received = 0; - bytes_sent = 0; - available_receive_bandwidth = 0; - dtls_cipher.clear(); - srtp_cipher.clear(); - } - - size_t number_of_reports; - double timestamp; - int audio_output_level; - int audio_input_level; - int bytes_received; - int bytes_sent; - int available_receive_bandwidth; - std::string dtls_cipher; - std::string srtp_cipher; - } stats_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_TEST_MOCKPEERCONNECTIONOBSERVERS_H_ diff --git a/include/talk/app/webrtc/test/peerconnectiontestwrapper.h b/include/talk/app/webrtc/test/peerconnectiontestwrapper.h deleted file mode 100644 index b654263..0000000 --- a/include/talk/app/webrtc/test/peerconnectiontestwrapper.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_ -#define TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_ - -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/app/webrtc/test/fakeaudiocapturemodule.h" -#include "talk/app/webrtc/test/fakeconstraints.h" -#include "talk/app/webrtc/test/fakevideotrackrenderer.h" -#include "webrtc/base/sigslot.h" - -namespace webrtc { -class DtlsIdentityStoreInterface; -class PortAllocatorFactoryInterface; -} - -class PeerConnectionTestWrapper - : public webrtc::PeerConnectionObserver, - public webrtc::CreateSessionDescriptionObserver, - public sigslot::has_slots<> { - public: - static void Connect(PeerConnectionTestWrapper* caller, - PeerConnectionTestWrapper* callee); - - explicit PeerConnectionTestWrapper(const std::string& name); - virtual ~PeerConnectionTestWrapper(); - - bool CreatePc(const webrtc::MediaConstraintsInterface* constraints); - - rtc::scoped_refptr CreateDataChannel( - const std::string& label, - const webrtc::DataChannelInit& init); - - // Implements PeerConnectionObserver. - virtual void OnSignalingChange( - webrtc::PeerConnectionInterface::SignalingState new_state) {} - virtual void OnStateChange( - webrtc::PeerConnectionObserver::StateType state_changed) {} - virtual void OnAddStream(webrtc::MediaStreamInterface* stream); - virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) {} - virtual void OnDataChannel(webrtc::DataChannelInterface* data_channel); - virtual void OnRenegotiationNeeded() {} - virtual void OnIceConnectionChange( - webrtc::PeerConnectionInterface::IceConnectionState new_state) {} - virtual void OnIceGatheringChange( - webrtc::PeerConnectionInterface::IceGatheringState new_state) {} - virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate); - virtual void OnIceComplete() {} - - // Implements CreateSessionDescriptionObserver. - virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc); - virtual void OnFailure(const std::string& error) {} - - void CreateOffer(const webrtc::MediaConstraintsInterface* constraints); - void CreateAnswer(const webrtc::MediaConstraintsInterface* constraints); - void ReceiveOfferSdp(const std::string& sdp); - void ReceiveAnswerSdp(const std::string& sdp); - void AddIceCandidate(const std::string& sdp_mid, int sdp_mline_index, - const std::string& candidate); - void WaitForCallEstablished(); - void WaitForConnection(); - void WaitForAudio(); - void WaitForVideo(); - void GetAndAddUserMedia( - bool audio, const webrtc::FakeConstraints& audio_constraints, - bool video, const webrtc::FakeConstraints& video_constraints); - - // sigslots - sigslot::signal1 SignalOnIceCandidateCreated; - sigslot::signal3 SignalOnIceCandidateReady; - sigslot::signal1 SignalOnSdpCreated; - sigslot::signal1 SignalOnSdpReady; - sigslot::signal1 SignalOnDataChannel; - - private: - void SetLocalDescription(const std::string& type, const std::string& sdp); - void SetRemoteDescription(const std::string& type, const std::string& sdp); - bool CheckForConnection(); - bool CheckForAudio(); - bool CheckForVideo(); - rtc::scoped_refptr GetUserMedia( - bool audio, const webrtc::FakeConstraints& audio_constraints, - bool video, const webrtc::FakeConstraints& video_constraints); - - std::string name_; - rtc::scoped_refptr - allocator_factory_; - rtc::scoped_refptr peer_connection_; - rtc::scoped_refptr - peer_connection_factory_; - rtc::scoped_refptr fake_audio_capture_module_; - rtc::scoped_ptr renderer_; -}; - -#endif // TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_ diff --git a/include/talk/app/webrtc/test/testsdpstrings.h b/include/talk/app/webrtc/test/testsdpstrings.h deleted file mode 100644 index e27c9a2..0000000 --- a/include/talk/app/webrtc/test/testsdpstrings.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contain SDP strings used for testing. - -#ifndef TALK_APP_WEBRTC_TEST_TESTSDPSTRINGS_H_ -#define TALK_APP_WEBRTC_TEST_TESTSDPSTRINGS_H_ - -namespace webrtc { - -// SDP offer string from a Nightly FireFox build. -static const char kFireFoxSdpOffer[] = - "v=0\r\n" - "o=Mozilla-SIPUA 23551 0 IN IP4 0.0.0.0\r\n" - "s=SIP Call\r\n" - "t=0 0\r\n" - "a=ice-ufrag:e5785931\r\n" - "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" - "a=fingerprint:sha-256 A7:24:72:CA:6E:02:55:39:BA:66:DF:6E:CC:4C:D8:B0:1A:" - "BF:1A:56:65:7D:F4:03:AD:7E:77:43:2A:29:EC:93\r\n" - "m=audio 36993 RTP/SAVPF 109 0 8 101\r\n" - "c=IN IP4 74.95.2.170\r\n" - "a=rtpmap:109 opus/48000/2\r\n" - "a=ptime:20\r\n" - "a=rtpmap:0 PCMU/8000\r\n" - "a=rtpmap:8 PCMA/8000\r\n" - "a=rtpmap:101 telephone-event/8000\r\n" - "a=fmtp:101 0-15\r\n" - "a=sendrecv\r\n" - "a=candidate:0 1 UDP 2112946431 172.16.191.1 61725 typ host\r\n" - "a=candidate:2 1 UDP 2112487679 172.16.131.1 58798 typ host\r\n" - "a=candidate:4 1 UDP 2113667327 10.0.254.2 58122 typ host\r\n" - "a=candidate:5 1 UDP 1694302207 74.95.2.170 36993 typ srflx raddr " - "10.0.254.2 rport 58122\r\n" - "a=candidate:0 2 UDP 2112946430 172.16.191.1 55025 typ host\r\n" - "a=candidate:2 2 UDP 2112487678 172.16.131.1 63576 typ host\r\n" - "a=candidate:4 2 UDP 2113667326 10.0.254.2 50962 typ host\r\n" - "a=candidate:5 2 UDP 1694302206 74.95.2.170 41028 typ srflx raddr" - " 10.0.254.2 rport 50962\r\n" - "m=video 38826 RTP/SAVPF 120\r\n" - "c=IN IP4 74.95.2.170\r\n" - "a=rtpmap:120 VP8/90000\r\n" - "a=sendrecv\r\n" - "a=candidate:0 1 UDP 2112946431 172.16.191.1 62017 typ host\r\n" - "a=candidate:2 1 UDP 2112487679 172.16.131.1 59741 typ host\r\n" - "a=candidate:4 1 UDP 2113667327 10.0.254.2 62652 typ host\r\n" - "a=candidate:5 1 UDP 1694302207 74.95.2.170 38826 typ srflx raddr" - " 10.0.254.2 rport 62652\r\n" - "a=candidate:0 2 UDP 2112946430 172.16.191.1 63440 typ host\r\n" - "a=candidate:2 2 UDP 2112487678 172.16.131.1 51847 typ host\r\n" - "a=candidate:4 2 UDP 2113667326 10.0.254.2 58890 typ host\r\n" - "a=candidate:5 2 UDP 1694302206 74.95.2.170 33611 typ srflx raddr" - " 10.0.254.2 rport 58890\r\n" -#ifdef HAVE_SCTP - "m=application 45536 SCTP/DTLS 5000\r\n" - "c=IN IP4 74.95.2.170\r\n" - "a=fmtp:5000 protocol=webrtc-datachannel;streams=16\r\n" - "a=sendrecv\r\n" - "a=candidate:0 1 UDP 2112946431 172.16.191.1 60248 typ host\r\n" - "a=candidate:2 1 UDP 2112487679 172.16.131.1 55925 typ host\r\n" - "a=candidate:4 1 UDP 2113667327 10.0.254.2 65268 typ host\r\n" - "a=candidate:5 1 UDP 1694302207 74.95.2.170 45536 typ srflx raddr" - " 10.0.254.2 rport 65268\r\n" - "a=candidate:0 2 UDP 2112946430 172.16.191.1 49162 typ host\r\n" - "a=candidate:2 2 UDP 2112487678 172.16.131.1 59635 typ host\r\n" - "a=candidate:4 2 UDP 2113667326 10.0.254.2 61232 typ host\r\n" - "a=candidate:5 2 UDP 1694302206 74.95.2.170 45468 typ srflx raddr" - " 10.0.254.2 rport 61232\r\n" -#endif - ; - -// Audio SDP with a limited set of audio codecs. -static const char kAudioSdp[] = - "v=0\r\n" - "o=- 7859371131 2 IN IP4 192.168.30.208\r\n" - "s=-\r\n" - "c=IN IP4 192.168.30.208\r\n" - "t=0 0\r\n" - "m=audio 16000 RTP/SAVPF 0 8 126\r\n" - "a=rtpmap:0 PCMU/8000\r\n" - "a=rtpmap:8 PCMA/8000\r\n" - "a=rtpmap:126 telephone-event/8000\r\n" - "a=sendrecv\r\n" - "a=rtcp:16000 IN IP4 192.168.30.208\r\n" - "a=rtcp-mux\r\n" - "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " - "inline:tvKIFjbMQ7W0/C2RzhwN0oQglj/7GJg+frdsNRxt\r\n" - "a=ice-ufrag:AI2sRT3r\r\n" - "a=ice-pwd:lByS9z2RSQlSE9XurlvjYmEm\r\n" - "a=ssrc:4227871655 cname:GeAAgb6XCPNLVMX5\r\n" - "a=ssrc:4227871655 msid:1NFAV3iD08ioO2339rQS9pfOI9mDf6GeG9F4 a0\r\n" - "a=ssrc:4227871655 mslabel:1NFAV3iD08ioO2339rQS9pfOI9mDf6GeG9F4\r\n" - "a=ssrc:4227871655 label:1NFAV3iD08ioO2339rQS9pfOI9mDf6GeG9F4a0\r\n" - "a=mid:audio\r\n"; - -static const char kAudioSdpWithUnsupportedCodecs[] = - "v=0\r\n" - "o=- 6858750541 2 IN IP4 192.168.30.208\r\n" - "s=-\r\n" - "c=IN IP4 192.168.30.208\r\n" - "t=0 0\r\n" - "m=audio 16000 RTP/SAVPF 0 8 18 110 126\r\n" - "a=rtpmap:0 PCMU/8000\r\n" - "a=rtpmap:8 PCMA/8000\r\n" - "a=rtpmap:18 WeirdCodec1/8000\r\n" - "a=rtpmap:110 WeirdCodec2/8000\r\n" - "a=rtpmap:126 telephone-event/8000\r\n" - "a=sendonly\r\n" - "a=rtcp:16000 IN IP4 192.168.30.208\r\n" - "a=rtcp-mux\r\n" - "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " - "inline:tvKIFjbMQ7W0/C2RzhwN0oQglj/7GJg+frdsNRxt\r\n" - "a=ice-ufrag:AI2sRT3r\r\n" - "a=ice-pwd:lByS9z2RSQlSE9XurlvjYmEm\r\n" - "a=ssrc:4227871655 cname:TsmD02HRfhkJBm4m\r\n" - "a=ssrc:4227871655 msid:7nU0TApbB-n4dfPlCplWT9QTEsbBDS1IlpW3 a0\r\n" - "a=ssrc:4227871655 mslabel:7nU0TApbB-n4dfPlCplWT9QTEsbBDS1IlpW3\r\n" - "a=ssrc:4227871655 label:7nU0TApbB-n4dfPlCplWT9QTEsbBDS1IlpW3a0\r\n" - "a=mid:audio\r\n"; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_TEST_TESTSDPSTRINGS_H_ diff --git a/include/talk/app/webrtc/umametrics.h b/include/talk/app/webrtc/umametrics.h deleted file mode 100644 index 14fac96..0000000 --- a/include/talk/app/webrtc/umametrics.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains enums related to IPv4/IPv6 metrics. - -#ifndef TALK_APP_WEBRTC_UMAMETRICS_H_ -#define TALK_APP_WEBRTC_UMAMETRICS_H_ - -namespace webrtc { - -// Used to specify which enum counter type we're incrementing in -// MetricsObserverInterface::IncrementEnumCounter. -enum PeerConnectionEnumCounterType { - kEnumCounterAddressFamily, - // For the next 2 counters, we track them separately based on the "first hop" - // protocol used by the local candidate. "First hop" means the local candidate - // type in the case of non-TURN candidates, and the protocol used to connect - // to the TURN server in the case of TURN candidates. - kEnumCounterIceCandidatePairTypeUdp, - kEnumCounterIceCandidatePairTypeTcp, - - kEnumCounterAudioSrtpCipher, - kEnumCounterAudioSslCipher, - kEnumCounterVideoSrtpCipher, - kEnumCounterVideoSslCipher, - kEnumCounterDataSrtpCipher, - kEnumCounterDataSslCipher, - kPeerConnectionEnumCounterMax -}; - -// Currently this contains information related to WebRTC network/transport -// information. - -// The difference between PeerConnectionEnumCounter and -// PeerConnectionMetricsName is that the "EnumCounter" is only counting the -// occurrences of events, while "Name" has a value associated with it which is -// used to form a histogram. - -// This enum is backed by Chromium's histograms.xml, -// chromium/src/tools/metrics/histograms/histograms.xml -// Existing values cannot be re-ordered and new enums must be added -// before kBoundary. -enum PeerConnectionAddressFamilyCounter { - kPeerConnection_IPv4, - kPeerConnection_IPv6, - kBestConnections_IPv4, - kBestConnections_IPv6, - kPeerConnectionAddressFamilyCounter_Max, -}; - -// TODO(guoweis): Keep previous name here until all references are renamed. -#define kBoundary kPeerConnectionAddressFamilyCounter_Max - -// TODO(guoweis): Keep previous name here until all references are renamed. -typedef PeerConnectionAddressFamilyCounter PeerConnectionUMAMetricsCounter; - -// This enum defines types for UMA samples, which will have a range. -enum PeerConnectionMetricsName { - kNetworkInterfaces_IPv4, // Number of IPv4 interfaces. - kNetworkInterfaces_IPv6, // Number of IPv6 interfaces. - kTimeToConnect, // In milliseconds. - kLocalCandidates_IPv4, // Number of IPv4 local candidates. - kLocalCandidates_IPv6, // Number of IPv6 local candidates. - kPeerConnectionMetricsName_Max -}; - -// TODO(guoweis): Keep previous name here until all references are renamed. -typedef PeerConnectionMetricsName PeerConnectionUMAMetricsName; - -// The IceCandidatePairType has the format of -// _. It is recorded based on the -// type of candidate pair used when the PeerConnection first goes to a completed -// state. When BUNDLE is enabled, only the first transport gets recorded. -enum IceCandidatePairType { - // HostHost is deprecated. It was replaced with the set of types at the bottom - // to report private or public host IP address. - kIceCandidatePairHostHost, - kIceCandidatePairHostSrflx, - kIceCandidatePairHostRelay, - kIceCandidatePairHostPrflx, - kIceCandidatePairSrflxHost, - kIceCandidatePairSrflxSrflx, - kIceCandidatePairSrflxRelay, - kIceCandidatePairSrflxPrflx, - kIceCandidatePairRelayHost, - kIceCandidatePairRelaySrflx, - kIceCandidatePairRelayRelay, - kIceCandidatePairRelayPrflx, - kIceCandidatePairPrflxHost, - kIceCandidatePairPrflxSrflx, - kIceCandidatePairPrflxRelay, - - // The following 4 types tell whether local and remote hosts have private or - // public IP addresses. - kIceCandidatePairHostPrivateHostPrivate, - kIceCandidatePairHostPrivateHostPublic, - kIceCandidatePairHostPublicHostPrivate, - kIceCandidatePairHostPublicHostPublic, - kIceCandidatePairMax -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_UMAMETRICS_H_ diff --git a/include/talk/app/webrtc/videosource.h b/include/talk/app/webrtc/videosource.h deleted file mode 100644 index 98c1e08..0000000 --- a/include/talk/app/webrtc/videosource.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_VIDEOSOURCE_H_ -#define TALK_APP_WEBRTC_VIDEOSOURCE_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/app/webrtc/notifier.h" -#include "talk/app/webrtc/videosourceinterface.h" -#include "talk/app/webrtc/videotrackrenderers.h" -#include "talk/media/base/videocapturer.h" -#include "talk/media/base/videocommon.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" - -// VideoSource implements VideoSourceInterface. It owns a -// cricket::VideoCapturer and make sure the camera is started at a resolution -// that honors the constraints. -// The state is set depending on the result of starting the capturer. -// If the constraint can't be met or the capturer fails to start, the state -// transition to kEnded, otherwise it transitions to kLive. - -namespace cricket { - -class ChannelManager; - -} // namespace cricket - -namespace webrtc { - -class MediaConstraintsInterface; - -class VideoSource : public Notifier, - public sigslot::has_slots<> { - public: - // Creates an instance of VideoSource. - // VideoSource take ownership of |capturer|. - // |constraints| can be NULL and in that case the camera is opened using a - // default resolution. - static rtc::scoped_refptr Create( - cricket::ChannelManager* channel_manager, - cricket::VideoCapturer* capturer, - const webrtc::MediaConstraintsInterface* constraints, - bool remote); - - SourceState state() const override { return state_; } - bool remote() const override { return remote_; } - - virtual const cricket::VideoOptions* options() const { return &options_; } - virtual cricket::VideoRenderer* FrameInput(); - - virtual cricket::VideoCapturer* GetVideoCapturer() { - return video_capturer_.get(); - } - - void Stop() override; - void Restart() override; - - // |output| will be served video frames as long as the underlying capturer - // is running video frames. - virtual void AddSink(cricket::VideoRenderer* output); - virtual void RemoveSink(cricket::VideoRenderer* output); - - protected: - VideoSource(cricket::ChannelManager* channel_manager, - cricket::VideoCapturer* capturer, - bool remote); - virtual ~VideoSource(); - void Initialize(const webrtc::MediaConstraintsInterface* constraints); - - private: - void OnStateChange(cricket::VideoCapturer* capturer, - cricket::CaptureState capture_state); - void SetState(SourceState new_state); - - cricket::ChannelManager* channel_manager_; - rtc::scoped_ptr video_capturer_; - rtc::scoped_ptr frame_input_; - - std::list sinks_; - - cricket::VideoFormat format_; - cricket::VideoOptions options_; - SourceState state_; - const bool remote_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_VIDEOSOURCE_H_ diff --git a/include/talk/app/webrtc/videosourceinterface.h b/include/talk/app/webrtc/videosourceinterface.h deleted file mode 100644 index a90e3d5..0000000 --- a/include/talk/app/webrtc/videosourceinterface.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_VIDEOSOURCEINTERFACE_H_ -#define TALK_APP_WEBRTC_VIDEOSOURCEINTERFACE_H_ - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/media/base/mediachannel.h" - -namespace webrtc { - -// VideoSourceInterface is a reference counted source used for VideoTracks. -// The same source can be used in multiple VideoTracks. -// The methods are only supposed to be called by the PeerConnection -// implementation. -class VideoSourceInterface : public MediaSourceInterface { - public: - // Get access to the source implementation of cricket::VideoCapturer. - // This can be used for receiving frames and state notifications. - // But it should not be used for starting or stopping capturing. - virtual cricket::VideoCapturer* GetVideoCapturer() = 0; - - // Stop the video capturer. - virtual void Stop() = 0; - virtual void Restart() = 0; - - // Adds |output| to the source to receive frames. - virtual void AddSink(cricket::VideoRenderer* output) = 0; - virtual void RemoveSink(cricket::VideoRenderer* output) = 0; - virtual const cricket::VideoOptions* options() const = 0; - virtual cricket::VideoRenderer* FrameInput() = 0; - - protected: - virtual ~VideoSourceInterface() {} -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_VIDEOSOURCEINTERFACE_H_ diff --git a/include/talk/app/webrtc/videosourceproxy.h b/include/talk/app/webrtc/videosourceproxy.h deleted file mode 100644 index ce96e8e..0000000 --- a/include/talk/app/webrtc/videosourceproxy.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_VIDEOSOURCEPROXY_H_ -#define TALK_APP_WEBRTC_VIDEOSOURCEPROXY_H_ - -#include "talk/app/webrtc/proxy.h" -#include "talk/app/webrtc/videosourceinterface.h" - -namespace webrtc { - -// VideoSourceProxy makes sure the real VideoSourceInterface implementation is -// destroyed on the signaling thread and marshals all method calls to the -// signaling thread. -BEGIN_PROXY_MAP(VideoSource) - PROXY_CONSTMETHOD0(SourceState, state) - PROXY_CONSTMETHOD0(bool, remote) - PROXY_METHOD0(cricket::VideoCapturer*, GetVideoCapturer) - PROXY_METHOD0(void, Stop) - PROXY_METHOD0(void, Restart) - PROXY_METHOD1(void, AddSink, cricket::VideoRenderer*) - PROXY_METHOD1(void, RemoveSink, cricket::VideoRenderer*) - PROXY_CONSTMETHOD0(const cricket::VideoOptions*, options) - PROXY_METHOD0(cricket::VideoRenderer*, FrameInput) - PROXY_METHOD1(void, RegisterObserver, ObserverInterface*) - PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*) -END_PROXY() - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_VIDEOSOURCEPROXY_H_ diff --git a/include/talk/app/webrtc/videotrack.h b/include/talk/app/webrtc/videotrack.h deleted file mode 100644 index 67a2163..0000000 --- a/include/talk/app/webrtc/videotrack.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_VIDEOTRACK_H_ -#define TALK_APP_WEBRTC_VIDEOTRACK_H_ - -#include - -#include "talk/app/webrtc/mediastreamtrack.h" -#include "talk/app/webrtc/videosourceinterface.h" -#include "talk/app/webrtc/videotrackrenderers.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace webrtc { - -class VideoTrack : public MediaStreamTrack { - public: - static rtc::scoped_refptr Create( - const std::string& label, VideoSourceInterface* source); - - virtual void AddRenderer(VideoRendererInterface* renderer); - virtual void RemoveRenderer(VideoRendererInterface* renderer); - virtual VideoSourceInterface* GetSource() const { - return video_source_.get(); - } - virtual bool set_enabled(bool enable); - virtual std::string kind() const; - - protected: - VideoTrack(const std::string& id, VideoSourceInterface* video_source); - ~VideoTrack(); - - private: - VideoTrackRenderers renderers_; - rtc::scoped_refptr video_source_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_VIDEOTRACK_H_ diff --git a/include/talk/app/webrtc/videotrackrenderers.h b/include/talk/app/webrtc/videotrackrenderers.h deleted file mode 100644 index 15274a1..0000000 --- a/include/talk/app/webrtc/videotrackrenderers.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_VIDEOTRACKRENDERERS_H_ -#define TALK_APP_WEBRTC_VIDEOTRACKRENDERERS_H_ - -#include - -#include "talk/app/webrtc/mediastreaminterface.h" -#include "talk/media/base/videorenderer.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" - -namespace webrtc { - -// Class used for rendering cricket::VideoFrames to multiple renderers of type -// VideoRendererInterface. -// Each VideoTrack owns a VideoTrackRenderers instance. -// The class is thread safe. Rendering to the added VideoRendererInterfaces is -// done on the same thread as the cricket::VideoRenderer. -class VideoTrackRenderers : public cricket::VideoRenderer { - public: - VideoTrackRenderers(); - ~VideoTrackRenderers(); - - // Implements cricket::VideoRenderer - virtual bool SetSize(int width, int height, int reserved); - virtual bool RenderFrame(const cricket::VideoFrame* frame); - - void AddRenderer(VideoRendererInterface* renderer); - void RemoveRenderer(VideoRendererInterface* renderer); - void SetEnabled(bool enable); - - private: - bool enabled_; - std::set renderers_; - - rtc::CriticalSection critical_section_; // Protects the above variables -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_VIDEOTRACKRENDERERS_H_ diff --git a/include/talk/app/webrtc/webrtcsdp.h b/include/talk/app/webrtc/webrtcsdp.h deleted file mode 100644 index fcbbdad..0000000 --- a/include/talk/app/webrtc/webrtcsdp.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contain functions for parsing and serializing SDP messages. -// Related RFC/draft including: -// * RFC 4566 - SDP -// * RFC 5245 - ICE -// * RFC 3388 - Grouping of Media Lines in SDP -// * RFC 4568 - SDP Security Descriptions for Media Streams -// * draft-lennox-mmusic-sdp-source-selection-02 - -// Mechanisms for Media Source Selection in SDP - -#ifndef TALK_APP_WEBRTC_WEBRTCSDP_H_ -#define TALK_APP_WEBRTC_WEBRTCSDP_H_ - -#include - -namespace webrtc { - -class IceCandidateInterface; -class JsepIceCandidate; -class JsepSessionDescription; -struct SdpParseError; - -// Serializes the passed in JsepSessionDescription. -// Serialize SessionDescription including candidates if -// JsepSessionDescription has candidates. -// jdesc - The JsepSessionDescription object to be serialized. -// return - SDP string serialized from the arguments. -std::string SdpSerialize(const JsepSessionDescription& jdesc); - -// Serializes the passed in IceCandidateInterface to a SDP string. -// candidate - The candidate to be serialized. -std::string SdpSerializeCandidate(const IceCandidateInterface& candidate); - -// Deserializes the passed in SDP string to a JsepSessionDescription. -// message - SDP string to be Deserialized. -// jdesc - The JsepSessionDescription deserialized from the SDP string. -// error - The detail error information when parsing fails. -// return - true on success, false on failure. -bool SdpDeserialize(const std::string& message, - JsepSessionDescription* jdesc, - SdpParseError* error); - -// Deserializes the passed in SDP string to one JsepIceCandidate. -// The first line must be a=candidate line and only the first line will be -// parsed. -// message - The SDP string to be Deserialized. -// candidates - The JsepIceCandidate from the SDP string. -// error - The detail error information when parsing fails. -// return - true on success, false on failure. -bool SdpDeserializeCandidate(const std::string& message, - JsepIceCandidate* candidate, - SdpParseError* error); -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_WEBRTCSDP_H_ diff --git a/include/talk/app/webrtc/webrtcsession.h b/include/talk/app/webrtc/webrtcsession.h deleted file mode 100644 index dd5ca18..0000000 --- a/include/talk/app/webrtc/webrtcsession.h +++ /dev/null @@ -1,519 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_ -#define TALK_APP_WEBRTC_WEBRTCSESSION_H_ - -#include -#include - -#include "talk/app/webrtc/datachannel.h" -#include "talk/app/webrtc/dtmfsender.h" -#include "talk/app/webrtc/mediacontroller.h" -#include "talk/app/webrtc/mediastreamprovider.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/app/webrtc/statstypes.h" -#include "talk/media/base/mediachannel.h" -#include "talk/session/media/mediasession.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/sslidentity.h" -#include "webrtc/base/thread.h" -#include "webrtc/p2p/base/transportcontroller.h" - -namespace cricket { - -class ChannelManager; -class DataChannel; -class StatsReport; -class VideoCapturer; -class VideoChannel; -class VoiceChannel; - -} // namespace cricket - -namespace webrtc { - -class IceRestartAnswerLatch; -class JsepIceCandidate; -class MediaStreamSignaling; -class WebRtcSessionDescriptionFactory; - -extern const char kBundleWithoutRtcpMux[]; -extern const char kCreateChannelFailed[]; -extern const char kInvalidCandidates[]; -extern const char kInvalidSdp[]; -extern const char kMlineMismatch[]; -extern const char kPushDownTDFailed[]; -extern const char kSdpWithoutDtlsFingerprint[]; -extern const char kSdpWithoutSdesCrypto[]; -extern const char kSdpWithoutIceUfragPwd[]; -extern const char kSdpWithoutSdesAndDtlsDisabled[]; -extern const char kSessionError[]; -extern const char kSessionErrorDesc[]; -extern const char kDtlsSetupFailureRtp[]; -extern const char kDtlsSetupFailureRtcp[]; -extern const char kEnableBundleFailed[]; - -// Maximum number of received video streams that will be processed by webrtc -// even if they are not signalled beforehand. -extern const int kMaxUnsignalledRecvStreams; - -// ICE state callback interface. -class IceObserver { - public: - IceObserver() {} - // Called any time the IceConnectionState changes - // TODO(honghaiz): Change the name to OnIceConnectionStateChange so as to - // conform to the w3c standard. - virtual void OnIceConnectionChange( - PeerConnectionInterface::IceConnectionState new_state) {} - // Called any time the IceGatheringState changes - virtual void OnIceGatheringChange( - PeerConnectionInterface::IceGatheringState new_state) {} - // New Ice candidate have been found. - virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; - // All Ice candidates have been found. - // TODO(bemasc): Remove this once callers transition to OnIceGatheringChange. - // (via PeerConnectionObserver) - virtual void OnIceComplete() {} - - // Called whenever the state changes between receiving and not receiving. - virtual void OnIceConnectionReceivingChange(bool receiving) {} - - protected: - ~IceObserver() {} - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(IceObserver); -}; - -// Statistics for all the transports of the session. -typedef std::map TransportStatsMap; -typedef std::map ProxyTransportMap; - -// TODO(pthatcher): Think of a better name for this. We already have -// a TransportStats in transport.h. Perhaps TransportsStats? -struct SessionStats { - ProxyTransportMap proxy_to_transport; - TransportStatsMap transport_stats; -}; - -// A WebRtcSession manages general session state. This includes negotiation -// of both the application-level and network-level protocols: the former -// defines what will be sent and the latter defines how it will be sent. Each -// network-level protocol is represented by a Transport object. Each Transport -// participates in the network-level negotiation. The individual streams of -// packets are represented by TransportChannels. The application-level protocol -// is represented by SessionDecription objects. -class WebRtcSession : public AudioProviderInterface, - public VideoProviderInterface, - public DtmfProviderInterface, - public DataChannelProviderInterface, - public sigslot::has_slots<> { - public: - enum State { - STATE_INIT = 0, - STATE_SENTOFFER, // Sent offer, waiting for answer. - STATE_RECEIVEDOFFER, // Received an offer. Need to send answer. - STATE_SENTPRANSWER, // Sent provisional answer. Need to send answer. - STATE_RECEIVEDPRANSWER, // Received provisional answer, waiting for answer. - STATE_INPROGRESS, // Offer/answer exchange completed. - STATE_CLOSED, // Close() was called. - }; - - enum Error { - ERROR_NONE = 0, // no error - ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent - ERROR_TRANSPORT = 2, // transport error of some kind - }; - - WebRtcSession(webrtc::MediaControllerInterface* media_controller, - rtc::Thread* signaling_thread, - rtc::Thread* worker_thread, - cricket::PortAllocator* port_allocator); - virtual ~WebRtcSession(); - - // These are const to allow them to be called from const methods. - rtc::Thread* signaling_thread() const { return signaling_thread_; } - rtc::Thread* worker_thread() const { return worker_thread_; } - cricket::PortAllocator* port_allocator() const { return port_allocator_; } - - // The ID of this session. - const std::string& id() const { return sid_; } - - bool Initialize( - const PeerConnectionFactoryInterface::Options& options, - const MediaConstraintsInterface* constraints, - rtc::scoped_ptr dtls_identity_store, - const PeerConnectionInterface::RTCConfiguration& rtc_configuration); - // Deletes the voice, video and data channel and changes the session state - // to STATE_CLOSED. - void Close(); - - // Returns true if we were the initial offerer. - bool initial_offerer() const { return initial_offerer_; } - - // Returns the current state of the session. See the enum above for details. - // Each time the state changes, we will fire this signal. - State state() const { return state_; } - sigslot::signal2 SignalState; - - // Returns the last error in the session. See the enum above for details. - Error error() const { return error_; } - const std::string& error_desc() const { return error_desc_; } - - void RegisterIceObserver(IceObserver* observer) { - ice_observer_ = observer; - } - - virtual cricket::VoiceChannel* voice_channel() { - return voice_channel_.get(); - } - virtual cricket::VideoChannel* video_channel() { - return video_channel_.get(); - } - virtual cricket::DataChannel* data_channel() { - return data_channel_.get(); - } - - void SetSdesPolicy(cricket::SecurePolicy secure_policy); - cricket::SecurePolicy SdesPolicy() const; - - // Get current ssl role from transport. - bool GetSslRole(rtc::SSLRole* role); - - void CreateOffer( - CreateSessionDescriptionObserver* observer, - const PeerConnectionInterface::RTCOfferAnswerOptions& options, - const cricket::MediaSessionOptions& session_options); - void CreateAnswer(CreateSessionDescriptionObserver* observer, - const MediaConstraintsInterface* constraints, - const cricket::MediaSessionOptions& session_options); - // The ownership of |desc| will be transferred after this call. - bool SetLocalDescription(SessionDescriptionInterface* desc, - std::string* err_desc); - // The ownership of |desc| will be transferred after this call. - bool SetRemoteDescription(SessionDescriptionInterface* desc, - std::string* err_desc); - bool ProcessIceMessage(const IceCandidateInterface* ice_candidate); - - bool SetIceTransports(PeerConnectionInterface::IceTransportsType type); - - cricket::IceConfig ParseIceConfig( - const PeerConnectionInterface::RTCConfiguration& config) const; - - void SetIceConfig(const cricket::IceConfig& ice_config); - - // Start gathering candidates for any new transports, or transports doing an - // ICE restart. - void MaybeStartGathering(); - - const SessionDescriptionInterface* local_description() const { - return local_desc_.get(); - } - const SessionDescriptionInterface* remote_description() const { - return remote_desc_.get(); - } - - // Get the id used as a media stream track's "id" field from ssrc. - virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); - virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); - - // AudioMediaProviderInterface implementation. - void SetAudioPlayout(uint32_t ssrc, bool enable) override; - void SetAudioSend(uint32_t ssrc, - bool enable, - const cricket::AudioOptions& options, - cricket::AudioRenderer* renderer) override; - void SetAudioPlayoutVolume(uint32_t ssrc, double volume) override; - void SetRawAudioSink(uint32_t ssrc, - rtc::scoped_ptr sink) override; - - // Implements VideoMediaProviderInterface. - bool SetCaptureDevice(uint32_t ssrc, cricket::VideoCapturer* camera) override; - void SetVideoPlayout(uint32_t ssrc, - bool enable, - cricket::VideoRenderer* renderer) override; - void SetVideoSend(uint32_t ssrc, - bool enable, - const cricket::VideoOptions* options) override; - - // Implements DtmfProviderInterface. - virtual bool CanInsertDtmf(const std::string& track_id); - virtual bool InsertDtmf(const std::string& track_id, - int code, int duration); - virtual sigslot::signal0<>* GetOnDestroyedSignal(); - - // Implements DataChannelProviderInterface. - bool SendData(const cricket::SendDataParams& params, - const rtc::Buffer& payload, - cricket::SendDataResult* result) override; - bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; - void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; - void AddSctpDataStream(int sid) override; - void RemoveSctpDataStream(int sid) override; - bool ReadyToSendData() const override; - - // Returns stats for all channels of all transports. - // This avoids exposing the internal structures used to track them. - virtual bool GetTransportStats(SessionStats* stats); - - // Get stats for a specific channel - bool GetChannelTransportStats(cricket::BaseChannel* ch, SessionStats* stats); - - // virtual so it can be mocked in unit tests - virtual bool GetLocalCertificate( - const std::string& transport_name, - rtc::scoped_refptr* certificate); - - // Caller owns returned certificate - virtual bool GetRemoteSSLCertificate(const std::string& transport_name, - rtc::SSLCertificate** cert); - - cricket::DataChannelType data_channel_type() const; - - bool IceRestartPending() const; - - void ResetIceRestartLatch(); - - // Called when an RTCCertificate is generated or retrieved by - // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. - void OnCertificateReady( - const rtc::scoped_refptr& certificate); - void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); - - // For unit test. - bool waiting_for_certificate_for_testing() const; - const rtc::scoped_refptr& certificate_for_testing(); - - void set_metrics_observer( - webrtc::MetricsObserverInterface* metrics_observer) { - metrics_observer_ = metrics_observer; - } - - // Called when voice_channel_, video_channel_ and data_channel_ are created - // and destroyed. As a result of, for example, setting a new description. - sigslot::signal0<> SignalVoiceChannelCreated; - sigslot::signal0<> SignalVoiceChannelDestroyed; - sigslot::signal0<> SignalVideoChannelCreated; - sigslot::signal0<> SignalVideoChannelDestroyed; - sigslot::signal0<> SignalDataChannelCreated; - sigslot::signal0<> SignalDataChannelDestroyed; - - // Called when a valid data channel OPEN message is received. - // std::string represents the data channel label. - sigslot::signal2 - SignalDataChannelOpenMessage; - - private: - // Indicates the type of SessionDescription in a call to SetLocalDescription - // and SetRemoteDescription. - enum Action { - kOffer, - kPrAnswer, - kAnswer, - }; - - // Log session state. - void LogState(State old_state, State new_state); - - // Updates the state, signaling if necessary. - virtual void SetState(State state); - - // Updates the error state, signaling if necessary. - // TODO(ronghuawu): remove the SetError method that doesn't take |error_desc|. - virtual void SetError(Error error, const std::string& error_desc); - - bool UpdateSessionState(Action action, cricket::ContentSource source, - std::string* err_desc); - static Action GetAction(const std::string& type); - // Push the media parts of the local or remote session description - // down to all of the channels. - bool PushdownMediaDescription(cricket::ContentAction action, - cricket::ContentSource source, - std::string* error_desc); - - bool PushdownTransportDescription(cricket::ContentSource source, - cricket::ContentAction action, - std::string* error_desc); - - // Helper methods to push local and remote transport descriptions. - bool PushdownLocalTransportDescription( - const cricket::SessionDescription* sdesc, - cricket::ContentAction action, - std::string* error_desc); - bool PushdownRemoteTransportDescription( - const cricket::SessionDescription* sdesc, - cricket::ContentAction action, - std::string* error_desc); - - // Returns true and the TransportInfo of the given |content_name| - // from |description|. Returns false if it's not available. - static bool GetTransportDescription( - const cricket::SessionDescription* description, - const std::string& content_name, - cricket::TransportDescription* info); - - cricket::BaseChannel* GetChannel(const std::string& content_name); - // Cause all the BaseChannels in the bundle group to have the same - // transport channel. - bool EnableBundle(const cricket::ContentGroup& bundle); - - // Enables media channels to allow sending of media. - void EnableChannels(); - // Returns the media index for a local ice candidate given the content name. - // Returns false if the local session description does not have a media - // content called |content_name|. - bool GetLocalCandidateMediaIndex(const std::string& content_name, - int* sdp_mline_index); - // Uses all remote candidates in |remote_desc| in this session. - bool UseCandidatesInSessionDescription( - const SessionDescriptionInterface* remote_desc); - // Uses |candidate| in this session. - bool UseCandidate(const IceCandidateInterface* candidate); - // Deletes the corresponding channel of contents that don't exist in |desc|. - // |desc| can be null. This means that all channels are deleted. - void RemoveUnusedChannels(const cricket::SessionDescription* desc); - - // Allocates media channels based on the |desc|. If |desc| doesn't have - // the BUNDLE option, this method will disable BUNDLE in PortAllocator. - // This method will also delete any existing media channels before creating. - bool CreateChannels(const cricket::SessionDescription* desc); - - // Helper methods to create media channels. - bool CreateVoiceChannel(const cricket::ContentInfo* content); - bool CreateVideoChannel(const cricket::ContentInfo* content); - bool CreateDataChannel(const cricket::ContentInfo* content); - - // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN - // messages. - void OnDataChannelMessageReceived(cricket::DataChannel* channel, - const cricket::ReceiveDataParams& params, - const rtc::Buffer& payload); - - std::string BadStateErrMsg(State state); - void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); - void SetIceConnectionReceiving(bool receiving); - - bool ValidateBundleSettings(const cricket::SessionDescription* desc); - bool HasRtcpMuxEnabled(const cricket::ContentInfo* content); - // Below methods are helper methods which verifies SDP. - bool ValidateSessionDescription(const SessionDescriptionInterface* sdesc, - cricket::ContentSource source, - std::string* err_desc); - - // Check if a call to SetLocalDescription is acceptable with |action|. - bool ExpectSetLocalDescription(Action action); - // Check if a call to SetRemoteDescription is acceptable with |action|. - bool ExpectSetRemoteDescription(Action action); - // Verifies a=setup attribute as per RFC 5763. - bool ValidateDtlsSetupAttribute(const cricket::SessionDescription* desc, - Action action); - - // Returns true if we are ready to push down the remote candidate. - // |remote_desc| is the new remote description, or NULL if the current remote - // description should be used. Output |valid| is true if the candidate media - // index is valid. - bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate, - const SessionDescriptionInterface* remote_desc, - bool* valid); - - void OnTransportControllerConnectionState(cricket::IceConnectionState state); - void OnTransportControllerReceiving(bool receiving); - void OnTransportControllerGatheringState(cricket::IceGatheringState state); - void OnTransportControllerCandidatesGathered( - const std::string& transport_name, - const cricket::Candidates& candidates); - - std::string GetSessionErrorMsg(); - - // Invoked when TransportController connection completion is signaled. - // Reports stats for all transports in use. - void ReportTransportStats(); - - // Gather the usage of IPv4/IPv6 as best connection. - void ReportBestConnectionState(const cricket::TransportStats& stats); - - void ReportNegotiatedCiphers(const cricket::TransportStats& stats); - - void OnSentPacket_w(cricket::TransportChannel* channel, - const rtc::SentPacket& sent_packet); - - rtc::Thread* const signaling_thread_; - rtc::Thread* const worker_thread_; - cricket::PortAllocator* const port_allocator_; - - State state_ = STATE_INIT; - Error error_ = ERROR_NONE; - std::string error_desc_; - - const std::string sid_; - bool initial_offerer_ = false; - - rtc::scoped_ptr transport_controller_; - MediaControllerInterface* media_controller_; - rtc::scoped_ptr voice_channel_; - rtc::scoped_ptr video_channel_; - rtc::scoped_ptr data_channel_; - cricket::ChannelManager* channel_manager_; - IceObserver* ice_observer_; - PeerConnectionInterface::IceConnectionState ice_connection_state_; - bool ice_connection_receiving_; - rtc::scoped_ptr local_desc_; - rtc::scoped_ptr remote_desc_; - // If the remote peer is using a older version of implementation. - bool older_version_remote_peer_; - bool dtls_enabled_; - // Specifies which kind of data channel is allowed. This is controlled - // by the chrome command-line flag and constraints: - // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, - // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is - // not set or false, SCTP is allowed (DCT_SCTP); - // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); - // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). - cricket::DataChannelType data_channel_type_; - rtc::scoped_ptr ice_restart_latch_; - - rtc::scoped_ptr - webrtc_session_desc_factory_; - - // Member variables for caching global options. - cricket::AudioOptions audio_options_; - cricket::VideoOptions video_options_; - MetricsObserverInterface* metrics_observer_; - - // Declares the bundle policy for the WebRTCSession. - PeerConnectionInterface::BundlePolicy bundle_policy_; - - // Declares the RTCP mux policy for the WebRTCSession. - PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; - - RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); -}; -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ diff --git a/include/talk/app/webrtc/webrtcsessiondescriptionfactory.h b/include/talk/app/webrtc/webrtcsessiondescriptionfactory.h deleted file mode 100644 index 91adc66..0000000 --- a/include/talk/app/webrtc/webrtcsessiondescriptionfactory.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ -#define TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ - -#include "talk/app/webrtc/dtlsidentitystore.h" -#include "talk/app/webrtc/peerconnectioninterface.h" -#include "talk/session/media/mediasession.h" -#include "webrtc/p2p/base/transportdescriptionfactory.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/rtccertificate.h" - -namespace cricket { -class ChannelManager; -class TransportDescriptionFactory; -} // namespace cricket - -namespace webrtc { -class CreateSessionDescriptionObserver; -class MediaConstraintsInterface; -class SessionDescriptionInterface; -class WebRtcSession; - -// DTLS identity request callback class. -class WebRtcIdentityRequestObserver : public DtlsIdentityRequestObserver, - public sigslot::has_slots<> { - public: - // DtlsIdentityRequestObserver overrides. - void OnFailure(int error) override; - void OnSuccess(const std::string& der_cert, - const std::string& der_private_key) override; - void OnSuccess(rtc::scoped_ptr identity) override; - - sigslot::signal1 SignalRequestFailed; - sigslot::signal1&> - SignalCertificateReady; -}; - -struct CreateSessionDescriptionRequest { - enum Type { - kOffer, - kAnswer, - }; - - CreateSessionDescriptionRequest( - Type type, - CreateSessionDescriptionObserver* observer, - const cricket::MediaSessionOptions& options) - : type(type), - observer(observer), - options(options) {} - - Type type; - rtc::scoped_refptr observer; - cricket::MediaSessionOptions options; -}; - -// This class is used to create offer/answer session description with regards to -// the async DTLS identity generation for WebRtcSession. -// It queues the create offer/answer request until the DTLS identity -// request has completed, i.e. when OnIdentityRequestFailed or OnIdentityReady -// is called. -class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - // Construct with DTLS disabled. - WebRtcSessionDescriptionFactory(rtc::Thread* signaling_thread, - cricket::ChannelManager* channel_manager, - WebRtcSession* session, - const std::string& session_id); - - // Construct with DTLS enabled using the specified |dtls_identity_store| to - // generate a certificate. - WebRtcSessionDescriptionFactory( - rtc::Thread* signaling_thread, - cricket::ChannelManager* channel_manager, - rtc::scoped_ptr dtls_identity_store, - WebRtcSession* session, - const std::string& session_id); - - // Construct with DTLS enabled using the specified (already generated) - // |certificate|. - WebRtcSessionDescriptionFactory( - rtc::Thread* signaling_thread, - cricket::ChannelManager* channel_manager, - const rtc::scoped_refptr& certificate, - WebRtcSession* session, - const std::string& session_id); - virtual ~WebRtcSessionDescriptionFactory(); - - static void CopyCandidatesFromSessionDescription( - const SessionDescriptionInterface* source_desc, - SessionDescriptionInterface* dest_desc); - - void CreateOffer( - CreateSessionDescriptionObserver* observer, - const PeerConnectionInterface::RTCOfferAnswerOptions& options, - const cricket::MediaSessionOptions& session_options); - void CreateAnswer(CreateSessionDescriptionObserver* observer, - const MediaConstraintsInterface* constraints, - const cricket::MediaSessionOptions& session_options); - - void SetSdesPolicy(cricket::SecurePolicy secure_policy); - cricket::SecurePolicy SdesPolicy() const; - - sigslot::signal1&> - SignalCertificateReady; - - // For testing. - bool waiting_for_certificate_for_testing() const { - return certificate_request_state_ == CERTIFICATE_WAITING; - } - - private: - enum CertificateRequestState { - CERTIFICATE_NOT_NEEDED, - CERTIFICATE_WAITING, - CERTIFICATE_SUCCEEDED, - CERTIFICATE_FAILED, - }; - - WebRtcSessionDescriptionFactory( - rtc::Thread* signaling_thread, - cricket::ChannelManager* channel_manager, - rtc::scoped_ptr dtls_identity_store, - const rtc::scoped_refptr& - identity_request_observer, - WebRtcSession* session, - const std::string& session_id, - bool dtls_enabled); - - // MessageHandler implementation. - virtual void OnMessage(rtc::Message* msg); - - void InternalCreateOffer(CreateSessionDescriptionRequest request); - void InternalCreateAnswer(CreateSessionDescriptionRequest request); - // Posts failure notifications for all pending session description requests. - void FailPendingRequests(const std::string& reason); - void PostCreateSessionDescriptionFailed( - CreateSessionDescriptionObserver* observer, - const std::string& error); - void PostCreateSessionDescriptionSucceeded( - CreateSessionDescriptionObserver* observer, - SessionDescriptionInterface* description); - - void OnIdentityRequestFailed(int error); - void SetCertificate( - const rtc::scoped_refptr& certificate); - - std::queue - create_session_description_requests_; - rtc::Thread* const signaling_thread_; - cricket::TransportDescriptionFactory transport_desc_factory_; - cricket::MediaSessionDescriptionFactory session_desc_factory_; - uint64_t session_version_; - const rtc::scoped_ptr dtls_identity_store_; - const rtc::scoped_refptr - identity_request_observer_; - // TODO(jiayl): remove the dependency on session once bug 2264 is fixed. - WebRtcSession* const session_; - const std::string session_id_; - CertificateRequestState certificate_request_state_; - - RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory); -}; -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ diff --git a/include/talk/media/base/audioframe.h b/include/talk/media/base/audioframe.h deleted file mode 100644 index 157d0f1..0000000 --- a/include/talk/media/base/audioframe.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_AUDIOFRAME_H_ -#define TALK_MEDIA_BASE_AUDIOFRAME_H_ - -namespace cricket { - -class AudioFrame { - public: - AudioFrame() - : audio10ms_(NULL), - length_(0), - sampling_frequency_(8000), - stereo_(false) { - } - AudioFrame(int16_t* audio, size_t audio_length, int sample_freq, bool stereo) - : audio10ms_(audio), - length_(audio_length), - sampling_frequency_(sample_freq), - stereo_(stereo) {} - - int16_t* GetData() { return audio10ms_; } - size_t GetSize() const { return length_; } - int GetSamplingFrequency() const { return sampling_frequency_; } - bool GetStereo() const { return stereo_; } - - private: - // TODO(janahan): currently the data is not owned by this class. - // add ownership when we come up with the first use case that requires it. - int16_t* audio10ms_; - size_t length_; - int sampling_frequency_; - bool stereo_; -}; - -} // namespace cricket -#endif // TALK_MEDIA_BASE_AUDIOFRAME_H_ diff --git a/include/talk/media/base/audiorenderer.h b/include/talk/media/base/audiorenderer.h deleted file mode 100644 index 229c36e..0000000 --- a/include/talk/media/base/audiorenderer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_AUDIORENDERER_H_ -#define TALK_MEDIA_BASE_AUDIORENDERER_H_ - -#include - -namespace cricket { - -// Abstract interface for rendering the audio data. -class AudioRenderer { - public: - class Sink { - public: - // Callback to receive data from the AudioRenderer. - virtual void OnData(const void* audio_data, - int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames) = 0; - - // Called when the AudioRenderer is going away. - virtual void OnClose() = 0; - - protected: - virtual ~Sink() {} - }; - - // Sets a sink to the AudioRenderer. There can be only one sink connected - // to the renderer at a time. - virtual void SetSink(Sink* sink) {} - - protected: - virtual ~AudioRenderer() {} -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_AUDIORENDERER_H_ diff --git a/include/talk/media/base/capturemanager.h b/include/talk/media/base/capturemanager.h deleted file mode 100644 index 8cbbf52..0000000 --- a/include/talk/media/base/capturemanager.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// The CaptureManager class manages VideoCapturers to make it possible to share -// the same VideoCapturers across multiple instances. E.g. if two instances of -// some class want to listen to same VideoCapturer they can't individually stop -// and start capturing as doing so will affect the other instance. -// The class employs reference counting on starting and stopping of capturing of -// frames such that if anyone is still listening it will not be stopped. The -// class also provides APIs for attaching VideoRenderers to a specific capturer -// such that the VideoRenderers are fed frames directly from the capturer. -// CaptureManager is Thread-unsafe. This means that none of its APIs may be -// called concurrently. Note that callbacks are called by the VideoCapturer's -// thread which is normally a separate unmarshalled thread and thus normally -// require lock protection. - -#ifndef TALK_MEDIA_BASE_CAPTUREMANAGER_H_ -#define TALK_MEDIA_BASE_CAPTUREMANAGER_H_ - -#include -#include - -#include "talk/media/base/capturerenderadapter.h" -#include "talk/media/base/videocommon.h" -#include "webrtc/base/sigslotrepeater.h" -#include "webrtc/base/thread_checker.h" - -namespace cricket { - -class VideoCapturer; -class VideoRenderer; -class VideoCapturerState; - -class CaptureManager : public sigslot::has_slots<> { - public: - enum RestartOptions { - kRequestRestart, - kForceRestart - }; - - CaptureManager(); - virtual ~CaptureManager(); - - virtual bool StartVideoCapture(VideoCapturer* video_capturer, - const VideoFormat& desired_format); - virtual bool StopVideoCapture(VideoCapturer* video_capturer, - const VideoFormat& format); - - // Possibly restarts the capturer. If |options| is set to kRequestRestart, - // the CaptureManager chooses whether this request can be handled with the - // current state or if a restart is actually needed. If |options| is set to - // kForceRestart, the capturer is restarted. - virtual bool RestartVideoCapture(VideoCapturer* video_capturer, - const VideoFormat& previous_format, - const VideoFormat& desired_format, - RestartOptions options); - - virtual bool AddVideoRenderer(VideoCapturer* video_capturer, - VideoRenderer* video_renderer); - virtual bool RemoveVideoRenderer(VideoCapturer* video_capturer, - VideoRenderer* video_renderer); - - sigslot::repeater2 SignalCapturerStateChange; - - private: - typedef std::map CaptureStates; - - bool IsCapturerRegistered(VideoCapturer* video_capturer) const; - bool RegisterVideoCapturer(VideoCapturer* video_capturer); - void UnregisterVideoCapturer(VideoCapturerState* capture_state); - - bool StartWithBestCaptureFormat(VideoCapturerState* capture_info, - VideoCapturer* video_capturer); - - VideoCapturerState* GetCaptureState(VideoCapturer* video_capturer) const; - CaptureRenderAdapter* GetAdapter(VideoCapturer* video_capturer) const; - - rtc::ThreadChecker thread_checker_; - CaptureStates capture_states_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_CAPTUREMANAGER_H_ diff --git a/include/talk/media/base/capturerenderadapter.h b/include/talk/media/base/capturerenderadapter.h deleted file mode 100644 index ec9c60c..0000000 --- a/include/talk/media/base/capturerenderadapter.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains the class CaptureRenderAdapter. The class connects a -// VideoCapturer to any number of VideoRenders such that the former feeds the -// latter. -// CaptureRenderAdapter is Thread-unsafe. This means that none of its APIs may -// be called concurrently. - -#ifndef TALK_MEDIA_BASE_CAPTURERENDERADAPTER_H_ -#define TALK_MEDIA_BASE_CAPTURERENDERADAPTER_H_ - -#include - -#include "talk/media/base/videocapturer.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/sigslot.h" - -namespace cricket { - -class VideoCapturer; -class VideoProcessor; -class VideoRenderer; - -class CaptureRenderAdapter : public sigslot::has_slots<> { - public: - static CaptureRenderAdapter* Create(VideoCapturer* video_capturer); - ~CaptureRenderAdapter(); - - bool AddRenderer(VideoRenderer* video_renderer); - bool RemoveRenderer(VideoRenderer* video_renderer); - - VideoCapturer* video_capturer() { return video_capturer_; } - private: - struct VideoRendererInfo { - explicit VideoRendererInfo(VideoRenderer* r) - : renderer(r), - render_width(0), - render_height(0) { - } - VideoRenderer* renderer; - size_t render_width; - size_t render_height; - }; - - // Just pointers since ownership is not handed over to this class. - typedef std::vector VideoRenderers; - - explicit CaptureRenderAdapter(VideoCapturer* video_capturer); - void Init(); - - // Callback for frames received from the capturer. - void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* video_frame); - - void MaybeSetRenderingSize(const VideoFrame* frame); - - bool IsRendererRegistered(const VideoRenderer& video_renderer) const; - - VideoRenderers video_renderers_; - VideoCapturer* video_capturer_; - // Critical section synchronizing the capture thread. - mutable rtc::CriticalSection capture_crit_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_CAPTURERENDERADAPTER_H_ diff --git a/include/talk/media/base/codec.h b/include/talk/media/base/codec.h deleted file mode 100644 index ea6c541..0000000 --- a/include/talk/media/base/codec.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_CODEC_H_ -#define TALK_MEDIA_BASE_CODEC_H_ - -#include -#include -#include -#include - -#include "talk/media/base/constants.h" - -namespace cricket { - -typedef std::map CodecParameterMap; - -extern const int kMaxPayloadId; - -class FeedbackParam { - public: - FeedbackParam(const std::string& id, const std::string& param) - : id_(id), - param_(param) { - } - explicit FeedbackParam(const std::string& id) - : id_(id), - param_(kParamValueEmpty) { - } - bool operator==(const FeedbackParam& other) const; - - const std::string& id() const { return id_; } - const std::string& param() const { return param_; } - - private: - std::string id_; // e.g. "nack", "ccm" - std::string param_; // e.g. "", "rpsi", "fir" -}; - -class FeedbackParams { - public: - bool operator==(const FeedbackParams& other) const; - - bool Has(const FeedbackParam& param) const; - void Add(const FeedbackParam& param); - - void Intersect(const FeedbackParams& from); - - const std::vector& params() const { return params_; } - private: - bool HasDuplicateEntries() const; - - std::vector params_; -}; - -struct Codec { - int id; - std::string name; - int clockrate; - int preference; - CodecParameterMap params; - FeedbackParams feedback_params; - - // Creates a codec with the given parameters. - Codec(int id, const std::string& name, int clockrate, int preference); - // Creates an empty codec. - Codec(); - Codec(const Codec& c); - ~Codec(); - - // Indicates if this codec is compatible with the specified codec. - bool Matches(const Codec& codec) const; - - // Find the parameter for |name| and write the value to |out|. - bool GetParam(const std::string& name, std::string* out) const; - bool GetParam(const std::string& name, int* out) const; - - void SetParam(const std::string& name, const std::string& value); - void SetParam(const std::string& name, int value); - - // It is safe to input a non-existent parameter. - // Returns true if the parameter existed, false if it did not exist. - bool RemoveParam(const std::string& name); - - bool HasFeedbackParam(const FeedbackParam& param) const; - void AddFeedbackParam(const FeedbackParam& param); - - static bool Preferable(const Codec& first, const Codec& other) { - return first.preference > other.preference; - } - - // Filter |this| feedbacks params such that only those shared by both |this| - // and |other| are kept. - void IntersectFeedbackParams(const Codec& other); - - Codec& operator=(const Codec& c); - - bool operator==(const Codec& c) const; - - bool operator!=(const Codec& c) const { - return !(*this == c); - } -}; - -struct AudioCodec : public Codec { - int bitrate; - int channels; - - // Creates a codec with the given parameters. - AudioCodec(int pt, const std::string& nm, int cr, int br, int cs, int pr); - // Creates an empty codec. - AudioCodec(); - AudioCodec(const AudioCodec& c); - ~AudioCodec() = default; - - // Indicates if this codec is compatible with the specified codec. - bool Matches(const AudioCodec& codec) const; - - static bool Preferable(const AudioCodec& first, const AudioCodec& other) { - return first.preference > other.preference; - } - - std::string ToString() const; - - AudioCodec& operator=(const AudioCodec& c); - - bool operator==(const AudioCodec& c) const; - - bool operator!=(const AudioCodec& c) const { - return !(*this == c); - } -}; - -struct VideoCodec : public Codec { - int width; - int height; - int framerate; - - // Creates a codec with the given parameters. - VideoCodec(int pt, const std::string& nm, int w, int h, int fr, int pr); - VideoCodec(int pt, const std::string& nm); - // Creates an empty codec. - VideoCodec(); - VideoCodec(const VideoCodec& c); - ~VideoCodec() = default; - - static bool Preferable(const VideoCodec& first, const VideoCodec& other) { - return first.preference > other.preference; - } - - std::string ToString() const; - - VideoCodec& operator=(const VideoCodec& c); - - bool operator==(const VideoCodec& c) const; - - bool operator!=(const VideoCodec& c) const { - return !(*this == c); - } - - static VideoCodec CreateRtxCodec(int rtx_payload_type, - int associated_payload_type); - - enum CodecType { - CODEC_VIDEO, - CODEC_RED, - CODEC_ULPFEC, - CODEC_RTX, - }; - - CodecType GetCodecType() const; - // Validates a VideoCodec's payload type, dimensions and bitrates etc. If they - // don't make sense (such as max < min bitrate), and error is logged and - // ValidateCodecFormat returns false. - bool ValidateCodecFormat() const; -}; - -struct DataCodec : public Codec { - DataCodec(int id, const std::string& name, int preference); - DataCodec(); - DataCodec(const DataCodec& c); - - DataCodec& operator=(const DataCodec& c); - - std::string ToString() const; -}; - -// Get the codec setting associated with |payload_type|. If there -// is no codec associated with that payload type it returns false. -template -bool FindCodecById(const std::vector& codecs, - int payload_type, - Codec* codec_out) { - for (const auto& codec : codecs) { - if (codec.id == payload_type) { - *codec_out = codec; - return true; - } - } - return false; -} - -bool CodecNamesEq(const std::string& name1, const std::string& name2); -bool HasNack(const VideoCodec& codec); -bool HasRemb(const VideoCodec& codec); -bool HasTransportCc(const VideoCodec& codec); - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_CODEC_H_ diff --git a/include/talk/media/base/constants.h b/include/talk/media/base/constants.h deleted file mode 100644 index 706a7bd..0000000 --- a/include/talk/media/base/constants.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_CONSTANTS_H_ -#define TALK_MEDIA_BASE_CONSTANTS_H_ - -#include - -// This file contains constants related to media. - -namespace cricket { - -extern const int kVideoCodecClockrate; -extern const int kDataCodecClockrate; -extern const int kDataMaxBandwidth; // bps - -// Default CPU thresholds. -extern const float kHighSystemCpuThreshold; -extern const float kLowSystemCpuThreshold; -extern const float kProcessCpuThreshold; - -extern const char kRtxCodecName[]; -extern const char kRedCodecName[]; -extern const char kUlpfecCodecName[]; - -// Codec parameters -extern const char kCodecParamAssociatedPayloadType[]; - -extern const char kOpusCodecName[]; -extern const char kIsacCodecName[]; -extern const char kL16CodecName[]; -extern const char kG722CodecName[]; -extern const char kIlbcCodecName[]; -extern const char kPcmuCodecName[]; -extern const char kPcmaCodecName[]; -extern const char kCnCodecName[]; -extern const char kDtmfCodecName[]; - -// Attribute parameters -extern const char kCodecParamPTime[]; -extern const char kCodecParamMaxPTime[]; -// fmtp parameters -extern const char kCodecParamMinPTime[]; -extern const char kCodecParamSPropStereo[]; -extern const char kCodecParamStereo[]; -extern const char kCodecParamUseInbandFec[]; -extern const char kCodecParamUseDtx[]; -extern const char kCodecParamMaxAverageBitrate[]; -extern const char kCodecParamMaxPlaybackRate[]; -extern const char kCodecParamSctpProtocol[]; -extern const char kCodecParamSctpStreams[]; - -extern const char kParamValueTrue[]; -// Parameters are stored as parameter/value pairs. For parameters who do not -// have a value, |kParamValueEmpty| should be used as value. -extern const char kParamValueEmpty[]; - -// opus parameters. -// Default value for maxptime according to -// http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03 -extern const int kOpusDefaultMaxPTime; -extern const int kOpusDefaultPTime; -extern const int kOpusDefaultMinPTime; -extern const int kOpusDefaultSPropStereo; -extern const int kOpusDefaultStereo; -extern const int kOpusDefaultUseInbandFec; -extern const int kOpusDefaultUseDtx; -extern const int kOpusDefaultMaxPlaybackRate; - -// Prefered values in this code base. Note that they may differ from the default -// values in http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03 -// Only frames larger or equal to 10 ms are currently supported in this code -// base. -extern const int kPreferredMaxPTime; -extern const int kPreferredMinPTime; -extern const int kPreferredSPropStereo; -extern const int kPreferredStereo; -extern const int kPreferredUseInbandFec; - -// rtcp-fb messages according to RFC 4585 -extern const char kRtcpFbParamNack[]; -extern const char kRtcpFbNackParamPli[]; -// rtcp-fb messages according to -// http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-00 -extern const char kRtcpFbParamRemb[]; -// rtcp-fb messages according to -// https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01 -extern const char kRtcpFbParamTransportCc[]; -// ccm submessages according to RFC 5104 -extern const char kRtcpFbParamCcm[]; -extern const char kRtcpFbCcmParamFir[]; -// Google specific parameters -extern const char kCodecParamMaxBitrate[]; -extern const char kCodecParamMinBitrate[]; -extern const char kCodecParamStartBitrate[]; -extern const char kCodecParamMaxQuantization[]; -extern const char kCodecParamPort[]; - -// We put the data codec names here so callers of -// DataEngine::CreateChannel don't have to import rtpdataengine.h or -// sctpdataengine.h to get the codec names they want to pass in. -extern const int kGoogleRtpDataCodecId; -extern const char kGoogleRtpDataCodecName[]; - -// TODO(pthatcher): Find an id that won't conflict with anything. On -// the other hand, it really shouldn't matter since the id won't be -// used on the wire. -extern const int kGoogleSctpDataCodecId; -extern const char kGoogleSctpDataCodecName[]; - -extern const char kComfortNoiseCodecName[]; - -// Header extension for audio levels, as defined in -// http://tools.ietf.org/html/draft-ietf-avtext-client-to-mixer-audio-level-03 -extern const int kRtpAudioLevelHeaderExtensionDefaultId; -extern const char kRtpAudioLevelHeaderExtension[]; - -// Header extension for RTP timestamp offset, see RFC 5450 for details: -// http://tools.ietf.org/html/rfc5450 -extern const int kRtpTimestampOffsetHeaderExtensionDefaultId; -extern const char kRtpTimestampOffsetHeaderExtension[]; - -// Header extension for absolute send time, see url for details: -// http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time -extern const int kRtpAbsoluteSenderTimeHeaderExtensionDefaultId; -extern const char kRtpAbsoluteSenderTimeHeaderExtension[]; - -// Header extension for coordination of video orientation, see url for details: -// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ -// ts_126114v120700p.pdf -extern const int kRtpVideoRotationHeaderExtensionDefaultId; -extern const char kRtpVideoRotationHeaderExtension[]; -// We don't support 6 bit CVO. Added here for testing purpose. -extern const char kRtpVideoRotation6BitsHeaderExtensionForTesting[]; - -// Header extension for transport sequence number, see url for details: -// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions -extern const int kRtpTransportSequenceNumberHeaderExtensionDefaultId; -extern const char kRtpTransportSequenceNumberHeaderExtension[]; - -extern const int kNumDefaultUnsignalledVideoRecvStreams; - -extern const char kVp8CodecName[]; -extern const char kVp9CodecName[]; -extern const char kH264CodecName[]; - -extern const int kDefaultVp8PlType; -extern const int kDefaultVp9PlType; -extern const int kDefaultH264PlType; -extern const int kDefaultRedPlType; -extern const int kDefaultUlpfecType; -extern const int kDefaultRtxVp8PlType; - -extern const int kDefaultVideoMaxWidth; -extern const int kDefaultVideoMaxHeight; -extern const int kDefaultVideoMaxFramerate; -} // namespace cricket - -#endif // TALK_MEDIA_BASE_CONSTANTS_H_ - diff --git a/include/talk/media/base/cpuid.h b/include/talk/media/base/cpuid.h deleted file mode 100644 index d97b28e..0000000 --- a/include/talk/media/base/cpuid.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_CPUID_H_ -#define TALK_MEDIA_BASE_CPUID_H_ - -#include "webrtc/base/constructormagic.h" - -namespace cricket { - -class CpuInfo { - public: - // The following flags must match libyuv/cpu_id.h values. - // Internal flag to indicate cpuid requires initialization. - static const int kCpuInit = 0x1; - - // These flags are only valid on ARM processors. - static const int kCpuHasARM = 0x2; - static const int kCpuHasNEON = 0x4; - // 0x8 reserved for future ARM flag. - - // These flags are only valid on x86 processors. - static const int kCpuHasX86 = 0x10; - static const int kCpuHasSSE2 = 0x20; - static const int kCpuHasSSSE3 = 0x40; - static const int kCpuHasSSE41 = 0x80; - static const int kCpuHasSSE42 = 0x100; - static const int kCpuHasAVX = 0x200; - static const int kCpuHasAVX2 = 0x400; - static const int kCpuHasERMS = 0x800; - - // These flags are only valid on MIPS processors. - static const int kCpuHasMIPS = 0x1000; - static const int kCpuHasMIPS_DSP = 0x2000; - static const int kCpuHasMIPS_DSPR2 = 0x4000; - - // Detect CPU has SSE2 etc. - static bool TestCpuFlag(int flag); - - // For testing, allow CPU flags to be disabled. - static void MaskCpuFlagsForTest(int enable_flags); - - private: - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CpuInfo); -}; - -// Detect an Intel Core I5 or better such as 4th generation Macbook Air. -bool IsCoreIOrBetter(); - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_CPUID_H_ diff --git a/include/talk/media/base/cryptoparams.h b/include/talk/media/base/cryptoparams.h deleted file mode 100644 index 589953d..0000000 --- a/include/talk/media/base/cryptoparams.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_CRYPTOPARAMS_H_ -#define TALK_MEDIA_BASE_CRYPTOPARAMS_H_ - -#include - -namespace cricket { - -// Parameters for SRTP negotiation, as described in RFC 4568. -struct CryptoParams { - CryptoParams() : tag(0) {} - CryptoParams(int t, - const std::string& cs, - const std::string& kp, - const std::string& sp) - : tag(t), cipher_suite(cs), key_params(kp), session_params(sp) {} - - bool Matches(const CryptoParams& params) const { - return (tag == params.tag && cipher_suite == params.cipher_suite); - } - - int tag; - std::string cipher_suite; - std::string key_params; - std::string session_params; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_CRYPTOPARAMS_H_ diff --git a/include/talk/media/base/device.h b/include/talk/media/base/device.h deleted file mode 100755 index 829ee30..0000000 --- a/include/talk/media/base/device.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_DEVICE_H_ -#define TALK_MEDIA_BASE_DEVICE_H_ - -#include "webrtc/base/stringencode.h" - -namespace cricket { - -// Used to represent an audio or video capture or render device. -struct Device { - Device() {} - Device(const std::string& name, int id) - : name(name), - id(rtc::ToString(id)) { - } - Device(const std::string& name, const std::string& id) - : name(name), id(id) {} - - std::string name; - std::string id; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_DEVICE_H_ diff --git a/include/talk/media/base/executablehelpers.h b/include/talk/media/base/executablehelpers.h deleted file mode 100644 index 401890f..0000000 --- a/include/talk/media/base/executablehelpers.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_ -#define TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_ - -#ifdef OSX -#include -#endif - -#include - -#include "webrtc/base/logging.h" -#include "webrtc/base/pathutils.h" - -namespace rtc { - -// Returns the path to the running executable or an empty path. -// TODO(thorcarpenter): Consolidate with FluteClient::get_executable_dir. -inline Pathname GetExecutablePath() { - const int32_t kMaxExePathSize = 255; -#ifdef WIN32 - TCHAR exe_path_buffer[kMaxExePathSize]; - DWORD copied_length = GetModuleFileName(NULL, // NULL = Current process - exe_path_buffer, kMaxExePathSize); - if (0 == copied_length) { - LOG(LS_ERROR) << "Copied length is zero"; - return rtc::Pathname(); - } - if (kMaxExePathSize == copied_length) { - LOG(LS_ERROR) << "Buffer too small"; - return rtc::Pathname(); - } -#ifdef UNICODE - std::wstring wdir(exe_path_buffer); - std::string dir_tmp(wdir.begin(), wdir.end()); - rtc::Pathname path(dir_tmp); -#else // UNICODE - rtc::Pathname path(exe_path_buffer); -#endif // UNICODE -#elif defined(OSX) || defined(LINUX) - char exe_path_buffer[kMaxExePathSize]; -#ifdef OSX - uint32_t copied_length = kMaxExePathSize - 1; - if (_NSGetExecutablePath(exe_path_buffer, &copied_length) == -1) { - LOG(LS_ERROR) << "Buffer too small"; - return rtc::Pathname(); - } -#elif defined LINUX - int32_t copied_length = kMaxExePathSize - 1; - const char* kProcExeFmt = "/proc/%d/exe"; - char proc_exe_link[40]; - snprintf(proc_exe_link, sizeof(proc_exe_link), kProcExeFmt, getpid()); - copied_length = readlink(proc_exe_link, exe_path_buffer, copied_length); - if (copied_length == -1) { - LOG_ERR(LS_ERROR) << "Error reading link " << proc_exe_link; - return rtc::Pathname(); - } - if (copied_length == kMaxExePathSize - 1) { - LOG(LS_ERROR) << "Probably truncated result when reading link " - << proc_exe_link; - return rtc::Pathname(); - } - exe_path_buffer[copied_length] = '\0'; -#endif // LINUX - rtc::Pathname path(exe_path_buffer); -#else // Android || IOS - rtc::Pathname path; -#endif // OSX || LINUX - return path; -} - -} // namespace rtc - -#endif // TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_ - diff --git a/include/talk/media/base/fakecapturemanager.h b/include/talk/media/base/fakecapturemanager.h deleted file mode 100644 index 64c0f52..0000000 --- a/include/talk/media/base/fakecapturemanager.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_FAKECAPTUREMANAGER_H_ -#define TALK_MEDIA_BASE_FAKECAPTUREMANAGER_H_ - -#include "talk/media/base/capturemanager.h" - -namespace cricket { - -class FakeCaptureManager : public CaptureManager { - public: - FakeCaptureManager() {} - ~FakeCaptureManager() {} - - virtual bool AddVideoRenderer(VideoCapturer* video_capturer, - VideoRenderer* video_renderer) { - return true; - } - virtual bool RemoveVideoRenderer(VideoCapturer* video_capturer, - VideoRenderer* video_renderer) { - return true; - } -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_FAKECAPTUREMANAGER_H_ diff --git a/include/talk/media/base/fakemediaengine.h b/include/talk/media/base/fakemediaengine.h deleted file mode 100644 index f5b2174..0000000 --- a/include/talk/media/base/fakemediaengine.h +++ /dev/null @@ -1,948 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ -#define TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ - -#include -#include -#include -#include -#include - -#include "talk/media/base/audiorenderer.h" -#include "talk/media/base/mediaengine.h" -#include "talk/media/base/rtputils.h" -#include "talk/media/base/streamparams.h" -#include "webrtc/audio/audio_sink.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/p2p/base/sessiondescription.h" - -namespace cricket { - -class FakeMediaEngine; -class FakeVideoEngine; -class FakeVoiceEngine; - -// A common helper class that handles sending and receiving RTP/RTCP packets. -template class RtpHelper : public Base { - public: - RtpHelper() - : sending_(false), - playout_(false), - fail_set_send_codecs_(false), - fail_set_recv_codecs_(false), - send_ssrc_(0), - ready_to_send_(false) {} - const std::vector& recv_extensions() { - return recv_extensions_; - } - const std::vector& send_extensions() { - return send_extensions_; - } - bool sending() const { return sending_; } - bool playout() const { return playout_; } - const std::list& rtp_packets() const { return rtp_packets_; } - const std::list& rtcp_packets() const { return rtcp_packets_; } - - bool SendRtp(const void* data, int len, const rtc::PacketOptions& options) { - if (!sending_) { - return false; - } - rtc::Buffer packet(reinterpret_cast(data), len, - kMaxRtpPacketLen); - return Base::SendPacket(&packet, options); - } - bool SendRtcp(const void* data, int len) { - rtc::Buffer packet(reinterpret_cast(data), len, - kMaxRtpPacketLen); - return Base::SendRtcp(&packet, rtc::PacketOptions()); - } - - bool CheckRtp(const void* data, int len) { - bool success = !rtp_packets_.empty(); - if (success) { - std::string packet = rtp_packets_.front(); - rtp_packets_.pop_front(); - success = (packet == std::string(static_cast(data), len)); - } - return success; - } - bool CheckRtcp(const void* data, int len) { - bool success = !rtcp_packets_.empty(); - if (success) { - std::string packet = rtcp_packets_.front(); - rtcp_packets_.pop_front(); - success = (packet == std::string(static_cast(data), len)); - } - return success; - } - bool CheckNoRtp() { return rtp_packets_.empty(); } - bool CheckNoRtcp() { return rtcp_packets_.empty(); } - void set_fail_set_send_codecs(bool fail) { fail_set_send_codecs_ = fail; } - void set_fail_set_recv_codecs(bool fail) { fail_set_recv_codecs_ = fail; } - virtual bool AddSendStream(const StreamParams& sp) { - if (std::find(send_streams_.begin(), send_streams_.end(), sp) != - send_streams_.end()) { - return false; - } - send_streams_.push_back(sp); - return true; - } - virtual bool RemoveSendStream(uint32_t ssrc) { - return RemoveStreamBySsrc(&send_streams_, ssrc); - } - virtual bool AddRecvStream(const StreamParams& sp) { - if (std::find(receive_streams_.begin(), receive_streams_.end(), sp) != - receive_streams_.end()) { - return false; - } - receive_streams_.push_back(sp); - return true; - } - virtual bool RemoveRecvStream(uint32_t ssrc) { - return RemoveStreamBySsrc(&receive_streams_, ssrc); - } - bool IsStreamMuted(uint32_t ssrc) const { - bool ret = muted_streams_.find(ssrc) != muted_streams_.end(); - // If |ssrc = 0| check if the first send stream is muted. - if (!ret && ssrc == 0 && !send_streams_.empty()) { - return muted_streams_.find(send_streams_[0].first_ssrc()) != - muted_streams_.end(); - } - return ret; - } - const std::vector& send_streams() const { - return send_streams_; - } - const std::vector& recv_streams() const { - return receive_streams_; - } - bool HasRecvStream(uint32_t ssrc) const { - return GetStreamBySsrc(receive_streams_, ssrc) != nullptr; - } - bool HasSendStream(uint32_t ssrc) const { - return GetStreamBySsrc(send_streams_, ssrc) != nullptr; - } - // TODO(perkj): This is to support legacy unit test that only check one - // sending stream. - uint32_t send_ssrc() const { - if (send_streams_.empty()) - return 0; - return send_streams_[0].first_ssrc(); - } - - // TODO(perkj): This is to support legacy unit test that only check one - // sending stream. - const std::string rtcp_cname() { - if (send_streams_.empty()) - return ""; - return send_streams_[0].cname; - } - - bool ready_to_send() const { - return ready_to_send_; - } - - protected: - bool MuteStream(uint32_t ssrc, bool mute) { - if (!HasSendStream(ssrc) && ssrc != 0) { - return false; - } - if (mute) { - muted_streams_.insert(ssrc); - } else { - muted_streams_.erase(ssrc); - } - return true; - } - bool set_sending(bool send) { - sending_ = send; - return true; - } - void set_playout(bool playout) { playout_ = playout; } - bool SetRecvRtpHeaderExtensions( - const std::vector& extensions) { - recv_extensions_ = extensions; - return true; - } - bool SetSendRtpHeaderExtensions( - const std::vector& extensions) { - send_extensions_ = extensions; - return true; - } - virtual void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) { - rtp_packets_.push_back(std::string(packet->data(), packet->size())); - } - virtual void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) { - rtcp_packets_.push_back(std::string(packet->data(), packet->size())); - } - virtual void OnReadyToSend(bool ready) { - ready_to_send_ = ready; - } - bool fail_set_send_codecs() const { return fail_set_send_codecs_; } - bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } - - private: - bool sending_; - bool playout_; - std::vector recv_extensions_; - std::vector send_extensions_; - std::list rtp_packets_; - std::list rtcp_packets_; - std::vector send_streams_; - std::vector receive_streams_; - std::set muted_streams_; - bool fail_set_send_codecs_; - bool fail_set_recv_codecs_; - uint32_t send_ssrc_; - std::string rtcp_cname_; - bool ready_to_send_; -}; - -class FakeVoiceMediaChannel : public RtpHelper { - public: - struct DtmfInfo { - DtmfInfo(uint32_t ssrc, int event_code, int duration) - : ssrc(ssrc), - event_code(event_code), - duration(duration) {} - uint32_t ssrc; - int event_code; - int duration; - }; - explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, - const AudioOptions& options) - : engine_(engine), - time_since_last_typing_(-1) { - output_scalings_[0] = 1.0; // For default channel. - SetOptions(options); - } - ~FakeVoiceMediaChannel(); - const std::vector& recv_codecs() const { return recv_codecs_; } - const std::vector& send_codecs() const { return send_codecs_; } - const std::vector& codecs() const { return send_codecs(); } - const std::vector& dtmf_info_queue() const { - return dtmf_info_queue_; - } - const AudioOptions& options() const { return options_; } - - virtual bool SetSendParameters(const AudioSendParameters& params) { - return (SetSendCodecs(params.codecs) && - SetSendRtpHeaderExtensions(params.extensions) && - SetMaxSendBandwidth(params.max_bandwidth_bps) && - SetOptions(params.options)); - } - - virtual bool SetRecvParameters(const AudioRecvParameters& params) { - return (SetRecvCodecs(params.codecs) && - SetRecvRtpHeaderExtensions(params.extensions)); - } - virtual bool SetPlayout(bool playout) { - set_playout(playout); - return true; - } - virtual bool SetSend(SendFlags flag) { - return set_sending(flag != SEND_NOTHING); - } - virtual bool SetAudioSend(uint32_t ssrc, - bool enable, - const AudioOptions* options, - AudioRenderer* renderer) { - if (!SetLocalRenderer(ssrc, renderer)) { - return false; - } - if (!RtpHelper::MuteStream(ssrc, !enable)) { - return false; - } - if (enable && options) { - return SetOptions(*options); - } - return true; - } - virtual bool AddRecvStream(const StreamParams& sp) { - if (!RtpHelper::AddRecvStream(sp)) - return false; - output_scalings_[sp.first_ssrc()] = 1.0; - return true; - } - virtual bool RemoveRecvStream(uint32_t ssrc) { - if (!RtpHelper::RemoveRecvStream(ssrc)) - return false; - output_scalings_.erase(ssrc); - return true; - } - - virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; } - virtual int GetOutputLevel() { return 0; } - void set_time_since_last_typing(int ms) { time_since_last_typing_ = ms; } - virtual int GetTimeSinceLastTyping() { return time_since_last_typing_; } - virtual void SetTypingDetectionParameters( - int time_window, int cost_per_typing, int reporting_threshold, - int penalty_decay, int type_event_delay) {} - - virtual bool CanInsertDtmf() { - for (std::vector::const_iterator it = send_codecs_.begin(); - it != send_codecs_.end(); ++it) { - // Find the DTMF telephone event "codec". - if (_stricmp(it->name.c_str(), "telephone-event") == 0) { - return true; - } - } - return false; - } - virtual bool InsertDtmf(uint32_t ssrc, - int event_code, - int duration) { - dtmf_info_queue_.push_back(DtmfInfo(ssrc, event_code, duration)); - return true; - } - - virtual bool SetOutputVolume(uint32_t ssrc, double volume) { - if (0 == ssrc) { - std::map::iterator it; - for (it = output_scalings_.begin(); it != output_scalings_.end(); ++it) { - it->second = volume; - } - return true; - } else if (output_scalings_.find(ssrc) != output_scalings_.end()) { - output_scalings_[ssrc] = volume; - return true; - } - return false; - } - bool GetOutputVolume(uint32_t ssrc, double* volume) { - if (output_scalings_.find(ssrc) == output_scalings_.end()) - return false; - *volume = output_scalings_[ssrc]; - return true; - } - - virtual bool GetStats(VoiceMediaInfo* info) { return false; } - - virtual void SetRawAudioSink( - uint32_t ssrc, - rtc::scoped_ptr sink) { - sink_ = std::move(sink); - } - - private: - class VoiceChannelAudioSink : public AudioRenderer::Sink { - public: - explicit VoiceChannelAudioSink(AudioRenderer* renderer) - : renderer_(renderer) { - renderer_->SetSink(this); - } - virtual ~VoiceChannelAudioSink() { - if (renderer_) { - renderer_->SetSink(NULL); - } - } - void OnData(const void* audio_data, - int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames) override {} - void OnClose() override { renderer_ = NULL; } - AudioRenderer* renderer() const { return renderer_; } - - private: - AudioRenderer* renderer_; - }; - - bool SetRecvCodecs(const std::vector& codecs) { - if (fail_set_recv_codecs()) { - // Fake the failure in SetRecvCodecs. - return false; - } - recv_codecs_ = codecs; - return true; - } - bool SetSendCodecs(const std::vector& codecs) { - if (fail_set_send_codecs()) { - // Fake the failure in SetSendCodecs. - return false; - } - send_codecs_ = codecs; - return true; - } - bool SetMaxSendBandwidth(int bps) { return true; } - bool SetOptions(const AudioOptions& options) { - // Does a "merge" of current options and set options. - options_.SetAll(options); - return true; - } - bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer) { - auto it = local_renderers_.find(ssrc); - if (renderer) { - if (it != local_renderers_.end()) { - ASSERT(it->second->renderer() == renderer); - } else { - local_renderers_.insert(std::make_pair( - ssrc, new VoiceChannelAudioSink(renderer))); - } - } else { - if (it != local_renderers_.end()) { - delete it->second; - local_renderers_.erase(it); - } - } - return true; - } - - FakeVoiceEngine* engine_; - std::vector recv_codecs_; - std::vector send_codecs_; - std::map output_scalings_; - std::vector dtmf_info_queue_; - int time_since_last_typing_; - AudioOptions options_; - std::map local_renderers_; - rtc::scoped_ptr sink_; -}; - -// A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. -inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, - uint32_t ssrc, - int event_code, - int duration) { - return (info.duration == duration && info.event_code == event_code && - info.ssrc == ssrc); -} - -class FakeVideoMediaChannel : public RtpHelper { - public: - explicit FakeVideoMediaChannel(FakeVideoEngine* engine, - const VideoOptions& options) - : engine_(engine), - sent_intra_frame_(false), - requested_intra_frame_(false), - max_bps_(-1) { - SetOptions(options); - } - - ~FakeVideoMediaChannel(); - - const std::vector& recv_codecs() const { return recv_codecs_; } - const std::vector& send_codecs() const { return send_codecs_; } - const std::vector& codecs() const { return send_codecs(); } - bool rendering() const { return playout(); } - const VideoOptions& options() const { return options_; } - const std::map& renderers() const { - return renderers_; - } - int max_bps() const { return max_bps_; } - bool GetSendStreamFormat(uint32_t ssrc, VideoFormat* format) { - if (send_formats_.find(ssrc) == send_formats_.end()) { - return false; - } - *format = send_formats_[ssrc]; - return true; - } - virtual bool SetSendStreamFormat(uint32_t ssrc, const VideoFormat& format) { - if (send_formats_.find(ssrc) == send_formats_.end()) { - return false; - } - send_formats_[ssrc] = format; - return true; - } - virtual bool SetSendParameters(const VideoSendParameters& params) { - return (SetSendCodecs(params.codecs) && - SetSendRtpHeaderExtensions(params.extensions) && - SetMaxSendBandwidth(params.max_bandwidth_bps) && - SetOptions(params.options)); - } - - virtual bool SetRecvParameters(const VideoRecvParameters& params) { - return (SetRecvCodecs(params.codecs) && - SetRecvRtpHeaderExtensions(params.extensions)); - } - virtual bool AddSendStream(const StreamParams& sp) { - if (!RtpHelper::AddSendStream(sp)) { - return false; - } - SetSendStreamDefaultFormat(sp.first_ssrc()); - return true; - } - virtual bool RemoveSendStream(uint32_t ssrc) { - send_formats_.erase(ssrc); - return RtpHelper::RemoveSendStream(ssrc); - } - - virtual bool GetSendCodec(VideoCodec* send_codec) { - if (send_codecs_.empty()) { - return false; - } - *send_codec = send_codecs_[0]; - return true; - } - virtual bool SetRenderer(uint32_t ssrc, VideoRenderer* r) { - if (ssrc != 0 && renderers_.find(ssrc) == renderers_.end()) { - return false; - } - if (ssrc != 0) { - renderers_[ssrc] = r; - } - return true; - } - - virtual bool SetSend(bool send) { return set_sending(send); } - virtual bool SetVideoSend(uint32_t ssrc, bool enable, - const VideoOptions* options) { - if (!RtpHelper::MuteStream(ssrc, !enable)) { - return false; - } - if (enable && options) { - return SetOptions(*options); - } - return true; - } - virtual bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { - capturers_[ssrc] = capturer; - return true; - } - bool HasCapturer(uint32_t ssrc) const { - return capturers_.find(ssrc) != capturers_.end(); - } - virtual bool AddRecvStream(const StreamParams& sp) { - if (!RtpHelper::AddRecvStream(sp)) - return false; - renderers_[sp.first_ssrc()] = NULL; - return true; - } - virtual bool RemoveRecvStream(uint32_t ssrc) { - if (!RtpHelper::RemoveRecvStream(ssrc)) - return false; - renderers_.erase(ssrc); - return true; - } - - virtual bool GetStats(VideoMediaInfo* info) { return false; } - virtual bool SendIntraFrame() { - sent_intra_frame_ = true; - return true; - } - virtual bool RequestIntraFrame() { - requested_intra_frame_ = true; - return true; - } - virtual void UpdateAspectRatio(int ratio_w, int ratio_h) {} - void set_sent_intra_frame(bool v) { sent_intra_frame_ = v; } - bool sent_intra_frame() const { return sent_intra_frame_; } - void set_requested_intra_frame(bool v) { requested_intra_frame_ = v; } - bool requested_intra_frame() const { return requested_intra_frame_; } - - private: - bool SetRecvCodecs(const std::vector& codecs) { - if (fail_set_recv_codecs()) { - // Fake the failure in SetRecvCodecs. - return false; - } - recv_codecs_ = codecs; - return true; - } - bool SetSendCodecs(const std::vector& codecs) { - if (fail_set_send_codecs()) { - // Fake the failure in SetSendCodecs. - return false; - } - send_codecs_ = codecs; - - for (std::vector::const_iterator it = send_streams().begin(); - it != send_streams().end(); ++it) { - SetSendStreamDefaultFormat(it->first_ssrc()); - } - return true; - } - bool SetOptions(const VideoOptions& options) { - options_ = options; - return true; - } - bool SetMaxSendBandwidth(int bps) { - max_bps_ = bps; - return true; - } - - // Be default, each send stream uses the first send codec format. - void SetSendStreamDefaultFormat(uint32_t ssrc) { - if (!send_codecs_.empty()) { - send_formats_[ssrc] = VideoFormat( - send_codecs_[0].width, send_codecs_[0].height, - cricket::VideoFormat::FpsToInterval(send_codecs_[0].framerate), - cricket::FOURCC_I420); - } - } - - FakeVideoEngine* engine_; - std::vector recv_codecs_; - std::vector send_codecs_; - std::map renderers_; - std::map send_formats_; - std::map capturers_; - bool sent_intra_frame_; - bool requested_intra_frame_; - VideoOptions options_; - int max_bps_; -}; - -class FakeDataMediaChannel : public RtpHelper { - public: - explicit FakeDataMediaChannel(void* unused, const DataOptions& options) - : send_blocked_(false), max_bps_(-1) {} - ~FakeDataMediaChannel() {} - const std::vector& recv_codecs() const { return recv_codecs_; } - const std::vector& send_codecs() const { return send_codecs_; } - const std::vector& codecs() const { return send_codecs(); } - int max_bps() const { return max_bps_; } - - virtual bool SetSendParameters(const DataSendParameters& params) { - return (SetSendCodecs(params.codecs) && - SetMaxSendBandwidth(params.max_bandwidth_bps)); - } - virtual bool SetRecvParameters(const DataRecvParameters& params) { - return SetRecvCodecs(params.codecs); - } - virtual bool SetSend(bool send) { return set_sending(send); } - virtual bool SetReceive(bool receive) { - set_playout(receive); - return true; - } - virtual bool AddRecvStream(const StreamParams& sp) { - if (!RtpHelper::AddRecvStream(sp)) - return false; - return true; - } - virtual bool RemoveRecvStream(uint32_t ssrc) { - if (!RtpHelper::RemoveRecvStream(ssrc)) - return false; - return true; - } - - virtual bool SendData(const SendDataParams& params, - const rtc::Buffer& payload, - SendDataResult* result) { - if (send_blocked_) { - *result = SDR_BLOCK; - return false; - } else { - last_sent_data_params_ = params; - last_sent_data_ = std::string(payload.data(), payload.size()); - return true; - } - } - - SendDataParams last_sent_data_params() { return last_sent_data_params_; } - std::string last_sent_data() { return last_sent_data_; } - bool is_send_blocked() { return send_blocked_; } - void set_send_blocked(bool blocked) { send_blocked_ = blocked; } - - private: - bool SetRecvCodecs(const std::vector& codecs) { - if (fail_set_recv_codecs()) { - // Fake the failure in SetRecvCodecs. - return false; - } - recv_codecs_ = codecs; - return true; - } - bool SetSendCodecs(const std::vector& codecs) { - if (fail_set_send_codecs()) { - // Fake the failure in SetSendCodecs. - return false; - } - send_codecs_ = codecs; - return true; - } - bool SetMaxSendBandwidth(int bps) { - max_bps_ = bps; - return true; - } - - std::vector recv_codecs_; - std::vector send_codecs_; - SendDataParams last_sent_data_params_; - std::string last_sent_data_; - bool send_blocked_; - int max_bps_; -}; - -// A base class for all of the shared parts between FakeVoiceEngine -// and FakeVideoEngine. -class FakeBaseEngine { - public: - FakeBaseEngine() - : options_changed_(false), - fail_create_channel_(false) {} - void set_fail_create_channel(bool fail) { fail_create_channel_ = fail; } - - RtpCapabilities GetCapabilities() const { return capabilities_; } - void set_rtp_header_extensions( - const std::vector& extensions) { - capabilities_.header_extensions = extensions; - } - - protected: - // Flag used by optionsmessagehandler_unittest for checking whether any - // relevant setting has been updated. - // TODO(thaloun): Replace with explicit checks of before & after values. - bool options_changed_; - bool fail_create_channel_; - RtpCapabilities capabilities_; -}; - -class FakeVoiceEngine : public FakeBaseEngine { - public: - FakeVoiceEngine() - : output_volume_(-1) { - // Add a fake audio codec. Note that the name must not be "" as there are - // sanity checks against that. - codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); - } - bool Init(rtc::Thread* worker_thread) { return true; } - void Terminate() {} - rtc::scoped_refptr GetAudioState() const { - return rtc::scoped_refptr(); - } - - VoiceMediaChannel* CreateChannel(webrtc::Call* call, - const AudioOptions& options) { - if (fail_create_channel_) { - return nullptr; - } - - FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this, options); - channels_.push_back(ch); - return ch; - } - FakeVoiceMediaChannel* GetChannel(size_t index) { - return (channels_.size() > index) ? channels_[index] : NULL; - } - void UnregisterChannel(VoiceMediaChannel* channel) { - channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); - } - - const std::vector& codecs() { return codecs_; } - void SetCodecs(const std::vector codecs) { codecs_ = codecs; } - - bool GetOutputVolume(int* level) { - *level = output_volume_; - return true; - } - bool SetOutputVolume(int level) { - output_volume_ = level; - return true; - } - - int GetInputLevel() { return 0; } - - bool StartAecDump(rtc::PlatformFile file) { return false; } - - void StopAecDump() {} - - bool StartRtcEventLog(rtc::PlatformFile file) { return false; } - - void StopRtcEventLog() {} - - private: - std::vector channels_; - std::vector codecs_; - int output_volume_; - - friend class FakeMediaEngine; -}; - -class FakeVideoEngine : public FakeBaseEngine { - public: - FakeVideoEngine() : capture_(false) { - // Add a fake video codec. Note that the name must not be "" as there are - // sanity checks against that. - codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); - } - void Init() {} - bool SetOptions(const VideoOptions& options) { - options_ = options; - options_changed_ = true; - return true; - } - - VideoMediaChannel* CreateChannel(webrtc::Call* call, - const VideoOptions& options) { - if (fail_create_channel_) { - return NULL; - } - - FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this, options); - channels_.push_back(ch); - return ch; - } - FakeVideoMediaChannel* GetChannel(size_t index) { - return (channels_.size() > index) ? channels_[index] : NULL; - } - void UnregisterChannel(VideoMediaChannel* channel) { - channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); - } - - const std::vector& codecs() const { return codecs_; } - bool FindCodec(const VideoCodec& in) { - for (size_t i = 0; i < codecs_.size(); ++i) { - if (codecs_[i].Matches(in)) { - return true; - } - } - return false; - } - void SetCodecs(const std::vector codecs) { codecs_ = codecs; } - - bool SetCaptureDevice(const Device* device) { - in_device_ = (device) ? device->name : ""; - options_changed_ = true; - return true; - } - bool SetCapture(bool capture) { - capture_ = capture; - return true; - } - - private: - std::vector channels_; - std::vector codecs_; - std::string in_device_; - bool capture_; - VideoOptions options_; - - friend class FakeMediaEngine; -}; - -class FakeMediaEngine : - public CompositeMediaEngine { - public: - FakeMediaEngine() {} - virtual ~FakeMediaEngine() {} - - void SetAudioCodecs(const std::vector& codecs) { - voice_.SetCodecs(codecs); - } - void SetVideoCodecs(const std::vector& codecs) { - video_.SetCodecs(codecs); - } - - void SetAudioRtpHeaderExtensions( - const std::vector& extensions) { - voice_.set_rtp_header_extensions(extensions); - } - void SetVideoRtpHeaderExtensions( - const std::vector& extensions) { - video_.set_rtp_header_extensions(extensions); - } - - FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { - return voice_.GetChannel(index); - } - FakeVideoMediaChannel* GetVideoChannel(size_t index) { - return video_.GetChannel(index); - } - - int output_volume() const { return voice_.output_volume_; } - bool capture() const { return video_.capture_; } - bool options_changed() const { - return video_.options_changed_; - } - void clear_options_changed() { - video_.options_changed_ = false; - } - void set_fail_create_channel(bool fail) { - voice_.set_fail_create_channel(fail); - video_.set_fail_create_channel(fail); - } -}; - -// CompositeMediaEngine with FakeVoiceEngine to expose SetAudioCodecs to -// establish a media connectionwith minimum set of audio codes required -template -class CompositeMediaEngineWithFakeVoiceEngine : - public CompositeMediaEngine { - public: - CompositeMediaEngineWithFakeVoiceEngine() {} - virtual ~CompositeMediaEngineWithFakeVoiceEngine() {} - - virtual void SetAudioCodecs(const std::vector& codecs) { - CompositeMediaEngine::voice_.SetCodecs(codecs); - } -}; - -// Have to come afterwards due to declaration order -inline FakeVoiceMediaChannel::~FakeVoiceMediaChannel() { - if (engine_) { - engine_->UnregisterChannel(this); - } -} - -inline FakeVideoMediaChannel::~FakeVideoMediaChannel() { - if (engine_) { - engine_->UnregisterChannel(this); - } -} - -class FakeDataEngine : public DataEngineInterface { - public: - FakeDataEngine() : last_channel_type_(DCT_NONE) {} - - virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type) { - last_channel_type_ = data_channel_type; - FakeDataMediaChannel* ch = new FakeDataMediaChannel(this, DataOptions()); - channels_.push_back(ch); - return ch; - } - - FakeDataMediaChannel* GetChannel(size_t index) { - return (channels_.size() > index) ? channels_[index] : NULL; - } - - void UnregisterChannel(DataMediaChannel* channel) { - channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); - } - - virtual void SetDataCodecs(const std::vector& data_codecs) { - data_codecs_ = data_codecs; - } - - virtual const std::vector& data_codecs() { return data_codecs_; } - - DataChannelType last_channel_type() const { return last_channel_type_; } - - private: - std::vector channels_; - std::vector data_codecs_; - DataChannelType last_channel_type_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ diff --git a/include/talk/media/base/fakenetworkinterface.h b/include/talk/media/base/fakenetworkinterface.h deleted file mode 100644 index 418dfef..0000000 --- a/include/talk/media/base/fakenetworkinterface.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_FAKENETWORKINTERFACE_H_ -#define TALK_MEDIA_BASE_FAKENETWORKINTERFACE_H_ - -#include -#include - -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/rtputils.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/byteorder.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/dscp.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -// Fake NetworkInterface that sends/receives RTP/RTCP packets. -class FakeNetworkInterface : public MediaChannel::NetworkInterface, - public rtc::MessageHandler { - public: - FakeNetworkInterface() - : thread_(rtc::Thread::Current()), - dest_(NULL), - conf_(false), - sendbuf_size_(-1), - recvbuf_size_(-1), - dscp_(rtc::DSCP_NO_CHANGE) { - } - - void SetDestination(MediaChannel* dest) { dest_ = dest; } - - // Conference mode is a mode where instead of simply forwarding the packets, - // the transport will send multiple copies of the packet with the specified - // SSRCs. This allows us to simulate receiving media from multiple sources. - void SetConferenceMode(bool conf, const std::vector& ssrcs) { - rtc::CritScope cs(&crit_); - conf_ = conf; - conf_sent_ssrcs_ = ssrcs; - } - - int NumRtpBytes() { - rtc::CritScope cs(&crit_); - int bytes = 0; - for (size_t i = 0; i < rtp_packets_.size(); ++i) { - bytes += static_cast(rtp_packets_[i].size()); - } - return bytes; - } - - int NumRtpBytes(uint32_t ssrc) { - rtc::CritScope cs(&crit_); - int bytes = 0; - GetNumRtpBytesAndPackets(ssrc, &bytes, NULL); - return bytes; - } - - int NumRtpPackets() { - rtc::CritScope cs(&crit_); - return static_cast(rtp_packets_.size()); - } - - int NumRtpPackets(uint32_t ssrc) { - rtc::CritScope cs(&crit_); - int packets = 0; - GetNumRtpBytesAndPackets(ssrc, NULL, &packets); - return packets; - } - - int NumSentSsrcs() { - rtc::CritScope cs(&crit_); - return static_cast(sent_ssrcs_.size()); - } - - // Note: callers are responsible for deleting the returned buffer. - const rtc::Buffer* GetRtpPacket(int index) { - rtc::CritScope cs(&crit_); - if (index >= NumRtpPackets()) { - return NULL; - } - return new rtc::Buffer(rtp_packets_[index]); - } - - int NumRtcpPackets() { - rtc::CritScope cs(&crit_); - return static_cast(rtcp_packets_.size()); - } - - // Note: callers are responsible for deleting the returned buffer. - const rtc::Buffer* GetRtcpPacket(int index) { - rtc::CritScope cs(&crit_); - if (index >= NumRtcpPackets()) { - return NULL; - } - return new rtc::Buffer(rtcp_packets_[index]); - } - - int sendbuf_size() const { return sendbuf_size_; } - int recvbuf_size() const { return recvbuf_size_; } - rtc::DiffServCodePoint dscp() const { return dscp_; } - - protected: - virtual bool SendPacket(rtc::Buffer* packet, - const rtc::PacketOptions& options) { - rtc::CritScope cs(&crit_); - - uint32_t cur_ssrc = 0; - if (!GetRtpSsrc(packet->data(), packet->size(), &cur_ssrc)) { - return false; - } - sent_ssrcs_[cur_ssrc]++; - - rtp_packets_.push_back(*packet); - if (conf_) { - rtc::Buffer buffer_copy(*packet); - for (size_t i = 0; i < conf_sent_ssrcs_.size(); ++i) { - if (!SetRtpSsrc(buffer_copy.data(), buffer_copy.size(), - conf_sent_ssrcs_[i])) { - return false; - } - PostMessage(ST_RTP, buffer_copy); - } - } else { - PostMessage(ST_RTP, *packet); - } - return true; - } - - virtual bool SendRtcp(rtc::Buffer* packet, - const rtc::PacketOptions& options) { - rtc::CritScope cs(&crit_); - rtcp_packets_.push_back(*packet); - if (!conf_) { - // don't worry about RTCP in conf mode for now - PostMessage(ST_RTCP, *packet); - } - return true; - } - - virtual int SetOption(SocketType type, rtc::Socket::Option opt, - int option) { - if (opt == rtc::Socket::OPT_SNDBUF) { - sendbuf_size_ = option; - } else if (opt == rtc::Socket::OPT_RCVBUF) { - recvbuf_size_ = option; - } else if (opt == rtc::Socket::OPT_DSCP) { - dscp_ = static_cast(option); - } - return 0; - } - - void PostMessage(int id, const rtc::Buffer& packet) { - thread_->Post(this, id, rtc::WrapMessageData(packet)); - } - - virtual void OnMessage(rtc::Message* msg) { - rtc::TypedMessageData* msg_data = - static_cast*>( - msg->pdata); - if (dest_) { - if (msg->message_id == ST_RTP) { - dest_->OnPacketReceived(&msg_data->data(), - rtc::CreatePacketTime(0)); - } else { - dest_->OnRtcpReceived(&msg_data->data(), - rtc::CreatePacketTime(0)); - } - } - delete msg_data; - } - - private: - void GetNumRtpBytesAndPackets(uint32_t ssrc, int* bytes, int* packets) { - if (bytes) { - *bytes = 0; - } - if (packets) { - *packets = 0; - } - uint32_t cur_ssrc = 0; - for (size_t i = 0; i < rtp_packets_.size(); ++i) { - if (!GetRtpSsrc(rtp_packets_[i].data(), rtp_packets_[i].size(), - &cur_ssrc)) { - return; - } - if (ssrc == cur_ssrc) { - if (bytes) { - *bytes += static_cast(rtp_packets_[i].size()); - } - if (packets) { - ++(*packets); - } - } - } - } - - rtc::Thread* thread_; - MediaChannel* dest_; - bool conf_; - // The ssrcs used in sending out packets in conference mode. - std::vector conf_sent_ssrcs_; - // Map to track counts of packets that have been sent per ssrc. - // This includes packets that are dropped. - std::map sent_ssrcs_; - // Map to track packet-number that needs to be dropped per ssrc. - std::map > drop_map_; - rtc::CriticalSection crit_; - std::vector rtp_packets_; - std::vector rtcp_packets_; - int sendbuf_size_; - int recvbuf_size_; - rtc::DiffServCodePoint dscp_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_FAKENETWORKINTERFACE_H_ diff --git a/include/talk/media/base/fakertp.h b/include/talk/media/base/fakertp.h deleted file mode 100644 index 7c56cba..0000000 --- a/include/talk/media/base/fakertp.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Fake RTP and RTCP packets to use in unit tests. - -#ifndef TALK_MEDIA_BASE_FAKERTP_H_ -#define TALK_MEDIA_BASE_FAKERTP_H_ - -// A typical PCMU RTP packet. -// PT=0, SN=1, TS=0, SSRC=1 -// all data FF -static const unsigned char kPcmuFrame[] = { - 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, -}; - -// A typical Receiver Report RTCP packet. -// PT=RR, LN=1, SSRC=1 -// send SSRC=2, all other fields 0 -static const unsigned char kRtcpReport[] = { - 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -// PT = 97, TS = 0, Seq = 1, SSRC = 2 -// H264 - NRI = 1, Type = 1, bit stream = FF - -static const unsigned char kH264Packet[] = { - 0x80, 0x61, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x21, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, -}; - -// PT= 101, SN=2, TS=3, SSRC = 4 -static const unsigned char kDataPacket[] = { - 0x80, 0x65, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0x00, - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, -}; - -#endif // TALK_MEDIA_BASE_FAKERTP_H_ diff --git a/include/talk/media/base/fakescreencapturerfactory.h b/include/talk/media/base/fakescreencapturerfactory.h deleted file mode 100755 index dfd7376..0000000 --- a/include/talk/media/base/fakescreencapturerfactory.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_FAKESCREENCAPTURERFACTORY_H_ -#define TALK_MEDIA_BASE_FAKESCREENCAPTURERFACTORY_H_ - -#include "talk/media/base/fakevideocapturer.h" -#include "talk/media/base/videocapturerfactory.h" - -namespace cricket { - -class FakeScreenCapturerFactory - : public cricket::ScreenCapturerFactory, - public sigslot::has_slots<> { - public: - FakeScreenCapturerFactory() - : window_capturer_(NULL), - capture_state_(cricket::CS_STOPPED) {} - - virtual cricket::VideoCapturer* Create(const ScreencastId& window) { - if (window_capturer_ != NULL) { - return NULL; - } - window_capturer_ = new cricket::FakeVideoCapturer; - window_capturer_->SignalDestroyed.connect( - this, - &FakeScreenCapturerFactory::OnWindowCapturerDestroyed); - window_capturer_->SignalStateChange.connect( - this, - &FakeScreenCapturerFactory::OnStateChange); - return window_capturer_; - } - - cricket::FakeVideoCapturer* window_capturer() { return window_capturer_; } - - cricket::CaptureState capture_state() { return capture_state_; } - - private: - void OnWindowCapturerDestroyed(cricket::FakeVideoCapturer* capturer) { - if (capturer == window_capturer_) { - window_capturer_ = NULL; - } - } - void OnStateChange(cricket::VideoCapturer*, cricket::CaptureState state) { - capture_state_ = state; - } - - cricket::FakeVideoCapturer* window_capturer_; - cricket::CaptureState capture_state_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_FAKESCREENCAPTURERFACTORY_H_ diff --git a/include/talk/media/base/fakevideocapturer.h b/include/talk/media/base/fakevideocapturer.h deleted file mode 100644 index a668ea7..0000000 --- a/include/talk/media/base/fakevideocapturer.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ -#define TALK_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ - -#include - -#include - -#include "talk/media/base/videocapturer.h" -#include "talk/media/base/videocommon.h" -#include "talk/media/base/videoframe.h" -#include "webrtc/base/timeutils.h" -#ifdef HAVE_WEBRTC_VIDEO -#include "talk/media/webrtc/webrtcvideoframefactory.h" -#endif - -namespace cricket { - -// Fake video capturer that allows the test to manually pump in frames. -class FakeVideoCapturer : public cricket::VideoCapturer { - public: - FakeVideoCapturer() - : running_(false), - initial_unix_timestamp_(time(NULL) * rtc::kNumNanosecsPerSec), - next_timestamp_(rtc::kNumNanosecsPerMillisec), - is_screencast_(false), - rotation_(webrtc::kVideoRotation_0) { -#ifdef HAVE_WEBRTC_VIDEO - set_frame_factory(new cricket::WebRtcVideoFrameFactory()); -#endif - // Default supported formats. Use ResetSupportedFormats to over write. - std::vector formats; - formats.push_back(cricket::VideoFormat(1280, 720, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(640, 480, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(320, 240, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(160, 120, - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); - formats.push_back(cricket::VideoFormat(1280, 720, - cricket::VideoFormat::FpsToInterval(60), cricket::FOURCC_I420)); - ResetSupportedFormats(formats); - } - ~FakeVideoCapturer() { - SignalDestroyed(this); - } - - void ResetSupportedFormats(const std::vector& formats) { - SetSupportedFormats(formats); - } - bool CaptureFrame() { - if (!GetCaptureFormat()) { - return false; - } - return CaptureCustomFrame(GetCaptureFormat()->width, - GetCaptureFormat()->height, - GetCaptureFormat()->interval, - GetCaptureFormat()->fourcc); - } - bool CaptureCustomFrame(int width, int height, uint32_t fourcc) { - // default to 30fps - return CaptureCustomFrame(width, height, 33333333, fourcc); - } - bool CaptureCustomFrame(int width, - int height, - int64_t timestamp_interval, - uint32_t fourcc) { - if (!running_) { - return false; - } - // Currently, |fourcc| is always I420 or ARGB. - // TODO(fbarchard): Extend SizeOf to take fourcc. - uint32_t size = 0u; - if (fourcc == cricket::FOURCC_ARGB) { - size = width * 4 * height; - } else if (fourcc == cricket::FOURCC_I420) { - size = static_cast(cricket::VideoFrame::SizeOf(width, height)); - } else { - return false; // Unsupported FOURCC. - } - if (size == 0u) { - return false; // Width and/or Height were zero. - } - - cricket::CapturedFrame frame; - frame.width = width; - frame.height = height; - frame.fourcc = fourcc; - frame.data_size = size; - frame.time_stamp = initial_unix_timestamp_ + next_timestamp_; - next_timestamp_ += timestamp_interval; - - rtc::scoped_ptr data(new char[size]); - frame.data = data.get(); - // Copy something non-zero into the buffer so Validate wont complain that - // the frame is all duplicate. - memset(frame.data, 1, size / 2); - memset(reinterpret_cast(frame.data) + (size / 2), 2, - size - (size / 2)); - memcpy(frame.data, reinterpret_cast(&fourcc), 4); - frame.rotation = rotation_; - // TODO(zhurunz): SignalFrameCaptured carry returned value to be able to - // capture results from downstream. - SignalFrameCaptured(this, &frame); - return true; - } - - void SignalCapturedFrame(cricket::CapturedFrame* frame) { - SignalFrameCaptured(this, frame); - } - - sigslot::signal1 SignalDestroyed; - - virtual cricket::CaptureState Start(const cricket::VideoFormat& format) { - cricket::VideoFormat supported; - if (GetBestCaptureFormat(format, &supported)) { - SetCaptureFormat(&supported); - } - running_ = true; - SetCaptureState(cricket::CS_RUNNING); - return cricket::CS_RUNNING; - } - virtual void Stop() { - running_ = false; - SetCaptureFormat(NULL); - SetCaptureState(cricket::CS_STOPPED); - } - virtual bool IsRunning() { return running_; } - void SetScreencast(bool is_screencast) { - is_screencast_ = is_screencast; - } - virtual bool IsScreencast() const { return is_screencast_; } - bool GetPreferredFourccs(std::vector* fourccs) { - fourccs->push_back(cricket::FOURCC_I420); - fourccs->push_back(cricket::FOURCC_MJPG); - return true; - } - - void SetRotation(webrtc::VideoRotation rotation) { - rotation_ = rotation; - } - - webrtc::VideoRotation GetRotation() { return rotation_; } - - private: - bool running_; - int64_t initial_unix_timestamp_; - int64_t next_timestamp_; - bool is_screencast_; - webrtc::VideoRotation rotation_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ diff --git a/include/talk/media/base/fakevideorenderer.h b/include/talk/media/base/fakevideorenderer.h deleted file mode 100644 index c6a1c24..0000000 --- a/include/talk/media/base/fakevideorenderer.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_ -#define TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_ - -#include "talk/media/base/videoframe.h" -#include "talk/media/base/videorenderer.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/sigslot.h" - -namespace cricket { - -// Faked video renderer that has a callback for actions on rendering. -class FakeVideoRenderer : public VideoRenderer { - public: - FakeVideoRenderer() - : errors_(0), - width_(0), - height_(0), - num_set_sizes_(0), - num_rendered_frames_(0), - black_frame_(false) { - } - - virtual bool SetSize(int width, int height, int reserved) { - rtc::CritScope cs(&crit_); - width_ = width; - height_ = height; - ++num_set_sizes_; - SignalSetSize(width, height, reserved); - return true; - } - - virtual bool RenderFrame(const VideoFrame* frame) { - rtc::CritScope cs(&crit_); - // TODO(zhurunz) Check with VP8 team to see if we can remove this - // tolerance on Y values. - black_frame_ = CheckFrameColorYuv(6, 48, 128, 128, 128, 128, frame); - // Treat unexpected frame size as error. - if (!frame || - frame->GetWidth() != static_cast(width_) || - frame->GetHeight() != static_cast(height_)) { - if (!frame) { - LOG(LS_WARNING) << "RenderFrame expected non-null frame."; - } else { - LOG(LS_WARNING) << "RenderFrame expected frame of size " << width_ - << "x" << height_ << " but received frame of size " - << frame->GetWidth() << "x" << frame->GetHeight(); - } - ++errors_; - return false; - } - ++num_rendered_frames_; - SignalRenderFrame(frame); - return true; - } - - int errors() const { return errors_; } - int width() const { - rtc::CritScope cs(&crit_); - return width_; - } - int height() const { - rtc::CritScope cs(&crit_); - return height_; - } - int num_set_sizes() const { - rtc::CritScope cs(&crit_); - return num_set_sizes_; - } - int num_rendered_frames() const { - rtc::CritScope cs(&crit_); - return num_rendered_frames_; - } - bool black_frame() const { - rtc::CritScope cs(&crit_); - return black_frame_; - } - - sigslot::signal3 SignalSetSize; - sigslot::signal1 SignalRenderFrame; - - private: - static bool CheckFrameColorYuv(uint8_t y_min, - uint8_t y_max, - uint8_t u_min, - uint8_t u_max, - uint8_t v_min, - uint8_t v_max, - const cricket::VideoFrame* frame) { - if (!frame) { - return false; - } - // Y - size_t y_width = frame->GetWidth(); - size_t y_height = frame->GetHeight(); - const uint8_t* y_plane = frame->GetYPlane(); - const uint8_t* y_pos = y_plane; - int32_t y_pitch = frame->GetYPitch(); - for (size_t i = 0; i < y_height; ++i) { - for (size_t j = 0; j < y_width; ++j) { - uint8_t y_value = *(y_pos + j); - if (y_value < y_min || y_value > y_max) { - return false; - } - } - y_pos += y_pitch; - } - // U and V - size_t chroma_width = frame->GetChromaWidth(); - size_t chroma_height = frame->GetChromaHeight(); - const uint8_t* u_plane = frame->GetUPlane(); - const uint8_t* v_plane = frame->GetVPlane(); - const uint8_t* u_pos = u_plane; - const uint8_t* v_pos = v_plane; - int32_t u_pitch = frame->GetUPitch(); - int32_t v_pitch = frame->GetVPitch(); - for (size_t i = 0; i < chroma_height; ++i) { - for (size_t j = 0; j < chroma_width; ++j) { - uint8_t u_value = *(u_pos + j); - if (u_value < u_min || u_value > u_max) { - return false; - } - uint8_t v_value = *(v_pos + j); - if (v_value < v_min || v_value > v_max) { - return false; - } - } - u_pos += u_pitch; - v_pos += v_pitch; - } - return true; - } - - int errors_; - int width_; - int height_; - int num_set_sizes_; - int num_rendered_frames_; - bool black_frame_; - mutable rtc::CriticalSection crit_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_ diff --git a/include/talk/media/base/hybriddataengine.h b/include/talk/media/base/hybriddataengine.h deleted file mode 100644 index cbdfa8a..0000000 --- a/include/talk/media/base/hybriddataengine.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. and Robin Seggelmann - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_SCTP_HYBRIDDATAENGINE_H_ -#define TALK_MEDIA_SCTP_HYBRIDDATAENGINE_H_ - -#include -#include - -#include "talk/media/base/codec.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/mediaengine.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -class HybridDataEngine : public DataEngineInterface { - public: - // Takes ownership. - HybridDataEngine(DataEngineInterface* first, - DataEngineInterface* second) - : first_(first), - second_(second) { - codecs_ = first_->data_codecs(); - codecs_.insert( - codecs_.end(), - second_->data_codecs().begin(), - second_->data_codecs().end()); - } - - virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type) { - DataMediaChannel* channel = NULL; - if (first_) { - channel = first_->CreateChannel(data_channel_type); - } - if (!channel && second_) { - channel = second_->CreateChannel(data_channel_type); - } - return channel; - } - - virtual const std::vector& data_codecs() { return codecs_; } - - private: - rtc::scoped_ptr first_; - rtc::scoped_ptr second_; - std::vector codecs_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_SCTP_HYBRIDDATAENGINE_H_ diff --git a/include/talk/media/base/mediachannel.h b/include/talk/media/base/mediachannel.h deleted file mode 100644 index f6fb77d..0000000 --- a/include/talk/media/base/mediachannel.h +++ /dev/null @@ -1,1227 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_MEDIACHANNEL_H_ -#define TALK_MEDIA_BASE_MEDIACHANNEL_H_ - -#include -#include - -#include "talk/media/base/codec.h" -#include "talk/media/base/constants.h" -#include "talk/media/base/streamparams.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/dscp.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/optional.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socket.h" -#include "webrtc/base/window.h" -// TODO(juberti): re-evaluate this include -#include "talk/session/media/audiomonitor.h" - -namespace rtc { -class Buffer; -class RateLimiter; -class Timing; -} - -namespace webrtc { -class AudioSinkInterface; -} - -namespace cricket { - -class AudioRenderer; -class ScreencastId; -class VideoCapturer; -class VideoRenderer; -struct RtpHeader; -struct VideoFormat; - -const int kMinRtpHeaderExtensionId = 1; -const int kMaxRtpHeaderExtensionId = 255; -const int kScreencastDefaultFps = 5; - -template -static std::string ToStringIfSet(const char* key, const rtc::Optional& val) { - std::string str; - if (val) { - str = key; - str += ": "; - str += val ? rtc::ToString(*val) : ""; - str += ", "; - } - return str; -} - -template -static std::string VectorToString(const std::vector& vals) { - std::ostringstream ost; - ost << "["; - for (size_t i = 0; i < vals.size(); ++i) { - if (i > 0) { - ost << ", "; - } - ost << vals[i].ToString(); - } - ost << "]"; - return ost.str(); -} - -// Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine. -// Used to be flags, but that makes it hard to selectively apply options. -// We are moving all of the setting of options to structs like this, -// but some things currently still use flags. -struct AudioOptions { - void SetAll(const AudioOptions& change) { - SetFrom(&echo_cancellation, change.echo_cancellation); - SetFrom(&auto_gain_control, change.auto_gain_control); - SetFrom(&noise_suppression, change.noise_suppression); - SetFrom(&highpass_filter, change.highpass_filter); - SetFrom(&stereo_swapping, change.stereo_swapping); - SetFrom(&audio_jitter_buffer_max_packets, - change.audio_jitter_buffer_max_packets); - SetFrom(&audio_jitter_buffer_fast_accelerate, - change.audio_jitter_buffer_fast_accelerate); - SetFrom(&typing_detection, change.typing_detection); - SetFrom(&aecm_generate_comfort_noise, change.aecm_generate_comfort_noise); - SetFrom(&conference_mode, change.conference_mode); - SetFrom(&adjust_agc_delta, change.adjust_agc_delta); - SetFrom(&experimental_agc, change.experimental_agc); - SetFrom(&extended_filter_aec, change.extended_filter_aec); - SetFrom(&delay_agnostic_aec, change.delay_agnostic_aec); - SetFrom(&experimental_ns, change.experimental_ns); - SetFrom(&aec_dump, change.aec_dump); - SetFrom(&tx_agc_target_dbov, change.tx_agc_target_dbov); - SetFrom(&tx_agc_digital_compression_gain, - change.tx_agc_digital_compression_gain); - SetFrom(&tx_agc_limiter, change.tx_agc_limiter); - SetFrom(&recording_sample_rate, change.recording_sample_rate); - SetFrom(&playout_sample_rate, change.playout_sample_rate); - SetFrom(&dscp, change.dscp); - SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe); - } - - bool operator==(const AudioOptions& o) const { - return echo_cancellation == o.echo_cancellation && - auto_gain_control == o.auto_gain_control && - noise_suppression == o.noise_suppression && - highpass_filter == o.highpass_filter && - stereo_swapping == o.stereo_swapping && - audio_jitter_buffer_max_packets == o.audio_jitter_buffer_max_packets && - audio_jitter_buffer_fast_accelerate == - o.audio_jitter_buffer_fast_accelerate && - typing_detection == o.typing_detection && - aecm_generate_comfort_noise == o.aecm_generate_comfort_noise && - conference_mode == o.conference_mode && - experimental_agc == o.experimental_agc && - extended_filter_aec == o.extended_filter_aec && - delay_agnostic_aec == o.delay_agnostic_aec && - experimental_ns == o.experimental_ns && - adjust_agc_delta == o.adjust_agc_delta && - aec_dump == o.aec_dump && - tx_agc_target_dbov == o.tx_agc_target_dbov && - tx_agc_digital_compression_gain == o.tx_agc_digital_compression_gain && - tx_agc_limiter == o.tx_agc_limiter && - recording_sample_rate == o.recording_sample_rate && - playout_sample_rate == o.playout_sample_rate && - dscp == o.dscp && - combined_audio_video_bwe == o.combined_audio_video_bwe; - } - - std::string ToString() const { - std::ostringstream ost; - ost << "AudioOptions {"; - ost << ToStringIfSet("aec", echo_cancellation); - ost << ToStringIfSet("agc", auto_gain_control); - ost << ToStringIfSet("ns", noise_suppression); - ost << ToStringIfSet("hf", highpass_filter); - ost << ToStringIfSet("swap", stereo_swapping); - ost << ToStringIfSet("audio_jitter_buffer_max_packets", - audio_jitter_buffer_max_packets); - ost << ToStringIfSet("audio_jitter_buffer_fast_accelerate", - audio_jitter_buffer_fast_accelerate); - ost << ToStringIfSet("typing", typing_detection); - ost << ToStringIfSet("comfort_noise", aecm_generate_comfort_noise); - ost << ToStringIfSet("conference", conference_mode); - ost << ToStringIfSet("agc_delta", adjust_agc_delta); - ost << ToStringIfSet("experimental_agc", experimental_agc); - ost << ToStringIfSet("extended_filter_aec", extended_filter_aec); - ost << ToStringIfSet("delay_agnostic_aec", delay_agnostic_aec); - ost << ToStringIfSet("experimental_ns", experimental_ns); - ost << ToStringIfSet("aec_dump", aec_dump); - ost << ToStringIfSet("tx_agc_target_dbov", tx_agc_target_dbov); - ost << ToStringIfSet("tx_agc_digital_compression_gain", - tx_agc_digital_compression_gain); - ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter); - ost << ToStringIfSet("recording_sample_rate", recording_sample_rate); - ost << ToStringIfSet("playout_sample_rate", playout_sample_rate); - ost << ToStringIfSet("dscp", dscp); - ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe); - ost << "}"; - return ost.str(); - } - - // Audio processing that attempts to filter away the output signal from - // later inbound pickup. - rtc::Optional echo_cancellation; - // Audio processing to adjust the sensitivity of the local mic dynamically. - rtc::Optional auto_gain_control; - // Audio processing to filter out background noise. - rtc::Optional noise_suppression; - // Audio processing to remove background noise of lower frequencies. - rtc::Optional highpass_filter; - // Audio processing to swap the left and right channels. - rtc::Optional stereo_swapping; - // Audio receiver jitter buffer (NetEq) max capacity in number of packets. - rtc::Optional audio_jitter_buffer_max_packets; - // Audio receiver jitter buffer (NetEq) fast accelerate mode. - rtc::Optional audio_jitter_buffer_fast_accelerate; - // Audio processing to detect typing. - rtc::Optional typing_detection; - rtc::Optional aecm_generate_comfort_noise; - rtc::Optional conference_mode; - rtc::Optional adjust_agc_delta; - rtc::Optional experimental_agc; - rtc::Optional extended_filter_aec; - rtc::Optional delay_agnostic_aec; - rtc::Optional experimental_ns; - rtc::Optional aec_dump; - // Note that tx_agc_* only applies to non-experimental AGC. - rtc::Optional tx_agc_target_dbov; - rtc::Optional tx_agc_digital_compression_gain; - rtc::Optional tx_agc_limiter; - rtc::Optional recording_sample_rate; - rtc::Optional playout_sample_rate; - // Set DSCP value for packet sent from audio channel. - rtc::Optional dscp; - // Enable combined audio+bandwidth BWE. - rtc::Optional combined_audio_video_bwe; - - private: - template - static void SetFrom(rtc::Optional* s, const rtc::Optional& o) { - if (o) { - *s = o; - } - } -}; - -// Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. -// Used to be flags, but that makes it hard to selectively apply options. -// We are moving all of the setting of options to structs like this, -// but some things currently still use flags. -struct VideoOptions { - VideoOptions() - : process_adaptation_threshhold(kProcessCpuThreshold), - system_low_adaptation_threshhold(kLowSystemCpuThreshold), - system_high_adaptation_threshhold(kHighSystemCpuThreshold), - unsignalled_recv_stream_limit(kNumDefaultUnsignalledVideoRecvStreams) {} - - void SetAll(const VideoOptions& change) { - SetFrom(&adapt_input_to_cpu_usage, change.adapt_input_to_cpu_usage); - SetFrom(&adapt_cpu_with_smoothing, change.adapt_cpu_with_smoothing); - SetFrom(&video_adapt_third, change.video_adapt_third); - SetFrom(&video_noise_reduction, change.video_noise_reduction); - SetFrom(&video_start_bitrate, change.video_start_bitrate); - SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection); - SetFrom(&cpu_underuse_threshold, change.cpu_underuse_threshold); - SetFrom(&cpu_overuse_threshold, change.cpu_overuse_threshold); - SetFrom(&cpu_underuse_encode_rsd_threshold, - change.cpu_underuse_encode_rsd_threshold); - SetFrom(&cpu_overuse_encode_rsd_threshold, - change.cpu_overuse_encode_rsd_threshold); - SetFrom(&cpu_overuse_encode_usage, change.cpu_overuse_encode_usage); - SetFrom(&conference_mode, change.conference_mode); - SetFrom(&process_adaptation_threshhold, - change.process_adaptation_threshhold); - SetFrom(&system_low_adaptation_threshhold, - change.system_low_adaptation_threshhold); - SetFrom(&system_high_adaptation_threshhold, - change.system_high_adaptation_threshhold); - SetFrom(&dscp, change.dscp); - SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate); - SetFrom(&unsignalled_recv_stream_limit, - change.unsignalled_recv_stream_limit); - SetFrom(&use_simulcast_adapter, change.use_simulcast_adapter); - SetFrom(&screencast_min_bitrate, change.screencast_min_bitrate); - SetFrom(&disable_prerenderer_smoothing, - change.disable_prerenderer_smoothing); - } - - bool operator==(const VideoOptions& o) const { - return adapt_input_to_cpu_usage == o.adapt_input_to_cpu_usage && - adapt_cpu_with_smoothing == o.adapt_cpu_with_smoothing && - video_adapt_third == o.video_adapt_third && - video_noise_reduction == o.video_noise_reduction && - video_start_bitrate == o.video_start_bitrate && - cpu_overuse_detection == o.cpu_overuse_detection && - cpu_underuse_threshold == o.cpu_underuse_threshold && - cpu_overuse_threshold == o.cpu_overuse_threshold && - cpu_underuse_encode_rsd_threshold == - o.cpu_underuse_encode_rsd_threshold && - cpu_overuse_encode_rsd_threshold == - o.cpu_overuse_encode_rsd_threshold && - cpu_overuse_encode_usage == o.cpu_overuse_encode_usage && - conference_mode == o.conference_mode && - process_adaptation_threshhold == o.process_adaptation_threshhold && - system_low_adaptation_threshhold == - o.system_low_adaptation_threshhold && - system_high_adaptation_threshhold == - o.system_high_adaptation_threshhold && - dscp == o.dscp && - suspend_below_min_bitrate == o.suspend_below_min_bitrate && - unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && - use_simulcast_adapter == o.use_simulcast_adapter && - screencast_min_bitrate == o.screencast_min_bitrate && - disable_prerenderer_smoothing == o.disable_prerenderer_smoothing; - } - - std::string ToString() const { - std::ostringstream ost; - ost << "VideoOptions {"; - ost << ToStringIfSet("cpu adaption", adapt_input_to_cpu_usage); - ost << ToStringIfSet("cpu adaptation smoothing", adapt_cpu_with_smoothing); - ost << ToStringIfSet("video adapt third", video_adapt_third); - ost << ToStringIfSet("noise reduction", video_noise_reduction); - ost << ToStringIfSet("start bitrate", video_start_bitrate); - ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); - ost << ToStringIfSet("cpu underuse threshold", cpu_underuse_threshold); - ost << ToStringIfSet("cpu overuse threshold", cpu_overuse_threshold); - ost << ToStringIfSet("cpu underuse encode rsd threshold", - cpu_underuse_encode_rsd_threshold); - ost << ToStringIfSet("cpu overuse encode rsd threshold", - cpu_overuse_encode_rsd_threshold); - ost << ToStringIfSet("cpu overuse encode usage", - cpu_overuse_encode_usage); - ost << ToStringIfSet("conference mode", conference_mode); - ost << ToStringIfSet("process", process_adaptation_threshhold); - ost << ToStringIfSet("low", system_low_adaptation_threshhold); - ost << ToStringIfSet("high", system_high_adaptation_threshhold); - ost << ToStringIfSet("dscp", dscp); - ost << ToStringIfSet("suspend below min bitrate", - suspend_below_min_bitrate); - ost << ToStringIfSet("num channels for early receive", - unsignalled_recv_stream_limit); - ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); - ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); - ost << "}"; - return ost.str(); - } - - // Enable CPU adaptation? - rtc::Optional adapt_input_to_cpu_usage; - // Enable CPU adaptation smoothing? - rtc::Optional adapt_cpu_with_smoothing; - // Enable video adapt third? - rtc::Optional video_adapt_third; - // Enable denoising? - rtc::Optional video_noise_reduction; - // Experimental: Enable WebRtc higher start bitrate? - rtc::Optional video_start_bitrate; - // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU - // adaptation algorithm. So this option will override the - // |adapt_input_to_cpu_usage|. - rtc::Optional cpu_overuse_detection; - // Low threshold (t1) for cpu overuse adaptation. (Adapt up) - // Metric: encode usage (m1). m1 < t1 => underuse. - rtc::Optional cpu_underuse_threshold; - // High threshold (t1) for cpu overuse adaptation. (Adapt down) - // Metric: encode usage (m1). m1 > t1 => overuse. - rtc::Optional cpu_overuse_threshold; - // Low threshold (t2) for cpu overuse adaptation. (Adapt up) - // Metric: relative standard deviation of encode time (m2). - // Optional threshold. If set, (m1 < t1 && m2 < t2) => underuse. - // Note: t2 will have no effect if t1 is not set. - rtc::Optional cpu_underuse_encode_rsd_threshold; - // High threshold (t2) for cpu overuse adaptation. (Adapt down) - // Metric: relative standard deviation of encode time (m2). - // Optional threshold. If set, (m1 > t1 || m2 > t2) => overuse. - // Note: t2 will have no effect if t1 is not set. - rtc::Optional cpu_overuse_encode_rsd_threshold; - // Use encode usage for cpu detection. - rtc::Optional cpu_overuse_encode_usage; - // Use conference mode? - rtc::Optional conference_mode; - // Threshhold for process cpu adaptation. (Process limit) - rtc::Optional process_adaptation_threshhold; - // Low threshhold for cpu adaptation. (Adapt up) - rtc::Optional system_low_adaptation_threshhold; - // High threshhold for cpu adaptation. (Adapt down) - rtc::Optional system_high_adaptation_threshhold; - // Set DSCP value for packet sent from video channel. - rtc::Optional dscp; - // Enable WebRTC suspension of video. No video frames will be sent when the - // bitrate is below the configured minimum bitrate. - rtc::Optional suspend_below_min_bitrate; - // Limit on the number of early receive channels that can be created. - rtc::Optional unsignalled_recv_stream_limit; - // Enable use of simulcast adapter. - rtc::Optional use_simulcast_adapter; - // Force screencast to use a minimum bitrate - rtc::Optional screencast_min_bitrate; - // Set to true if the renderer has an algorithm of frame selection. - // If the value is true, then WebRTC will hand over a frame as soon as - // possible without delay, and rendering smoothness is completely the duty - // of the renderer; - // If the value is false, then WebRTC is responsible to delay frame release - // in order to increase rendering smoothness. - rtc::Optional disable_prerenderer_smoothing; - - private: - template - static void SetFrom(rtc::Optional* s, const rtc::Optional& o) { - if (o) { - *s = o; - } - } -}; - -struct RtpHeaderExtension { - RtpHeaderExtension() : id(0) {} - RtpHeaderExtension(const std::string& u, int i) : uri(u), id(i) {} - - bool operator==(const RtpHeaderExtension& ext) const { - // id is a reserved word in objective-c. Therefore the id attribute has to - // be a fully qualified name in order to compile on IOS. - return this->id == ext.id && - uri == ext.uri; - } - - std::string ToString() const { - std::ostringstream ost; - ost << "{"; - ost << "uri: " << uri; - ost << ", id: " << id; - ost << "}"; - return ost.str(); - } - - std::string uri; - int id; - // TODO(juberti): SendRecv direction; -}; - -// Returns the named header extension if found among all extensions, NULL -// otherwise. -inline const RtpHeaderExtension* FindHeaderExtension( - const std::vector& extensions, - const std::string& name) { - for (std::vector::const_iterator it = extensions.begin(); - it != extensions.end(); ++it) { - if (it->uri == name) - return &(*it); - } - return NULL; -} - -enum MediaChannelOptions { - // Tune the stream for conference mode. - OPT_CONFERENCE = 0x0001 -}; - -enum VoiceMediaChannelOptions { - // Tune the audio stream for vcs with different target levels. - OPT_AGC_MINUS_10DB = 0x80000000 -}; - -class MediaChannel : public sigslot::has_slots<> { - public: - class NetworkInterface { - public: - enum SocketType { ST_RTP, ST_RTCP }; - virtual bool SendPacket(rtc::Buffer* packet, - const rtc::PacketOptions& options) = 0; - virtual bool SendRtcp(rtc::Buffer* packet, - const rtc::PacketOptions& options) = 0; - virtual int SetOption(SocketType type, rtc::Socket::Option opt, - int option) = 0; - virtual ~NetworkInterface() {} - }; - - MediaChannel() : network_interface_(NULL) {} - virtual ~MediaChannel() {} - - // Sets the abstract interface class for sending RTP/RTCP data. - virtual void SetInterface(NetworkInterface *iface) { - rtc::CritScope cs(&network_interface_crit_); - network_interface_ = iface; - } - - // Called when a RTP packet is received. - virtual void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) = 0; - // Called when a RTCP packet is received. - virtual void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) = 0; - // Called when the socket's ability to send has changed. - virtual void OnReadyToSend(bool ready) = 0; - // Creates a new outgoing media stream with SSRCs and CNAME as described - // by sp. - virtual bool AddSendStream(const StreamParams& sp) = 0; - // Removes an outgoing media stream. - // ssrc must be the first SSRC of the media stream if the stream uses - // multiple SSRCs. - virtual bool RemoveSendStream(uint32_t ssrc) = 0; - // Creates a new incoming media stream with SSRCs and CNAME as described - // by sp. - virtual bool AddRecvStream(const StreamParams& sp) = 0; - // Removes an incoming media stream. - // ssrc must be the first SSRC of the media stream if the stream uses - // multiple SSRCs. - virtual bool RemoveRecvStream(uint32_t ssrc) = 0; - - // Returns the absoulte sendtime extension id value from media channel. - virtual int GetRtpSendTimeExtnId() const { - return -1; - } - - // Base method to send packet using NetworkInterface. - bool SendPacket(rtc::Buffer* packet, const rtc::PacketOptions& options) { - return DoSendPacket(packet, false, options); - } - - bool SendRtcp(rtc::Buffer* packet, const rtc::PacketOptions& options) { - return DoSendPacket(packet, true, options); - } - - int SetOption(NetworkInterface::SocketType type, - rtc::Socket::Option opt, - int option) { - rtc::CritScope cs(&network_interface_crit_); - if (!network_interface_) - return -1; - - return network_interface_->SetOption(type, opt, option); - } - - protected: - // This method sets DSCP |value| on both RTP and RTCP channels. - int SetDscp(rtc::DiffServCodePoint value) { - int ret; - ret = SetOption(NetworkInterface::ST_RTP, - rtc::Socket::OPT_DSCP, - value); - if (ret == 0) { - ret = SetOption(NetworkInterface::ST_RTCP, - rtc::Socket::OPT_DSCP, - value); - } - return ret; - } - - private: - bool DoSendPacket(rtc::Buffer* packet, - bool rtcp, - const rtc::PacketOptions& options) { - rtc::CritScope cs(&network_interface_crit_); - if (!network_interface_) - return false; - - return (!rtcp) ? network_interface_->SendPacket(packet, options) - : network_interface_->SendRtcp(packet, options); - } - - // |network_interface_| can be accessed from the worker_thread and - // from any MediaEngine threads. This critical section is to protect accessing - // of network_interface_ object. - rtc::CriticalSection network_interface_crit_; - NetworkInterface* network_interface_; -}; - -enum SendFlags { - SEND_NOTHING, - SEND_MICROPHONE -}; - -// The stats information is structured as follows: -// Media are represented by either MediaSenderInfo or MediaReceiverInfo. -// Media contains a vector of SSRC infos that are exclusively used by this -// media. (SSRCs shared between media streams can't be represented.) - -// Information about an SSRC. -// This data may be locally recorded, or received in an RTCP SR or RR. -struct SsrcSenderInfo { - SsrcSenderInfo() - : ssrc(0), - timestamp(0) { - } - uint32_t ssrc; - double timestamp; // NTP timestamp, represented as seconds since epoch. -}; - -struct SsrcReceiverInfo { - SsrcReceiverInfo() - : ssrc(0), - timestamp(0) { - } - uint32_t ssrc; - double timestamp; -}; - -struct MediaSenderInfo { - MediaSenderInfo() - : bytes_sent(0), - packets_sent(0), - packets_lost(0), - fraction_lost(0.0), - rtt_ms(0) { - } - void add_ssrc(const SsrcSenderInfo& stat) { - local_stats.push_back(stat); - } - // Temporary utility function for call sites that only provide SSRC. - // As more info is added into SsrcSenderInfo, this function should go away. - void add_ssrc(uint32_t ssrc) { - SsrcSenderInfo stat; - stat.ssrc = ssrc; - add_ssrc(stat); - } - // Utility accessor for clients that are only interested in ssrc numbers. - std::vector ssrcs() const { - std::vector retval; - for (std::vector::const_iterator it = local_stats.begin(); - it != local_stats.end(); ++it) { - retval.push_back(it->ssrc); - } - return retval; - } - // Utility accessor for clients that make the assumption only one ssrc - // exists per media. - // This will eventually go away. - uint32_t ssrc() const { - if (local_stats.size() > 0) { - return local_stats[0].ssrc; - } else { - return 0; - } - } - int64_t bytes_sent; - int packets_sent; - int packets_lost; - float fraction_lost; - int64_t rtt_ms; - std::string codec_name; - std::vector local_stats; - std::vector remote_stats; -}; - -template -struct VariableInfo { - VariableInfo() - : min_val(), - mean(0.0), - max_val(), - variance(0.0) { - } - T min_val; - double mean; - T max_val; - double variance; -}; - -struct MediaReceiverInfo { - MediaReceiverInfo() - : bytes_rcvd(0), - packets_rcvd(0), - packets_lost(0), - fraction_lost(0.0) { - } - void add_ssrc(const SsrcReceiverInfo& stat) { - local_stats.push_back(stat); - } - // Temporary utility function for call sites that only provide SSRC. - // As more info is added into SsrcSenderInfo, this function should go away. - void add_ssrc(uint32_t ssrc) { - SsrcReceiverInfo stat; - stat.ssrc = ssrc; - add_ssrc(stat); - } - std::vector ssrcs() const { - std::vector retval; - for (std::vector::const_iterator it = local_stats.begin(); - it != local_stats.end(); ++it) { - retval.push_back(it->ssrc); - } - return retval; - } - // Utility accessor for clients that make the assumption only one ssrc - // exists per media. - // This will eventually go away. - uint32_t ssrc() const { - if (local_stats.size() > 0) { - return local_stats[0].ssrc; - } else { - return 0; - } - } - - int64_t bytes_rcvd; - int packets_rcvd; - int packets_lost; - float fraction_lost; - std::string codec_name; - std::vector local_stats; - std::vector remote_stats; -}; - -struct VoiceSenderInfo : public MediaSenderInfo { - VoiceSenderInfo() - : ext_seqnum(0), - jitter_ms(0), - audio_level(0), - aec_quality_min(0.0), - echo_delay_median_ms(0), - echo_delay_std_ms(0), - echo_return_loss(0), - echo_return_loss_enhancement(0), - typing_noise_detected(false) { - } - - int ext_seqnum; - int jitter_ms; - int audio_level; - float aec_quality_min; - int echo_delay_median_ms; - int echo_delay_std_ms; - int echo_return_loss; - int echo_return_loss_enhancement; - bool typing_noise_detected; -}; - -struct VoiceReceiverInfo : public MediaReceiverInfo { - VoiceReceiverInfo() - : ext_seqnum(0), - jitter_ms(0), - jitter_buffer_ms(0), - jitter_buffer_preferred_ms(0), - delay_estimate_ms(0), - audio_level(0), - expand_rate(0), - speech_expand_rate(0), - secondary_decoded_rate(0), - accelerate_rate(0), - preemptive_expand_rate(0), - decoding_calls_to_silence_generator(0), - decoding_calls_to_neteq(0), - decoding_normal(0), - decoding_plc(0), - decoding_cng(0), - decoding_plc_cng(0), - capture_start_ntp_time_ms(-1) {} - - int ext_seqnum; - int jitter_ms; - int jitter_buffer_ms; - int jitter_buffer_preferred_ms; - int delay_estimate_ms; - int audio_level; - // fraction of synthesized audio inserted through expansion. - float expand_rate; - // fraction of synthesized speech inserted through expansion. - float speech_expand_rate; - // fraction of data out of secondary decoding, including FEC and RED. - float secondary_decoded_rate; - // Fraction of data removed through time compression. - float accelerate_rate; - // Fraction of data inserted through time stretching. - float preemptive_expand_rate; - int decoding_calls_to_silence_generator; - int decoding_calls_to_neteq; - int decoding_normal; - int decoding_plc; - int decoding_cng; - int decoding_plc_cng; - // Estimated capture start time in NTP time in ms. - int64_t capture_start_ntp_time_ms; -}; - -struct VideoSenderInfo : public MediaSenderInfo { - VideoSenderInfo() - : packets_cached(0), - firs_rcvd(0), - plis_rcvd(0), - nacks_rcvd(0), - input_frame_width(0), - input_frame_height(0), - send_frame_width(0), - send_frame_height(0), - framerate_input(0), - framerate_sent(0), - nominal_bitrate(0), - preferred_bitrate(0), - adapt_reason(0), - adapt_changes(0), - avg_encode_ms(0), - encode_usage_percent(0) { - } - - std::vector ssrc_groups; - std::string encoder_implementation_name; - int packets_cached; - int firs_rcvd; - int plis_rcvd; - int nacks_rcvd; - int input_frame_width; - int input_frame_height; - int send_frame_width; - int send_frame_height; - int framerate_input; - int framerate_sent; - int nominal_bitrate; - int preferred_bitrate; - int adapt_reason; - int adapt_changes; - int avg_encode_ms; - int encode_usage_percent; - VariableInfo adapt_frame_drops; - VariableInfo effects_frame_drops; - VariableInfo capturer_frame_time; -}; - -struct VideoReceiverInfo : public MediaReceiverInfo { - VideoReceiverInfo() - : packets_concealed(0), - firs_sent(0), - plis_sent(0), - nacks_sent(0), - frame_width(0), - frame_height(0), - framerate_rcvd(0), - framerate_decoded(0), - framerate_output(0), - framerate_render_input(0), - framerate_render_output(0), - decode_ms(0), - max_decode_ms(0), - jitter_buffer_ms(0), - min_playout_delay_ms(0), - render_delay_ms(0), - target_delay_ms(0), - current_delay_ms(0), - capture_start_ntp_time_ms(-1) { - } - - std::vector ssrc_groups; - std::string decoder_implementation_name; - int packets_concealed; - int firs_sent; - int plis_sent; - int nacks_sent; - int frame_width; - int frame_height; - int framerate_rcvd; - int framerate_decoded; - int framerate_output; - // Framerate as sent to the renderer. - int framerate_render_input; - // Framerate that the renderer reports. - int framerate_render_output; - - // All stats below are gathered per-VideoReceiver, but some will be correlated - // across MediaStreamTracks. NOTE(hta): when sinking stats into per-SSRC - // structures, reflect this in the new layout. - - // Current frame decode latency. - int decode_ms; - // Maximum observed frame decode latency. - int max_decode_ms; - // Jitter (network-related) latency. - int jitter_buffer_ms; - // Requested minimum playout latency. - int min_playout_delay_ms; - // Requested latency to account for rendering delay. - int render_delay_ms; - // Target overall delay: network+decode+render, accounting for - // min_playout_delay_ms. - int target_delay_ms; - // Current overall delay, possibly ramping towards target_delay_ms. - int current_delay_ms; - - // Estimated capture start time in NTP time in ms. - int64_t capture_start_ntp_time_ms; -}; - -struct DataSenderInfo : public MediaSenderInfo { - DataSenderInfo() - : ssrc(0) { - } - - uint32_t ssrc; -}; - -struct DataReceiverInfo : public MediaReceiverInfo { - DataReceiverInfo() - : ssrc(0) { - } - - uint32_t ssrc; -}; - -struct BandwidthEstimationInfo { - BandwidthEstimationInfo() - : available_send_bandwidth(0), - available_recv_bandwidth(0), - target_enc_bitrate(0), - actual_enc_bitrate(0), - retransmit_bitrate(0), - transmit_bitrate(0), - bucket_delay(0) { - } - - int available_send_bandwidth; - int available_recv_bandwidth; - int target_enc_bitrate; - int actual_enc_bitrate; - int retransmit_bitrate; - int transmit_bitrate; - int64_t bucket_delay; -}; - -struct VoiceMediaInfo { - void Clear() { - senders.clear(); - receivers.clear(); - } - std::vector senders; - std::vector receivers; -}; - -struct VideoMediaInfo { - void Clear() { - senders.clear(); - receivers.clear(); - bw_estimations.clear(); - } - std::vector senders; - std::vector receivers; - std::vector bw_estimations; -}; - -struct DataMediaInfo { - void Clear() { - senders.clear(); - receivers.clear(); - } - std::vector senders; - std::vector receivers; -}; - -struct RtcpParameters { - bool reduced_size = false; -}; - -template -struct RtpParameters { - virtual std::string ToString() const { - std::ostringstream ost; - ost << "{"; - ost << "codecs: " << VectorToString(codecs) << ", "; - ost << "extensions: " << VectorToString(extensions); - ost << "}"; - return ost.str(); - } - - std::vector codecs; - std::vector extensions; - // TODO(pthatcher): Add streams. - RtcpParameters rtcp; -}; - -template -struct RtpSendParameters : RtpParameters { - std::string ToString() const override { - std::ostringstream ost; - ost << "{"; - ost << "codecs: " << VectorToString(this->codecs) << ", "; - ost << "extensions: " << VectorToString(this->extensions) << ", "; - ost << "max_bandiwidth_bps: " << max_bandwidth_bps << ", "; - ost << "options: " << options.ToString(); - ost << "}"; - return ost.str(); - } - - int max_bandwidth_bps = -1; - Options options; -}; - -struct AudioSendParameters : RtpSendParameters { -}; - -struct AudioRecvParameters : RtpParameters { -}; - -class VoiceMediaChannel : public MediaChannel { - public: - enum Error { - ERROR_NONE = 0, // No error. - ERROR_OTHER, // Other errors. - ERROR_REC_DEVICE_OPEN_FAILED = 100, // Could not open mic. - ERROR_REC_DEVICE_MUTED, // Mic was muted by OS. - ERROR_REC_DEVICE_SILENT, // No background noise picked up. - ERROR_REC_DEVICE_SATURATION, // Mic input is clipping. - ERROR_REC_DEVICE_REMOVED, // Mic was removed while active. - ERROR_REC_RUNTIME_ERROR, // Processing is encountering errors. - ERROR_REC_SRTP_ERROR, // Generic SRTP failure. - ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. - ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected. - ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. - ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. - ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. - ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. - ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. - ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. - ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. - }; - - VoiceMediaChannel() {} - virtual ~VoiceMediaChannel() {} - virtual bool SetSendParameters(const AudioSendParameters& params) = 0; - virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; - // Starts or stops playout of received audio. - virtual bool SetPlayout(bool playout) = 0; - // Starts or stops sending (and potentially capture) of local audio. - virtual bool SetSend(SendFlags flag) = 0; - // Configure stream for sending. - virtual bool SetAudioSend(uint32_t ssrc, - bool enable, - const AudioOptions* options, - AudioRenderer* renderer) = 0; - // Gets current energy levels for all incoming streams. - virtual bool GetActiveStreams(AudioInfo::StreamList* actives) = 0; - // Get the current energy level of the stream sent to the speaker. - virtual int GetOutputLevel() = 0; - // Get the time in milliseconds since last recorded keystroke, or negative. - virtual int GetTimeSinceLastTyping() = 0; - // Temporarily exposed field for tuning typing detect options. - virtual void SetTypingDetectionParameters(int time_window, - int cost_per_typing, int reporting_threshold, int penalty_decay, - int type_event_delay) = 0; - // Set speaker output volume of the specified ssrc. - virtual bool SetOutputVolume(uint32_t ssrc, double volume) = 0; - // Returns if the telephone-event has been negotiated. - virtual bool CanInsertDtmf() = 0; - // Send a DTMF |event|. The DTMF out-of-band signal will be used. - // The |ssrc| should be either 0 or a valid send stream ssrc. - // The valid value for the |event| are 0 to 15 which corresponding to - // DTMF event 0-9, *, #, A-D. - virtual bool InsertDtmf(uint32_t ssrc, int event, int duration) = 0; - // Gets quality stats for the channel. - virtual bool GetStats(VoiceMediaInfo* info) = 0; - - virtual void SetRawAudioSink( - uint32_t ssrc, - rtc::scoped_ptr sink) = 0; -}; - -struct VideoSendParameters : RtpSendParameters { -}; - -struct VideoRecvParameters : RtpParameters { -}; - -class VideoMediaChannel : public MediaChannel { - public: - enum Error { - ERROR_NONE = 0, // No error. - ERROR_OTHER, // Other errors. - ERROR_REC_DEVICE_OPEN_FAILED = 100, // Could not open camera. - ERROR_REC_DEVICE_NO_DEVICE, // No camera. - ERROR_REC_DEVICE_IN_USE, // Device is in already use. - ERROR_REC_DEVICE_REMOVED, // Device is removed. - ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. - ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. - ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. - ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. - ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. - ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. - }; - - VideoMediaChannel() : renderer_(NULL) {} - virtual ~VideoMediaChannel() {} - - virtual bool SetSendParameters(const VideoSendParameters& params) = 0; - virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; - // Gets the currently set codecs/payload types to be used for outgoing media. - virtual bool GetSendCodec(VideoCodec* send_codec) = 0; - // Sets the format of a specified outgoing stream. - virtual bool SetSendStreamFormat(uint32_t ssrc, - const VideoFormat& format) = 0; - // Starts or stops transmission (and potentially capture) of local video. - virtual bool SetSend(bool send) = 0; - // Configure stream for sending. - virtual bool SetVideoSend(uint32_t ssrc, - bool enable, - const VideoOptions* options) = 0; - // Sets the renderer object to be used for the specified stream. - // If SSRC is 0, the renderer is used for the 'default' stream. - virtual bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer) = 0; - // If |ssrc| is 0, replace the default capturer (engine capturer) with - // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC. - virtual bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) = 0; - // Gets quality stats for the channel. - virtual bool GetStats(VideoMediaInfo* info) = 0; - // Send an intra frame to the receivers. - virtual bool SendIntraFrame() = 0; - // Reuqest each of the remote senders to send an intra frame. - virtual bool RequestIntraFrame() = 0; - virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0; - - protected: - VideoRenderer *renderer_; -}; - -enum DataMessageType { - // Chrome-Internal use only. See SctpDataMediaChannel for the actual PPID - // values. - DMT_NONE = 0, - DMT_CONTROL = 1, - DMT_BINARY = 2, - DMT_TEXT = 3, -}; - -// Info about data received in DataMediaChannel. For use in -// DataMediaChannel::SignalDataReceived and in all of the signals that -// signal fires, on up the chain. -struct ReceiveDataParams { - // The in-packet stream indentifier. - // For SCTP, this is really SID, not SSRC. - uint32_t ssrc; - // The type of message (binary, text, or control). - DataMessageType type; - // A per-stream value incremented per packet in the stream. - int seq_num; - // A per-stream value monotonically increasing with time. - int timestamp; - - ReceiveDataParams() : - ssrc(0), - type(DMT_TEXT), - seq_num(0), - timestamp(0) { - } -}; - -struct SendDataParams { - // The in-packet stream indentifier. - // For SCTP, this is really SID, not SSRC. - uint32_t ssrc; - // The type of message (binary, text, or control). - DataMessageType type; - - // For SCTP, whether to send messages flagged as ordered or not. - // If false, messages can be received out of order. - bool ordered; - // For SCTP, whether the messages are sent reliably or not. - // If false, messages may be lost. - bool reliable; - // For SCTP, if reliable == false, provide partial reliability by - // resending up to this many times. Either count or millis - // is supported, not both at the same time. - int max_rtx_count; - // For SCTP, if reliable == false, provide partial reliability by - // resending for up to this many milliseconds. Either count or millis - // is supported, not both at the same time. - int max_rtx_ms; - - SendDataParams() : - ssrc(0), - type(DMT_TEXT), - // TODO(pthatcher): Make these true by default? - ordered(false), - reliable(false), - max_rtx_count(0), - max_rtx_ms(0) { - } -}; - -enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; - -struct DataOptions { - std::string ToString() const { - return "{}"; - } -}; - -struct DataSendParameters : RtpSendParameters { - std::string ToString() const { - std::ostringstream ost; - // Options and extensions aren't used. - ost << "{"; - ost << "codecs: " << VectorToString(codecs) << ", "; - ost << "max_bandiwidth_bps: " << max_bandwidth_bps; - ost << "}"; - return ost.str(); - } -}; - -struct DataRecvParameters : RtpParameters { -}; - -class DataMediaChannel : public MediaChannel { - public: - enum Error { - ERROR_NONE = 0, // No error. - ERROR_OTHER, // Other errors. - ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. - ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. - ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. - ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. - ERROR_RECV_SRTP_REPLAY, // Packet replay detected. - }; - - virtual ~DataMediaChannel() {} - - virtual bool SetSendParameters(const DataSendParameters& params) = 0; - virtual bool SetRecvParameters(const DataRecvParameters& params) = 0; - - // TODO(pthatcher): Implement this. - virtual bool GetStats(DataMediaInfo* info) { return true; } - - virtual bool SetSend(bool send) = 0; - virtual bool SetReceive(bool receive) = 0; - - virtual bool SendData( - const SendDataParams& params, - const rtc::Buffer& payload, - SendDataResult* result = NULL) = 0; - // Signals when data is received (params, data, len) - sigslot::signal3 SignalDataReceived; - // Signal when the media channel is ready to send the stream. Arguments are: - // writable(bool) - sigslot::signal1 SignalReadyToSend; - // Signal for notifying that the remote side has closed the DataChannel. - sigslot::signal1 SignalStreamClosedRemotely; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ diff --git a/include/talk/media/base/mediacommon.h b/include/talk/media/base/mediacommon.h deleted file mode 100644 index 6eb5457..0000000 --- a/include/talk/media/base/mediacommon.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_MEDIACOMMON_H_ -#define TALK_MEDIA_BASE_MEDIACOMMON_H_ - -#include "webrtc/base/stringencode.h" - -namespace cricket { - -enum MediaCapabilities { - AUDIO_RECV = 1 << 0, - AUDIO_SEND = 1 << 1, - VIDEO_RECV = 1 << 2, - VIDEO_SEND = 1 << 3, -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_MEDIACOMMON_H_ diff --git a/include/talk/media/base/mediaengine.h b/include/talk/media/base/mediaengine.h deleted file mode 100644 index 43b4de5..0000000 --- a/include/talk/media/base/mediaengine.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_MEDIAENGINE_H_ -#define TALK_MEDIA_BASE_MEDIAENGINE_H_ - -#ifdef OSX -#include -#endif - -#include -#include - -#include "talk/media/base/codec.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/mediacommon.h" -#include "talk/media/base/videocapturer.h" -#include "talk/media/base/videocommon.h" -#include "talk/media/devices/devicemanager.h" -#include "webrtc/audio_state.h" -#include "webrtc/base/fileutils.h" -#include "webrtc/base/sigslotrepeater.h" - -#if defined(GOOGLE_CHROME_BUILD) || defined(CHROMIUM_BUILD) -#define DISABLE_MEDIA_ENGINE_FACTORY -#endif - -namespace webrtc { -class Call; -} - -namespace cricket { - -class VideoCapturer; - -struct RtpCapabilities { - std::vector header_extensions; -}; - -// MediaEngineInterface is an abstraction of a media engine which can be -// subclassed to support different media componentry backends. -// It supports voice and video operations in the same class to facilitate -// proper synchronization between both media types. -class MediaEngineInterface { - public: - virtual ~MediaEngineInterface() {} - - // Initialization - // Starts the engine. - virtual bool Init(rtc::Thread* worker_thread) = 0; - // Shuts down the engine. - virtual void Terminate() = 0; - // TODO(solenberg): Remove once VoE API refactoring is done. - virtual rtc::scoped_refptr GetAudioState() const = 0; - - // MediaChannel creation - // Creates a voice media channel. Returns NULL on failure. - virtual VoiceMediaChannel* CreateChannel( - webrtc::Call* call, - const AudioOptions& options) = 0; - // Creates a video media channel, paired with the specified voice channel. - // Returns NULL on failure. - virtual VideoMediaChannel* CreateVideoChannel( - webrtc::Call* call, - const VideoOptions& options) = 0; - - // Device configuration - // Gets the current speaker volume, as a value between 0 and 255. - virtual bool GetOutputVolume(int* level) = 0; - // Sets the current speaker volume, as a value between 0 and 255. - virtual bool SetOutputVolume(int level) = 0; - - // Gets the current microphone level, as a value between 0 and 10. - virtual int GetInputLevel() = 0; - - virtual const std::vector& audio_codecs() = 0; - virtual RtpCapabilities GetAudioCapabilities() = 0; - virtual const std::vector& video_codecs() = 0; - virtual RtpCapabilities GetVideoCapabilities() = 0; - - // Starts AEC dump using existing file. - virtual bool StartAecDump(rtc::PlatformFile file) = 0; - - // Stops recording AEC dump. - virtual void StopAecDump() = 0; - - // Starts RtcEventLog using existing file. - virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0; - - // Stops recording an RtcEventLog. - virtual void StopRtcEventLog() = 0; -}; - - -#if !defined(DISABLE_MEDIA_ENGINE_FACTORY) -class MediaEngineFactory { - public: - typedef cricket::MediaEngineInterface* (*MediaEngineCreateFunction)(); - // Creates a media engine, using either the compiled system default or the - // creation function specified in SetCreateFunction, if specified. - static MediaEngineInterface* Create(); - // Sets the function used when calling Create. If unset, the compiled system - // default will be used. Returns the old create function, or NULL if one - // wasn't set. Likewise, NULL can be used as the |function| parameter to - // reset to the default behavior. - static MediaEngineCreateFunction SetCreateFunction( - MediaEngineCreateFunction function); - private: - static MediaEngineCreateFunction create_function_; -}; -#endif - -// CompositeMediaEngine constructs a MediaEngine from separate -// voice and video engine classes. -template -class CompositeMediaEngine : public MediaEngineInterface { - public: - virtual ~CompositeMediaEngine() {} - virtual bool Init(rtc::Thread* worker_thread) { - if (!voice_.Init(worker_thread)) - return false; - video_.Init(); - return true; - } - virtual void Terminate() { - voice_.Terminate(); - } - - virtual rtc::scoped_refptr GetAudioState() const { - return voice_.GetAudioState(); - } - virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, - const AudioOptions& options) { - return voice_.CreateChannel(call, options); - } - virtual VideoMediaChannel* CreateVideoChannel(webrtc::Call* call, - const VideoOptions& options) { - return video_.CreateChannel(call, options); - } - - virtual bool GetOutputVolume(int* level) { - return voice_.GetOutputVolume(level); - } - virtual bool SetOutputVolume(int level) { - return voice_.SetOutputVolume(level); - } - - virtual int GetInputLevel() { - return voice_.GetInputLevel(); - } - virtual const std::vector& audio_codecs() { - return voice_.codecs(); - } - virtual RtpCapabilities GetAudioCapabilities() { - return voice_.GetCapabilities(); - } - virtual const std::vector& video_codecs() { - return video_.codecs(); - } - virtual RtpCapabilities GetVideoCapabilities() { - return video_.GetCapabilities(); - } - - virtual bool StartAecDump(rtc::PlatformFile file) { - return voice_.StartAecDump(file); - } - - virtual void StopAecDump() { - voice_.StopAecDump(); - } - - virtual bool StartRtcEventLog(rtc::PlatformFile file) { - return voice_.StartRtcEventLog(file); - } - - virtual void StopRtcEventLog() { voice_.StopRtcEventLog(); } - - protected: - VOICE voice_; - VIDEO video_; -}; - -enum DataChannelType { - DCT_NONE = 0, - DCT_RTP = 1, - DCT_SCTP = 2 -}; - -class DataEngineInterface { - public: - virtual ~DataEngineInterface() {} - virtual DataMediaChannel* CreateChannel(DataChannelType type) = 0; - virtual const std::vector& data_codecs() = 0; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_MEDIAENGINE_H_ diff --git a/include/talk/media/base/rtpdataengine.h b/include/talk/media/base/rtpdataengine.h deleted file mode 100644 index c0449c9..0000000 --- a/include/talk/media/base/rtpdataengine.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_RTPDATAENGINE_H_ -#define TALK_MEDIA_BASE_RTPDATAENGINE_H_ - -#include -#include - -#include "talk/media/base/constants.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/mediaengine.h" -#include "webrtc/base/timing.h" - -namespace cricket { - -struct DataCodec; - -class RtpDataEngine : public DataEngineInterface { - public: - RtpDataEngine(); - - virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type); - - virtual const std::vector& data_codecs() { - return data_codecs_; - } - - // Mostly for testing with a fake clock. Ownership is passed in. - void SetTiming(rtc::Timing* timing) { - timing_.reset(timing); - } - - private: - std::vector data_codecs_; - rtc::scoped_ptr timing_; -}; - -// Keep track of sequence number and timestamp of an RTP stream. The -// sequence number starts with a "random" value and increments. The -// timestamp starts with a "random" value and increases monotonically -// according to the clockrate. -class RtpClock { - public: - RtpClock(int clockrate, uint16_t first_seq_num, uint32_t timestamp_offset) - : clockrate_(clockrate), - last_seq_num_(first_seq_num), - timestamp_offset_(timestamp_offset) {} - - // Given the current time (in number of seconds which must be - // monotonically increasing), Return the next sequence number and - // timestamp. - void Tick(double now, int* seq_num, uint32_t* timestamp); - - private: - int clockrate_; - uint16_t last_seq_num_; - uint32_t timestamp_offset_; -}; - -class RtpDataMediaChannel : public DataMediaChannel { - public: - // Timing* Used for the RtpClock - explicit RtpDataMediaChannel(rtc::Timing* timing); - // Sets Timing == NULL, so you'll need to call set_timer() before - // using it. This is needed by FakeMediaEngine. - RtpDataMediaChannel(); - virtual ~RtpDataMediaChannel(); - - void set_timing(rtc::Timing* timing) { - timing_ = timing; - } - - virtual bool SetSendParameters(const DataSendParameters& params); - virtual bool SetRecvParameters(const DataRecvParameters& params); - virtual bool AddSendStream(const StreamParams& sp); - virtual bool RemoveSendStream(uint32_t ssrc); - virtual bool AddRecvStream(const StreamParams& sp); - virtual bool RemoveRecvStream(uint32_t ssrc); - virtual bool SetSend(bool send) { - sending_ = send; - return true; - } - virtual bool SetReceive(bool receive) { - receiving_ = receive; - return true; - } - virtual void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time); - virtual void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) {} - virtual void OnReadyToSend(bool ready) {} - virtual bool SendData( - const SendDataParams& params, - const rtc::Buffer& payload, - SendDataResult* result); - - private: - void Construct(rtc::Timing* timing); - bool SetMaxSendBandwidth(int bps); - bool SetSendCodecs(const std::vector& codecs); - bool SetRecvCodecs(const std::vector& codecs); - - bool sending_; - bool receiving_; - rtc::Timing* timing_; - std::vector send_codecs_; - std::vector recv_codecs_; - std::vector send_streams_; - std::vector recv_streams_; - std::map rtp_clock_by_send_ssrc_; - rtc::scoped_ptr send_limiter_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_RTPDATAENGINE_H_ diff --git a/include/talk/media/base/rtpdump.h b/include/talk/media/base/rtpdump.h deleted file mode 100644 index 0f3091a..0000000 --- a/include/talk/media/base/rtpdump.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_RTPDUMP_H_ -#define TALK_MEDIA_BASE_RTPDUMP_H_ - -#include - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/bytebuffer.h" -#include "webrtc/base/stream.h" - -namespace cricket { - -// We use the RTP dump file format compatible to the format used by rtptools -// (http://www.cs.columbia.edu/irt/software/rtptools/) and Wireshark -// (http://wiki.wireshark.org/rtpdump). In particular, the file starts with the -// first line "#!rtpplay1.0 address/port\n", followed by a 16 byte file header. -// For each packet, the file contains a 8 byte dump packet header, followed by -// the actual RTP or RTCP packet. - -enum RtpDumpPacketFilter { - PF_NONE = 0x0, - PF_RTPHEADER = 0x1, - PF_RTPPACKET = 0x3, // includes header - // PF_RTCPHEADER = 0x4, // TODO(juberti) - PF_RTCPPACKET = 0xC, // includes header - PF_ALL = 0xF -}; - -struct RtpDumpFileHeader { - RtpDumpFileHeader(uint32_t start_ms, uint32_t s, uint16_t p); - void WriteToByteBuffer(rtc::ByteBuffer* buf); - - static const char kFirstLine[]; - static const size_t kHeaderLength = 16; - uint32_t start_sec; // start of recording, the seconds part. - uint32_t start_usec; // start of recording, the microseconds part. - uint32_t source; // network source (multicast address). - uint16_t port; // UDP port. - uint16_t padding; // 2 bytes padding. -}; - -struct RtpDumpPacket { - RtpDumpPacket() {} - - RtpDumpPacket(const void* d, size_t s, uint32_t elapsed, bool rtcp) - : elapsed_time(elapsed), original_data_len((rtcp) ? 0 : s) { - data.resize(s); - memcpy(&data[0], d, s); - } - - // In the rtpdump file format, RTCP packets have their data len set to zero, - // since RTCP has an internal length field. - bool is_rtcp() const { return original_data_len == 0; } - bool IsValidRtpPacket() const; - bool IsValidRtcpPacket() const; - // Get the payload type, sequence number, timestampe, and SSRC of the RTP - // packet. Return true and set the output parameter if successful. - bool GetRtpPayloadType(int* pt) const; - bool GetRtpSeqNum(int* seq_num) const; - bool GetRtpTimestamp(uint32_t* ts) const; - bool GetRtpSsrc(uint32_t* ssrc) const; - bool GetRtpHeaderLen(size_t* len) const; - // Get the type of the RTCP packet. Return true and set the output parameter - // if successful. - bool GetRtcpType(int* type) const; - - static const size_t kHeaderLength = 8; - uint32_t elapsed_time; // Milliseconds since the start of recording. - std::vector data; // The actual RTP or RTCP packet. - size_t original_data_len; // The original length of the packet; may be - // greater than data.size() if only part of the - // packet was recorded. -}; - -class RtpDumpReader { - public: - explicit RtpDumpReader(rtc::StreamInterface* stream) - : stream_(stream), - file_header_read_(false), - first_line_and_file_header_len_(0), - start_time_ms_(0), - ssrc_override_(0) { - } - virtual ~RtpDumpReader() {} - - // Use the specified ssrc, rather than the ssrc from dump, for RTP packets. - void SetSsrc(uint32_t ssrc); - virtual rtc::StreamResult ReadPacket(RtpDumpPacket* packet); - - protected: - rtc::StreamResult ReadFileHeader(); - bool RewindToFirstDumpPacket() { - return stream_->SetPosition(first_line_and_file_header_len_); - } - - private: - // Check if its matches "#!rtpplay1.0 address/port\n". - bool CheckFirstLine(const std::string& first_line); - - rtc::StreamInterface* stream_; - bool file_header_read_; - size_t first_line_and_file_header_len_; - uint32_t start_time_ms_; - uint32_t ssrc_override_; - - RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpReader); -}; - -// RtpDumpLoopReader reads RTP dump packets from the input stream and rewinds -// the stream when it ends. RtpDumpLoopReader maintains the elapsed time, the -// RTP sequence number and the RTP timestamp properly. RtpDumpLoopReader can -// handle both RTP dump and RTCP dump. We assume that the dump does not mix -// RTP packets and RTCP packets. -class RtpDumpLoopReader : public RtpDumpReader { - public: - explicit RtpDumpLoopReader(rtc::StreamInterface* stream); - virtual rtc::StreamResult ReadPacket(RtpDumpPacket* packet); - - private: - // During the first loop, update the statistics, including packet count, frame - // count, timestamps, and sequence number, of the input stream. - void UpdateStreamStatistics(const RtpDumpPacket& packet); - - // At the end of first loop, calculate elapsed_time_increases_, - // rtp_seq_num_increase_, and rtp_timestamp_increase_. - void CalculateIncreases(); - - // During the second and later loops, update the elapsed time of the dump - // packet. If the dumped packet is a RTP packet, update its RTP sequence - // number and timestamp as well. - void UpdateDumpPacket(RtpDumpPacket* packet); - - int loop_count_; - // How much to increase the elapsed time, RTP sequence number, RTP timestampe - // for each loop. They are calcualted with the variables below during the - // first loop. - uint32_t elapsed_time_increases_; - int rtp_seq_num_increase_; - uint32_t rtp_timestamp_increase_; - // How many RTP packets and how many payload frames in the input stream. RTP - // packets belong to the same frame have the same RTP timestamp, different - // dump timestamp, and different RTP sequence number. - uint32_t packet_count_; - uint32_t frame_count_; - // The elapsed time, RTP sequence number, and RTP timestamp of the first and - // the previous dump packets in the input stream. - uint32_t first_elapsed_time_; - int first_rtp_seq_num_; - uint32_t first_rtp_timestamp_; - uint32_t prev_elapsed_time_; - int prev_rtp_seq_num_; - uint32_t prev_rtp_timestamp_; - - RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpLoopReader); -}; - -class RtpDumpWriter { - public: - explicit RtpDumpWriter(rtc::StreamInterface* stream); - - // Filter to control what packets we actually record. - void set_packet_filter(int filter); - // Write a RTP or RTCP packet. The parameters data points to the packet and - // data_len is its length. - rtc::StreamResult WriteRtpPacket(const void* data, size_t data_len) { - return WritePacket(data, data_len, GetElapsedTime(), false); - } - rtc::StreamResult WriteRtcpPacket(const void* data, size_t data_len) { - return WritePacket(data, data_len, GetElapsedTime(), true); - } - rtc::StreamResult WritePacket(const RtpDumpPacket& packet) { - return WritePacket(&packet.data[0], packet.data.size(), packet.elapsed_time, - packet.is_rtcp()); - } - uint32_t GetElapsedTime() const; - - bool GetDumpSize(size_t* size) { - // Note that we use GetPosition(), rather than GetSize(), to avoid flush the - // stream per write. - return stream_ && size && stream_->GetPosition(size); - } - - protected: - rtc::StreamResult WriteFileHeader(); - - private: - rtc::StreamResult WritePacket(const void* data, - size_t data_len, - uint32_t elapsed, - bool rtcp); - size_t FilterPacket(const void* data, size_t data_len, bool rtcp); - rtc::StreamResult WriteToStream(const void* data, size_t data_len); - - rtc::StreamInterface* stream_; - int packet_filter_; - bool file_header_written_; - uint32_t start_time_ms_; // Time when the record starts. - // If writing to the stream takes longer than this many ms, log a warning. - uint32_t warn_slow_writes_delay_; - RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpWriter); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_RTPDUMP_H_ diff --git a/include/talk/media/base/rtputils.h b/include/talk/media/base/rtputils.h deleted file mode 100644 index bf8238f..0000000 --- a/include/talk/media/base/rtputils.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_RTPUTILS_H_ -#define TALK_MEDIA_BASE_RTPUTILS_H_ - -#include "webrtc/base/byteorder.h" - -namespace cricket { - -const size_t kMinRtpPacketLen = 12; -const size_t kMaxRtpPacketLen = 2048; -const size_t kMinRtcpPacketLen = 4; - -struct RtpHeader { - int payload_type; - int seq_num; - uint32_t timestamp; - uint32_t ssrc; -}; - -enum RtcpTypes { - kRtcpTypeSR = 200, // Sender report payload type. - kRtcpTypeRR = 201, // Receiver report payload type. - kRtcpTypeSDES = 202, // SDES payload type. - kRtcpTypeBye = 203, // BYE payload type. - kRtcpTypeApp = 204, // APP payload type. - kRtcpTypeRTPFB = 205, // Transport layer Feedback message payload type. - kRtcpTypePSFB = 206, // Payload-specific Feedback message payload type. -}; - -bool GetRtpPayloadType(const void* data, size_t len, int* value); -bool GetRtpSeqNum(const void* data, size_t len, int* value); -bool GetRtpTimestamp(const void* data, size_t len, uint32_t* value); -bool GetRtpSsrc(const void* data, size_t len, uint32_t* value); -bool GetRtpHeaderLen(const void* data, size_t len, size_t* value); -bool GetRtcpType(const void* data, size_t len, int* value); -bool GetRtcpSsrc(const void* data, size_t len, uint32_t* value); -bool GetRtpHeader(const void* data, size_t len, RtpHeader* header); - -bool SetRtpSsrc(void* data, size_t len, uint32_t value); -// Assumes version 2, no padding, no extensions, no csrcs. -bool SetRtpHeader(void* data, size_t len, const RtpHeader& header); - -bool IsRtpPacket(const void* data, size_t len); - -// True if |payload type| is 0-127. -bool IsValidRtpPayloadType(int payload_type); - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_RTPUTILS_H_ diff --git a/include/talk/media/base/screencastid.h b/include/talk/media/base/screencastid.h deleted file mode 100644 index e5115a4..0000000 --- a/include/talk/media/base/screencastid.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Author: thorcarpenter@google.com (Thor Carpenter) -// -// Defines variant class ScreencastId that combines WindowId and DesktopId. - -#ifndef TALK_MEDIA_BASE_SCREENCASTID_H_ -#define TALK_MEDIA_BASE_SCREENCASTID_H_ - -#include -#include - -#include "webrtc/base/window.h" -#include "webrtc/base/windowpicker.h" - -namespace cricket { - -class ScreencastId; -typedef std::vector ScreencastIdList; - -// Used for identifying a window or desktop to be screencast. -class ScreencastId { - public: - enum Type { INVALID, WINDOW, DESKTOP }; - - // Default constructor indicates invalid ScreencastId. - ScreencastId() : type_(INVALID) {} - explicit ScreencastId(const rtc::WindowId& id) - : type_(WINDOW), window_(id) { - } - explicit ScreencastId(const rtc::DesktopId& id) - : type_(DESKTOP), desktop_(id) { - } - - Type type() const { return type_; } - const rtc::WindowId& window() const { return window_; } - const rtc::DesktopId& desktop() const { return desktop_; } - - // Title is an optional parameter. - const std::string& title() const { return title_; } - void set_title(const std::string& desc) { title_ = desc; } - - bool IsValid() const { - if (type_ == INVALID) { - return false; - } else if (type_ == WINDOW) { - return window_.IsValid(); - } else { - return desktop_.IsValid(); - } - } - bool IsWindow() const { return type_ == WINDOW; } - bool IsDesktop() const { return type_ == DESKTOP; } - bool EqualsId(const ScreencastId& other) const { - if (type_ != other.type_) { - return false; - } - if (type_ == INVALID) { - return true; - } else if (type_ == WINDOW) { - return window_.Equals(other.window()); - } - return desktop_.Equals(other.desktop()); - } - - // T is assumed to be WindowDescription or DesktopDescription. - template - static cricket::ScreencastIdList Convert(const std::vector& list) { - ScreencastIdList screencast_list; - screencast_list.reserve(list.size()); - for (typename std::vector::const_iterator it = list.begin(); - it != list.end(); ++it) { - ScreencastId id(it->id()); - id.set_title(it->title()); - screencast_list.push_back(id); - } - return screencast_list; - } - - private: - Type type_; - rtc::WindowId window_; - rtc::DesktopId desktop_; - std::string title_; // Optional. -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_SCREENCASTID_H_ diff --git a/include/talk/media/base/streamparams.h b/include/talk/media/base/streamparams.h deleted file mode 100644 index d082bee..0000000 --- a/include/talk/media/base/streamparams.h +++ /dev/null @@ -1,345 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains structures for describing SSRCs from a media source such -// as a MediaStreamTrack when it is sent across an RTP session. Multiple media -// sources may be sent across the same RTP session, each of them will be -// described by one StreamParams object -// SsrcGroup is used to describe the relationship between the SSRCs that -// are used for this media source. -// E.x: Consider a source that is sent as 3 simulcast streams -// Let the simulcast elements have SSRC 10, 20, 30. -// Let each simulcast element use FEC and let the protection packets have -// SSRC 11,21,31. -// To describe this 4 SsrcGroups are needed, -// StreamParams would then contain ssrc = {10,11,20,21,30,31} and -// ssrc_groups = {{SIM,{10,20,30}, {FEC,{10,11}, {FEC, {20,21}, {FEC {30,31}}} -// Please see RFC 5576. - -#ifndef TALK_MEDIA_BASE_STREAMPARAMS_H_ -#define TALK_MEDIA_BASE_STREAMPARAMS_H_ - -#include -#include -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" - -namespace cricket { - -extern const char kFecSsrcGroupSemantics[]; -extern const char kFidSsrcGroupSemantics[]; -extern const char kSimSsrcGroupSemantics[]; - -struct SsrcGroup { - SsrcGroup(const std::string& usage, const std::vector& ssrcs) - : semantics(usage), ssrcs(ssrcs) {} - - bool operator==(const SsrcGroup& other) const { - return (semantics == other.semantics && ssrcs == other.ssrcs); - } - bool operator!=(const SsrcGroup &other) const { - return !(*this == other); - } - - bool has_semantics(const std::string& semantics) const; - - std::string ToString() const; - - std::string semantics; // e.g FIX, FEC, SIM. - std::vector ssrcs; // SSRCs of this type. -}; - -struct StreamParams { - static StreamParams CreateLegacy(uint32_t ssrc) { - StreamParams stream; - stream.ssrcs.push_back(ssrc); - return stream; - } - - bool operator==(const StreamParams& other) const { - return (groupid == other.groupid && - id == other.id && - ssrcs == other.ssrcs && - ssrc_groups == other.ssrc_groups && - type == other.type && - display == other.display && - cname == other.cname && - sync_label == other.sync_label); - } - bool operator!=(const StreamParams &other) const { - return !(*this == other); - } - - uint32_t first_ssrc() const { - if (ssrcs.empty()) { - return 0; - } - - return ssrcs[0]; - } - bool has_ssrcs() const { - return !ssrcs.empty(); - } - bool has_ssrc(uint32_t ssrc) const { - return std::find(ssrcs.begin(), ssrcs.end(), ssrc) != ssrcs.end(); - } - void add_ssrc(uint32_t ssrc) { ssrcs.push_back(ssrc); } - bool has_ssrc_groups() const { - return !ssrc_groups.empty(); - } - bool has_ssrc_group(const std::string& semantics) const { - return (get_ssrc_group(semantics) != NULL); - } - const SsrcGroup* get_ssrc_group(const std::string& semantics) const { - for (std::vector::const_iterator it = ssrc_groups.begin(); - it != ssrc_groups.end(); ++it) { - if (it->has_semantics(semantics)) { - return &(*it); - } - } - return NULL; - } - - // Convenience function to add an FID ssrc for a primary_ssrc - // that's already been added. - inline bool AddFidSsrc(uint32_t primary_ssrc, uint32_t fid_ssrc) { - return AddSecondarySsrc(kFidSsrcGroupSemantics, primary_ssrc, fid_ssrc); - } - - // Convenience function to lookup the FID ssrc for a primary_ssrc. - // Returns false if primary_ssrc not found or FID not defined for it. - inline bool GetFidSsrc(uint32_t primary_ssrc, uint32_t* fid_ssrc) const { - return GetSecondarySsrc(kFidSsrcGroupSemantics, primary_ssrc, fid_ssrc); - } - - // Convenience to get all the SIM SSRCs if there are SIM ssrcs, or - // the first SSRC otherwise. - void GetPrimarySsrcs(std::vector* ssrcs) const; - - // Convenience to get all the FID SSRCs for the given primary ssrcs. - // If a given primary SSRC does not have a FID SSRC, the list of FID - // SSRCS will be smaller than the list of primary SSRCs. - void GetFidSsrcs(const std::vector& primary_ssrcs, - std::vector* fid_ssrcs) const; - - std::string ToString() const; - - // Resource of the MUC jid of the participant of with this stream. - // For 1:1 calls, should be left empty (which means remote streams - // and local streams should not be mixed together). - std::string groupid; - // Unique per-groupid, not across all groupids - std::string id; - std::vector ssrcs; // All SSRCs for this source - std::vector ssrc_groups; // e.g. FID, FEC, SIM - // Examples: "camera", "screencast" - std::string type; - // Friendly name describing stream - std::string display; - std::string cname; // RTCP CNAME - std::string sync_label; // Friendly name of cname. - - private: - bool AddSecondarySsrc(const std::string& semantics, - uint32_t primary_ssrc, - uint32_t secondary_ssrc); - bool GetSecondarySsrc(const std::string& semantics, - uint32_t primary_ssrc, - uint32_t* secondary_ssrc) const; -}; - -// A Stream can be selected by either groupid+id or ssrc. -struct StreamSelector { - explicit StreamSelector(uint32_t ssrc) : ssrc(ssrc) {} - - StreamSelector(const std::string& groupid, - const std::string& streamid) : - ssrc(0), - groupid(groupid), - streamid(streamid) { - } - - bool Matches(const StreamParams& stream) const { - if (ssrc == 0) { - return stream.groupid == groupid && stream.id == streamid; - } else { - return stream.has_ssrc(ssrc); - } - } - - uint32_t ssrc; - std::string groupid; - std::string streamid; -}; - -typedef std::vector StreamParamsVec; - -// A collection of audio and video and data streams. Most of the -// methods are merely for convenience. Many of these methods are keyed -// by ssrc, which is the source identifier in the RTP spec -// (http://tools.ietf.org/html/rfc3550). -// TODO(pthatcher): Add basic unit test for these. -// See https://code.google.com/p/webrtc/issues/detail?id=4107 -struct MediaStreams { - public: - MediaStreams() {} - void CopyFrom(const MediaStreams& sources); - - bool empty() const { - return audio_.empty() && video_.empty() && data_.empty(); - } - - std::vector* mutable_audio() { return &audio_; } - std::vector* mutable_video() { return &video_; } - std::vector* mutable_data() { return &data_; } - const std::vector& audio() const { return audio_; } - const std::vector& video() const { return video_; } - const std::vector& data() const { return data_; } - - // Gets a stream, returning true if found. - bool GetAudioStream( - const StreamSelector& selector, StreamParams* stream); - bool GetVideoStream( - const StreamSelector& selector, StreamParams* stream); - bool GetDataStream( - const StreamSelector& selector, StreamParams* stream); - // Adds a stream. - void AddAudioStream(const StreamParams& stream); - void AddVideoStream(const StreamParams& stream); - void AddDataStream(const StreamParams& stream); - // Removes a stream, returning true if found and removed. - bool RemoveAudioStream(const StreamSelector& selector); - bool RemoveVideoStream(const StreamSelector& selector); - bool RemoveDataStream(const StreamSelector& selector); - - private: - std::vector audio_; - std::vector video_; - std::vector data_; - - RTC_DISALLOW_COPY_AND_ASSIGN(MediaStreams); -}; - -// A request for a specific format of a specific stream. -struct StaticVideoView { - StaticVideoView(const StreamSelector& selector, - int width, int height, int framerate) - : selector(selector), - width(width), - height(height), - framerate(framerate), - preference(0) { - } - - StreamSelector selector; - int width; - int height; - int framerate; - int preference; -}; - -typedef std::vector StaticVideoViews; - -// A request for several streams in various formats. -struct ViewRequest { - StaticVideoViews static_video_views; -}; - -template -const StreamParams* GetStream(const StreamParamsVec& streams, - Condition condition) { - StreamParamsVec::const_iterator found = - std::find_if(streams.begin(), streams.end(), condition); - return found == streams.end() ? nullptr : &(*found); -} - -inline const StreamParams* GetStreamBySsrc(const StreamParamsVec& streams, - uint32_t ssrc) { - return GetStream(streams, - [&ssrc](const StreamParams& sp) { return sp.has_ssrc(ssrc); }); -} - -inline const StreamParams* GetStreamByIds(const StreamParamsVec& streams, - const std::string& groupid, - const std::string& id) { - return GetStream(streams, - [&groupid, &id](const StreamParams& sp) { - return sp.groupid == groupid && sp.id == id; - }); -} - -inline const StreamParams* GetStream(const StreamParamsVec& streams, - const StreamSelector& selector) { - return GetStream(streams, - [&selector](const StreamParams& sp) { return selector.Matches(sp); }); -} - -template -bool RemoveStream(StreamParamsVec* streams, Condition condition) { - auto iter(std::remove_if(streams->begin(), streams->end(), condition)); - if (iter == streams->end()) - return false; - streams->erase(iter, streams->end()); - return true; -} - -// Removes the stream from streams. Returns true if a stream is -// found and removed. -inline bool RemoveStream(StreamParamsVec* streams, - const StreamSelector& selector) { - return RemoveStream(streams, - [&selector](const StreamParams& sp) { return selector.Matches(sp); }); -} -inline bool RemoveStreamBySsrc(StreamParamsVec* streams, uint32_t ssrc) { - return RemoveStream(streams, - [&ssrc](const StreamParams& sp) { return sp.has_ssrc(ssrc); }); -} -inline bool RemoveStreamByIds(StreamParamsVec* streams, - const std::string& groupid, - const std::string& id) { - return RemoveStream(streams, - [&groupid, &id](const StreamParams& sp) { - return sp.groupid == groupid && sp.id == id; - }); -} - -// Checks if |sp| defines parameters for a single primary stream. There may -// be an RTX stream associated with the primary stream. Leaving as non-static so -// we can test this function. -bool IsOneSsrcStream(const StreamParams& sp); - -// Checks if |sp| defines parameters for one Simulcast stream. There may be RTX -// streams associated with the simulcast streams. Leaving as non-static so we -// can test this function. -bool IsSimulcastStream(const StreamParams& sp); - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_STREAMPARAMS_H_ diff --git a/include/talk/media/base/testutils.h b/include/talk/media/base/testutils.h deleted file mode 100644 index 20c0d62..0000000 --- a/include/talk/media/base/testutils.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_TESTUTILS_H_ -#define TALK_MEDIA_BASE_TESTUTILS_H_ - -#include -#include - -#include "libyuv/compare.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/videocapturer.h" -#include "talk/media/base/videocommon.h" -#include "webrtc/base/arraysize.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/window.h" - -namespace rtc { -class ByteBuffer; -class StreamInterface; -} - -namespace cricket { - -// Returns size of 420 image with rounding on chroma for odd sizes. -#define I420_SIZE(w, h) (w * h + (((w + 1) / 2) * ((h + 1) / 2)) * 2) -// Returns size of ARGB image. -#define ARGB_SIZE(w, h) (w * h * 4) - -template inline std::vector MakeVector(const T a[], size_t s) { - return std::vector(a, a + s); -} -#define MAKE_VECTOR(a) cricket::MakeVector(a, arraysize(a)) - -struct RtpDumpPacket; -class RtpDumpWriter; -class VideoFrame; - -struct RawRtpPacket { - void WriteToByteBuffer(uint32_t in_ssrc, rtc::ByteBuffer* buf) const; - bool ReadFromByteBuffer(rtc::ByteBuffer* buf); - // Check if this packet is the same as the specified packet except the - // sequence number and timestamp, which should be the same as the specified - // parameters. - bool SameExceptSeqNumTimestampSsrc(const RawRtpPacket& packet, - uint16_t seq, - uint32_t ts, - uint32_t ssc) const; - int size() const { return 28; } - - uint8_t ver_to_cc; - uint8_t m_to_pt; - uint16_t sequence_number; - uint32_t timestamp; - uint32_t ssrc; - char payload[16]; -}; - -struct RawRtcpPacket { - void WriteToByteBuffer(rtc::ByteBuffer* buf) const; - bool ReadFromByteBuffer(rtc::ByteBuffer* buf); - bool EqualsTo(const RawRtcpPacket& packet) const; - - uint8_t ver_to_count; - uint8_t type; - uint16_t length; - char payload[16]; -}; - -class RtpTestUtility { - public: - static size_t GetTestPacketCount(); - - // Write the first count number of kTestRawRtcpPackets or kTestRawRtpPackets, - // depending on the flag rtcp. If it is RTP, use the specified SSRC. Return - // true if successful. - static bool WriteTestPackets(size_t count, - bool rtcp, - uint32_t rtp_ssrc, - RtpDumpWriter* writer); - - // Loop read the first count number of packets from the specified stream. - // Verify the elapsed time of the dump packets increase monotonically. If the - // stream is a RTP stream, verify the RTP sequence number, timestamp, and - // payload. If the stream is a RTCP stream, verify the RTCP header and - // payload. - static bool VerifyTestPacketsFromStream(size_t count, - rtc::StreamInterface* stream, - uint32_t ssrc); - - // Verify the dump packet is the same as the raw RTP packet. - static bool VerifyPacket(const RtpDumpPacket* dump, - const RawRtpPacket* raw, - bool header_only); - - static const uint32_t kDefaultSsrc = 1; - static const uint32_t kRtpTimestampIncrease = 90; - static const uint32_t kDefaultTimeIncrease = 30; - static const uint32_t kElapsedTimeInterval = 10; - static const RawRtpPacket kTestRawRtpPackets[]; - static const RawRtcpPacket kTestRawRtcpPackets[]; - - private: - RtpTestUtility() {} -}; - -// Test helper for testing VideoCapturer implementations. -class VideoCapturerListener : public sigslot::has_slots<> { - public: - explicit VideoCapturerListener(VideoCapturer* cap); - - CaptureState last_capture_state() const { return last_capture_state_; } - int frame_count() const { return frame_count_; } - uint32_t frame_fourcc() const { return frame_fourcc_; } - int frame_width() const { return frame_width_; } - int frame_height() const { return frame_height_; } - uint32_t frame_size() const { return frame_size_; } - bool resolution_changed() const { return resolution_changed_; } - - void OnStateChange(VideoCapturer* capturer, CaptureState state); - void OnFrameCaptured(VideoCapturer* capturer, const CapturedFrame* frame); - - private: - CaptureState last_capture_state_; - int frame_count_; - uint32_t frame_fourcc_; - int frame_width_; - int frame_height_; - uint32_t frame_size_; - bool resolution_changed_; -}; - -class ScreencastEventCatcher : public sigslot::has_slots<> { - public: - ScreencastEventCatcher() : ssrc_(0), ev_(rtc::WE_RESIZE) { } - uint32_t ssrc() const { return ssrc_; } - rtc::WindowEvent event() const { return ev_; } - void OnEvent(uint32_t ssrc, rtc::WindowEvent ev) { - ssrc_ = ssrc; - ev_ = ev; - } - private: - uint32_t ssrc_; - rtc::WindowEvent ev_; -}; - -class VideoMediaErrorCatcher : public sigslot::has_slots<> { - public: - VideoMediaErrorCatcher() : ssrc_(0), error_(VideoMediaChannel::ERROR_NONE) { } - uint32_t ssrc() const { return ssrc_; } - VideoMediaChannel::Error error() const { return error_; } - void OnError(uint32_t ssrc, VideoMediaChannel::Error error) { - ssrc_ = ssrc; - error_ = error; - } - private: - uint32_t ssrc_; - VideoMediaChannel::Error error_; -}; - -// Returns the absolute path to a file in the testdata/ directory. -std::string GetTestFilePath(const std::string& filename); - -// PSNR formula: psnr = 10 * log10 (Peak Signal^2 / mse) -// sse is set to a small number for identical frames or sse == 0 -static inline double ComputePSNR(double sse, double count) { - return libyuv::SumSquareErrorToPsnr(static_cast(sse), - static_cast(count)); -} - -static inline double ComputeSumSquareError(const uint8_t* org, - const uint8_t* rec, - int size) { - return static_cast(libyuv::ComputeSumSquareError(org, rec, size)); -} - -// Loads the image with the specified prefix and size into |out|. -bool LoadPlanarYuvTestImage(const std::string& prefix, - int width, - int height, - uint8_t* out); - -// Dumps the YUV image out to a file, for visual inspection. -// PYUV tool can be used to view dump files. -void DumpPlanarYuvTestImage(const std::string& prefix, - const uint8_t* img, - int w, - int h); - -// Dumps the ARGB image out to a file, for visual inspection. -// ffplay tool can be used to view dump files. -void DumpPlanarArgbTestImage(const std::string& prefix, - const uint8_t* img, - int w, - int h); - -// Compare two I420 frames. -bool VideoFrameEqual(const VideoFrame* frame0, const VideoFrame* frame1); - -// Checks whether |codecs| contains |codec|; checks using Codec::Matches(). -template -bool ContainsMatchingCodec(const std::vector& codecs, const C& codec) { - typename std::vector::const_iterator it; - for (it = codecs.begin(); it != codecs.end(); ++it) { - if (it->Matches(codec)) { - return true; - } - } - return false; -} - -// Create Simulcast StreamParams with given |ssrcs| and |cname|. -cricket::StreamParams CreateSimStreamParams(const std::string& cname, - const std::vector& ssrcs); -// Create Simulcast stream with given |ssrcs| and |rtx_ssrcs|. -// The number of |rtx_ssrcs| must match number of |ssrcs|. -cricket::StreamParams CreateSimWithRtxStreamParams( - const std::string& cname, - const std::vector& ssrcs, - const std::vector& rtx_ssrcs); - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_TESTUTILS_H_ diff --git a/include/talk/media/base/videoadapter.h b/include/talk/media/base/videoadapter.h deleted file mode 100644 index 212f250..0000000 --- a/include/talk/media/base/videoadapter.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT -#define TALK_MEDIA_BASE_VIDEOADAPTER_H_ - -#include "talk/media/base/videocommon.h" -#include "webrtc/base/common.h" // For ASSERT -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" - -namespace cricket { - -class VideoFrame; - -// VideoAdapter adapts an input video frame to an output frame based on the -// specified input and output formats. The adaptation includes dropping frames -// to reduce frame rate and scaling frames. VideoAdapter is thread safe. -class VideoAdapter { - public: - VideoAdapter(); - virtual ~VideoAdapter(); - - virtual void SetInputFormat(const VideoFormat& format); - void SetOutputFormat(const VideoFormat& format); - // Constrain output resolution to this many pixels overall - void SetOutputNumPixels(int num_pixels); - int GetOutputNumPixels() const; - - const VideoFormat& input_format(); - // Returns true if the adapter will always return zero size from - // AdaptFrameResolution. - bool drops_all_frames() const; - const VideoFormat& output_format(); - - // Return the adapted resolution given the input resolution. The returned - // resolution will be 0x0 if the frame should be dropped. - VideoFormat AdaptFrameResolution(int in_width, int in_height); - - void set_scale_third(bool enable); - bool scale_third() const { return scale_third_; } - - int adaptation_changes() const { return adaption_changes_; } - - protected: - float FindClosestScale(int width, int height, int target_num_pixels); - float FindClosestViewScale(int width, int height, int target_num_pixels); - float FindLowerScale(int width, int height, int target_num_pixels); - - private: - const float* GetViewScaleFactors() const; - float FindScale(const float* scale_factors, - const float upbias, int width, int height, - int target_num_pixels); - - VideoFormat input_format_; - VideoFormat output_format_; - int output_num_pixels_; - bool scale_third_; // True if adapter allows scaling to 1/3 and 2/3. - int frames_in_; // Number of input frames. - int frames_out_; // Number of output frames. - int frames_scaled_; // Number of frames scaled. - int adaption_changes_; // Number of changes in scale factor. - size_t previous_width_; // Previous adapter output width. - size_t previous_height_; // Previous adapter output height. - int64_t interval_next_frame_; - // The critical section to protect the above variables. - rtc::CriticalSection critical_section_; - - RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter); -}; - -// CoordinatedVideoAdapter adapts the video input to the encoder by coordinating -// the format request from the server, the resolution request from the encoder, -// and the CPU load. -class CoordinatedVideoAdapter - : public VideoAdapter, public sigslot::has_slots<> { - public: - enum AdaptRequest { UPGRADE, KEEP, DOWNGRADE }; - enum AdaptReasonEnum { - ADAPTREASON_NONE = 0, - ADAPTREASON_CPU = 1, - ADAPTREASON_BANDWIDTH = 2, - ADAPTREASON_VIEW = 4 - }; - typedef int AdaptReason; - - CoordinatedVideoAdapter(); - virtual ~CoordinatedVideoAdapter() {} - - virtual void SetInputFormat(const VideoFormat& format); - - // Enable or disable video adaptation due to the change of the CPU load. - void set_cpu_adaptation(bool enable) { cpu_adaptation_ = enable; } - bool cpu_adaptation() const { return cpu_adaptation_; } - // Enable or disable smoothing when doing CPU adaptation. When smoothing is - // enabled, system CPU load is tracked using an exponential weighted - // average. - void set_cpu_smoothing(bool enable); - bool cpu_smoothing() const { return cpu_smoothing_; } - // Enable or disable video adaptation due to the change of the GD - void set_gd_adaptation(bool enable) { gd_adaptation_ = enable; } - bool gd_adaptation() const { return gd_adaptation_; } - // Enable or disable video adaptation due to the change of the View - void set_view_adaptation(bool enable) { view_adaptation_ = enable; } - bool view_adaptation() const { return view_adaptation_; } - // Enable or disable video adaptation to fast switch View - void set_view_switch(bool enable) { view_switch_ = enable; } - bool view_switch() const { return view_switch_; } - - CoordinatedVideoAdapter::AdaptReason adapt_reason() const { - return adapt_reason_; - } - - // When the video is decreased, set the waiting time for CPU adaptation to - // decrease video again. - void set_cpu_load_min_samples(int cpu_load_min_samples); - int cpu_load_min_samples() const { return cpu_load_min_samples_; } - // CPU system load high threshold for reducing resolution. e.g. 0.85f - void set_high_system_threshold(float high_system_threshold); - float high_system_threshold() const { return high_system_threshold_; } - // CPU system load low threshold for increasing resolution. e.g. 0.70f - void set_low_system_threshold(float low_system_threshold); - float low_system_threshold() const { return low_system_threshold_; } - // CPU process load threshold for reducing resolution. e.g. 0.10f - void set_process_threshold(float process_threshold); - float process_threshold() const { return process_threshold_; } - - // Handle the format request from the server via Jingle update message. - void OnOutputFormatRequest(const VideoFormat& format); - // Handle the resolution request from the encoder due to bandwidth changes. - void OnEncoderResolutionRequest(int width, int height, AdaptRequest request); - // Handle the resolution request for CPU overuse. - void OnCpuResolutionRequest(AdaptRequest request); - // Handle the CPU load provided by a CPU monitor. - void OnCpuLoadUpdated(int current_cpus, int max_cpus, - float process_load, float system_load); - - sigslot::signal0<> SignalCpuAdaptationUnable; - - private: - // Adapt to the minimum of the formats the server requests, the CPU wants, and - // the encoder wants. Returns true if resolution changed. - bool AdaptToMinimumFormat(int* new_width, int* new_height); - bool IsMinimumFormat(int pixels); - void StepPixelCount(CoordinatedVideoAdapter::AdaptRequest request, - int* num_pixels); - CoordinatedVideoAdapter::AdaptRequest FindCpuRequest( - int current_cpus, int max_cpus, - float process_load, float system_load); - - bool cpu_adaptation_; // True if cpu adaptation is enabled. - bool cpu_smoothing_; // True if cpu smoothing is enabled (with adaptation). - bool gd_adaptation_; // True if gd adaptation is enabled. - bool view_adaptation_; // True if view adaptation is enabled. - bool view_switch_; // True if view switch is enabled. - int cpu_downgrade_count_; - int cpu_load_min_samples_; - int cpu_load_num_samples_; - // cpu system load thresholds relative to max cpus. - float high_system_threshold_; - float low_system_threshold_; - // cpu process load thresholds relative to current cpus. - float process_threshold_; - // Video formats that the server view requests, the CPU wants, and the encoder - // wants respectively. The adapted output format is the minimum of these. - int view_desired_num_pixels_; - int64_t view_desired_interval_; - int encoder_desired_num_pixels_; - int cpu_desired_num_pixels_; - CoordinatedVideoAdapter::AdaptReason adapt_reason_; - // The critical section to protect handling requests. - rtc::CriticalSection request_critical_section_; - - // The weighted average of cpu load over time. It's always updated (if cpu - // adaptation is on), but only used if cpu_smoothing_ is set. - float system_load_average_; - - RTC_DISALLOW_COPY_AND_ASSIGN(CoordinatedVideoAdapter); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT diff --git a/include/talk/media/base/videocapturer.h b/include/talk/media/base/videocapturer.h deleted file mode 100644 index 387a4b9..0000000 --- a/include/talk/media/base/videocapturer.h +++ /dev/null @@ -1,397 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Declaration of abstract class VideoCapturer - -#ifndef TALK_MEDIA_BASE_VIDEOCAPTURER_H_ -#define TALK_MEDIA_BASE_VIDEOCAPTURER_H_ - -#include -#include -#include - -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/videoadapter.h" -#include "talk/media/base/videocommon.h" -#include "talk/media/base/videoframefactory.h" -#include "talk/media/devices/devicemanager.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/rollingaccumulator.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/timing.h" - - -namespace cricket { - -// Current state of the capturer. -// TODO(hellner): CS_NO_DEVICE is an error code not a capture state. Separate -// error codes and states. -enum CaptureState { - CS_STOPPED, // The capturer has been stopped or hasn't started yet. - CS_STARTING, // The capturer is in the process of starting. Note, it may - // still fail to start. - CS_RUNNING, // The capturer has been started successfully and is now - // capturing. - CS_PAUSED, // The capturer has been paused. - CS_FAILED, // The capturer failed to start. - CS_NO_DEVICE, // The capturer has no device and consequently failed to start. -}; - -class VideoFrame; - -struct CapturedFrame { - static const uint32_t kFrameHeaderSize = 40; // Size from width to data_size. - static const uint32_t kUnknownDataSize = 0xFFFFFFFF; - - CapturedFrame(); - - // Get the number of bytes of the frame data. If data_size is known, return - // it directly. Otherwise, calculate the size based on width, height, and - // fourcc. Return true if succeeded. - bool GetDataSize(uint32_t* size) const; - - // The width and height of the captured frame could be different from those - // of VideoFormat. Once the first frame is captured, the width, height, - // fourcc, pixel_width, and pixel_height should keep the same over frames. - int width; // in number of pixels - int height; // in number of pixels - uint32_t fourcc; // compression - uint32_t pixel_width; // width of a pixel, default is 1 - uint32_t pixel_height; // height of a pixel, default is 1 - int64_t time_stamp; // timestamp of when the frame was captured, in unix - // time with nanosecond units. - uint32_t data_size; // number of bytes of the frame data - - webrtc::VideoRotation rotation; // rotation in degrees of the frame. - - void* data; // pointer to the frame data. This object allocates the - // memory or points to an existing memory. - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(CapturedFrame); -}; - -// VideoCapturer is an abstract class that defines the interfaces for video -// capturing. The subclasses implement the video capturer for various types of -// capturers and various platforms. -// -// The captured frames may need to be adapted (for example, cropping). -// Video adaptation is built into and enabled by default. After a frame has -// been captured from the device, it is sent to the video adapter, then out to -// the encoder. -// -// Programming model: -// Create an object of a subclass of VideoCapturer -// Initialize -// SignalStateChange.connect() -// SignalFrameCaptured.connect() -// Find the capture format for Start() by either calling GetSupportedFormats() -// and selecting one of the supported or calling GetBestCaptureFormat(). -// video_adapter()->OnOutputFormatRequest(desired_encoding_format) -// Start() -// GetCaptureFormat() optionally -// Stop() -// -// Assumption: -// The Start() and Stop() methods are called by a single thread (E.g., the -// media engine thread). Hence, the VideoCapture subclasses dont need to be -// thread safe. -// -class VideoCapturer - : public sigslot::has_slots<>, - public rtc::MessageHandler { - public: - // All signals are marshalled to |thread| or the creating thread if - // none is provided. - VideoCapturer(); - explicit VideoCapturer(rtc::Thread* thread); - virtual ~VideoCapturer() {} - - // Gets the id of the underlying device, which is available after the capturer - // is initialized. Can be used to determine if two capturers reference the - // same device. - const std::string& GetId() const { return id_; } - - // Get the capture formats supported by the video capturer. The supported - // formats are non empty after the device has been opened successfully. - const std::vector* GetSupportedFormats() const; - - // Get the best capture format for the desired format. The best format is the - // same as one of the supported formats except that the frame interval may be - // different. If the application asks for 16x9 and the camera does not support - // 16x9 HD or the application asks for 16x10, we find the closest 4x3 and then - // crop; Otherwise, we find what the application asks for. Note that we assume - // that for HD, the desired format is always 16x9. The subclasses can override - // the default implementation. - // Parameters - // desired: the input desired format. If desired.fourcc is not kAnyFourcc, - // the best capture format has the exactly same fourcc. Otherwise, - // the best capture format uses a fourcc in GetPreferredFourccs(). - // best_format: the output of the best capture format. - // Return false if there is no such a best format, that is, the desired format - // is not supported. - virtual bool GetBestCaptureFormat(const VideoFormat& desired, - VideoFormat* best_format); - - // TODO(hellner): deprecate (make private) the Start API in favor of this one. - // Also remove CS_STARTING as it is implied by the return - // value of StartCapturing(). - bool StartCapturing(const VideoFormat& capture_format); - // Start the video capturer with the specified capture format. - // Parameter - // capture_format: The caller got this parameter by either calling - // GetSupportedFormats() and selecting one of the supported - // or calling GetBestCaptureFormat(). - // Return - // CS_STARTING: The capturer is trying to start. Success or failure will - // be notified via the |SignalStateChange| callback. - // CS_RUNNING: if the capturer is started and capturing. - // CS_PAUSED: Will never be returned. - // CS_FAILED: if the capturer failes to start.. - // CS_NO_DEVICE: if the capturer has no device and fails to start. - virtual CaptureState Start(const VideoFormat& capture_format) = 0; - // Sets the desired aspect ratio. If the capturer is capturing at another - // aspect ratio it will crop the width or the height so that asked for - // aspect ratio is acheived. Note that ratio_w and ratio_h do not need to be - // relatively prime. - void UpdateAspectRatio(int ratio_w, int ratio_h); - void ClearAspectRatio(); - - // Get the current capture format, which is set by the Start() call. - // Note that the width and height of the captured frames may differ from the - // capture format. For example, the capture format is HD but the captured - // frames may be smaller than HD. - const VideoFormat* GetCaptureFormat() const { - return capture_format_.get(); - } - - // Pause the video capturer. - virtual bool Pause(bool paused); - // Stop the video capturer. - virtual void Stop() = 0; - // Check if the video capturer is running. - virtual bool IsRunning() = 0; - // Restart the video capturer with the new |capture_format|. - // Default implementation stops and starts the capturer. - virtual bool Restart(const VideoFormat& capture_format); - // TODO(thorcarpenter): This behavior of keeping the camera open just to emit - // black frames is a total hack and should be fixed. - // When muting, produce black frames then pause the camera. - // When unmuting, start the camera. Camera starts unmuted. - virtual bool MuteToBlackThenPause(bool muted); - virtual bool IsMuted() const { - return muted_; - } - CaptureState capture_state() const { - return capture_state_; - } - - // Tells videocapturer whether to apply the pending rotation. By default, the - // rotation is applied and the generated frame is up right. When set to false, - // generated frames will carry the rotation information from - // SetCaptureRotation. Return value indicates whether this operation succeeds. - virtual bool SetApplyRotation(bool enable); - virtual bool GetApplyRotation() { return apply_rotation_; } - - // Returns true if the capturer is screencasting. This can be used to - // implement screencast specific behavior. - virtual bool IsScreencast() const = 0; - - // Caps the VideoCapturer's format according to max_format. It can e.g. be - // used to prevent cameras from capturing at a resolution or framerate that - // the capturer is capable of but not performing satisfactorily at. - // The capping is an upper bound for each component of the capturing format. - // The fourcc component is ignored. - void ConstrainSupportedFormats(const VideoFormat& max_format); - - void set_enable_camera_list(bool enable_camera_list) { - enable_camera_list_ = enable_camera_list; - } - bool enable_camera_list() { - return enable_camera_list_; - } - - // Enable scaling to ensure square pixels. - void set_square_pixel_aspect_ratio(bool square_pixel_aspect_ratio) { - square_pixel_aspect_ratio_ = square_pixel_aspect_ratio; - } - bool square_pixel_aspect_ratio() { - return square_pixel_aspect_ratio_; - } - - // Signal all capture state changes that are not a direct result of calling - // Start(). - sigslot::signal2 SignalStateChange; - // Frame callbacks are multithreaded to allow disconnect and connect to be - // called concurrently. It also ensures that it is safe to call disconnect - // at any time which is needed since the signal may be called from an - // unmarshalled thread owned by the VideoCapturer. - // Signal the captured frame to downstream. - sigslot::signal2 SignalFrameCaptured; - // Signal the captured and possibly adapted frame to downstream consumers - // such as the encoder. - sigslot::signal2 SignalVideoFrame; - - // If 'screencast_max_pixels' is set greater than zero, screencasts will be - // scaled to be no larger than this value. - // If set to zero, the max pixels will be limited to - // Retina MacBookPro 15" resolution of 2880 x 1800. - // For high fps, maximum pixels limit is set based on common 24" monitor - // resolution of 2048 x 1280. - int screencast_max_pixels() const { return screencast_max_pixels_; } - void set_screencast_max_pixels(int p) { - screencast_max_pixels_ = std::max(0, p); - } - - // If true, run video adaptation. By default, video adaptation is enabled - // and users must call video_adapter()->OnOutputFormatRequest() - // to receive frames. - bool enable_video_adapter() const { return enable_video_adapter_; } - void set_enable_video_adapter(bool enable_video_adapter) { - enable_video_adapter_ = enable_video_adapter; - } - - CoordinatedVideoAdapter* video_adapter() { return &video_adapter_; } - const CoordinatedVideoAdapter* video_adapter() const { - return &video_adapter_; - } - - // Takes ownership. - void set_frame_factory(VideoFrameFactory* frame_factory); - - // Gets statistics for tracked variables recorded since the last call to - // GetStats. Note that calling GetStats resets any gathered data so it - // should be called only periodically to log statistics. - void GetStats(VariableInfo* adapt_drop_stats, - VariableInfo* effect_drop_stats, - VariableInfo* frame_time_stats, - VideoFormat* last_captured_frame_format); - - protected: - // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. - void OnFrameCaptured(VideoCapturer* video_capturer, - const CapturedFrame* captured_frame); - void SetCaptureState(CaptureState state); - - // Marshals SignalStateChange onto thread_. - void OnMessage(rtc::Message* message); - - // subclasses override this virtual method to provide a vector of fourccs, in - // order of preference, that are expected by the media engine. - virtual bool GetPreferredFourccs(std::vector* fourccs) = 0; - - // mutators to set private attributes - void SetId(const std::string& id) { - id_ = id; - } - - void SetCaptureFormat(const VideoFormat* format) { - capture_format_.reset(format ? new VideoFormat(*format) : NULL); - if (capture_format_) { - ASSERT(capture_format_->interval > 0 && - "Capture format expected to have positive interval."); - // Video adapter really only cares about capture format interval. - video_adapter_.SetInputFormat(*capture_format_); - } - } - - void SetSupportedFormats(const std::vector& formats); - VideoFrameFactory* frame_factory() { return frame_factory_.get(); } - - private: - void Construct(); - // Get the distance between the desired format and the supported format. - // Return the max distance if they mismatch. See the implementation for - // details. - int64_t GetFormatDistance(const VideoFormat& desired, - const VideoFormat& supported); - - // Convert captured frame to readable string for LOG messages. - std::string ToString(const CapturedFrame* frame) const; - - // Updates filtered_supported_formats_ so that it contains the formats in - // supported_formats_ that fulfill all applied restrictions. - void UpdateFilteredSupportedFormats(); - // Returns true if format doesn't fulfill all applied restrictions. - bool ShouldFilterFormat(const VideoFormat& format) const; - - void UpdateStats(const CapturedFrame* captured_frame); - - // Helper function to save statistics on the current data from a - // RollingAccumulator into stats. - template - static void GetVariableSnapshot( - const rtc::RollingAccumulator& data, - VariableInfo* stats); - - rtc::Thread* thread_; - std::string id_; - CaptureState capture_state_; - rtc::scoped_ptr frame_factory_; - rtc::scoped_ptr capture_format_; - std::vector supported_formats_; - rtc::scoped_ptr max_format_; - std::vector filtered_supported_formats_; - - int ratio_w_; // View resolution. e.g. 1280 x 720. - int ratio_h_; - bool enable_camera_list_; - bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. - int scaled_width_; // Current output size from ComputeScale. - int scaled_height_; - int screencast_max_pixels_; // Downscale screencasts further if requested. - bool muted_; - int black_frame_count_down_; - - bool enable_video_adapter_; - CoordinatedVideoAdapter video_adapter_; - - rtc::Timing frame_length_time_reporter_; - rtc::CriticalSection frame_stats_crit_; - - int adapt_frame_drops_; - rtc::RollingAccumulator adapt_frame_drops_data_; - double previous_frame_time_; - rtc::RollingAccumulator frame_time_data_; - // The captured frame format before potential adapation. - VideoFormat last_captured_frame_format_; - - // Whether capturer should apply rotation to the frame before signaling it. - bool apply_rotation_; - - RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEOCAPTURER_H_ diff --git a/include/talk/media/base/videocapturerfactory.h b/include/talk/media/base/videocapturerfactory.h deleted file mode 100755 index 6cb629a..0000000 --- a/include/talk/media/base/videocapturerfactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEOCAPTURERFACTORY_H_ -#define TALK_MEDIA_BASE_VIDEOCAPTURERFACTORY_H_ - -#include "talk/media/base/device.h" -#include "talk/media/base/screencastid.h" - -namespace cricket { - -class VideoCapturer; - -class VideoDeviceCapturerFactory { - public: - VideoDeviceCapturerFactory() {} - virtual ~VideoDeviceCapturerFactory() {} - - virtual VideoCapturer* Create(const Device& device) = 0; -}; - -class ScreenCapturerFactory { - public: - ScreenCapturerFactory() {} - virtual ~ScreenCapturerFactory() {} - - virtual VideoCapturer* Create(const ScreencastId& screenid) = 0; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEOCAPTURERFACTORY_H_ diff --git a/include/talk/media/base/videocommon.h b/include/talk/media/base/videocommon.h deleted file mode 100644 index c28a07b..0000000 --- a/include/talk/media/base/videocommon.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Common definition for video, including fourcc and VideoFormat. - -#ifndef TALK_MEDIA_BASE_VIDEOCOMMON_H_ // NOLINT -#define TALK_MEDIA_BASE_VIDEOCOMMON_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/timeutils.h" - -namespace cricket { - -// TODO(janahan): For now, a hard-coded ssrc is used as the video ssrc. -// This is because when the video frame is passed to the mediaprocessor for -// processing, it doesn't have the correct ssrc. Since currently only Tx -// Video processing is supported, this is ok. When we switch over to trigger -// from capturer, this should be fixed and this const removed. -const uint32_t kDummyVideoSsrc = 0xFFFFFFFF; - -// Minimum interval is 10k fps. -#define FPS_TO_INTERVAL(fps) \ - (fps ? rtc::kNumNanosecsPerSec / fps : \ - rtc::kNumNanosecsPerSec / 10000) - -////////////////////////////////////////////////////////////////////////////// -// Definition of FourCC codes -////////////////////////////////////////////////////////////////////////////// -// Convert four characters to a FourCC code. -// Needs to be a macro otherwise the OS X compiler complains when the kFormat* -// constants are used in a switch. -#define FOURCC(a, b, c, d) \ - ((static_cast(a)) | (static_cast(b) << 8) | \ - (static_cast(c) << 16) | (static_cast(d) << 24)) -// Some pages discussing FourCC codes: -// http://www.fourcc.org/yuv.php -// http://v4l2spec.bytesex.org/spec/book1.htm -// http://developer.apple.com/quicktime/icefloe/dispatch020.html -// http://msdn.microsoft.com/library/windows/desktop/dd206750.aspx#nv12 -// http://people.xiph.org/~xiphmont/containers/nut/nut4cc.txt - -// FourCC codes grouped according to implementation efficiency. -// Primary formats should convert in 1 efficient step. -// Secondary formats are converted in 2 steps. -// Auxilliary formats call primary converters. -enum FourCC { - // 9 Primary YUV formats: 5 planar, 2 biplanar, 2 packed. - FOURCC_I420 = FOURCC('I', '4', '2', '0'), - FOURCC_I422 = FOURCC('I', '4', '2', '2'), - FOURCC_I444 = FOURCC('I', '4', '4', '4'), - FOURCC_I411 = FOURCC('I', '4', '1', '1'), - FOURCC_I400 = FOURCC('I', '4', '0', '0'), - FOURCC_NV21 = FOURCC('N', 'V', '2', '1'), - FOURCC_NV12 = FOURCC('N', 'V', '1', '2'), - FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'), - FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'), - - // 2 Secondary YUV formats: row biplanar. - FOURCC_M420 = FOURCC('M', '4', '2', '0'), - - // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp. - FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'), - FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'), - FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'), - FOURCC_24BG = FOURCC('2', '4', 'B', 'G'), - FOURCC_RAW = FOURCC('r', 'a', 'w', ' '), - FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'), - FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // bgr565. - FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // abgr1555. - FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444. - - // 4 Secondary RGB formats: 4 Bayer Patterns. - FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'), - FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'), - FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'), - FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'), - - // 1 Primary Compressed YUV format. - FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'), - - // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias. - FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'), - FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'), - FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'), - FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420. - FOURCC_J420 = FOURCC('J', '4', '2', '0'), - FOURCC_J400 = FOURCC('J', '4', '0', '0'), - - // 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc. - FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420. - FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422. - FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444. - FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2. - FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac. - FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY. - FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac. - FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG. - FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac. - FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR. - FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW. - FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG. - FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARGB - FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB - - // 1 Auxiliary compressed YUV format set aside for capturer. - FOURCC_H264 = FOURCC('H', '2', '6', '4'), -}; - -// Match any fourcc. - -// We move this out of the enum because using it in many places caused -// the compiler to get grumpy, presumably since the above enum is -// backed by an int. -static const uint32_t FOURCC_ANY = 0xFFFFFFFF; - -// Converts fourcc aliases into canonical ones. -uint32_t CanonicalFourCC(uint32_t fourcc); - -// Get FourCC code as a string. -inline std::string GetFourccName(uint32_t fourcc) { - std::string name; - name.push_back(static_cast(fourcc & 0xFF)); - name.push_back(static_cast((fourcc >> 8) & 0xFF)); - name.push_back(static_cast((fourcc >> 16) & 0xFF)); - name.push_back(static_cast((fourcc >> 24) & 0xFF)); - return name; -} - -// Computes a scale less to fit in max_pixels while maintaining aspect ratio. -void ComputeScaleMaxPixels(int frame_width, int frame_height, int max_pixels, - int* scaled_width, int* scaled_height); - -// For low fps, max pixels limit is set to Retina MacBookPro 15" resolution of -// 2880 x 1800 as of 4/18/2013. -// For high fps, maximum pixels limit is set based on common 24" monitor -// resolution of 2048 x 1280 as of 6/13/2013. The Retina resolution is -// therefore reduced to 1440 x 900. -void ComputeScale(int frame_width, int frame_height, int fps, - int* scaled_width, int* scaled_height); - -// Compute the frame size that conversion should crop to based on aspect ratio. -// Ensures size is multiple of 2 due to I420 and conversion limitations. -void ComputeCrop(int cropped_format_width, int cropped_format_height, - int frame_width, int frame_height, - int pixel_width, int pixel_height, - int rotation, - int* cropped_width, int* cropped_height); - -// Compute the frame size that makes pixels square pixel aspect ratio. -void ComputeScaleToSquarePixels(int in_width, int in_height, - int pixel_width, int pixel_height, - int* scaled_width, int* scaled_height); - -////////////////////////////////////////////////////////////////////////////// -// Definition of VideoFormat. -////////////////////////////////////////////////////////////////////////////// - -// VideoFormat with Plain Old Data for global variables. -struct VideoFormatPod { - int width; // Number of pixels. - int height; // Number of pixels. - int64_t interval; // Nanoseconds. - uint32_t fourcc; // Color space. FOURCC_ANY means that any color space is OK. -}; - -struct VideoFormat : VideoFormatPod { - static const int64_t kMinimumInterval = - rtc::kNumNanosecsPerSec / 10000; // 10k fps. - - VideoFormat() { - Construct(0, 0, 0, 0); - } - - VideoFormat(int w, int h, int64_t interval_ns, uint32_t cc) { - Construct(w, h, interval_ns, cc); - } - - explicit VideoFormat(const VideoFormatPod& format) { - Construct(format.width, format.height, format.interval, format.fourcc); - } - - void Construct(int w, int h, int64_t interval_ns, uint32_t cc) { - width = w; - height = h; - interval = interval_ns; - fourcc = cc; - } - - static int64_t FpsToInterval(int fps) { - return fps ? rtc::kNumNanosecsPerSec / fps : kMinimumInterval; - } - - static int IntervalToFps(int64_t interval) { - if (!interval) { - return 0; - } - return static_cast(rtc::kNumNanosecsPerSec / interval); - } - - static float IntervalToFpsFloat(int64_t interval) { - if (!interval) { - return 0.f; - } - return static_cast(rtc::kNumNanosecsPerSec) / - static_cast(interval); - } - - bool operator==(const VideoFormat& format) const { - return width == format.width && height == format.height && - interval == format.interval && fourcc == format.fourcc; - } - - bool operator!=(const VideoFormat& format) const { - return !(*this == format); - } - - bool operator<(const VideoFormat& format) const { - return (fourcc < format.fourcc) || - (fourcc == format.fourcc && width < format.width) || - (fourcc == format.fourcc && width == format.width && - height < format.height) || - (fourcc == format.fourcc && width == format.width && - height == format.height && interval > format.interval); - } - - int framerate() const { return IntervalToFps(interval); } - - // Check if both width and height are 0. - bool IsSize0x0() const { return 0 == width && 0 == height; } - - // Check if this format is less than another one by comparing the resolution - // and frame rate. - bool IsPixelRateLess(const VideoFormat& format) const { - return width * height * framerate() < - format.width * format.height * format.framerate(); - } - - // Get a string presentation in the form of "fourcc width x height x fps" - std::string ToString() const; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEOCOMMON_H_ // NOLINT diff --git a/include/talk/media/base/videoengine_unittest.h b/include/talk/media/base/videoengine_unittest.h deleted file mode 100644 index d7fa00d..0000000 --- a/include/talk/media/base/videoengine_unittest.h +++ /dev/null @@ -1,1498 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ // NOLINT -#define TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ - -#include -#include - -#include "talk/media/base/fakenetworkinterface.h" -#include "talk/media/base/fakevideocapturer.h" -#include "talk/media/base/fakevideorenderer.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/streamparams.h" -#include "talk/media/webrtc/fakewebrtccall.h" -#include "webrtc/base/bytebuffer.h" -#include "webrtc/base/gunit.h" -#include "webrtc/base/timeutils.h" -#include "webrtc/call.h" - -#define EXPECT_FRAME_WAIT(c, w, h, t) \ - EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \ - EXPECT_EQ((w), renderer_.width()); \ - EXPECT_EQ((h), renderer_.height()); \ - EXPECT_EQ(0, renderer_.errors()); \ - -#define EXPECT_FRAME_ON_RENDERER_WAIT(r, c, w, h, t) \ - EXPECT_EQ_WAIT((c), (r).num_rendered_frames(), (t)); \ - EXPECT_EQ((w), (r).width()); \ - EXPECT_EQ((h), (r).height()); \ - EXPECT_EQ(0, (r).errors()); \ - -#define EXPECT_GT_FRAME_ON_RENDERER_WAIT(r, c, w, h, t) \ - EXPECT_TRUE_WAIT((r).num_rendered_frames() >= (c) && \ - (w) == (r).width() && \ - (h) == (r).height(), (t)); \ - EXPECT_EQ(0, (r).errors()); - -static const uint32_t kTimeout = 5000U; -static const uint32_t kDefaultReceiveSsrc = 0; -static const uint32_t kSsrc = 1234u; -static const uint32_t kRtxSsrc = 4321u; -static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; - -inline bool IsEqualRes(const cricket::VideoCodec& a, int w, int h, int fps) { - return a.width == w && a.height == h && a.framerate == fps; -} - -inline bool IsEqualCodec(const cricket::VideoCodec& a, - const cricket::VideoCodec& b) { - return a.id == b.id && a.name == b.name && - IsEqualRes(a, b.width, b.height, b.framerate); -} - -namespace std { -inline std::ostream& operator<<(std::ostream& s, const cricket::VideoCodec& c) { - s << "{" << c.name << "(" << c.id << "), " - << c.width << "x" << c.height << "x" << c.framerate << "}"; - return s; -} -} // namespace std - -inline int TimeBetweenSend(const cricket::VideoCodec& codec) { - return static_cast( - cricket::VideoFormat::FpsToInterval(codec.framerate) / - rtc::kNumNanosecsPerMillisec); -} - -// Fake video engine that makes it possible to test enabling and disabling -// capturer (checking that the engine state is updated and that the capturer -// is indeed capturing) without having to create a channel. It also makes it -// possible to test that the media processors are indeed being called when -// registered. -template -class VideoEngineOverride : public T { - public: - VideoEngineOverride() : T() { - } - virtual ~VideoEngineOverride() { - } - bool is_camera_on() const { return T::GetVideoCapturer()->IsRunning(); } - void set_has_senders(bool has_senders) { - cricket::VideoCapturer* video_capturer = T::GetVideoCapturer(); - if (has_senders) { - video_capturer->SignalVideoFrame.connect(this, - &VideoEngineOverride::OnLocalFrame); - } else { - video_capturer->SignalVideoFrame.disconnect(this); - } - } - void OnLocalFrame(cricket::VideoCapturer*, - const cricket::VideoFrame*) { - } - void OnLocalFrameFormat(cricket::VideoCapturer*, - const cricket::VideoFormat*) { - } - - void TriggerMediaFrame(uint32_t ssrc, - cricket::VideoFrame* frame, - bool* drop_frame) { - T::SignalMediaFrame(ssrc, frame, drop_frame); - } -}; - -template -class VideoMediaChannelTest : public testing::Test, - public sigslot::has_slots<> { - protected: - VideoMediaChannelTest() - : call_(webrtc::Call::Create(webrtc::Call::Config())) {} - - virtual cricket::VideoCodec DefaultCodec() = 0; - - virtual cricket::StreamParams DefaultSendStreamParams() { - return cricket::StreamParams::CreateLegacy(kSsrc); - } - - virtual void SetUp() { - cricket::Device device("test", "device"); - engine_.Init(); - channel_.reset( - engine_.CreateChannel(call_.get(), cricket::VideoOptions())); - EXPECT_TRUE(channel_.get() != NULL); - network_interface_.SetDestination(channel_.get()); - channel_->SetInterface(&network_interface_); - media_error_ = cricket::VideoMediaChannel::ERROR_NONE; - cricket::VideoRecvParameters parameters; - parameters.codecs = engine_.codecs(); - channel_->SetRecvParameters(parameters); - EXPECT_TRUE(channel_->AddSendStream(DefaultSendStreamParams())); - video_capturer_.reset(CreateFakeVideoCapturer()); - cricket::VideoFormat format(640, 480, - cricket::VideoFormat::FpsToInterval(30), - cricket::FOURCC_I420); - EXPECT_EQ(cricket::CS_RUNNING, video_capturer_->Start(format)); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, video_capturer_.get())); - } - - virtual cricket::FakeVideoCapturer* CreateFakeVideoCapturer() { - return new cricket::FakeVideoCapturer(); - } - - // Utility method to setup an additional stream to send and receive video. - // Used to test send and recv between two streams. - void SetUpSecondStream() { - SetUpSecondStreamWithNoRecv(); - // Setup recv for second stream. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc + 2))); - // Make the second renderer available for use by a new stream. - EXPECT_TRUE(channel_->SetRenderer(kSsrc + 2, &renderer2_)); - } - // Setup an additional stream just to send video. Defer add recv stream. - // This is required if you want to test unsignalled recv of video rtp packets. - void SetUpSecondStreamWithNoRecv() { - // SetUp() already added kSsrc make sure duplicate SSRCs cant be added. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_)); - EXPECT_FALSE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(kSsrc + 2))); - // We dont add recv for the second stream. - - // Setup the receive and renderer for second stream after send. - video_capturer_2_.reset(CreateFakeVideoCapturer()); - cricket::VideoFormat format(640, 480, - cricket::VideoFormat::FpsToInterval(30), - cricket::FOURCC_I420); - EXPECT_EQ(cricket::CS_RUNNING, video_capturer_2_->Start(format)); - - EXPECT_TRUE(channel_->SetCapturer(kSsrc + 2, video_capturer_2_.get())); - } - virtual void TearDown() { - channel_.reset(); - } - bool SetDefaultCodec() { - return SetOneCodec(DefaultCodec()); - } - - bool SetOneCodec(int pt, const char* name, int w, int h, int fr) { - return SetOneCodec(cricket::VideoCodec(pt, name, w, h, fr, 0)); - } - bool SetOneCodec(const cricket::VideoCodec& codec) { - cricket::VideoFormat capture_format(codec.width, codec.height, - cricket::VideoFormat::FpsToInterval(codec.framerate), - cricket::FOURCC_I420); - - if (video_capturer_) { - EXPECT_EQ(cricket::CS_RUNNING, video_capturer_->Start(capture_format)); - } - if (video_capturer_2_) { - EXPECT_EQ(cricket::CS_RUNNING, video_capturer_2_->Start(capture_format)); - } - - bool sending = channel_->sending(); - bool success = SetSend(false); - if (success) { - cricket::VideoSendParameters parameters; - parameters.codecs.push_back(codec); - success = channel_->SetSendParameters(parameters); - } - if (success) { - success = SetSend(sending); - } - return success; - } - bool SetSend(bool send) { - return channel_->SetSend(send); - } - bool SetSendStreamFormat(uint32_t ssrc, const cricket::VideoCodec& codec) { - return channel_->SetSendStreamFormat(ssrc, cricket::VideoFormat( - codec.width, codec.height, - cricket::VideoFormat::FpsToInterval(codec.framerate), - cricket::FOURCC_ANY)); - } - int DrainOutgoingPackets() { - int packets = 0; - do { - packets = NumRtpPackets(); - // 100 ms should be long enough. - rtc::Thread::Current()->ProcessMessages(100); - } while (NumRtpPackets() > packets); - return NumRtpPackets(); - } - bool SendFrame() { - if (video_capturer_2_) { - video_capturer_2_->CaptureFrame(); - } - return video_capturer_.get() && - video_capturer_->CaptureFrame(); - } - bool WaitAndSendFrame(int wait_ms) { - bool ret = rtc::Thread::Current()->ProcessMessages(wait_ms); - ret &= SendFrame(); - return ret; - } - // Sends frames and waits for the decoder to be fully initialized. - // Returns the number of frames that were sent. - int WaitForDecoder() { -#if defined(HAVE_OPENMAX) - // Send enough frames for the OpenMAX decoder to continue processing, and - // return the number of frames sent. - // Send frames for a full kTimeout's worth of 15fps video. - int frame_count = 0; - while (frame_count < static_cast(kTimeout) / 66) { - EXPECT_TRUE(WaitAndSendFrame(66)); - ++frame_count; - } - return frame_count; -#else - return 0; -#endif - } - bool SendCustomVideoFrame(int w, int h) { - if (!video_capturer_.get()) return false; - return video_capturer_->CaptureCustomFrame(w, h, cricket::FOURCC_I420); - } - int NumRtpBytes() { - return network_interface_.NumRtpBytes(); - } - int NumRtpBytes(uint32_t ssrc) { - return network_interface_.NumRtpBytes(ssrc); - } - int NumRtpPackets() { - return network_interface_.NumRtpPackets(); - } - int NumRtpPackets(uint32_t ssrc) { - return network_interface_.NumRtpPackets(ssrc); - } - int NumSentSsrcs() { - return network_interface_.NumSentSsrcs(); - } - const rtc::Buffer* GetRtpPacket(int index) { - return network_interface_.GetRtpPacket(index); - } - int NumRtcpPackets() { - return network_interface_.NumRtcpPackets(); - } - const rtc::Buffer* GetRtcpPacket(int index) { - return network_interface_.GetRtcpPacket(index); - } - static int GetPayloadType(const rtc::Buffer* p) { - int pt = -1; - ParseRtpPacket(p, NULL, &pt, NULL, NULL, NULL, NULL); - return pt; - } - static bool ParseRtpPacket(const rtc::Buffer* p, - bool* x, - int* pt, - int* seqnum, - uint32_t* tstamp, - uint32_t* ssrc, - std::string* payload) { - rtc::ByteBuffer buf(*p); - uint8_t u08 = 0; - uint16_t u16 = 0; - uint32_t u32 = 0; - - // Read X and CC fields. - if (!buf.ReadUInt8(&u08)) return false; - bool extension = ((u08 & 0x10) != 0); - uint8_t cc = (u08 & 0x0F); - if (x) *x = extension; - - // Read PT field. - if (!buf.ReadUInt8(&u08)) return false; - if (pt) *pt = (u08 & 0x7F); - - // Read Sequence Number field. - if (!buf.ReadUInt16(&u16)) return false; - if (seqnum) *seqnum = u16; - - // Read Timestamp field. - if (!buf.ReadUInt32(&u32)) return false; - if (tstamp) *tstamp = u32; - - // Read SSRC field. - if (!buf.ReadUInt32(&u32)) return false; - if (ssrc) *ssrc = u32; - - // Skip CSRCs. - for (uint8_t i = 0; i < cc; ++i) { - if (!buf.ReadUInt32(&u32)) return false; - } - - // Skip extension header. - if (extension) { - // Read Profile-specific extension header ID - if (!buf.ReadUInt16(&u16)) return false; - - // Read Extension header length - if (!buf.ReadUInt16(&u16)) return false; - uint16_t ext_header_len = u16; - - // Read Extension header - for (uint16_t i = 0; i < ext_header_len; ++i) { - if (!buf.ReadUInt32(&u32)) return false; - } - } - - if (payload) { - return buf.ReadString(payload, buf.Length()); - } - return true; - } - - // Parse all RTCP packet, from start_index to stop_index, and count how many - // FIR (PT=206 and FMT=4 according to RFC 5104). If successful, set the count - // and return true. - bool CountRtcpFir(int start_index, int stop_index, int* fir_count) { - int count = 0; - for (int i = start_index; i < stop_index; ++i) { - rtc::scoped_ptr p(GetRtcpPacket(i)); - rtc::ByteBuffer buf(*p); - size_t total_len = 0; - // The packet may be a compound RTCP packet. - while (total_len < p->size()) { - // Read FMT, type and length. - uint8_t fmt = 0; - uint8_t type = 0; - uint16_t length = 0; - if (!buf.ReadUInt8(&fmt)) return false; - fmt &= 0x1F; - if (!buf.ReadUInt8(&type)) return false; - if (!buf.ReadUInt16(&length)) return false; - buf.Consume(length * 4); // Skip RTCP data. - total_len += (length + 1) * 4; - if ((192 == type) || ((206 == type) && (4 == fmt))) { - ++count; - } - } - } - - if (fir_count) { - *fir_count = count; - } - return true; - } - - void OnVideoChannelError(uint32_t ssrc, - cricket::VideoMediaChannel::Error error) { - media_error_ = error; - } - - // Test that SetSend works. - void SetSend() { - EXPECT_FALSE(channel_->sending()); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, video_capturer_.get())); - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - EXPECT_FALSE(channel_->sending()); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->sending()); - EXPECT_TRUE(SendFrame()); - EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); - EXPECT_TRUE(SetSend(false)); - EXPECT_FALSE(channel_->sending()); - } - // Test that SetSend fails without codecs being set. - void SetSendWithoutCodecs() { - EXPECT_FALSE(channel_->sending()); - EXPECT_FALSE(SetSend(true)); - EXPECT_FALSE(channel_->sending()); - } - // Test that we properly set the send and recv buffer sizes by the time - // SetSend is called. - void SetSendSetsTransportBufferSizes() { - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - EXPECT_TRUE(SetSend(true)); - EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size()); - EXPECT_EQ(64 * 1024, network_interface_.recvbuf_size()); - } - // Tests that we can send frames and the right payload type is used. - void Send(const cricket::VideoCodec& codec) { - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(SendFrame()); - EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); - rtc::scoped_ptr p(GetRtpPacket(0)); - EXPECT_EQ(codec.id, GetPayloadType(p.get())); - } - // Tests that we can send and receive frames. - void SendAndReceive(const cricket::VideoCodec& codec) { - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); - rtc::scoped_ptr p(GetRtpPacket(0)); - EXPECT_EQ(codec.id, GetPayloadType(p.get())); - } - // Tests that we only get a VideoRenderer::SetSize() callback when needed. - void SendManyResizeOnce() { - cricket::VideoCodec codec(DefaultCodec()); - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - EXPECT_TRUE(WaitAndSendFrame(30)); - EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); - EXPECT_TRUE(WaitAndSendFrame(30)); - EXPECT_FRAME_WAIT(2, codec.width, codec.height, kTimeout); - rtc::scoped_ptr p(GetRtpPacket(0)); - EXPECT_EQ(codec.id, GetPayloadType(p.get())); - EXPECT_EQ(1, renderer_.num_set_sizes()); - - codec.width /= 2; - codec.height /= 2; - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(WaitAndSendFrame(30)); - EXPECT_FRAME_WAIT(3, codec.width, codec.height, kTimeout); - EXPECT_EQ(2, renderer_.num_set_sizes()); - } - void SendReceiveManyAndGetStats(const cricket::VideoCodec& codec, - int duration_sec, int fps) { - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - for (int i = 0; i < duration_sec; ++i) { - for (int frame = 1; frame <= fps; ++frame) { - EXPECT_TRUE(WaitAndSendFrame(1000 / fps)); - EXPECT_FRAME_WAIT(frame + i * fps, codec.width, codec.height, kTimeout); - } - } - rtc::scoped_ptr p(GetRtpPacket(0)); - EXPECT_EQ(codec.id, GetPayloadType(p.get())); - } - - // Test that stats work properly for a 1-1 call. - void GetStats() { - const int kDurationSec = 3; - const int kFps = 10; - SendReceiveManyAndGetStats(DefaultCodec(), kDurationSec, kFps); - - cricket::VideoMediaInfo info; - EXPECT_TRUE(channel_->GetStats(&info)); - - ASSERT_EQ(1U, info.senders.size()); - // TODO(whyuan): bytes_sent and bytes_rcvd are different. Are both payload? - // For webrtc, bytes_sent does not include the RTP header length. - EXPECT_GT(info.senders[0].bytes_sent, 0); - EXPECT_EQ(NumRtpPackets(), info.senders[0].packets_sent); - EXPECT_EQ(0.0, info.senders[0].fraction_lost); - EXPECT_EQ(0, info.senders[0].firs_rcvd); - EXPECT_EQ(0, info.senders[0].plis_rcvd); - EXPECT_EQ(0, info.senders[0].nacks_rcvd); - EXPECT_EQ(DefaultCodec().width, info.senders[0].send_frame_width); - EXPECT_EQ(DefaultCodec().height, info.senders[0].send_frame_height); - EXPECT_GT(info.senders[0].framerate_input, 0); - EXPECT_GT(info.senders[0].framerate_sent, 0); - - ASSERT_EQ(1U, info.receivers.size()); - EXPECT_EQ(1U, info.senders[0].ssrcs().size()); - EXPECT_EQ(1U, info.receivers[0].ssrcs().size()); - EXPECT_EQ(info.senders[0].ssrcs()[0], info.receivers[0].ssrcs()[0]); - EXPECT_EQ(NumRtpBytes(), info.receivers[0].bytes_rcvd); - EXPECT_EQ(NumRtpPackets(), info.receivers[0].packets_rcvd); - EXPECT_EQ(0.0, info.receivers[0].fraction_lost); - EXPECT_EQ(0, info.receivers[0].packets_lost); - // TODO(asapersson): Not set for webrtc. Handle missing stats. - // EXPECT_EQ(0, info.receivers[0].packets_concealed); - EXPECT_EQ(0, info.receivers[0].firs_sent); - EXPECT_EQ(0, info.receivers[0].plis_sent); - EXPECT_EQ(0, info.receivers[0].nacks_sent); - EXPECT_EQ(DefaultCodec().width, info.receivers[0].frame_width); - EXPECT_EQ(DefaultCodec().height, info.receivers[0].frame_height); - EXPECT_GT(info.receivers[0].framerate_rcvd, 0); - EXPECT_GT(info.receivers[0].framerate_decoded, 0); - EXPECT_GT(info.receivers[0].framerate_output, 0); - } - - cricket::VideoSenderInfo GetSenderStats(size_t i) { - cricket::VideoMediaInfo info; - EXPECT_TRUE(channel_->GetStats(&info)); - return info.senders[i]; - } - - cricket::VideoReceiverInfo GetReceiverStats(size_t i) { - cricket::VideoMediaInfo info; - EXPECT_TRUE(channel_->GetStats(&info)); - return info.receivers[i]; - } - - // Test that stats work properly for a conf call with multiple recv streams. - void GetStatsMultipleRecvStreams() { - cricket::FakeVideoRenderer renderer1, renderer2; - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - cricket::VideoSendParameters parameters; - parameters.codecs.push_back(DefaultCodec()); - parameters.options.conference_mode = rtc::Optional(true); - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(1))); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(2))); - EXPECT_TRUE(channel_->SetRenderer(1, &renderer1)); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer2)); - EXPECT_EQ(0, renderer1.num_rendered_frames()); - EXPECT_EQ(0, renderer2.num_rendered_frames()); - std::vector ssrcs; - ssrcs.push_back(1); - ssrcs.push_back(2); - network_interface_.SetConferenceMode(true, ssrcs); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer1, 1, DefaultCodec().width, DefaultCodec().height, kTimeout); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer2, 1, DefaultCodec().width, DefaultCodec().height, kTimeout); - - EXPECT_TRUE(channel_->SetSend(false)); - - cricket::VideoMediaInfo info; - EXPECT_TRUE(channel_->GetStats(&info)); - ASSERT_EQ(1U, info.senders.size()); - // TODO(whyuan): bytes_sent and bytes_rcvd are different. Are both payload? - // For webrtc, bytes_sent does not include the RTP header length. - EXPECT_GT(GetSenderStats(0).bytes_sent, 0); - EXPECT_EQ_WAIT(NumRtpPackets(), GetSenderStats(0).packets_sent, kTimeout); - EXPECT_EQ(DefaultCodec().width, GetSenderStats(0).send_frame_width); - EXPECT_EQ(DefaultCodec().height, GetSenderStats(0).send_frame_height); - - ASSERT_EQ(2U, info.receivers.size()); - for (size_t i = 0; i < info.receivers.size(); ++i) { - EXPECT_EQ(1U, GetReceiverStats(i).ssrcs().size()); - EXPECT_EQ(i + 1, GetReceiverStats(i).ssrcs()[0]); - EXPECT_EQ_WAIT(NumRtpBytes(), GetReceiverStats(i).bytes_rcvd, kTimeout); - EXPECT_EQ_WAIT(NumRtpPackets(), GetReceiverStats(i).packets_rcvd, - kTimeout); - EXPECT_EQ(DefaultCodec().width, GetReceiverStats(i).frame_width); - EXPECT_EQ(DefaultCodec().height, GetReceiverStats(i).frame_height); - } - } - // Test that stats work properly for a conf call with multiple send streams. - void GetStatsMultipleSendStreams() { - // Normal setup; note that we set the SSRC explicitly to ensure that - // it will come first in the senders map. - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - cricket::VideoSendParameters parameters; - parameters.codecs.push_back(DefaultCodec()); - parameters.options.conference_mode = rtc::Optional(true); - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_)); - channel_->UpdateAspectRatio(640, 400); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(SendFrame()); - EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); - EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); - - // Add an additional capturer, and hook up a renderer to receive it. - cricket::FakeVideoRenderer renderer2; - rtc::scoped_ptr capturer( - CreateFakeVideoCapturer()); - capturer->SetScreencast(true); - const int kTestWidth = 160; - const int kTestHeight = 120; - cricket::VideoFormat format(kTestWidth, kTestHeight, - cricket::VideoFormat::FpsToInterval(5), - cricket::FOURCC_I420); - EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format)); - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(5678))); - EXPECT_TRUE(channel_->SetCapturer(5678, capturer.get())); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(5678))); - EXPECT_TRUE(channel_->SetRenderer(5678, &renderer2)); - EXPECT_TRUE(capturer->CaptureCustomFrame( - kTestWidth, kTestHeight, cricket::FOURCC_I420)); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer2, 1, kTestWidth, kTestHeight, kTimeout); - - // Get stats, and make sure they are correct for two senders. We wait until - // the number of expected packets have been sent to avoid races where we - // check stats before it has been updated. - cricket::VideoMediaInfo info; - for (uint32_t i = 0; i < kTimeout; ++i) { - rtc::Thread::Current()->ProcessMessages(1); - EXPECT_TRUE(channel_->GetStats(&info)); - ASSERT_EQ(2U, info.senders.size()); - if (info.senders[0].packets_sent + info.senders[1].packets_sent == - NumRtpPackets()) { - // Stats have been updated for both sent frames, expectations can be - // checked now. - break; - } - } - EXPECT_EQ(NumRtpPackets(), - info.senders[0].packets_sent + info.senders[1].packets_sent) - << "Timed out while waiting for packet counts for all sent packets."; - EXPECT_EQ(1U, info.senders[0].ssrcs().size()); - EXPECT_EQ(1234U, info.senders[0].ssrcs()[0]); - EXPECT_EQ(DefaultCodec().width, info.senders[0].send_frame_width); - EXPECT_EQ(DefaultCodec().height, info.senders[0].send_frame_height); - EXPECT_EQ(1U, info.senders[1].ssrcs().size()); - EXPECT_EQ(5678U, info.senders[1].ssrcs()[0]); - EXPECT_EQ(kTestWidth, info.senders[1].send_frame_width); - EXPECT_EQ(kTestHeight, info.senders[1].send_frame_height); - // The capturer must be unregistered here as it runs out of it's scope next. - EXPECT_TRUE(channel_->SetCapturer(5678, NULL)); - } - - // Test that we can set the bandwidth. - void SetSendBandwidth() { - cricket::VideoSendParameters parameters; - parameters.codecs.push_back(DefaultCodec()); - parameters.max_bandwidth_bps = -1; // <= 0 means unlimited. - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - parameters.max_bandwidth_bps = 128 * 1024; - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - } - // Test that we can set the SSRC for the default send source. - void SetSendSsrc() { - EXPECT_TRUE(SetDefaultCodec()); - EXPECT_TRUE(SetSendStreamFormat(kSsrc, DefaultCodec())); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(SendFrame()); - EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); - uint32_t ssrc = 0; - rtc::scoped_ptr p(GetRtpPacket(0)); - ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL); - EXPECT_EQ(kSsrc, ssrc); - // Packets are being paced out, so these can mismatch between the first and - // second call to NumRtpPackets until pending packets are paced out. - EXPECT_EQ_WAIT(NumRtpPackets(), NumRtpPackets(ssrc), kTimeout); - EXPECT_EQ_WAIT(NumRtpBytes(), NumRtpBytes(ssrc), kTimeout); - EXPECT_EQ(1, NumSentSsrcs()); - EXPECT_EQ(0, NumRtpPackets(kSsrc - 1)); - EXPECT_EQ(0, NumRtpBytes(kSsrc - 1)); - } - // Test that we can set the SSRC even after codecs are set. - void SetSendSsrcAfterSetCodecs() { - // Remove stream added in Setup. - EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); - EXPECT_TRUE(SetDefaultCodec()); - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(999))); - EXPECT_TRUE(channel_->SetCapturer(999u, video_capturer_.get())); - EXPECT_TRUE(SetSendStreamFormat(999u, DefaultCodec())); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(WaitAndSendFrame(0)); - EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); - uint32_t ssrc = 0; - rtc::scoped_ptr p(GetRtpPacket(0)); - ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL); - EXPECT_EQ(999u, ssrc); - // Packets are being paced out, so these can mismatch between the first and - // second call to NumRtpPackets until pending packets are paced out. - EXPECT_EQ_WAIT(NumRtpPackets(), NumRtpPackets(ssrc), kTimeout); - EXPECT_EQ_WAIT(NumRtpBytes(), NumRtpBytes(ssrc), kTimeout); - EXPECT_EQ(1, NumSentSsrcs()); - EXPECT_EQ(0, NumRtpPackets(kSsrc)); - EXPECT_EQ(0, NumRtpBytes(kSsrc)); - } - // Test that we can set the default video renderer before and after - // media is received. - void SetRenderer() { - uint8_t data1[] = { - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - rtc::Buffer packet1(data1, sizeof(data1)); - rtc::SetBE32(packet1.data() + 8, kSsrc); - channel_->SetRenderer(kDefaultReceiveSsrc, NULL); - EXPECT_TRUE(SetDefaultCodec()); - EXPECT_TRUE(SetSend(true)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - channel_->OnPacketReceived(&packet1, rtc::PacketTime()); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); - } - - // Tests empty StreamParams is rejected. - void RejectEmptyStreamParams() { - // Remove the send stream that was added during Setup. - EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); - - cricket::StreamParams empty; - EXPECT_FALSE(channel_->AddSendStream(empty)); - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(789u))); - } - - // Tests setting up and configuring a send stream. - void AddRemoveSendStreams() { - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); - EXPECT_GT(NumRtpPackets(), 0); - uint32_t ssrc = 0; - size_t last_packet = NumRtpPackets() - 1; - rtc::scoped_ptr - p(GetRtpPacket(static_cast(last_packet))); - ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL); - EXPECT_EQ(kSsrc, ssrc); - - // Remove the send stream that was added during Setup. - EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); - int rtp_packets = NumRtpPackets(); - - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(789u))); - EXPECT_TRUE(channel_->SetCapturer(789u, video_capturer_.get())); - EXPECT_EQ(rtp_packets, NumRtpPackets()); - // Wait 30ms to guarantee the engine does not drop the frame. - EXPECT_TRUE(WaitAndSendFrame(30)); - EXPECT_TRUE_WAIT(NumRtpPackets() > rtp_packets, kTimeout); - - last_packet = NumRtpPackets() - 1; - p.reset(GetRtpPacket(static_cast(last_packet))); - ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL); - EXPECT_EQ(789u, ssrc); - } - - // Tests setting up and configuring multiple incoming streams. - void AddRemoveRecvStreams() { - cricket::FakeVideoRenderer renderer1, renderer2; - cricket::VideoSendParameters parameters; - parameters.codecs.push_back(DefaultCodec()); - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - - // Ensure we can't set the renderer on a non-existent stream. - EXPECT_FALSE(channel_->SetRenderer(1, &renderer1)); - EXPECT_FALSE(channel_->SetRenderer(2, &renderer2)); - cricket::VideoRenderer* renderer; - EXPECT_FALSE(channel_->GetRenderer(1, &renderer)); - EXPECT_FALSE(channel_->GetRenderer(2, &renderer)); - - // Ensure we can add streams. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(1))); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(2))); - EXPECT_TRUE(channel_->GetRenderer(1, &renderer)); - EXPECT_TRUE(renderer == NULL); - EXPECT_TRUE(channel_->GetRenderer(2, &renderer)); - EXPECT_TRUE(NULL == renderer); - - // Ensure we can now set the renderers. - EXPECT_TRUE(channel_->SetRenderer(1, &renderer1)); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer2)); - EXPECT_TRUE(channel_->GetRenderer(1, &renderer)); - EXPECT_TRUE(&renderer1 == renderer); - EXPECT_TRUE(channel_->GetRenderer(2, &renderer)); - EXPECT_TRUE(&renderer2 == renderer); - - // Ensure we can change the renderers if needed. - EXPECT_TRUE(channel_->SetRenderer(1, &renderer2)); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer1)); - EXPECT_TRUE(channel_->GetRenderer(1, &renderer)); - EXPECT_TRUE(&renderer2 == renderer); - EXPECT_TRUE(channel_->GetRenderer(2, &renderer)); - EXPECT_TRUE(&renderer1 == renderer); - - EXPECT_TRUE(channel_->RemoveRecvStream(2)); - EXPECT_TRUE(channel_->RemoveRecvStream(1)); - EXPECT_FALSE(channel_->GetRenderer(1, &renderer)); - EXPECT_FALSE(channel_->GetRenderer(2, &renderer)); - } - - // Tests setting up and configuring multiple incoming streams in a - // non-conference call. - void AddRemoveRecvStreamsNoConference() { - cricket::FakeVideoRenderer renderer1, renderer2; - // Ensure we can't set the renderer on a non-existent stream. - EXPECT_FALSE(channel_->SetRenderer(1, &renderer1)); - EXPECT_FALSE(channel_->SetRenderer(2, &renderer2)); - cricket::VideoRenderer* renderer; - EXPECT_FALSE(channel_->GetRenderer(1, &renderer)); - EXPECT_FALSE(channel_->GetRenderer(2, &renderer)); - - // Ensure we can add streams. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(1))); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(2))); - EXPECT_TRUE(channel_->GetRenderer(1, &renderer)); - // Verify the first AddRecvStream hook up to the default renderer. - EXPECT_TRUE(renderer == NULL); - EXPECT_TRUE(channel_->GetRenderer(2, &renderer)); - EXPECT_TRUE(NULL == renderer); - - // Ensure we can now set the renderers. - EXPECT_TRUE(channel_->SetRenderer(1, &renderer1)); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer2)); - EXPECT_TRUE(channel_->GetRenderer(1, &renderer)); - EXPECT_TRUE(&renderer1 == renderer); - EXPECT_TRUE(channel_->GetRenderer(2, &renderer)); - EXPECT_TRUE(&renderer2 == renderer); - - // Ensure we can change the renderers if needed. - EXPECT_TRUE(channel_->SetRenderer(1, &renderer2)); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer1)); - EXPECT_TRUE(channel_->GetRenderer(1, &renderer)); - EXPECT_TRUE(&renderer2 == renderer); - EXPECT_TRUE(channel_->GetRenderer(2, &renderer)); - EXPECT_TRUE(&renderer1 == renderer); - - EXPECT_TRUE(channel_->RemoveRecvStream(2)); - EXPECT_TRUE(channel_->RemoveRecvStream(1)); - EXPECT_FALSE(channel_->GetRenderer(1, &renderer)); - EXPECT_FALSE(channel_->GetRenderer(2, &renderer)); - } - - // Test that no frames are rendered after the receive stream have been - // removed. - void AddRemoveRecvStreamAndRender() { - cricket::FakeVideoRenderer renderer1; - EXPECT_TRUE(SetDefaultCodec()); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer1)); - - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer1, 1, DefaultCodec().width, DefaultCodec().height, kTimeout); - EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc)); - // Send three more frames. This is to avoid that the test might be flaky - // due to frame dropping. - for (size_t i = 0; i < 3; ++i) - EXPECT_TRUE(WaitAndSendFrame(100)); - - // Test that no more frames have been rendered. - EXPECT_EQ(1, renderer1.num_rendered_frames()); - - // Re-add the stream again and make sure it renders. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - // Force the next frame to be a key frame to make the receiving - // decoder happy. - EXPECT_TRUE(channel_->SendIntraFrame()); - - EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer1)); - EXPECT_TRUE(SendFrame()); - // Because the default channel is used, RemoveRecvStream above is not going - // to delete the channel. As a result the engine will continue to receive - // and decode the 3 frames sent above. So it is possible we will receive - // some (e.g. 1) of these 3 frames after the renderer is set again. - EXPECT_GT_FRAME_ON_RENDERER_WAIT( - renderer1, 2, DefaultCodec().width, DefaultCodec().height, kTimeout); - // Detach |renderer1| before exit as there might be frames come late. - EXPECT_TRUE(channel_->SetRenderer(kSsrc, NULL)); - } - - // Tests the behavior of incoming streams in a conference scenario. - void SimulateConference() { - cricket::FakeVideoRenderer renderer1, renderer2; - EXPECT_TRUE(SetDefaultCodec()); - cricket::VideoSendParameters parameters; - parameters.codecs.push_back(DefaultCodec()); - parameters.options.conference_mode = rtc::Optional(true); - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(1))); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(2))); - EXPECT_TRUE(channel_->SetRenderer(1, &renderer1)); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer2)); - EXPECT_EQ(0, renderer1.num_rendered_frames()); - EXPECT_EQ(0, renderer2.num_rendered_frames()); - std::vector ssrcs; - ssrcs.push_back(1); - ssrcs.push_back(2); - network_interface_.SetConferenceMode(true, ssrcs); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer1, 1, DefaultCodec().width, DefaultCodec().height, kTimeout); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer2, 1, DefaultCodec().width, DefaultCodec().height, kTimeout); - - rtc::scoped_ptr p(GetRtpPacket(0)); - EXPECT_EQ(DefaultCodec().id, GetPayloadType(p.get())); - EXPECT_EQ(DefaultCodec().width, renderer1.width()); - EXPECT_EQ(DefaultCodec().height, renderer1.height()); - EXPECT_EQ(DefaultCodec().width, renderer2.width()); - EXPECT_EQ(DefaultCodec().height, renderer2.height()); - EXPECT_TRUE(channel_->RemoveRecvStream(2)); - EXPECT_TRUE(channel_->RemoveRecvStream(1)); - } - - // Tests that we can add and remove capturers and frames are sent out properly - void AddRemoveCapturer() { - cricket::VideoCodec codec = DefaultCodec(); - codec.width = 320; - codec.height = 240; - const int time_between_send = TimeBetweenSend(codec); - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); - rtc::scoped_ptr capturer( - CreateFakeVideoCapturer()); - capturer->SetScreencast(true); - cricket::VideoFormat format(480, 360, - cricket::VideoFormat::FpsToInterval(30), - cricket::FOURCC_I420); - EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format)); - // All capturers start generating frames with the same timestamp. ViE does - // not allow the same timestamp to be used. Capture one frame before - // associating the capturer with the channel. - EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height, - cricket::FOURCC_I420)); - - int captured_frames = 1; - for (int iterations = 0; iterations < 2; ++iterations) { - EXPECT_TRUE(channel_->SetCapturer(kSsrc, capturer.get())); - rtc::Thread::Current()->ProcessMessages(time_between_send); - EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height, - cricket::FOURCC_I420)); - ++captured_frames; - // Wait until frame of right size is captured. - EXPECT_TRUE_WAIT(renderer_.num_rendered_frames() >= captured_frames && - format.width == renderer_.width() && - format.height == renderer_.height() && - !renderer_.black_frame(), kTimeout); - EXPECT_GE(renderer_.num_rendered_frames(), captured_frames); - EXPECT_EQ(format.width, renderer_.width()); - EXPECT_EQ(format.height, renderer_.height()); - captured_frames = renderer_.num_rendered_frames() + 1; - EXPECT_FALSE(renderer_.black_frame()); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); - // Make sure a black frame is generated within the specified timeout. - // The black frame should be the resolution of the previous frame to - // prevent expensive encoder reconfigurations. - EXPECT_TRUE_WAIT(renderer_.num_rendered_frames() >= captured_frames && - format.width == renderer_.width() && - format.height == renderer_.height() && - renderer_.black_frame(), kTimeout); - EXPECT_GE(renderer_.num_rendered_frames(), captured_frames); - EXPECT_EQ(format.width, renderer_.width()); - EXPECT_EQ(format.height, renderer_.height()); - EXPECT_TRUE(renderer_.black_frame()); - - // The black frame has the same timestamp as the next frame since it's - // timestamp is set to the last frame's timestamp + interval. WebRTC will - // not render a frame with the same timestamp so capture another frame - // with the frame capturer to increment the next frame's timestamp. - EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height, - cricket::FOURCC_I420)); - } - } - - // Tests that if RemoveCapturer is called without a capturer ever being - // added, the plugin shouldn't crash (and no black frame should be sent). - void RemoveCapturerWithoutAdd() { - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, 640, 400, kTimeout); - // Wait for one frame so they don't get dropped because we send frames too - // tightly. - rtc::Thread::Current()->ProcessMessages(30); - // Remove the capturer. - EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); - // Wait for one black frame for removing the capturer. - EXPECT_FRAME_WAIT(2, 640, 400, kTimeout); - - // No capturer was added, so this RemoveCapturer should - // fail. - EXPECT_FALSE(channel_->SetCapturer(kSsrc, NULL)); - rtc::Thread::Current()->ProcessMessages(300); - // Verify no more frames were sent. - EXPECT_EQ(2, renderer_.num_rendered_frames()); - } - - // Tests that we can add and remove capturer as unique sources. - void AddRemoveCapturerMultipleSources() { - // WebRTC implementation will drop frames if pushed to quickly. Wait the - // interval time to avoid that. - // WebRTC implementation will drop frames if pushed to quickly. Wait the - // interval time to avoid that. - // Set up the stream associated with the engine. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_)); - cricket::VideoFormat capture_format; // default format - capture_format.interval = cricket::VideoFormat::FpsToInterval(30); - // Set up additional stream 1. - cricket::FakeVideoRenderer renderer1; - EXPECT_FALSE(channel_->SetRenderer(1, &renderer1)); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(1))); - EXPECT_TRUE(channel_->SetRenderer(1, &renderer1)); - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(1))); - rtc::scoped_ptr capturer1( - CreateFakeVideoCapturer()); - capturer1->SetScreencast(true); - EXPECT_EQ(cricket::CS_RUNNING, capturer1->Start(capture_format)); - // Set up additional stream 2. - cricket::FakeVideoRenderer renderer2; - EXPECT_FALSE(channel_->SetRenderer(2, &renderer2)); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(2))); - EXPECT_TRUE(channel_->SetRenderer(2, &renderer2)); - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(2))); - rtc::scoped_ptr capturer2( - CreateFakeVideoCapturer()); - capturer2->SetScreencast(true); - EXPECT_EQ(cricket::CS_RUNNING, capturer2->Start(capture_format)); - // State for all the streams. - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - // A limitation in the lmi implementation requires that SetCapturer() is - // called after SetOneCodec(). - // TODO(hellner): this seems like an unnecessary constraint, fix it. - EXPECT_TRUE(channel_->SetCapturer(1, capturer1.get())); - EXPECT_TRUE(channel_->SetCapturer(2, capturer2.get())); - EXPECT_TRUE(SetSend(true)); - // Test capturer associated with engine. - const int kTestWidth = 160; - const int kTestHeight = 120; - EXPECT_TRUE(capturer1->CaptureCustomFrame( - kTestWidth, kTestHeight, cricket::FOURCC_I420)); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer1, 1, kTestWidth, kTestHeight, kTimeout); - // Capture a frame with additional capturer2, frames should be received - EXPECT_TRUE(capturer2->CaptureCustomFrame( - kTestWidth, kTestHeight, cricket::FOURCC_I420)); - EXPECT_FRAME_ON_RENDERER_WAIT( - renderer2, 1, kTestWidth, kTestHeight, kTimeout); - // Successfully remove the capturer. - EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); - // Fail to re-remove the capturer. - EXPECT_FALSE(channel_->SetCapturer(kSsrc, NULL)); - // The capturers must be unregistered here as it runs out of it's scope - // next. - EXPECT_TRUE(channel_->SetCapturer(1, NULL)); - EXPECT_TRUE(channel_->SetCapturer(2, NULL)); - } - - void HighAspectHighHeightCapturer() { - const int kWidth = 80; - const int kHeight = 10000; - const int kScaledWidth = 20; - const int kScaledHeight = 2500; - - cricket::VideoCodec codec(DefaultCodec()); - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - - cricket::FakeVideoRenderer renderer; - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc))); - EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer)); - EXPECT_EQ(0, renderer.num_rendered_frames()); - - EXPECT_TRUE(SendFrame()); - EXPECT_GT_FRAME_ON_RENDERER_WAIT( - renderer, 1, codec.width, codec.height, kTimeout); - - // Registering an external capturer is currently the same as screen casting - // (update the test when this changes). - rtc::scoped_ptr capturer( - CreateFakeVideoCapturer()); - capturer->SetScreencast(true); - const std::vector* formats = - capturer->GetSupportedFormats(); - cricket::VideoFormat capture_format = (*formats)[0]; - EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(capture_format)); - // Capture frame to not get same frame timestamps as previous capturer. - capturer->CaptureFrame(); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, capturer.get())); - EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); - EXPECT_TRUE(capturer->CaptureCustomFrame(kWidth, kHeight, - cricket::FOURCC_ARGB)); - EXPECT_GT_FRAME_ON_RENDERER_WAIT( - renderer, 2, kScaledWidth, kScaledHeight, kTimeout); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); - } - - // Tests that we can adapt video resolution with 16:10 aspect ratio properly. - void AdaptResolution16x10() { - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - cricket::VideoCodec codec(DefaultCodec()); - codec.width = 640; - codec.height = 400; - SendAndReceive(codec); - codec.width /= 2; - codec.height /= 2; - // Adapt the resolution. - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(WaitAndSendFrame(30)); - EXPECT_FRAME_WAIT(2, codec.width, codec.height, kTimeout); - } - // Tests that we can adapt video resolution with 4:3 aspect ratio properly. - void AdaptResolution4x3() { - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - cricket::VideoCodec codec(DefaultCodec()); - codec.width = 640; - codec.height = 400; - SendAndReceive(codec); - codec.width /= 2; - codec.height /= 2; - // Adapt the resolution. - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(WaitAndSendFrame(30)); - EXPECT_FRAME_WAIT(2, codec.width, codec.height, kTimeout); - } - // Tests that we can drop all frames properly. - void AdaptDropAllFrames() { - // Set the channel codec's resolution to 0, which will require the adapter - // to drop all frames. - cricket::VideoCodec codec(DefaultCodec()); - codec.width = codec.height = codec.framerate = 0; - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - EXPECT_TRUE(SendFrame()); - EXPECT_TRUE(SendFrame()); - rtc::Thread::Current()->ProcessMessages(500); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - } - // Tests that we can reduce the frame rate on demand properly. - // TODO(fbarchard): This test is flakey on pulse. Fix and re-enable - void AdaptFramerate() { - cricket::VideoCodec codec(DefaultCodec()); - int frame_count = 0; - // The capturer runs at 30 fps. The channel requires 30 fps. - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_EQ(frame_count, renderer_.num_rendered_frames()); - EXPECT_TRUE(WaitAndSendFrame(0)); // Should be rendered. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be rendered. - frame_count += 2; - EXPECT_FRAME_WAIT(frame_count, codec.width, codec.height, kTimeout); - rtc::scoped_ptr p(GetRtpPacket(0)); - EXPECT_EQ(codec.id, GetPayloadType(p.get())); - - // The channel requires 15 fps. - codec.framerate = 15; - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(WaitAndSendFrame(0)); // Should be rendered. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be rendered. - frame_count += 2; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - - // The channel requires 10 fps. - codec.framerate = 10; - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(WaitAndSendFrame(0)); // Should be rendered. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be rendered. - frame_count += 2; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - - // The channel requires 8 fps. The adapter adapts to 10 fps, which is the - // closest factor of 30. - codec.framerate = 8; - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(WaitAndSendFrame(0)); // Should be rendered. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be rendered. - frame_count += 2; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - } - // Tests that adapted frames won't be upscaled to a higher resolution. - void SendsLowerResolutionOnSmallerFrames() { - cricket::VideoCodec codec = DefaultCodec(); - codec.width = 320; - codec.height = 240; - EXPECT_TRUE(SetOneCodec(codec)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); - - // Check that we send smaller frames at the new resolution. - EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(33)); - EXPECT_TRUE(video_capturer_->CaptureCustomFrame( - codec.width / 2, codec.height / 2, cricket::FOURCC_I420)); - EXPECT_FRAME_WAIT(2, codec.width / 2, codec.height / 2, kTimeout); - } - // Tests that we can set the send stream format properly. - void SetSendStreamFormat() { - cricket::VideoCodec codec(DefaultCodec()); - SendAndReceive(codec); - int frame_count = 1; - EXPECT_FRAME_WAIT(frame_count, codec.width, codec.height, kTimeout); - - // Adapt the resolution and frame rate to half. - cricket::VideoFormat format( - codec.width / 2, - codec.height / 2, - cricket::VideoFormat::FpsToInterval(codec.framerate / 2), - cricket::FOURCC_I420); - // The SSRC differs from the send SSRC. - EXPECT_FALSE(channel_->SetSendStreamFormat(kSsrc - 1, format)); - EXPECT_TRUE(channel_->SetSendStreamFormat(kSsrc, format)); - - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be rendered. - EXPECT_TRUE(WaitAndSendFrame(30)); // Should be dropped. - frame_count += 1; - EXPECT_FRAME_WAIT(frame_count, format.width, format.height, kTimeout); - - // Adapt the resolution to 0x0, which should drop all frames. - format.width = 0; - format.height = 0; - EXPECT_TRUE(channel_->SetSendStreamFormat(kSsrc, format)); - EXPECT_TRUE(SendFrame()); - EXPECT_TRUE(SendFrame()); - rtc::Thread::Current()->ProcessMessages(500); - EXPECT_EQ(frame_count, renderer_.num_rendered_frames()); - } - // Test that setting send stream format to 0x0 resolution will result in - // frames being dropped. - void SetSendStreamFormat0x0() { - EXPECT_TRUE(SetOneCodec(DefaultCodec())); - EXPECT_TRUE(SetSendStreamFormat(kSsrc, DefaultCodec())); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - // This frame should be received. - EXPECT_TRUE(SendFrame()); - EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); - const int64_t interval = - cricket::VideoFormat::FpsToInterval(DefaultCodec().framerate); - cricket::VideoFormat format( - 0, - 0, - interval, - cricket::FOURCC_I420); - EXPECT_TRUE(channel_->SetSendStreamFormat(kSsrc, format)); - // This frame should not be received. - EXPECT_TRUE(WaitAndSendFrame( - static_cast(interval/rtc::kNumNanosecsPerMillisec))); - rtc::Thread::Current()->ProcessMessages(500); - EXPECT_EQ(1, renderer_.num_rendered_frames()); - } - - // Tests that we can mute and unmute the channel properly. - void MuteStream() { - EXPECT_TRUE(SetDefaultCodec()); - cricket::FakeVideoCapturer video_capturer; - video_capturer.Start( - cricket::VideoFormat( - 640, 480, - cricket::VideoFormat::FpsToInterval(30), - cricket::FOURCC_I420)); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, &video_capturer)); - EXPECT_TRUE(SetSend(true)); - EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); - EXPECT_EQ(0, renderer_.num_rendered_frames()); - // Mute the channel and expect black output frame. - int frame_count = 0; - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr)); - EXPECT_TRUE(video_capturer.CaptureFrame()); - ++frame_count; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - EXPECT_TRUE(renderer_.black_frame()); - // Unmute the channel and expect non-black output frame. - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); - EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); - EXPECT_TRUE(video_capturer.CaptureFrame()); - ++frame_count; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - EXPECT_FALSE(renderer_.black_frame()); - // Test that we can also Mute using the correct send stream SSRC. - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr)); - EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); - EXPECT_TRUE(video_capturer.CaptureFrame()); - ++frame_count; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - EXPECT_TRUE(renderer_.black_frame()); - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); - EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); - EXPECT_TRUE(video_capturer.CaptureFrame()); - ++frame_count; - EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); - EXPECT_FALSE(renderer_.black_frame()); - // Test that muting an existing stream succeeds even if it's muted. - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr)); - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr)); - // Test that unmuting an existing stream succeeds even if it's not muted. - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); - EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); - // Test that muting an invalid stream fails. - EXPECT_FALSE(channel_->SetVideoSend(kSsrc+1, false, nullptr)); - EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); - } - - // Test that multiple send streams can be created and deleted properly. - void MultipleSendStreams() { - // Remove stream added in Setup. I.e. remove stream corresponding to default - // channel. - EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); - const unsigned int kSsrcsSize = sizeof(kSsrcs4)/sizeof(kSsrcs4[0]); - for (unsigned int i = 0; i < kSsrcsSize; ++i) { - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(kSsrcs4[i]))); - } - // Delete one of the non default channel streams, let the destructor delete - // the remaining ones. - EXPECT_TRUE(channel_->RemoveSendStream(kSsrcs4[kSsrcsSize - 1])); - // Stream should already be deleted. - EXPECT_FALSE(channel_->RemoveSendStream(kSsrcs4[kSsrcsSize - 1])); - } - - // Two streams one channel tests. - - // Tests that we can send and receive frames. - void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) { - SetUpSecondStream(); - // Test sending and receiving on first stream. - SendAndReceive(codec); - // Test sending and receiving on second stream. - EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout); - EXPECT_GT(NumRtpPackets(), 0); - EXPECT_EQ(1, renderer2_.num_rendered_frames()); - } - - // Set up 2 streams where the first stream uses the default channel. - // Then disconnect the first stream and verify default channel becomes - // available. - // Then add a new stream with |new_ssrc|. The new stream should re-use the - // default channel. - void TwoStreamsReUseFirstStream(const cricket::VideoCodec& codec) { - SetUpSecondStream(); - // Default channel used by the first stream. - EXPECT_EQ(kSsrc, channel_->GetDefaultSendChannelSsrc()); - EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc)); - EXPECT_FALSE(channel_->RemoveRecvStream(kSsrc)); - EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); - EXPECT_FALSE(channel_->RemoveSendStream(kSsrc)); - // Default channel is no longer used by a stream. - EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc()); - uint32_t new_ssrc = kSsrc + 100; - EXPECT_TRUE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(new_ssrc))); - // Re-use default channel. - EXPECT_EQ(new_ssrc, channel_->GetDefaultSendChannelSsrc()); - EXPECT_FALSE(channel_->AddSendStream( - cricket::StreamParams::CreateLegacy(new_ssrc))); - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(new_ssrc))); - EXPECT_TRUE(channel_->SetRenderer(new_ssrc, &renderer_)); - EXPECT_FALSE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(new_ssrc))); - - EXPECT_TRUE(channel_->SetCapturer(new_ssrc, video_capturer_.get())); - - SendAndReceive(codec); - EXPECT_TRUE(channel_->RemoveSendStream(new_ssrc)); - EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc()); - } - - // Tests that we can send and receive frames with early receive. - void TwoStreamsSendAndUnsignalledRecv(const cricket::VideoCodec& codec) { - cricket::VideoSendParameters parameters; - parameters.options.conference_mode = rtc::Optional(true); - parameters.options.unsignalled_recv_stream_limit = rtc::Optional(1); - EXPECT_TRUE(channel_->SetSendParameters(parameters)); - SetUpSecondStreamWithNoRecv(); - // Test sending and receiving on first stream. - Send(codec); - EXPECT_EQ_WAIT(2, NumRtpPackets(), kTimeout); - EXPECT_EQ_WAIT(1, renderer_.num_rendered_frames(), kTimeout); - // The first send is not expected to yield frames, because the ssrc - // is not signalled yet. With unsignalled recv enabled, we will drop frames - // instead of packets. - EXPECT_EQ(0, renderer2_.num_rendered_frames()); - // Give a chance for the decoder to process before adding the receiver. - rtc::Thread::Current()->ProcessMessages(100); - // Test sending and receiving on second stream. - EXPECT_TRUE(channel_->AddRecvStream( - cricket::StreamParams::CreateLegacy(kSsrc + 2))); - EXPECT_TRUE(channel_->SetRenderer(kSsrc + 2, &renderer2_)); - SendFrame(); - EXPECT_EQ_WAIT(2, renderer_.num_rendered_frames(), kTimeout); - EXPECT_EQ(4, NumRtpPackets()); - // The second send is expected to yield frame as the ssrc is signalled now. - // Decode should succeed here, though we received the key frame earlier. - // Without early recv, we would have dropped it and decoding would have - // failed. - EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout); - } - - // Tests that we drop key frames when conference mode is enabled and we - // receive rtp packets on unsignalled streams. Removal of a unsignalled recv - // stream is successful. - void TwoStreamsAddAndRemoveUnsignalledRecv( - const cricket::VideoCodec& codec) { - cricket::VideoOptions vmo; - vmo.conference_mode = rtc::Optional(true); - vmo.unsignalled_recv_stream_limit = rtc::Optional(1); - EXPECT_TRUE(channel_->SetOptions(vmo)); - SetUpSecondStreamWithNoRecv(); - // Sending and receiving on first stream. - Send(codec); - EXPECT_EQ_WAIT(2, NumRtpPackets(), kTimeout); - EXPECT_EQ_WAIT(1, renderer_.num_rendered_frames(), kTimeout); - // The first send is not expected to yield frames, because the ssrc - // is no signalled yet. With unsignalled recv enabled, we will drop frames - // instead of packets. - EXPECT_EQ(0, renderer2_.num_rendered_frames()); - // Give a chance for the decoder to process before adding the receiver. - rtc::Thread::Current()->ProcessMessages(100); - // Ensure that we can remove the unsignalled recv stream that was created - // when the first video packet with unsignalled recv ssrc is received. - EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc + 2)); - } - - const rtc::scoped_ptr call_; - VideoEngineOverride engine_; - rtc::scoped_ptr video_capturer_; - rtc::scoped_ptr video_capturer_2_; - rtc::scoped_ptr channel_; - cricket::FakeNetworkInterface network_interface_; - cricket::FakeVideoRenderer renderer_; - cricket::VideoMediaChannel::Error media_error_; - - // Used by test cases where 2 streams are run on the same channel. - cricket::FakeVideoRenderer renderer2_; -}; - -#endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT diff --git a/include/talk/media/base/videoframe.h b/include/talk/media/base/videoframe.h deleted file mode 100644 index f81c678..0000000 --- a/include/talk/media/base/videoframe.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEOFRAME_H_ -#define TALK_MEDIA_BASE_VIDEOFRAME_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/stream.h" -#include "webrtc/common_video/include/video_frame_buffer.h" -#include "webrtc/common_video/rotation.h" - -namespace cricket { - -// Represents a YUV420 (a.k.a. I420) video frame. -class VideoFrame { - public: - VideoFrame() {} - virtual ~VideoFrame() {} - - virtual bool InitToBlack(int w, int h, size_t pixel_width, - size_t pixel_height, int64_t time_stamp) = 0; - // Creates a frame from a raw sample with FourCC |format| and size |w| x |h|. - // |h| can be negative indicating a vertically flipped image. - // |dw| is destination width; can be less than |w| if cropping is desired. - // |dh| is destination height, like |dw|, but must be a positive number. - // Returns whether the function succeeded or failed. - - virtual bool Reset(uint32_t fourcc, - int w, - int h, - int dw, - int dh, - uint8_t* sample, - size_t sample_size, - size_t pixel_width, - size_t pixel_height, - int64_t time_stamp, - webrtc::VideoRotation rotation, - bool apply_rotation) = 0; - - // Basic accessors. - // Note this is the width and height without rotation applied. - virtual size_t GetWidth() const = 0; - virtual size_t GetHeight() const = 0; - - size_t GetChromaWidth() const { return (GetWidth() + 1) / 2; } - size_t GetChromaHeight() const { return (GetHeight() + 1) / 2; } - size_t GetChromaSize() const { return GetUPitch() * GetChromaHeight(); } - // These can return NULL if the object is not backed by a buffer. - virtual const uint8_t* GetYPlane() const = 0; - virtual const uint8_t* GetUPlane() const = 0; - virtual const uint8_t* GetVPlane() const = 0; - virtual uint8_t* GetYPlane() = 0; - virtual uint8_t* GetUPlane() = 0; - virtual uint8_t* GetVPlane() = 0; - - virtual int32_t GetYPitch() const = 0; - virtual int32_t GetUPitch() const = 0; - virtual int32_t GetVPitch() const = 0; - - // Returns the handle of the underlying video frame. This is used when the - // frame is backed by a texture. The object should be destroyed when it is no - // longer in use, so the underlying resource can be freed. - virtual void* GetNativeHandle() const = 0; - - // Returns the underlying video frame buffer. This function is ok to call - // multiple times, but the returned object will refer to the same memory. - virtual rtc::scoped_refptr GetVideoFrameBuffer() - const = 0; - - // For retrieving the aspect ratio of each pixel. Usually this is 1x1, but - // the aspect_ratio_idc parameter of H.264 can specify non-square pixels. - virtual size_t GetPixelWidth() const = 0; - virtual size_t GetPixelHeight() const = 0; - - virtual int64_t GetTimeStamp() const = 0; - virtual void SetTimeStamp(int64_t time_stamp) = 0; - - // Indicates the rotation angle in degrees. - // TODO(guoweis): Remove this function, rename GetVideoRotation and remove the - // skeleton implementation of GetRotation once chrome is updated. - virtual int GetRotation() const { return GetVideoRotation(); } - virtual webrtc::VideoRotation GetVideoRotation() const { - return webrtc::kVideoRotation_0; - } - - // Make a shallow copy of the frame. The frame buffer itself is not copied. - // Both the current and new VideoFrame will share a single reference-counted - // frame buffer. - virtual VideoFrame *Copy() const = 0; - - // Since VideoFrame supports shallow copy and the internal frame buffer might - // be shared, this function can be used to check exclusive ownership. - virtual bool IsExclusive() const = 0; - - // In case VideoFrame needs exclusive access of the frame buffer, user can - // call MakeExclusive() to make sure the frame buffer is exclusively - // accessible to the current object. This might mean a deep copy of the frame - // buffer if it is currently shared by other objects. - virtual bool MakeExclusive() = 0; - - // Writes the frame into the given frame buffer, provided that it is of - // sufficient size. Returns the frame's actual size, regardless of whether - // it was written or not (like snprintf). If there is insufficient space, - // nothing is written. - virtual size_t CopyToBuffer(uint8_t* buffer, size_t size) const; - - // Writes the frame into the given planes, stretched to the given width and - // height. The parameter "interpolate" controls whether to interpolate or just - // take the nearest-point. The parameter "crop" controls whether to crop this - // frame to the aspect ratio of the given dimensions before stretching. - virtual bool CopyToPlanes(uint8_t* dst_y, - uint8_t* dst_u, - uint8_t* dst_v, - int32_t dst_pitch_y, - int32_t dst_pitch_u, - int32_t dst_pitch_v) const; - - // Writes the frame into the target VideoFrame. - virtual void CopyToFrame(VideoFrame* target) const; - - // Return a copy of frame which has its pending rotation applied. The - // ownership of the returned frame is held by this frame. - virtual const VideoFrame* GetCopyWithRotationApplied() const = 0; - - // Writes the frame into the given stream and returns the StreamResult. - // See webrtc/base/stream.h for a description of StreamResult and error. - // Error may be NULL. If a non-success value is returned from - // StreamInterface::Write(), we immediately return with that value. - virtual rtc::StreamResult Write(rtc::StreamInterface* stream, - int* error) const; - - // Converts the I420 data to RGB of a certain type such as ARGB and ABGR. - // Returns the frame's actual size, regardless of whether it was written or - // not (like snprintf). Parameters size and stride_rgb are in units of bytes. - // If there is insufficient space, nothing is written. - virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, - uint8_t* buffer, - size_t size, - int stride_rgb) const; - - // Writes the frame into the given planes, stretched to the given width and - // height. The parameter "interpolate" controls whether to interpolate or just - // take the nearest-point. The parameter "crop" controls whether to crop this - // frame to the aspect ratio of the given dimensions before stretching. - virtual void StretchToPlanes(uint8_t* y, - uint8_t* u, - uint8_t* v, - int32_t pitchY, - int32_t pitchU, - int32_t pitchV, - size_t width, - size_t height, - bool interpolate, - bool crop) const; - - // Writes the frame into the target VideoFrame, stretched to the size of that - // frame. The parameter "interpolate" controls whether to interpolate or just - // take the nearest-point. The parameter "crop" controls whether to crop this - // frame to the aspect ratio of the target frame before stretching. - virtual void StretchToFrame(VideoFrame *target, bool interpolate, - bool crop) const; - - // Stretches the frame to the given size, creating a new VideoFrame object to - // hold it. The parameter "interpolate" controls whether to interpolate or - // just take the nearest-point. The parameter "crop" controls whether to crop - // this frame to the aspect ratio of the given dimensions before stretching. - virtual VideoFrame *Stretch(size_t w, size_t h, bool interpolate, - bool crop) const; - - // Sets the video frame to black. - virtual bool SetToBlack(); - - // Tests if sample is valid. Returns true if valid. - static bool Validate(uint32_t fourcc, - int w, - int h, - const uint8_t* sample, - size_t sample_size); - - // Size of an I420 image of given dimensions when stored as a frame buffer. - static size_t SizeOf(size_t w, size_t h) { - return w * h + ((w + 1) / 2) * ((h + 1) / 2) * 2; - } - - protected: - // Creates an empty frame. - virtual VideoFrame *CreateEmptyFrame(int w, int h, size_t pixel_width, - size_t pixel_height, - int64_t time_stamp) const = 0; - virtual void SetRotation(webrtc::VideoRotation rotation) = 0; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEOFRAME_H_ diff --git a/include/talk/media/base/videoframe_unittest.h b/include/talk/media/base/videoframe_unittest.h deleted file mode 100644 index 73d1a2f..0000000 --- a/include/talk/media/base/videoframe_unittest.h +++ /dev/null @@ -1,1955 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ -#define TALK_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ - -#include -#include - -#include "libyuv/convert.h" -#include "libyuv/convert_from.h" -#include "libyuv/planar_functions.h" -#include "libyuv/rotate.h" -#include "talk/media/base/testutils.h" -#include "talk/media/base/videocommon.h" -#include "talk/media/base/videoframe.h" -#include "webrtc/base/gunit.h" -#include "webrtc/base/pathutils.h" -#include "webrtc/base/stream.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/common_video/rotation.h" - -#if defined(_MSC_VER) -#define ALIGN16(var) __declspec(align(16)) var -#else -#define ALIGN16(var) var __attribute__((aligned(16))) -#endif - -#define kImageFilename "faces.1280x720_P420.yuv" -#define kJpeg420Filename "faces_I420.jpg" -#define kJpeg422Filename "faces_I422.jpg" -#define kJpeg444Filename "faces_I444.jpg" -#define kJpeg411Filename "faces_I411.jpg" -#define kJpeg400Filename "faces_I400.jpg" - -// Generic test class for testing various video frame implementations. -template -class VideoFrameTest : public testing::Test { - public: - VideoFrameTest() : repeat_(1) {} - - protected: - static const int kWidth = 1280; - static const int kHeight = 720; - static const int kAlignment = 16; - static const int kMinWidthAll = 1; // Constants for ConstructYUY2AllSizes. - static const int kMinHeightAll = 1; - static const int kMaxWidthAll = 17; - static const int kMaxHeightAll = 23; - - // Load a video frame from disk. - bool LoadFrameNoRepeat(T* frame) { - int save_repeat = repeat_; // This LoadFrame disables repeat. - repeat_ = 1; - bool success = LoadFrame(kImageFilename, cricket::FOURCC_I420, - kWidth, kHeight, frame); - repeat_ = save_repeat; - return success; - } - - bool LoadFrame(const std::string& filename, - uint32_t format, - int32_t width, - int32_t height, - T* frame) { - return LoadFrame(filename, format, width, height, width, abs(height), - webrtc::kVideoRotation_0, frame); - } - bool LoadFrame(const std::string& filename, - uint32_t format, - int32_t width, - int32_t height, - int dw, - int dh, - webrtc::VideoRotation rotation, - T* frame) { - rtc::scoped_ptr ms(LoadSample(filename)); - return LoadFrame(ms.get(), format, width, height, dw, dh, rotation, frame); - } - // Load a video frame from a memory stream. - bool LoadFrame(rtc::MemoryStream* ms, - uint32_t format, - int32_t width, - int32_t height, - T* frame) { - return LoadFrame(ms, format, width, height, width, abs(height), - webrtc::kVideoRotation_0, frame); - } - bool LoadFrame(rtc::MemoryStream* ms, - uint32_t format, - int32_t width, - int32_t height, - int dw, - int dh, - webrtc::VideoRotation rotation, - T* frame) { - if (!ms) { - return false; - } - size_t data_size; - bool ret = ms->GetSize(&data_size); - EXPECT_TRUE(ret); - if (ret) { - ret = LoadFrame(reinterpret_cast(ms->GetBuffer()), data_size, - format, width, height, dw, dh, rotation, frame); - } - return ret; - } - // Load a frame from a raw buffer. - bool LoadFrame(uint8_t* sample, - size_t sample_size, - uint32_t format, - int32_t width, - int32_t height, - T* frame) { - return LoadFrame(sample, sample_size, format, width, height, width, - abs(height), webrtc::kVideoRotation_0, frame); - } - bool LoadFrame(uint8_t* sample, - size_t sample_size, - uint32_t format, - int32_t width, - int32_t height, - int dw, - int dh, - webrtc::VideoRotation rotation, - T* frame) { - bool ret = false; - for (int i = 0; i < repeat_; ++i) { - ret = frame->Init(format, width, height, dw, dh, - sample, sample_size, 1, 1, 0, rotation); - } - return ret; - } - - rtc::MemoryStream* LoadSample(const std::string& filename) { - rtc::Pathname path(cricket::GetTestFilePath(filename)); - rtc::scoped_ptr fs( - rtc::Filesystem::OpenFile(path, "rb")); - if (!fs.get()) { - LOG(LS_ERROR) << "Could not open test file path: " << path.pathname() - << " from current dir " - << rtc::Filesystem::GetCurrentDirectory().pathname(); - return NULL; - } - - char buf[4096]; - rtc::scoped_ptr ms( - new rtc::MemoryStream()); - rtc::StreamResult res = Flow(fs.get(), buf, sizeof(buf), ms.get()); - if (res != rtc::SR_SUCCESS) { - LOG(LS_ERROR) << "Could not load test file path: " << path.pathname(); - return NULL; - } - - return ms.release(); - } - - // Write an I420 frame out to disk. - bool DumpFrame(const std::string& prefix, - const cricket::VideoFrame& frame) { - char filename[256]; - rtc::sprintfn(filename, sizeof(filename), "%s.%dx%d_P420.yuv", - prefix.c_str(), frame.GetWidth(), frame.GetHeight()); - size_t out_size = cricket::VideoFrame::SizeOf(frame.GetWidth(), - frame.GetHeight()); - rtc::scoped_ptr out(new uint8_t[out_size]); - frame.CopyToBuffer(out.get(), out_size); - return DumpSample(filename, out.get(), out_size); - } - - bool DumpSample(const std::string& filename, const void* buffer, int size) { - rtc::Pathname path(filename); - rtc::scoped_ptr fs( - rtc::Filesystem::OpenFile(path, "wb")); - if (!fs.get()) { - return false; - } - - return (fs->Write(buffer, size, NULL, NULL) == rtc::SR_SUCCESS); - } - - // Create a test image in the desired color space. - // The image is a checkerboard pattern with 63x63 squares, which allows - // I420 chroma artifacts to easily be seen on the square boundaries. - // The pattern is { { green, orange }, { blue, purple } } - // There is also a gradient within each square to ensure that the luma - // values are handled properly. - rtc::MemoryStream* CreateYuv422Sample(uint32_t fourcc, - uint32_t width, - uint32_t height) { - int y1_pos, y2_pos, u_pos, v_pos; - if (!GetYuv422Packing(fourcc, &y1_pos, &y2_pos, &u_pos, &v_pos)) { - return NULL; - } - - rtc::scoped_ptr ms( - new rtc::MemoryStream); - int awidth = (width + 1) & ~1; - int size = awidth * 2 * height; - if (!ms->ReserveSize(size)) { - return NULL; - } - for (uint32_t y = 0; y < height; ++y) { - for (int x = 0; x < awidth; x += 2) { - uint8_t quad[4]; - quad[y1_pos] = (x % 63 + y % 63) + 64; - quad[y2_pos] = ((x + 1) % 63 + y % 63) + 64; - quad[u_pos] = ((x / 63) & 1) ? 192 : 64; - quad[v_pos] = ((y / 63) & 1) ? 192 : 64; - ms->Write(quad, sizeof(quad), NULL, NULL); - } - } - return ms.release(); - } - - // Create a test image for YUV 420 formats with 12 bits per pixel. - rtc::MemoryStream* CreateYuvSample(uint32_t width, - uint32_t height, - uint32_t bpp) { - rtc::scoped_ptr ms( - new rtc::MemoryStream); - if (!ms->ReserveSize(width * height * bpp / 8)) { - return NULL; - } - - for (uint32_t i = 0; i < width * height * bpp / 8; ++i) { - char value = ((i / 63) & 1) ? 192 : 64; - ms->Write(&value, sizeof(value), NULL, NULL); - } - return ms.release(); - } - - rtc::MemoryStream* CreateRgbSample(uint32_t fourcc, - uint32_t width, - uint32_t height) { - int r_pos, g_pos, b_pos, bytes; - if (!GetRgbPacking(fourcc, &r_pos, &g_pos, &b_pos, &bytes)) { - return NULL; - } - - rtc::scoped_ptr ms( - new rtc::MemoryStream); - if (!ms->ReserveSize(width * height * bytes)) { - return NULL; - } - - for (uint32_t y = 0; y < height; ++y) { - for (uint32_t x = 0; x < width; ++x) { - uint8_t rgb[4] = {255, 255, 255, 255}; - rgb[r_pos] = ((x / 63) & 1) ? 224 : 32; - rgb[g_pos] = (x % 63 + y % 63) + 96; - rgb[b_pos] = ((y / 63) & 1) ? 224 : 32; - ms->Write(rgb, bytes, NULL, NULL); - } - } - return ms.release(); - } - - // Simple conversion routines to verify the optimized VideoFrame routines. - // Converts from the specified colorspace to I420. - bool ConvertYuv422(const rtc::MemoryStream* ms, - uint32_t fourcc, - uint32_t width, - uint32_t height, - T* frame) { - int y1_pos, y2_pos, u_pos, v_pos; - if (!GetYuv422Packing(fourcc, &y1_pos, &y2_pos, &u_pos, &v_pos)) { - return false; - } - - const uint8_t* start = reinterpret_cast(ms->GetBuffer()); - int awidth = (width + 1) & ~1; - frame->InitToBlack(width, height, 1, 1, 0); - int stride_y = frame->GetYPitch(); - int stride_u = frame->GetUPitch(); - int stride_v = frame->GetVPitch(); - for (uint32_t y = 0; y < height; ++y) { - for (uint32_t x = 0; x < width; x += 2) { - const uint8_t* quad1 = start + (y * awidth + x) * 2; - frame->GetYPlane()[stride_y * y + x] = quad1[y1_pos]; - if ((x + 1) < width) { - frame->GetYPlane()[stride_y * y + x + 1] = quad1[y2_pos]; - } - if ((y & 1) == 0) { - const uint8_t* quad2 = quad1 + awidth * 2; - if ((y + 1) >= height) { - quad2 = quad1; - } - frame->GetUPlane()[stride_u * (y / 2) + x / 2] = - (quad1[u_pos] + quad2[u_pos] + 1) / 2; - frame->GetVPlane()[stride_v * (y / 2) + x / 2] = - (quad1[v_pos] + quad2[v_pos] + 1) / 2; - } - } - } - return true; - } - - // Convert RGB to 420. - // A negative height inverts the image. - bool ConvertRgb(const rtc::MemoryStream* ms, - uint32_t fourcc, - int32_t width, - int32_t height, - T* frame) { - int r_pos, g_pos, b_pos, bytes; - if (!GetRgbPacking(fourcc, &r_pos, &g_pos, &b_pos, &bytes)) { - return false; - } - int pitch = width * bytes; - const uint8_t* start = reinterpret_cast(ms->GetBuffer()); - if (height < 0) { - height = -height; - start = start + pitch * (height - 1); - pitch = -pitch; - } - frame->InitToBlack(width, height, 1, 1, 0); - int stride_y = frame->GetYPitch(); - int stride_u = frame->GetUPitch(); - int stride_v = frame->GetVPitch(); - for (int32_t y = 0; y < height; y += 2) { - for (int32_t x = 0; x < width; x += 2) { - const uint8_t* rgb[4]; - uint8_t yuv[4][3]; - rgb[0] = start + y * pitch + x * bytes; - rgb[1] = rgb[0] + ((x + 1) < width ? bytes : 0); - rgb[2] = rgb[0] + ((y + 1) < height ? pitch : 0); - rgb[3] = rgb[2] + ((x + 1) < width ? bytes : 0); - for (size_t i = 0; i < 4; ++i) { - ConvertRgbPixel(rgb[i][r_pos], rgb[i][g_pos], rgb[i][b_pos], - &yuv[i][0], &yuv[i][1], &yuv[i][2]); - } - frame->GetYPlane()[stride_y * y + x] = yuv[0][0]; - if ((x + 1) < width) { - frame->GetYPlane()[stride_y * y + x + 1] = yuv[1][0]; - } - if ((y + 1) < height) { - frame->GetYPlane()[stride_y * (y + 1) + x] = yuv[2][0]; - if ((x + 1) < width) { - frame->GetYPlane()[stride_y * (y + 1) + x + 1] = yuv[3][0]; - } - } - frame->GetUPlane()[stride_u * (y / 2) + x / 2] = - (yuv[0][1] + yuv[1][1] + yuv[2][1] + yuv[3][1] + 2) / 4; - frame->GetVPlane()[stride_v * (y / 2) + x / 2] = - (yuv[0][2] + yuv[1][2] + yuv[2][2] + yuv[3][2] + 2) / 4; - } - } - return true; - } - - // Simple and slow RGB->YUV conversion. From NTSC standard, c/o Wikipedia. - void ConvertRgbPixel(uint8_t r, - uint8_t g, - uint8_t b, - uint8_t* y, - uint8_t* u, - uint8_t* v) { - *y = static_cast(.257 * r + .504 * g + .098 * b) + 16; - *u = static_cast(-.148 * r - .291 * g + .439 * b) + 128; - *v = static_cast(.439 * r - .368 * g - .071 * b) + 128; - } - - bool GetYuv422Packing(uint32_t fourcc, - int* y1_pos, - int* y2_pos, - int* u_pos, - int* v_pos) { - if (fourcc == cricket::FOURCC_YUY2) { - *y1_pos = 0; *u_pos = 1; *y2_pos = 2; *v_pos = 3; - } else if (fourcc == cricket::FOURCC_UYVY) { - *u_pos = 0; *y1_pos = 1; *v_pos = 2; *y2_pos = 3; - } else { - return false; - } - return true; - } - - bool GetRgbPacking(uint32_t fourcc, - int* r_pos, - int* g_pos, - int* b_pos, - int* bytes) { - if (fourcc == cricket::FOURCC_RAW) { - *r_pos = 0; *g_pos = 1; *b_pos = 2; *bytes = 3; // RGB in memory. - } else if (fourcc == cricket::FOURCC_24BG) { - *r_pos = 2; *g_pos = 1; *b_pos = 0; *bytes = 3; // BGR in memory. - } else if (fourcc == cricket::FOURCC_ABGR) { - *r_pos = 0; *g_pos = 1; *b_pos = 2; *bytes = 4; // RGBA in memory. - } else if (fourcc == cricket::FOURCC_BGRA) { - *r_pos = 1; *g_pos = 2; *b_pos = 3; *bytes = 4; // ARGB in memory. - } else if (fourcc == cricket::FOURCC_ARGB) { - *r_pos = 2; *g_pos = 1; *b_pos = 0; *bytes = 4; // BGRA in memory. - } else { - return false; - } - return true; - } - - // Comparison functions for testing. - static bool IsNull(const cricket::VideoFrame& frame) { - return !frame.GetYPlane(); - } - - static bool IsSize(const cricket::VideoFrame& frame, - uint32_t width, - uint32_t height) { - return !IsNull(frame) && frame.GetYPitch() >= static_cast(width) && - frame.GetUPitch() >= static_cast(width) / 2 && - frame.GetVPitch() >= static_cast(width) / 2 && - frame.GetWidth() == width && frame.GetHeight() == height; - } - - static bool IsPlaneEqual(const std::string& name, - const uint8_t* plane1, - uint32_t pitch1, - const uint8_t* plane2, - uint32_t pitch2, - uint32_t width, - uint32_t height, - int max_error) { - const uint8_t* r1 = plane1; - const uint8_t* r2 = plane2; - for (uint32_t y = 0; y < height; ++y) { - for (uint32_t x = 0; x < width; ++x) { - if (abs(static_cast(r1[x] - r2[x])) > max_error) { - LOG(LS_INFO) << "IsPlaneEqual(" << name << "): pixel[" - << x << "," << y << "] differs: " - << static_cast(r1[x]) << " vs " - << static_cast(r2[x]); - return false; - } - } - r1 += pitch1; - r2 += pitch2; - } - return true; - } - - static bool IsEqual(const cricket::VideoFrame& frame, - size_t width, - size_t height, - size_t pixel_width, - size_t pixel_height, - int64_t time_stamp, - const uint8_t* y, - uint32_t ypitch, - const uint8_t* u, - uint32_t upitch, - const uint8_t* v, - uint32_t vpitch, - int max_error) { - return IsSize(frame, static_cast(width), - static_cast(height)) && - frame.GetPixelWidth() == pixel_width && - frame.GetPixelHeight() == pixel_height && - frame.GetTimeStamp() == time_stamp && - IsPlaneEqual("y", frame.GetYPlane(), frame.GetYPitch(), y, ypitch, - static_cast(width), - static_cast(height), max_error) && - IsPlaneEqual("u", frame.GetUPlane(), frame.GetUPitch(), u, upitch, - static_cast((width + 1) / 2), - static_cast((height + 1) / 2), max_error) && - IsPlaneEqual("v", frame.GetVPlane(), frame.GetVPitch(), v, vpitch, - static_cast((width + 1) / 2), - static_cast((height + 1) / 2), max_error); - } - - static bool IsEqual(const cricket::VideoFrame& frame1, - const cricket::VideoFrame& frame2, - int max_error) { - return IsEqual(frame1, - frame2.GetWidth(), frame2.GetHeight(), - frame2.GetPixelWidth(), frame2.GetPixelHeight(), - frame2.GetTimeStamp(), - frame2.GetYPlane(), frame2.GetYPitch(), - frame2.GetUPlane(), frame2.GetUPitch(), - frame2.GetVPlane(), frame2.GetVPitch(), - max_error); - } - - static bool IsEqualWithCrop(const cricket::VideoFrame& frame1, - const cricket::VideoFrame& frame2, - int hcrop, int vcrop, int max_error) { - return frame1.GetWidth() <= frame2.GetWidth() && - frame1.GetHeight() <= frame2.GetHeight() && - IsEqual(frame1, - frame2.GetWidth() - hcrop * 2, - frame2.GetHeight() - vcrop * 2, - frame2.GetPixelWidth(), frame2.GetPixelHeight(), - frame2.GetTimeStamp(), - frame2.GetYPlane() + vcrop * frame2.GetYPitch() - + hcrop, - frame2.GetYPitch(), - frame2.GetUPlane() + vcrop * frame2.GetUPitch() / 2 - + hcrop / 2, - frame2.GetUPitch(), - frame2.GetVPlane() + vcrop * frame2.GetVPitch() / 2 - + hcrop / 2, - frame2.GetVPitch(), - max_error); - } - - static bool IsBlack(const cricket::VideoFrame& frame) { - return !IsNull(frame) && - *frame.GetYPlane() == 16 && - *frame.GetUPlane() == 128 && - *frame.GetVPlane() == 128; - } - - //////////////////////// - // Construction tests // - //////////////////////// - - // Test constructing an image from a I420 buffer. - void ConstructI420() { - T frame; - EXPECT_TRUE(IsNull(frame)); - rtc::scoped_ptr ms( - CreateYuvSample(kWidth, kHeight, 12)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, - kWidth, kHeight, &frame)); - - const uint8_t* y = reinterpret_cast(ms.get()->GetBuffer()); - const uint8_t* u = y + kWidth * kHeight; - const uint8_t* v = u + kWidth * kHeight / 4; - EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 1, 1, 0, y, kWidth, u, - kWidth / 2, v, kWidth / 2, 0)); - } - - // Test constructing an image from a YV12 buffer. - void ConstructYV12() { - T frame; - rtc::scoped_ptr ms( - CreateYuvSample(kWidth, kHeight, 12)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YV12, - kWidth, kHeight, &frame)); - - const uint8_t* y = reinterpret_cast(ms.get()->GetBuffer()); - const uint8_t* v = y + kWidth * kHeight; - const uint8_t* u = v + kWidth * kHeight / 4; - EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 1, 1, 0, y, kWidth, u, - kWidth / 2, v, kWidth / 2, 0)); - } - - // Test constructing an image from a I422 buffer. - void ConstructI422() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - size_t buf_size = kWidth * kHeight * 2; - rtc::scoped_ptr buf(new uint8_t[buf_size + kAlignment]); - uint8_t* y = ALIGNP(buf.get(), kAlignment); - uint8_t* u = y + kWidth * kHeight; - uint8_t* v = u + (kWidth / 2) * kHeight; - EXPECT_EQ(0, libyuv::I420ToI422(frame1.GetYPlane(), frame1.GetYPitch(), - frame1.GetUPlane(), frame1.GetUPitch(), - frame1.GetVPlane(), frame1.GetVPitch(), - y, kWidth, - u, kWidth / 2, - v, kWidth / 2, - kWidth, kHeight)); - EXPECT_TRUE(LoadFrame(y, buf_size, cricket::FOURCC_I422, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 1)); - } - - // Test constructing an image from a YUY2 buffer. - void ConstructYuy2() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - size_t buf_size = kWidth * kHeight * 2; - rtc::scoped_ptr buf(new uint8_t[buf_size + kAlignment]); - uint8_t* yuy2 = ALIGNP(buf.get(), kAlignment); - EXPECT_EQ(0, libyuv::I420ToYUY2(frame1.GetYPlane(), frame1.GetYPitch(), - frame1.GetUPlane(), frame1.GetUPitch(), - frame1.GetVPlane(), frame1.GetVPitch(), - yuy2, kWidth * 2, - kWidth, kHeight)); - EXPECT_TRUE(LoadFrame(yuy2, buf_size, cricket::FOURCC_YUY2, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - } - - // Test constructing an image from a YUY2 buffer with buffer unaligned. - void ConstructYuy2Unaligned() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - size_t buf_size = kWidth * kHeight * 2; - rtc::scoped_ptr buf(new uint8_t[buf_size + kAlignment + 1]); - uint8_t* yuy2 = ALIGNP(buf.get(), kAlignment) + 1; - EXPECT_EQ(0, libyuv::I420ToYUY2(frame1.GetYPlane(), frame1.GetYPitch(), - frame1.GetUPlane(), frame1.GetUPitch(), - frame1.GetVPlane(), frame1.GetVPitch(), - yuy2, kWidth * 2, - kWidth, kHeight)); - EXPECT_TRUE(LoadFrame(yuy2, buf_size, cricket::FOURCC_YUY2, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - } - - // Test constructing an image from a wide YUY2 buffer. - // Normal is 1280x720. Wide is 12800x72 - void ConstructYuy2Wide() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth * 10, kHeight / 10)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, - kWidth * 10, kHeight / 10, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, - kWidth * 10, kHeight / 10, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - } - - // Test constructing an image from a UYVY buffer. - void ConstructUyvy() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - } - - // Test constructing an image from a random buffer. - // We are merely verifying that the code succeeds and is free of crashes. - void ConstructM420() { - T frame; - rtc::scoped_ptr ms( - CreateYuvSample(kWidth, kHeight, 12)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_M420, - kWidth, kHeight, &frame)); - } - - void ConstructNV21() { - T frame; - rtc::scoped_ptr ms( - CreateYuvSample(kWidth, kHeight, 12)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_NV21, - kWidth, kHeight, &frame)); - } - - void ConstructNV12() { - T frame; - rtc::scoped_ptr ms( - CreateYuvSample(kWidth, kHeight, 12)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_NV12, - kWidth, kHeight, &frame)); - } - - // Test constructing an image from a ABGR buffer - // Due to rounding, some pixels may differ slightly from the VideoFrame impl. - void ConstructABGR() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_ABGR, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ABGR, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_ABGR, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 2)); - } - - // Test constructing an image from a ARGB buffer - // Due to rounding, some pixels may differ slightly from the VideoFrame impl. - void ConstructARGB() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_ARGB, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 2)); - } - - // Test constructing an image from a wide ARGB buffer - // Normal is 1280x720. Wide is 12800x72 - void ConstructARGBWide() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_ARGB, kWidth * 10, kHeight / 10)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, - kWidth * 10, kHeight / 10, &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_ARGB, - kWidth * 10, kHeight / 10, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 2)); - } - - // Test constructing an image from an BGRA buffer. - // Due to rounding, some pixels may differ slightly from the VideoFrame impl. - void ConstructBGRA() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_BGRA, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_BGRA, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_BGRA, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 2)); - } - - // Test constructing an image from a 24BG buffer. - // Due to rounding, some pixels may differ slightly from the VideoFrame impl. - void Construct24BG() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_24BG, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_24BG, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_24BG, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 2)); - } - - // Test constructing an image from a raw RGB buffer. - // Due to rounding, some pixels may differ slightly from the VideoFrame impl. - void ConstructRaw() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_RAW, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_RAW, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_RAW, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 2)); - } - - // Test constructing an image from a RGB565 buffer - void ConstructRGB565() { - T frame1, frame2; - size_t out_size = kWidth * kHeight * 2; - rtc::scoped_ptr outbuf(new uint8_t[out_size + kAlignment]); - uint8_t* out = ALIGNP(outbuf.get(), kAlignment); - T frame; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - EXPECT_EQ(out_size, frame1.ConvertToRgbBuffer(cricket::FOURCC_RGBP, - out, - out_size, kWidth * 2)); - EXPECT_TRUE(LoadFrame(out, out_size, cricket::FOURCC_RGBP, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 20)); - } - - // Test constructing an image from a ARGB1555 buffer - void ConstructARGB1555() { - T frame1, frame2; - size_t out_size = kWidth * kHeight * 2; - rtc::scoped_ptr outbuf(new uint8_t[out_size + kAlignment]); - uint8_t* out = ALIGNP(outbuf.get(), kAlignment); - T frame; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - EXPECT_EQ(out_size, frame1.ConvertToRgbBuffer(cricket::FOURCC_RGBO, - out, - out_size, kWidth * 2)); - EXPECT_TRUE(LoadFrame(out, out_size, cricket::FOURCC_RGBO, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 20)); - } - - // Test constructing an image from a ARGB4444 buffer - void ConstructARGB4444() { - T frame1, frame2; - size_t out_size = kWidth * kHeight * 2; - rtc::scoped_ptr outbuf(new uint8_t[out_size + kAlignment]); - uint8_t* out = ALIGNP(outbuf.get(), kAlignment); - T frame; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - EXPECT_EQ(out_size, frame1.ConvertToRgbBuffer(cricket::FOURCC_R444, - out, - out_size, kWidth * 2)); - EXPECT_TRUE(LoadFrame(out, out_size, cricket::FOURCC_R444, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 20)); - } - -// Macro to help test different rotations -#define TEST_MIRROR(FOURCC, BPP) \ - void Construct##FOURCC##Mirror() { \ - T frame1, frame2, frame3; \ - rtc::scoped_ptr ms( \ - CreateYuvSample(kWidth, kHeight, BPP)); \ - ASSERT_TRUE(ms.get() != NULL); \ - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, \ - -kHeight, kWidth, kHeight, \ - webrtc::kVideoRotation_180, &frame1)); \ - size_t data_size; \ - bool ret = ms->GetSize(&data_size); \ - EXPECT_TRUE(ret); \ - EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ - kHeight, \ - reinterpret_cast(ms->GetBuffer()), \ - data_size, 1, 1, 0, webrtc::kVideoRotation_0)); \ - int width_rotate = static_cast(frame1.GetWidth()); \ - int height_rotate = static_cast(frame1.GetHeight()); \ - EXPECT_TRUE(frame3.InitToBlack(width_rotate, height_rotate, 1, 1, 0)); \ - libyuv::I420Mirror( \ - frame2.GetYPlane(), frame2.GetYPitch(), frame2.GetUPlane(), \ - frame2.GetUPitch(), frame2.GetVPlane(), frame2.GetVPitch(), \ - frame3.GetYPlane(), frame3.GetYPitch(), frame3.GetUPlane(), \ - frame3.GetUPitch(), frame3.GetVPlane(), frame3.GetVPitch(), kWidth, \ - kHeight); \ - EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \ - } - - TEST_MIRROR(I420, 420) - -// Macro to help test different rotations -#define TEST_ROTATE(FOURCC, BPP, ROTATE) \ - void Construct##FOURCC##Rotate##ROTATE() { \ - T frame1, frame2, frame3; \ - rtc::scoped_ptr ms( \ - CreateYuvSample(kWidth, kHeight, BPP)); \ - ASSERT_TRUE(ms.get() != NULL); \ - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, kHeight, \ - kWidth, kHeight, webrtc::kVideoRotation_##ROTATE, \ - &frame1)); \ - size_t data_size; \ - bool ret = ms->GetSize(&data_size); \ - EXPECT_TRUE(ret); \ - EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ - kHeight, \ - reinterpret_cast(ms->GetBuffer()), \ - data_size, 1, 1, 0, webrtc::kVideoRotation_0)); \ - int width_rotate = static_cast(frame1.GetWidth()); \ - int height_rotate = static_cast(frame1.GetHeight()); \ - EXPECT_TRUE(frame3.InitToBlack(width_rotate, height_rotate, 1, 1, 0)); \ - libyuv::I420Rotate( \ - frame2.GetYPlane(), frame2.GetYPitch(), frame2.GetUPlane(), \ - frame2.GetUPitch(), frame2.GetVPlane(), frame2.GetVPitch(), \ - frame3.GetYPlane(), frame3.GetYPitch(), frame3.GetUPlane(), \ - frame3.GetUPitch(), frame3.GetVPlane(), frame3.GetVPitch(), kWidth, \ - kHeight, libyuv::kRotate##ROTATE); \ - EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \ - } - - // Test constructing an image with rotation. - TEST_ROTATE(I420, 12, 0) - TEST_ROTATE(I420, 12, 90) - TEST_ROTATE(I420, 12, 180) - TEST_ROTATE(I420, 12, 270) - TEST_ROTATE(YV12, 12, 0) - TEST_ROTATE(YV12, 12, 90) - TEST_ROTATE(YV12, 12, 180) - TEST_ROTATE(YV12, 12, 270) - TEST_ROTATE(NV12, 12, 0) - TEST_ROTATE(NV12, 12, 90) - TEST_ROTATE(NV12, 12, 180) - TEST_ROTATE(NV12, 12, 270) - TEST_ROTATE(NV21, 12, 0) - TEST_ROTATE(NV21, 12, 90) - TEST_ROTATE(NV21, 12, 180) - TEST_ROTATE(NV21, 12, 270) - TEST_ROTATE(UYVY, 16, 0) - TEST_ROTATE(UYVY, 16, 90) - TEST_ROTATE(UYVY, 16, 180) - TEST_ROTATE(UYVY, 16, 270) - TEST_ROTATE(YUY2, 16, 0) - TEST_ROTATE(YUY2, 16, 90) - TEST_ROTATE(YUY2, 16, 180) - TEST_ROTATE(YUY2, 16, 270) - - // Test constructing an image from a UYVY buffer rotated 90 degrees. - void ConstructUyvyRotate90() { - T frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight, - kWidth, kHeight, webrtc::kVideoRotation_90, &frame2)); - } - - // Test constructing an image from a UYVY buffer rotated 180 degrees. - void ConstructUyvyRotate180() { - T frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight, - kWidth, kHeight, webrtc::kVideoRotation_180, - &frame2)); - } - - // Test constructing an image from a UYVY buffer rotated 270 degrees. - void ConstructUyvyRotate270() { - T frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight, - kWidth, kHeight, webrtc::kVideoRotation_270, - &frame2)); - } - - // Test constructing an image from a YUY2 buffer rotated 90 degrees. - void ConstructYuy2Rotate90() { - T frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight, - kWidth, kHeight, webrtc::kVideoRotation_90, &frame2)); - } - - // Test constructing an image from a YUY2 buffer rotated 180 degrees. - void ConstructYuy2Rotate180() { - T frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight, - kWidth, kHeight, webrtc::kVideoRotation_180, - &frame2)); - } - - // Test constructing an image from a YUY2 buffer rotated 270 degrees. - void ConstructYuy2Rotate270() { - T frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight, - kWidth, kHeight, webrtc::kVideoRotation_270, - &frame2)); - } - - // Test 1 pixel edge case image I420 buffer. - void ConstructI4201Pixel() { - T frame; - uint8_t pixel[3] = {1, 2, 3}; - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 1, 1, 1, 1, pixel, - sizeof(pixel), 1, 1, 0, webrtc::kVideoRotation_0)); - } - const uint8_t* y = pixel; - const uint8_t* u = y + 1; - const uint8_t* v = u + 1; - EXPECT_TRUE(IsEqual(frame, 1, 1, 1, 1, 0, y, 1, u, 1, v, 1, 0)); - } - - // Test 5 pixel edge case image. - void ConstructI4205Pixel() { - T frame; - uint8_t pixels5x5[5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2]; - memset(pixels5x5, 1, 5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2); - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 5, 5, 5, 5, pixels5x5, - sizeof(pixels5x5), 1, 1, 0, - webrtc::kVideoRotation_0)); - } - EXPECT_EQ(5u, frame.GetWidth()); - EXPECT_EQ(5u, frame.GetHeight()); - EXPECT_EQ(5, frame.GetYPitch()); - EXPECT_EQ(3, frame.GetUPitch()); - EXPECT_EQ(3, frame.GetVPitch()); - } - - // Test 1 pixel edge case image ARGB buffer. - void ConstructARGB1Pixel() { - T frame; - uint8_t pixel[4] = {64, 128, 192, 255}; - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame.Init(cricket::FOURCC_ARGB, 1, 1, 1, 1, pixel, - sizeof(pixel), 1, 1, 0, - webrtc::kVideoRotation_0)); - } - // Convert back to ARGB. - size_t out_size = 4; - rtc::scoped_ptr outbuf(new uint8_t[out_size + kAlignment]); - uint8_t* out = ALIGNP(outbuf.get(), kAlignment); - - EXPECT_EQ(out_size, frame.ConvertToRgbBuffer(cricket::FOURCC_ARGB, - out, - out_size, // buffer size - out_size)); // stride - #ifdef USE_LMI_CONVERT - // TODO(fbarchard): Expected to fail, but not crash. - EXPECT_FALSE(IsPlaneEqual("argb", pixel, 4, out, 4, 3, 1, 2)); - #else - // TODO(fbarchard): Check for overwrite. - EXPECT_TRUE(IsPlaneEqual("argb", pixel, 4, out, 4, 3, 1, 2)); - #endif - } - - // Test Black, White and Grey pixels. - void ConstructARGBBlackWhitePixel() { - T frame; - uint8_t pixel[10 * 4] = {0, 0, 0, 255, // Black. - 0, 0, 0, 255, // Black. - 64, 64, 64, 255, // Dark Grey. - 64, 64, 64, 255, // Dark Grey. - 128, 128, 128, 255, // Grey. - 128, 128, 128, 255, // Grey. - 196, 196, 196, 255, // Light Grey. - 196, 196, 196, 255, // Light Grey. - 255, 255, 255, 255, // White. - 255, 255, 255, 255}; // White. - - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame.Init(cricket::FOURCC_ARGB, 10, 1, 10, 1, pixel, - sizeof(pixel), 1, 1, 0, - webrtc::kVideoRotation_0)); - } - // Convert back to ARGB - size_t out_size = 10 * 4; - rtc::scoped_ptr outbuf(new uint8_t[out_size + kAlignment]); - uint8_t* out = ALIGNP(outbuf.get(), kAlignment); - - EXPECT_EQ(out_size, frame.ConvertToRgbBuffer(cricket::FOURCC_ARGB, - out, - out_size, // buffer size. - out_size)); // stride. - EXPECT_TRUE(IsPlaneEqual("argb", pixel, out_size, - out, out_size, - out_size, 1, 2)); - } - - // Test constructing an image from an I420 buffer with horizontal cropping. - void ConstructI420CropHorizontal() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kImageFilename, cricket::FOURCC_I420, kWidth, kHeight, - kWidth * 3 / 4, kHeight, webrtc::kVideoRotation_0, - &frame2)); - EXPECT_TRUE(IsEqualWithCrop(frame2, frame1, kWidth / 8, 0, 0)); - } - - // Test constructing an image from a YUY2 buffer with horizontal cropping. - void ConstructYuy2CropHorizontal() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight, - kWidth * 3 / 4, kHeight, webrtc::kVideoRotation_0, - &frame2)); - EXPECT_TRUE(IsEqualWithCrop(frame2, frame1, kWidth / 8, 0, 0)); - } - - // Test constructing an image from an ARGB buffer with horizontal cropping. - void ConstructARGBCropHorizontal() { - T frame1, frame2; - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_ARGB, kWidth, kHeight, - kWidth * 3 / 4, kHeight, webrtc::kVideoRotation_0, - &frame2)); - EXPECT_TRUE(IsEqualWithCrop(frame2, frame1, kWidth / 8, 0, 2)); - } - - // Test constructing an image from an I420 buffer, cropping top and bottom. - void ConstructI420CropVertical() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kImageFilename, cricket::FOURCC_I420, kWidth, kHeight, - kWidth, kHeight * 3 / 4, webrtc::kVideoRotation_0, - &frame2)); - EXPECT_TRUE(IsEqualWithCrop(frame2, frame1, 0, kHeight / 8, 0)); - } - - // Test constructing an image from I420 synonymous formats. - void ConstructI420Aliases() { - T frame1, frame2, frame3; - ASSERT_TRUE(LoadFrame(kImageFilename, cricket::FOURCC_I420, kWidth, kHeight, - &frame1)); - ASSERT_TRUE(LoadFrame(kImageFilename, cricket::FOURCC_IYUV, kWidth, kHeight, - &frame2)); - ASSERT_TRUE(LoadFrame(kImageFilename, cricket::FOURCC_YU12, kWidth, kHeight, - &frame3)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - EXPECT_TRUE(IsEqual(frame1, frame3, 0)); - } - - // Test constructing an image from an I420 MJPG buffer. - void ConstructMjpgI420() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kJpeg420Filename, - cricket::FOURCC_MJPG, kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 32)); - } - - // Test constructing an image from an I422 MJPG buffer. - void ConstructMjpgI422() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kJpeg422Filename, - cricket::FOURCC_MJPG, kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 32)); - } - - // Test constructing an image from an I444 MJPG buffer. - void ConstructMjpgI444() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kJpeg444Filename, - cricket::FOURCC_MJPG, kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 32)); - } - - // Test constructing an image from an I444 MJPG buffer. - void ConstructMjpgI411() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kJpeg411Filename, - cricket::FOURCC_MJPG, kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 32)); - } - - // Test constructing an image from an I400 MJPG buffer. - // TODO(fbarchard): Stronger compare on chroma. Compare agaisnt a grey image. - void ConstructMjpgI400() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - ASSERT_TRUE(LoadFrame(kJpeg400Filename, - cricket::FOURCC_MJPG, kWidth, kHeight, &frame2)); - EXPECT_TRUE(IsPlaneEqual("y", frame1.GetYPlane(), frame1.GetYPitch(), - frame2.GetYPlane(), frame2.GetYPitch(), - kWidth, kHeight, 32)); - EXPECT_TRUE(IsEqual(frame1, frame2, 128)); - } - - // Test constructing an image from an I420 MJPG buffer. - void ValidateFrame(const char* name, - uint32_t fourcc, - int data_adjust, - int size_adjust, - bool expected_result) { - T frame; - rtc::scoped_ptr ms(LoadSample(name)); - ASSERT_TRUE(ms.get() != NULL); - const uint8_t* sample = - reinterpret_cast(ms.get()->GetBuffer()); - size_t sample_size; - ms->GetSize(&sample_size); - // Optional adjust size to test invalid size. - size_t data_size = sample_size + data_adjust; - - // Allocate a buffer with end page aligned. - const int kPadToHeapSized = 16 * 1024 * 1024; - rtc::scoped_ptr page_buffer( - new uint8_t[((data_size + kPadToHeapSized + 4095) & ~4095)]); - uint8_t* data_ptr = page_buffer.get(); - if (!data_ptr) { - LOG(LS_WARNING) << "Failed to allocate memory for ValidateFrame test."; - EXPECT_FALSE(expected_result); // NULL is okay if failure was expected. - return; - } - data_ptr += kPadToHeapSized + (-(static_cast(data_size)) & 4095); - memcpy(data_ptr, sample, std::min(data_size, sample_size)); - for (int i = 0; i < repeat_; ++i) { - EXPECT_EQ(expected_result, frame.Validate(fourcc, kWidth, kHeight, - data_ptr, - sample_size + size_adjust)); - } - } - - // Test validate for I420 MJPG buffer. - void ValidateMjpgI420() { - ValidateFrame(kJpeg420Filename, cricket::FOURCC_MJPG, 0, 0, true); - } - - // Test validate for I422 MJPG buffer. - void ValidateMjpgI422() { - ValidateFrame(kJpeg422Filename, cricket::FOURCC_MJPG, 0, 0, true); - } - - // Test validate for I444 MJPG buffer. - void ValidateMjpgI444() { - ValidateFrame(kJpeg444Filename, cricket::FOURCC_MJPG, 0, 0, true); - } - - // Test validate for I411 MJPG buffer. - void ValidateMjpgI411() { - ValidateFrame(kJpeg411Filename, cricket::FOURCC_MJPG, 0, 0, true); - } - - // Test validate for I400 MJPG buffer. - void ValidateMjpgI400() { - ValidateFrame(kJpeg400Filename, cricket::FOURCC_MJPG, 0, 0, true); - } - - // Test validate for I420 buffer. - void ValidateI420() { - ValidateFrame(kImageFilename, cricket::FOURCC_I420, 0, 0, true); - } - - // Test validate for I420 buffer where size is too small - void ValidateI420SmallSize() { - ValidateFrame(kImageFilename, cricket::FOURCC_I420, 0, -16384, false); - } - - // Test validate for I420 buffer where size is too large (16 MB) - // Will produce warning but pass. - void ValidateI420LargeSize() { - ValidateFrame(kImageFilename, cricket::FOURCC_I420, 16000000, 16000000, - true); - } - - // Test validate for I420 buffer where size is 1 GB (not reasonable). - void ValidateI420HugeSize() { -#ifndef WIN32 // TODO(fbarchard): Reenable when fixing bug 9603762. - ValidateFrame(kImageFilename, cricket::FOURCC_I420, 1000000000u, - 1000000000u, false); -#endif - } - - // The following test that Validate crashes if the size is greater than the - // actual buffer size. - // TODO(fbarchard): Consider moving a filter into the capturer/plugin. -#if defined(_MSC_VER) && !defined(NDEBUG) - int ExceptionFilter(unsigned int code, struct _EXCEPTION_POINTERS *ep) { - if (code == EXCEPTION_ACCESS_VIOLATION) { - LOG(LS_INFO) << "Caught EXCEPTION_ACCESS_VIOLATION as expected."; - return EXCEPTION_EXECUTE_HANDLER; - } else { - LOG(LS_INFO) << "Did not catch EXCEPTION_ACCESS_VIOLATION. Unexpected."; - return EXCEPTION_CONTINUE_SEARCH; - } - } - - // Test validate fails for truncated MJPG data buffer. If ValidateFrame - // crashes the exception handler will return and unittest passes with OK. - void ValidateMjpgI420InvalidSize() { - __try { - ValidateFrame(kJpeg420Filename, cricket::FOURCC_MJPG, -16384, 0, false); - FAIL() << "Validate was expected to cause EXCEPTION_ACCESS_VIOLATION."; - } __except(ExceptionFilter(GetExceptionCode(), GetExceptionInformation())) { - return; // Successfully crashed in ValidateFrame. - } - } - - // Test validate fails for truncated I420 buffer. - void ValidateI420InvalidSize() { - __try { - ValidateFrame(kImageFilename, cricket::FOURCC_I420, -16384, 0, false); - FAIL() << "Validate was expected to cause EXCEPTION_ACCESS_VIOLATION."; - } __except(ExceptionFilter(GetExceptionCode(), GetExceptionInformation())) { - return; // Successfully crashed in ValidateFrame. - } - } -#endif - - // Test constructing an image from a YUY2 buffer (and synonymous formats). - void ConstructYuy2Aliases() { - T frame1, frame2, frame3, frame4; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUVS, - kWidth, kHeight, &frame3)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUYV, - kWidth, kHeight, &frame4)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - EXPECT_TRUE(IsEqual(frame1, frame3, 0)); - EXPECT_TRUE(IsEqual(frame1, frame4, 0)); - } - - // Test constructing an image from a UYVY buffer (and synonymous formats). - void ConstructUyvyAliases() { - T frame1, frame2, frame3, frame4; - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY, - kWidth, kHeight, &frame2)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_2VUY, - kWidth, kHeight, &frame3)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_HDYC, - kWidth, kHeight, &frame4)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - EXPECT_TRUE(IsEqual(frame1, frame3, 0)); - EXPECT_TRUE(IsEqual(frame1, frame4, 0)); - } - - // Test creating a copy. - void ConstructCopy() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame2.Init(frame1)); - } - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - } - - // Test creating a copy and check that it just increments the refcount. - void ConstructCopyIsRef() { - T frame1, frame2; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame2.Init(frame1)); - } - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - EXPECT_EQ(frame1.GetYPlane(), frame2.GetYPlane()); - EXPECT_EQ(frame1.GetUPlane(), frame2.GetUPlane()); - EXPECT_EQ(frame1.GetVPlane(), frame2.GetVPlane()); - } - - // Test creating an empty image and initing it to black. - void ConstructBlack() { - T frame; - for (int i = 0; i < repeat_; ++i) { - EXPECT_TRUE(frame.InitToBlack(kWidth, kHeight, 1, 1, 0)); - } - EXPECT_TRUE(IsSize(frame, kWidth, kHeight)); - EXPECT_TRUE(IsBlack(frame)); - } - - // Test constructing an image from a YUY2 buffer with a range of sizes. - // Only tests that conversion does not crash or corrupt heap. - void ConstructYuy2AllSizes() { - T frame1, frame2; - for (int height = kMinHeightAll; height <= kMaxHeightAll; ++height) { - for (int width = kMinWidthAll; width <= kMaxWidthAll; ++width) { - rtc::scoped_ptr ms( - CreateYuv422Sample(cricket::FOURCC_YUY2, width, height)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, width, height, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2, - width, height, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - } - } - } - - // Test constructing an image from a ARGB buffer with a range of sizes. - // Only tests that conversion does not crash or corrupt heap. - void ConstructARGBAllSizes() { - T frame1, frame2; - for (int height = kMinHeightAll; height <= kMaxHeightAll; ++height) { - for (int width = kMinWidthAll; width <= kMaxWidthAll; ++width) { - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_ARGB, width, height)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, width, height, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_ARGB, - width, height, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 64)); - } - } - // Test a practical window size for screencasting usecase. - const int kOddWidth = 1228; - const int kOddHeight = 260; - for (int j = 0; j < 2; ++j) { - for (int i = 0; i < 2; ++i) { - rtc::scoped_ptr ms( - CreateRgbSample(cricket::FOURCC_ARGB, kOddWidth + i, kOddHeight + j)); - ASSERT_TRUE(ms.get() != NULL); - EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, - kOddWidth + i, kOddHeight + j, - &frame1)); - EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_ARGB, - kOddWidth + i, kOddHeight + j, &frame2)); - EXPECT_TRUE(IsEqual(frame1, frame2, 64)); - } - } - } - - // Tests re-initing an existing image. - void Reset(webrtc::VideoRotation rotation, bool apply_rotation) { - T frame1, frame2; - rtc::scoped_ptr ms( - LoadSample(kImageFilename)); - ASSERT_TRUE(ms.get() != NULL); - size_t data_size; - ms->GetSize(&data_size); - EXPECT_TRUE(frame1.InitToBlack(kWidth, kHeight, 1, 1, 0)); - EXPECT_TRUE(frame2.InitToBlack(kWidth, kHeight, 1, 1, 0)); - EXPECT_TRUE(IsBlack(frame1)); - EXPECT_TRUE(IsEqual(frame1, frame2, 0)); - EXPECT_TRUE(frame1.Reset(cricket::FOURCC_I420, kWidth, kHeight, kWidth, - kHeight, - reinterpret_cast(ms->GetBuffer()), - data_size, 1, 1, 0, rotation, apply_rotation)); - if (apply_rotation) - EXPECT_EQ(webrtc::kVideoRotation_0, frame1.GetVideoRotation()); - else - EXPECT_EQ(rotation, frame1.GetVideoRotation()); - - // Swapp width and height if the frame is rotated 90 or 270 degrees. - if (apply_rotation && (rotation == webrtc::kVideoRotation_90 - || rotation == webrtc::kVideoRotation_270)) { - EXPECT_TRUE(kHeight == frame1.GetWidth()); - EXPECT_TRUE(kWidth == frame1.GetHeight()); - } else { - EXPECT_TRUE(kWidth == frame1.GetWidth()); - EXPECT_TRUE(kHeight == frame1.GetHeight()); - } - EXPECT_FALSE(IsBlack(frame1)); - EXPECT_FALSE(IsEqual(frame1, frame2, 0)); - } - - void ResetAndApplyRotation() { - Reset(webrtc::kVideoRotation_90, true); - } - - void ResetAndDontApplyRotation() { - Reset(webrtc::kVideoRotation_90, false); - } - - ////////////////////// - // Conversion tests // - ////////////////////// - - enum ToFrom { TO, FROM }; - - // Helper function for test converting from I420 to packed formats. - inline void ConvertToBuffer(int bpp, - int rowpad, - bool invert, - ToFrom to_from, - int error, - uint32_t fourcc, - int (*RGBToI420)(const uint8_t* src_frame, - int src_stride_frame, - uint8_t* dst_y, - int dst_stride_y, - uint8_t* dst_u, - int dst_stride_u, - uint8_t* dst_v, - int dst_stride_v, - int width, - int height)) { - T frame1, frame2; - int repeat_to = (to_from == TO) ? repeat_ : 1; - int repeat_from = (to_from == FROM) ? repeat_ : 1; - - int astride = kWidth * bpp + rowpad; - size_t out_size = astride * kHeight; - rtc::scoped_ptr outbuf(new uint8_t[out_size + kAlignment + 1]); - memset(outbuf.get(), 0, out_size + kAlignment + 1); - uint8_t* outtop = ALIGNP(outbuf.get(), kAlignment); - uint8_t* out = outtop; - int stride = astride; - if (invert) { - out += (kHeight - 1) * stride; // Point to last row. - stride = -stride; - } - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - - for (int i = 0; i < repeat_to; ++i) { - EXPECT_EQ(out_size, frame1.ConvertToRgbBuffer(fourcc, - out, - out_size, stride)); - } - EXPECT_TRUE(frame2.InitToBlack(kWidth, kHeight, 1, 1, 0)); - for (int i = 0; i < repeat_from; ++i) { - EXPECT_EQ(0, RGBToI420(out, stride, - frame2.GetYPlane(), frame2.GetYPitch(), - frame2.GetUPlane(), frame2.GetUPitch(), - frame2.GetVPlane(), frame2.GetVPitch(), - kWidth, kHeight)); - } - if (rowpad) { - EXPECT_EQ(0, outtop[kWidth * bpp]); // Ensure stride skipped end of row. - EXPECT_NE(0, outtop[astride]); // Ensure pixel at start of 2nd row. - } else { - EXPECT_NE(0, outtop[kWidth * bpp]); // Expect something to be here. - } - EXPECT_EQ(0, outtop[out_size]); // Ensure no overrun. - EXPECT_TRUE(IsEqual(frame1, frame2, error)); - } - - static const int kError = 20; - static const int kErrorHigh = 40; - static const int kOddStride = 23; - - // Tests ConvertToRGBBuffer formats. - void ConvertToARGBBuffer() { - ConvertToBuffer(4, 0, false, TO, kError, - cricket::FOURCC_ARGB, libyuv::ARGBToI420); - } - void ConvertToBGRABuffer() { - ConvertToBuffer(4, 0, false, TO, kError, - cricket::FOURCC_BGRA, libyuv::BGRAToI420); - } - void ConvertToABGRBuffer() { - ConvertToBuffer(4, 0, false, TO, kError, - cricket::FOURCC_ABGR, libyuv::ABGRToI420); - } - void ConvertToRGB24Buffer() { - ConvertToBuffer(3, 0, false, TO, kError, - cricket::FOURCC_24BG, libyuv::RGB24ToI420); - } - void ConvertToRAWBuffer() { - ConvertToBuffer(3, 0, false, TO, kError, - cricket::FOURCC_RAW, libyuv::RAWToI420); - } - void ConvertToRGB565Buffer() { - ConvertToBuffer(2, 0, false, TO, kError, - cricket::FOURCC_RGBP, libyuv::RGB565ToI420); - } - void ConvertToARGB1555Buffer() { - ConvertToBuffer(2, 0, false, TO, kError, - cricket::FOURCC_RGBO, libyuv::ARGB1555ToI420); - } - void ConvertToARGB4444Buffer() { - ConvertToBuffer(2, 0, false, TO, kError, - cricket::FOURCC_R444, libyuv::ARGB4444ToI420); - } - void ConvertToI400Buffer() { - ConvertToBuffer(1, 0, false, TO, 128, - cricket::FOURCC_I400, libyuv::I400ToI420); - } - void ConvertToYUY2Buffer() { - ConvertToBuffer(2, 0, false, TO, kError, - cricket::FOURCC_YUY2, libyuv::YUY2ToI420); - } - void ConvertToUYVYBuffer() { - ConvertToBuffer(2, 0, false, TO, kError, - cricket::FOURCC_UYVY, libyuv::UYVYToI420); - } - - // Tests ConvertToRGBBuffer formats with odd stride. - void ConvertToARGBBufferStride() { - ConvertToBuffer(4, kOddStride, false, TO, kError, - cricket::FOURCC_ARGB, libyuv::ARGBToI420); - } - void ConvertToBGRABufferStride() { - ConvertToBuffer(4, kOddStride, false, TO, kError, - cricket::FOURCC_BGRA, libyuv::BGRAToI420); - } - void ConvertToABGRBufferStride() { - ConvertToBuffer(4, kOddStride, false, TO, kError, - cricket::FOURCC_ABGR, libyuv::ABGRToI420); - } - void ConvertToRGB24BufferStride() { - ConvertToBuffer(3, kOddStride, false, TO, kError, - cricket::FOURCC_24BG, libyuv::RGB24ToI420); - } - void ConvertToRAWBufferStride() { - ConvertToBuffer(3, kOddStride, false, TO, kError, - cricket::FOURCC_RAW, libyuv::RAWToI420); - } - void ConvertToRGB565BufferStride() { - ConvertToBuffer(2, kOddStride, false, TO, kError, - cricket::FOURCC_RGBP, libyuv::RGB565ToI420); - } - void ConvertToARGB1555BufferStride() { - ConvertToBuffer(2, kOddStride, false, TO, kError, - cricket::FOURCC_RGBO, libyuv::ARGB1555ToI420); - } - void ConvertToARGB4444BufferStride() { - ConvertToBuffer(2, kOddStride, false, TO, kError, - cricket::FOURCC_R444, libyuv::ARGB4444ToI420); - } - void ConvertToI400BufferStride() { - ConvertToBuffer(1, kOddStride, false, TO, 128, - cricket::FOURCC_I400, libyuv::I400ToI420); - } - void ConvertToYUY2BufferStride() { - ConvertToBuffer(2, kOddStride, false, TO, kError, - cricket::FOURCC_YUY2, libyuv::YUY2ToI420); - } - void ConvertToUYVYBufferStride() { - ConvertToBuffer(2, kOddStride, false, TO, kError, - cricket::FOURCC_UYVY, libyuv::UYVYToI420); - } - - // Tests ConvertToRGBBuffer formats with negative stride to invert image. - void ConvertToARGBBufferInverted() { - ConvertToBuffer(4, 0, true, TO, kError, - cricket::FOURCC_ARGB, libyuv::ARGBToI420); - } - void ConvertToBGRABufferInverted() { - ConvertToBuffer(4, 0, true, TO, kError, - cricket::FOURCC_BGRA, libyuv::BGRAToI420); - } - void ConvertToABGRBufferInverted() { - ConvertToBuffer(4, 0, true, TO, kError, - cricket::FOURCC_ABGR, libyuv::ABGRToI420); - } - void ConvertToRGB24BufferInverted() { - ConvertToBuffer(3, 0, true, TO, kError, - cricket::FOURCC_24BG, libyuv::RGB24ToI420); - } - void ConvertToRAWBufferInverted() { - ConvertToBuffer(3, 0, true, TO, kError, - cricket::FOURCC_RAW, libyuv::RAWToI420); - } - void ConvertToRGB565BufferInverted() { - ConvertToBuffer(2, 0, true, TO, kError, - cricket::FOURCC_RGBP, libyuv::RGB565ToI420); - } - void ConvertToARGB1555BufferInverted() { - ConvertToBuffer(2, 0, true, TO, kError, - cricket::FOURCC_RGBO, libyuv::ARGB1555ToI420); - } - void ConvertToARGB4444BufferInverted() { - ConvertToBuffer(2, 0, true, TO, kError, - cricket::FOURCC_R444, libyuv::ARGB4444ToI420); - } - void ConvertToI400BufferInverted() { - ConvertToBuffer(1, 0, true, TO, 128, - cricket::FOURCC_I400, libyuv::I400ToI420); - } - void ConvertToYUY2BufferInverted() { - ConvertToBuffer(2, 0, true, TO, kError, - cricket::FOURCC_YUY2, libyuv::YUY2ToI420); - } - void ConvertToUYVYBufferInverted() { - ConvertToBuffer(2, 0, true, TO, kError, - cricket::FOURCC_UYVY, libyuv::UYVYToI420); - } - - // Tests ConvertFrom formats. - void ConvertFromARGBBuffer() { - ConvertToBuffer(4, 0, false, FROM, kError, - cricket::FOURCC_ARGB, libyuv::ARGBToI420); - } - void ConvertFromBGRABuffer() { - ConvertToBuffer(4, 0, false, FROM, kError, - cricket::FOURCC_BGRA, libyuv::BGRAToI420); - } - void ConvertFromABGRBuffer() { - ConvertToBuffer(4, 0, false, FROM, kError, - cricket::FOURCC_ABGR, libyuv::ABGRToI420); - } - void ConvertFromRGB24Buffer() { - ConvertToBuffer(3, 0, false, FROM, kError, - cricket::FOURCC_24BG, libyuv::RGB24ToI420); - } - void ConvertFromRAWBuffer() { - ConvertToBuffer(3, 0, false, FROM, kError, - cricket::FOURCC_RAW, libyuv::RAWToI420); - } - void ConvertFromRGB565Buffer() { - ConvertToBuffer(2, 0, false, FROM, kError, - cricket::FOURCC_RGBP, libyuv::RGB565ToI420); - } - void ConvertFromARGB1555Buffer() { - ConvertToBuffer(2, 0, false, FROM, kError, - cricket::FOURCC_RGBO, libyuv::ARGB1555ToI420); - } - void ConvertFromARGB4444Buffer() { - ConvertToBuffer(2, 0, false, FROM, kError, - cricket::FOURCC_R444, libyuv::ARGB4444ToI420); - } - void ConvertFromI400Buffer() { - ConvertToBuffer(1, 0, false, FROM, 128, - cricket::FOURCC_I400, libyuv::I400ToI420); - } - void ConvertFromYUY2Buffer() { - ConvertToBuffer(2, 0, false, FROM, kError, - cricket::FOURCC_YUY2, libyuv::YUY2ToI420); - } - void ConvertFromUYVYBuffer() { - ConvertToBuffer(2, 0, false, FROM, kError, - cricket::FOURCC_UYVY, libyuv::UYVYToI420); - } - - // Tests ConvertFrom formats with odd stride. - void ConvertFromARGBBufferStride() { - ConvertToBuffer(4, kOddStride, false, FROM, kError, - cricket::FOURCC_ARGB, libyuv::ARGBToI420); - } - void ConvertFromBGRABufferStride() { - ConvertToBuffer(4, kOddStride, false, FROM, kError, - cricket::FOURCC_BGRA, libyuv::BGRAToI420); - } - void ConvertFromABGRBufferStride() { - ConvertToBuffer(4, kOddStride, false, FROM, kError, - cricket::FOURCC_ABGR, libyuv::ABGRToI420); - } - void ConvertFromRGB24BufferStride() { - ConvertToBuffer(3, kOddStride, false, FROM, kError, - cricket::FOURCC_24BG, libyuv::RGB24ToI420); - } - void ConvertFromRAWBufferStride() { - ConvertToBuffer(3, kOddStride, false, FROM, kError, - cricket::FOURCC_RAW, libyuv::RAWToI420); - } - void ConvertFromRGB565BufferStride() { - ConvertToBuffer(2, kOddStride, false, FROM, kError, - cricket::FOURCC_RGBP, libyuv::RGB565ToI420); - } - void ConvertFromARGB1555BufferStride() { - ConvertToBuffer(2, kOddStride, false, FROM, kError, - cricket::FOURCC_RGBO, libyuv::ARGB1555ToI420); - } - void ConvertFromARGB4444BufferStride() { - ConvertToBuffer(2, kOddStride, false, FROM, kError, - cricket::FOURCC_R444, libyuv::ARGB4444ToI420); - } - void ConvertFromI400BufferStride() { - ConvertToBuffer(1, kOddStride, false, FROM, 128, - cricket::FOURCC_I400, libyuv::I400ToI420); - } - void ConvertFromYUY2BufferStride() { - ConvertToBuffer(2, kOddStride, false, FROM, kError, - cricket::FOURCC_YUY2, libyuv::YUY2ToI420); - } - void ConvertFromUYVYBufferStride() { - ConvertToBuffer(2, kOddStride, false, FROM, kError, - cricket::FOURCC_UYVY, libyuv::UYVYToI420); - } - - // Tests ConvertFrom formats with negative stride to invert image. - void ConvertFromARGBBufferInverted() { - ConvertToBuffer(4, 0, true, FROM, kError, - cricket::FOURCC_ARGB, libyuv::ARGBToI420); - } - void ConvertFromBGRABufferInverted() { - ConvertToBuffer(4, 0, true, FROM, kError, - cricket::FOURCC_BGRA, libyuv::BGRAToI420); - } - void ConvertFromABGRBufferInverted() { - ConvertToBuffer(4, 0, true, FROM, kError, - cricket::FOURCC_ABGR, libyuv::ABGRToI420); - } - void ConvertFromRGB24BufferInverted() { - ConvertToBuffer(3, 0, true, FROM, kError, - cricket::FOURCC_24BG, libyuv::RGB24ToI420); - } - void ConvertFromRAWBufferInverted() { - ConvertToBuffer(3, 0, true, FROM, kError, - cricket::FOURCC_RAW, libyuv::RAWToI420); - } - void ConvertFromRGB565BufferInverted() { - ConvertToBuffer(2, 0, true, FROM, kError, - cricket::FOURCC_RGBP, libyuv::RGB565ToI420); - } - void ConvertFromARGB1555BufferInverted() { - ConvertToBuffer(2, 0, true, FROM, kError, - cricket::FOURCC_RGBO, libyuv::ARGB1555ToI420); - } - void ConvertFromARGB4444BufferInverted() { - ConvertToBuffer(2, 0, true, FROM, kError, - cricket::FOURCC_R444, libyuv::ARGB4444ToI420); - } - void ConvertFromI400BufferInverted() { - ConvertToBuffer(1, 0, true, FROM, 128, - cricket::FOURCC_I400, libyuv::I400ToI420); - } - void ConvertFromYUY2BufferInverted() { - ConvertToBuffer(2, 0, true, FROM, kError, - cricket::FOURCC_YUY2, libyuv::YUY2ToI420); - } - void ConvertFromUYVYBufferInverted() { - ConvertToBuffer(2, 0, true, FROM, kError, - cricket::FOURCC_UYVY, libyuv::UYVYToI420); - } - - // Test converting from I420 to I422. - void ConvertToI422Buffer() { - T frame1, frame2; - size_t out_size = kWidth * kHeight * 2; - rtc::scoped_ptr buf(new uint8_t[out_size + kAlignment]); - uint8_t* y = ALIGNP(buf.get(), kAlignment); - uint8_t* u = y + kWidth * kHeight; - uint8_t* v = u + (kWidth / 2) * kHeight; - ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); - for (int i = 0; i < repeat_; ++i) { - EXPECT_EQ(0, libyuv::I420ToI422(frame1.GetYPlane(), frame1.GetYPitch(), - frame1.GetUPlane(), frame1.GetUPitch(), - frame1.GetVPlane(), frame1.GetVPitch(), - y, kWidth, - u, kWidth / 2, - v, kWidth / 2, - kWidth, kHeight)); - } - EXPECT_TRUE(frame2.Init(cricket::FOURCC_I422, kWidth, kHeight, kWidth, - kHeight, y, out_size, 1, 1, 0, - webrtc::kVideoRotation_0)); - EXPECT_TRUE(IsEqual(frame1, frame2, 1)); - } - - /////////////////// - // General tests // - /////////////////// - - void Copy() { - rtc::scoped_ptr source(new T); - rtc::scoped_ptr target; - ASSERT_TRUE(LoadFrameNoRepeat(source.get())); - target.reset(source->Copy()); - EXPECT_TRUE(IsEqual(*source, *target, 0)); - source.reset(); - EXPECT_TRUE(target->GetYPlane() != NULL); - } - - void CopyIsRef() { - rtc::scoped_ptr source(new T); - rtc::scoped_ptr target; - ASSERT_TRUE(LoadFrameNoRepeat(source.get())); - target.reset(source->Copy()); - EXPECT_TRUE(IsEqual(*source, *target, 0)); - const T* const_source = source.get(); - EXPECT_EQ(const_source->GetYPlane(), target->GetYPlane()); - EXPECT_EQ(const_source->GetUPlane(), target->GetUPlane()); - EXPECT_EQ(const_source->GetVPlane(), target->GetVPlane()); - } - - void MakeExclusive() { - rtc::scoped_ptr source(new T); - rtc::scoped_ptr target; - ASSERT_TRUE(LoadFrameNoRepeat(source.get())); - target.reset(source->Copy()); - EXPECT_TRUE(target->MakeExclusive()); - EXPECT_TRUE(IsEqual(*source, *target, 0)); - EXPECT_NE(target->GetYPlane(), source->GetYPlane()); - EXPECT_NE(target->GetUPlane(), source->GetUPlane()); - EXPECT_NE(target->GetVPlane(), source->GetVPlane()); - } - - void CopyToBuffer() { - T frame; - rtc::scoped_ptr ms( - LoadSample(kImageFilename)); - ASSERT_TRUE(ms.get() != NULL); - ASSERT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight, - &frame)); - size_t out_size = kWidth * kHeight * 3 / 2; - rtc::scoped_ptr out(new uint8_t[out_size]); - for (int i = 0; i < repeat_; ++i) { - EXPECT_EQ(out_size, frame.CopyToBuffer(out.get(), out_size)); - } - EXPECT_EQ(0, memcmp(out.get(), ms->GetBuffer(), out_size)); - } - - void CopyToFrame() { - T source; - rtc::scoped_ptr ms( - LoadSample(kImageFilename)); - ASSERT_TRUE(ms.get() != NULL); - ASSERT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight, - &source)); - - // Create the target frame by loading from a file. - T target; - ASSERT_TRUE(LoadFrameNoRepeat(&target)); - EXPECT_FALSE(IsBlack(target)); - - // Stretch and check if the stretched target is black. - source.CopyToFrame(&target); - - EXPECT_TRUE(IsEqual(source, target, 0)); - } - - void Write() { - T frame; - rtc::scoped_ptr ms( - LoadSample(kImageFilename)); - ASSERT_TRUE(ms.get() != NULL); - rtc::MemoryStream ms2; - size_t size; - ASSERT_TRUE(ms->GetSize(&size)); - ASSERT_TRUE(ms2.ReserveSize(size)); - ASSERT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight, - &frame)); - for (int i = 0; i < repeat_; ++i) { - ms2.SetPosition(0u); // Useful when repeat_ > 1. - int error; - EXPECT_EQ(rtc::SR_SUCCESS, frame.Write(&ms2, &error)); - } - size_t out_size = cricket::VideoFrame::SizeOf(kWidth, kHeight); - EXPECT_EQ(0, memcmp(ms2.GetBuffer(), ms->GetBuffer(), out_size)); - } - - void CopyToBuffer1Pixel() { - size_t out_size = 3; - rtc::scoped_ptr out(new uint8_t[out_size + 1]); - memset(out.get(), 0xfb, out_size + 1); // Fill buffer - uint8_t pixel[3] = {1, 2, 3}; - T frame; - EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 1, 1, 1, 1, pixel, - sizeof(pixel), 1, 1, 0, - webrtc::kVideoRotation_0)); - for (int i = 0; i < repeat_; ++i) { - EXPECT_EQ(out_size, frame.CopyToBuffer(out.get(), out_size)); - } - EXPECT_EQ(1, out.get()[0]); // Check Y. Should be 1. - EXPECT_EQ(2, out.get()[1]); // Check U. Should be 2. - EXPECT_EQ(3, out.get()[2]); // Check V. Should be 3. - EXPECT_EQ(0xfb, out.get()[3]); // Check sentinel is still intact. - } - - void StretchToFrame() { - // Create the source frame as a black frame. - T source; - EXPECT_TRUE(source.InitToBlack(kWidth * 2, kHeight * 2, 1, 1, 0)); - EXPECT_TRUE(IsSize(source, kWidth * 2, kHeight * 2)); - - // Create the target frame by loading from a file. - T target1; - ASSERT_TRUE(LoadFrameNoRepeat(&target1)); - EXPECT_FALSE(IsBlack(target1)); - - // Stretch and check if the stretched target is black. - source.StretchToFrame(&target1, true, false); - EXPECT_TRUE(IsBlack(target1)); - - // Crop and stretch and check if the stretched target is black. - T target2; - ASSERT_TRUE(LoadFrameNoRepeat(&target2)); - source.StretchToFrame(&target2, true, true); - EXPECT_TRUE(IsBlack(target2)); - EXPECT_EQ(source.GetTimeStamp(), target2.GetTimeStamp()); - } - - int repeat_; -}; - -#endif // TALK_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ diff --git a/include/talk/media/base/videoframefactory.h b/include/talk/media/base/videoframefactory.h deleted file mode 100644 index ba8c517..0000000 --- a/include/talk/media/base/videoframefactory.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ -#define TALK_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ - -#include "talk/media/base/videoframe.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -struct CapturedFrame; -class VideoFrame; - -// Creates cricket::VideoFrames, or a subclass of cricket::VideoFrame -// depending on the subclass of VideoFrameFactory. -class VideoFrameFactory { - public: - VideoFrameFactory() : apply_rotation_(true) {} - virtual ~VideoFrameFactory() {} - - // The returned frame aliases the aliased_frame if the input color - // space allows for aliasing, otherwise a color conversion will - // occur. Returns NULL if conversion fails. - - // The returned frame will be a center crop of |input_frame| with - // size |cropped_width| x |cropped_height|. - virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame, - int cropped_width, - int cropped_height) const = 0; - - // The returned frame will be a center crop of |input_frame| with size - // |cropped_width| x |cropped_height|, scaled to |output_width| x - // |output_height|. - virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame, - int cropped_input_width, - int cropped_input_height, - int output_width, - int output_height) const; - - void SetApplyRotation(bool enable) { apply_rotation_ = enable; } - - protected: - bool apply_rotation_; - - private: - // An internal frame buffer to avoid reallocations. It is mutable because it - // does not affect behaviour, only performance. - mutable rtc::scoped_ptr output_frame_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ diff --git a/include/talk/media/base/videorenderer.h b/include/talk/media/base/videorenderer.h deleted file mode 100644 index 0a0ee51..0000000 --- a/include/talk/media/base/videorenderer.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_BASE_VIDEORENDERER_H_ -#define TALK_MEDIA_BASE_VIDEORENDERER_H_ - -#if !defined(NDEBUG) -#include -#endif - -#include "webrtc/base/sigslot.h" - -namespace cricket { - -class VideoFrame; - -// Abstract interface for rendering VideoFrames. -class VideoRenderer { - public: - virtual ~VideoRenderer() {} - // Called when the video has changed size. This is also used as an - // initialization method to set the UI size before any video frame - // rendered. webrtc::ExternalRenderer's FrameSizeChange will invoke this when - // it's called or later when a VideoRenderer is attached. - virtual bool SetSize(int width, int height, int reserved) = 0; - // Called when a new frame is available for display. - virtual bool RenderFrame(const VideoFrame *frame) = 0; - -#if !defined(NDEBUG) - // Allow renderer dumping out rendered frames. - virtual bool SetDumpPath(const std::string &path) { return true; } -#endif -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_VIDEORENDERER_H_ diff --git a/include/talk/media/base/yuvframegenerator.h b/include/talk/media/base/yuvframegenerator.h deleted file mode 100644 index 9091362..0000000 --- a/include/talk/media/base/yuvframegenerator.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Generates YUV420 frames with a "landscape with striped crosshair" in the -// Y-plane, plus a horizontal gradient in the U-plane and a vertical one in the -// V-plane. This makes for a nice mix of colours that is suited for both -// catching visual errors and making sure e.g. YUV->RGB/BGR conversion looks -// the same on different platforms. -// There is also a solid box bouncing around in the Y-plane, and two differently -// coloured lines bouncing horizontally and vertically in the U and V plane. -// This helps illustrating how the frame boundary goes, and can aid as a quite -// handy visual help for noticing e.g. packet loss if the frames are encoded -// and sent over the network. - -#ifndef TALK_MEDIA_BASE_YUVFRAMEGENERATOR_H_ -#define TALK_MEDIA_BASE_YUVFRAMEGENERATOR_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" - -namespace cricket { - -class YuvFrameGenerator { - public: - // Constructs a frame-generator that produces frames of size |width|x|height|. - // If |enable_barcode| is specified, barcodes can be included in the frames - // when calling |GenerateNextFrame(uint8_t*, uint32_t)|. If |enable_barcode| - // is |true| then |width|x|height| should be at least 160x100; otherwise this - // constructor will abort. - YuvFrameGenerator(int width, int height, bool enable_barcode); - ~YuvFrameGenerator(); - - int GetFrameSize() { return frame_data_size_; } - - // Generate the next frame and return it in the provided |frame_buffer|. If - // barcode_value is not |nullptr| the value referred by it will be encoded - // into a barcode in the frame. The value should in the range: - // [0..9,999,999]. If the value exceeds this range or barcodes were not - // requested in the constructor, this function will abort. - void GenerateNextFrame(uint8_t* frame_buffer, int32_t barcode_value); - - int GetHeight() { return height_; } - int GetWidth() { return width_; } - - // Fetch the bounds of the barcode from the generator. The barcode will - // always be at this location. This function will abort if barcodes were not - // requested in the constructor. - void GetBarcodeBounds(int* top, int* left, int* width, int* height); - - private: - void DrawLandscape(uint8_t* p, int w, int h); - void DrawGradientX(uint8_t* p, int w, int h); - void DrawGradientY(uint8_t* p, int w, int h); - void DrawMovingLineX(uint8_t* p, int w, int h, int n); - void DrawMovingLineY(uint8_t* p, int w, int h, int n); - void DrawBouncingCube(uint8_t* p, int w, int h, int n); - - void DrawBarcode(uint32_t value); - int DrawSideGuardBars(int x, int y, int height); - int DrawMiddleGuardBars(int x, int y, int height); - int DrawEanEncodedDigit(int digit, int x, int y, int height, bool r_code); - void DrawBlockRectangle(uint8_t* p, - int x_start, - int y_start, - int width, - int height, - int pitch, - uint8_t value); - - private: - int width_; - int height_; - int frame_index_; - int frame_data_size_; - uint8_t* y_data_; - uint8_t* u_data_; - uint8_t* v_data_; - - int barcode_start_x_; - int barcode_start_y_; - - RTC_DISALLOW_COPY_AND_ASSIGN(YuvFrameGenerator); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_BASE_YUVFRAMEGENERATOR_H_ diff --git a/include/talk/media/devices/carbonvideorenderer.h b/include/talk/media/devices/carbonvideorenderer.h deleted file mode 100644 index 52c9740..0000000 --- a/include/talk/media/devices/carbonvideorenderer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Definition of class CarbonVideoRenderer that implements the abstract class -// cricket::VideoRenderer via Carbon. - -#ifndef TALK_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ -#define TALK_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ - -#include - -#include "talk/media/base/videorenderer.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -class CarbonVideoRenderer : public VideoRenderer { - public: - CarbonVideoRenderer(int x, int y); - virtual ~CarbonVideoRenderer(); - - // Implementation of pure virtual methods of VideoRenderer. - // These two methods may be executed in different threads. - // SetSize is called before RenderFrame. - virtual bool SetSize(int width, int height, int reserved); - virtual bool RenderFrame(const VideoFrame* frame); - - // Needs to be called on the main thread. - bool Initialize(); - - private: - bool DrawFrame(); - - static OSStatus DrawEventHandler(EventHandlerCallRef handler, - EventRef event, - void* data); - rtc::scoped_ptr image_; - rtc::CriticalSection image_crit_; - int image_width_; - int image_height_; - int x_; - int y_; - CGImageRef image_ref_; - WindowRef window_ref_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ diff --git a/include/talk/media/devices/deviceinfo.h b/include/talk/media/devices/deviceinfo.h deleted file mode 100644 index 86382f6..0000000 --- a/include/talk/media/devices/deviceinfo.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_DEVICEINFO_H_ -#define TALK_MEDIA_DEVICES_DEVICEINFO_H_ - -#include - -#include "talk/media/devices/devicemanager.h" - -namespace cricket { - -bool GetUsbId(const Device& device, std::string* usb_id); -bool GetUsbVersion(const Device& device, std::string* usb_version); - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_DEVICEINFO_H_ diff --git a/include/talk/media/devices/devicemanager.h b/include/talk/media/devices/devicemanager.h deleted file mode 100644 index 982c679..0000000 --- a/include/talk/media/devices/devicemanager.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_DEVICEMANAGER_H_ -#define TALK_MEDIA_DEVICES_DEVICEMANAGER_H_ - -#include -#include -#include - -#include "talk/media/base/device.h" -#include "talk/media/base/screencastid.h" -#include "talk/media/base/videocapturerfactory.h" -#include "talk/media/base/videocommon.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/stringencode.h" -#include "webrtc/base/window.h" - -namespace rtc { - -class DesktopDescription; -class WindowDescription; -class WindowPicker; - -} -namespace cricket { - -class VideoCapturer; - -// DeviceManagerInterface - interface to manage the audio and -// video devices on the system. -class DeviceManagerInterface { - public: - virtual ~DeviceManagerInterface() { } - - // Initialization - virtual bool Init() = 0; - virtual void Terminate() = 0; - - // Capabilities - virtual int GetCapabilities() = 0; - - // Device enumeration - virtual bool GetAudioInputDevices(std::vector* devices) = 0; - virtual bool GetAudioOutputDevices(std::vector* devices) = 0; - - virtual bool GetAudioInputDevice(const std::string& name, Device* out) = 0; - virtual bool GetAudioOutputDevice(const std::string& name, Device* out) = 0; - - virtual bool GetVideoCaptureDevices(std::vector* devs) = 0; - virtual bool GetVideoCaptureDevice(const std::string& name, Device* out) = 0; - - // If the device manager needs to create video capturers, here is - // how to control which video capturers are created. These take - // ownership of the factories. - virtual void SetVideoDeviceCapturerFactory( - VideoDeviceCapturerFactory* video_device_capturer_factory) = 0; - virtual void SetScreenCapturerFactory( - ScreenCapturerFactory* screen_capturer_factory) = 0; - - // Caps the capture format according to max format for capturers created - // by CreateVideoCapturer(). See ConstrainSupportedFormats() in - // videocapturer.h for more detail. - // Note that once a VideoCapturer has been created, calling this API will - // not affect it. - virtual void SetVideoCaptureDeviceMaxFormat( - const std::string& usb_id, - const VideoFormat& max_format) = 0; - virtual void ClearVideoCaptureDeviceMaxFormat(const std::string& usb_id) = 0; - - // Device creation - virtual VideoCapturer* CreateVideoCapturer(const Device& device) const = 0; - - virtual bool GetWindows( - std::vector* descriptions) = 0; - virtual bool GetDesktops( - std::vector* descriptions) = 0; - virtual VideoCapturer* CreateScreenCapturer( - const ScreencastId& screenid) const = 0; - - sigslot::signal0<> SignalDevicesChange; - - static const char kDefaultDeviceName[]; -}; - -class DeviceWatcher { - public: - explicit DeviceWatcher(DeviceManagerInterface* dm) {} - virtual ~DeviceWatcher() {} - virtual bool Start() { return true; } - virtual void Stop() {} -}; - -class DeviceManagerFactory { - public: - static DeviceManagerInterface* Create(); - - private: - DeviceManagerFactory() {} -}; - -class DeviceManager : public DeviceManagerInterface { - public: - DeviceManager(); - virtual ~DeviceManager(); - - // Initialization - virtual bool Init(); - virtual void Terminate(); - - // Capabilities - virtual int GetCapabilities(); - - // Device enumeration - virtual bool GetAudioInputDevices(std::vector* devices); - virtual bool GetAudioOutputDevices(std::vector* devices); - - virtual bool GetAudioInputDevice(const std::string& name, Device* out); - virtual bool GetAudioOutputDevice(const std::string& name, Device* out); - - virtual bool GetVideoCaptureDevices(std::vector* devs); - virtual bool GetVideoCaptureDevice(const std::string& name, Device* out); - - virtual void SetVideoDeviceCapturerFactory( - VideoDeviceCapturerFactory* video_device_capturer_factory) { - video_device_capturer_factory_.reset(video_device_capturer_factory); - } - virtual void SetScreenCapturerFactory( - ScreenCapturerFactory* screen_capturer_factory) { - screen_capturer_factory_.reset(screen_capturer_factory); - } - - - virtual void SetVideoCaptureDeviceMaxFormat(const std::string& usb_id, - const VideoFormat& max_format); - virtual void ClearVideoCaptureDeviceMaxFormat(const std::string& usb_id); - - // TODO(pthatcher): Rename to CreateVideoDeviceCapturer. - virtual VideoCapturer* CreateVideoCapturer(const Device& device) const; - - virtual bool GetWindows( - std::vector* descriptions); - virtual bool GetDesktops( - std::vector* descriptions); - virtual VideoCapturer* CreateScreenCapturer( - const ScreencastId& screenid) const; - - // The exclusion_list MUST be a NULL terminated list. - static bool FilterDevices(std::vector* devices, - const char* const exclusion_list[]); - bool initialized() const { return initialized_; } - - protected: - virtual bool GetAudioDevices(bool input, std::vector* devs); - virtual bool GetAudioDevice(bool is_input, const std::string& name, - Device* out); - virtual bool GetDefaultVideoCaptureDevice(Device* device); - bool IsInWhitelist(const std::string& key, VideoFormat* video_format) const; - virtual bool GetMaxFormat(const Device& device, - VideoFormat* video_format) const; - - void set_initialized(bool initialized) { initialized_ = initialized; } - - void set_watcher(DeviceWatcher* watcher) { watcher_.reset(watcher); } - DeviceWatcher* watcher() { return watcher_.get(); } - - private: - // The exclusion_list MUST be a NULL terminated list. - static bool ShouldDeviceBeIgnored(const std::string& device_name, - const char* const exclusion_list[]); - bool GetFakeVideoCaptureDevice(const std::string& name, Device* out) const; - VideoCapturer* MaybeConstructFakeVideoCapturer(const Device& device) const; - - bool initialized_; - rtc::scoped_ptr< - VideoDeviceCapturerFactory> video_device_capturer_factory_; - rtc::scoped_ptr< - ScreenCapturerFactory> screen_capturer_factory_; - std::map max_formats_; - rtc::scoped_ptr watcher_; - rtc::scoped_ptr window_picker_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_DEVICEMANAGER_H_ diff --git a/include/talk/media/devices/dummydevicemanager.h b/include/talk/media/devices/dummydevicemanager.h deleted file mode 100644 index 7da8185..0000000 --- a/include/talk/media/devices/dummydevicemanager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_DUMMYDEVICEMANAGER_H_ -#define TALK_MEDIA_DEVICES_DUMMYDEVICEMANAGER_H_ - -#include - -#include "talk/media/base/mediacommon.h" -#include "talk/media/devices/fakedevicemanager.h" - -namespace cricket { - -class DummyDeviceManager : public FakeDeviceManager { - public: - DummyDeviceManager() { - std::vector devices; - devices.push_back(DeviceManagerInterface::kDefaultDeviceName); - SetAudioInputDevices(devices); - SetAudioOutputDevices(devices); - SetVideoCaptureDevices(devices); - } -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_DUMMYDEVICEMANAGER_H_ diff --git a/include/talk/media/devices/fakedevicemanager.h b/include/talk/media/devices/fakedevicemanager.h deleted file mode 100644 index a4b2b86..0000000 --- a/include/talk/media/devices/fakedevicemanager.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - * libjingle - * Copyright 2008 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_FAKEDEVICEMANAGER_H_ -#define TALK_MEDIA_DEVICES_FAKEDEVICEMANAGER_H_ - -#include -#include - -#include "talk/media/base/fakevideocapturer.h" -#include "talk/media/base/mediacommon.h" -#include "talk/media/devices/devicemanager.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/window.h" -#include "webrtc/base/windowpicker.h" - -namespace cricket { - -class FakeDeviceManager : public DeviceManagerInterface { - public: - FakeDeviceManager() {} - virtual bool Init() { - return true; - } - virtual void Terminate() { - } - virtual int GetCapabilities() { - std::vector devices; - int caps = VIDEO_RECV; - if (!input_devices_.empty()) { - caps |= AUDIO_SEND; - } - if (!output_devices_.empty()) { - caps |= AUDIO_RECV; - } - if (!vidcap_devices_.empty()) { - caps |= VIDEO_SEND; - } - return caps; - } - virtual bool GetAudioInputDevices(std::vector* devs) { - *devs = input_devices_; - return true; - } - virtual bool GetAudioOutputDevices(std::vector* devs) { - *devs = output_devices_; - return true; - } - virtual bool GetAudioInputDevice(const std::string& name, Device* out) { - return GetAudioDevice(true, name, out); - } - virtual bool GetAudioOutputDevice(const std::string& name, Device* out) { - return GetAudioDevice(false, name, out); - } - virtual bool GetVideoCaptureDevices(std::vector* devs) { - *devs = vidcap_devices_; - return true; - } - virtual void SetVideoDeviceCapturerFactory( - VideoDeviceCapturerFactory* video_device_capturer_factory) { - } - virtual void SetScreenCapturerFactory( - ScreenCapturerFactory* screen_capturer_factory) { - screen_capturer_factory_.reset(screen_capturer_factory); - } - virtual void SetVideoCaptureDeviceMaxFormat(const std::string& usb_id, - const VideoFormat& max_format) { - max_formats_[usb_id] = max_format; - } - bool IsMaxFormatForDevice(const std::string& usb_id, - const VideoFormat& max_format) const { - std::map::const_iterator found = - max_formats_.find(usb_id); - return (found != max_formats_.end()) ? - max_format == found->second : - false; - } - virtual void ClearVideoCaptureDeviceMaxFormat(const std::string& usb_id) { - max_formats_.erase(usb_id); - } - virtual VideoCapturer* CreateVideoCapturer(const Device& device) const { - return new FakeVideoCapturer(); - } - virtual VideoCapturer* CreateScreenCapturer( - const ScreencastId& screenid) const { - if (!screen_capturer_factory_) { - return new FakeVideoCapturer(); - } - return screen_capturer_factory_->Create(screenid); - } - virtual bool GetWindows( - std::vector* descriptions) { - descriptions->clear(); - const uint32_t id = 1u; // Note that 0 is not a valid ID. - const rtc::WindowId window_id = - rtc::WindowId::Cast(id); - std::string title = "FakeWindow"; - rtc::WindowDescription window_description(window_id, title); - descriptions->push_back(window_description); - return true; - } - virtual VideoCapturer* CreateWindowCapturer(rtc::WindowId window) { - if (!window.IsValid()) { - return NULL; - } - return new FakeVideoCapturer; - } - virtual bool GetDesktops( - std::vector* descriptions) { - descriptions->clear(); - const int id = 0; - const int valid_index = 0; - const rtc::DesktopId desktop_id = - rtc::DesktopId::Cast(id, valid_index); - std::string title = "FakeDesktop"; - rtc::DesktopDescription desktop_description(desktop_id, title); - descriptions->push_back(desktop_description); - return true; - } - virtual VideoCapturer* CreateDesktopCapturer(rtc::DesktopId desktop) { - if (!desktop.IsValid()) { - return NULL; - } - return new FakeVideoCapturer; - } - - virtual bool GetDefaultVideoCaptureDevice(Device* device) { - if (vidcap_devices_.empty()) { - return false; - } - *device = vidcap_devices_[0]; - return true; - } - -#ifdef OSX - bool QtKitToSgDevice(const std::string& qtkit_name, Device* out) { - out->name = qtkit_name; - out->id = "sg:" + qtkit_name; - return true; - } -#endif - - void SetAudioInputDevices(const std::vector& devices) { - input_devices_.clear(); - for (size_t i = 0; i < devices.size(); ++i) { - input_devices_.push_back(Device(devices[i], - static_cast(i))); - } - SignalDevicesChange(); - } - void SetAudioOutputDevices(const std::vector& devices) { - output_devices_.clear(); - for (size_t i = 0; i < devices.size(); ++i) { - output_devices_.push_back(Device(devices[i], - static_cast(i))); - } - SignalDevicesChange(); - } - void SetVideoCaptureDevices(const std::vector& devices) { - vidcap_devices_.clear(); - for (size_t i = 0; i < devices.size(); ++i) { - vidcap_devices_.push_back(Device(devices[i], - static_cast(i))); - } - SignalDevicesChange(); - } - virtual bool GetVideoCaptureDevice(const std::string& name, - Device* out) { - if (vidcap_devices_.empty()) - return false; - - // If the name is empty, return the default device. - if (name.empty() || name == kDefaultDeviceName) { - *out = vidcap_devices_[0]; - return true; - } - - return FindDeviceByName(vidcap_devices_, name, out); - } - bool GetAudioDevice(bool is_input, const std::string& name, - Device* out) { - // If the name is empty, return the default device. - if (name.empty() || name == kDefaultDeviceName) { - *out = Device(name, -1); - return true; - } - - return FindDeviceByName((is_input ? input_devices_ : output_devices_), - name, out); - } - static bool FindDeviceByName(const std::vector& devices, - const std::string& name, - Device* out) { - for (std::vector::const_iterator it = devices.begin(); - it != devices.end(); ++it) { - if (name == it->name) { - *out = *it; - return true; - } - } - return false; - } - - private: - std::vector input_devices_; - std::vector output_devices_; - std::vector vidcap_devices_; - std::map max_formats_; - rtc::scoped_ptr< - ScreenCapturerFactory> screen_capturer_factory_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_FAKEDEVICEMANAGER_H_ diff --git a/include/talk/media/devices/filevideocapturer.h b/include/talk/media/devices/filevideocapturer.h deleted file mode 100644 index cc41c39..0000000 --- a/include/talk/media/devices/filevideocapturer.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// This file contains two classes, VideoRecorder and FileVideoCapturer. -// VideoRecorder records the captured frames into a file. The file stores a -// sequence of captured frames; each frame has a header defined in struct -// CapturedFrame, followed by the frame data. -// -// FileVideoCapturer, a subclass of VideoCapturer, is a simulated video capturer -// that periodically reads images from a previously recorded file. - -#ifndef TALK_MEDIA_DEVICES_FILEVIDEOCAPTURER_H_ -#define TALK_MEDIA_DEVICES_FILEVIDEOCAPTURER_H_ - -#include -#include - -#include "talk/media/base/videocapturer.h" -#include "webrtc/base/stream.h" -#include "webrtc/base/stringutils.h" - -namespace rtc { -class FileStream; -} - -namespace cricket { - -// Utility class to record the frames captured by a video capturer into a file. -class VideoRecorder { - public: - VideoRecorder() {} - ~VideoRecorder() { Stop(); } - - // Start the recorder by opening the specified file. Return true if the file - // is opened successfully. write_header should normally be true; false means - // write raw frame pixel data to file without any headers. - bool Start(const std::string& filename, bool write_header); - // Stop the recorder by closing the file. - void Stop(); - // Record a video frame to the file. Return true if the frame is written to - // the file successfully. This method needs to be called after Start() and - // before Stop(). - bool RecordFrame(const CapturedFrame& frame); - - private: - rtc::FileStream video_file_; - bool write_header_; - - RTC_DISALLOW_COPY_AND_ASSIGN(VideoRecorder); -}; - -// Simulated video capturer that periodically reads frames from a file. -class FileVideoCapturer : public VideoCapturer { - public: - static const int kForever = -1; - - FileVideoCapturer(); - virtual ~FileVideoCapturer(); - - // Determines if the given device is actually a video file, to be captured - // with a FileVideoCapturer. - static bool IsFileVideoCapturerDevice(const Device& device) { - return rtc::starts_with(device.id.c_str(), kVideoFileDevicePrefix); - } - - // Creates a fake device for the given filename. - static Device CreateFileVideoCapturerDevice(const std::string& filename) { - std::stringstream id; - id << kVideoFileDevicePrefix << filename; - return Device(filename, id.str()); - } - - // Set how many times to repeat reading the file. Repeat forever if the - // parameter is kForever; no repeat if the parameter is 0 or - // less than -1. - void set_repeat(int repeat) { repeat_ = repeat; } - - // If ignore_framerate is true, file is read as quickly as possible. If - // false, read rate is controlled by the timestamps in the video file - // (thus simulating camera capture). Default value set to false. - void set_ignore_framerate(bool ignore_framerate) { - ignore_framerate_ = ignore_framerate; - } - - // Initializes the capturer with the given file. - bool Init(const std::string& filename); - - // Initializes the capturer with the given device. This should only be used - // if IsFileVideoCapturerDevice returned true for the given device. - bool Init(const Device& device); - - // Override virtual methods of parent class VideoCapturer. - virtual CaptureState Start(const VideoFormat& capture_format); - virtual void Stop(); - virtual bool IsRunning(); - virtual bool IsScreencast() const { return false; } - - protected: - // Override virtual methods of parent class VideoCapturer. - virtual bool GetPreferredFourccs(std::vector* fourccs); - - // Read the frame header from the file stream, video_file_. - rtc::StreamResult ReadFrameHeader(CapturedFrame* frame); - - // Read a frame and determine how long to wait for the next frame. If the - // frame is read successfully, Set the output parameter, wait_time_ms and - // return true. Otherwise, do not change wait_time_ms and return false. - bool ReadFrame(bool first_frame, int* wait_time_ms); - - // Return the CapturedFrame - useful for extracting contents after reading - // a frame. Should be used only while still reading a file (i.e. only while - // the CapturedFrame object still exists). - const CapturedFrame* frame() const { - return &captured_frame_; - } - - private: - class FileReadThread; // Forward declaration, defined in .cc. - - static const char* kVideoFileDevicePrefix; - rtc::FileStream video_file_; - CapturedFrame captured_frame_; - // The number of bytes allocated buffer for captured_frame_.data. - uint32_t frame_buffer_size_; - FileReadThread* file_read_thread_; - int repeat_; // How many times to repeat the file. - int64_t last_frame_timestamp_ns_; // Timestamp of last read frame. - bool ignore_framerate_; - - RTC_DISALLOW_COPY_AND_ASSIGN(FileVideoCapturer); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_FILEVIDEOCAPTURER_H_ diff --git a/include/talk/media/devices/gdivideorenderer.h b/include/talk/media/devices/gdivideorenderer.h deleted file mode 100755 index 0e4f6cf..0000000 --- a/include/talk/media/devices/gdivideorenderer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// Definition of class GdiVideoRenderer that implements the abstract class -// cricket::VideoRenderer via GDI on Windows. - -#ifndef TALK_MEDIA_DEVICES_GDIVIDEORENDERER_H_ -#define TALK_MEDIA_DEVICES_GDIVIDEORENDERER_H_ - -#ifdef WIN32 -#include "talk/media/base/videorenderer.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -class GdiVideoRenderer : public VideoRenderer { - public: - GdiVideoRenderer(int x, int y); - virtual ~GdiVideoRenderer(); - - // Implementation of pure virtual methods of VideoRenderer. - // These two methods may be executed in different threads. - // SetSize is called before RenderFrame. - virtual bool SetSize(int width, int height, int reserved); - virtual bool RenderFrame(const VideoFrame* frame); - - private: - class VideoWindow; // forward declaration, defined in the .cc file - rtc::scoped_ptr window_; - // The initial position of the window. - int initial_x_; - int initial_y_; -}; - -} // namespace cricket - -#endif // WIN32 -#endif // TALK_MEDIA_DEVICES_GDIVIDEORENDERER_H_ diff --git a/include/talk/media/devices/gtkvideorenderer.h b/include/talk/media/devices/gtkvideorenderer.h deleted file mode 100755 index 0270a7a..0000000 --- a/include/talk/media/devices/gtkvideorenderer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Definition of class GtkVideoRenderer that implements the abstract class -// cricket::VideoRenderer via GTK. - -#ifndef TALK_MEDIA_DEVICES_GTKVIDEORENDERER_H_ -#define TALK_MEDIA_DEVICES_GTKVIDEORENDERER_H_ - -#include "talk/media/base/videorenderer.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/scoped_ptr.h" - -typedef struct _GtkWidget GtkWidget; // forward declaration, defined in gtk.h - -namespace cricket { - -class GtkVideoRenderer : public VideoRenderer { - public: - GtkVideoRenderer(int x, int y); - virtual ~GtkVideoRenderer(); - - // Implementation of pure virtual methods of VideoRenderer. - // These two methods may be executed in different threads. - // SetSize is called before RenderFrame. - virtual bool SetSize(int width, int height, int reserved); - virtual bool RenderFrame(const VideoFrame* frame); - - private: - // Initialize the attributes when the first frame arrives. - bool Initialize(int width, int height); - // Pump the Gtk event loop until there are no events left. - void Pump(); - // Check if the window has been closed. - bool IsClosed() const; - - rtc::scoped_ptr image_; - GtkWidget* window_; - GtkWidget* draw_area_; - // The initial position of the window. - int initial_x_; - int initial_y_; - - int width_; - int height_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_GTKVIDEORENDERER_H_ diff --git a/include/talk/media/devices/libudevsymboltable.h b/include/talk/media/devices/libudevsymboltable.h deleted file mode 100644 index f764cd2..0000000 --- a/include/talk/media/devices/libudevsymboltable.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_LIBUDEVSYMBOLTABLE_H_ -#define TALK_MEDIA_DEVICES_LIBUDEVSYMBOLTABLE_H_ - -#include - -#include "webrtc/base/latebindingsymboltable.h" - -namespace cricket { - -#define LIBUDEV_SYMBOLS_CLASS_NAME LibUDevSymbolTable -// The libudev symbols we need, as an X-Macro list. -// This list must contain precisely every libudev function that is used in -// linuxdevicemanager.cc. -#define LIBUDEV_SYMBOLS_LIST \ - X(udev_device_get_devnode) \ - X(udev_device_get_parent_with_subsystem_devtype) \ - X(udev_device_get_sysattr_value) \ - X(udev_device_new_from_syspath) \ - X(udev_device_unref) \ - X(udev_enumerate_add_match_subsystem) \ - X(udev_enumerate_get_list_entry) \ - X(udev_enumerate_new) \ - X(udev_enumerate_scan_devices) \ - X(udev_enumerate_unref) \ - X(udev_list_entry_get_name) \ - X(udev_list_entry_get_next) \ - X(udev_monitor_enable_receiving) \ - X(udev_monitor_filter_add_match_subsystem_devtype) \ - X(udev_monitor_get_fd) \ - X(udev_monitor_new_from_netlink) \ - X(udev_monitor_receive_device) \ - X(udev_monitor_unref) \ - X(udev_new) \ - X(udev_unref) - -#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBUDEV_SYMBOLS_CLASS_NAME -#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBUDEV_SYMBOLS_LIST -#include "webrtc/base/latebindingsymboltable.h.def" -#undef LATE_BINDING_SYMBOL_TABLE_CLASS_NAME -#undef LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST - -// libudev has changed ABIs to libudev.so.1 in recent distros and lots of users -// and/or software (including Google Chrome) are symlinking the old to the new. -// The entire point of ABI versions is that you can't safely do that, and -// it has caused crashes in the wild. This function checks if the DllHandle that -// we got back for libudev.so.0 is actually for libudev.so.1. If so, the library -// cannot safely be used. -bool IsWrongLibUDevAbiVersion(rtc::DllHandle libudev_0); - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_LIBUDEVSYMBOLTABLE_H_ diff --git a/include/talk/media/devices/linuxdevicemanager.h b/include/talk/media/devices/linuxdevicemanager.h deleted file mode 100644 index 1eb648f..0000000 --- a/include/talk/media/devices/linuxdevicemanager.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_LINUXDEVICEMANAGER_H_ -#define TALK_MEDIA_DEVICES_LINUXDEVICEMANAGER_H_ - -#include -#include - -#include "talk/media/devices/devicemanager.h" -#include "webrtc/sound/soundsystemfactory.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/stringencode.h" - -namespace cricket { - -class LinuxDeviceManager : public DeviceManager { - public: - LinuxDeviceManager(); - virtual ~LinuxDeviceManager(); - - virtual bool GetVideoCaptureDevices(std::vector* devs); - - private: - virtual bool GetAudioDevices(bool input, std::vector* devs); - rtc::SoundSystemHandle sound_system_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_LINUXDEVICEMANAGER_H_ diff --git a/include/talk/media/devices/macdevicemanager.h b/include/talk/media/devices/macdevicemanager.h deleted file mode 100644 index 82e62f9..0000000 --- a/include/talk/media/devices/macdevicemanager.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_MACDEVICEMANAGER_H_ -#define TALK_MEDIA_DEVICES_MACDEVICEMANAGER_H_ - -#include -#include - -#include "talk/media/devices/devicemanager.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/stringencode.h" - -namespace cricket { - -class DeviceWatcher; - -class MacDeviceManager : public DeviceManager { - public: - MacDeviceManager(); - virtual ~MacDeviceManager(); - - virtual bool GetVideoCaptureDevices(std::vector* devs); - - private: - virtual bool GetAudioDevices(bool input, std::vector* devs); - bool FilterDevice(const Device& d); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_MACDEVICEMANAGER_H_ diff --git a/include/talk/media/devices/v4llookup.h b/include/talk/media/devices/v4llookup.h deleted file mode 100644 index 1bed90b..0000000 --- a/include/talk/media/devices/v4llookup.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * libjingle - * Copyright 2009 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Author: lexnikitin@google.com (Alexey Nikitin) - * - * V4LLookup provides basic functionality to work with V2L2 devices in Linux - * The functionality is implemented as a class with virtual methods for - * the purpose of unit testing. - */ -#ifndef TALK_MEDIA_DEVICES_V4LLOOKUP_H_ -#define TALK_MEDIA_DEVICES_V4LLOOKUP_H_ - -#include - -#ifdef LINUX -namespace cricket { -class V4LLookup { - public: - virtual ~V4LLookup() {} - - static bool IsV4L2Device(const std::string& device_path) { - return GetV4LLookup()->CheckIsV4L2Device(device_path); - } - - static void SetV4LLookup(V4LLookup* v4l_lookup) { - v4l_lookup_ = v4l_lookup; - } - - static V4LLookup* GetV4LLookup() { - if (!v4l_lookup_) { - v4l_lookup_ = new V4LLookup(); - } - return v4l_lookup_; - } - - protected: - static V4LLookup* v4l_lookup_; - // Making virtual so it is easier to mock - virtual bool CheckIsV4L2Device(const std::string& device_path); -}; - -} // namespace cricket - -#endif // LINUX -#endif // TALK_MEDIA_DEVICES_V4LLOOKUP_H_ diff --git a/include/talk/media/devices/videorendererfactory.h b/include/talk/media/devices/videorendererfactory.h deleted file mode 100644 index 416f05b..0000000 --- a/include/talk/media/devices/videorendererfactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// A factory to create a GUI video renderer. - -#ifndef TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_ -#define TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_ - -#include "talk/media/base/videorenderer.h" -#if defined(LINUX) && defined(HAVE_GTK) -#include "talk/media/devices/gtkvideorenderer.h" -#elif defined(OSX) && !defined(CARBON_DEPRECATED) -#include "talk/media/devices/carbonvideorenderer.h" -#elif defined(WIN32) -#include "talk/media/devices/gdivideorenderer.h" -#endif - -namespace cricket { - -class VideoRendererFactory { - public: - static VideoRenderer* CreateGuiVideoRenderer(int x, int y) { - #if defined(LINUX) && defined(HAVE_GTK) - return new GtkVideoRenderer(x, y); - #elif defined(OSX) && !defined(CARBON_DEPRECATED) - CarbonVideoRenderer* renderer = new CarbonVideoRenderer(x, y); - // Needs to be initialized on the main thread. - if (renderer->Initialize()) { - return renderer; - } else { - delete renderer; - return NULL; - } - #elif defined(WIN32) - return new GdiVideoRenderer(x, y); - #else - return NULL; - #endif - } -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_ diff --git a/include/talk/media/devices/win32devicemanager.h b/include/talk/media/devices/win32devicemanager.h deleted file mode 100644 index 5f8ba83..0000000 --- a/include/talk/media/devices/win32devicemanager.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_WIN32DEVICEMANAGER_H_ -#define TALK_MEDIA_DEVICES_WIN32DEVICEMANAGER_H_ - -#include -#include - -#include "talk/media/devices/devicemanager.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/stringencode.h" - -namespace cricket { - -class Win32DeviceManager : public DeviceManager { - public: - Win32DeviceManager(); - virtual ~Win32DeviceManager(); - - // Initialization - virtual bool Init(); - virtual void Terminate(); - - virtual bool GetVideoCaptureDevices(std::vector* devs); - - private: - virtual bool GetAudioDevices(bool input, std::vector* devs); - virtual bool GetDefaultVideoCaptureDevice(Device* device); - - bool need_couninitialize_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_WIN32DEVICEMANAGER_H_ diff --git a/include/talk/media/devices/yuvframescapturer.h b/include/talk/media/devices/yuvframescapturer.h deleted file mode 100644 index 850a8df..0000000 --- a/include/talk/media/devices/yuvframescapturer.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_DEVICES_YUVFRAMESCAPTURER_H_ -#define TALK_MEDIA_DEVICES_YUVFRAMESCAPTURER_H_ - -#include -#include - -#include "talk/media/base/videocapturer.h" -#include "talk/media/base/yuvframegenerator.h" -#include "webrtc/base/stream.h" -#include "webrtc/base/stringutils.h" - - -namespace rtc { -class FileStream; -} - -namespace cricket { - - -// Simulated video capturer that periodically reads frames from a file. -class YuvFramesCapturer : public VideoCapturer { - public: - YuvFramesCapturer(); - YuvFramesCapturer(int width, int height); - virtual ~YuvFramesCapturer(); - - static const char* kYuvFrameDeviceName; - static Device CreateYuvFramesCapturerDevice() { - std::stringstream id; - id << kYuvFrameDeviceName; - return Device(id.str(), id.str()); - } - static bool IsYuvFramesCapturerDevice(const Device& device) { - return rtc::starts_with(device.id.c_str(), kYuvFrameDeviceName); - } - - void Init(); - // Override virtual methods of parent class VideoCapturer. - virtual CaptureState Start(const VideoFormat& capture_format); - virtual void Stop(); - virtual bool IsRunning(); - virtual bool IsScreencast() const { return false; } - - protected: - // Override virtual methods of parent class VideoCapturer. - virtual bool GetPreferredFourccs(std::vector* fourccs); - - // Read a frame and determine how long to wait for the next frame. - void ReadFrame(bool first_frame); - - private: - class YuvFramesThread; // Forward declaration, defined in .cc. - - YuvFrameGenerator* frame_generator_; - CapturedFrame captured_frame_; - YuvFramesThread* frames_generator_thread; - int width_; - int height_; - uint32_t frame_data_size_; - uint32_t frame_index_; - - int64_t barcode_reference_timestamp_millis_; - int32_t barcode_interval_; - int32_t GetBarcodeValue(); - - RTC_DISALLOW_COPY_AND_ASSIGN(YuvFramesCapturer); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_DEVICES_YUVFRAMESCAPTURER_H_ diff --git a/include/talk/media/sctp/sctpdataengine.h b/include/talk/media/sctp/sctpdataengine.h deleted file mode 100644 index 4bc5f0b..0000000 --- a/include/talk/media/sctp/sctpdataengine.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * libjingle - * Copyright 2012 Google Inc. and Robin Seggelmann - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_SCTP_SCTPDATAENGINE_H_ -#define TALK_MEDIA_SCTP_SCTPDATAENGINE_H_ - -#include -#include -#include - -namespace cricket { -// Some ERRNO values get re-#defined to WSA* equivalents in some talk/ -// headers. We save the original ones in an enum. -enum PreservedErrno { - SCTP_EINPROGRESS = EINPROGRESS, - SCTP_EWOULDBLOCK = EWOULDBLOCK -}; -} // namespace cricket - -#include "talk/media/base/codec.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/mediaengine.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/scoped_ptr.h" - -// Defined by "usrsctplib/usrsctp.h" -struct sockaddr_conn; -struct sctp_assoc_change; -struct sctp_stream_reset_event; -// Defined by -struct socket; -namespace cricket { -// The highest stream ID (Sid) that SCTP allows, and the number of streams we -// tell SCTP we're going to use. -const uint32_t kMaxSctpSid = 1023; - -// This is the default SCTP port to use. It is passed along the wire and the -// connectee and connector must be using the same port. It is not related to the -// ports at the IP level. (Corresponds to: sockaddr_conn.sconn_port in -// usrsctp.h) -const int kSctpDefaultPort = 5000; - -class SctpDataMediaChannel; - -// A DataEngine that interacts with usrsctp. -// -// From channel calls, data flows like this: -// [worker thread (although it can in princple be another thread)] -// 1. SctpDataMediaChannel::SendData(data) -// 2. usrsctp_sendv(data) -// [worker thread returns; sctp thread then calls the following] -// 3. OnSctpOutboundPacket(wrapped_data) -// [sctp thread returns having posted a message for the worker thread] -// 4. SctpDataMediaChannel::OnMessage(wrapped_data) -// 5. SctpDataMediaChannel::OnPacketFromSctpToNetwork(wrapped_data) -// 6. NetworkInterface::SendPacket(wrapped_data) -// 7. ... across network ... a packet is sent back ... -// 8. SctpDataMediaChannel::OnPacketReceived(wrapped_data) -// 9. usrsctp_conninput(wrapped_data) -// [worker thread returns; sctp thread then calls the following] -// 10. OnSctpInboundData(data) -// [sctp thread returns having posted a message fot the worker thread] -// 11. SctpDataMediaChannel::OnMessage(inboundpacket) -// 12. SctpDataMediaChannel::OnInboundPacketFromSctpToChannel(inboundpacket) -// 13. SctpDataMediaChannel::OnDataFromSctpToChannel(data) -// 14. SctpDataMediaChannel::SignalDataReceived(data) -// [from the same thread, methods registered/connected to -// SctpDataMediaChannel are called with the recieved data] -class SctpDataEngine : public DataEngineInterface, public sigslot::has_slots<> { - public: - SctpDataEngine(); - virtual ~SctpDataEngine(); - - virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type); - - virtual const std::vector& data_codecs() { return codecs_; } - - static int SendThresholdCallback(struct socket* sock, uint32_t sb_free); - - private: - static int usrsctp_engines_count; - std::vector codecs_; - - static SctpDataMediaChannel* GetChannelFromSocket(struct socket* sock); -}; - -// TODO(ldixon): Make into a special type of TypedMessageData. -// Holds data to be passed on to a channel. -struct SctpInboundPacket; - -class SctpDataMediaChannel : public DataMediaChannel, - public rtc::MessageHandler { - public: - // DataMessageType is used for the SCTP "Payload Protocol Identifier", as - // defined in http://tools.ietf.org/html/rfc4960#section-14.4 - // - // For the list of IANA approved values see: - // http://www.iana.org/assignments/sctp-parameters/sctp-parameters.xml - // The value is not used by SCTP itself. It indicates the protocol running - // on top of SCTP. - enum PayloadProtocolIdentifier { - PPID_NONE = 0, // No protocol is specified. - // Matches the PPIDs in mozilla source and - // https://datatracker.ietf.org/doc/draft-ietf-rtcweb-data-protocol Sec. 9 - // They're not yet assigned by IANA. - PPID_CONTROL = 50, - PPID_BINARY_PARTIAL = 52, - PPID_BINARY_LAST = 53, - PPID_TEXT_PARTIAL = 54, - PPID_TEXT_LAST = 51 - }; - - typedef std::set StreamSet; - - // Given a thread which will be used to post messages (received data) to this - // SctpDataMediaChannel instance. - explicit SctpDataMediaChannel(rtc::Thread* thread); - virtual ~SctpDataMediaChannel(); - - // When SetSend is set to true, connects. When set to false, disconnects. - // Calling: "SetSend(true); SetSend(false); SetSend(true);" will connect, - // disconnect, and reconnect. - virtual bool SetSend(bool send); - // Unless SetReceive(true) is called, received packets will be discarded. - virtual bool SetReceive(bool receive); - - virtual bool SetSendParameters(const DataSendParameters& params); - virtual bool SetRecvParameters(const DataRecvParameters& params); - virtual bool AddSendStream(const StreamParams& sp); - virtual bool RemoveSendStream(uint32_t ssrc); - virtual bool AddRecvStream(const StreamParams& sp); - virtual bool RemoveRecvStream(uint32_t ssrc); - - // Called when Sctp gets data. The data may be a notification or data for - // OnSctpInboundData. Called from the worker thread. - virtual void OnMessage(rtc::Message* msg); - // Send data down this channel (will be wrapped as SCTP packets then given to - // sctp that will then post the network interface by OnMessage). - // Returns true iff successful data somewhere on the send-queue/network. - virtual bool SendData(const SendDataParams& params, - const rtc::Buffer& payload, - SendDataResult* result = NULL); - // A packet is received from the network interface. Posted to OnMessage. - virtual void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time); - - // Exposed to allow Post call from c-callbacks. - rtc::Thread* worker_thread() const { return worker_thread_; } - - // Many of these things are unused by SCTP, but are needed to fulfill - // the MediaChannel interface. - virtual void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) {} - virtual void OnReadyToSend(bool ready) {} - - void OnSendThresholdCallback(); - // Helper for debugging. - void set_debug_name(const std::string& debug_name) { - debug_name_ = debug_name; - } - const std::string& debug_name() const { return debug_name_; } - const struct socket* socket() const { return sock_; } - private: - sockaddr_conn GetSctpSockAddr(int port); - - bool SetSendCodecs(const std::vector& codecs); - bool SetRecvCodecs(const std::vector& codecs); - - // Creates the socket and connects. Sets sending_ to true. - bool Connect(); - // Closes the socket. Sets sending_ to false. - void Disconnect(); - - // Returns false when openning the socket failed; when successfull sets - // sending_ to true - bool OpenSctpSocket(); - // Sets sending_ to false and sock_ to NULL. - void CloseSctpSocket(); - - // Sends a SCTP_RESET_STREAM for all streams in closing_ssids_. - bool SendQueuedStreamResets(); - - // Adds a stream. - bool AddStream(const StreamParams &sp); - // Queues a stream for reset. - bool ResetStream(uint32_t ssrc); - - // Called by OnMessage to send packet on the network. - void OnPacketFromSctpToNetwork(rtc::Buffer* buffer); - // Called by OnMessage to decide what to do with the packet. - void OnInboundPacketFromSctpToChannel(SctpInboundPacket* packet); - void OnDataFromSctpToChannel(const ReceiveDataParams& params, - rtc::Buffer* buffer); - void OnNotificationFromSctp(rtc::Buffer* buffer); - void OnNotificationAssocChange(const sctp_assoc_change& change); - - void OnStreamResetEvent(const struct sctp_stream_reset_event* evt); - - // Responsible for marshalling incoming data to the channels listeners, and - // outgoing data to the network interface. - rtc::Thread* worker_thread_; - // The local and remote SCTP port to use. These are passed along the wire - // and the listener and connector must be using the same port. It is not - // related to the ports at the IP level. If set to -1, we default to - // kSctpDefaultPort. - int local_port_; - int remote_port_; - struct socket* sock_; // The socket created by usrsctp_socket(...). - - // sending_ is true iff there is a connected socket. - bool sending_; - // receiving_ controls whether inbound packets are thrown away. - bool receiving_; - - // When a data channel opens a stream, it goes into open_streams_. When we - // want to close it, the stream's ID goes into queued_reset_streams_. When - // we actually transmit a RE-CONFIG chunk with that stream ID, the ID goes - // into sent_reset_streams_. When we get a response RE-CONFIG chunk back - // acknowledging the reset, we remove the stream ID from - // sent_reset_streams_. We use sent_reset_streams_ to differentiate - // between acknowledgment RE-CONFIG and peer-initiated RE-CONFIGs. - StreamSet open_streams_; - StreamSet queued_reset_streams_; - StreamSet sent_reset_streams_; - - // A human-readable name for debugging messages. - std::string debug_name_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_SCTP_SCTPDATAENGINE_H_ diff --git a/include/talk/media/webrtc/constants.h b/include/talk/media/webrtc/constants.h deleted file mode 100755 index ff73faa..0000000 --- a/include/talk/media/webrtc/constants.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_CONSTANTS_H_ -#define TALK_MEDIA_WEBRTC_CONSTANTS_H_ - -namespace cricket { - -extern const int kVideoMtu; -extern const int kVideoRtpBufferSize; - -extern const char kH264CodecName[]; - -extern const int kMinVideoBitrate; -extern const int kStartVideoBitrate; -extern const int kMaxVideoBitrate; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_CONSTANTS_H_ diff --git a/include/talk/media/webrtc/fakewebrtccall.h b/include/talk/media/webrtc/fakewebrtccall.h deleted file mode 100644 index 3528c7a..0000000 --- a/include/talk/media/webrtc/fakewebrtccall.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains fake implementations, for use in unit tests, of the -// following classes: -// -// webrtc::Call -// webrtc::AudioSendStream -// webrtc::AudioReceiveStream -// webrtc::VideoSendStream -// webrtc::VideoReceiveStream - -#ifndef TALK_MEDIA_WEBRTC_FAKEWEBRTCCALL_H_ -#define TALK_MEDIA_WEBRTC_FAKEWEBRTCCALL_H_ - -#include - -#include "webrtc/call.h" -#include "webrtc/audio_receive_stream.h" -#include "webrtc/audio_send_stream.h" -#include "webrtc/video_frame.h" -#include "webrtc/video_receive_stream.h" -#include "webrtc/video_send_stream.h" - -namespace cricket { -class FakeAudioSendStream final : public webrtc::AudioSendStream { - public: - struct TelephoneEvent { - int payload_type = -1; - uint8_t event_code = 0; - uint32_t duration_ms = 0; - }; - - explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); - - const webrtc::AudioSendStream::Config& GetConfig() const; - void SetStats(const webrtc::AudioSendStream::Stats& stats); - TelephoneEvent GetLatestTelephoneEvent() const; - - private: - // webrtc::SendStream implementation. - void Start() override {} - void Stop() override {} - void SignalNetworkState(webrtc::NetworkState state) override {} - bool DeliverRtcp(const uint8_t* packet, size_t length) override { - return true; - } - - // webrtc::AudioSendStream implementation. - bool SendTelephoneEvent(int payload_type, uint8_t event, - uint32_t duration_ms) override; - webrtc::AudioSendStream::Stats GetStats() const override; - - TelephoneEvent latest_telephone_event_; - webrtc::AudioSendStream::Config config_; - webrtc::AudioSendStream::Stats stats_; -}; - -class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { - public: - explicit FakeAudioReceiveStream( - const webrtc::AudioReceiveStream::Config& config); - - const webrtc::AudioReceiveStream::Config& GetConfig() const; - void SetStats(const webrtc::AudioReceiveStream::Stats& stats); - int received_packets() const { return received_packets_; } - void IncrementReceivedPackets(); - - private: - // webrtc::ReceiveStream implementation. - void Start() override {} - void Stop() override {} - void SignalNetworkState(webrtc::NetworkState state) override {} - bool DeliverRtcp(const uint8_t* packet, size_t length) override { - return true; - } - bool DeliverRtp(const uint8_t* packet, - size_t length, - const webrtc::PacketTime& packet_time) override { - return true; - } - - // webrtc::AudioReceiveStream implementation. - webrtc::AudioReceiveStream::Stats GetStats() const override; - void SetSink(rtc::scoped_ptr sink) override; - - webrtc::AudioReceiveStream::Config config_; - webrtc::AudioReceiveStream::Stats stats_; - int received_packets_; - rtc::scoped_ptr sink_; -}; - -class FakeVideoSendStream final : public webrtc::VideoSendStream, - public webrtc::VideoCaptureInput { - public: - FakeVideoSendStream(const webrtc::VideoSendStream::Config& config, - const webrtc::VideoEncoderConfig& encoder_config); - webrtc::VideoSendStream::Config GetConfig() const; - webrtc::VideoEncoderConfig GetEncoderConfig() const; - std::vector GetVideoStreams(); - - bool IsSending() const; - bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; - bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; - - int GetNumberOfSwappedFrames() const; - int GetLastWidth() const; - int GetLastHeight() const; - int64_t GetLastTimestamp() const; - void SetStats(const webrtc::VideoSendStream::Stats& stats); - - private: - void IncomingCapturedFrame(const webrtc::VideoFrame& frame) override; - - // webrtc::SendStream implementation. - void Start() override; - void Stop() override; - void SignalNetworkState(webrtc::NetworkState state) override {} - bool DeliverRtcp(const uint8_t* packet, size_t length) override { - return true; - } - - // webrtc::VideoSendStream implementation. - webrtc::VideoSendStream::Stats GetStats() override; - bool ReconfigureVideoEncoder( - const webrtc::VideoEncoderConfig& config) override; - webrtc::VideoCaptureInput* Input() override; - - bool sending_; - webrtc::VideoSendStream::Config config_; - webrtc::VideoEncoderConfig encoder_config_; - bool codec_settings_set_; - union VpxSettings { - webrtc::VideoCodecVP8 vp8; - webrtc::VideoCodecVP9 vp9; - } vpx_settings_; - int num_swapped_frames_; - webrtc::VideoFrame last_frame_; - webrtc::VideoSendStream::Stats stats_; -}; - -class FakeVideoReceiveStream final : public webrtc::VideoReceiveStream { - public: - explicit FakeVideoReceiveStream( - const webrtc::VideoReceiveStream::Config& config); - - webrtc::VideoReceiveStream::Config GetConfig(); - - bool IsReceiving() const; - - void InjectFrame(const webrtc::VideoFrame& frame, int time_to_render_ms); - - void SetStats(const webrtc::VideoReceiveStream::Stats& stats); - - private: - // webrtc::ReceiveStream implementation. - void Start() override; - void Stop() override; - void SignalNetworkState(webrtc::NetworkState state) override {} - bool DeliverRtcp(const uint8_t* packet, size_t length) override { - return true; - } - bool DeliverRtp(const uint8_t* packet, - size_t length, - const webrtc::PacketTime& packet_time) override { - return true; - } - - // webrtc::VideoReceiveStream implementation. - webrtc::VideoReceiveStream::Stats GetStats() const override; - - webrtc::VideoReceiveStream::Config config_; - bool receiving_; - webrtc::VideoReceiveStream::Stats stats_; -}; - -class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver { - public: - explicit FakeCall(const webrtc::Call::Config& config); - ~FakeCall() override; - - webrtc::Call::Config GetConfig() const; - const std::vector& GetVideoSendStreams(); - const std::vector& GetVideoReceiveStreams(); - - const std::vector& GetAudioSendStreams(); - const FakeAudioSendStream* GetAudioSendStream(uint32_t ssrc); - const std::vector& GetAudioReceiveStreams(); - const FakeAudioReceiveStream* GetAudioReceiveStream(uint32_t ssrc); - - rtc::SentPacket last_sent_packet() const { return last_sent_packet_; } - webrtc::NetworkState GetNetworkState() const; - int GetNumCreatedSendStreams() const; - int GetNumCreatedReceiveStreams() const; - void SetStats(const webrtc::Call::Stats& stats); - - private: - webrtc::AudioSendStream* CreateAudioSendStream( - const webrtc::AudioSendStream::Config& config) override; - void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; - - webrtc::AudioReceiveStream* CreateAudioReceiveStream( - const webrtc::AudioReceiveStream::Config& config) override; - void DestroyAudioReceiveStream( - webrtc::AudioReceiveStream* receive_stream) override; - - webrtc::VideoSendStream* CreateVideoSendStream( - const webrtc::VideoSendStream::Config& config, - const webrtc::VideoEncoderConfig& encoder_config) override; - void DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) override; - - webrtc::VideoReceiveStream* CreateVideoReceiveStream( - const webrtc::VideoReceiveStream::Config& config) override; - void DestroyVideoReceiveStream( - webrtc::VideoReceiveStream* receive_stream) override; - webrtc::PacketReceiver* Receiver() override; - - DeliveryStatus DeliverPacket(webrtc::MediaType media_type, - const uint8_t* packet, - size_t length, - const webrtc::PacketTime& packet_time) override; - - webrtc::Call::Stats GetStats() const override; - - void SetBitrateConfig( - const webrtc::Call::Config::BitrateConfig& bitrate_config) override; - void SignalNetworkState(webrtc::NetworkState state) override; - void OnSentPacket(const rtc::SentPacket& sent_packet) override; - - webrtc::Call::Config config_; - webrtc::NetworkState network_state_; - rtc::SentPacket last_sent_packet_; - webrtc::Call::Stats stats_; - std::vector video_send_streams_; - std::vector audio_send_streams_; - std::vector video_receive_streams_; - std::vector audio_receive_streams_; - - int num_created_send_streams_; - int num_created_receive_streams_; -}; - -} // namespace cricket -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ diff --git a/include/talk/media/webrtc/fakewebrtccommon.h b/include/talk/media/webrtc/fakewebrtccommon.h deleted file mode 100644 index 4281528..0000000 --- a/include/talk/media/webrtc/fakewebrtccommon.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_PHONE_FAKEWEBRTCCOMMON_H_ -#define TALK_SESSION_PHONE_FAKEWEBRTCCOMMON_H_ - -#include "webrtc/base/common.h" - -namespace cricket { - -#define WEBRTC_STUB(method, args) \ - int method args override { return 0; } - -#define WEBRTC_STUB_CONST(method, args) \ - int method args const override { return 0; } - -#define WEBRTC_BOOL_STUB(method, args) \ - bool method args override { return true; } - -#define WEBRTC_BOOL_STUB_CONST(method, args) \ - bool method args const override { return true; } - -#define WEBRTC_VOID_STUB(method, args) \ - void method args override {} - -#define WEBRTC_FUNC(method, args) int method args override - -#define WEBRTC_FUNC_CONST(method, args) int method args const override - -#define WEBRTC_BOOL_FUNC(method, args) bool method args override - -#define WEBRTC_VOID_FUNC(method, args) void method args override -} // namespace cricket - -#endif // TALK_SESSION_PHONE_FAKEWEBRTCCOMMON_H_ diff --git a/include/talk/media/webrtc/fakewebrtcdeviceinfo.h b/include/talk/media/webrtc/fakewebrtcdeviceinfo.h deleted file mode 100644 index ad5d5f5..0000000 --- a/include/talk/media/webrtc/fakewebrtcdeviceinfo.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_PHONE_FAKEWEBRTCDEVICEINFO_H_ -#define TALK_SESSION_PHONE_FAKEWEBRTCDEVICEINFO_H_ - -#include - -#include "talk/media/webrtc/webrtcvideocapturer.h" -#include "webrtc/base/stringutils.h" - -// Fake class for mocking out webrtc::VideoCaptureModule::DeviceInfo. -class FakeWebRtcDeviceInfo : public webrtc::VideoCaptureModule::DeviceInfo { - public: - struct Device { - Device(const std::string& n, const std::string& i) : name(n), id(i) {} - std::string name; - std::string id; - std::string product; - std::vector caps; - }; - FakeWebRtcDeviceInfo() {} - void AddDevice(const std::string& device_name, const std::string& device_id) { - devices_.push_back(Device(device_name, device_id)); - } - void AddCapability(const std::string& device_id, - const webrtc::VideoCaptureCapability& cap) { - Device* dev = GetDeviceById( - reinterpret_cast(device_id.c_str())); - if (!dev) return; - dev->caps.push_back(cap); - } - virtual uint32_t NumberOfDevices() { - return static_cast(devices_.size()); - } - virtual int32_t GetDeviceName(uint32_t device_num, - char* device_name, - uint32_t device_name_len, - char* device_id, - uint32_t device_id_len, - char* product_id, - uint32_t product_id_len) { - Device* dev = GetDeviceByIndex(device_num); - if (!dev) return -1; - rtc::strcpyn(reinterpret_cast(device_name), device_name_len, - dev->name.c_str()); - rtc::strcpyn(reinterpret_cast(device_id), device_id_len, - dev->id.c_str()); - if (product_id) { - rtc::strcpyn(reinterpret_cast(product_id), product_id_len, - dev->product.c_str()); - } - return 0; - } - virtual int32_t NumberOfCapabilities(const char* device_id) { - Device* dev = GetDeviceById(device_id); - if (!dev) return -1; - return static_cast(dev->caps.size()); - } - virtual int32_t GetCapability(const char* device_id, - const uint32_t device_cap_num, - webrtc::VideoCaptureCapability& cap) { - Device* dev = GetDeviceById(device_id); - if (!dev) return -1; - if (device_cap_num >= dev->caps.size()) return -1; - cap = dev->caps[device_cap_num]; - return 0; - } - virtual int32_t GetOrientation(const char* device_id, - webrtc::VideoRotation& rotation) { - return -1; // not implemented - } - virtual int32_t GetBestMatchedCapability( - const char* device_id, - const webrtc::VideoCaptureCapability& requested, - webrtc::VideoCaptureCapability& resulting) { - return -1; // not implemented - } - virtual int32_t DisplayCaptureSettingsDialogBox( - const char* device_id, const char* dialog_title, - void* parent, uint32_t x, uint32_t y) { - return -1; // not implemented - } - - Device* GetDeviceByIndex(size_t num) { - return (num < devices_.size()) ? &devices_[num] : NULL; - } - Device* GetDeviceById(const char* device_id) { - for (size_t i = 0; i < devices_.size(); ++i) { - if (devices_[i].id == reinterpret_cast(device_id)) { - return &devices_[i]; - } - } - return NULL; - } - - private: - std::vector devices_; -}; - -#endif // TALK_SESSION_PHONE_FAKEWEBRTCDEVICEINFO_H_ diff --git a/include/talk/media/webrtc/fakewebrtcvcmfactory.h b/include/talk/media/webrtc/fakewebrtcvcmfactory.h deleted file mode 100644 index 40009cc..0000000 --- a/include/talk/media/webrtc/fakewebrtcvcmfactory.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_PHONE_FAKEWEBRTCVCMFACTORY_H_ -#define TALK_SESSION_PHONE_FAKEWEBRTCVCMFACTORY_H_ - -#include - -#include "talk/media/webrtc/fakewebrtcvideocapturemodule.h" -#include "talk/media/webrtc/webrtcvideocapturer.h" - -// Factory class to allow the fakes above to be injected into -// WebRtcVideoCapturer. -class FakeWebRtcVcmFactory : public cricket::WebRtcVcmFactoryInterface { - public: - virtual webrtc::VideoCaptureModule* Create(int module_id, - const char* device_id) { - if (!device_info.GetDeviceById(device_id)) return NULL; - FakeWebRtcVideoCaptureModule* module = - new FakeWebRtcVideoCaptureModule(this, module_id); - modules.push_back(module); - return module; - } - virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo(int id) { - return &device_info; - } - virtual void DestroyDeviceInfo(webrtc::VideoCaptureModule::DeviceInfo* info) { - } - void OnDestroyed(webrtc::VideoCaptureModule* module) { - std::remove(modules.begin(), modules.end(), module); - } - FakeWebRtcDeviceInfo device_info; - std::vector modules; -}; - -FakeWebRtcVideoCaptureModule::~FakeWebRtcVideoCaptureModule() { - if (factory_) - factory_->OnDestroyed(this); -} - -#endif // TALK_SESSION_PHONE_FAKEWEBRTCVCMFACTORY_H_ diff --git a/include/talk/media/webrtc/fakewebrtcvideocapturemodule.h b/include/talk/media/webrtc/fakewebrtcvideocapturemodule.h deleted file mode 100644 index 7540fcf..0000000 --- a/include/talk/media/webrtc/fakewebrtcvideocapturemodule.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_PHONE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ -#define TALK_SESSION_PHONE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ - -#include - -#include "talk/media/base/testutils.h" -#include "talk/media/webrtc/fakewebrtcdeviceinfo.h" -#include "talk/media/webrtc/webrtcvideocapturer.h" - -class FakeWebRtcVcmFactory; - -// Fake class for mocking out webrtc::VideoCaptureModule. -class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { - public: - FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory, int32_t id) - : factory_(factory), - id_(id), - callback_(NULL), - running_(false), - delay_(0) { - } - int64_t TimeUntilNextProcess() override { return 0; } - int32_t Process() override { return 0; } - void RegisterCaptureDataCallback( - webrtc::VideoCaptureDataCallback& callback) override { - callback_ = &callback; - } - void DeRegisterCaptureDataCallback() override { callback_ = NULL; } - void RegisterCaptureCallback( - webrtc::VideoCaptureFeedBack& callback) override { - // Not implemented. - } - void DeRegisterCaptureCallback() override { - // Not implemented. - } - void SetCaptureDelay(int32_t delay) override { delay_ = delay; } - int32_t CaptureDelay() override { return delay_; } - void EnableFrameRateCallback(const bool enable) override { - // not implemented - } - void EnableNoPictureAlarm(const bool enable) override { - // not implemented - } - int32_t StartCapture(const webrtc::VideoCaptureCapability& cap) override { - if (running_) return -1; - cap_ = cap; - running_ = true; - return 0; - } - int32_t StopCapture() override { - running_ = false; - return 0; - } - const char* CurrentDeviceName() const override { - return NULL; // not implemented - } - bool CaptureStarted() override { return running_; } - int32_t CaptureSettings(webrtc::VideoCaptureCapability& settings) override { - if (!running_) return -1; - settings = cap_; - return 0; - } - - int32_t SetCaptureRotation(webrtc::VideoRotation rotation) override { - return -1; // not implemented - } - bool SetApplyRotation(bool enable) override { - return false; // not implemented - } - bool GetApplyRotation() override { - return true; // Rotation compensation is turned on. - } - VideoCaptureEncodeInterface* GetEncodeInterface( - const webrtc::VideoCodec& codec) override { - return NULL; // not implemented - } - int32_t AddRef() const override { return 0; } - int32_t Release() const override { - delete this; - return 0; - } - - bool SendFrame(int w, int h) { - if (!running_) return false; - webrtc::VideoFrame sample; - // Setting stride based on width. - if (sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2) < 0) { - return false; - } - if (callback_) { - callback_->OnIncomingCapturedFrame(id_, sample); - } - return true; - } - - const webrtc::VideoCaptureCapability& cap() const { - return cap_; - } - - private: - // Ref-counted, use Release() instead. - ~FakeWebRtcVideoCaptureModule(); - - FakeWebRtcVcmFactory* factory_; - int id_; - webrtc::VideoCaptureDataCallback* callback_; - bool running_; - webrtc::VideoCaptureCapability cap_; - int delay_; -}; - -#endif // TALK_SESSION_PHONE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ diff --git a/include/talk/media/webrtc/fakewebrtcvideoengine.h b/include/talk/media/webrtc/fakewebrtcvideoengine.h deleted file mode 100644 index e0d4db5..0000000 --- a/include/talk/media/webrtc/fakewebrtcvideoengine.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_ -#define TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_ - -#include -#include -#include - -#include "talk/media/base/codec.h" -#include "talk/media/webrtc/fakewebrtccommon.h" -#include "talk/media/webrtc/webrtcvideodecoderfactory.h" -#include "talk/media/webrtc/webrtcvideoencoderfactory.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/gunit.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/base/thread_annotations.h" -#include "webrtc/modules/video_coding/include/video_error_codes.h" -#include "webrtc/video_decoder.h" -#include "webrtc/video_encoder.h" - -namespace cricket { - -static const int kMinVideoBitrate = 100; -static const int kStartVideoBitrate = 300; -static const int kMaxVideoBitrate = 1000; - -// WebRtc channel id and capture id share the same number space. -// This is how AddRenderer(renderId, ...) is able to tell if it is adding a -// renderer for a channel or it is adding a renderer for a capturer. -static const int kViEChannelIdBase = 0; -static const int kViEChannelIdMax = 1000; - -// Fake class for mocking out webrtc::VideoDecoder -class FakeWebRtcVideoDecoder : public webrtc::VideoDecoder { - public: - FakeWebRtcVideoDecoder() - : num_frames_received_(0) { - } - - virtual int32_t InitDecode(const webrtc::VideoCodec*, int32_t) { - return WEBRTC_VIDEO_CODEC_OK; - } - - virtual int32_t Decode(const webrtc::EncodedImage&, - bool, - const webrtc::RTPFragmentationHeader*, - const webrtc::CodecSpecificInfo*, - int64_t) { - num_frames_received_++; - return WEBRTC_VIDEO_CODEC_OK; - } - - virtual int32_t RegisterDecodeCompleteCallback( - webrtc::DecodedImageCallback*) { - return WEBRTC_VIDEO_CODEC_OK; - } - - virtual int32_t Release() { return WEBRTC_VIDEO_CODEC_OK; } - - virtual int32_t Reset() { return WEBRTC_VIDEO_CODEC_OK; } - - int GetNumFramesReceived() const { - return num_frames_received_; - } - - private: - int num_frames_received_; -}; - -// Fake class for mocking out WebRtcVideoDecoderFactory. -class FakeWebRtcVideoDecoderFactory : public WebRtcVideoDecoderFactory { - public: - FakeWebRtcVideoDecoderFactory() - : num_created_decoders_(0) { - } - - virtual webrtc::VideoDecoder* CreateVideoDecoder( - webrtc::VideoCodecType type) { - if (supported_codec_types_.count(type) == 0) { - return NULL; - } - FakeWebRtcVideoDecoder* decoder = new FakeWebRtcVideoDecoder(); - decoders_.push_back(decoder); - num_created_decoders_++; - return decoder; - } - - virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) { - decoders_.erase( - std::remove(decoders_.begin(), decoders_.end(), decoder), - decoders_.end()); - delete decoder; - } - - void AddSupportedVideoCodecType(webrtc::VideoCodecType type) { - supported_codec_types_.insert(type); - } - - int GetNumCreatedDecoders() { - return num_created_decoders_; - } - - const std::vector& decoders() { - return decoders_; - } - - private: - std::set supported_codec_types_; - std::vector decoders_; - int num_created_decoders_; -}; - -// Fake class for mocking out webrtc::VideoEnoder -class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { - public: - FakeWebRtcVideoEncoder() : num_frames_encoded_(0) {} - - virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings, - int32_t numberOfCores, - size_t maxPayloadSize) { - rtc::CritScope lock(&crit_); - codec_settings_ = *codecSettings; - return WEBRTC_VIDEO_CODEC_OK; - } - - webrtc::VideoCodec GetCodecSettings() { - rtc::CritScope lock(&crit_); - return codec_settings_; - } - - virtual int32_t Encode(const webrtc::VideoFrame& inputImage, - const webrtc::CodecSpecificInfo* codecSpecificInfo, - const std::vector* frame_types) { - rtc::CritScope lock(&crit_); - ++num_frames_encoded_; - return WEBRTC_VIDEO_CODEC_OK; - } - - virtual int32_t RegisterEncodeCompleteCallback( - webrtc::EncodedImageCallback* callback) { - return WEBRTC_VIDEO_CODEC_OK; - } - - virtual int32_t Release() { return WEBRTC_VIDEO_CODEC_OK; } - - virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) { - return WEBRTC_VIDEO_CODEC_OK; - } - - virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) { - return WEBRTC_VIDEO_CODEC_OK; - } - - int GetNumEncodedFrames() { - rtc::CritScope lock(&crit_); - return num_frames_encoded_; - } - - private: - rtc::CriticalSection crit_; - int num_frames_encoded_ GUARDED_BY(crit_); - webrtc::VideoCodec codec_settings_ GUARDED_BY(crit_); -}; - -// Fake class for mocking out WebRtcVideoEncoderFactory. -class FakeWebRtcVideoEncoderFactory : public WebRtcVideoEncoderFactory { - public: - FakeWebRtcVideoEncoderFactory() - : num_created_encoders_(0), encoders_have_internal_sources_(false) {} - - virtual webrtc::VideoEncoder* CreateVideoEncoder( - webrtc::VideoCodecType type) { - if (supported_codec_types_.count(type) == 0) { - return NULL; - } - FakeWebRtcVideoEncoder* encoder = new FakeWebRtcVideoEncoder(); - encoders_.push_back(encoder); - num_created_encoders_++; - return encoder; - } - - virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) { - encoders_.erase( - std::remove(encoders_.begin(), encoders_.end(), encoder), - encoders_.end()); - delete encoder; - } - - virtual const std::vector& codecs() - const { - return codecs_; - } - - virtual bool EncoderTypeHasInternalSource( - webrtc::VideoCodecType type) const override { - return encoders_have_internal_sources_; - } - - void set_encoders_have_internal_sources(bool internal_source) { - encoders_have_internal_sources_ = internal_source; - } - - void AddSupportedVideoCodecType(webrtc::VideoCodecType type, - const std::string& name) { - supported_codec_types_.insert(type); - codecs_.push_back( - WebRtcVideoEncoderFactory::VideoCodec(type, name, 1280, 720, 30)); - } - - int GetNumCreatedEncoders() { - return num_created_encoders_; - } - - const std::vector& encoders() { - return encoders_; - } - - private: - std::set supported_codec_types_; - std::vector codecs_; - std::vector encoders_; - int num_created_encoders_; - bool encoders_have_internal_sources_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_ diff --git a/include/talk/media/webrtc/fakewebrtcvoiceengine.h b/include/talk/media/webrtc/fakewebrtcvoiceengine.h deleted file mode 100644 index bf22a29..0000000 --- a/include/talk/media/webrtc/fakewebrtcvoiceengine.h +++ /dev/null @@ -1,823 +0,0 @@ -/* - * libjingle - * Copyright 2010 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ -#define TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ - -#include -#include -#include - -#include "talk/media/base/codec.h" -#include "talk/media/base/rtputils.h" -#include "talk/media/webrtc/fakewebrtccommon.h" -#include "talk/media/webrtc/webrtcvoe.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/checks.h" -#include "webrtc/base/gunit.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/config.h" -#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" -#include "webrtc/modules/audio_processing/include/audio_processing.h" - -namespace cricket { - -static const int kOpusBandwidthNb = 4000; -static const int kOpusBandwidthMb = 6000; -static const int kOpusBandwidthWb = 8000; -static const int kOpusBandwidthSwb = 12000; -static const int kOpusBandwidthFb = 20000; - -#define WEBRTC_CHECK_CHANNEL(channel) \ - if (channels_.find(channel) == channels_.end()) return -1; - -class FakeAudioProcessing : public webrtc::AudioProcessing { - public: - FakeAudioProcessing() : experimental_ns_enabled_(false) {} - - WEBRTC_STUB(Initialize, ()) - WEBRTC_STUB(Initialize, ( - int input_sample_rate_hz, - int output_sample_rate_hz, - int reverse_sample_rate_hz, - webrtc::AudioProcessing::ChannelLayout input_layout, - webrtc::AudioProcessing::ChannelLayout output_layout, - webrtc::AudioProcessing::ChannelLayout reverse_layout)); - WEBRTC_STUB(Initialize, ( - const webrtc::ProcessingConfig& processing_config)); - - WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) { - experimental_ns_enabled_ = config.Get().enabled; - } - - WEBRTC_STUB_CONST(input_sample_rate_hz, ()); - WEBRTC_STUB_CONST(proc_sample_rate_hz, ()); - WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ()); - WEBRTC_STUB_CONST(num_input_channels, ()); - WEBRTC_STUB_CONST(num_output_channels, ()); - WEBRTC_STUB_CONST(num_reverse_channels, ()); - WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted)); - WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame)); - WEBRTC_STUB(ProcessStream, ( - const float* const* src, - size_t samples_per_channel, - int input_sample_rate_hz, - webrtc::AudioProcessing::ChannelLayout input_layout, - int output_sample_rate_hz, - webrtc::AudioProcessing::ChannelLayout output_layout, - float* const* dest)); - WEBRTC_STUB(ProcessStream, - (const float* const* src, - const webrtc::StreamConfig& input_config, - const webrtc::StreamConfig& output_config, - float* const* dest)); - WEBRTC_STUB(AnalyzeReverseStream, (webrtc::AudioFrame* frame)); - WEBRTC_STUB(ProcessReverseStream, (webrtc::AudioFrame * frame)); - WEBRTC_STUB(AnalyzeReverseStream, ( - const float* const* data, - size_t samples_per_channel, - int sample_rate_hz, - webrtc::AudioProcessing::ChannelLayout layout)); - WEBRTC_STUB(ProcessReverseStream, - (const float* const* src, - const webrtc::StreamConfig& reverse_input_config, - const webrtc::StreamConfig& reverse_output_config, - float* const* dest)); - WEBRTC_STUB(set_stream_delay_ms, (int delay)); - WEBRTC_STUB_CONST(stream_delay_ms, ()); - WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ()); - WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed)); - WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset)); - WEBRTC_STUB_CONST(delay_offset_ms, ()); - WEBRTC_STUB(StartDebugRecording, (const char filename[kMaxFilenameSize])); - WEBRTC_STUB(StartDebugRecording, (FILE* handle)); - WEBRTC_STUB(StopDebugRecording, ()); - WEBRTC_VOID_STUB(UpdateHistogramsOnCallEnd, ()); - webrtc::EchoCancellation* echo_cancellation() const override { return NULL; } - webrtc::EchoControlMobile* echo_control_mobile() const override { - return NULL; - } - webrtc::GainControl* gain_control() const override { return NULL; } - webrtc::HighPassFilter* high_pass_filter() const override { return NULL; } - webrtc::LevelEstimator* level_estimator() const override { return NULL; } - webrtc::NoiseSuppression* noise_suppression() const override { return NULL; } - webrtc::VoiceDetection* voice_detection() const override { return NULL; } - - bool experimental_ns_enabled() { - return experimental_ns_enabled_; - } - - private: - bool experimental_ns_enabled_; -}; - -class FakeWebRtcVoiceEngine - : public webrtc::VoEAudioProcessing, - public webrtc::VoEBase, public webrtc::VoECodec, - public webrtc::VoEHardware, - public webrtc::VoENetwork, public webrtc::VoERTP_RTCP, - public webrtc::VoEVolumeControl { - public: - struct Channel { - explicit Channel() - : external_transport(false), - send(false), - playout(false), - volume_scale(1.0), - vad(false), - codec_fec(false), - max_encoding_bandwidth(0), - opus_dtx(false), - red(false), - nack(false), - cn8_type(13), - cn16_type(105), - red_type(117), - nack_max_packets(0), - send_ssrc(0), - associate_send_channel(-1), - recv_codecs(), - neteq_capacity(-1), - neteq_fast_accelerate(false) { - memset(&send_codec, 0, sizeof(send_codec)); - } - bool external_transport; - bool send; - bool playout; - float volume_scale; - bool vad; - bool codec_fec; - int max_encoding_bandwidth; - bool opus_dtx; - bool red; - bool nack; - int cn8_type; - int cn16_type; - int red_type; - int nack_max_packets; - uint32_t send_ssrc; - int associate_send_channel; - std::vector recv_codecs; - webrtc::CodecInst send_codec; - webrtc::PacketTime last_rtp_packet_time; - std::list packets; - int neteq_capacity; - bool neteq_fast_accelerate; - }; - - FakeWebRtcVoiceEngine() - : inited_(false), - last_channel_(-1), - fail_create_channel_(false), - num_set_send_codecs_(0), - ec_enabled_(false), - ec_metrics_enabled_(false), - cng_enabled_(false), - ns_enabled_(false), - agc_enabled_(false), - highpass_filter_enabled_(false), - stereo_swapping_enabled_(false), - typing_detection_enabled_(false), - ec_mode_(webrtc::kEcDefault), - aecm_mode_(webrtc::kAecmSpeakerphone), - ns_mode_(webrtc::kNsDefault), - agc_mode_(webrtc::kAgcDefault), - observer_(NULL), - playout_fail_channel_(-1), - send_fail_channel_(-1), - recording_sample_rate_(-1), - playout_sample_rate_(-1) { - memset(&agc_config_, 0, sizeof(agc_config_)); - } - ~FakeWebRtcVoiceEngine() { - RTC_CHECK(channels_.empty()); - } - - bool ec_metrics_enabled() const { return ec_metrics_enabled_; } - - bool IsInited() const { return inited_; } - int GetLastChannel() const { return last_channel_; } - int GetNumChannels() const { return static_cast(channels_.size()); } - uint32_t GetLocalSSRC(int channel) { - return channels_[channel]->send_ssrc; - } - bool GetPlayout(int channel) { - return channels_[channel]->playout; - } - bool GetSend(int channel) { - return channels_[channel]->send; - } - bool GetVAD(int channel) { - return channels_[channel]->vad; - } - bool GetOpusDtx(int channel) { - return channels_[channel]->opus_dtx; - } - bool GetRED(int channel) { - return channels_[channel]->red; - } - bool GetCodecFEC(int channel) { - return channels_[channel]->codec_fec; - } - int GetMaxEncodingBandwidth(int channel) { - return channels_[channel]->max_encoding_bandwidth; - } - bool GetNACK(int channel) { - return channels_[channel]->nack; - } - int GetNACKMaxPackets(int channel) { - return channels_[channel]->nack_max_packets; - } - const webrtc::PacketTime& GetLastRtpPacketTime(int channel) { - RTC_DCHECK(channels_.find(channel) != channels_.end()); - return channels_[channel]->last_rtp_packet_time; - } - int GetSendCNPayloadType(int channel, bool wideband) { - return (wideband) ? - channels_[channel]->cn16_type : - channels_[channel]->cn8_type; - } - int GetSendREDPayloadType(int channel) { - return channels_[channel]->red_type; - } - bool CheckPacket(int channel, const void* data, size_t len) { - bool result = !CheckNoPacket(channel); - if (result) { - std::string packet = channels_[channel]->packets.front(); - result = (packet == std::string(static_cast(data), len)); - channels_[channel]->packets.pop_front(); - } - return result; - } - bool CheckNoPacket(int channel) { - return channels_[channel]->packets.empty(); - } - void TriggerCallbackOnError(int channel_num, int err_code) { - RTC_DCHECK(observer_ != NULL); - observer_->CallbackOnError(channel_num, err_code); - } - void set_playout_fail_channel(int channel) { - playout_fail_channel_ = channel; - } - void set_send_fail_channel(int channel) { - send_fail_channel_ = channel; - } - void set_fail_create_channel(bool fail_create_channel) { - fail_create_channel_ = fail_create_channel; - } - int AddChannel(const webrtc::Config& config) { - if (fail_create_channel_) { - return -1; - } - Channel* ch = new Channel(); - auto db = webrtc::acm2::RentACodec::Database(); - ch->recv_codecs.assign(db.begin(), db.end()); - if (config.Get().enabled) { - ch->neteq_capacity = config.Get().capacity; - } - ch->neteq_fast_accelerate = - config.Get().enabled; - channels_[++last_channel_] = ch; - return last_channel_; - } - - int GetNumSetSendCodecs() const { return num_set_send_codecs_; } - - int GetAssociateSendChannel(int channel) { - return channels_[channel]->associate_send_channel; - } - - WEBRTC_STUB(Release, ()); - - // webrtc::VoEBase - WEBRTC_FUNC(RegisterVoiceEngineObserver, ( - webrtc::VoiceEngineObserver& observer)) { - observer_ = &observer; - return 0; - } - WEBRTC_STUB(DeRegisterVoiceEngineObserver, ()); - WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm, - webrtc::AudioProcessing* audioproc)) { - inited_ = true; - return 0; - } - WEBRTC_FUNC(Terminate, ()) { - inited_ = false; - return 0; - } - webrtc::AudioProcessing* audio_processing() override { - return &audio_processing_; - } - WEBRTC_FUNC(CreateChannel, ()) { - webrtc::Config empty_config; - return AddChannel(empty_config); - } - WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) { - return AddChannel(config); - } - WEBRTC_FUNC(DeleteChannel, (int channel)) { - WEBRTC_CHECK_CHANNEL(channel); - for (const auto& ch : channels_) { - if (ch.second->associate_send_channel == channel) { - ch.second->associate_send_channel = -1; - } - } - delete channels_[channel]; - channels_.erase(channel); - return 0; - } - WEBRTC_STUB(StartReceive, (int channel)); - WEBRTC_FUNC(StartPlayout, (int channel)) { - if (playout_fail_channel_ != channel) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->playout = true; - return 0; - } else { - // When playout_fail_channel_ == channel, fail the StartPlayout on this - // channel. - return -1; - } - } - WEBRTC_FUNC(StartSend, (int channel)) { - if (send_fail_channel_ != channel) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->send = true; - return 0; - } else { - // When send_fail_channel_ == channel, fail the StartSend on this - // channel. - return -1; - } - } - WEBRTC_STUB(StopReceive, (int channel)); - WEBRTC_FUNC(StopPlayout, (int channel)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->playout = false; - return 0; - } - WEBRTC_FUNC(StopSend, (int channel)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->send = false; - return 0; - } - WEBRTC_STUB(GetVersion, (char version[1024])); - WEBRTC_STUB(LastError, ()); - WEBRTC_FUNC(AssociateSendChannel, (int channel, - int accociate_send_channel)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->associate_send_channel = accociate_send_channel; - return 0; - } - webrtc::RtcEventLog* GetEventLog() { return nullptr; } - - // webrtc::VoECodec - WEBRTC_STUB(NumOfCodecs, ()); - WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec)); - WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - // To match the behavior of the real implementation. - if (_stricmp(codec.plname, "telephone-event") == 0 || - _stricmp(codec.plname, "audio/telephone-event") == 0 || - _stricmp(codec.plname, "CN") == 0 || - _stricmp(codec.plname, "red") == 0 ) { - return -1; - } - channels_[channel]->send_codec = codec; - ++num_set_send_codecs_; - return 0; - } - WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - codec = channels_[channel]->send_codec; - return 0; - } - WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps)); - WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec)); - WEBRTC_FUNC(SetRecPayloadType, (int channel, - const webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - Channel* ch = channels_[channel]; - if (ch->playout) - return -1; // Channel is in use. - // Check if something else already has this slot. - if (codec.pltype != -1) { - for (std::vector::iterator it = - ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) { - if (it->pltype == codec.pltype && - _stricmp(it->plname, codec.plname) != 0) { - return -1; - } - } - } - // Otherwise try to find this codec and update its payload type. - int result = -1; // not found - for (std::vector::iterator it = ch->recv_codecs.begin(); - it != ch->recv_codecs.end(); ++it) { - if (strcmp(it->plname, codec.plname) == 0 && - it->plfreq == codec.plfreq && - it->channels == codec.channels) { - it->pltype = codec.pltype; - result = 0; - } - } - return result; - } - WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type, - webrtc::PayloadFrequencies frequency)) { - WEBRTC_CHECK_CHANNEL(channel); - if (frequency == webrtc::kFreq8000Hz) { - channels_[channel]->cn8_type = type; - } else if (frequency == webrtc::kFreq16000Hz) { - channels_[channel]->cn16_type = type; - } - return 0; - } - WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - Channel* ch = channels_[channel]; - for (std::vector::iterator it = ch->recv_codecs.begin(); - it != ch->recv_codecs.end(); ++it) { - if (strcmp(it->plname, codec.plname) == 0 && - it->plfreq == codec.plfreq && - it->channels == codec.channels && - it->pltype != -1) { - codec.pltype = it->pltype; - return 0; - } - } - return -1; // not found - } - WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode, - bool disableDTX)) { - WEBRTC_CHECK_CHANNEL(channel); - if (channels_[channel]->send_codec.channels == 2) { - // Replicating VoE behavior; VAD cannot be enabled for stereo. - return -1; - } - channels_[channel]->vad = enable; - return 0; - } - WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled, - webrtc::VadModes& mode, bool& disabledDTX)); - - WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) { - WEBRTC_CHECK_CHANNEL(channel); - if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { - // Return -1 if current send codec is not Opus. - // TODO(minyue): Excludes other codecs if they support inband FEC. - return -1; - } - channels_[channel]->codec_fec = enable; - return 0; - } - WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) { - WEBRTC_CHECK_CHANNEL(channel); - enable = channels_[channel]->codec_fec; - return 0; - } - - WEBRTC_FUNC(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)) { - WEBRTC_CHECK_CHANNEL(channel); - if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { - // Return -1 if current send codec is not Opus. - return -1; - } - if (frequency_hz <= 8000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthNb; - else if (frequency_hz <= 12000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthMb; - else if (frequency_hz <= 16000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthWb; - else if (frequency_hz <= 24000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthSwb; - else - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthFb; - return 0; - } - - WEBRTC_FUNC(SetOpusDtx, (int channel, bool enable_dtx)) { - WEBRTC_CHECK_CHANNEL(channel); - if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { - // Return -1 if current send codec is not Opus. - return -1; - } - channels_[channel]->opus_dtx = enable_dtx; - return 0; - } - - // webrtc::VoEHardware - WEBRTC_STUB(GetNumOfRecordingDevices, (int& num)); - WEBRTC_STUB(GetNumOfPlayoutDevices, (int& num)); - WEBRTC_STUB(GetRecordingDeviceName, (int i, char* name, char* guid)); - WEBRTC_STUB(GetPlayoutDeviceName, (int i, char* name, char* guid)); - WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel)); - WEBRTC_STUB(SetPlayoutDevice, (int)); - WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers)); - WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&)); - WEBRTC_FUNC(SetRecordingSampleRate, (unsigned int samples_per_sec)) { - recording_sample_rate_ = samples_per_sec; - return 0; - } - WEBRTC_FUNC_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)) { - *samples_per_sec = recording_sample_rate_; - return 0; - } - WEBRTC_FUNC(SetPlayoutSampleRate, (unsigned int samples_per_sec)) { - playout_sample_rate_ = samples_per_sec; - return 0; - } - WEBRTC_FUNC_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)) { - *samples_per_sec = playout_sample_rate_; - return 0; - } - WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); - virtual bool BuiltInAECIsAvailable() const { return false; } - WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); - virtual bool BuiltInAGCIsAvailable() const { return false; } - WEBRTC_STUB(EnableBuiltInNS, (bool enable)); - virtual bool BuiltInNSIsAvailable() const { return false; } - - // webrtc::VoENetwork - WEBRTC_FUNC(RegisterExternalTransport, (int channel, - webrtc::Transport& transport)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->external_transport = true; - return 0; - } - WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->external_transport = false; - return 0; - } - WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data, - size_t length)) { - WEBRTC_CHECK_CHANNEL(channel); - if (!channels_[channel]->external_transport) return -1; - channels_[channel]->packets.push_back( - std::string(static_cast(data), length)); - return 0; - } - WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data, - size_t length, - const webrtc::PacketTime& packet_time)) { - WEBRTC_CHECK_CHANNEL(channel); - if (ReceivedRTPPacket(channel, data, length) == -1) { - return -1; - } - channels_[channel]->last_rtp_packet_time = packet_time; - return 0; - } - - WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data, - size_t length)); - - // webrtc::VoERTP_RTCP - WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->send_ssrc = ssrc; - return 0; - } - WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc)); - WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); - WEBRTC_STUB(SetSendAudioLevelIndicationStatus, (int channel, bool enable, - unsigned char id)); - WEBRTC_STUB(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable, - unsigned char id)); - WEBRTC_STUB(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable, - unsigned char id)); - WEBRTC_STUB(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable, - unsigned char id)); - WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable)); - WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled)); - WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256])); - WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256])); - WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname)); - WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh, - unsigned int& NTPLow, - unsigned int& timestamp, - unsigned int& playoutTimestamp, - unsigned int* jitter, - unsigned short* fractionLost)); - WEBRTC_STUB(GetRemoteRTCPReportBlocks, - (int channel, std::vector* receive_blocks)); - WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs, - unsigned int& maxJitterMs, - unsigned int& discardedPackets)); - WEBRTC_STUB(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats)); - WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->red = enable; - channels_[channel]->red_type = redPayloadtype; - return 0; - } - WEBRTC_FUNC(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)) { - WEBRTC_CHECK_CHANNEL(channel); - enable = channels_[channel]->red; - redPayloadtype = channels_[channel]->red_type; - return 0; - } - WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->nack = enable; - channels_[channel]->nack_max_packets = maxNoPackets; - return 0; - } - - // webrtc::VoEVolumeControl - WEBRTC_STUB(SetSpeakerVolume, (unsigned int)); - WEBRTC_STUB(GetSpeakerVolume, (unsigned int&)); - WEBRTC_STUB(SetMicVolume, (unsigned int)); - WEBRTC_STUB(GetMicVolume, (unsigned int&)); - WEBRTC_STUB(SetInputMute, (int, bool)); - WEBRTC_STUB(GetInputMute, (int, bool&)); - WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&)); - WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&)); - WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&)); - WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&)); - WEBRTC_FUNC(SetChannelOutputVolumeScaling, (int channel, float scale)) { - WEBRTC_CHECK_CHANNEL(channel); - channels_[channel]->volume_scale= scale; - return 0; - } - WEBRTC_FUNC(GetChannelOutputVolumeScaling, (int channel, float& scale)) { - WEBRTC_CHECK_CHANNEL(channel); - scale = channels_[channel]->volume_scale; - return 0; - } - WEBRTC_STUB(SetOutputVolumePan, (int channel, float left, float right)); - WEBRTC_STUB(GetOutputVolumePan, (int channel, float& left, float& right)); - - // webrtc::VoEAudioProcessing - WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) { - ns_enabled_ = enable; - ns_mode_ = mode; - return 0; - } - WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) { - enabled = ns_enabled_; - mode = ns_mode_; - return 0; - } - - WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) { - agc_enabled_ = enable; - agc_mode_ = mode; - return 0; - } - WEBRTC_FUNC(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode)) { - enabled = agc_enabled_; - mode = agc_mode_; - return 0; - } - - WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) { - agc_config_ = config; - return 0; - } - WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) { - config = agc_config_; - return 0; - } - WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) { - ec_enabled_ = enable; - ec_mode_ = mode; - return 0; - } - WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) { - enabled = ec_enabled_; - mode = ec_mode_; - return 0; - } - WEBRTC_STUB(EnableDriftCompensation, (bool enable)) - WEBRTC_BOOL_STUB(DriftCompensationEnabled, ()) - WEBRTC_VOID_STUB(SetDelayOffsetMs, (int offset)) - WEBRTC_STUB(DelayOffsetMs, ()); - WEBRTC_FUNC(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG)) { - aecm_mode_ = mode; - cng_enabled_ = enableCNG; - return 0; - } - WEBRTC_FUNC(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG)) { - mode = aecm_mode_; - enabledCNG = cng_enabled_; - return 0; - } - WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode)); - WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled, - webrtc::NsModes& mode)); - WEBRTC_STUB(SetRxAgcStatus, (int channel, bool enable, - webrtc::AgcModes mode)); - WEBRTC_STUB(GetRxAgcStatus, (int channel, bool& enabled, - webrtc::AgcModes& mode)); - WEBRTC_STUB(SetRxAgcConfig, (int channel, webrtc::AgcConfig config)); - WEBRTC_STUB(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config)); - - WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&)); - WEBRTC_STUB(DeRegisterRxVadObserver, (int channel)); - WEBRTC_STUB(VoiceActivityIndicator, (int channel)); - WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) { - ec_metrics_enabled_ = enable; - return 0; - } - WEBRTC_STUB(GetEcMetricsStatus, (bool& enabled)); - WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP)); - WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std, - float& fraction_poor_delays)); - - WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8)); - WEBRTC_STUB(StartDebugRecording, (FILE* handle)); - WEBRTC_STUB(StopDebugRecording, ()); - - WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) { - typing_detection_enabled_ = enable; - return 0; - } - WEBRTC_FUNC(GetTypingDetectionStatus, (bool& enabled)) { - enabled = typing_detection_enabled_; - return 0; - } - - WEBRTC_STUB(TimeSinceLastTyping, (int& seconds)); - WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow, - int costPerTyping, - int reportingThreshold, - int penaltyDecay, - int typeEventDelay)); - int EnableHighPassFilter(bool enable) { - highpass_filter_enabled_ = enable; - return 0; - } - bool IsHighPassFilterEnabled() { - return highpass_filter_enabled_; - } - bool IsStereoChannelSwappingEnabled() { - return stereo_swapping_enabled_; - } - void EnableStereoChannelSwapping(bool enable) { - stereo_swapping_enabled_ = enable; - } - int GetNetEqCapacity() const { - auto ch = channels_.find(last_channel_); - ASSERT(ch != channels_.end()); - return ch->second->neteq_capacity; - } - bool GetNetEqFastAccelerate() const { - auto ch = channels_.find(last_channel_); - ASSERT(ch != channels_.end()); - return ch->second->neteq_fast_accelerate; - } - - private: - bool inited_; - int last_channel_; - std::map channels_; - bool fail_create_channel_; - int num_set_send_codecs_; // how many times we call SetSendCodec(). - bool ec_enabled_; - bool ec_metrics_enabled_; - bool cng_enabled_; - bool ns_enabled_; - bool agc_enabled_; - bool highpass_filter_enabled_; - bool stereo_swapping_enabled_; - bool typing_detection_enabled_; - webrtc::EcModes ec_mode_; - webrtc::AecmModes aecm_mode_; - webrtc::NsModes ns_mode_; - webrtc::AgcModes agc_mode_; - webrtc::AgcConfig agc_config_; - webrtc::VoiceEngineObserver* observer_; - int playout_fail_channel_; - int send_fail_channel_; - int recording_sample_rate_; - int playout_sample_rate_; - FakeAudioProcessing audio_processing_; -}; - -} // namespace cricket - -#endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ diff --git a/include/talk/media/webrtc/simulcast.h b/include/talk/media/webrtc/simulcast.h deleted file mode 100755 index 68d0aae..0000000 --- a/include/talk/media/webrtc/simulcast.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_SIMULCAST_H_ -#define TALK_MEDIA_WEBRTC_SIMULCAST_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/config.h" - -namespace cricket { -struct StreamParams; - -// Config for use with screen cast when temporal layers are enabled. -struct ScreenshareLayerConfig { - public: - ScreenshareLayerConfig(int tl0_bitrate, int tl1_bitrate); - - // Bitrates, for temporal layers 0 and 1. - int tl0_bitrate_kbps; - int tl1_bitrate_kbps; - - static ScreenshareLayerConfig GetDefault(); - - // Parse bitrate from group name on format "(tl0_bitrate)-(tl1_bitrate)", - // eg. "100-1000" for the default rates. - static bool FromFieldTrialGroup(const std::string& group, - ScreenshareLayerConfig* config); -}; - -// TODO(pthatcher): Write unit tests just for these functions, -// independent of WebrtcVideoEngine. - -int GetTotalMaxBitrateBps(const std::vector& streams); - -// Get the ssrcs of the SIM group from the stream params. -void GetSimulcastSsrcs(const StreamParams& sp, std::vector* ssrcs); - -// Get simulcast settings. -std::vector GetSimulcastConfig(size_t max_streams, - int width, - int height, - int max_bitrate_bps, - int max_qp, - int max_framerate); - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_SIMULCAST_H_ diff --git a/include/talk/media/webrtc/webrtccommon.h b/include/talk/media/webrtc/webrtccommon.h deleted file mode 100644 index c83f29d..0000000 --- a/include/talk/media/webrtc/webrtccommon.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTCCOMMON_H_ -#define TALK_MEDIA_WEBRTCCOMMON_H_ - -#include "webrtc/common_types.h" - -namespace cricket { - -// Tracing helpers, for easy logging when WebRTC calls fail. -// Example: "LOG_RTCERR1(StartSend, channel);" produces the trace -// "StartSend(1) failed, err=XXXX" -// The method GetLastEngineError must be defined in the calling scope. -#define LOG_RTCERR0(func) \ - LOG_RTCERR0_EX(func, GetLastEngineError()) -#define LOG_RTCERR1(func, a1) \ - LOG_RTCERR1_EX(func, a1, GetLastEngineError()) -#define LOG_RTCERR2(func, a1, a2) \ - LOG_RTCERR2_EX(func, a1, a2, GetLastEngineError()) -#define LOG_RTCERR3(func, a1, a2, a3) \ - LOG_RTCERR3_EX(func, a1, a2, a3, GetLastEngineError()) -#define LOG_RTCERR4(func, a1, a2, a3, a4) \ - LOG_RTCERR4_EX(func, a1, a2, a3, a4, GetLastEngineError()) -#define LOG_RTCERR5(func, a1, a2, a3, a4, a5) \ - LOG_RTCERR5_EX(func, a1, a2, a3, a4, a5, GetLastEngineError()) -#define LOG_RTCERR6(func, a1, a2, a3, a4, a5, a6) \ - LOG_RTCERR6_EX(func, a1, a2, a3, a4, a5, a6, GetLastEngineError()) -#define LOG_RTCERR0_EX(func, err) LOG(LS_WARNING) \ - << "" << #func << "() failed, err=" << err -#define LOG_RTCERR1_EX(func, a1, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ") failed, err=" << err -#define LOG_RTCERR2_EX(func, a1, a2, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ") failed, err=" \ - << err -#define LOG_RTCERR3_EX(func, a1, a2, a3, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ") failed, err=" << err -#define LOG_RTCERR4_EX(func, a1, a2, a3, a4, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ", " << a4 << ") failed, err=" << err -#define LOG_RTCERR5_EX(func, a1, a2, a3, a4, a5, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ", " << a4 << ", " << a5 << ") failed, err=" << err -#define LOG_RTCERR6_EX(func, a1, a2, a3, a4, a5, a6, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ", " << a4 << ", " << a5 << ", " << a6 << ") failed, err=" << err - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTCCOMMON_H_ diff --git a/include/talk/media/webrtc/webrtcmediaengine.h b/include/talk/media/webrtc/webrtcmediaengine.h deleted file mode 100644 index 831d072..0000000 --- a/include/talk/media/webrtc/webrtcmediaengine.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTCMEDIAENGINE_H_ -#define TALK_MEDIA_WEBRTCMEDIAENGINE_H_ - -#include -#include - -#include "talk/media/base/mediaengine.h" -#include "webrtc/config.h" - -namespace webrtc { -class AudioDeviceModule; -} -namespace cricket { -class WebRtcVideoDecoderFactory; -class WebRtcVideoEncoderFactory; -} - -namespace cricket { - -class WebRtcMediaEngineFactory { - public: - static MediaEngineInterface* Create( - webrtc::AudioDeviceModule* adm, - WebRtcVideoEncoderFactory* encoder_factory, - WebRtcVideoDecoderFactory* decoder_factory); -}; - -// Verify that extension IDs are within 1-byte extension range and are not -// overlapping. -bool ValidateRtpExtensions(const std::vector& extensions); - -// Convert cricket::RtpHeaderExtension:s to webrtc::RtpExtension:s, discarding -// any extensions not validated by the 'supported' predicate. Duplicate -// extensions are removed if 'filter_redundant_extensions' is set, and also any -// mutually exclusive extensions (see implementation for details). -std::vector FilterRtpExtensions( - const std::vector& extensions, - bool (*supported)(const std::string&), - bool filter_redundant_extensions); - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTCMEDIAENGINE_H_ diff --git a/include/talk/media/webrtc/webrtcvideocapturer.h b/include/talk/media/webrtc/webrtcvideocapturer.h deleted file mode 100644 index 591e46f..0000000 --- a/include/talk/media/webrtc/webrtcvideocapturer.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTCVIDEOCAPTURER_H_ -#define TALK_MEDIA_WEBRTCVIDEOCAPTURER_H_ - -#ifdef HAVE_WEBRTC_VIDEO - -#include -#include - -#include "talk/media/base/videocapturer.h" -#include "talk/media/webrtc/webrtcvideoframe.h" -#include "webrtc/base/asyncinvoker.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" -#include "webrtc/modules/video_capture/video_capture.h" - -namespace cricket { - -// Factory to allow injection of a VCM impl into WebRtcVideoCapturer. -// DeviceInfos do not have a Release() and therefore need an explicit Destroy(). -class WebRtcVcmFactoryInterface { - public: - virtual ~WebRtcVcmFactoryInterface() {} - virtual webrtc::VideoCaptureModule* Create( - int id, const char* device) = 0; - virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo(int id) = 0; - virtual void DestroyDeviceInfo( - webrtc::VideoCaptureModule::DeviceInfo* info) = 0; -}; - -// WebRTC-based implementation of VideoCapturer. -class WebRtcVideoCapturer : public VideoCapturer, - public webrtc::VideoCaptureDataCallback { - public: - WebRtcVideoCapturer(); - explicit WebRtcVideoCapturer(WebRtcVcmFactoryInterface* factory); - virtual ~WebRtcVideoCapturer(); - - bool Init(const Device& device); - bool Init(webrtc::VideoCaptureModule* module); - - // Override virtual methods of the parent class VideoCapturer. - virtual bool GetBestCaptureFormat(const VideoFormat& desired, - VideoFormat* best_format); - virtual CaptureState Start(const VideoFormat& capture_format); - virtual void Stop(); - virtual bool IsRunning(); - virtual bool IsScreencast() const { return false; } - virtual bool SetApplyRotation(bool enable); - - protected: - // Override virtual methods of the parent class VideoCapturer. - virtual bool GetPreferredFourccs(std::vector* fourccs); - - private: - // Callback when a frame is captured by camera. - virtual void OnIncomingCapturedFrame(const int32_t id, - const webrtc::VideoFrame& frame); - virtual void OnCaptureDelayChanged(const int32_t id, - const int32_t delay); - - // Used to signal captured frames on the same thread as invoked Start(). - // With WebRTC's current VideoCapturer implementations, this will mean a - // thread hop, but in other implementations (e.g. Chrome) it will be called - // directly from OnIncomingCapturedFrame. - // TODO(tommi): Remove this workaround when we've updated the WebRTC capturers - // to follow the same contract. - void SignalFrameCapturedOnStartThread(const webrtc::VideoFrame& frame); - - rtc::scoped_ptr factory_; - webrtc::VideoCaptureModule* module_; - int captured_frames_; - std::vector capture_buffer_; - rtc::Thread* start_thread_; // Set in Start(), unset in Stop(); - - rtc::scoped_ptr async_invoker_; -}; - -struct WebRtcCapturedFrame : public CapturedFrame { - public: - WebRtcCapturedFrame(const webrtc::VideoFrame& frame, - void* buffer, - size_t length); -}; - -} // namespace cricket - -#endif // HAVE_WEBRTC_VIDEO -#endif // TALK_MEDIA_WEBRTCVIDEOCAPTURER_H_ diff --git a/include/talk/media/webrtc/webrtcvideocapturerfactory.h b/include/talk/media/webrtc/webrtcvideocapturerfactory.h deleted file mode 100755 index 0f7b622..0000000 --- a/include/talk/media/webrtc/webrtcvideocapturerfactory.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// TODO(pthatcher): Rename file to match class name. -#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEOCAPTURERFACTORY_H_ -#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOCAPTURERFACTORY_H_ - -#include "talk/media/base/videocapturerfactory.h" - -namespace cricket { - -// Creates instances of cricket::WebRtcVideoCapturer. -class WebRtcVideoDeviceCapturerFactory : public VideoDeviceCapturerFactory { - public: - virtual VideoCapturer* Create(const Device& device); -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOCAPTURERFACTORY_H_ diff --git a/include/talk/media/webrtc/webrtcvideochannelfactory.h b/include/talk/media/webrtc/webrtcvideochannelfactory.h deleted file mode 100644 index 646348c..0000000 --- a/include/talk/media/webrtc/webrtcvideochannelfactory.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEOCHANNEL_H_ -#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOCHANNEL_H_ - -namespace cricket { -class VoiceMediaChannel; -class WebRtcVideoEngine2; -class WebRtcVideoChannel2; - -class WebRtcVideoChannelFactory { - public: - virtual ~WebRtcVideoChannelFactory() {} - virtual WebRtcVideoChannel2* Create(WebRtcVideoEngine2* engine, - VoiceMediaChannel* voice_channel) = 0; -}; -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOCHANNEL_H_ diff --git a/include/talk/media/webrtc/webrtcvideodecoderfactory.h b/include/talk/media/webrtc/webrtcvideodecoderfactory.h deleted file mode 100644 index 6055a23..0000000 --- a/include/talk/media/webrtc/webrtcvideodecoderfactory.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEODECODERFACTORY_H_ -#define TALK_MEDIA_WEBRTC_WEBRTCVIDEODECODERFACTORY_H_ - -#include "webrtc/base/refcount.h" -#include "webrtc/common_types.h" - -namespace webrtc { -class VideoDecoder; -} - -namespace cricket { - -class WebRtcVideoDecoderFactory { - public: - // Caller takes the ownership of the returned object and it should be released - // by calling DestroyVideoDecoder(). - virtual webrtc::VideoDecoder* CreateVideoDecoder( - webrtc::VideoCodecType type) = 0; - virtual ~WebRtcVideoDecoderFactory() {} - - virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) = 0; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEODECODERFACTORY_H_ diff --git a/include/talk/media/webrtc/webrtcvideoencoderfactory.h b/include/talk/media/webrtc/webrtcvideoencoderfactory.h deleted file mode 100644 index ad681fe..0000000 --- a/include/talk/media/webrtc/webrtcvideoencoderfactory.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEOENCODERFACTORY_H_ -#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOENCODERFACTORY_H_ - -#include "talk/media/base/codec.h" -#include "webrtc/base/refcount.h" -#include "webrtc/common_types.h" - -namespace webrtc { -class VideoEncoder; -} - -namespace cricket { - -class WebRtcVideoEncoderFactory { - public: - struct VideoCodec { - webrtc::VideoCodecType type; - std::string name; - int max_width; - int max_height; - int max_fps; - - VideoCodec(webrtc::VideoCodecType t, const std::string& nm, int w, int h, - int fr) - : type(t), name(nm), max_width(w), max_height(h), max_fps(fr) { - } - }; - - virtual ~WebRtcVideoEncoderFactory() {} - - // Caller takes the ownership of the returned object and it should be released - // by calling DestroyVideoEncoder(). - virtual webrtc::VideoEncoder* CreateVideoEncoder( - webrtc::VideoCodecType type) = 0; - - // Returns a list of supported codecs in order of preference. - virtual const std::vector& codecs() const = 0; - - // Returns true if encoders created by this factory of the given codec type - // will use internal camera sources, meaning that they don't require/expect - // frames to be delivered via webrtc::VideoEncoder::Encode. This flag is used - // as the internal_source parameter to - // webrtc::ViEExternalCodec::RegisterExternalSendCodec. - virtual bool EncoderTypeHasInternalSource(webrtc::VideoCodecType type) const { - return false; - } - - virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) = 0; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENCODERFACTORY_H_ diff --git a/include/talk/media/webrtc/webrtcvideoengine2.h b/include/talk/media/webrtc/webrtcvideoengine2.h deleted file mode 100644 index 1b8da16..0000000 --- a/include/talk/media/webrtc/webrtcvideoengine2.h +++ /dev/null @@ -1,538 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ -#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ - -#include -#include -#include - -#include "talk/media/base/mediaengine.h" -#include "talk/media/webrtc/webrtcvideochannelfactory.h" -#include "talk/media/webrtc/webrtcvideodecoderfactory.h" -#include "talk/media/webrtc/webrtcvideoencoderfactory.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/thread_annotations.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/call.h" -#include "webrtc/transport.h" -#include "webrtc/video_frame.h" -#include "webrtc/video_receive_stream.h" -#include "webrtc/video_renderer.h" -#include "webrtc/video_send_stream.h" - -namespace webrtc { -class VideoDecoder; -class VideoEncoder; -} - -namespace rtc { -class Thread; -} // namespace rtc - -namespace cricket { - -class VideoCapturer; -class VideoFrame; -class VideoProcessor; -class VideoRenderer; -class VoiceMediaChannel; -class WebRtcDecoderObserver; -class WebRtcEncoderObserver; -class WebRtcLocalStreamInfo; -class WebRtcRenderAdapter; -class WebRtcVideoChannelRecvInfo; -class WebRtcVideoChannelSendInfo; -class WebRtcVoiceEngine; -class WebRtcVoiceMediaChannel; - -struct CapturedFrame; -struct Device; - -// Exposed here for unittests. -std::vector DefaultVideoCodecList(); - -class UnsignalledSsrcHandler { - public: - enum Action { - kDropPacket, - kDeliverPacket, - }; - virtual Action OnUnsignalledSsrc(WebRtcVideoChannel2* channel, - uint32_t ssrc) = 0; -}; - -// TODO(pbos): Remove, use external handlers only. -class DefaultUnsignalledSsrcHandler : public UnsignalledSsrcHandler { - public: - DefaultUnsignalledSsrcHandler(); - Action OnUnsignalledSsrc(WebRtcVideoChannel2* channel, - uint32_t ssrc) override; - - VideoRenderer* GetDefaultRenderer() const; - void SetDefaultRenderer(VideoMediaChannel* channel, VideoRenderer* renderer); - - private: - uint32_t default_recv_ssrc_; - VideoRenderer* default_renderer_; -}; - -// WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667). -class WebRtcVideoEngine2 { - public: - WebRtcVideoEngine2(); - ~WebRtcVideoEngine2(); - - // Basic video engine implementation. - void Init(); - - WebRtcVideoChannel2* CreateChannel(webrtc::Call* call, - const VideoOptions& options); - - const std::vector& codecs() const; - RtpCapabilities GetCapabilities() const; - - // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does - // not take the ownership of |decoder_factory|. The caller needs to make sure - // that |decoder_factory| outlives the video engine. - void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory); - // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does - // not take the ownership of |encoder_factory|. The caller needs to make sure - // that |encoder_factory| outlives the video engine. - virtual void SetExternalEncoderFactory( - WebRtcVideoEncoderFactory* encoder_factory); - - bool EnableTimedRender(); - - bool FindCodec(const VideoCodec& in); - // Check whether the supplied trace should be ignored. - bool ShouldIgnoreTrace(const std::string& trace); - - private: - std::vector GetSupportedCodecs() const; - - std::vector video_codecs_; - - bool initialized_; - - WebRtcVideoDecoderFactory* external_decoder_factory_; - WebRtcVideoEncoderFactory* external_encoder_factory_; - rtc::scoped_ptr simulcast_encoder_factory_; -}; - -class WebRtcVideoChannel2 : public rtc::MessageHandler, - public VideoMediaChannel, - public webrtc::Transport, - public webrtc::LoadObserver { - public: - WebRtcVideoChannel2(webrtc::Call* call, - const VideoOptions& options, - const std::vector& recv_codecs, - WebRtcVideoEncoderFactory* external_encoder_factory, - WebRtcVideoDecoderFactory* external_decoder_factory); - ~WebRtcVideoChannel2() override; - - // VideoMediaChannel implementation - bool SetSendParameters(const VideoSendParameters& params) override; - bool SetRecvParameters(const VideoRecvParameters& params) override; - bool GetSendCodec(VideoCodec* send_codec) override; - bool SetSendStreamFormat(uint32_t ssrc, const VideoFormat& format) override; - bool SetSend(bool send) override; - bool SetVideoSend(uint32_t ssrc, - bool mute, - const VideoOptions* options) override; - bool AddSendStream(const StreamParams& sp) override; - bool RemoveSendStream(uint32_t ssrc) override; - bool AddRecvStream(const StreamParams& sp) override; - bool AddRecvStream(const StreamParams& sp, bool default_stream); - bool RemoveRecvStream(uint32_t ssrc) override; - bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer) override; - bool GetStats(VideoMediaInfo* info) override; - bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; - bool SendIntraFrame() override; - bool RequestIntraFrame() override; - - void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) override; - void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) override; - void OnReadyToSend(bool ready) override; - void SetInterface(NetworkInterface* iface) override; - void UpdateAspectRatio(int ratio_w, int ratio_h) override; - - void OnMessage(rtc::Message* msg) override; - - void OnLoadUpdate(Load load) override; - - // Implemented for VideoMediaChannelTest. - bool sending() const { return sending_; } - uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } - bool GetRenderer(uint32_t ssrc, VideoRenderer** renderer); - - private: - bool MuteStream(uint32_t ssrc, bool mute); - class WebRtcVideoReceiveStream; - - bool SetSendCodecs(const std::vector& codecs); - bool SetSendRtpHeaderExtensions( - const std::vector& extensions); - bool SetMaxSendBandwidth(int bps); - bool SetOptions(const VideoOptions& options); - bool SetRecvCodecs(const std::vector& codecs); - bool SetRecvRtpHeaderExtensions( - const std::vector& extensions); - - void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, - const StreamParams& sp) const; - bool CodecIsExternallySupported(const std::string& name) const; - bool ValidateSendSsrcAvailability(const StreamParams& sp) const - EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); - bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const - EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); - void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) - EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); - - struct VideoCodecSettings { - VideoCodecSettings(); - - bool operator==(const VideoCodecSettings& other) const; - bool operator!=(const VideoCodecSettings& other) const; - - VideoCodec codec; - webrtc::FecConfig fec; - int rtx_payload_type; - }; - - static std::string CodecSettingsVectorToString( - const std::vector& codecs); - - // Wrapper for the sender part, this is where the capturer is connected and - // frames are then converted from cricket frames to webrtc frames. - class WebRtcVideoSendStream : public sigslot::has_slots<> { - public: - WebRtcVideoSendStream( - webrtc::Call* call, - const StreamParams& sp, - const webrtc::VideoSendStream::Config& config, - WebRtcVideoEncoderFactory* external_encoder_factory, - const VideoOptions& options, - int max_bitrate_bps, - const rtc::Optional& codec_settings, - const std::vector& rtp_extensions, - const VideoSendParameters& send_params); - ~WebRtcVideoSendStream(); - - void SetOptions(const VideoOptions& options); - void SetCodec(const VideoCodecSettings& codec); - void SetRtpExtensions( - const std::vector& rtp_extensions); - // TODO(deadbeef): Move logic from SetCodec/SetRtpExtensions/etc. - // into this method. Currently this method only sets the RTCP mode. - void SetSendParameters(const VideoSendParameters& send_params); - - void InputFrame(VideoCapturer* capturer, const VideoFrame* frame); - bool SetCapturer(VideoCapturer* capturer); - bool SetVideoFormat(const VideoFormat& format); - void MuteStream(bool mute); - bool DisconnectCapturer(); - - void SetApplyRotation(bool apply_rotation); - - void Start(); - void Stop(); - - const std::vector& GetSsrcs() const; - VideoSenderInfo GetVideoSenderInfo(); - void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); - - void SetMaxBitrateBps(int max_bitrate_bps); - - private: - // Parameters needed to reconstruct the underlying stream. - // webrtc::VideoSendStream doesn't support setting a lot of options on the - // fly, so when those need to be changed we tear down and reconstruct with - // similar parameters depending on which options changed etc. - struct VideoSendStreamParameters { - VideoSendStreamParameters( - const webrtc::VideoSendStream::Config& config, - const VideoOptions& options, - int max_bitrate_bps, - const rtc::Optional& codec_settings); - webrtc::VideoSendStream::Config config; - VideoOptions options; - int max_bitrate_bps; - rtc::Optional codec_settings; - // Sent resolutions + bitrates etc. by the underlying VideoSendStream, - // typically changes when setting a new resolution or reconfiguring - // bitrates. - webrtc::VideoEncoderConfig encoder_config; - }; - - struct AllocatedEncoder { - AllocatedEncoder(webrtc::VideoEncoder* encoder, - webrtc::VideoCodecType type, - bool external); - webrtc::VideoEncoder* encoder; - webrtc::VideoEncoder* external_encoder; - webrtc::VideoCodecType type; - bool external; - }; - - struct Dimensions { - // Initial encoder configuration (QCIF, 176x144) frame (to ensure that - // hardware encoders can be initialized). This gives us low memory usage - // but also makes it so configuration errors are discovered at the time we - // apply the settings rather than when we get the first frame (waiting for - // the first frame to know that you gave a bad codec parameter could make - // debugging hard). - // TODO(pbos): Consider setting up encoders lazily. - Dimensions() : width(176), height(144), is_screencast(false) {} - int width; - int height; - bool is_screencast; - }; - - union VideoEncoderSettings { - webrtc::VideoCodecVP8 vp8; - webrtc::VideoCodecVP9 vp9; - }; - - static std::vector CreateVideoStreams( - const VideoCodec& codec, - const VideoOptions& options, - int max_bitrate_bps, - size_t num_streams); - static std::vector CreateSimulcastVideoStreams( - const VideoCodec& codec, - const VideoOptions& options, - int max_bitrate_bps, - size_t num_streams); - - void* ConfigureVideoEncoderSettings(const VideoCodec& codec, - const VideoOptions& options, - bool is_screencast) - EXCLUSIVE_LOCKS_REQUIRED(lock_); - - AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec) - EXCLUSIVE_LOCKS_REQUIRED(lock_); - void DestroyVideoEncoder(AllocatedEncoder* encoder) - EXCLUSIVE_LOCKS_REQUIRED(lock_); - void SetCodecAndOptions(const VideoCodecSettings& codec, - const VideoOptions& options) - EXCLUSIVE_LOCKS_REQUIRED(lock_); - void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); - webrtc::VideoEncoderConfig CreateVideoEncoderConfig( - const Dimensions& dimensions, - const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); - void SetDimensions(int width, int height, bool is_screencast) - EXCLUSIVE_LOCKS_REQUIRED(lock_); - - const std::vector ssrcs_; - const std::vector ssrc_groups_; - webrtc::Call* const call_; - WebRtcVideoEncoderFactory* const external_encoder_factory_ - GUARDED_BY(lock_); - - rtc::CriticalSection lock_; - webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); - VideoSendStreamParameters parameters_ GUARDED_BY(lock_); - VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); - AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); - Dimensions last_dimensions_ GUARDED_BY(lock_); - - VideoCapturer* capturer_ GUARDED_BY(lock_); - bool sending_ GUARDED_BY(lock_); - bool muted_ GUARDED_BY(lock_); - VideoFormat format_ GUARDED_BY(lock_); - int old_adapt_changes_ GUARDED_BY(lock_); - - // The timestamp of the first frame received - // Used to generate the timestamps of subsequent frames - int64_t first_frame_timestamp_ms_ GUARDED_BY(lock_); - - // The timestamp of the last frame received - // Used to generate timestamp for the black frame when capturer is removed - int64_t last_frame_timestamp_ms_ GUARDED_BY(lock_); - }; - - // Wrapper for the receiver part, contains configs etc. that are needed to - // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper - // between webrtc::VideoRenderer and cricket::VideoRenderer. - class WebRtcVideoReceiveStream : public webrtc::VideoRenderer { - public: - WebRtcVideoReceiveStream( - webrtc::Call* call, - const StreamParams& sp, - const webrtc::VideoReceiveStream::Config& config, - WebRtcVideoDecoderFactory* external_decoder_factory, - bool default_stream, - const std::vector& recv_codecs, - bool disable_prerenderer_smoothing); - ~WebRtcVideoReceiveStream(); - - const std::vector& GetSsrcs() const; - - void SetLocalSsrc(uint32_t local_ssrc); - void SetFeedbackParameters(bool nack_enabled, - bool remb_enabled, - bool transport_cc_enabled); - void SetRecvCodecs(const std::vector& recv_codecs); - void SetRtpExtensions(const std::vector& extensions); - // TODO(deadbeef): Move logic from SetRecvCodecs/SetRtpExtensions/etc. - // into this method. Currently this method only sets the RTCP mode. - void SetRecvParameters(const VideoRecvParameters& recv_params); - - void RenderFrame(const webrtc::VideoFrame& frame, - int time_to_render_ms) override; - bool IsTextureSupported() const override; - bool SmoothsRenderedFrames() const override; - bool IsDefaultStream() const; - - void SetRenderer(cricket::VideoRenderer* renderer); - cricket::VideoRenderer* GetRenderer(); - - VideoReceiverInfo GetVideoReceiverInfo(); - - private: - struct AllocatedDecoder { - AllocatedDecoder(webrtc::VideoDecoder* decoder, - webrtc::VideoCodecType type, - bool external); - webrtc::VideoDecoder* decoder; - // Decoder wrapped into a fallback decoder to permit software fallback. - webrtc::VideoDecoder* external_decoder; - webrtc::VideoCodecType type; - bool external; - }; - - void SetSize(int width, int height); - void RecreateWebRtcStream(); - - AllocatedDecoder CreateOrReuseVideoDecoder( - std::vector* old_decoder, - const VideoCodec& codec); - void ClearDecoders(std::vector* allocated_decoders); - - std::string GetCodecNameFromPayloadType(int payload_type); - - webrtc::Call* const call_; - const std::vector ssrcs_; - const std::vector ssrc_groups_; - - webrtc::VideoReceiveStream* stream_; - const bool default_stream_; - webrtc::VideoReceiveStream::Config config_; - - WebRtcVideoDecoderFactory* const external_decoder_factory_; - std::vector allocated_decoders_; - - const bool disable_prerenderer_smoothing_; - - rtc::CriticalSection renderer_lock_; - cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_); - int last_width_ GUARDED_BY(renderer_lock_); - int last_height_ GUARDED_BY(renderer_lock_); - // Expands remote RTP timestamps to int64_t to be able to estimate how long - // the stream has been running. - rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ - GUARDED_BY(renderer_lock_); - int64_t first_frame_timestamp_ GUARDED_BY(renderer_lock_); - // Start NTP time is estimated as current remote NTP time (estimated from - // RTCP) minus the elapsed time, as soon as remote NTP time is available. - int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(renderer_lock_); - }; - - void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); - void SetDefaultOptions(); - - bool SendRtp(const uint8_t* data, - size_t len, - const webrtc::PacketOptions& options) override; - bool SendRtcp(const uint8_t* data, size_t len) override; - - void StartAllSendStreams(); - void StopAllSendStreams(); - - static std::vector MapCodecs( - const std::vector& codecs); - std::vector FilterSupportedCodecs( - const std::vector& mapped_codecs) const; - static bool ReceiveCodecsHaveChanged(std::vector before, - std::vector after); - - void FillSenderStats(VideoMediaInfo* info); - void FillReceiverStats(VideoMediaInfo* info); - void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats, - VideoMediaInfo* info); - - rtc::ThreadChecker thread_checker_; - - uint32_t rtcp_receiver_report_ssrc_; - bool sending_; - webrtc::Call* const call_; - - uint32_t default_send_ssrc_; - - DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; - UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; - - // Separate list of set capturers used to signal CPU adaptation. These should - // not be locked while calling methods that take other locks to prevent - // lock-order inversions. - rtc::CriticalSection capturer_crit_; - bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); - std::map capturers_ GUARDED_BY(capturer_crit_); - - rtc::CriticalSection stream_crit_; - // Using primary-ssrc (first ssrc) as key. - std::map send_streams_ - GUARDED_BY(stream_crit_); - std::map receive_streams_ - GUARDED_BY(stream_crit_); - std::set send_ssrcs_ GUARDED_BY(stream_crit_); - std::set receive_ssrcs_ GUARDED_BY(stream_crit_); - - rtc::Optional send_codec_; - std::vector send_rtp_extensions_; - - WebRtcVideoEncoderFactory* const external_encoder_factory_; - WebRtcVideoDecoderFactory* const external_decoder_factory_; - std::vector recv_codecs_; - std::vector recv_rtp_extensions_; - webrtc::Call::Config::BitrateConfig bitrate_config_; - VideoOptions options_; - // TODO(deadbeef): Don't duplicate information between - // send_params/recv_params, rtp_extensions, options, etc. - VideoSendParameters send_params_; - VideoRecvParameters recv_params_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ diff --git a/include/talk/media/webrtc/webrtcvideoframe.h b/include/talk/media/webrtc/webrtcvideoframe.h deleted file mode 100644 index 827cf28..0000000 --- a/include/talk/media/webrtc/webrtcvideoframe.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTCVIDEOFRAME_H_ -#define TALK_MEDIA_WEBRTCVIDEOFRAME_H_ - -#include "talk/media/base/videoframe.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/common_types.h" -#include "webrtc/common_video/include/video_frame_buffer.h" - -namespace cricket { - -struct CapturedFrame; - -class WebRtcVideoFrame : public VideoFrame { - public: - WebRtcVideoFrame(); - WebRtcVideoFrame(const rtc::scoped_refptr& buffer, - int64_t time_stamp_ns, - webrtc::VideoRotation rotation); - - ~WebRtcVideoFrame(); - - // Creates a frame from a raw sample with FourCC "format" and size "w" x "h". - // "h" can be negative indicating a vertically flipped image. - // "dh" is destination height if cropping is desired and is always positive. - // Returns "true" if successful. - bool Init(uint32_t format, - int w, - int h, - int dw, - int dh, - uint8_t* sample, - size_t sample_size, - size_t pixel_width, - size_t pixel_height, - int64_t time_stamp_ns, - webrtc::VideoRotation rotation); - - bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); - - void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, - int64_t time_stamp_ns); - - bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, - int64_t time_stamp_ns) override; - - // From base class VideoFrame. - bool Reset(uint32_t format, - int w, - int h, - int dw, - int dh, - uint8_t* sample, - size_t sample_size, - size_t pixel_width, - size_t pixel_height, - int64_t time_stamp_ns, - webrtc::VideoRotation rotation, - bool apply_rotation) override; - - size_t GetWidth() const override; - size_t GetHeight() const override; - const uint8_t* GetYPlane() const override; - const uint8_t* GetUPlane() const override; - const uint8_t* GetVPlane() const override; - uint8_t* GetYPlane() override; - uint8_t* GetUPlane() override; - uint8_t* GetVPlane() override; - int32_t GetYPitch() const override; - int32_t GetUPitch() const override; - int32_t GetVPitch() const override; - void* GetNativeHandle() const override; - rtc::scoped_refptr GetVideoFrameBuffer() - const override; - - size_t GetPixelWidth() const override { return pixel_width_; } - size_t GetPixelHeight() const override { return pixel_height_; } - int64_t GetTimeStamp() const override { return time_stamp_ns_; } - void SetTimeStamp(int64_t time_stamp_ns) override { - time_stamp_ns_ = time_stamp_ns; - } - - webrtc::VideoRotation GetVideoRotation() const override { - return rotation_; - } - - VideoFrame* Copy() const override; - bool IsExclusive() const override; - bool MakeExclusive() override; - size_t ConvertToRgbBuffer(uint32_t to_fourcc, - uint8_t* buffer, - size_t size, - int stride_rgb) const override; - - const VideoFrame* GetCopyWithRotationApplied() const override; - - protected: - void SetRotation(webrtc::VideoRotation rotation) override { - rotation_ = rotation; - } - - private: - VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, - size_t pixel_height, - int64_t time_stamp_ns) const override; - - // An opaque reference counted handle that stores the pixel data. - rtc::scoped_refptr video_frame_buffer_; - size_t pixel_width_; - size_t pixel_height_; - int64_t time_stamp_ns_; - webrtc::VideoRotation rotation_; - - // This is mutable as the calculation is expensive but once calculated, it - // remains const. - mutable rtc::scoped_ptr rotated_frame_; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ diff --git a/include/talk/media/webrtc/webrtcvideoframefactory.h b/include/talk/media/webrtc/webrtcvideoframefactory.h deleted file mode 100644 index 5557a35..0000000 --- a/include/talk/media/webrtc/webrtcvideoframefactory.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEOFRAMEFACTORY_H_ -#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOFRAMEFACTORY_H_ - -#include "talk/media/base/videoframefactory.h" - -namespace cricket { - -struct CapturedFrame; - -// Creates instances of cricket::WebRtcVideoFrame. -class WebRtcVideoFrameFactory : public VideoFrameFactory { - public: - VideoFrame* CreateAliasedFrame(const CapturedFrame* aliased_frame, - int width, - int height) const override; -}; - -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOFRAMEFACTORY_H_ diff --git a/include/talk/media/webrtc/webrtcvoe.h b/include/talk/media/webrtc/webrtcvoe.h deleted file mode 100644 index aa705a0..0000000 --- a/include/talk/media/webrtc/webrtcvoe.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTCVOE_H_ -#define TALK_MEDIA_WEBRTCVOE_H_ - -#include "talk/media/webrtc/webrtccommon.h" -#include "webrtc/base/common.h" - -#include "webrtc/common_types.h" -#include "webrtc/modules/audio_device/include/audio_device.h" -#include "webrtc/voice_engine/include/voe_audio_processing.h" -#include "webrtc/voice_engine/include/voe_base.h" -#include "webrtc/voice_engine/include/voe_codec.h" -#include "webrtc/voice_engine/include/voe_errors.h" -#include "webrtc/voice_engine/include/voe_hardware.h" -#include "webrtc/voice_engine/include/voe_network.h" -#include "webrtc/voice_engine/include/voe_rtp_rtcp.h" -#include "webrtc/voice_engine/include/voe_volume_control.h" - -namespace cricket { -// automatically handles lifetime of WebRtc VoiceEngine -class scoped_voe_engine { - public: - explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} - // VERIFY, to ensure that there are no leaks at shutdown - ~scoped_voe_engine() { if (ptr) VERIFY(webrtc::VoiceEngine::Delete(ptr)); } - // Releases the current pointer. - void reset() { - if (ptr) { - VERIFY(webrtc::VoiceEngine::Delete(ptr)); - ptr = NULL; - } - } - webrtc::VoiceEngine* get() const { return ptr; } - private: - webrtc::VoiceEngine* ptr; -}; - -// scoped_ptr class to handle obtaining and releasing WebRTC interface pointers -template -class scoped_voe_ptr { - public: - explicit scoped_voe_ptr(const scoped_voe_engine& e) - : ptr(T::GetInterface(e.get())) {} - explicit scoped_voe_ptr(T* p) : ptr(p) {} - ~scoped_voe_ptr() { if (ptr) ptr->Release(); } - T* operator->() const { return ptr; } - T* get() const { return ptr; } - - // Releases the current pointer. - void reset() { - if (ptr) { - ptr->Release(); - ptr = NULL; - } - } - - private: - T* ptr; -}; - -// Utility class for aggregating the various WebRTC interface. -// Fake implementations can also be injected for testing. -class VoEWrapper { - public: - VoEWrapper() - : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), - base_(engine_), codec_(engine_), - hw_(engine_), network_(engine_), - rtp_(engine_), volume_(engine_) { - } - VoEWrapper(webrtc::VoEAudioProcessing* processing, - webrtc::VoEBase* base, - webrtc::VoECodec* codec, - webrtc::VoEHardware* hw, - webrtc::VoENetwork* network, - webrtc::VoERTP_RTCP* rtp, - webrtc::VoEVolumeControl* volume) - : engine_(NULL), - processing_(processing), - base_(base), - codec_(codec), - hw_(hw), - network_(network), - rtp_(rtp), - volume_(volume) { - } - ~VoEWrapper() {} - webrtc::VoiceEngine* engine() const { return engine_.get(); } - webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } - webrtc::VoEBase* base() const { return base_.get(); } - webrtc::VoECodec* codec() const { return codec_.get(); } - webrtc::VoEHardware* hw() const { return hw_.get(); } - webrtc::VoENetwork* network() const { return network_.get(); } - webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } - webrtc::VoEVolumeControl* volume() const { return volume_.get(); } - int error() { return base_->LastError(); } - - private: - scoped_voe_engine engine_; - scoped_voe_ptr processing_; - scoped_voe_ptr base_; - scoped_voe_ptr codec_; - scoped_voe_ptr hw_; - scoped_voe_ptr network_; - scoped_voe_ptr rtp_; - scoped_voe_ptr volume_; -}; -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTCVOE_H_ diff --git a/include/talk/media/webrtc/webrtcvoiceengine.h b/include/talk/media/webrtc/webrtcvoiceengine.h deleted file mode 100644 index 0f2f59e..0000000 --- a/include/talk/media/webrtc/webrtcvoiceengine.h +++ /dev/null @@ -1,289 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_MEDIA_WEBRTCVOICEENGINE_H_ -#define TALK_MEDIA_WEBRTCVOICEENGINE_H_ - -#include -#include -#include - -#include "talk/media/base/rtputils.h" -#include "talk/media/webrtc/webrtccommon.h" -#include "talk/media/webrtc/webrtcvoe.h" -#include "talk/session/media/channel.h" -#include "webrtc/audio_state.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/stream.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/call.h" -#include "webrtc/common.h" -#include "webrtc/config.h" - -namespace cricket { - -class AudioDeviceModule; -class AudioRenderer; -class VoEWrapper; -class WebRtcVoiceMediaChannel; - -// WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. -// It uses the WebRtc VoiceEngine library for audio handling. -class WebRtcVoiceEngine final : public webrtc::TraceCallback { - friend class WebRtcVoiceMediaChannel; - public: - // Exposed for the WVoE/MC unit test. - static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out); - - WebRtcVoiceEngine(); - // Dependency injection for testing. - explicit WebRtcVoiceEngine(VoEWrapper* voe_wrapper); - ~WebRtcVoiceEngine(); - bool Init(rtc::Thread* worker_thread); - void Terminate(); - - rtc::scoped_refptr GetAudioState() const; - VoiceMediaChannel* CreateChannel(webrtc::Call* call, - const AudioOptions& options); - - bool GetOutputVolume(int* level); - bool SetOutputVolume(int level); - int GetInputLevel(); - - const std::vector& codecs(); - RtpCapabilities GetCapabilities() const; - - // For tracking WebRtc channels. Needed because we have to pause them - // all when switching devices. - // May only be called by WebRtcVoiceMediaChannel. - void RegisterChannel(WebRtcVoiceMediaChannel* channel); - void UnregisterChannel(WebRtcVoiceMediaChannel* channel); - - // Called by WebRtcVoiceMediaChannel to set a gain offset from - // the default AGC target level. - bool AdjustAgcLevel(int delta); - - VoEWrapper* voe() { return voe_wrapper_.get(); } - int GetLastEngineError(); - - // Set the external ADM. This can only be called before Init. - bool SetAudioDeviceModule(webrtc::AudioDeviceModule* adm); - - // Starts AEC dump using existing file. - bool StartAecDump(rtc::PlatformFile file); - - // Stops AEC dump. - void StopAecDump(); - - // Starts recording an RtcEventLog using an existing file until 10 minutes - // pass or the StopRtcEventLog function is called. - bool StartRtcEventLog(rtc::PlatformFile file); - - // Stops recording the RtcEventLog. - void StopRtcEventLog(); - - private: - void Construct(); - bool InitInternal(); - // Every option that is "set" will be applied. Every option not "set" will be - // ignored. This allows us to selectively turn on and off different options - // easily at any time. - bool ApplyOptions(const AudioOptions& options); - void SetDefaultDevices(); - - // webrtc::TraceCallback: - void Print(webrtc::TraceLevel level, const char* trace, int length) override; - - void StartAecDump(const std::string& filename); - int CreateVoEChannel(); - - rtc::ThreadChecker signal_thread_checker_; - rtc::ThreadChecker worker_thread_checker_; - - // The primary instance of WebRtc VoiceEngine. - rtc::scoped_ptr voe_wrapper_; - rtc::scoped_refptr audio_state_; - // The external audio device manager - webrtc::AudioDeviceModule* adm_ = nullptr; - std::vector codecs_; - std::vector channels_; - webrtc::Config voe_config_; - bool initialized_ = false; - bool is_dumping_aec_ = false; - - webrtc::AgcConfig default_agc_config_; - // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns - // values, and apply them in case they are missing in the audio options. We - // need to do this because SetExtraOptions() will revert to defaults for - // options which are not provided. - rtc::Optional extended_filter_aec_; - rtc::Optional delay_agnostic_aec_; - rtc::Optional experimental_ns_; - - RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcVoiceEngine); -}; - -// WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses -// WebRtc Voice Engine. -class WebRtcVoiceMediaChannel final : public VoiceMediaChannel, - public webrtc::Transport { - public: - WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, - const AudioOptions& options, - webrtc::Call* call); - ~WebRtcVoiceMediaChannel() override; - - const AudioOptions& options() const { return options_; } - - bool SetSendParameters(const AudioSendParameters& params) override; - bool SetRecvParameters(const AudioRecvParameters& params) override; - bool SetPlayout(bool playout) override; - bool PausePlayout(); - bool ResumePlayout(); - bool SetSend(SendFlags send) override; - bool PauseSend(); - bool ResumeSend(); - bool SetAudioSend(uint32_t ssrc, - bool enable, - const AudioOptions* options, - AudioRenderer* renderer) override; - bool AddSendStream(const StreamParams& sp) override; - bool RemoveSendStream(uint32_t ssrc) override; - bool AddRecvStream(const StreamParams& sp) override; - bool RemoveRecvStream(uint32_t ssrc) override; - bool GetActiveStreams(AudioInfo::StreamList* actives) override; - int GetOutputLevel() override; - int GetTimeSinceLastTyping() override; - void SetTypingDetectionParameters(int time_window, - int cost_per_typing, - int reporting_threshold, - int penalty_decay, - int type_event_delay) override; - bool SetOutputVolume(uint32_t ssrc, double volume) override; - - bool CanInsertDtmf() override; - bool InsertDtmf(uint32_t ssrc, int event, int duration) override; - - void OnPacketReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) override; - void OnRtcpReceived(rtc::Buffer* packet, - const rtc::PacketTime& packet_time) override; - void OnReadyToSend(bool ready) override {} - bool GetStats(VoiceMediaInfo* info) override; - - void SetRawAudioSink( - uint32_t ssrc, - rtc::scoped_ptr sink) override; - - // implements Transport interface - bool SendRtp(const uint8_t* data, - size_t len, - const webrtc::PacketOptions& options) override { - rtc::Buffer packet(reinterpret_cast(data), len, - kMaxRtpPacketLen); - rtc::PacketOptions rtc_options; - rtc_options.packet_id = options.packet_id; - return VoiceMediaChannel::SendPacket(&packet, rtc_options); - } - - bool SendRtcp(const uint8_t* data, size_t len) override { - rtc::Buffer packet(reinterpret_cast(data), len, - kMaxRtpPacketLen); - return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions()); - } - - int GetReceiveChannelId(uint32_t ssrc) const; - int GetSendChannelId(uint32_t ssrc) const; - - private: - bool SetSendCodecs(const std::vector& codecs); - bool SetOptions(const AudioOptions& options); - bool SetMaxSendBandwidth(int bps); - bool SetRecvCodecs(const std::vector& codecs); - bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); - bool MuteStream(uint32_t ssrc, bool mute); - - WebRtcVoiceEngine* engine() { return engine_; } - int GetLastEngineError() { return engine()->GetLastEngineError(); } - int GetOutputLevel(int channel); - bool GetRedSendCodec(const AudioCodec& red_codec, - const std::vector& all_codecs, - webrtc::CodecInst* send_codec); - bool SetPlayout(int channel, bool playout); - void SetNack(int channel, bool nack_enabled); - bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); - bool ChangePlayout(bool playout); - bool ChangeSend(SendFlags send); - bool ChangeSend(int channel, SendFlags send); - int CreateVoEChannel(); - bool DeleteVoEChannel(int channel); - bool IsDefaultRecvStream(uint32_t ssrc) { - return default_recv_ssrc_ == static_cast(ssrc); - } - bool SetSendCodecs(int channel, const std::vector& codecs); - bool SetSendBitrateInternal(int bps); - - rtc::ThreadChecker worker_thread_checker_; - - WebRtcVoiceEngine* const engine_ = nullptr; - std::vector recv_codecs_; - std::vector send_codecs_; - rtc::scoped_ptr send_codec_; - bool send_bitrate_setting_ = false; - int send_bitrate_bps_ = 0; - AudioOptions options_; - rtc::Optional dtmf_payload_type_; - bool desired_playout_ = false; - bool nack_enabled_ = false; - bool playout_ = false; - SendFlags desired_send_ = SEND_NOTHING; - SendFlags send_ = SEND_NOTHING; - webrtc::Call* const call_ = nullptr; - - // SSRC of unsignalled receive stream, or -1 if there isn't one. - int64_t default_recv_ssrc_ = -1; - // Volume for unsignalled stream, which may be set before the stream exists. - double default_recv_volume_ = 1.0; - // Default SSRC to use for RTCP receiver reports in case of no signaled - // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 - // and https://code.google.com/p/chromium/issues/detail?id=547661 - uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; - - class WebRtcAudioSendStream; - std::map send_streams_; - std::vector send_rtp_extensions_; - - class WebRtcAudioReceiveStream; - std::map recv_streams_; - std::vector recv_rtp_extensions_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); -}; -} // namespace cricket - -#endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ diff --git a/include/talk/session/media/audiomonitor.h b/include/talk/session/media/audiomonitor.h deleted file mode 100644 index 3723419..0000000 --- a/include/talk/session/media/audiomonitor.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_AUDIOMONITOR_H_ -#define TALK_SESSION_MEDIA_AUDIOMONITOR_H_ - -#include -#include "webrtc/p2p/base/port.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -class VoiceChannel; - -struct AudioInfo { - int input_level; - int output_level; - typedef std::vector > StreamList; - StreamList active_streams; // ssrcs contributing to output_level -}; - -class AudioMonitor : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - AudioMonitor(VoiceChannel* voice_channel, rtc::Thread *monitor_thread); - ~AudioMonitor(); - - void Start(int cms); - void Stop(); - - VoiceChannel* voice_channel(); - rtc::Thread *monitor_thread(); - - sigslot::signal2 SignalUpdate; - - protected: - void OnMessage(rtc::Message *message); - void PollVoiceChannel(); - - AudioInfo audio_info_; - VoiceChannel* voice_channel_; - rtc::Thread* monitoring_thread_; - rtc::CriticalSection crit_; - uint32_t rate_; - bool monitoring_; -}; - -} - -#endif // TALK_SESSION_MEDIA_AUDIOMONITOR_H_ diff --git a/include/talk/session/media/bundlefilter.h b/include/talk/session/media/bundlefilter.h deleted file mode 100755 index d9d952f..0000000 --- a/include/talk/session/media/bundlefilter.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_BUNDLEFILTER_H_ -#define TALK_SESSION_MEDIA_BUNDLEFILTER_H_ - -#include - -#include -#include - -#include "talk/media/base/streamparams.h" -#include "webrtc/base/basictypes.h" - -namespace cricket { - -// In case of single RTP session and single transport channel, all session -// (or media) channels share a common transport channel. Hence they all get -// SignalReadPacket when packet received on transport channel. This requires -// cricket::BaseChannel to know all the valid sources, else media channel -// will decode invalid packets. -// -// This class determines whether a packet is destined for cricket::BaseChannel. -// This is only to be used for RTP packets as RTCP packets are not filtered. -// For RTP packets, this is decided based on the payload type. -class BundleFilter { - public: - BundleFilter(); - ~BundleFilter(); - - // Determines if a RTP packet belongs to valid cricket::BaseChannel. - bool DemuxPacket(const uint8_t* data, size_t len); - - // Adds the supported payload type. - void AddPayloadType(int payload_type); - - // Public for unittests. - bool FindPayloadType(int pl_type) const; - void ClearAllPayloadTypes(); - - private: - std::set payload_types_; -}; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_BUNDLEFILTER_H_ diff --git a/include/talk/session/media/channel.h b/include/talk/session/media/channel.h deleted file mode 100644 index 3a8550c..0000000 --- a/include/talk/session/media/channel.h +++ /dev/null @@ -1,656 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_CHANNEL_H_ -#define TALK_SESSION_MEDIA_CHANNEL_H_ - -#include -#include -#include -#include -#include - -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/mediaengine.h" -#include "talk/media/base/streamparams.h" -#include "talk/media/base/videocapturer.h" -#include "talk/session/media/audiomonitor.h" -#include "talk/session/media/bundlefilter.h" -#include "talk/session/media/mediamonitor.h" -#include "talk/session/media/mediasession.h" -#include "talk/session/media/rtcpmuxfilter.h" -#include "talk/session/media/srtpfilter.h" -#include "webrtc/audio/audio_sink.h" -#include "webrtc/base/asyncudpsocket.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/network.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/window.h" -#include "webrtc/p2p/base/transportcontroller.h" -#include "webrtc/p2p/client/socketmonitor.h" - -namespace webrtc { -class AudioSinkInterface; -} // namespace webrtc - -namespace cricket { - -struct CryptoParams; -class MediaContentDescription; -struct ViewRequest; - -enum SinkType { - SINK_PRE_CRYPTO, // Sink packets before encryption or after decryption. - SINK_POST_CRYPTO // Sink packets after encryption or before decryption. -}; - -// BaseChannel contains logic common to voice and video, including -// enable, marshaling calls to a worker thread, and -// connection and media monitors. -// -// WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! -// This is required to avoid a data race between the destructor modifying the -// vtable, and the media channel's thread using BaseChannel as the -// NetworkInterface. - -class BaseChannel - : public rtc::MessageHandler, public sigslot::has_slots<>, - public MediaChannel::NetworkInterface, - public ConnectionStatsGetter { - public: - BaseChannel(rtc::Thread* thread, - MediaChannel* channel, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp); - virtual ~BaseChannel(); - bool Init(); - // Deinit may be called multiple times and is simply ignored if it's alreay - // done. - void Deinit(); - - rtc::Thread* worker_thread() const { return worker_thread_; } - const std::string& content_name() const { return content_name_; } - const std::string& transport_name() const { return transport_name_; } - TransportChannel* transport_channel() const { - return transport_channel_; - } - TransportChannel* rtcp_transport_channel() const { - return rtcp_transport_channel_; - } - bool enabled() const { return enabled_; } - - // This function returns true if we are using SRTP. - bool secure() const { return srtp_filter_.IsActive(); } - // The following function returns true if we are using - // DTLS-based keying. If you turned off SRTP later, however - // you could have secure() == false and dtls_secure() == true. - bool secure_dtls() const { return dtls_keyed_; } - // This function returns true if we require secure channel for call setup. - bool secure_required() const { return secure_required_; } - - bool writable() const { return writable_; } - - // Activate RTCP mux, regardless of the state so far. Once - // activated, it can not be deactivated, and if the remote - // description doesn't support RTCP mux, setting the remote - // description will fail. - void ActivateRtcpMux(); - bool SetTransport(const std::string& transport_name); - bool PushdownLocalDescription(const SessionDescription* local_desc, - ContentAction action, - std::string* error_desc); - bool PushdownRemoteDescription(const SessionDescription* remote_desc, - ContentAction action, - std::string* error_desc); - // Channel control - bool SetLocalContent(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - bool SetRemoteContent(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - - bool Enable(bool enable); - - // Multiplexing - bool AddRecvStream(const StreamParams& sp); - bool RemoveRecvStream(uint32_t ssrc); - bool AddSendStream(const StreamParams& sp); - bool RemoveSendStream(uint32_t ssrc); - - // Monitoring - void StartConnectionMonitor(int cms); - void StopConnectionMonitor(); - // For ConnectionStatsGetter, used by ConnectionMonitor - bool GetConnectionStats(ConnectionInfos* infos) override; - - BundleFilter* bundle_filter() { return &bundle_filter_; } - - const std::vector& local_streams() const { - return local_streams_; - } - const std::vector& remote_streams() const { - return remote_streams_; - } - - sigslot::signal2 SignalDtlsSetupFailure; - void SignalDtlsSetupFailure_w(bool rtcp); - void SignalDtlsSetupFailure_s(bool rtcp); - - // Used for latency measurements. - sigslot::signal1 SignalFirstPacketReceived; - - // Made public for easier testing. - void SetReadyToSend(bool rtcp, bool ready); - - // Only public for unit tests. Otherwise, consider protected. - int SetOption(SocketType type, rtc::Socket::Option o, int val) - override; - - SrtpFilter* srtp_filter() { return &srtp_filter_; } - - protected: - virtual MediaChannel* media_channel() const { return media_channel_; } - // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is - // true). Gets the transport channels from |transport_controller_|. - bool SetTransport_w(const std::string& transport_name); - - void set_transport_channel(TransportChannel* transport); - void set_rtcp_transport_channel(TransportChannel* transport, - bool update_writablity); - - bool was_ever_writable() const { return was_ever_writable_; } - void set_local_content_direction(MediaContentDirection direction) { - local_content_direction_ = direction; - } - void set_remote_content_direction(MediaContentDirection direction) { - remote_content_direction_ = direction; - } - void set_secure_required(bool secure_required) { - secure_required_ = secure_required; - } - bool IsReadyToReceive() const; - bool IsReadyToSend() const; - rtc::Thread* signaling_thread() { - return transport_controller_->signaling_thread(); - } - bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; } - - void ConnectToTransportChannel(TransportChannel* tc); - void DisconnectFromTransportChannel(TransportChannel* tc); - - void FlushRtcpMessages(); - - // NetworkInterface implementation, called by MediaEngine - bool SendPacket(rtc::Buffer* packet, - const rtc::PacketOptions& options) override; - bool SendRtcp(rtc::Buffer* packet, const rtc::PacketOptions& options) - override; - - // From TransportChannel - void OnWritableState(TransportChannel* channel); - virtual void OnChannelRead(TransportChannel* channel, - const char* data, - size_t len, - const rtc::PacketTime& packet_time, - int flags); - void OnReadyToSend(TransportChannel* channel); - - void OnDtlsState(TransportChannel* channel, DtlsTransportState state); - - bool PacketIsRtcp(const TransportChannel* channel, const char* data, - size_t len); - bool SendPacket(bool rtcp, - rtc::Buffer* packet, - const rtc::PacketOptions& options); - virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); - void HandlePacket(bool rtcp, rtc::Buffer* packet, - const rtc::PacketTime& packet_time); - - void EnableMedia_w(); - void DisableMedia_w(); - void UpdateWritableState_w(); - void ChannelWritable_w(); - void ChannelNotWritable_w(); - bool AddRecvStream_w(const StreamParams& sp); - bool RemoveRecvStream_w(uint32_t ssrc); - bool AddSendStream_w(const StreamParams& sp); - bool RemoveSendStream_w(uint32_t ssrc); - virtual bool ShouldSetupDtlsSrtp() const; - // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. - // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. - bool SetupDtlsSrtp(bool rtcp_channel); - void MaybeSetupDtlsSrtp_w(); - // Set the DTLS-SRTP cipher policy on this channel as appropriate. - bool SetDtlsSrtpCryptoSuites(TransportChannel* tc, bool rtcp); - - virtual void ChangeState() = 0; - - // Gets the content info appropriate to the channel (audio or video). - virtual const ContentInfo* GetFirstContent( - const SessionDescription* sdesc) = 0; - bool UpdateLocalStreams_w(const std::vector& streams, - ContentAction action, - std::string* error_desc); - bool UpdateRemoteStreams_w(const std::vector& streams, - ContentAction action, - std::string* error_desc); - virtual bool SetLocalContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc) = 0; - virtual bool SetRemoteContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc) = 0; - bool SetRtpTransportParameters_w(const MediaContentDescription* content, - ContentAction action, - ContentSource src, - std::string* error_desc); - - // Helper method to get RTP Absoulute SendTime extension header id if - // present in remote supported extensions list. - void MaybeCacheRtpAbsSendTimeHeaderExtension( - const std::vector& extensions); - - bool CheckSrtpConfig(const std::vector& cryptos, - bool* dtls, - std::string* error_desc); - bool SetSrtp_w(const std::vector& params, - ContentAction action, - ContentSource src, - std::string* error_desc); - void ActivateRtcpMux_w(); - bool SetRtcpMux_w(bool enable, - ContentAction action, - ContentSource src, - std::string* error_desc); - - // From MessageHandler - void OnMessage(rtc::Message* pmsg) override; - - // Handled in derived classes - // Get the SRTP crypto suites to use for RTP media - virtual void GetSrtpCryptoSuites(std::vector* crypto_suites) const = 0; - virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, - const std::vector& infos) = 0; - - // Helper function for invoking bool-returning methods on the worker thread. - template - bool InvokeOnWorker(const FunctorT& functor) { - return worker_thread_->Invoke(functor); - } - - private: - rtc::Thread* worker_thread_; - TransportController* transport_controller_; - MediaChannel* media_channel_; - std::vector local_streams_; - std::vector remote_streams_; - - const std::string content_name_; - std::string transport_name_; - bool rtcp_transport_enabled_; - TransportChannel* transport_channel_; - std::vector > socket_options_; - TransportChannel* rtcp_transport_channel_; - std::vector > rtcp_socket_options_; - SrtpFilter srtp_filter_; - RtcpMuxFilter rtcp_mux_filter_; - BundleFilter bundle_filter_; - rtc::scoped_ptr connection_monitor_; - bool enabled_; - bool writable_; - bool rtp_ready_to_send_; - bool rtcp_ready_to_send_; - bool was_ever_writable_; - MediaContentDirection local_content_direction_; - MediaContentDirection remote_content_direction_; - bool has_received_packet_; - bool dtls_keyed_; - bool secure_required_; - int rtp_abs_sendtime_extn_id_; -}; - -// VoiceChannel is a specialization that adds support for early media, DTMF, -// and input/output level monitoring. -class VoiceChannel : public BaseChannel { - public: - VoiceChannel(rtc::Thread* thread, - MediaEngineInterface* media_engine, - VoiceMediaChannel* channel, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp); - ~VoiceChannel(); - bool Init(); - - // Configure sending media on the stream with SSRC |ssrc| - // If there is only one sending stream SSRC 0 can be used. - bool SetAudioSend(uint32_t ssrc, - bool enable, - const AudioOptions* options, - AudioRenderer* renderer); - - // downcasts a MediaChannel - virtual VoiceMediaChannel* media_channel() const { - return static_cast(BaseChannel::media_channel()); - } - - void SetEarlyMedia(bool enable); - // This signal is emitted when we have gone a period of time without - // receiving early media. When received, a UI should start playing its - // own ringing sound - sigslot::signal1 SignalEarlyMediaTimeout; - - // Returns if the telephone-event has been negotiated. - bool CanInsertDtmf(); - // Send and/or play a DTMF |event| according to the |flags|. - // The DTMF out-of-band signal will be used on sending. - // The |ssrc| should be either 0 or a valid send stream ssrc. - // The valid value for the |event| are 0 which corresponding to DTMF - // event 0-9, *, #, A-D. - bool InsertDtmf(uint32_t ssrc, int event_code, int duration); - bool SetOutputVolume(uint32_t ssrc, double volume); - void SetRawAudioSink(uint32_t ssrc, - rtc::scoped_ptr sink); - - // Get statistics about the current media session. - bool GetStats(VoiceMediaInfo* stats); - - // Monitoring functions - sigslot::signal2&> - SignalConnectionMonitor; - - void StartMediaMonitor(int cms); - void StopMediaMonitor(); - sigslot::signal2 SignalMediaMonitor; - - void StartAudioMonitor(int cms); - void StopAudioMonitor(); - bool IsAudioMonitorRunning() const; - sigslot::signal2 SignalAudioMonitor; - - int GetInputLevel_w(); - int GetOutputLevel_w(); - void GetActiveStreams_w(AudioInfo::StreamList* actives); - - private: - // overrides from BaseChannel - virtual void OnChannelRead(TransportChannel* channel, - const char* data, size_t len, - const rtc::PacketTime& packet_time, - int flags); - virtual void ChangeState(); - virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); - virtual bool SetLocalContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - virtual bool SetRemoteContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - void HandleEarlyMediaTimeout(); - bool InsertDtmf_w(uint32_t ssrc, int event, int duration); - bool SetOutputVolume_w(uint32_t ssrc, double volume); - bool GetStats_w(VoiceMediaInfo* stats); - - virtual void OnMessage(rtc::Message* pmsg); - virtual void GetSrtpCryptoSuites(std::vector* crypto_suites) const; - virtual void OnConnectionMonitorUpdate( - ConnectionMonitor* monitor, const std::vector& infos); - virtual void OnMediaMonitorUpdate( - VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); - void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); - - static const int kEarlyMediaTimeout = 1000; - MediaEngineInterface* media_engine_; - bool received_media_; - rtc::scoped_ptr media_monitor_; - rtc::scoped_ptr audio_monitor_; - - // Last AudioSendParameters sent down to the media_channel() via - // SetSendParameters. - AudioSendParameters last_send_params_; - // Last AudioRecvParameters sent down to the media_channel() via - // SetRecvParameters. - AudioRecvParameters last_recv_params_; -}; - -// VideoChannel is a specialization for video. -class VideoChannel : public BaseChannel { - public: - VideoChannel(rtc::Thread* thread, - VideoMediaChannel* channel, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp); - ~VideoChannel(); - bool Init(); - - // downcasts a MediaChannel - virtual VideoMediaChannel* media_channel() const { - return static_cast(BaseChannel::media_channel()); - } - - bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer); - bool ApplyViewRequest(const ViewRequest& request); - - // TODO(pthatcher): Refactor to use a "capture id" instead of an - // ssrc here as the "key". - // Passes ownership of the capturer to the channel. - bool AddScreencast(uint32_t ssrc, VideoCapturer* capturer); - bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer); - bool RemoveScreencast(uint32_t ssrc); - // True if we've added a screencast. Doesn't matter if the capturer - // has been started or not. - bool IsScreencasting(); - int GetScreencastFps(uint32_t ssrc); - int GetScreencastMaxPixels(uint32_t ssrc); - // Get statistics about the current media session. - bool GetStats(VideoMediaInfo* stats); - - sigslot::signal2&> - SignalConnectionMonitor; - - void StartMediaMonitor(int cms); - void StopMediaMonitor(); - sigslot::signal2 SignalMediaMonitor; - sigslot::signal2 SignalScreencastWindowEvent; - - bool SendIntraFrame(); - bool RequestIntraFrame(); - - bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); - - private: - typedef std::map ScreencastMap; - struct ScreencastDetailsData; - - // overrides from BaseChannel - virtual void ChangeState(); - virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); - virtual bool SetLocalContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - virtual bool SetRemoteContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - bool ApplyViewRequest_w(const ViewRequest& request); - - bool AddScreencast_w(uint32_t ssrc, VideoCapturer* capturer); - bool RemoveScreencast_w(uint32_t ssrc); - void OnScreencastWindowEvent_s(uint32_t ssrc, rtc::WindowEvent we); - bool IsScreencasting_w() const; - void GetScreencastDetails_w(ScreencastDetailsData* d) const; - bool GetStats_w(VideoMediaInfo* stats); - - virtual void OnMessage(rtc::Message* pmsg); - virtual void GetSrtpCryptoSuites(std::vector* crypto_suites) const; - virtual void OnConnectionMonitorUpdate( - ConnectionMonitor* monitor, const std::vector& infos); - virtual void OnMediaMonitorUpdate( - VideoMediaChannel* media_channel, const VideoMediaInfo& info); - virtual void OnScreencastWindowEvent(uint32_t ssrc, rtc::WindowEvent event); - virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); - bool GetLocalSsrc(const VideoCapturer* capturer, uint32_t* ssrc); - - VideoRenderer* renderer_; - ScreencastMap screencast_capturers_; - rtc::scoped_ptr media_monitor_; - - rtc::WindowEvent previous_we_; - - // Last VideoSendParameters sent down to the media_channel() via - // SetSendParameters. - VideoSendParameters last_send_params_; - // Last VideoRecvParameters sent down to the media_channel() via - // SetRecvParameters. - VideoRecvParameters last_recv_params_; -}; - -// DataChannel is a specialization for data. -class DataChannel : public BaseChannel { - public: - DataChannel(rtc::Thread* thread, - DataMediaChannel* media_channel, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp); - ~DataChannel(); - bool Init(); - - virtual bool SendData(const SendDataParams& params, - const rtc::Buffer& payload, - SendDataResult* result); - - void StartMediaMonitor(int cms); - void StopMediaMonitor(); - - // Should be called on the signaling thread only. - bool ready_to_send_data() const { - return ready_to_send_data_; - } - - sigslot::signal2 SignalMediaMonitor; - sigslot::signal2&> - SignalConnectionMonitor; - sigslot::signal3 - SignalDataReceived; - // Signal for notifying when the channel becomes ready to send data. - // That occurs when the channel is enabled, the transport is writable, - // both local and remote descriptions are set, and the channel is unblocked. - sigslot::signal1 SignalReadyToSendData; - // Signal for notifying that the remote side has closed the DataChannel. - sigslot::signal1 SignalStreamClosedRemotely; - - protected: - // downcasts a MediaChannel. - virtual DataMediaChannel* media_channel() const { - return static_cast(BaseChannel::media_channel()); - } - - private: - struct SendDataMessageData : public rtc::MessageData { - SendDataMessageData(const SendDataParams& params, - const rtc::Buffer* payload, - SendDataResult* result) - : params(params), - payload(payload), - result(result), - succeeded(false) { - } - - const SendDataParams& params; - const rtc::Buffer* payload; - SendDataResult* result; - bool succeeded; - }; - - struct DataReceivedMessageData : public rtc::MessageData { - // We copy the data because the data will become invalid after we - // handle DataMediaChannel::SignalDataReceived but before we fire - // SignalDataReceived. - DataReceivedMessageData( - const ReceiveDataParams& params, const char* data, size_t len) - : params(params), - payload(data, len) { - } - const ReceiveDataParams params; - const rtc::Buffer payload; - }; - - typedef rtc::TypedMessageData DataChannelReadyToSendMessageData; - - // overrides from BaseChannel - virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); - // If data_channel_type_ is DCT_NONE, set it. Otherwise, check that - // it's the same as what was set previously. Returns false if it's - // set to one type one type and changed to another type later. - bool SetDataChannelType(DataChannelType new_data_channel_type, - std::string* error_desc); - // Same as SetDataChannelType, but extracts the type from the - // DataContentDescription. - bool SetDataChannelTypeFromContent(const DataContentDescription* content, - std::string* error_desc); - virtual bool SetLocalContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - virtual bool SetRemoteContent_w(const MediaContentDescription* content, - ContentAction action, - std::string* error_desc); - virtual void ChangeState(); - virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); - - virtual void OnMessage(rtc::Message* pmsg); - virtual void GetSrtpCryptoSuites(std::vector* crypto_suites) const; - virtual void OnConnectionMonitorUpdate( - ConnectionMonitor* monitor, const std::vector& infos); - virtual void OnMediaMonitorUpdate( - DataMediaChannel* media_channel, const DataMediaInfo& info); - virtual bool ShouldSetupDtlsSrtp() const; - void OnDataReceived( - const ReceiveDataParams& params, const char* data, size_t len); - void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error); - void OnDataChannelReadyToSend(bool writable); - void OnStreamClosedRemotely(uint32_t sid); - - rtc::scoped_ptr media_monitor_; - // TODO(pthatcher): Make a separate SctpDataChannel and - // RtpDataChannel instead of using this. - DataChannelType data_channel_type_; - bool ready_to_send_data_; - - // Last DataSendParameters sent down to the media_channel() via - // SetSendParameters. - DataSendParameters last_send_params_; - // Last DataRecvParameters sent down to the media_channel() via - // SetRecvParameters. - DataRecvParameters last_recv_params_; -}; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_CHANNEL_H_ diff --git a/include/talk/session/media/channelmanager.h b/include/talk/session/media/channelmanager.h deleted file mode 100644 index 2bc516b..0000000 --- a/include/talk/session/media/channelmanager.h +++ /dev/null @@ -1,238 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_CHANNELMANAGER_H_ -#define TALK_SESSION_MEDIA_CHANNELMANAGER_H_ - -#include -#include - -#include "talk/media/base/capturemanager.h" -#include "talk/media/base/mediaengine.h" -#include "talk/session/media/voicechannel.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/fileutils.h" -#include "webrtc/base/sigslotrepeater.h" -#include "webrtc/base/thread.h" - -namespace webrtc { -class MediaControllerInterface; -} -namespace cricket { - -class VoiceChannel; - -// ChannelManager allows the MediaEngine to run on a separate thread, and takes -// care of marshalling calls between threads. It also creates and keeps track of -// voice and video channels; by doing so, it can temporarily pause all the -// channels when a new audio or video device is chosen. The voice and video -// channels are stored in separate vectors, to easily allow operations on just -// voice or just video channels. -// ChannelManager also allows the application to discover what devices it has -// using device manager. -class ChannelManager : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - // For testing purposes. Allows the media engine and data media - // engine and dev manager to be mocks. The ChannelManager takes - // ownership of these objects. - ChannelManager(MediaEngineInterface* me, - DataEngineInterface* dme, - CaptureManager* cm, - rtc::Thread* worker); - // Same as above, but gives an easier default DataEngine. - ChannelManager(MediaEngineInterface* me, - rtc::Thread* worker); - ~ChannelManager(); - - // Accessors for the worker thread, allowing it to be set after construction, - // but before Init. set_worker_thread will return false if called after Init. - rtc::Thread* worker_thread() const { return worker_thread_; } - bool set_worker_thread(rtc::Thread* thread) { - if (initialized_) return false; - worker_thread_ = thread; - return true; - } - - MediaEngineInterface* media_engine() { return media_engine_.get(); } - - // Retrieves the list of supported audio & video codec types. - // Can be called before starting the media engine. - void GetSupportedAudioCodecs(std::vector* codecs) const; - void GetSupportedAudioRtpHeaderExtensions(RtpHeaderExtensions* ext) const; - void GetSupportedVideoCodecs(std::vector* codecs) const; - void GetSupportedVideoRtpHeaderExtensions(RtpHeaderExtensions* ext) const; - void GetSupportedDataCodecs(std::vector* codecs) const; - - // Indicates whether the media engine is started. - bool initialized() const { return initialized_; } - // Starts up the media engine. - bool Init(); - // Shuts down the media engine. - void Terminate(); - - // The operations below all occur on the worker thread. - // Creates a voice channel, to be associated with the specified session. - VoiceChannel* CreateVoiceChannel( - webrtc::MediaControllerInterface* media_controller, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp, - const AudioOptions& options); - // Destroys a voice channel created with the Create API. - void DestroyVoiceChannel(VoiceChannel* voice_channel); - // Creates a video channel, synced with the specified voice channel, and - // associated with the specified session. - VideoChannel* CreateVideoChannel( - webrtc::MediaControllerInterface* media_controller, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp, - const VideoOptions& options); - // Destroys a video channel created with the Create API. - void DestroyVideoChannel(VideoChannel* video_channel); - DataChannel* CreateDataChannel(TransportController* transport_controller, - const std::string& content_name, - bool rtcp, - DataChannelType data_channel_type); - // Destroys a data channel created with the Create API. - void DestroyDataChannel(DataChannel* data_channel); - - // Indicates whether any channels exist. - bool has_channels() const { - return (!voice_channels_.empty() || !video_channels_.empty()); - } - - bool GetOutputVolume(int* level); - bool SetOutputVolume(int level); - // RTX will be enabled/disabled in engines that support it. The supporting - // engines will start offering an RTX codec. Must be called before Init(). - bool SetVideoRtxEnabled(bool enable); - - // Starts/stops the local microphone and enables polling of the input level. - bool capturing() const { return capturing_; } - - // Gets capturer's supported formats in a thread safe manner - std::vector GetSupportedFormats( - VideoCapturer* capturer) const; - // The following are done in the new "CaptureManager" style that - // all local video capturers, processors, and managers should move to. - // TODO(pthatcher): Make methods nicer by having start return a handle that - // can be used for stop and restart, rather than needing to pass around - // formats a a pseudo-handle. - bool StartVideoCapture(VideoCapturer* video_capturer, - const VideoFormat& video_format); - // When muting, produce black frames then pause the camera. - // When unmuting, start the camera. Camera starts unmuted. - bool MuteToBlackThenPause(VideoCapturer* video_capturer, bool muted); - bool StopVideoCapture(VideoCapturer* video_capturer, - const VideoFormat& video_format); - bool RestartVideoCapture(VideoCapturer* video_capturer, - const VideoFormat& previous_format, - const VideoFormat& desired_format, - CaptureManager::RestartOptions options); - - bool AddVideoRenderer(VideoCapturer* capturer, VideoRenderer* renderer); - bool RemoveVideoRenderer(VideoCapturer* capturer, VideoRenderer* renderer); - bool IsScreencastRunning() const; - - // The operations below occur on the main thread. - - // Starts AEC dump using existing file. - bool StartAecDump(rtc::PlatformFile file); - - // Stops recording AEC dump. - void StopAecDump(); - - // Starts RtcEventLog using existing file. - bool StartRtcEventLog(rtc::PlatformFile file); - - // Stops logging RtcEventLog. - void StopRtcEventLog(); - - sigslot::signal2 SignalVideoCaptureStateChange; - - private: - typedef std::vector VoiceChannels; - typedef std::vector VideoChannels; - typedef std::vector DataChannels; - - void Construct(MediaEngineInterface* me, - DataEngineInterface* dme, - CaptureManager* cm, - rtc::Thread* worker_thread); - bool InitMediaEngine_w(); - void DestructorDeletes_w(); - void Terminate_w(); - VoiceChannel* CreateVoiceChannel_w( - webrtc::MediaControllerInterface* media_controller, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp, - const AudioOptions& options); - void DestroyVoiceChannel_w(VoiceChannel* voice_channel); - VideoChannel* CreateVideoChannel_w( - webrtc::MediaControllerInterface* media_controller, - TransportController* transport_controller, - const std::string& content_name, - bool rtcp, - const VideoOptions& options); - void DestroyVideoChannel_w(VideoChannel* video_channel); - DataChannel* CreateDataChannel_w(TransportController* transport_controller, - const std::string& content_name, - bool rtcp, - DataChannelType data_channel_type); - void DestroyDataChannel_w(DataChannel* data_channel); - void OnVideoCaptureStateChange(VideoCapturer* capturer, - CaptureState result); - void GetSupportedFormats_w( - VideoCapturer* capturer, - std::vector* out_formats) const; - bool IsScreencastRunning_w() const; - virtual void OnMessage(rtc::Message *message); - - rtc::scoped_ptr media_engine_; - rtc::scoped_ptr data_media_engine_; - rtc::scoped_ptr capture_manager_; - bool initialized_; - rtc::Thread* main_thread_; - rtc::Thread* worker_thread_; - - VoiceChannels voice_channels_; - VideoChannels video_channels_; - DataChannels data_channels_; - - int audio_output_volume_; - VideoRenderer* local_renderer_; - bool enable_rtx_; - - bool capturing_; -}; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_CHANNELMANAGER_H_ diff --git a/include/talk/session/media/currentspeakermonitor.h b/include/talk/session/media/currentspeakermonitor.h deleted file mode 100644 index cef8b73..0000000 --- a/include/talk/session/media/currentspeakermonitor.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * libjingle - * Copyright 2011 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// CurrentSpeakerMonitor monitors the audio levels for a session and determines -// which participant is currently speaking. - -#ifndef TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ -#define TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/sigslot.h" - -namespace cricket { - -struct AudioInfo; -struct MediaStreams; - -class AudioSourceContext { - public: - sigslot::signal2 - SignalAudioMonitor; - sigslot::signal1 SignalMediaStreamsReset; - sigslot::signal3 SignalMediaStreamsUpdate; -}; - -// CurrentSpeakerMonitor can be used to monitor the audio-levels from -// many audio-sources and report on changes in the loudest audio-source. -// Its a generic type and relies on an AudioSourceContext which is aware of -// the audio-sources. AudioSourceContext needs to provide two signals namely -// SignalAudioInfoMonitor - provides audio info of the all current speakers. -// SignalMediaSourcesUpdated - provides updates when a speaker leaves or joins. -// Note that the AudioSourceContext's audio monitor must be started -// before this is started. -// It's recommended that the audio monitor be started with a 100 ms period. -class CurrentSpeakerMonitor : public sigslot::has_slots<> { - public: - CurrentSpeakerMonitor(AudioSourceContext* audio_source_context); - ~CurrentSpeakerMonitor(); - - void Start(); - void Stop(); - - // Used by tests. Note that the actual minimum time between switches - // enforced by the monitor will be the given value plus or minus the - // resolution of the system clock. - void set_min_time_between_switches(uint32_t min_time_between_switches); - - // This is fired when the current speaker changes, and provides his audio - // SSRC. This only fires after the audio monitor on the underlying - // AudioSourceContext has been started. - sigslot::signal2 SignalUpdate; - - private: - void OnAudioMonitor(AudioSourceContext* audio_source_context, - const AudioInfo& info); - void OnMediaStreamsUpdate(AudioSourceContext* audio_source_context, - const MediaStreams& added, - const MediaStreams& removed); - void OnMediaStreamsReset(AudioSourceContext* audio_source_context); - - // These are states that a participant will pass through so that we gradually - // recognize that they have started and stopped speaking. This avoids - // "twitchiness". - enum SpeakingState { - SS_NOT_SPEAKING, - SS_MIGHT_BE_SPEAKING, - SS_SPEAKING, - SS_WAS_SPEAKING_RECENTLY1, - SS_WAS_SPEAKING_RECENTLY2 - }; - - bool started_; - AudioSourceContext* audio_source_context_; - std::map ssrc_to_speaking_state_map_; - uint32_t current_speaker_ssrc_; - // To prevent overswitching, switching is disabled for some time after a - // switch is made. This gives us the earliest time a switch is permitted. - uint32_t earliest_permitted_switch_time_; - uint32_t min_time_between_switches_; -}; - -} - -#endif // TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ diff --git a/include/talk/session/media/externalhmac.h b/include/talk/session/media/externalhmac.h deleted file mode 100644 index 150a1bb..0000000 --- a/include/talk/session/media/externalhmac.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_EXTERNAL_HMAC_H_ -#define TALK_SESSION_MEDIA_EXTERNAL_HMAC_H_ - -// External libsrtp HMAC auth module which implements methods defined in -// auth_type_t. -// The default auth module will be replaced only when the ENABLE_EXTERNAL_AUTH -// flag is enabled. This allows us to access to authentication keys, -// as the default auth implementation doesn't provide access and avoids -// hashing each packet twice. - -// How will libsrtp select this module? -// Libsrtp defines authentication function types identified by an unsigned -// integer, e.g. HMAC_SHA1 is 3. Using authentication ids, the application -// can plug any desired authentication modules into libsrtp. -// libsrtp also provides a mechanism to select different auth functions for -// individual streams. This can be done by setting the right value in -// the auth_type of srtp_policy_t. The application must first register auth -// functions and the corresponding authentication id using -// crypto_kernel_replace_auth_type function. -#if defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) - -#include "webrtc/base/basictypes.h" -extern "C" { -#ifdef SRTP_RELATIVE_PATH -#include "auth.h" // NOLINT -#else -#include "third_party/libsrtp/srtp/crypto/include/auth.h" -#endif // SRTP_RELATIVE_PATH -} - -#define EXTERNAL_HMAC_SHA1 HMAC_SHA1 + 1 -#define HMAC_KEY_LENGTH 20 - -// The HMAC context structure used to store authentication keys. -// The pointer to the key will be allocated in the external_hmac_init function. -// This pointer is owned by srtp_t in a template context. -typedef struct { - uint8_t key[HMAC_KEY_LENGTH]; - int key_length; -} ExternalHmacContext; - -err_status_t external_hmac_alloc(auth_t** a, int key_len, int out_len); - -err_status_t external_hmac_dealloc(auth_t* a); - -err_status_t external_hmac_init(ExternalHmacContext* state, - const uint8_t* key, - int key_len); - -err_status_t external_hmac_start(ExternalHmacContext* state); - -err_status_t external_hmac_update(ExternalHmacContext* state, - const uint8_t* message, - int msg_octets); - -err_status_t external_hmac_compute(ExternalHmacContext* state, - const void* message, - int msg_octets, - int tag_len, - uint8_t* result); - -err_status_t external_crypto_init(); - -#endif // defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) -#endif // TALK_SESSION_MEDIA_EXTERNAL_HMAC_H_ diff --git a/include/talk/session/media/mediamonitor.h b/include/talk/session/media/mediamonitor.h deleted file mode 100644 index 445b379..0000000 --- a/include/talk/session/media/mediamonitor.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * libjingle - * Copyright 2005 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Class to collect statistics from a media channel - -#ifndef TALK_SESSION_MEDIA_MEDIAMONITOR_H_ -#define TALK_SESSION_MEDIA_MEDIAMONITOR_H_ - -#include "talk/media/base/mediachannel.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/thread_annotations.h" - -namespace cricket { - -// The base MediaMonitor class, independent of voice and video. -class MediaMonitor : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - MediaMonitor(rtc::Thread* worker_thread, - rtc::Thread* monitor_thread); - ~MediaMonitor(); - - void Start(uint32_t milliseconds); - void Stop(); - - protected: - void OnMessage(rtc::Message *message); - void PollMediaChannel(); - virtual void GetStats() = 0; - virtual void Update() = 0; - - rtc::CriticalSection crit_; - rtc::Thread* worker_thread_; - rtc::Thread* monitor_thread_; - bool monitoring_; - uint32_t rate_; -}; - -// Templatized MediaMonitor that can deal with different kinds of media. -template -class MediaMonitorT : public MediaMonitor { - public: - MediaMonitorT(MC* media_channel, rtc::Thread* worker_thread, - rtc::Thread* monitor_thread) - : MediaMonitor(worker_thread, monitor_thread), - media_channel_(media_channel) {} - sigslot::signal2 SignalUpdate; - - protected: - // These routines assume the crit_ lock is held by the calling thread. - virtual void GetStats() { - media_info_.Clear(); - media_channel_->GetStats(&media_info_); - } - virtual void Update() EXCLUSIVE_LOCKS_REQUIRED(crit_) { - MI stats(media_info_); - crit_.Leave(); - SignalUpdate(media_channel_, stats); - crit_.Enter(); - } - - private: - MC* media_channel_; - MI media_info_; -}; - -typedef MediaMonitorT VoiceMediaMonitor; -typedef MediaMonitorT VideoMediaMonitor; -typedef MediaMonitorT DataMediaMonitor; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_MEDIAMONITOR_H_ diff --git a/include/talk/session/media/mediasession.h b/include/talk/session/media/mediasession.h deleted file mode 100644 index 8a7f4cc..0000000 --- a/include/talk/session/media/mediasession.h +++ /dev/null @@ -1,561 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Types and classes used in media session descriptions. - -#ifndef TALK_SESSION_MEDIA_MEDIASESSION_H_ -#define TALK_SESSION_MEDIA_MEDIASESSION_H_ - -#include -#include -#include - -#include "talk/media/base/codec.h" -#include "talk/media/base/constants.h" -#include "talk/media/base/cryptoparams.h" -#include "talk/media/base/mediachannel.h" -#include "talk/media/base/mediaengine.h" // For DataChannelType -#include "talk/media/base/streamparams.h" -#include "webrtc/p2p/base/sessiondescription.h" -#include "webrtc/p2p/base/transport.h" -#include "webrtc/p2p/base/transportdescriptionfactory.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -class ChannelManager; -typedef std::vector AudioCodecs; -typedef std::vector VideoCodecs; -typedef std::vector DataCodecs; -typedef std::vector CryptoParamsVec; -typedef std::vector RtpHeaderExtensions; - -enum MediaType { - MEDIA_TYPE_AUDIO, - MEDIA_TYPE_VIDEO, - MEDIA_TYPE_DATA -}; - -std::string MediaTypeToString(MediaType type); - -enum MediaContentDirection { - MD_INACTIVE, - MD_SENDONLY, - MD_RECVONLY, - MD_SENDRECV -}; - -enum CryptoType { - CT_NONE, - CT_SDES, - CT_DTLS -}; - -// RTC4585 RTP/AVPF -extern const char kMediaProtocolAvpf[]; -// RFC5124 RTP/SAVPF -extern const char kMediaProtocolSavpf[]; - -extern const char kMediaProtocolDtlsSavpf[]; - -extern const char kMediaProtocolRtpPrefix[]; - -extern const char kMediaProtocolSctp[]; -extern const char kMediaProtocolDtlsSctp[]; -extern const char kMediaProtocolUdpDtlsSctp[]; -extern const char kMediaProtocolTcpDtlsSctp[]; - -// Options to control how session descriptions are generated. -const int kAutoBandwidth = -1; -const int kBufferedModeDisabled = 0; - -struct MediaSessionOptions { - MediaSessionOptions() : - recv_audio(true), - recv_video(false), - data_channel_type(DCT_NONE), - is_muc(false), - vad_enabled(true), // When disabled, removes all CN codecs from SDP. - rtcp_mux_enabled(true), - bundle_enabled(false), - video_bandwidth(kAutoBandwidth), - data_bandwidth(kDataMaxBandwidth) { - } - - bool has_audio() const { - return recv_audio || HasSendMediaStream(MEDIA_TYPE_AUDIO); - } - bool has_video() const { - return recv_video || HasSendMediaStream(MEDIA_TYPE_VIDEO); - } - bool has_data() const { return data_channel_type != DCT_NONE; } - - // Add a stream with MediaType type and id. - // All streams with the same sync_label will get the same CNAME. - // All ids must be unique. - void AddSendStream(MediaType type, - const std::string& id, - const std::string& sync_label); - void AddSendVideoStream(const std::string& id, - const std::string& sync_label, - int num_sim_layers); - void RemoveSendStream(MediaType type, const std::string& id); - - - // Helper function. - void AddSendStreamInternal(MediaType type, - const std::string& id, - const std::string& sync_label, - int num_sim_layers); - - bool HasSendMediaStream(MediaType type) const; - - bool recv_audio; - bool recv_video; - DataChannelType data_channel_type; - bool is_muc; - bool vad_enabled; - bool rtcp_mux_enabled; - bool bundle_enabled; - // bps. -1 == auto. - int video_bandwidth; - int data_bandwidth; - TransportOptions transport_options; - - struct Stream { - Stream(MediaType type, - const std::string& id, - const std::string& sync_label, - int num_sim_layers) - : type(type), id(id), sync_label(sync_label), - num_sim_layers(num_sim_layers) { - } - MediaType type; - std::string id; - std::string sync_label; - int num_sim_layers; - }; - - typedef std::vector Streams; - Streams streams; -}; - -// "content" (as used in XEP-0166) descriptions for voice and video. -class MediaContentDescription : public ContentDescription { - public: - MediaContentDescription() {} - - virtual MediaType type() const = 0; - virtual bool has_codecs() const = 0; - - // |protocol| is the expected media transport protocol, such as RTP/AVPF, - // RTP/SAVPF or SCTP/DTLS. - std::string protocol() const { return protocol_; } - void set_protocol(const std::string& protocol) { protocol_ = protocol; } - - MediaContentDirection direction() const { return direction_; } - void set_direction(MediaContentDirection direction) { - direction_ = direction; - } - - bool rtcp_mux() const { return rtcp_mux_; } - void set_rtcp_mux(bool mux) { rtcp_mux_ = mux; } - - bool rtcp_reduced_size() const { return rtcp_reduced_size_; } - void set_rtcp_reduced_size(bool reduced_size) { - rtcp_reduced_size_ = reduced_size; - } - - int bandwidth() const { return bandwidth_; } - void set_bandwidth(int bandwidth) { bandwidth_ = bandwidth; } - - const std::vector& cryptos() const { return cryptos_; } - void AddCrypto(const CryptoParams& params) { - cryptos_.push_back(params); - } - void set_cryptos(const std::vector& cryptos) { - cryptos_ = cryptos; - } - - CryptoType crypto_required() const { return crypto_required_; } - void set_crypto_required(CryptoType type) { - crypto_required_ = type; - } - - const RtpHeaderExtensions& rtp_header_extensions() const { - return rtp_header_extensions_; - } - void set_rtp_header_extensions(const RtpHeaderExtensions& extensions) { - rtp_header_extensions_ = extensions; - rtp_header_extensions_set_ = true; - } - void AddRtpHeaderExtension(const RtpHeaderExtension& ext) { - rtp_header_extensions_.push_back(ext); - rtp_header_extensions_set_ = true; - } - void ClearRtpHeaderExtensions() { - rtp_header_extensions_.clear(); - rtp_header_extensions_set_ = true; - } - // We can't always tell if an empty list of header extensions is - // because the other side doesn't support them, or just isn't hooked up to - // signal them. For now we assume an empty list means no signaling, but - // provide the ClearRtpHeaderExtensions method to allow "no support" to be - // clearly indicated (i.e. when derived from other information). - bool rtp_header_extensions_set() const { - return rtp_header_extensions_set_; - } - // True iff the client supports multiple streams. - void set_multistream(bool multistream) { multistream_ = multistream; } - bool multistream() const { return multistream_; } - const StreamParamsVec& streams() const { - return streams_; - } - // TODO(pthatcher): Remove this by giving mediamessage.cc access - // to MediaContentDescription - StreamParamsVec& mutable_streams() { - return streams_; - } - void AddStream(const StreamParams& stream) { - streams_.push_back(stream); - } - // Legacy streams have an ssrc, but nothing else. - void AddLegacyStream(uint32_t ssrc) { - streams_.push_back(StreamParams::CreateLegacy(ssrc)); - } - void AddLegacyStream(uint32_t ssrc, uint32_t fid_ssrc) { - StreamParams sp = StreamParams::CreateLegacy(ssrc); - sp.AddFidSsrc(ssrc, fid_ssrc); - streams_.push_back(sp); - } - // Sets the CNAME of all StreamParams if it have not been set. - // This can be used to set the CNAME of legacy streams. - void SetCnameIfEmpty(const std::string& cname) { - for (cricket::StreamParamsVec::iterator it = streams_.begin(); - it != streams_.end(); ++it) { - if (it->cname.empty()) - it->cname = cname; - } - } - uint32_t first_ssrc() const { - if (streams_.empty()) { - return 0; - } - return streams_[0].first_ssrc(); - } - bool has_ssrcs() const { - if (streams_.empty()) { - return false; - } - return streams_[0].has_ssrcs(); - } - - void set_conference_mode(bool enable) { conference_mode_ = enable; } - bool conference_mode() const { return conference_mode_; } - - void set_partial(bool partial) { partial_ = partial; } - bool partial() const { return partial_; } - - void set_buffered_mode_latency(int latency) { - buffered_mode_latency_ = latency; - } - int buffered_mode_latency() const { return buffered_mode_latency_; } - - protected: - bool rtcp_mux_ = false; - bool rtcp_reduced_size_ = false; - int bandwidth_ = kAutoBandwidth; - std::string protocol_; - std::vector cryptos_; - CryptoType crypto_required_ = CT_NONE; - std::vector rtp_header_extensions_; - bool rtp_header_extensions_set_ = false; - bool multistream_ = false; - StreamParamsVec streams_; - bool conference_mode_ = false; - bool partial_ = false; - int buffered_mode_latency_ = kBufferedModeDisabled; - MediaContentDirection direction_ = MD_SENDRECV; -}; - -template -class MediaContentDescriptionImpl : public MediaContentDescription { - public: - struct PreferenceSort { - bool operator()(C a, C b) { return a.preference > b.preference; } - }; - - const std::vector& codecs() const { return codecs_; } - void set_codecs(const std::vector& codecs) { codecs_ = codecs; } - virtual bool has_codecs() const { return !codecs_.empty(); } - bool HasCodec(int id) { - bool found = false; - for (typename std::vector::iterator iter = codecs_.begin(); - iter != codecs_.end(); ++iter) { - if (iter->id == id) { - found = true; - break; - } - } - return found; - } - void AddCodec(const C& codec) { - codecs_.push_back(codec); - } - void AddOrReplaceCodec(const C& codec) { - for (typename std::vector::iterator iter = codecs_.begin(); - iter != codecs_.end(); ++iter) { - if (iter->id == codec.id) { - *iter = codec; - return; - } - } - AddCodec(codec); - } - void AddCodecs(const std::vector& codecs) { - typename std::vector::const_iterator codec; - for (codec = codecs.begin(); codec != codecs.end(); ++codec) { - AddCodec(*codec); - } - } - void SortCodecs() { - std::sort(codecs_.begin(), codecs_.end(), PreferenceSort()); - } - - private: - std::vector codecs_; -}; - -class AudioContentDescription : public MediaContentDescriptionImpl { - public: - AudioContentDescription() : - agc_minus_10db_(false) {} - - virtual ContentDescription* Copy() const { - return new AudioContentDescription(*this); - } - virtual MediaType type() const { return MEDIA_TYPE_AUDIO; } - - const std::string &lang() const { return lang_; } - void set_lang(const std::string &lang) { lang_ = lang; } - - bool agc_minus_10db() const { return agc_minus_10db_; } - void set_agc_minus_10db(bool enable) { - agc_minus_10db_ = enable; - } - - private: - bool agc_minus_10db_; - - private: - std::string lang_; -}; - -class VideoContentDescription : public MediaContentDescriptionImpl { - public: - virtual ContentDescription* Copy() const { - return new VideoContentDescription(*this); - } - virtual MediaType type() const { return MEDIA_TYPE_VIDEO; } -}; - -class DataContentDescription : public MediaContentDescriptionImpl { - public: - virtual ContentDescription* Copy() const { - return new DataContentDescription(*this); - } - virtual MediaType type() const { return MEDIA_TYPE_DATA; } -}; - -// Creates media session descriptions according to the supplied codecs and -// other fields, as well as the supplied per-call options. -// When creating answers, performs the appropriate negotiation -// of the various fields to determine the proper result. -class MediaSessionDescriptionFactory { - public: - // Default ctor; use methods below to set configuration. - // The TransportDescriptionFactory is not owned by MediaSessionDescFactory, - // so it must be kept alive by the user of this class. - explicit MediaSessionDescriptionFactory( - const TransportDescriptionFactory* factory); - // This helper automatically sets up the factory to get its configuration - // from the specified ChannelManager. - MediaSessionDescriptionFactory(ChannelManager* cmanager, - const TransportDescriptionFactory* factory); - - const AudioCodecs& audio_codecs() const { return audio_codecs_; } - void set_audio_codecs(const AudioCodecs& codecs) { audio_codecs_ = codecs; } - void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) { - audio_rtp_extensions_ = extensions; - } - const RtpHeaderExtensions& audio_rtp_header_extensions() const { - return audio_rtp_extensions_; - } - const VideoCodecs& video_codecs() const { return video_codecs_; } - void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; } - void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) { - video_rtp_extensions_ = extensions; - } - const RtpHeaderExtensions& video_rtp_header_extensions() const { - return video_rtp_extensions_; - } - const DataCodecs& data_codecs() const { return data_codecs_; } - void set_data_codecs(const DataCodecs& codecs) { data_codecs_ = codecs; } - SecurePolicy secure() const { return secure_; } - void set_secure(SecurePolicy s) { secure_ = s; } - // Decides if a StreamParams shall be added to the audio and video media - // content in SessionDescription when CreateOffer and CreateAnswer is called - // even if |options| don't include a Stream. This is needed to support legacy - // applications. |add_legacy_| is true per default. - void set_add_legacy_streams(bool add_legacy) { add_legacy_ = add_legacy; } - - SessionDescription* CreateOffer( - const MediaSessionOptions& options, - const SessionDescription* current_description) const; - SessionDescription* CreateAnswer( - const SessionDescription* offer, - const MediaSessionOptions& options, - const SessionDescription* current_description) const; - - private: - void GetCodecsToOffer(const SessionDescription* current_description, - AudioCodecs* audio_codecs, - VideoCodecs* video_codecs, - DataCodecs* data_codecs) const; - void GetRtpHdrExtsToOffer(const SessionDescription* current_description, - RtpHeaderExtensions* audio_extensions, - RtpHeaderExtensions* video_extensions) const; - bool AddTransportOffer( - const std::string& content_name, - const TransportOptions& transport_options, - const SessionDescription* current_desc, - SessionDescription* offer) const; - - TransportDescription* CreateTransportAnswer( - const std::string& content_name, - const SessionDescription* offer_desc, - const TransportOptions& transport_options, - const SessionDescription* current_desc) const; - - bool AddTransportAnswer( - const std::string& content_name, - const TransportDescription& transport_desc, - SessionDescription* answer_desc) const; - - // Helpers for adding media contents to the SessionDescription. Returns true - // it succeeds or the media content is not needed, or false if there is any - // error. - - bool AddAudioContentForOffer( - const MediaSessionOptions& options, - const SessionDescription* current_description, - const RtpHeaderExtensions& audio_rtp_extensions, - const AudioCodecs& audio_codecs, - StreamParamsVec* current_streams, - SessionDescription* desc) const; - - bool AddVideoContentForOffer( - const MediaSessionOptions& options, - const SessionDescription* current_description, - const RtpHeaderExtensions& video_rtp_extensions, - const VideoCodecs& video_codecs, - StreamParamsVec* current_streams, - SessionDescription* desc) const; - - bool AddDataContentForOffer( - const MediaSessionOptions& options, - const SessionDescription* current_description, - DataCodecs* data_codecs, - StreamParamsVec* current_streams, - SessionDescription* desc) const; - - bool AddAudioContentForAnswer( - const SessionDescription* offer, - const MediaSessionOptions& options, - const SessionDescription* current_description, - StreamParamsVec* current_streams, - SessionDescription* answer) const; - - bool AddVideoContentForAnswer( - const SessionDescription* offer, - const MediaSessionOptions& options, - const SessionDescription* current_description, - StreamParamsVec* current_streams, - SessionDescription* answer) const; - - bool AddDataContentForAnswer( - const SessionDescription* offer, - const MediaSessionOptions& options, - const SessionDescription* current_description, - StreamParamsVec* current_streams, - SessionDescription* answer) const; - - AudioCodecs audio_codecs_; - RtpHeaderExtensions audio_rtp_extensions_; - VideoCodecs video_codecs_; - RtpHeaderExtensions video_rtp_extensions_; - DataCodecs data_codecs_; - SecurePolicy secure_; - bool add_legacy_; - std::string lang_; - const TransportDescriptionFactory* transport_desc_factory_; -}; - -// Convenience functions. -bool IsMediaContent(const ContentInfo* content); -bool IsAudioContent(const ContentInfo* content); -bool IsVideoContent(const ContentInfo* content); -bool IsDataContent(const ContentInfo* content); -const ContentInfo* GetFirstAudioContent(const ContentInfos& contents); -const ContentInfo* GetFirstVideoContent(const ContentInfos& contents); -const ContentInfo* GetFirstDataContent(const ContentInfos& contents); -const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc); -const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc); -const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc); -const AudioContentDescription* GetFirstAudioContentDescription( - const SessionDescription* sdesc); -const VideoContentDescription* GetFirstVideoContentDescription( - const SessionDescription* sdesc); -const DataContentDescription* GetFirstDataContentDescription( - const SessionDescription* sdesc); - -void GetSupportedAudioCryptoSuites(std::vector* crypto_suites); -void GetSupportedVideoCryptoSuites(std::vector* crypto_suites); -void GetSupportedDataCryptoSuites(std::vector* crypto_suites); -void GetDefaultSrtpCryptoSuites(std::vector* crypto_suites); -void GetSupportedAudioCryptoSuiteNames( - std::vector* crypto_suite_names); -void GetSupportedVideoCryptoSuiteNames( - std::vector* crypto_suite_names); -void GetSupportedDataCryptoSuiteNames( - std::vector* crypto_suite_names); -void GetDefaultSrtpCryptoSuiteNames( - std::vector* crypto_suite_names); - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_MEDIASESSION_H_ diff --git a/include/talk/session/media/mediasink.h b/include/talk/session/media/mediasink.h deleted file mode 100644 index fb0e06b..0000000 --- a/include/talk/session/media/mediasink.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_MEDIASINK_H_ -#define TALK_SESSION_MEDIA_MEDIASINK_H_ - -namespace cricket { - -// MediaSinkInterface is a sink to handle RTP and RTCP packets that are sent or -// received by a channel. -class MediaSinkInterface { - public: - virtual ~MediaSinkInterface() {} - - virtual void SetMaxSize(size_t size) = 0; - virtual bool Enable(bool enable) = 0; - virtual bool IsEnabled() const = 0; - virtual void OnPacket(const void* data, size_t size, bool rtcp) = 0; - virtual void set_packet_filter(int filter) = 0; -}; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_MEDIASINK_H_ diff --git a/include/talk/session/media/rtcpmuxfilter.h b/include/talk/session/media/rtcpmuxfilter.h deleted file mode 100644 index 8888fd4..0000000 --- a/include/talk/session/media/rtcpmuxfilter.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_RTCPMUXFILTER_H_ -#define TALK_SESSION_MEDIA_RTCPMUXFILTER_H_ - -#include "webrtc/p2p/base/sessiondescription.h" -#include "webrtc/base/basictypes.h" - -namespace cricket { - -// RTCP Muxer, as defined in RFC 5761 (http://tools.ietf.org/html/rfc5761) -class RtcpMuxFilter { - public: - RtcpMuxFilter(); - - // Whether the filter is active, i.e. has RTCP mux been properly negotiated. - bool IsActive() const; - - // Make the filter active, regardless of the current state. - void SetActive(); - - // Specifies whether the offer indicates the use of RTCP mux. - bool SetOffer(bool offer_enable, ContentSource src); - - // Specifies whether the provisional answer indicates the use of RTCP mux. - bool SetProvisionalAnswer(bool answer_enable, ContentSource src); - - // Specifies whether the answer indicates the use of RTCP mux. - bool SetAnswer(bool answer_enable, ContentSource src); - - // Determines whether the specified packet is RTCP. - bool DemuxRtcp(const char* data, int len); - - private: - bool ExpectOffer(bool offer_enable, ContentSource source); - bool ExpectAnswer(ContentSource source); - enum State { - // RTCP mux filter unused. - ST_INIT, - // Offer with RTCP mux enabled received. - // RTCP mux filter is not active. - ST_RECEIVEDOFFER, - // Offer with RTCP mux enabled sent. - // RTCP mux filter can demux incoming packets but is not active. - ST_SENTOFFER, - // RTCP mux filter is active but the sent answer is only provisional. - // When the final answer is set, the state transitions to ST_ACTIVE or - // ST_INIT. - ST_SENTPRANSWER, - // RTCP mux filter is active but the received answer is only provisional. - // When the final answer is set, the state transitions to ST_ACTIVE or - // ST_INIT. - ST_RECEIVEDPRANSWER, - // Offer and answer set, RTCP mux enabled. It is not possible to de-activate - // the filter. - ST_ACTIVE - }; - State state_; - bool offer_enable_; -}; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_RTCPMUXFILTER_H_ diff --git a/include/talk/session/media/srtpfilter.h b/include/talk/session/media/srtpfilter.h deleted file mode 100644 index 6b941f3..0000000 --- a/include/talk/session/media/srtpfilter.h +++ /dev/null @@ -1,330 +0,0 @@ -/* - * libjingle - * Copyright 2009 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_SESSION_MEDIA_SRTPFILTER_H_ -#define TALK_SESSION_MEDIA_SRTPFILTER_H_ - -#include -#include -#include -#include - -#include "talk/media/base/cryptoparams.h" -#include "webrtc/p2p/base/sessiondescription.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslotrepeater.h" -#include "webrtc/base/sslstreamadapter.h" - -// Forward declaration to avoid pulling in libsrtp headers here -struct srtp_event_data_t; -struct srtp_ctx_t; -struct srtp_policy_t; - -namespace cricket { - -// Key is 128 bits and salt is 112 bits == 30 bytes. B64 bloat => 40 bytes. -extern const int SRTP_MASTER_KEY_BASE64_LEN; - -// Needed for DTLS-SRTP -extern const int SRTP_MASTER_KEY_KEY_LEN; -extern const int SRTP_MASTER_KEY_SALT_LEN; - -class SrtpSession; -class SrtpStat; - -void EnableSrtpDebugging(); -void ShutdownSrtp(); - -// Class to transform SRTP to/from RTP. -// Initialize by calling SetSend with the local security params, then call -// SetRecv once the remote security params are received. At that point -// Protect/UnprotectRt(c)p can be called to encrypt/decrypt data. -// TODO: Figure out concurrency policy for SrtpFilter. -class SrtpFilter { - public: - enum Mode { - PROTECT, - UNPROTECT - }; - enum Error { - ERROR_NONE, - ERROR_FAIL, - ERROR_AUTH, - ERROR_REPLAY, - }; - - SrtpFilter(); - ~SrtpFilter(); - - // Whether the filter is active (i.e. crypto has been properly negotiated). - bool IsActive() const; - - // Indicates which crypto algorithms and keys were contained in the offer. - // offer_params should contain a list of available parameters to use, or none, - // if crypto is not desired. This must be called before SetAnswer. - bool SetOffer(const std::vector& offer_params, - ContentSource source); - // Same as SetAnwer. But multiple calls are allowed to SetProvisionalAnswer - // after a call to SetOffer. - bool SetProvisionalAnswer(const std::vector& answer_params, - ContentSource source); - // Indicates which crypto algorithms and keys were contained in the answer. - // answer_params should contain the negotiated parameters, which may be none, - // if crypto was not desired or could not be negotiated (and not required). - // This must be called after SetOffer. If crypto negotiation completes - // successfully, this will advance the filter to the active state. - bool SetAnswer(const std::vector& answer_params, - ContentSource source); - - // Just set up both sets of keys directly. - // Used with DTLS-SRTP. - bool SetRtpParams(int send_cs, - const uint8_t* send_key, - int send_key_len, - int recv_cs, - const uint8_t* recv_key, - int recv_key_len); - bool SetRtcpParams(int send_cs, - const uint8_t* send_key, - int send_key_len, - int recv_cs, - const uint8_t* recv_key, - int recv_key_len); - - // Encrypts/signs an individual RTP/RTCP packet, in-place. - // If an HMAC is used, this will increase the packet size. - bool ProtectRtp(void* data, int in_len, int max_len, int* out_len); - // Overloaded version, outputs packet index. - bool ProtectRtp(void* data, - int in_len, - int max_len, - int* out_len, - int64_t* index); - bool ProtectRtcp(void* data, int in_len, int max_len, int* out_len); - // Decrypts/verifies an invidiual RTP/RTCP packet. - // If an HMAC is used, this will decrease the packet size. - bool UnprotectRtp(void* data, int in_len, int* out_len); - bool UnprotectRtcp(void* data, int in_len, int* out_len); - - // Returns rtp auth params from srtp context. - bool GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len); - - // Update the silent threshold (in ms) for signaling errors. - void set_signal_silent_time(uint32_t signal_silent_time_in_ms); - - bool ResetParams(); - - sigslot::repeater3 SignalSrtpError; - - protected: - bool ExpectOffer(ContentSource source); - bool StoreParams(const std::vector& params, - ContentSource source); - bool ExpectAnswer(ContentSource source); - bool DoSetAnswer(const std::vector& answer_params, - ContentSource source, - bool final); - void CreateSrtpSessions(); - bool NegotiateParams(const std::vector& answer_params, - CryptoParams* selected_params); - bool ApplyParams(const CryptoParams& send_params, - const CryptoParams& recv_params); - static bool ParseKeyParams(const std::string& params, uint8_t* key, int len); - - private: - enum State { - ST_INIT, // SRTP filter unused. - ST_SENTOFFER, // Offer with SRTP parameters sent. - ST_RECEIVEDOFFER, // Offer with SRTP parameters received. - ST_SENTPRANSWER_NO_CRYPTO, // Sent provisional answer without crypto. - // Received provisional answer without crypto. - ST_RECEIVEDPRANSWER_NO_CRYPTO, - ST_ACTIVE, // Offer and answer set. - // SRTP filter is active but new parameters are offered. - // When the answer is set, the state transitions to ST_ACTIVE or ST_INIT. - ST_SENTUPDATEDOFFER, - // SRTP filter is active but new parameters are received. - // When the answer is set, the state transitions back to ST_ACTIVE. - ST_RECEIVEDUPDATEDOFFER, - // SRTP filter is active but the sent answer is only provisional. - // When the final answer is set, the state transitions to ST_ACTIVE or - // ST_INIT. - ST_SENTPRANSWER, - // SRTP filter is active but the received answer is only provisional. - // When the final answer is set, the state transitions to ST_ACTIVE or - // ST_INIT. - ST_RECEIVEDPRANSWER - }; - State state_; - uint32_t signal_silent_time_in_ms_; - std::vector offer_params_; - rtc::scoped_ptr send_session_; - rtc::scoped_ptr recv_session_; - rtc::scoped_ptr send_rtcp_session_; - rtc::scoped_ptr recv_rtcp_session_; - CryptoParams applied_send_params_; - CryptoParams applied_recv_params_; -}; - -// Class that wraps a libSRTP session. -class SrtpSession { - public: - SrtpSession(); - ~SrtpSession(); - - // Configures the session for sending data using the specified - // cipher-suite and key. Receiving must be done by a separate session. - bool SetSend(int cs, const uint8_t* key, int len); - // Configures the session for receiving data using the specified - // cipher-suite and key. Sending must be done by a separate session. - bool SetRecv(int cs, const uint8_t* key, int len); - - // Encrypts/signs an individual RTP/RTCP packet, in-place. - // If an HMAC is used, this will increase the packet size. - bool ProtectRtp(void* data, int in_len, int max_len, int* out_len); - // Overloaded version, outputs packet index. - bool ProtectRtp(void* data, - int in_len, - int max_len, - int* out_len, - int64_t* index); - bool ProtectRtcp(void* data, int in_len, int max_len, int* out_len); - // Decrypts/verifies an invidiual RTP/RTCP packet. - // If an HMAC is used, this will decrease the packet size. - bool UnprotectRtp(void* data, int in_len, int* out_len); - bool UnprotectRtcp(void* data, int in_len, int* out_len); - - // Helper method to get authentication params. - bool GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len); - - // Update the silent threshold (in ms) for signaling errors. - void set_signal_silent_time(uint32_t signal_silent_time_in_ms); - - // Calls srtp_shutdown if it's initialized. - static void Terminate(); - - sigslot::repeater3 - SignalSrtpError; - - private: - bool SetKey(int type, int cs, const uint8_t* key, int len); - // Returns send stream current packet index from srtp db. - bool GetSendStreamPacketIndex(void* data, int in_len, int64_t* index); - - static bool Init(); - void HandleEvent(const srtp_event_data_t* ev); - static void HandleEventThunk(srtp_event_data_t* ev); - - static std::list* sessions(); - - srtp_ctx_t* session_; - int rtp_auth_tag_len_; - int rtcp_auth_tag_len_; - rtc::scoped_ptr srtp_stat_; - static bool inited_; - static rtc::GlobalLockPod lock_; - int last_send_seq_num_; - RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession); -}; - -// Class that collects failures of SRTP. -class SrtpStat { - public: - SrtpStat(); - - // Report RTP protection results to the handler. - void AddProtectRtpResult(uint32_t ssrc, int result); - // Report RTP unprotection results to the handler. - void AddUnprotectRtpResult(uint32_t ssrc, int result); - // Report RTCP protection results to the handler. - void AddProtectRtcpResult(int result); - // Report RTCP unprotection results to the handler. - void AddUnprotectRtcpResult(int result); - - // Get silent time (in ms) for SRTP statistics handler. - uint32_t signal_silent_time() const { return signal_silent_time_; } - // Set silent time (in ms) for SRTP statistics handler. - void set_signal_silent_time(uint32_t signal_silent_time) { - signal_silent_time_ = signal_silent_time; - } - - // Sigslot for reporting errors. - sigslot::signal3 - SignalSrtpError; - - private: - // For each different ssrc and error, we collect statistics separately. - struct FailureKey { - FailureKey() - : ssrc(0), - mode(SrtpFilter::PROTECT), - error(SrtpFilter::ERROR_NONE) { - } - FailureKey(uint32_t in_ssrc, - SrtpFilter::Mode in_mode, - SrtpFilter::Error in_error) - : ssrc(in_ssrc), mode(in_mode), error(in_error) {} - bool operator <(const FailureKey& key) const { - return - (ssrc < key.ssrc) || - (ssrc == key.ssrc && mode < key.mode) || - (ssrc == key.ssrc && mode == key.mode && error < key.error); - } - uint32_t ssrc; - SrtpFilter::Mode mode; - SrtpFilter::Error error; - }; - // For tracing conditions for signaling, currently we only use - // last_signal_time. Wrap this as a struct so that later on, if we need any - // other improvements, it will be easier. - struct FailureStat { - FailureStat() - : last_signal_time(0) { - } - explicit FailureStat(uint32_t in_last_signal_time) - : last_signal_time(in_last_signal_time) {} - void Reset() { - last_signal_time = 0; - } - uint32_t last_signal_time; - }; - - // Inspect SRTP result and signal error if needed. - void HandleSrtpResult(const FailureKey& key); - - std::map failures_; - // Threshold in ms to silent the signaling errors. - uint32_t signal_silent_time_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat); -}; - -} // namespace cricket - -#endif // TALK_SESSION_MEDIA_SRTPFILTER_H_ diff --git a/include/talk/session/media/voicechannel.h b/include/talk/session/media/voicechannel.h deleted file mode 100644 index 6c1b6af..0000000 --- a/include/talk/session/media/voicechannel.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * libjingle - * Copyright 2004 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _VOICECHANNEL_H_ -#define _VOICECHANNEL_H_ - -#include "talk/session/media/channel.h" - -#endif // _VOICECHANNEL_H_ diff --git a/include/webrtc/audio/audio_receive_stream.h b/include/webrtc/audio/audio_receive_stream.h deleted file mode 100644 index 42286af..0000000 --- a/include/webrtc/audio/audio_receive_stream.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ -#define WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ - -#include "webrtc/audio_receive_stream.h" -#include "webrtc/audio_state.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" - -namespace webrtc { -class RemoteBitrateEstimator; - -namespace voe { -class ChannelProxy; -} // namespace voe - -namespace internal { - -class AudioReceiveStream final : public webrtc::AudioReceiveStream { - public: - AudioReceiveStream(RemoteBitrateEstimator* remote_bitrate_estimator, - const webrtc::AudioReceiveStream::Config& config, - const rtc::scoped_refptr& audio_state); - ~AudioReceiveStream() override; - - // webrtc::ReceiveStream implementation. - void Start() override; - void Stop() override; - void SignalNetworkState(NetworkState state) override; - bool DeliverRtcp(const uint8_t* packet, size_t length) override; - bool DeliverRtp(const uint8_t* packet, - size_t length, - const PacketTime& packet_time) override; - - // webrtc::AudioReceiveStream implementation. - webrtc::AudioReceiveStream::Stats GetStats() const override; - - void SetSink(rtc::scoped_ptr sink) override; - - const webrtc::AudioReceiveStream::Config& config() const; - - private: - VoiceEngine* voice_engine() const; - - rtc::ThreadChecker thread_checker_; - RemoteBitrateEstimator* const remote_bitrate_estimator_; - const webrtc::AudioReceiveStream::Config config_; - rtc::scoped_refptr audio_state_; - rtc::scoped_ptr rtp_header_parser_; - rtc::scoped_ptr channel_proxy_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); -}; -} // namespace internal -} // namespace webrtc - -#endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ diff --git a/include/webrtc/audio/audio_send_stream.h b/include/webrtc/audio/audio_send_stream.h deleted file mode 100644 index 8b96350..0000000 --- a/include/webrtc/audio/audio_send_stream.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ -#define WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ - -#include "webrtc/audio_send_stream.h" -#include "webrtc/audio_state.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/base/scoped_ptr.h" - -namespace webrtc { -class CongestionController; -class VoiceEngine; - -namespace voe { -class ChannelProxy; -} // namespace voe - -namespace internal { -class AudioSendStream final : public webrtc::AudioSendStream { - public: - AudioSendStream(const webrtc::AudioSendStream::Config& config, - const rtc::scoped_refptr& audio_state, - CongestionController* congestion_controller); - ~AudioSendStream() override; - - // webrtc::SendStream implementation. - void Start() override; - void Stop() override; - void SignalNetworkState(NetworkState state) override; - bool DeliverRtcp(const uint8_t* packet, size_t length) override; - - // webrtc::AudioSendStream implementation. - bool SendTelephoneEvent(int payload_type, uint8_t event, - uint32_t duration_ms) override; - webrtc::AudioSendStream::Stats GetStats() const override; - - const webrtc::AudioSendStream::Config& config() const; - - private: - VoiceEngine* voice_engine() const; - - rtc::ThreadChecker thread_checker_; - const webrtc::AudioSendStream::Config config_; - rtc::scoped_refptr audio_state_; - rtc::scoped_ptr channel_proxy_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); -}; -} // namespace internal -} // namespace webrtc - -#endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ diff --git a/include/webrtc/audio/audio_sink.h b/include/webrtc/audio/audio_sink.h deleted file mode 100644 index d022b32..0000000 --- a/include/webrtc/audio/audio_sink.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_AUDIO_SINK_H_ -#define WEBRTC_AUDIO_AUDIO_SINK_H_ - -#if defined(WEBRTC_POSIX) && !defined(__STDC_FORMAT_MACROS) -// Avoid conflict with format_macros.h. -#define __STDC_FORMAT_MACROS -#endif - -#include -#include - -namespace webrtc { - -// Represents a simple push audio sink. -class AudioSinkInterface { - public: - virtual ~AudioSinkInterface() {} - - struct Data { - Data(int16_t* data, - size_t samples_per_channel, - int sample_rate, - int channels, - uint32_t timestamp) - : data(data), - samples_per_channel(samples_per_channel), - sample_rate(sample_rate), - channels(channels), - timestamp(timestamp) {} - - int16_t* data; // The actual 16bit audio data. - size_t samples_per_channel; // Number of frames in the buffer. - int sample_rate; // Sample rate in Hz. - int channels; // Number of channels in the audio data. - uint32_t timestamp; // The RTP timestamp of the first sample. - }; - - virtual void OnData(const Data& audio) = 0; -}; - -} // namespace webrtc - -#endif // WEBRTC_AUDIO_AUDIO_SINK_H_ diff --git a/include/webrtc/audio/audio_state.h b/include/webrtc/audio/audio_state.h deleted file mode 100644 index 2cb83e4..0000000 --- a/include/webrtc/audio/audio_state.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_AUDIO_STATE_H_ -#define WEBRTC_AUDIO_AUDIO_STATE_H_ - -#include "webrtc/audio_state.h" -#include "webrtc/audio/scoped_voe_interface.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/voice_engine/include/voe_base.h" - -namespace webrtc { -namespace internal { - -class AudioState final : public webrtc::AudioState, - public webrtc::VoiceEngineObserver { - public: - explicit AudioState(const AudioState::Config& config); - ~AudioState() override; - - VoiceEngine* voice_engine(); - bool typing_noise_detected() const; - - private: - // rtc::RefCountInterface implementation. - int AddRef() const override; - int Release() const override; - - // webrtc::VoiceEngineObserver implementation. - void CallbackOnError(int channel_id, int err_code) override; - - rtc::ThreadChecker thread_checker_; - rtc::ThreadChecker process_thread_checker_; - const webrtc::AudioState::Config config_; - - // We hold one interface pointer to the VoE to make sure it is kept alive. - ScopedVoEInterface voe_base_; - - // The critical section isn't strictly needed in this case, but xSAN bots may - // trigger on unprotected cross-thread access. - mutable rtc::CriticalSection crit_sect_; - bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; - - // Reference count; implementation copied from rtc::RefCountedObject. - mutable volatile int ref_count_ = 0; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState); -}; -} // namespace internal -} // namespace webrtc - -#endif // WEBRTC_AUDIO_AUDIO_STATE_H_ diff --git a/include/webrtc/audio/conversion.h b/include/webrtc/audio/conversion.h deleted file mode 100644 index 6ae3243..0000000 --- a/include/webrtc/audio/conversion.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_CONVERSION_H_ -#define WEBRTC_AUDIO_CONVERSION_H_ - -namespace webrtc { - -// Convert fixed point number with 8 bit fractional part, to floating point. -inline float Q8ToFloat(uint32_t v) { - return static_cast(v) / (1 << 8); -} - -// Convert fixed point number with 14 bit fractional part, to floating point. -inline float Q14ToFloat(uint32_t v) { - return static_cast(v) / (1 << 14); -} -} // namespace webrtc - -#endif // WEBRTC_AUDIO_CONVERSION_H_ diff --git a/include/webrtc/audio/scoped_voe_interface.h b/include/webrtc/audio/scoped_voe_interface.h deleted file mode 100644 index 1029337..0000000 --- a/include/webrtc/audio/scoped_voe_interface.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_SCOPED_VOE_INTERFACE_H_ -#define WEBRTC_AUDIO_SCOPED_VOE_INTERFACE_H_ - -#include "webrtc/base/checks.h" - -namespace webrtc { - -class VoiceEngine; - -namespace internal { - -// Utility template for obtaining and holding a reference to a VoiceEngine -// interface and making sure it is released when this object goes out of scope. -template class ScopedVoEInterface { - public: - explicit ScopedVoEInterface(webrtc::VoiceEngine* e) - : ptr_(T::GetInterface(e)) { - RTC_DCHECK(ptr_); - } - ~ScopedVoEInterface() { - if (ptr_) { - ptr_->Release(); - } - } - T* operator->() { - RTC_DCHECK(ptr_); - return ptr_; - } - private: - T* ptr_; -}; -} // namespace internal -} // namespace webrtc - -#endif // WEBRTC_AUDIO_SCOPED_VOE_INTERFACE_H_ diff --git a/include/webrtc/audio_receive_stream.h b/include/webrtc/audio_receive_stream.h deleted file mode 100644 index daf4598..0000000 --- a/include/webrtc/audio_receive_stream.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_RECEIVE_STREAM_H_ -#define WEBRTC_AUDIO_RECEIVE_STREAM_H_ - -#include -#include -#include - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/config.h" -#include "webrtc/stream.h" -#include "webrtc/transport.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class AudioDecoder; -class AudioSinkInterface; - -// WORK IN PROGRESS -// This class is under development and is not yet intended for for use outside -// of WebRtc/Libjingle. Please use the VoiceEngine API instead. -// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 - -class AudioReceiveStream : public ReceiveStream { - public: - struct Stats { - uint32_t remote_ssrc = 0; - int64_t bytes_rcvd = 0; - uint32_t packets_rcvd = 0; - uint32_t packets_lost = 0; - float fraction_lost = 0.0f; - std::string codec_name; - uint32_t ext_seqnum = 0; - uint32_t jitter_ms = 0; - uint32_t jitter_buffer_ms = 0; - uint32_t jitter_buffer_preferred_ms = 0; - uint32_t delay_estimate_ms = 0; - int32_t audio_level = -1; - float expand_rate = 0.0f; - float speech_expand_rate = 0.0f; - float secondary_decoded_rate = 0.0f; - float accelerate_rate = 0.0f; - float preemptive_expand_rate = 0.0f; - int32_t decoding_calls_to_silence_generator = 0; - int32_t decoding_calls_to_neteq = 0; - int32_t decoding_normal = 0; - int32_t decoding_plc = 0; - int32_t decoding_cng = 0; - int32_t decoding_plc_cng = 0; - int64_t capture_start_ntp_time_ms = 0; - }; - - struct Config { - std::string ToString() const; - - // Receive-stream specific RTP settings. - struct Rtp { - std::string ToString() const; - - // Synchronization source (stream identifier) to be received. - uint32_t remote_ssrc = 0; - - // Sender SSRC used for sending RTCP (such as receiver reports). - uint32_t local_ssrc = 0; - - // RTP header extensions used for the received stream. - std::vector extensions; - } rtp; - - Transport* receive_transport = nullptr; - Transport* rtcp_send_transport = nullptr; - - // Underlying VoiceEngine handle, used to map AudioReceiveStream to lower- - // level components. - // TODO(solenberg): Remove when VoiceEngine channels are created outside - // of Call. - int voe_channel_id = -1; - - // Identifier for an A/V synchronization group. Empty string to disable. - // TODO(pbos): Synchronize streams in a sync group, not just one video - // stream to one audio stream. Tracked by issue webrtc:4762. - std::string sync_group; - - // Decoders for every payload that we can receive. Call owns the - // AudioDecoder instances once the Config is submitted to - // Call::CreateReceiveStream(). - // TODO(solenberg): Use unique_ptr<> once our std lib fully supports C++11. - std::map decoder_map; - - // TODO(pbos): Remove config option once combined A/V BWE is always on. - bool combined_audio_video_bwe = false; - }; - - virtual Stats GetStats() const = 0; - - // Sets an audio sink that receives unmixed audio from the receive stream. - // Ownership of the sink is passed to the stream and can be used by the - // caller to do lifetime management (i.e. when the sink's dtor is called). - // Only one sink can be set and passing a null sink, clears an existing one. - // NOTE: Audio must still somehow be pulled through AudioTransport for audio - // to stream through this sink. In practice, this happens if mixed audio - // is being pulled+rendered and/or if audio is being pulled for the purposes - // of feeding to the AEC. - virtual void SetSink(rtc::scoped_ptr sink) = 0; -}; -} // namespace webrtc - -#endif // WEBRTC_AUDIO_RECEIVE_STREAM_H_ diff --git a/include/webrtc/audio_send_stream.h b/include/webrtc/audio_send_stream.h deleted file mode 100644 index d1af9e0..0000000 --- a/include/webrtc/audio_send_stream.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_AUDIO_SEND_STREAM_H_ -#define WEBRTC_AUDIO_SEND_STREAM_H_ - -#include -#include - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/config.h" -#include "webrtc/modules/audio_coding/codecs/audio_encoder.h" -#include "webrtc/stream.h" -#include "webrtc/transport.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -// WORK IN PROGRESS -// This class is under development and is not yet intended for for use outside -// of WebRtc/Libjingle. Please use the VoiceEngine API instead. -// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 - -class AudioSendStream : public SendStream { - public: - struct Stats { - // TODO(solenberg): Harmonize naming and defaults with receive stream stats. - uint32_t local_ssrc = 0; - int64_t bytes_sent = 0; - int32_t packets_sent = 0; - int32_t packets_lost = -1; - float fraction_lost = -1.0f; - std::string codec_name; - int32_t ext_seqnum = -1; - int32_t jitter_ms = -1; - int64_t rtt_ms = -1; - int32_t audio_level = -1; - float aec_quality_min = -1.0f; - int32_t echo_delay_median_ms = -1; - int32_t echo_delay_std_ms = -1; - int32_t echo_return_loss = -100; - int32_t echo_return_loss_enhancement = -100; - bool typing_noise_detected = false; - }; - - struct Config { - Config() = delete; - explicit Config(Transport* send_transport) - : send_transport(send_transport) {} - - std::string ToString() const; - - // Receive-stream specific RTP settings. - struct Rtp { - std::string ToString() const; - - // Sender SSRC. - uint32_t ssrc = 0; - - // RTP header extensions used for the sent stream. - std::vector extensions; - - // RTCP CNAME, see RFC 3550. - std::string c_name; - } rtp; - - // Transport for outgoing packets. The transport is expected to exist for - // the entire life of the AudioSendStream and is owned by the API client. - Transport* send_transport = nullptr; - - // Underlying VoiceEngine handle, used to map AudioSendStream to lower-level - // components. - // TODO(solenberg): Remove when VoiceEngine channels are created outside - // of Call. - int voe_channel_id = -1; - - // Ownership of the encoder object is transferred to Call when the config is - // passed to Call::CreateAudioSendStream(). - // TODO(solenberg): Implement, once we configure codecs through the new API. - // rtc::scoped_ptr encoder; - int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator. - int red_payload_type = -1; // pt, or -1 to disable REDundant coding. - }; - - // TODO(solenberg): Make payload_type a config property instead. - virtual bool SendTelephoneEvent(int payload_type, uint8_t event, - uint32_t duration_ms) = 0; - virtual Stats GetStats() const = 0; -}; -} // namespace webrtc - -#endif // WEBRTC_AUDIO_SEND_STREAM_H_ diff --git a/include/webrtc/audio_state.h b/include/webrtc/audio_state.h deleted file mode 100644 index fa5784c..0000000 --- a/include/webrtc/audio_state.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_AUDIO_STATE_H_ -#define WEBRTC_AUDIO_STATE_H_ - -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace webrtc { - -class AudioDeviceModule; -class VoiceEngine; - -// WORK IN PROGRESS -// This class is under development and is not yet intended for for use outside -// of WebRtc/Libjingle. Please use the VoiceEngine API instead. -// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 - -// AudioState holds the state which must be shared between multiple instances of -// webrtc::Call for audio processing purposes. -class AudioState : public rtc::RefCountInterface { - public: - struct Config { - // VoiceEngine used for audio streams and audio/video synchronization. - // AudioState will tickle the VoE refcount to keep it alive for as long as - // the AudioState itself. - VoiceEngine* voice_engine = nullptr; - - // The AudioDeviceModule associated with the Calls. - AudioDeviceModule* audio_device_module = nullptr; - }; - - // TODO(solenberg): Replace scoped_refptr with shared_ptr once we can use it. - static rtc::scoped_refptr Create( - const AudioState::Config& config); - - virtual ~AudioState() {} -}; -} // namespace webrtc - -#endif // WEBRTC_AUDIO_STATE_H_ diff --git a/include/webrtc/base/array_view.h b/include/webrtc/base/array_view.h deleted file mode 100644 index a7ca66c..0000000 --- a/include/webrtc/base/array_view.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ARRAY_VIEW_H_ -#define WEBRTC_BASE_ARRAY_VIEW_H_ - -#include "webrtc/base/checks.h" - -namespace rtc { - -// Many functions read from or write to arrays. The obvious way to do this is -// to use two arguments, a pointer to the first element and an element count: -// -// bool Contains17(const int* arr, size_t size) { -// for (size_t i = 0; i < size; ++i) { -// if (arr[i] == 17) -// return true; -// } -// return false; -// } -// -// This is flexible, since it doesn't matter how the array is stored (C array, -// std::vector, rtc::Buffer, ...), but it's error-prone because the caller has -// to correctly specify the array length: -// -// Contains17(arr, arraysize(arr)); // C array -// Contains17(&arr[0], arr.size()); // std::vector -// Contains17(arr, size); // pointer + size -// ... -// -// It's also kind of messy to have two separate arguments for what is -// conceptually a single thing. -// -// Enter rtc::ArrayView. It contains a T pointer (to an array it doesn't -// own) and a count, and supports the basic things you'd expect, such as -// indexing and iteration. It allows us to write our function like this: -// -// bool Contains17(rtc::ArrayView arr) { -// for (auto e : arr) { -// if (e == 17) -// return true; -// } -// return false; -// } -// -// And even better, because a bunch of things will implicitly convert to -// ArrayView, we can call it like this: -// -// Contains17(arr); // C array -// Contains17(arr); // std::vector -// Contains17(rtc::ArrayView(arr, size)); // pointer + size -// ... -// -// One important point is that ArrayView and ArrayView are -// different types, which allow and don't allow mutation of the array elements, -// respectively. The implicit conversions work just like you'd hope, so that -// e.g. vector will convert to either ArrayView or ArrayView, but const vector will convert only to ArrayView. -// (ArrayView itself can be the source type in such conversions, so -// ArrayView will convert to ArrayView.) -// -// Note: ArrayView is tiny (just a pointer and a count) and trivially copyable, -// so it's probably cheaper to pass it by value than by const reference. -template -class ArrayView final { - public: - // Construct an empty ArrayView. - ArrayView() : ArrayView(static_cast(nullptr), 0) {} - - // Construct an ArrayView for a (pointer,size) pair. - template - ArrayView(U* data, size_t size) - : data_(size == 0 ? nullptr : data), size_(size) { - CheckInvariant(); - } - - // Construct an ArrayView for an array. - template - ArrayView(U (&array)[N]) : ArrayView(&array[0], N) {} - - // Construct an ArrayView for any type U that has a size() method whose - // return value converts implicitly to size_t, and a data() method whose - // return value converts implicitly to T*. In particular, this means we allow - // conversion from ArrayView to ArrayView, but not the other way - // around. Other allowed conversions include std::vector to ArrayView - // or ArrayView, const std::vector to ArrayView, and - // rtc::Buffer to ArrayView (with the same const behavior as - // std::vector). - template - ArrayView(U& u) : ArrayView(u.data(), u.size()) {} - - // Indexing, size, and iteration. These allow mutation even if the ArrayView - // is const, because the ArrayView doesn't own the array. (To prevent - // mutation, use ArrayView.) - size_t size() const { return size_; } - bool empty() const { return size_ == 0; } - T* data() const { return data_; } - T& operator[](size_t idx) const { - RTC_DCHECK_LT(idx, size_); - RTC_DCHECK(data_); // Follows from size_ > idx and the class invariant. - return data_[idx]; - } - T* begin() const { return data_; } - T* end() const { return data_ + size_; } - const T* cbegin() const { return data_; } - const T* cend() const { return data_ + size_; } - - // Comparing two ArrayViews compares their (pointer,size) pairs; it does - // *not* dereference the pointers. - friend bool operator==(const ArrayView& a, const ArrayView& b) { - return a.data_ == b.data_ && a.size_ == b.size_; - } - friend bool operator!=(const ArrayView& a, const ArrayView& b) { - return !(a == b); - } - - private: - // Invariant: !data_ iff size_ == 0. - void CheckInvariant() const { RTC_DCHECK_EQ(!data_, size_ == 0); } - T* data_; - size_t size_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ARRAY_VIEW_H_ diff --git a/include/webrtc/base/arraysize.h b/include/webrtc/base/arraysize.h deleted file mode 100644 index 56a1039..0000000 --- a/include/webrtc/base/arraysize.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ARRAYSIZE_H_ -#define WEBRTC_BASE_ARRAYSIZE_H_ - -#include - -// This file defines the arraysize() macro and is derived from Chromium's -// base/macros.h. - -// The arraysize(arr) macro returns the # of elements in an array arr. -// The expression is a compile-time constant, and therefore can be -// used in defining new arrays, for example. If you use arraysize on -// a pointer by mistake, you will get a compile-time error. - -// This template function declaration is used in defining arraysize. -// Note that the function doesn't need an implementation, as we only -// use its type. -template char (&ArraySizeHelper(T (&array)[N]))[N]; - -#define arraysize(array) (sizeof(ArraySizeHelper(array))) - -#endif // WEBRTC_BASE_ARRAYSIZE_H_ diff --git a/include/webrtc/base/asyncfile.h b/include/webrtc/base/asyncfile.h deleted file mode 100644 index dd46766..0000000 --- a/include/webrtc/base/asyncfile.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCFILE_H__ -#define WEBRTC_BASE_ASYNCFILE_H__ - -#include "webrtc/base/sigslot.h" - -namespace rtc { - -// Provides the ability to perform file I/O asynchronously. -// TODO: Create a common base class with AsyncSocket. -class AsyncFile { - public: - AsyncFile(); - virtual ~AsyncFile(); - - // Determines whether the file will receive read events. - virtual bool readable() = 0; - virtual void set_readable(bool value) = 0; - - // Determines whether the file will receive write events. - virtual bool writable() = 0; - virtual void set_writable(bool value) = 0; - - sigslot::signal1 SignalReadEvent; - sigslot::signal1 SignalWriteEvent; - sigslot::signal2 SignalCloseEvent; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCFILE_H__ diff --git a/include/webrtc/base/asynchttprequest.h b/include/webrtc/base/asynchttprequest.h deleted file mode 100644 index 310d82e..0000000 --- a/include/webrtc/base/asynchttprequest.h +++ /dev/null @@ -1,2 +0,0 @@ -// TODO(pthatcher): Remove this file once chromium's GYP file doesn't -// refer to it. diff --git a/include/webrtc/base/asyncinvoker-inl.h b/include/webrtc/base/asyncinvoker-inl.h deleted file mode 100644 index f615f83..0000000 --- a/include/webrtc/base/asyncinvoker-inl.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCINVOKER_INL_H_ -#define WEBRTC_BASE_ASYNCINVOKER_INL_H_ - -#include "webrtc/base/bind.h" -#include "webrtc/base/callback.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -class AsyncInvoker; - -// Helper class for AsyncInvoker. Runs a task and triggers a callback -// on the calling thread if necessary. Instances are ref-counted so their -// lifetime can be independent of AsyncInvoker. -class AsyncClosure : public RefCountInterface { - public: - // Runs the asynchronous task, and triggers a callback to the calling - // thread if needed. Should be called from the target thread. - virtual void Execute() = 0; - protected: - ~AsyncClosure() override {} -}; - -// Simple closure that doesn't trigger a callback for the calling thread. -template -class FireAndForgetAsyncClosure : public AsyncClosure { - public: - explicit FireAndForgetAsyncClosure(const FunctorT& functor) - : functor_(functor) {} - virtual void Execute() { - functor_(); - } - private: - FunctorT functor_; -}; - -// Base class for closures that may trigger a callback for the calling thread. -// Listens for the "destroyed" signals from the calling thread and the invoker, -// and cancels the callback to the calling thread if either is destroyed. -class NotifyingAsyncClosureBase : public AsyncClosure, - public sigslot::has_slots<> { - public: - ~NotifyingAsyncClosureBase() override; - - protected: - NotifyingAsyncClosureBase(AsyncInvoker* invoker, Thread* calling_thread); - void TriggerCallback(); - void SetCallback(const Callback0& callback) { - CritScope cs(&crit_); - callback_ = callback; - } - bool CallbackCanceled() const { return calling_thread_ == NULL; } - - private: - Callback0 callback_; - CriticalSection crit_; - AsyncInvoker* invoker_; - Thread* calling_thread_; - - void CancelCallback(); -}; - -// Closures that have a non-void return value and require a callback. -template -class NotifyingAsyncClosure : public NotifyingAsyncClosureBase { - public: - NotifyingAsyncClosure(AsyncInvoker* invoker, - Thread* calling_thread, - const FunctorT& functor, - void (HostT::*callback)(ReturnT), - HostT* callback_host) - : NotifyingAsyncClosureBase(invoker, calling_thread), - functor_(functor), - callback_(callback), - callback_host_(callback_host) {} - virtual void Execute() { - ReturnT result = functor_(); - if (!CallbackCanceled()) { - SetCallback(Callback0(Bind(callback_, callback_host_, result))); - TriggerCallback(); - } - } - - private: - FunctorT functor_; - void (HostT::*callback_)(ReturnT); - HostT* callback_host_; -}; - -// Closures that have a void return value and require a callback. -template -class NotifyingAsyncClosure - : public NotifyingAsyncClosureBase { - public: - NotifyingAsyncClosure(AsyncInvoker* invoker, - Thread* calling_thread, - const FunctorT& functor, - void (HostT::*callback)(), - HostT* callback_host) - : NotifyingAsyncClosureBase(invoker, calling_thread), - functor_(functor) { - SetCallback(Callback0(Bind(callback, callback_host))); - } - virtual void Execute() { - functor_(); - TriggerCallback(); - } - - private: - FunctorT functor_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCINVOKER_INL_H_ diff --git a/include/webrtc/base/asyncinvoker.h b/include/webrtc/base/asyncinvoker.h deleted file mode 100644 index a351337..0000000 --- a/include/webrtc/base/asyncinvoker.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCINVOKER_H_ -#define WEBRTC_BASE_ASYNCINVOKER_H_ - -#include "webrtc/base/asyncinvoker-inl.h" -#include "webrtc/base/bind.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/scopedptrcollection.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -// Invokes function objects (aka functors) asynchronously on a Thread, and -// owns the lifetime of calls (ie, when this object is destroyed, calls in -// flight are cancelled). AsyncInvoker can optionally execute a user-specified -// function when the asynchronous call is complete, or operates in -// fire-and-forget mode otherwise. -// -// AsyncInvoker does not own the thread it calls functors on. -// -// A note about async calls and object lifetimes: users should -// be mindful of object lifetimes when calling functions asynchronously and -// ensure objects used by the function _cannot_ be deleted between the -// invocation and execution of the functor. AsyncInvoker is designed to -// help: any calls in flight will be cancelled when the AsyncInvoker used to -// make the call is destructed, and any calls executing will be allowed to -// complete before AsyncInvoker destructs. -// -// The easiest way to ensure lifetimes are handled correctly is to create a -// class that owns the Thread and AsyncInvoker objects, and then call its -// methods asynchronously as needed. -// -// Example: -// class MyClass { -// public: -// void FireAsyncTaskWithResult(Thread* thread, int x) { -// // Specify a callback to get the result upon completion. -// invoker_.AsyncInvoke( -// thread, Bind(&MyClass::AsyncTaskWithResult, this, x), -// &MyClass::OnTaskComplete, this); -// } -// void FireAnotherAsyncTask(Thread* thread) { -// // No callback specified means fire-and-forget. -// invoker_.AsyncInvoke( -// thread, Bind(&MyClass::AnotherAsyncTask, this)); -// -// private: -// int AsyncTaskWithResult(int x) { -// // Some long running process... -// return x * x; -// } -// void AnotherAsyncTask() { -// // Some other long running process... -// } -// void OnTaskComplete(int result) { result_ = result; } -// -// AsyncInvoker invoker_; -// int result_; -// }; -class AsyncInvoker : public MessageHandler { - public: - AsyncInvoker(); - ~AsyncInvoker() override; - - // Call |functor| asynchronously on |thread|, with no callback upon - // completion. Returns immediately. - template - void AsyncInvoke(Thread* thread, const FunctorT& functor, uint32_t id = 0) { - scoped_refptr closure( - new RefCountedObject >(functor)); - DoInvoke(thread, closure, id); - } - - // Call |functor| asynchronously on |thread| with |delay_ms|, with no callback - // upon completion. Returns immediately. - template - void AsyncInvokeDelayed(Thread* thread, - const FunctorT& functor, - uint32_t delay_ms, - uint32_t id = 0) { - scoped_refptr closure( - new RefCountedObject >(functor)); - DoInvokeDelayed(thread, closure, delay_ms, id); - } - - // Call |functor| asynchronously on |thread|, calling |callback| when done. - template - void AsyncInvoke(Thread* thread, - const FunctorT& functor, - void (HostT::*callback)(ReturnT), - HostT* callback_host, - uint32_t id = 0) { - scoped_refptr closure( - new RefCountedObject >( - this, Thread::Current(), functor, callback, callback_host)); - DoInvoke(thread, closure, id); - } - - // Call |functor| asynchronously on |thread|, calling |callback| when done. - // Overloaded for void return. - template - void AsyncInvoke(Thread* thread, - const FunctorT& functor, - void (HostT::*callback)(), - HostT* callback_host, - uint32_t id = 0) { - scoped_refptr closure( - new RefCountedObject >( - this, Thread::Current(), functor, callback, callback_host)); - DoInvoke(thread, closure, id); - } - - // Synchronously execute on |thread| all outstanding calls we own - // that are pending on |thread|, and wait for calls to complete - // before returning. Optionally filter by message id. - // The destructor will not wait for outstanding calls, so if that - // behavior is desired, call Flush() before destroying this object. - void Flush(Thread* thread, uint32_t id = MQID_ANY); - - // Signaled when this object is destructed. - sigslot::signal0<> SignalInvokerDestroyed; - - private: - void OnMessage(Message* msg) override; - void DoInvoke(Thread* thread, - const scoped_refptr& closure, - uint32_t id); - void DoInvokeDelayed(Thread* thread, - const scoped_refptr& closure, - uint32_t delay_ms, - uint32_t id); - bool destroying_; - - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); -}; - -// Similar to AsyncInvoker, but guards against the Thread being destroyed while -// there are outstanding dangling pointers to it. It will connect to the current -// thread in the constructor, and will get notified when that thread is -// destroyed. After GuardedAsyncInvoker is constructed, it can be used from -// other threads to post functors to the thread it was constructed on. If that -// thread dies, any further calls to AsyncInvoke() will be safely ignored. -class GuardedAsyncInvoker : public sigslot::has_slots<> { - public: - GuardedAsyncInvoker(); - ~GuardedAsyncInvoker() override; - - // Synchronously execute all outstanding calls we own, and wait for calls to - // complete before returning. Optionally filter by message id. The destructor - // will not wait for outstanding calls, so if that behavior is desired, call - // Flush() first. Returns false if the thread has died. - bool Flush(uint32_t id = MQID_ANY); - - // Call |functor| asynchronously with no callback upon completion. Returns - // immediately. Returns false if the thread has died. - template - bool AsyncInvoke(const FunctorT& functor, uint32_t id = 0) { - rtc::CritScope cs(&crit_); - if (thread_ == nullptr) - return false; - invoker_.AsyncInvoke(thread_, functor, id); - return true; - } - - // Call |functor| asynchronously with |delay_ms|, with no callback upon - // completion. Returns immediately. Returns false if the thread has died. - template - bool AsyncInvokeDelayed(const FunctorT& functor, - uint32_t delay_ms, - uint32_t id = 0) { - rtc::CritScope cs(&crit_); - if (thread_ == nullptr) - return false; - invoker_.AsyncInvokeDelayed(thread_, functor, delay_ms, - id); - return true; - } - - // Call |functor| asynchronously, calling |callback| when done. Returns false - // if the thread has died. - template - bool AsyncInvoke(const FunctorT& functor, - void (HostT::*callback)(ReturnT), - HostT* callback_host, - uint32_t id = 0) { - rtc::CritScope cs(&crit_); - if (thread_ == nullptr) - return false; - invoker_.AsyncInvoke(thread_, functor, callback, - callback_host, id); - return true; - } - - // Call |functor| asynchronously calling |callback| when done. Overloaded for - // void return. Returns false if the thread has died. - template - bool AsyncInvoke(const FunctorT& functor, - void (HostT::*callback)(), - HostT* callback_host, - uint32_t id = 0) { - rtc::CritScope cs(&crit_); - if (thread_ == nullptr) - return false; - invoker_.AsyncInvoke(thread_, functor, callback, - callback_host, id); - return true; - } - - private: - // Callback when |thread_| is destroyed. - void ThreadDestroyed(); - - CriticalSection crit_; - Thread* thread_ GUARDED_BY(crit_); - AsyncInvoker invoker_ GUARDED_BY(crit_); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCINVOKER_H_ diff --git a/include/webrtc/base/asyncpacketsocket.h b/include/webrtc/base/asyncpacketsocket.h deleted file mode 100644 index 949ec67..0000000 --- a/include/webrtc/base/asyncpacketsocket.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCPACKETSOCKET_H_ -#define WEBRTC_BASE_ASYNCPACKETSOCKET_H_ - -#include "webrtc/base/dscp.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socket.h" -#include "webrtc/base/timeutils.h" - -namespace rtc { - -// This structure holds the info needed to update the packet send time header -// extension, including the information needed to update the authentication tag -// after changing the value. -struct PacketTimeUpdateParams { - PacketTimeUpdateParams(); - ~PacketTimeUpdateParams(); - - int rtp_sendtime_extension_id; // extension header id present in packet. - std::vector srtp_auth_key; // Authentication key. - int srtp_auth_tag_len; // Authentication tag length. - int64_t srtp_packet_index; // Required for Rtp Packet authentication. -}; - -// This structure holds meta information for the packet which is about to send -// over network. -struct PacketOptions { - PacketOptions() : dscp(DSCP_NO_CHANGE), packet_id(-1) {} - explicit PacketOptions(DiffServCodePoint dscp) : dscp(dscp), packet_id(-1) {} - - DiffServCodePoint dscp; - int packet_id; // 16 bits, -1 represents "not set". - PacketTimeUpdateParams packet_time_params; -}; - -// This structure will have the information about when packet is actually -// received by socket. -struct PacketTime { - PacketTime() : timestamp(-1), not_before(-1) {} - PacketTime(int64_t timestamp, int64_t not_before) - : timestamp(timestamp), not_before(not_before) {} - - int64_t timestamp; // Receive time after socket delivers the data. - - // Earliest possible time the data could have arrived, indicating the - // potential error in the |timestamp| value, in case the system, is busy. For - // example, the time of the last select() call. - // If unknown, this value will be set to zero. - int64_t not_before; -}; - -inline PacketTime CreatePacketTime(int64_t not_before) { - return PacketTime(TimeMicros(), not_before); -} - -// Provides the ability to receive packets asynchronously. Sends are not -// buffered since it is acceptable to drop packets under high load. -class AsyncPacketSocket : public sigslot::has_slots<> { - public: - enum State { - STATE_CLOSED, - STATE_BINDING, - STATE_BOUND, - STATE_CONNECTING, - STATE_CONNECTED - }; - - AsyncPacketSocket(); - ~AsyncPacketSocket() override; - - // Returns current local address. Address may be set to NULL if the - // socket is not bound yet (GetState() returns STATE_BINDING). - virtual SocketAddress GetLocalAddress() const = 0; - - // Returns remote address. Returns zeroes if this is not a client TCP socket. - virtual SocketAddress GetRemoteAddress() const = 0; - - // Send a packet. - virtual int Send(const void *pv, size_t cb, const PacketOptions& options) = 0; - virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr, - const PacketOptions& options) = 0; - - // Close the socket. - virtual int Close() = 0; - - // Returns current state of the socket. - virtual State GetState() const = 0; - - // Get/set options. - virtual int GetOption(Socket::Option opt, int* value) = 0; - virtual int SetOption(Socket::Option opt, int value) = 0; - - // Get/Set current error. - // TODO: Remove SetError(). - virtual int GetError() const = 0; - virtual void SetError(int error) = 0; - - // Emitted each time a packet is read. Used only for UDP and - // connected TCP sockets. - sigslot::signal5 SignalReadPacket; - - // Emitted each time a packet is sent. - sigslot::signal2 SignalSentPacket; - - // Emitted when the socket is currently able to send. - sigslot::signal1 SignalReadyToSend; - - // Emitted after address for the socket is allocated, i.e. binding - // is finished. State of the socket is changed from BINDING to BOUND - // (for UDP and server TCP sockets) or CONNECTING (for client TCP - // sockets). - sigslot::signal2 SignalAddressReady; - - // Emitted for client TCP sockets when state is changed from - // CONNECTING to CONNECTED. - sigslot::signal1 SignalConnect; - - // Emitted for client TCP sockets when state is changed from - // CONNECTED to CLOSED. - sigslot::signal2 SignalClose; - - // Used only for listening TCP sockets. - sigslot::signal2 SignalNewConnection; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncPacketSocket); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCPACKETSOCKET_H_ diff --git a/include/webrtc/base/asyncresolverinterface.h b/include/webrtc/base/asyncresolverinterface.h deleted file mode 100644 index 75c36ab..0000000 --- a/include/webrtc/base/asyncresolverinterface.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2013 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCRESOLVERINTERFACE_H_ -#define WEBRTC_BASE_ASYNCRESOLVERINTERFACE_H_ - -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketaddress.h" - -namespace rtc { - -// This interface defines the methods to resolve the address asynchronously. -class AsyncResolverInterface { - public: - AsyncResolverInterface(); - virtual ~AsyncResolverInterface(); - - // Start address resolve process. - virtual void Start(const SocketAddress& addr) = 0; - // Returns top most resolved address of |family| - virtual bool GetResolvedAddress(int family, SocketAddress* addr) const = 0; - // Returns error from resolver. - virtual int GetError() const = 0; - // Delete the resolver. - virtual void Destroy(bool wait) = 0; - // Returns top most resolved IPv4 address if address is resolved successfully. - // Otherwise returns address set in SetAddress. - SocketAddress address() const { - SocketAddress addr; - GetResolvedAddress(AF_INET, &addr); - return addr; - } - - // This signal is fired when address resolve process is completed. - sigslot::signal1 SignalDone; -}; - -} // namespace rtc - -#endif diff --git a/include/webrtc/base/asyncsocket.h b/include/webrtc/base/asyncsocket.h deleted file mode 100644 index 7a859be..0000000 --- a/include/webrtc/base/asyncsocket.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCSOCKET_H_ -#define WEBRTC_BASE_ASYNCSOCKET_H_ - -#include "webrtc/base/common.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socket.h" - -namespace rtc { - -// TODO: Remove Socket and rename AsyncSocket to Socket. - -// Provides the ability to perform socket I/O asynchronously. -class AsyncSocket : public Socket { - public: - AsyncSocket(); - ~AsyncSocket() override; - - AsyncSocket* Accept(SocketAddress* paddr) override = 0; - - // SignalReadEvent and SignalWriteEvent use multi_threaded_local to allow - // access concurrently from different thread. - // For example SignalReadEvent::connect will be called in AsyncUDPSocket ctor - // but at the same time the SocketDispatcher maybe signaling the read event. - // ready to read - sigslot::signal1 SignalReadEvent; - // ready to write - sigslot::signal1 SignalWriteEvent; - sigslot::signal1 SignalConnectEvent; // connected - sigslot::signal2 SignalCloseEvent; // closed -}; - -class AsyncSocketAdapter : public AsyncSocket, public sigslot::has_slots<> { - public: - // The adapted socket may explicitly be NULL, and later assigned using Attach. - // However, subclasses which support detached mode must override any methods - // that will be called during the detached period (usually GetState()), to - // avoid dereferencing a null pointer. - explicit AsyncSocketAdapter(AsyncSocket* socket); - ~AsyncSocketAdapter() override; - void Attach(AsyncSocket* socket); - SocketAddress GetLocalAddress() const override; - SocketAddress GetRemoteAddress() const override; - int Bind(const SocketAddress& addr) override; - int Connect(const SocketAddress& addr) override; - int Send(const void* pv, size_t cb) override; - int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override; - int Recv(void* pv, size_t cb) override; - int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override; - int Listen(int backlog) override; - AsyncSocket* Accept(SocketAddress* paddr) override; - int Close() override; - int GetError() const override; - void SetError(int error) override; - ConnState GetState() const override; - int EstimateMTU(uint16_t* mtu) override; - int GetOption(Option opt, int* value) override; - int SetOption(Option opt, int value) override; - - protected: - virtual void OnConnectEvent(AsyncSocket* socket); - virtual void OnReadEvent(AsyncSocket* socket); - virtual void OnWriteEvent(AsyncSocket* socket); - virtual void OnCloseEvent(AsyncSocket* socket, int err); - - AsyncSocket* socket_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCSOCKET_H_ diff --git a/include/webrtc/base/asynctcpsocket.h b/include/webrtc/base/asynctcpsocket.h deleted file mode 100644 index 321fa23..0000000 --- a/include/webrtc/base/asynctcpsocket.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCTCPSOCKET_H_ -#define WEBRTC_BASE_ASYNCTCPSOCKET_H_ - -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/socketfactory.h" - -namespace rtc { - -// Simulates UDP semantics over TCP. Send and Recv packet sizes -// are preserved, and drops packets silently on Send, rather than -// buffer them in user space. -class AsyncTCPSocketBase : public AsyncPacketSocket { - public: - AsyncTCPSocketBase(AsyncSocket* socket, bool listen, size_t max_packet_size); - ~AsyncTCPSocketBase() override; - - // Pure virtual methods to send and recv data. - int Send(const void *pv, size_t cb, - const rtc::PacketOptions& options) override = 0; - virtual void ProcessInput(char* data, size_t* len) = 0; - // Signals incoming connection. - virtual void HandleIncomingConnection(AsyncSocket* socket) = 0; - - SocketAddress GetLocalAddress() const override; - SocketAddress GetRemoteAddress() const override; - int SendTo(const void* pv, - size_t cb, - const SocketAddress& addr, - const rtc::PacketOptions& options) override; - int Close() override; - - State GetState() const override; - int GetOption(Socket::Option opt, int* value) override; - int SetOption(Socket::Option opt, int value) override; - int GetError() const override; - void SetError(int error) override; - - protected: - // Binds and connects |socket| and creates AsyncTCPSocket for - // it. Takes ownership of |socket|. Returns NULL if bind() or - // connect() fail (|socket| is destroyed in that case). - static AsyncSocket* ConnectSocket(AsyncSocket* socket, - const SocketAddress& bind_address, - const SocketAddress& remote_address); - virtual int SendRaw(const void* pv, size_t cb); - int FlushOutBuffer(); - // Add data to |outbuf_|. - void AppendToOutBuffer(const void* pv, size_t cb); - - // Helper methods for |outpos_|. - bool IsOutBufferEmpty() const { return outpos_ == 0; } - void ClearOutBuffer() { outpos_ = 0; } - - private: - // Called by the underlying socket - void OnConnectEvent(AsyncSocket* socket); - void OnReadEvent(AsyncSocket* socket); - void OnWriteEvent(AsyncSocket* socket); - void OnCloseEvent(AsyncSocket* socket, int error); - - scoped_ptr socket_; - bool listen_; - char* inbuf_, * outbuf_; - size_t insize_, inpos_, outsize_, outpos_; - - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocketBase); -}; - -class AsyncTCPSocket : public AsyncTCPSocketBase { - public: - // Binds and connects |socket| and creates AsyncTCPSocket for - // it. Takes ownership of |socket|. Returns NULL if bind() or - // connect() fail (|socket| is destroyed in that case). - static AsyncTCPSocket* Create(AsyncSocket* socket, - const SocketAddress& bind_address, - const SocketAddress& remote_address); - AsyncTCPSocket(AsyncSocket* socket, bool listen); - ~AsyncTCPSocket() override {} - - int Send(const void* pv, - size_t cb, - const rtc::PacketOptions& options) override; - void ProcessInput(char* data, size_t* len) override; - void HandleIncomingConnection(AsyncSocket* socket) override; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCTCPSOCKET_H_ diff --git a/include/webrtc/base/asyncudpsocket.h b/include/webrtc/base/asyncudpsocket.h deleted file mode 100644 index 4b47007..0000000 --- a/include/webrtc/base/asyncudpsocket.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCUDPSOCKET_H_ -#define WEBRTC_BASE_ASYNCUDPSOCKET_H_ - -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/socketfactory.h" - -namespace rtc { - -// Provides the ability to receive packets asynchronously. Sends are not -// buffered since it is acceptable to drop packets under high load. -class AsyncUDPSocket : public AsyncPacketSocket { - public: - // Binds |socket| and creates AsyncUDPSocket for it. Takes ownership - // of |socket|. Returns NULL if bind() fails (|socket| is destroyed - // in that case). - static AsyncUDPSocket* Create(AsyncSocket* socket, - const SocketAddress& bind_address); - // Creates a new socket for sending asynchronous UDP packets using an - // asynchronous socket from the given factory. - static AsyncUDPSocket* Create(SocketFactory* factory, - const SocketAddress& bind_address); - explicit AsyncUDPSocket(AsyncSocket* socket); - ~AsyncUDPSocket() override; - - SocketAddress GetLocalAddress() const override; - SocketAddress GetRemoteAddress() const override; - int Send(const void* pv, - size_t cb, - const rtc::PacketOptions& options) override; - int SendTo(const void* pv, - size_t cb, - const SocketAddress& addr, - const rtc::PacketOptions& options) override; - int Close() override; - - State GetState() const override; - int GetOption(Socket::Option opt, int* value) override; - int SetOption(Socket::Option opt, int value) override; - int GetError() const override; - void SetError(int error) override; - - private: - // Called when the underlying socket is ready to be read from. - void OnReadEvent(AsyncSocket* socket); - // Called when the underlying socket is ready to send. - void OnWriteEvent(AsyncSocket* socket); - - scoped_ptr socket_; - char* buf_; - size_t size_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCUDPSOCKET_H_ diff --git a/include/webrtc/base/atomicops.h b/include/webrtc/base/atomicops.h deleted file mode 100644 index a286bf0..0000000 --- a/include/webrtc/base/atomicops.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ATOMICOPS_H_ -#define WEBRTC_BASE_ATOMICOPS_H_ - -#if defined(WEBRTC_WIN) -// Include winsock2.h before including to maintain consistency with -// win32.h. We can't include win32.h directly here since it pulls in -// headers such as basictypes.h which causes problems in Chromium where webrtc -// exists as two separate projects, webrtc and libjingle. -#include -#include -#endif // defined(WEBRTC_WIN) - -namespace rtc { -class AtomicOps { - public: -#if defined(WEBRTC_WIN) - // Assumes sizeof(int) == sizeof(LONG), which it is on Win32 and Win64. - static int Increment(volatile int* i) { - return ::InterlockedIncrement(reinterpret_cast(i)); - } - static int Decrement(volatile int* i) { - return ::InterlockedDecrement(reinterpret_cast(i)); - } - static int AcquireLoad(volatile const int* i) { - return *i; - } - static void ReleaseStore(volatile int* i, int value) { - *i = value; - } - static int CompareAndSwap(volatile int* i, int old_value, int new_value) { - return ::InterlockedCompareExchange(reinterpret_cast(i), - new_value, - old_value); - } - // Pointer variants. - template - static T* AcquireLoadPtr(T* volatile* ptr) { - return *ptr; - } - template - static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { - return static_cast(::InterlockedCompareExchangePointer( - reinterpret_cast(ptr), new_value, old_value)); - } -#else - static int Increment(volatile int* i) { - return __sync_add_and_fetch(i, 1); - } - static int Decrement(volatile int* i) { - return __sync_sub_and_fetch(i, 1); - } - static int AcquireLoad(volatile const int* i) { - return __atomic_load_n(i, __ATOMIC_ACQUIRE); - } - static void ReleaseStore(volatile int* i, int value) { - __atomic_store_n(i, value, __ATOMIC_RELEASE); - } - static int CompareAndSwap(volatile int* i, int old_value, int new_value) { - return __sync_val_compare_and_swap(i, old_value, new_value); - } - // Pointer variants. - template - static T* AcquireLoadPtr(T* volatile* ptr) { - return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); - } - template - static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { - return __sync_val_compare_and_swap(ptr, old_value, new_value); - } -#endif -}; - - - -} - -#endif // WEBRTC_BASE_ATOMICOPS_H_ diff --git a/include/webrtc/base/autodetectproxy.h b/include/webrtc/base/autodetectproxy.h deleted file mode 100644 index 1bd523f..0000000 --- a/include/webrtc/base/autodetectproxy.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_AUTODETECTPROXY_H_ -#define WEBRTC_BASE_AUTODETECTPROXY_H_ - -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/cryptstring.h" -#include "webrtc/base/proxydetect.h" -#include "webrtc/base/proxyinfo.h" -#include "webrtc/base/signalthread.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// AutoDetectProxy -/////////////////////////////////////////////////////////////////////////////// - -class AsyncResolverInterface; -class AsyncSocket; - -class AutoDetectProxy : public SignalThread { - public: - explicit AutoDetectProxy(const std::string& user_agent); - - const ProxyInfo& proxy() const { return proxy_; } - - void set_server_url(const std::string& url) { - server_url_ = url; - } - void set_proxy(const SocketAddress& proxy) { - proxy_.type = PROXY_UNKNOWN; - proxy_.address = proxy; - } - void set_auth_info(bool use_auth, const std::string& username, - const CryptString& password) { - if (use_auth) { - proxy_.username = username; - proxy_.password = password; - } - } - // Default implementation of GetProxySettingsForUrl. Override for special - // implementation. - virtual bool GetProxyForUrl(const char* agent, - const char* url, - rtc::ProxyInfo* proxy); - enum { MSG_TIMEOUT = SignalThread::ST_MSG_FIRST_AVAILABLE, - MSG_UNRESOLVABLE, - ADP_MSG_FIRST_AVAILABLE}; - - protected: - ~AutoDetectProxy() override; - - // SignalThread Interface - void DoWork() override; - void OnMessage(Message* msg) override; - - void Next(); - void Complete(ProxyType type); - - void OnConnectEvent(AsyncSocket * socket); - void OnReadEvent(AsyncSocket * socket); - void OnCloseEvent(AsyncSocket * socket, int error); - void OnResolveResult(AsyncResolverInterface* resolver); - bool DoConnect(); - - private: - std::string agent_; - std::string server_url_; - ProxyInfo proxy_; - AsyncResolverInterface* resolver_; - AsyncSocket* socket_; - int next_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AutoDetectProxy); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_AUTODETECTPROXY_H_ diff --git a/include/webrtc/base/bandwidthsmoother.h b/include/webrtc/base/bandwidthsmoother.h deleted file mode 100644 index eae565e..0000000 --- a/include/webrtc/base/bandwidthsmoother.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BANDWIDTHSMOOTHER_H_ -#define WEBRTC_BASE_BANDWIDTHSMOOTHER_H_ - -#include "webrtc/base/rollingaccumulator.h" -#include "webrtc/base/timeutils.h" - -namespace rtc { - -// The purpose of BandwidthSmoother is to smooth out bandwidth -// estimations so that 'trstate' messages can be triggered when we -// are "sure" there is sufficient bandwidth. To avoid frequent fluctuations, -// we take a slightly pessimistic view of our bandwidth. We only increase -// our estimation when we have sampled bandwidth measurements of values -// at least as large as the current estimation * percent_increase -// for at least time_between_increase time. If a sampled bandwidth -// is less than our current estimation we immediately decrease our estimation -// to that sampled value. -// We retain the initial bandwidth guess as our current bandwidth estimation -// until we have received (min_sample_count_percent * samples_count_to_average) -// number of samples. Min_sample_count_percent must be in range [0, 1]. -class BandwidthSmoother { - public: - BandwidthSmoother(int initial_bandwidth_guess, - uint32_t time_between_increase, - double percent_increase, - size_t samples_count_to_average, - double min_sample_count_percent); - ~BandwidthSmoother(); - - // Samples a new bandwidth measurement. - // bandwidth is expected to be non-negative. - // returns true if the bandwidth estimation changed - bool Sample(uint32_t sample_time, int bandwidth); - - int get_bandwidth_estimation() const { - return bandwidth_estimation_; - } - - private: - uint32_t time_between_increase_; - double percent_increase_; - uint32_t time_at_last_change_; - int bandwidth_estimation_; - RollingAccumulator accumulator_; - double min_sample_count_percent_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_BANDWIDTHSMOOTHER_H_ diff --git a/include/webrtc/base/base64.h b/include/webrtc/base/base64.h deleted file mode 100644 index d5a7dd8..0000000 --- a/include/webrtc/base/base64.h +++ /dev/null @@ -1,104 +0,0 @@ - -//********************************************************************* -//* C_Base64 - a simple base64 encoder and decoder. -//* -//* Copyright (c) 1999, Bob Withers - bwit@pobox.com -//* -//* This code may be freely used for any purpose, either personal -//* or commercial, provided the authors copyright notice remains -//* intact. -//********************************************************************* - -#ifndef WEBRTC_BASE_BASE64_H__ -#define WEBRTC_BASE_BASE64_H__ - -#include -#include - -namespace rtc { - -class Base64 -{ -public: - enum DecodeOption { - DO_PARSE_STRICT = 1, // Parse only base64 characters - DO_PARSE_WHITE = 2, // Parse only base64 and whitespace characters - DO_PARSE_ANY = 3, // Parse all characters - DO_PARSE_MASK = 3, - - DO_PAD_YES = 4, // Padding is required - DO_PAD_ANY = 8, // Padding is optional - DO_PAD_NO = 12, // Padding is disallowed - DO_PAD_MASK = 12, - - DO_TERM_BUFFER = 16, // Must termiante at end of buffer - DO_TERM_CHAR = 32, // May terminate at any character boundary - DO_TERM_ANY = 48, // May terminate at a sub-character bit offset - DO_TERM_MASK = 48, - - // Strictest interpretation - DO_STRICT = DO_PARSE_STRICT | DO_PAD_YES | DO_TERM_BUFFER, - - DO_LAX = DO_PARSE_ANY | DO_PAD_ANY | DO_TERM_CHAR, - }; - typedef int DecodeFlags; - - static bool IsBase64Char(char ch); - - // Get the char next to the |ch| from the Base64Table. - // If the |ch| is the last one in the Base64Table then returns - // the first one from the table. - // Expects the |ch| be a base64 char. - // The result will be saved in |next_ch|. - // Returns true on success. - static bool GetNextBase64Char(char ch, char* next_ch); - - // Determines whether the given string consists entirely of valid base64 - // encoded characters. - static bool IsBase64Encoded(const std::string& str); - - static void EncodeFromArray(const void* data, size_t len, - std::string* result); - static bool DecodeFromArray(const char* data, size_t len, DecodeFlags flags, - std::string* result, size_t* data_used); - static bool DecodeFromArray(const char* data, size_t len, DecodeFlags flags, - std::vector* result, size_t* data_used); - - // Convenience Methods - static inline std::string Encode(const std::string& data) { - std::string result; - EncodeFromArray(data.data(), data.size(), &result); - return result; - } - static inline std::string Decode(const std::string& data, DecodeFlags flags) { - std::string result; - DecodeFromArray(data.data(), data.size(), flags, &result, NULL); - return result; - } - static inline bool Decode(const std::string& data, DecodeFlags flags, - std::string* result, size_t* data_used) - { - return DecodeFromArray(data.data(), data.size(), flags, result, data_used); - } - static inline bool Decode(const std::string& data, DecodeFlags flags, - std::vector* result, size_t* data_used) - { - return DecodeFromArray(data.data(), data.size(), flags, result, data_used); - } - -private: - static const char Base64Table[]; - static const unsigned char DecodeTable[]; - - static size_t GetNextQuantum(DecodeFlags parse_flags, bool illegal_pads, - const char* data, size_t len, size_t* dpos, - unsigned char qbuf[4], bool* padded); - template - static bool DecodeFromArrayTemplate(const char* data, size_t len, - DecodeFlags flags, T* result, - size_t* data_used); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_BASE64_H__ diff --git a/include/webrtc/base/basictypes.h b/include/webrtc/base/basictypes.h deleted file mode 100644 index 4c3d5d1..0000000 --- a/include/webrtc/base/basictypes.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BASICTYPES_H_ -#define WEBRTC_BASE_BASICTYPES_H_ - -#include // for NULL, size_t -#include // for uintptr_t and (u)int_t types. - -#ifdef HAVE_CONFIG_H -#include "config.h" // NOLINT -#endif - -// Detect compiler is for x86 or x64. -#if defined(__x86_64__) || defined(_M_X64) || \ - defined(__i386__) || defined(_M_IX86) -#define CPU_X86 1 -#endif - -// Detect compiler is for arm. -#if defined(__arm__) || defined(_M_ARM) -#define CPU_ARM 1 -#endif - -#if defined(CPU_X86) && defined(CPU_ARM) -#error CPU_X86 and CPU_ARM both defined. -#endif - -#if !defined(RTC_ARCH_CPU_BIG_ENDIAN) && !defined(RTC_ARCH_CPU_LITTLE_ENDIAN) -// x86, arm or GCC provided __BYTE_ORDER__ macros -#if CPU_X86 || CPU_ARM || \ - (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) -#define RTC_ARCH_CPU_LITTLE_ENDIAN -#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#define RTC_ARCH_CPU_BIG_ENDIAN -#else -#error RTC_ARCH_CPU_BIG_ENDIAN or RTC_ARCH_CPU_LITTLE_ENDIAN should be defined. -#endif -#endif - -#if defined(RTC_ARCH_CPU_BIG_ENDIAN) && defined(RTC_ARCH_CPU_LITTLE_ENDIAN) -#error RTC_ARCH_CPU_BIG_ENDIAN and RTC_ARCH_CPU_LITTLE_ENDIAN both defined. -#endif - -#if defined(WEBRTC_WIN) -typedef int socklen_t; -#endif - -// The following only works for C++ -#ifdef __cplusplus - -#ifndef ALIGNP -#define ALIGNP(p, t) \ - (reinterpret_cast(((reinterpret_cast(p) + \ - ((t) - 1)) & ~((t) - 1)))) -#endif - -#define RTC_IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1))) - -// Use these to declare and define a static local variable that gets leaked so -// that its destructors are not called at exit. -#define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \ - static type& name = *new type arguments - -#endif // __cplusplus - -#endif // WEBRTC_BASE_BASICTYPES_H_ diff --git a/include/webrtc/base/bind.h b/include/webrtc/base/bind.h deleted file mode 100644 index b50afc2..0000000 --- a/include/webrtc/base/bind.h +++ /dev/null @@ -1,1542 +0,0 @@ -// This file was GENERATED by command: -// pump.py bind.h.pump -// DO NOT EDIT BY HAND!!! - -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// To generate bind.h from bind.h.pump, execute: -// /home/build/google3/third_party/gtest/scripts/pump.py bind.h.pump - -// Bind() is an overloaded function that converts method calls into function -// objects (aka functors). The method object is captured as a scoped_refptr<> if -// possible, and as a raw pointer otherwise. Any arguments to the method are -// captured by value. The return value of Bind is a stateful, nullary function -// object. Care should be taken about the lifetime of objects captured by -// Bind(); the returned functor knows nothing about the lifetime of a non -// ref-counted method object or any arguments passed by pointer, and calling the -// functor with a destroyed object will surely do bad things. -// -// Example usage: -// struct Foo { -// int Test1() { return 42; } -// int Test2() const { return 52; } -// int Test3(int x) { return x*x; } -// float Test4(int x, float y) { return x + y; } -// }; -// -// int main() { -// Foo foo; -// cout << rtc::Bind(&Foo::Test1, &foo)() << endl; -// cout << rtc::Bind(&Foo::Test2, &foo)() << endl; -// cout << rtc::Bind(&Foo::Test3, &foo, 3)() << endl; -// cout << rtc::Bind(&Foo::Test4, &foo, 7, 8.5f)() << endl; -// } -// -// Example usage of ref counted objects: -// struct Bar { -// int AddRef(); -// int Release(); -// -// void Test() {} -// void BindThis() { -// // The functor passed to AsyncInvoke() will keep this object alive. -// invoker.AsyncInvoke(rtc::Bind(&Bar::Test, this)); -// } -// }; -// -// int main() { -// rtc::scoped_refptr bar = new rtc::RefCountedObject(); -// auto functor = rtc::Bind(&Bar::Test, bar); -// bar = nullptr; -// // The functor stores an internal scoped_refptr, so this is safe. -// functor(); -// } -// - -#ifndef WEBRTC_BASE_BIND_H_ -#define WEBRTC_BASE_BIND_H_ - -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/template_util.h" - -#define NONAME - -namespace rtc { -namespace detail { -// This is needed because the template parameters in Bind can't be resolved -// if they're used both as parameters of the function pointer type and as -// parameters to Bind itself: the function pointer parameters are exact -// matches to the function prototype, but the parameters to bind have -// references stripped. This trick allows the compiler to dictate the Bind -// parameter types rather than deduce them. -template struct identity { typedef T type; }; - -// IsRefCounted::value will be true for types that can be used in -// rtc::scoped_refptr, i.e. types that implements nullary functions AddRef() -// and Release(), regardless of their return types. AddRef() and Release() can -// be defined in T or any superclass of T. -template -class IsRefCounted { - // This is a complex implementation detail done with SFINAE. - - // Define types such that sizeof(Yes) != sizeof(No). - struct Yes { char dummy[1]; }; - struct No { char dummy[2]; }; - // Define two overloaded template functions with return types of different - // size. This way, we can use sizeof() on the return type to determine which - // function the compiler would have chosen. One function will be preferred - // over the other if it is possible to create it without compiler errors, - // otherwise the compiler will simply remove it, and default to the less - // preferred function. - template - static Yes test(R* r, decltype(r->AddRef(), r->Release(), 42)); - template static No test(...); - -public: - // Trick the compiler to tell if it's possible to call AddRef() and Release(). - static const bool value = sizeof(test((T*)nullptr, 42)) == sizeof(Yes); -}; - -// TernaryTypeOperator is a helper class to select a type based on a static bool -// value. -template -struct TernaryTypeOperator {}; - -template -struct TernaryTypeOperator { - typedef IfTrueT type; -}; - -template -struct TernaryTypeOperator { - typedef IfFalseT type; -}; - -// PointerType::type will be scoped_refptr for ref counted types, and T* -// otherwise. -template -struct PointerType { - typedef typename TernaryTypeOperator::value, - scoped_refptr, - T*>::type type; -}; - -} // namespace detail - -template -class MethodFunctor0 { - public: - MethodFunctor0(MethodT method, ObjectT* object) - : method_(method), object_(object) {} - R operator()() const { - return (object_->*method_)(); } - private: - MethodT method_; - typename detail::PointerType::type object_; -}; - -template -class Functor0 { - public: - explicit Functor0(const FunctorT& functor) - : functor_(functor) {} - R operator()() const { - return functor_(); } - private: - FunctorT functor_; -}; - - -#define FP_T(x) R (ObjectT::*x)() - -template -MethodFunctor0 -Bind(FP_T(method), ObjectT* object) { - return MethodFunctor0( - method, object); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)() const - -template -MethodFunctor0 -Bind(FP_T(method), const ObjectT* object) { - return MethodFunctor0( - method, object); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)() - -template -MethodFunctor0 -Bind(FP_T(method), const scoped_refptr& object) { - return MethodFunctor0( - method, object.get()); -} - -#undef FP_T -#define FP_T(x) R (*x)() - -template -Functor0 -Bind(FP_T(function)) { - return Functor0( - function); -} - -#undef FP_T - -template -class MethodFunctor1 { - public: - MethodFunctor1(MethodT method, ObjectT* object, - P1 p1) - : method_(method), object_(object), - p1_(p1) {} - R operator()() const { - return (object_->*method_)(p1_); } - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; -}; - -template -class Functor1 { - public: - Functor1(const FunctorT& functor, P1 p1) - : functor_(functor), - p1_(p1) {} - R operator()() const { - return functor_(p1_); } - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; -}; - - -#define FP_T(x) R (ObjectT::*x)(P1) - -template -MethodFunctor1 -Bind(FP_T(method), ObjectT* object, - typename detail::identity::type p1) { - return MethodFunctor1( - method, object, p1); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1) const - -template -MethodFunctor1 -Bind(FP_T(method), const ObjectT* object, - typename detail::identity::type p1) { - return MethodFunctor1( - method, object, p1); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1) - -template -MethodFunctor1 -Bind(FP_T(method), const scoped_refptr& object, - typename detail::identity::type p1) { - return MethodFunctor1( - method, object.get(), p1); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1) - -template -Functor1 -Bind(FP_T(function), - typename detail::identity::type p1) { - return Functor1( - function, p1); -} - -#undef FP_T - -template -class MethodFunctor2 { - public: - MethodFunctor2(MethodT method, ObjectT* object, - P1 p1, - P2 p2) - : method_(method), object_(object), - p1_(p1), - p2_(p2) {} - R operator()() const { - return (object_->*method_)(p1_, p2_); } - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; -}; - -template -class Functor2 { - public: - Functor2(const FunctorT& functor, P1 p1, P2 p2) - : functor_(functor), - p1_(p1), - p2_(p2) {} - R operator()() const { - return functor_(p1_, p2_); } - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; -}; - - -#define FP_T(x) R (ObjectT::*x)(P1, P2) - -template -MethodFunctor2 -Bind(FP_T(method), ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2) { - return MethodFunctor2( - method, object, p1, p2); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2) const - -template -MethodFunctor2 -Bind(FP_T(method), const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2) { - return MethodFunctor2( - method, object, p1, p2); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2) - -template -MethodFunctor2 -Bind(FP_T(method), const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2) { - return MethodFunctor2( - method, object.get(), p1, p2); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2) - -template -Functor2 -Bind(FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2) { - return Functor2( - function, p1, p2); -} - -#undef FP_T - -template -class MethodFunctor3 { - public: - MethodFunctor3(MethodT method, ObjectT* object, - P1 p1, - P2 p2, - P3 p3) - : method_(method), object_(object), - p1_(p1), - p2_(p2), - p3_(p3) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_); } - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; -}; - -template -class Functor3 { - public: - Functor3(const FunctorT& functor, P1 p1, P2 p2, P3 p3) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3) {} - R operator()() const { - return functor_(p1_, p2_, p3_); } - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; -}; - - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3) - -template -MethodFunctor3 -Bind(FP_T(method), ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3) { - return MethodFunctor3( - method, object, p1, p2, p3); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3) const - -template -MethodFunctor3 -Bind(FP_T(method), const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3) { - return MethodFunctor3( - method, object, p1, p2, p3); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3) - -template -MethodFunctor3 -Bind(FP_T(method), const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3) { - return MethodFunctor3( - method, object.get(), p1, p2, p3); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3) - -template -Functor3 -Bind(FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3) { - return Functor3( - function, p1, p2, p3); -} - -#undef FP_T - -template -class MethodFunctor4 { - public: - MethodFunctor4(MethodT method, ObjectT* object, - P1 p1, - P2 p2, - P3 p3, - P4 p4) - : method_(method), object_(object), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_, p4_); } - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; -}; - -template -class Functor4 { - public: - Functor4(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4) {} - R operator()() const { - return functor_(p1_, p2_, p3_, p4_); } - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; -}; - - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) - -template -MethodFunctor4 -Bind(FP_T(method), ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4) { - return MethodFunctor4( - method, object, p1, p2, p3, p4); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) const - -template -MethodFunctor4 -Bind(FP_T(method), const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4) { - return MethodFunctor4( - method, object, p1, p2, p3, p4); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) - -template -MethodFunctor4 -Bind(FP_T(method), const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4) { - return MethodFunctor4( - method, object.get(), p1, p2, p3, p4); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3, P4) - -template -Functor4 -Bind(FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4) { - return Functor4( - function, p1, p2, p3, p4); -} - -#undef FP_T - -template -class MethodFunctor5 { - public: - MethodFunctor5(MethodT method, ObjectT* object, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5) - : method_(method), object_(object), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_, p4_, p5_); } - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; -}; - -template -class Functor5 { - public: - Functor5(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5) {} - R operator()() const { - return functor_(p1_, p2_, p3_, p4_, p5_); } - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; -}; - - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) - -template -MethodFunctor5 -Bind(FP_T(method), ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5) { - return MethodFunctor5( - method, object, p1, p2, p3, p4, p5); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) const - -template -MethodFunctor5 -Bind(FP_T(method), const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5) { - return MethodFunctor5( - method, object, p1, p2, p3, p4, p5); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) - -template -MethodFunctor5 -Bind(FP_T(method), const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5) { - return MethodFunctor5( - method, object.get(), p1, p2, p3, p4, p5); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3, P4, P5) - -template -Functor5 -Bind(FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5) { - return Functor5( - function, p1, p2, p3, p4, p5); -} - -#undef FP_T - -template -class MethodFunctor6 { - public: - MethodFunctor6(MethodT method, ObjectT* object, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6) - : method_(method), object_(object), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_); } - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; -}; - -template -class Functor6 { - public: - Functor6(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6) {} - R operator()() const { - return functor_(p1_, p2_, p3_, p4_, p5_, p6_); } - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; -}; - - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) - -template -MethodFunctor6 -Bind(FP_T(method), ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6) { - return MethodFunctor6( - method, object, p1, p2, p3, p4, p5, p6); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) const - -template -MethodFunctor6 -Bind(FP_T(method), const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6) { - return MethodFunctor6( - method, object, p1, p2, p3, p4, p5, p6); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) - -template -MethodFunctor6 -Bind(FP_T(method), const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6) { - return MethodFunctor6( - method, object.get(), p1, p2, p3, p4, p5, p6); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6) - -template -Functor6 -Bind(FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6) { - return Functor6( - function, p1, p2, p3, p4, p5, p6); -} - -#undef FP_T - -template -class MethodFunctor7 { - public: - MethodFunctor7(MethodT method, - ObjectT* object, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7) - : method_(method), - object_(object), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_); - } - - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; - typename rtc::remove_reference::type p7_; -}; - -template -class Functor7 { - public: - Functor7(const FunctorT& functor, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7) {} - R operator()() const { return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_); } - - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; - typename rtc::remove_reference::type p7_; -}; - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) - -template -MethodFunctor7 Bind( - FP_T(method), - ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7) { - return MethodFunctor7( - method, object, p1, p2, p3, p4, p5, p6, p7); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) const - -template -MethodFunctor7 Bind( - FP_T(method), - const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7) { - return MethodFunctor7(method, object, p1, p2, p3, p4, p5, p6, p7); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) - -template -MethodFunctor7 Bind( - FP_T(method), - const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7) { - return MethodFunctor7( - method, object.get(), p1, p2, p3, p4, p5, p6, p7); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7) - -template -Functor7 Bind( - FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7) { - return Functor7( - function, p1, p2, p3, p4, p5, p6, p7); -} - -#undef FP_T - -template -class MethodFunctor8 { - public: - MethodFunctor8(MethodT method, - ObjectT* object, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7, - P8 p8) - : method_(method), - object_(object), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7), - p8_(p8) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_); - } - - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; - typename rtc::remove_reference::type p7_; - typename rtc::remove_reference::type p8_; -}; - -template -class Functor8 { - public: - Functor8(const FunctorT& functor, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7, - P8 p8) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7), - p8_(p8) {} - R operator()() const { - return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_); - } - - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; - typename rtc::remove_reference::type p7_; - typename rtc::remove_reference::type p8_; -}; - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) - -template -MethodFunctor8 Bind( - FP_T(method), - ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8) { - return MethodFunctor8(method, object, p1, p2, p3, p4, p5, p6, p7, p8); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) const - -template -MethodFunctor8 -Bind(FP_T(method), - const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8) { - return MethodFunctor8(method, object, p1, p2, p3, p4, p5, p6, p7, p8); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) - -template -MethodFunctor8 Bind( - FP_T(method), - const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8) { - return MethodFunctor8(method, object.get(), p1, p2, p3, p4, p5, p6, p7, - p8); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7, P8) - -template -Functor8 Bind( - FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8) { - return Functor8( - function, p1, p2, p3, p4, p5, p6, p7, p8); -} - -#undef FP_T - -template -class MethodFunctor9 { - public: - MethodFunctor9(MethodT method, - ObjectT* object, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7, - P8 p8, - P9 p9) - : method_(method), - object_(object), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7), - p8_(p8), - p9_(p9) {} - R operator()() const { - return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_); - } - - private: - MethodT method_; - typename detail::PointerType::type object_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; - typename rtc::remove_reference::type p7_; - typename rtc::remove_reference::type p8_; - typename rtc::remove_reference::type p9_; -}; - -template -class Functor9 { - public: - Functor9(const FunctorT& functor, - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7, - P8 p8, - P9 p9) - : functor_(functor), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7), - p8_(p8), - p9_(p9) {} - R operator()() const { - return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_); - } - - private: - FunctorT functor_; - typename rtc::remove_reference::type p1_; - typename rtc::remove_reference::type p2_; - typename rtc::remove_reference::type p3_; - typename rtc::remove_reference::type p4_; - typename rtc::remove_reference::type p5_; - typename rtc::remove_reference::type p6_; - typename rtc::remove_reference::type p7_; - typename rtc::remove_reference::type p8_; - typename rtc::remove_reference::type p9_; -}; - -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) - -template -MethodFunctor9 -Bind(FP_T(method), - ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8, - typename detail::identity::type p9) { - return MethodFunctor9(method, object, p1, p2, p3, p4, p5, p6, p7, p8, - p9); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) const - -template -MethodFunctor9 -Bind(FP_T(method), - const ObjectT* object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8, - typename detail::identity::type p9) { - return MethodFunctor9(method, object, p1, p2, p3, p4, p5, p6, p7, - p8, p9); -} - -#undef FP_T -#define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) - -template -MethodFunctor9 -Bind(FP_T(method), - const scoped_refptr& object, - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8, - typename detail::identity::type p9) { - return MethodFunctor9(method, object.get(), p1, p2, p3, p4, p5, p6, - p7, p8, p9); -} - -#undef FP_T -#define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) - -template -Functor9 Bind( - FP_T(function), - typename detail::identity::type p1, - typename detail::identity::type p2, - typename detail::identity::type p3, - typename detail::identity::type p4, - typename detail::identity::type p5, - typename detail::identity::type p6, - typename detail::identity::type p7, - typename detail::identity::type p8, - typename detail::identity::type p9) { - return Functor9( - function, p1, p2, p3, p4, p5, p6, p7, p8, p9); -} - -#undef FP_T - -} // namespace rtc - -#undef NONAME - -#endif // WEBRTC_BASE_BIND_H_ diff --git a/include/webrtc/base/bitbuffer.h b/include/webrtc/base/bitbuffer.h deleted file mode 100644 index 8ea044e..0000000 --- a/include/webrtc/base/bitbuffer.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BITBUFFER_H_ -#define WEBRTC_BASE_BITBUFFER_H_ - -#include // For integer types. -#include // For size_t. - -#include "webrtc/base/constructormagic.h" - -namespace rtc { - -// A class, similar to ByteBuffer, that can parse bit-sized data out of a set of -// bytes. Has a similar API to ByteBuffer, plus methods for reading bit-sized -// and exponential golomb encoded data. For a writable version, use -// BitBufferWriter. Unlike ByteBuffer, this class doesn't make a copy of the -// source bytes, so it can be used on read-only data. -// Sizes/counts specify bits/bytes, for clarity. -// Byte order is assumed big-endian/network. -class BitBuffer { - public: - BitBuffer(const uint8_t* bytes, size_t byte_count); - - // Gets the current offset, in bytes/bits, from the start of the buffer. The - // bit offset is the offset into the current byte, in the range [0,7]. - void GetCurrentOffset(size_t* out_byte_offset, size_t* out_bit_offset); - - // The remaining bits in the byte buffer. - uint64_t RemainingBitCount() const; - - // Reads byte-sized values from the buffer. Returns false if there isn't - // enough data left for the specified type. - bool ReadUInt8(uint8_t* val); - bool ReadUInt16(uint16_t* val); - bool ReadUInt32(uint32_t* val); - - // Reads bit-sized values from the buffer. Returns false if there isn't enough - // data left for the specified bit count.. - bool ReadBits(uint32_t* val, size_t bit_count); - - // Peeks bit-sized values from the buffer. Returns false if there isn't enough - // data left for the specified number of bits. Doesn't move the current - // offset. - bool PeekBits(uint32_t* val, size_t bit_count); - - // Reads the exponential golomb encoded value at the current offset. - // Exponential golomb values are encoded as: - // 1) x = source val + 1 - // 2) In binary, write [countbits(x) - 1] 0s, then x - // To decode, we count the number of leading 0 bits, read that many + 1 bits, - // and increment the result by 1. - // Returns false if there isn't enough data left for the specified type, or if - // the value wouldn't fit in a uint32_t. - bool ReadExponentialGolomb(uint32_t* val); - // Reads signed exponential golomb values at the current offset. Signed - // exponential golomb values are just the unsigned values mapped to the - // sequence 0, 1, -1, 2, -2, etc. in order. - bool ReadSignedExponentialGolomb(int32_t* val); - - // Moves current position |byte_count| bytes forward. Returns false if - // there aren't enough bytes left in the buffer. - bool ConsumeBytes(size_t byte_count); - // Moves current position |bit_count| bits forward. Returns false if - // there aren't enough bits left in the buffer. - bool ConsumeBits(size_t bit_count); - - // Sets the current offset to the provied byte/bit offsets. The bit - // offset is from the given byte, in the range [0,7]. - bool Seek(size_t byte_offset, size_t bit_offset); - - protected: - const uint8_t* const bytes_; - // The total size of |bytes_|. - size_t byte_count_; - // The current offset, in bytes, from the start of |bytes_|. - size_t byte_offset_; - // The current offset, in bits, into the current byte. - size_t bit_offset_; - - RTC_DISALLOW_COPY_AND_ASSIGN(BitBuffer); -}; - -// A BitBuffer API for write operations. Supports symmetric write APIs to the -// reading APIs of BitBuffer. Note that the read/write offset is shared with the -// BitBuffer API, so both reading and writing will consume bytes/bits. -class BitBufferWriter : public BitBuffer { - public: - // Constructs a bit buffer for the writable buffer of |bytes|. - BitBufferWriter(uint8_t* bytes, size_t byte_count); - - // Writes byte-sized values from the buffer. Returns false if there isn't - // enough data left for the specified type. - bool WriteUInt8(uint8_t val); - bool WriteUInt16(uint16_t val); - bool WriteUInt32(uint32_t val); - - // Writes bit-sized values to the buffer. Returns false if there isn't enough - // room left for the specified number of bits. - bool WriteBits(uint64_t val, size_t bit_count); - - // Writes the exponential golomb encoded version of the supplied value. - // Returns false if there isn't enough room left for the value. - bool WriteExponentialGolomb(uint32_t val); - - private: - // The buffer, as a writable array. - uint8_t* const writable_bytes_; - - RTC_DISALLOW_COPY_AND_ASSIGN(BitBufferWriter); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_BITBUFFER_H_ diff --git a/include/webrtc/base/buffer.h b/include/webrtc/base/buffer.h deleted file mode 100644 index 076fa08..0000000 --- a/include/webrtc/base/buffer.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BUFFER_H_ -#define WEBRTC_BASE_BUFFER_H_ - -#include // std::swap (pre-C++11) -#include -#include -#include // std::swap (C++11 and later) -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -namespace internal { - -// (Internal; please don't use outside this file.) ByteType::t is int if T -// is uint8_t, int8_t, or char; otherwise, it's a compilation error. Use like -// this: -// -// template ::t = 0> -// void foo(T* x); -// -// to let foo be defined only for byte-sized integers. -template -struct ByteType { - private: - static int F(uint8_t*); - static int F(int8_t*); - static int F(char*); - - public: - using t = decltype(F(static_cast(nullptr))); -}; - -} // namespace internal - -// Basic buffer class, can be grown and shrunk dynamically. -// Unlike std::string/vector, does not initialize data when expanding capacity. -class Buffer { - public: - Buffer(); // An empty buffer. - Buffer(const Buffer& buf); // Copy size and contents of an existing buffer. - Buffer(Buffer&& buf); // Move contents from an existing buffer. - - // Construct a buffer with the specified number of uninitialized bytes. - explicit Buffer(size_t size); - Buffer(size_t size, size_t capacity); - - // Construct a buffer and copy the specified number of bytes into it. The - // source array may be (const) uint8_t*, int8_t*, or char*. - template ::t = 0> - Buffer(const T* data, size_t size) - : Buffer(data, size, size) {} - template ::t = 0> - Buffer(const T* data, size_t size, size_t capacity) - : Buffer(size, capacity) { - std::memcpy(data_.get(), data, size); - } - - // Construct a buffer from the contents of an array. - template ::t = 0> - Buffer(const T(&array)[N]) - : Buffer(array, N) {} - - ~Buffer(); - - // Get a pointer to the data. Just .data() will give you a (const) uint8_t*, - // but you may also use .data() and .data(). - template ::t = 0> - const T* data() const { - assert(IsConsistent()); - return reinterpret_cast(data_.get()); - } - template ::t = 0> - T* data() { - assert(IsConsistent()); - return reinterpret_cast(data_.get()); - } - - size_t size() const { - assert(IsConsistent()); - return size_; - } - size_t capacity() const { - assert(IsConsistent()); - return capacity_; - } - - Buffer& operator=(const Buffer& buf) { - if (&buf != this) - SetData(buf.data(), buf.size()); - return *this; - } - Buffer& operator=(Buffer&& buf) { - assert(IsConsistent()); - assert(buf.IsConsistent()); - size_ = buf.size_; - capacity_ = buf.capacity_; - data_ = std::move(buf.data_); - buf.OnMovedFrom(); - return *this; - } - - bool operator==(const Buffer& buf) const { - assert(IsConsistent()); - return size_ == buf.size() && memcmp(data_.get(), buf.data(), size_) == 0; - } - - bool operator!=(const Buffer& buf) const { return !(*this == buf); } - - // Replace the contents of the buffer. Accepts the same types as the - // constructors. - template ::t = 0> - void SetData(const T* data, size_t size) { - assert(IsConsistent()); - size_ = 0; - AppendData(data, size); - } - template ::t = 0> - void SetData(const T(&array)[N]) { - SetData(array, N); - } - void SetData(const Buffer& buf) { SetData(buf.data(), buf.size()); } - - // Append data to the buffer. Accepts the same types as the constructors. - template ::t = 0> - void AppendData(const T* data, size_t size) { - assert(IsConsistent()); - const size_t new_size = size_ + size; - EnsureCapacity(new_size); - std::memcpy(data_.get() + size_, data, size); - size_ = new_size; - assert(IsConsistent()); - } - template ::t = 0> - void AppendData(const T(&array)[N]) { - AppendData(array, N); - } - void AppendData(const Buffer& buf) { AppendData(buf.data(), buf.size()); } - - // Sets the size of the buffer. If the new size is smaller than the old, the - // buffer contents will be kept but truncated; if the new size is greater, - // the existing contents will be kept and the new space will be - // uninitialized. - void SetSize(size_t size) { - EnsureCapacity(size); - size_ = size; - } - - // Ensure that the buffer size can be increased to at least capacity without - // further reallocation. (Of course, this operation might need to reallocate - // the buffer.) - void EnsureCapacity(size_t capacity) { - assert(IsConsistent()); - if (capacity <= capacity_) - return; - scoped_ptr new_data(new uint8_t[capacity]); - std::memcpy(new_data.get(), data_.get(), size_); - data_ = std::move(new_data); - capacity_ = capacity; - assert(IsConsistent()); - } - - // b.Pass() does the same thing as std::move(b). - Buffer&& Pass() { - assert(IsConsistent()); - return static_cast(*this); - } - - // Resets the buffer to zero size and capacity. Works even if the buffer has - // been moved from. - void Clear() { - data_.reset(); - size_ = 0; - capacity_ = 0; - assert(IsConsistent()); - } - - // Swaps two buffers. Also works for buffers that have been moved from. - friend void swap(Buffer& a, Buffer& b) { - using std::swap; - swap(a.size_, b.size_); - swap(a.capacity_, b.capacity_); - swap(a.data_, b.data_); - } - - private: - // Precondition for all methods except Clear and the destructor. - // Postcondition for all methods except move construction and move - // assignment, which leave the moved-from object in a possibly inconsistent - // state. - bool IsConsistent() const { - return (data_ || capacity_ == 0) && capacity_ >= size_; - } - - // Called when *this has been moved from. Conceptually it's a no-op, but we - // can mutate the state slightly to help subsequent sanity checks catch bugs. - void OnMovedFrom() { -#ifdef NDEBUG - // Make *this consistent and empty. Shouldn't be necessary, but better safe - // than sorry. - size_ = 0; - capacity_ = 0; -#else - // Ensure that *this is always inconsistent, to provoke bugs. - size_ = 1; - capacity_ = 0; -#endif - } - - size_t size_; - size_t capacity_; - scoped_ptr data_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_BUFFER_H_ diff --git a/include/webrtc/base/bufferqueue.h b/include/webrtc/base/bufferqueue.h deleted file mode 100644 index 458f018..0000000 --- a/include/webrtc/base/bufferqueue.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BUFFERQUEUE_H_ -#define WEBRTC_BASE_BUFFERQUEUE_H_ - -#include -#include - -#include "webrtc/base/buffer.h" -#include "webrtc/base/criticalsection.h" - -namespace rtc { - -class BufferQueue { - public: - // Creates a buffer queue with a given capacity and default buffer size. - BufferQueue(size_t capacity, size_t default_size); - virtual ~BufferQueue(); - - // Return number of queued buffers. - size_t size() const; - - // ReadFront will only read one buffer at a time and will truncate buffers - // that don't fit in the passed memory. - // Returns true unless no data could be returned. - bool ReadFront(void* data, size_t bytes, size_t* bytes_read); - - // WriteBack always writes either the complete memory or nothing. - // Returns true unless no data could be written. - bool WriteBack(const void* data, size_t bytes, size_t* bytes_written); - - protected: - // These methods are called when the state of the queue changes. - virtual void NotifyReadableForTest() {} - virtual void NotifyWritableForTest() {} - - private: - size_t capacity_; - size_t default_size_; - mutable CriticalSection crit_; - std::deque queue_ GUARDED_BY(crit_); - std::vector free_list_ GUARDED_BY(crit_); - - RTC_DISALLOW_COPY_AND_ASSIGN(BufferQueue); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_BUFFERQUEUE_H_ diff --git a/include/webrtc/base/bytebuffer.h b/include/webrtc/base/bytebuffer.h deleted file mode 100644 index ad2e552..0000000 --- a/include/webrtc/base/bytebuffer.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BYTEBUFFER_H_ -#define WEBRTC_BASE_BYTEBUFFER_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/constructormagic.h" - -namespace rtc { - -class ByteBuffer { - public: - - enum ByteOrder { - ORDER_NETWORK = 0, // Default, use network byte order (big endian). - ORDER_HOST, // Use the native order of the host. - }; - - // |byte_order| defines order of bytes in the buffer. - ByteBuffer(); - explicit ByteBuffer(ByteOrder byte_order); - ByteBuffer(const char* bytes, size_t len); - ByteBuffer(const char* bytes, size_t len, ByteOrder byte_order); - - // Initializes buffer from a zero-terminated string. - explicit ByteBuffer(const char* bytes); - - explicit ByteBuffer(const Buffer& buf); - - ~ByteBuffer(); - - const char* Data() const { return bytes_ + start_; } - size_t Length() const { return end_ - start_; } - size_t Capacity() const { return size_ - start_; } - ByteOrder Order() const { return byte_order_; } - - // Read a next value from the buffer. Return false if there isn't - // enough data left for the specified type. - bool ReadUInt8(uint8_t* val); - bool ReadUInt16(uint16_t* val); - bool ReadUInt24(uint32_t* val); - bool ReadUInt32(uint32_t* val); - bool ReadUInt64(uint64_t* val); - bool ReadBytes(char* val, size_t len); - - // Appends next |len| bytes from the buffer to |val|. Returns false - // if there is less than |len| bytes left. - bool ReadString(std::string* val, size_t len); - - // Write value to the buffer. Resizes the buffer when it is - // neccessary. - void WriteUInt8(uint8_t val); - void WriteUInt16(uint16_t val); - void WriteUInt24(uint32_t val); - void WriteUInt32(uint32_t val); - void WriteUInt64(uint64_t val); - void WriteString(const std::string& val); - void WriteBytes(const char* val, size_t len); - - // Reserves the given number of bytes and returns a char* that can be written - // into. Useful for functions that require a char* buffer and not a - // ByteBuffer. - char* ReserveWriteBuffer(size_t len); - - // Resize the buffer to the specified |size|. This invalidates any remembered - // seek positions. - void Resize(size_t size); - - // Moves current position |size| bytes forward. Returns false if - // there is less than |size| bytes left in the buffer. Consume doesn't - // permanently remove data, so remembered read positions are still valid - // after this call. - bool Consume(size_t size); - - // Clears the contents of the buffer. After this, Length() will be 0. - void Clear(); - - // Used with GetReadPosition/SetReadPosition. - class ReadPosition { - friend class ByteBuffer; - ReadPosition(size_t start, int version) - : start_(start), version_(version) { } - size_t start_; - int version_; - }; - - // Remembers the current read position for a future SetReadPosition. Any - // calls to Shift or Resize in the interim will invalidate the position. - ReadPosition GetReadPosition() const; - - // If the given position is still valid, restores that read position. - bool SetReadPosition(const ReadPosition &position); - - private: - void Construct(const char* bytes, size_t size, ByteOrder byte_order); - - char* bytes_; - size_t size_; - size_t start_; - size_t end_; - int version_; - ByteOrder byte_order_; - - // There are sensible ways to define these, but they aren't needed in our code - // base. - RTC_DISALLOW_COPY_AND_ASSIGN(ByteBuffer); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_BYTEBUFFER_H_ diff --git a/include/webrtc/base/byteorder.h b/include/webrtc/base/byteorder.h deleted file mode 100644 index d579e6e..0000000 --- a/include/webrtc/base/byteorder.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_BYTEORDER_H_ -#define WEBRTC_BASE_BYTEORDER_H_ - -#if defined(WEBRTC_POSIX) && !defined(__native_client__) -#include -#endif - -#if defined(WEBRTC_WIN) -#include -#endif - -#include "webrtc/base/basictypes.h" - -namespace rtc { - -// Reading and writing of little and big-endian numbers from memory -// TODO: Optimized versions, with direct read/writes of -// integers in host-endian format, when the platform supports it. - -inline void Set8(void* memory, size_t offset, uint8_t v) { - static_cast(memory)[offset] = v; -} - -inline uint8_t Get8(const void* memory, size_t offset) { - return static_cast(memory)[offset]; -} - -inline void SetBE16(void* memory, uint16_t v) { - Set8(memory, 0, static_cast(v >> 8)); - Set8(memory, 1, static_cast(v >> 0)); -} - -inline void SetBE32(void* memory, uint32_t v) { - Set8(memory, 0, static_cast(v >> 24)); - Set8(memory, 1, static_cast(v >> 16)); - Set8(memory, 2, static_cast(v >> 8)); - Set8(memory, 3, static_cast(v >> 0)); -} - -inline void SetBE64(void* memory, uint64_t v) { - Set8(memory, 0, static_cast(v >> 56)); - Set8(memory, 1, static_cast(v >> 48)); - Set8(memory, 2, static_cast(v >> 40)); - Set8(memory, 3, static_cast(v >> 32)); - Set8(memory, 4, static_cast(v >> 24)); - Set8(memory, 5, static_cast(v >> 16)); - Set8(memory, 6, static_cast(v >> 8)); - Set8(memory, 7, static_cast(v >> 0)); -} - -inline uint16_t GetBE16(const void* memory) { - return static_cast((Get8(memory, 0) << 8) | (Get8(memory, 1) << 0)); -} - -inline uint32_t GetBE32(const void* memory) { - return (static_cast(Get8(memory, 0)) << 24) | - (static_cast(Get8(memory, 1)) << 16) | - (static_cast(Get8(memory, 2)) << 8) | - (static_cast(Get8(memory, 3)) << 0); -} - -inline uint64_t GetBE64(const void* memory) { - return (static_cast(Get8(memory, 0)) << 56) | - (static_cast(Get8(memory, 1)) << 48) | - (static_cast(Get8(memory, 2)) << 40) | - (static_cast(Get8(memory, 3)) << 32) | - (static_cast(Get8(memory, 4)) << 24) | - (static_cast(Get8(memory, 5)) << 16) | - (static_cast(Get8(memory, 6)) << 8) | - (static_cast(Get8(memory, 7)) << 0); -} - -inline void SetLE16(void* memory, uint16_t v) { - Set8(memory, 0, static_cast(v >> 0)); - Set8(memory, 1, static_cast(v >> 8)); -} - -inline void SetLE32(void* memory, uint32_t v) { - Set8(memory, 0, static_cast(v >> 0)); - Set8(memory, 1, static_cast(v >> 8)); - Set8(memory, 2, static_cast(v >> 16)); - Set8(memory, 3, static_cast(v >> 24)); -} - -inline void SetLE64(void* memory, uint64_t v) { - Set8(memory, 0, static_cast(v >> 0)); - Set8(memory, 1, static_cast(v >> 8)); - Set8(memory, 2, static_cast(v >> 16)); - Set8(memory, 3, static_cast(v >> 24)); - Set8(memory, 4, static_cast(v >> 32)); - Set8(memory, 5, static_cast(v >> 40)); - Set8(memory, 6, static_cast(v >> 48)); - Set8(memory, 7, static_cast(v >> 56)); -} - -inline uint16_t GetLE16(const void* memory) { - return static_cast((Get8(memory, 0) << 0) | (Get8(memory, 1) << 8)); -} - -inline uint32_t GetLE32(const void* memory) { - return (static_cast(Get8(memory, 0)) << 0) | - (static_cast(Get8(memory, 1)) << 8) | - (static_cast(Get8(memory, 2)) << 16) | - (static_cast(Get8(memory, 3)) << 24); -} - -inline uint64_t GetLE64(const void* memory) { - return (static_cast(Get8(memory, 0)) << 0) | - (static_cast(Get8(memory, 1)) << 8) | - (static_cast(Get8(memory, 2)) << 16) | - (static_cast(Get8(memory, 3)) << 24) | - (static_cast(Get8(memory, 4)) << 32) | - (static_cast(Get8(memory, 5)) << 40) | - (static_cast(Get8(memory, 6)) << 48) | - (static_cast(Get8(memory, 7)) << 56); -} - -// Check if the current host is big endian. -inline bool IsHostBigEndian() { - static const int number = 1; - return 0 == *reinterpret_cast(&number); -} - -inline uint16_t HostToNetwork16(uint16_t n) { - uint16_t result; - SetBE16(&result, n); - return result; -} - -inline uint32_t HostToNetwork32(uint32_t n) { - uint32_t result; - SetBE32(&result, n); - return result; -} - -inline uint64_t HostToNetwork64(uint64_t n) { - uint64_t result; - SetBE64(&result, n); - return result; -} - -inline uint16_t NetworkToHost16(uint16_t n) { - return GetBE16(&n); -} - -inline uint32_t NetworkToHost32(uint32_t n) { - return GetBE32(&n); -} - -inline uint64_t NetworkToHost64(uint64_t n) { - return GetBE64(&n); -} - -} // namespace rtc - -#endif // WEBRTC_BASE_BYTEORDER_H_ diff --git a/include/webrtc/base/callback.h b/include/webrtc/base/callback.h deleted file mode 100644 index 7ffdcd7..0000000 --- a/include/webrtc/base/callback.h +++ /dev/null @@ -1,260 +0,0 @@ -// This file was GENERATED by command: -// pump.py callback.h.pump -// DO NOT EDIT BY HAND!!! - -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// To generate callback.h from callback.h.pump, execute: -// /home/build/google3/third_party/gtest/scripts/pump.py callback.h.pump - -// Callbacks are callable object containers. They can hold a function pointer -// or a function object and behave like a value type. Internally, data is -// reference-counted, making copies and pass-by-value inexpensive. -// -// Callbacks are typed using template arguments. The format is: -// CallbackN -// where N is the number of arguments supplied to the callable object. -// Callbacks are invoked using operator(), just like a function or a function -// object. Default-constructed callbacks are "empty," and executing an empty -// callback does nothing. A callback can be made empty by assigning it from -// a default-constructed callback. -// -// Callbacks are similar in purpose to std::function (which isn't available on -// all platforms we support) and a lightweight alternative to sigslots. Since -// they effectively hide the type of the object they call, they're useful in -// breaking dependencies between objects that need to interact with one another. -// Notably, they can hold the results of Bind(), std::bind*, etc, without -// needing -// to know the resulting object type of those calls. -// -// Sigslots, on the other hand, provide a fuller feature set, such as multiple -// subscriptions to a signal, optional thread-safety, and lifetime tracking of -// slots. When these features are needed, choose sigslots. -// -// Example: -// int sqr(int x) { return x * x; } -// struct AddK { -// int k; -// int operator()(int x) const { return x + k; } -// } add_k = {5}; -// -// Callback1 my_callback; -// cout << my_callback.empty() << endl; // true -// -// my_callback = Callback1(&sqr); -// cout << my_callback.empty() << endl; // false -// cout << my_callback(3) << endl; // 9 -// -// my_callback = Callback1(add_k); -// cout << my_callback(10) << endl; // 15 -// -// my_callback = Callback1(); -// cout << my_callback.empty() << endl; // true - -#ifndef WEBRTC_BASE_CALLBACK_H_ -#define WEBRTC_BASE_CALLBACK_H_ - -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace rtc { - -template -class Callback0 { - public: - // Default copy operations are appropriate for this class. - Callback0() {} - template Callback0(const T& functor) - : helper_(new RefCountedObject< HelperImpl >(functor)) {} - R operator()() { - if (empty()) - return R(); - return helper_->Run(); - } - bool empty() const { return !helper_; } - - private: - struct Helper : RefCountInterface { - virtual ~Helper() {} - virtual R Run() = 0; - }; - template struct HelperImpl : Helper { - explicit HelperImpl(const T& functor) : functor_(functor) {} - virtual R Run() { - return functor_(); - } - T functor_; - }; - scoped_refptr helper_; -}; - -template -class Callback1 { - public: - // Default copy operations are appropriate for this class. - Callback1() {} - template Callback1(const T& functor) - : helper_(new RefCountedObject< HelperImpl >(functor)) {} - R operator()(P1 p1) { - if (empty()) - return R(); - return helper_->Run(p1); - } - bool empty() const { return !helper_; } - - private: - struct Helper : RefCountInterface { - virtual ~Helper() {} - virtual R Run(P1 p1) = 0; - }; - template struct HelperImpl : Helper { - explicit HelperImpl(const T& functor) : functor_(functor) {} - virtual R Run(P1 p1) { - return functor_(p1); - } - T functor_; - }; - scoped_refptr helper_; -}; - -template -class Callback2 { - public: - // Default copy operations are appropriate for this class. - Callback2() {} - template Callback2(const T& functor) - : helper_(new RefCountedObject< HelperImpl >(functor)) {} - R operator()(P1 p1, P2 p2) { - if (empty()) - return R(); - return helper_->Run(p1, p2); - } - bool empty() const { return !helper_; } - - private: - struct Helper : RefCountInterface { - virtual ~Helper() {} - virtual R Run(P1 p1, P2 p2) = 0; - }; - template struct HelperImpl : Helper { - explicit HelperImpl(const T& functor) : functor_(functor) {} - virtual R Run(P1 p1, P2 p2) { - return functor_(p1, p2); - } - T functor_; - }; - scoped_refptr helper_; -}; - -template -class Callback3 { - public: - // Default copy operations are appropriate for this class. - Callback3() {} - template Callback3(const T& functor) - : helper_(new RefCountedObject< HelperImpl >(functor)) {} - R operator()(P1 p1, P2 p2, P3 p3) { - if (empty()) - return R(); - return helper_->Run(p1, p2, p3); - } - bool empty() const { return !helper_; } - - private: - struct Helper : RefCountInterface { - virtual ~Helper() {} - virtual R Run(P1 p1, P2 p2, P3 p3) = 0; - }; - template struct HelperImpl : Helper { - explicit HelperImpl(const T& functor) : functor_(functor) {} - virtual R Run(P1 p1, P2 p2, P3 p3) { - return functor_(p1, p2, p3); - } - T functor_; - }; - scoped_refptr helper_; -}; - -template -class Callback4 { - public: - // Default copy operations are appropriate for this class. - Callback4() {} - template Callback4(const T& functor) - : helper_(new RefCountedObject< HelperImpl >(functor)) {} - R operator()(P1 p1, P2 p2, P3 p3, P4 p4) { - if (empty()) - return R(); - return helper_->Run(p1, p2, p3, p4); - } - bool empty() const { return !helper_; } - - private: - struct Helper : RefCountInterface { - virtual ~Helper() {} - virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4) = 0; - }; - template struct HelperImpl : Helper { - explicit HelperImpl(const T& functor) : functor_(functor) {} - virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4) { - return functor_(p1, p2, p3, p4); - } - T functor_; - }; - scoped_refptr helper_; -}; - -template -class Callback5 { - public: - // Default copy operations are appropriate for this class. - Callback5() {} - template Callback5(const T& functor) - : helper_(new RefCountedObject< HelperImpl >(functor)) {} - R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { - if (empty()) - return R(); - return helper_->Run(p1, p2, p3, p4, p5); - } - bool empty() const { return !helper_; } - - private: - struct Helper : RefCountInterface { - virtual ~Helper() {} - virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) = 0; - }; - template struct HelperImpl : Helper { - explicit HelperImpl(const T& functor) : functor_(functor) {} - virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { - return functor_(p1, p2, p3, p4, p5); - } - T functor_; - }; - scoped_refptr helper_; -}; -} // namespace rtc - -#endif // WEBRTC_BASE_CALLBACK_H_ diff --git a/include/webrtc/base/checks.h b/include/webrtc/base/checks.h deleted file mode 100644 index 681361a..0000000 --- a/include/webrtc/base/checks.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2006 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_CHECKS_H_ -#define WEBRTC_BASE_CHECKS_H_ - -#include -#include - -#include "webrtc/typedefs.h" - -// The macros here print a message to stderr and abort under various -// conditions. All will accept additional stream messages. For example: -// RTC_DCHECK_EQ(foo, bar) << "I'm printed when foo != bar."; -// -// - RTC_CHECK(x) is an assertion that x is always true, and that if it isn't, -// it's better to terminate the process than to continue. During development, -// the reason that it's better to terminate might simply be that the error -// handling code isn't in place yet; in production, the reason might be that -// the author of the code truly believes that x will always be true, but that -// she recognizes that if she is wrong, abrupt and unpleasant process -// termination is still better than carrying on with the assumption violated. -// -// RTC_CHECK always evaluates its argument, so it's OK for x to have side -// effects. -// -// - RTC_DCHECK(x) is the same as RTC_CHECK(x)---an assertion that x is always -// true---except that x will only be evaluated in debug builds; in production -// builds, x is simply assumed to be true. This is useful if evaluating x is -// expensive and the expected cost of failing to detect the violated -// assumption is acceptable. You should not handle cases where a production -// build fails to spot a violated condition, even those that would result in -// crashes. If the code needs to cope with the error, make it cope, but don't -// call RTC_DCHECK; if the condition really can't occur, but you'd sleep -// better at night knowing that the process will suicide instead of carrying -// on in case you were wrong, use RTC_CHECK instead of RTC_DCHECK. -// -// RTC_DCHECK only evaluates its argument in debug builds, so if x has visible -// side effects, you need to write e.g. -// bool w = x; RTC_DCHECK(w); -// -// - RTC_CHECK_EQ, _NE, _GT, ..., and RTC_DCHECK_EQ, _NE, _GT, ... are -// specialized variants of RTC_CHECK and RTC_DCHECK that print prettier -// messages if the condition doesn't hold. Prefer them to raw RTC_CHECK and -// RTC_DCHECK. -// -// - FATAL() aborts unconditionally. -// -// TODO(ajm): Ideally, checks.h would be combined with logging.h, but -// consolidation with system_wrappers/logging.h should happen first. - -namespace rtc { - -// Helper macro which avoids evaluating the arguments to a stream if -// the condition doesn't hold. -#define RTC_LAZY_STREAM(stream, condition) \ - !(condition) ? static_cast(0) : rtc::FatalMessageVoidify() & (stream) - -// The actual stream used isn't important. We reference condition in the code -// but don't evaluate it; this is to avoid "unused variable" warnings (we do so -// in a particularly convoluted way with an extra ?: because that appears to be -// the simplest construct that keeps Visual Studio from complaining about -// condition being unused). -#define RTC_EAT_STREAM_PARAMETERS(condition) \ - (true ? true : !(condition)) \ - ? static_cast(0) \ - : rtc::FatalMessageVoidify() & rtc::FatalMessage("", 0).stream() - -// RTC_CHECK dies with a fatal error if condition is not true. It is *not* -// controlled by NDEBUG, so the check will be executed regardless of -// compilation mode. -// -// We make sure RTC_CHECK et al. always evaluates their arguments, as -// doing RTC_CHECK(FunctionWithSideEffect()) is a common idiom. -#define RTC_CHECK(condition) \ - RTC_LAZY_STREAM(rtc::FatalMessage(__FILE__, __LINE__).stream(), \ - !(condition)) \ - << "Check failed: " #condition << std::endl << "# " - -// Helper macro for binary operators. -// Don't use this macro directly in your code, use RTC_CHECK_EQ et al below. -// -// TODO(akalin): Rewrite this so that constructs like if (...) -// RTC_CHECK_EQ(...) else { ... } work properly. -#define RTC_CHECK_OP(name, op, val1, val2) \ - if (std::string* _result = \ - rtc::Check##name##Impl((val1), (val2), #val1 " " #op " " #val2)) \ - rtc::FatalMessage(__FILE__, __LINE__, _result).stream() - -// Build the error message string. This is separate from the "Impl" -// function template because it is not performance critical and so can -// be out of line, while the "Impl" code should be inline. Caller -// takes ownership of the returned string. -template -std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) { - std::ostringstream ss; - ss << names << " (" << v1 << " vs. " << v2 << ")"; - std::string* msg = new std::string(ss.str()); - return msg; -} - -// MSVC doesn't like complex extern templates and DLLs. -#if !defined(COMPILER_MSVC) -// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated -// in logging.cc. -extern template std::string* MakeCheckOpString( - const int&, const int&, const char* names); -extern template -std::string* MakeCheckOpString( - const unsigned long&, const unsigned long&, const char* names); -extern template -std::string* MakeCheckOpString( - const unsigned long&, const unsigned int&, const char* names); -extern template -std::string* MakeCheckOpString( - const unsigned int&, const unsigned long&, const char* names); -extern template -std::string* MakeCheckOpString( - const std::string&, const std::string&, const char* name); -#endif - -// Helper functions for RTC_CHECK_OP macro. -// The (int, int) specialization works around the issue that the compiler -// will not instantiate the template version of the function on values of -// unnamed enum type - see comment below. -#define DEFINE_RTC_CHECK_OP_IMPL(name, op) \ - template \ - inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ - const char* names) { \ - if (v1 op v2) \ - return NULL; \ - else \ - return rtc::MakeCheckOpString(v1, v2, names); \ - } \ - inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \ - if (v1 op v2) \ - return NULL; \ - else \ - return rtc::MakeCheckOpString(v1, v2, names); \ - } -DEFINE_RTC_CHECK_OP_IMPL(EQ, ==) -DEFINE_RTC_CHECK_OP_IMPL(NE, !=) -DEFINE_RTC_CHECK_OP_IMPL(LE, <=) -DEFINE_RTC_CHECK_OP_IMPL(LT, < ) -DEFINE_RTC_CHECK_OP_IMPL(GE, >=) -DEFINE_RTC_CHECK_OP_IMPL(GT, > ) -#undef DEFINE_RTC_CHECK_OP_IMPL - -#define RTC_CHECK_EQ(val1, val2) RTC_CHECK_OP(EQ, ==, val1, val2) -#define RTC_CHECK_NE(val1, val2) RTC_CHECK_OP(NE, !=, val1, val2) -#define RTC_CHECK_LE(val1, val2) RTC_CHECK_OP(LE, <=, val1, val2) -#define RTC_CHECK_LT(val1, val2) RTC_CHECK_OP(LT, < , val1, val2) -#define RTC_CHECK_GE(val1, val2) RTC_CHECK_OP(GE, >=, val1, val2) -#define RTC_CHECK_GT(val1, val2) RTC_CHECK_OP(GT, > , val1, val2) - -// The RTC_DCHECK macro is equivalent to RTC_CHECK except that it only generates -// code in debug builds. It does reference the condition parameter in all cases, -// though, so callers won't risk getting warnings about unused variables. -#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) -#define RTC_DCHECK_IS_ON 1 -#define RTC_DCHECK(condition) RTC_CHECK(condition) -#define RTC_DCHECK_EQ(v1, v2) RTC_CHECK_EQ(v1, v2) -#define RTC_DCHECK_NE(v1, v2) RTC_CHECK_NE(v1, v2) -#define RTC_DCHECK_LE(v1, v2) RTC_CHECK_LE(v1, v2) -#define RTC_DCHECK_LT(v1, v2) RTC_CHECK_LT(v1, v2) -#define RTC_DCHECK_GE(v1, v2) RTC_CHECK_GE(v1, v2) -#define RTC_DCHECK_GT(v1, v2) RTC_CHECK_GT(v1, v2) -#else -#define RTC_DCHECK_IS_ON 0 -#define RTC_DCHECK(condition) RTC_EAT_STREAM_PARAMETERS(condition) -#define RTC_DCHECK_EQ(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) == (v2)) -#define RTC_DCHECK_NE(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) != (v2)) -#define RTC_DCHECK_LE(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) <= (v2)) -#define RTC_DCHECK_LT(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) < (v2)) -#define RTC_DCHECK_GE(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) >= (v2)) -#define RTC_DCHECK_GT(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) > (v2)) -#endif - -// This is identical to LogMessageVoidify but in name. -class FatalMessageVoidify { - public: - FatalMessageVoidify() { } - // This has to be an operator with a precedence lower than << but - // higher than ?: - void operator&(std::ostream&) { } -}; - -#define RTC_UNREACHABLE_CODE_HIT false -#define RTC_NOTREACHED() RTC_DCHECK(RTC_UNREACHABLE_CODE_HIT) - -#define FATAL() rtc::FatalMessage(__FILE__, __LINE__).stream() -// TODO(ajm): Consider adding RTC_NOTIMPLEMENTED macro when -// base/logging.h and system_wrappers/logging.h are consolidated such that we -// can match the Chromium behavior. - -// Like a stripped-down LogMessage from logging.h, except that it aborts. -class FatalMessage { - public: - FatalMessage(const char* file, int line); - // Used for RTC_CHECK_EQ(), etc. Takes ownership of the given string. - FatalMessage(const char* file, int line, std::string* result); - NO_RETURN ~FatalMessage(); - - std::ostream& stream() { return stream_; } - - private: - void Init(const char* file, int line); - - std::ostringstream stream_; -}; - -// Performs the integer division a/b and returns the result. CHECKs that the -// remainder is zero. -template -inline T CheckedDivExact(T a, T b) { - RTC_CHECK_EQ(a % b, static_cast(0)); - return a / b; -} - -} // namespace rtc - -#endif // WEBRTC_BASE_CHECKS_H_ diff --git a/include/webrtc/base/common.h b/include/webrtc/base/common.h deleted file mode 100644 index 2086754..0000000 --- a/include/webrtc/base/common.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_COMMON_H_ // NOLINT -#define WEBRTC_BASE_COMMON_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" - -#if defined(_MSC_VER) -// warning C4355: 'this' : used in base member initializer list -#pragma warning(disable:4355) -#endif - -////////////////////////////////////////////////////////////////////// -// General Utilities -////////////////////////////////////////////////////////////////////// - -#ifndef RTC_UNUSED -#define RTC_UNUSED(x) RtcUnused(static_cast(&x)) -#define RTC_UNUSED2(x, y) RtcUnused(static_cast(&x)); \ - RtcUnused(static_cast(&y)) -#define RTC_UNUSED3(x, y, z) RtcUnused(static_cast(&x)); \ - RtcUnused(static_cast(&y)); \ - RtcUnused(static_cast(&z)) -#define RTC_UNUSED4(x, y, z, a) RtcUnused(static_cast(&x)); \ - RtcUnused(static_cast(&y)); \ - RtcUnused(static_cast(&z)); \ - RtcUnused(static_cast(&a)) -#define RTC_UNUSED5(x, y, z, a, b) RtcUnused(static_cast(&x)); \ - RtcUnused(static_cast(&y)); \ - RtcUnused(static_cast(&z)); \ - RtcUnused(static_cast(&a)); \ - RtcUnused(static_cast(&b)) -inline void RtcUnused(const void*) {} -#endif // RTC_UNUSED - -#if !defined(WEBRTC_WIN) - -#ifndef strnicmp -#define strnicmp(x, y, n) strncasecmp(x, y, n) -#endif - -#ifndef stricmp -#define stricmp(x, y) strcasecmp(x, y) -#endif - -#endif // !defined(WEBRTC_WIN) - -///////////////////////////////////////////////////////////////////////////// -// Assertions -///////////////////////////////////////////////////////////////////////////// - -#ifndef ENABLE_DEBUG -#if !defined(NDEBUG) -#define ENABLE_DEBUG 1 -#else -#define ENABLE_DEBUG 0 -#endif -#endif // !defined(ENABLE_DEBUG) - -// Even for release builds, allow for the override of LogAssert. Though no -// macro is provided, this can still be used for explicit runtime asserts -// and allow applications to override the assert behavior. - -namespace rtc { - - -// If a debugger is attached, triggers a debugger breakpoint. If a debugger is -// not attached, forces program termination. -void Break(); - -// LogAssert writes information about an assertion to the log. It's called by -// Assert (and from the ASSERT macro in debug mode) before any other action -// is taken (e.g. breaking the debugger, abort()ing, etc.). -void LogAssert(const char* function, const char* file, int line, - const char* expression); - -typedef void (*AssertLogger)(const char* function, - const char* file, - int line, - const char* expression); - -// Sets a custom assert logger to be used instead of the default LogAssert -// behavior. To clear the custom assert logger, pass NULL for |logger| and the -// default behavior will be restored. Only one custom assert logger can be set -// at a time, so this should generally be set during application startup and -// only by one component. -void SetCustomAssertLogger(AssertLogger logger); - -bool IsOdd(int n); - -bool IsEven(int n); - -} // namespace rtc - -#if ENABLE_DEBUG - -namespace rtc { - -inline bool Assert(bool result, const char* function, const char* file, - int line, const char* expression) { - if (!result) { - LogAssert(function, file, line, expression); - Break(); - } - return result; -} - -// Same as Assert above, but does not call Break(). Used in assert macros -// that implement their own breaking. -inline bool AssertNoBreak(bool result, const char* function, const char* file, - int line, const char* expression) { - if (!result) - LogAssert(function, file, line, expression); - return result; -} - -} // namespace rtc - -#if defined(_MSC_VER) && _MSC_VER < 1300 -#define __FUNCTION__ "" -#endif - -#ifndef ASSERT -#if defined(WIN32) -// Using debugbreak() inline on Windows directly in the ASSERT macro, has the -// benefit of breaking exactly where the failing expression is and not two -// calls up the stack. -#define ASSERT(x) \ - (rtc::AssertNoBreak((x), __FUNCTION__, __FILE__, __LINE__, #x) ? \ - (void)(1) : __debugbreak()) -#else -#define ASSERT(x) \ - (void)rtc::Assert((x), __FUNCTION__, __FILE__, __LINE__, #x) -#endif -#endif - -#ifndef VERIFY -#if defined(WIN32) -#define VERIFY(x) \ - (rtc::AssertNoBreak((x), __FUNCTION__, __FILE__, __LINE__, #x) ? \ - true : (__debugbreak(), false)) -#else -#define VERIFY(x) rtc::Assert((x), __FUNCTION__, __FILE__, __LINE__, #x) -#endif -#endif - -#else // !ENABLE_DEBUG - -namespace rtc { - -inline bool ImplicitCastToBool(bool result) { return result; } - -} // namespace rtc - -#ifndef ASSERT -#define ASSERT(x) (void)0 -#endif - -#ifndef VERIFY -#define VERIFY(x) rtc::ImplicitCastToBool(x) -#endif - -#endif // !ENABLE_DEBUG - -#define COMPILE_TIME_ASSERT(expr) char CTA_UNIQUE_NAME[expr] -#define CTA_UNIQUE_NAME CTA_MAKE_NAME(__LINE__) -#define CTA_MAKE_NAME(line) CTA_MAKE_NAME2(line) -#define CTA_MAKE_NAME2(line) constraint_ ## line - -// Forces compiler to inline, even against its better judgement. Use wisely. -#if defined(__GNUC__) -#define FORCE_INLINE __attribute__((always_inline)) -#elif defined(WEBRTC_WIN) -#define FORCE_INLINE __forceinline -#else -#define FORCE_INLINE -#endif - -// Annotate a function indicating the caller must examine the return value. -// Use like: -// int foo() WARN_UNUSED_RESULT; -// To explicitly ignore a result, see |ignore_result()| in . -// TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and -// libjingle are merged. -#if !defined(WARN_UNUSED_RESULT) -#if defined(__GNUC__) || defined(__clang__) -#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define WARN_UNUSED_RESULT -#endif -#endif // WARN_UNUSED_RESULT - -#endif // WEBRTC_BASE_COMMON_H_ // NOLINT diff --git a/include/webrtc/base/constructormagic.h b/include/webrtc/base/constructormagic.h deleted file mode 100644 index 6ef7826..0000000 --- a/include/webrtc/base/constructormagic.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_CONSTRUCTORMAGIC_H_ -#define WEBRTC_BASE_CONSTRUCTORMAGIC_H_ - -// Put this in the declarations for a class to be unassignable. -#define RTC_DISALLOW_ASSIGN(TypeName) \ - void operator=(const TypeName&) = delete - -// A macro to disallow the copy constructor and operator= functions. This should -// be used in the declarations for a class. -#define RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&) = delete; \ - RTC_DISALLOW_ASSIGN(TypeName) - -// A macro to disallow all the implicit constructors, namely the default -// constructor, copy constructor and operator= functions. -// -// This should be used in the declarations for a class that wants to prevent -// anyone from instantiating it. This is especially useful for classes -// containing only static methods. -#define RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName() = delete; \ - RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) - -#endif // WEBRTC_BASE_CONSTRUCTORMAGIC_H_ diff --git a/include/webrtc/base/crc32.h b/include/webrtc/base/crc32.h deleted file mode 100644 index 9661876..0000000 --- a/include/webrtc/base/crc32.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_CRC32_H_ -#define WEBRTC_BASE_CRC32_H_ - -#include - -#include "webrtc/base/basictypes.h" - -namespace rtc { - -// Updates a CRC32 checksum with |len| bytes from |buf|. |initial| holds the -// checksum result from the previous update; for the first call, it should be 0. -uint32_t UpdateCrc32(uint32_t initial, const void* buf, size_t len); - -// Computes a CRC32 checksum using |len| bytes from |buf|. -inline uint32_t ComputeCrc32(const void* buf, size_t len) { - return UpdateCrc32(0, buf, len); -} -inline uint32_t ComputeCrc32(const std::string& str) { - return ComputeCrc32(str.c_str(), str.size()); -} - -} // namespace rtc - -#endif // WEBRTC_BASE_CRC32_H_ diff --git a/include/webrtc/base/criticalsection.h b/include/webrtc/base/criticalsection.h deleted file mode 100644 index ddbf857..0000000 --- a/include/webrtc/base/criticalsection.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_CRITICALSECTION_H_ -#define WEBRTC_BASE_CRITICALSECTION_H_ - -#include "webrtc/base/atomicops.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/thread_annotations.h" - -#if defined(WEBRTC_WIN) -// Include winsock2.h before including to maintain consistency with -// win32.h. We can't include win32.h directly here since it pulls in -// headers such as basictypes.h which causes problems in Chromium where webrtc -// exists as two separate projects, webrtc and libjingle. -#include -#include -#include // must come after windows headers. -#endif // defined(WEBRTC_WIN) - -#if defined(WEBRTC_POSIX) -#include -#endif - -#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) -#define CS_DEBUG_CHECKS 1 -#endif - -#if CS_DEBUG_CHECKS -#define CS_DEBUG_CODE(x) x -#else // !CS_DEBUG_CHECKS -#define CS_DEBUG_CODE(x) -#endif // !CS_DEBUG_CHECKS - -namespace rtc { - -class LOCKABLE CriticalSection { - public: - CriticalSection(); - ~CriticalSection(); - - void Enter() EXCLUSIVE_LOCK_FUNCTION(); - bool TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true); - void Leave() UNLOCK_FUNCTION(); - - // Use only for RTC_DCHECKing. - bool CurrentThreadIsOwner() const; - // Use only for RTC_DCHECKing. - bool IsLocked() const; - - private: -#if defined(WEBRTC_WIN) - CRITICAL_SECTION crit_; -#elif defined(WEBRTC_POSIX) - pthread_mutex_t mutex_; - CS_DEBUG_CODE(pthread_t thread_); - CS_DEBUG_CODE(int recursion_count_); -#endif -}; - -// CritScope, for serializing execution through a scope. -class SCOPED_LOCKABLE CritScope { - public: - explicit CritScope(CriticalSection* cs) EXCLUSIVE_LOCK_FUNCTION(cs); - ~CritScope() UNLOCK_FUNCTION(); - private: - CriticalSection* const cs_; - RTC_DISALLOW_COPY_AND_ASSIGN(CritScope); -}; - -// Tries to lock a critical section on construction via -// CriticalSection::TryEnter, and unlocks on destruction if the -// lock was taken. Never blocks. -// -// IMPORTANT: Unlike CritScope, the lock may not be owned by this thread in -// subsequent code. Users *must* check locked() to determine if the -// lock was taken. If you're not calling locked(), you're doing it wrong! -class TryCritScope { - public: - explicit TryCritScope(CriticalSection* cs); - ~TryCritScope(); -#if defined(WEBRTC_WIN) - _Check_return_ bool locked() const; -#else - bool locked() const __attribute__((warn_unused_result)); -#endif - private: - CriticalSection* const cs_; - const bool locked_; - CS_DEBUG_CODE(mutable bool lock_was_called_); - RTC_DISALLOW_COPY_AND_ASSIGN(TryCritScope); -}; - -// A POD lock used to protect global variables. Do NOT use for other purposes. -// No custom constructor or private data member should be added. -class LOCKABLE GlobalLockPod { - public: - void Lock() EXCLUSIVE_LOCK_FUNCTION(); - - void Unlock() UNLOCK_FUNCTION(); - - volatile int lock_acquired; -}; - -class GlobalLock : public GlobalLockPod { - public: - GlobalLock(); -}; - -// GlobalLockScope, for serializing execution through a scope. -class SCOPED_LOCKABLE GlobalLockScope { - public: - explicit GlobalLockScope(GlobalLockPod* lock) EXCLUSIVE_LOCK_FUNCTION(lock); - ~GlobalLockScope() UNLOCK_FUNCTION(); - private: - GlobalLockPod* const lock_; - RTC_DISALLOW_COPY_AND_ASSIGN(GlobalLockScope); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_CRITICALSECTION_H_ diff --git a/include/webrtc/base/cryptstring.h b/include/webrtc/base/cryptstring.h deleted file mode 100644 index a6bae51..0000000 --- a/include/webrtc/base/cryptstring.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef _WEBRTC_BASE_CRYPTSTRING_H_ -#define _WEBRTC_BASE_CRYPTSTRING_H_ - -#include - -#include -#include - -#include "webrtc/base/linked_ptr.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -class CryptStringImpl { -public: - virtual ~CryptStringImpl() {} - virtual size_t GetLength() const = 0; - virtual void CopyTo(char * dest, bool nullterminate) const = 0; - virtual std::string UrlEncode() const = 0; - virtual CryptStringImpl * Copy() const = 0; - virtual void CopyRawTo(std::vector * dest) const = 0; -}; - -class EmptyCryptStringImpl : public CryptStringImpl { -public: - ~EmptyCryptStringImpl() override {} - size_t GetLength() const override; - void CopyTo(char* dest, bool nullterminate) const override; - std::string UrlEncode() const override; - CryptStringImpl* Copy() const override; - void CopyRawTo(std::vector* dest) const override; -}; - -class CryptString { -public: - CryptString(); - size_t GetLength() const { return impl_->GetLength(); } - void CopyTo(char * dest, bool nullterminate) const { impl_->CopyTo(dest, nullterminate); } - CryptString(const CryptString& other); - explicit CryptString(const CryptStringImpl& impl); - ~CryptString(); - CryptString & operator=(const CryptString & other) { - if (this != &other) { - impl_.reset(other.impl_->Copy()); - } - return *this; - } - void Clear() { impl_.reset(new EmptyCryptStringImpl()); } - std::string UrlEncode() const { return impl_->UrlEncode(); } - void CopyRawTo(std::vector * dest) const { - return impl_->CopyRawTo(dest); - } - -private: - scoped_ptr impl_; -}; - - -// Used for constructing strings where a password is involved and we -// need to ensure that we zero memory afterwards -class FormatCryptString { -public: - FormatCryptString() { - storage_ = new char[32]; - capacity_ = 32; - length_ = 0; - storage_[0] = 0; - } - - void Append(const std::string & text) { - Append(text.data(), text.length()); - } - - void Append(const char * data, size_t length) { - EnsureStorage(length_ + length + 1); - memcpy(storage_ + length_, data, length); - length_ += length; - storage_[length_] = '\0'; - } - - void Append(const CryptString * password) { - size_t len = password->GetLength(); - EnsureStorage(length_ + len + 1); - password->CopyTo(storage_ + length_, true); - length_ += len; - } - - size_t GetLength() { - return length_; - } - - const char * GetData() { - return storage_; - } - - - // Ensures storage of at least n bytes - void EnsureStorage(size_t n) { - if (capacity_ >= n) { - return; - } - - size_t old_capacity = capacity_; - char * old_storage = storage_; - - for (;;) { - capacity_ *= 2; - if (capacity_ >= n) - break; - } - - storage_ = new char[capacity_]; - - if (old_capacity) { - memcpy(storage_, old_storage, length_); - - // zero memory in a way that an optimizer won't optimize it out - old_storage[0] = 0; - for (size_t i = 1; i < old_capacity; i++) { - old_storage[i] = old_storage[i - 1]; - } - delete[] old_storage; - } - } - - ~FormatCryptString() { - if (capacity_) { - storage_[0] = 0; - for (size_t i = 1; i < capacity_; i++) { - storage_[i] = storage_[i - 1]; - } - } - delete[] storage_; - } -private: - char * storage_; - size_t capacity_; - size_t length_; -}; - -class InsecureCryptStringImpl : public CryptStringImpl { - public: - std::string& password() { return password_; } - const std::string& password() const { return password_; } - - ~InsecureCryptStringImpl() override = default; - size_t GetLength() const override; - void CopyTo(char* dest, bool nullterminate) const override; - std::string UrlEncode() const override; - CryptStringImpl* Copy() const override; - void CopyRawTo(std::vector* dest) const override; - - private: - std::string password_; -}; - -} - -#endif // _WEBRTC_BASE_CRYPTSTRING_H_ diff --git a/include/webrtc/base/dbus.h b/include/webrtc/base/dbus.h deleted file mode 100644 index fb90638..0000000 --- a/include/webrtc/base/dbus.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_DBUS_H_ -#define WEBRTC_BASE_DBUS_H_ - -#ifdef HAVE_DBUS_GLIB - -#include - -#include -#include - -#include "webrtc/base/libdbusglibsymboltable.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -#define DBUS_TYPE "type" -#define DBUS_SIGNAL "signal" -#define DBUS_PATH "path" -#define DBUS_INTERFACE "interface" -#define DBUS_MEMBER "member" - -#ifdef CHROMEOS -#define CROS_PM_PATH "/" -#define CROS_PM_INTERFACE "org.chromium.PowerManager" -#define CROS_SIG_POWERCHANGED "PowerStateChanged" -#define CROS_VALUE_SLEEP "mem" -#define CROS_VALUE_RESUME "on" -#else -#define UP_PATH "/org/freedesktop/UPower" -#define UP_INTERFACE "org.freedesktop.UPower" -#define UP_SIG_SLEEPING "Sleeping" -#define UP_SIG_RESUMING "Resuming" -#endif // CHROMEOS - -// Wraps a DBus messages. -class DBusSigMessageData : public TypedMessageData { - public: - explicit DBusSigMessageData(DBusMessage *message); - ~DBusSigMessageData(); -}; - -// DBusSigFilter is an abstract class that defines the interface of DBus -// signal handling. -// The subclasses implement ProcessSignal() for various purposes. -// When a DBus signal comes, a DSM_SIGNAL message is posted to the caller thread -// which will then invokes ProcessSignal(). -class DBusSigFilter : protected MessageHandler { - public: - enum DBusSigMessage { DSM_SIGNAL }; - - // This filter string should ususally come from BuildFilterString() - explicit DBusSigFilter(const std::string &filter) - : caller_thread_(Thread::Current()), filter_(filter) { - } - - // Builds a DBus monitor filter string from given DBus path, interface, and - // member. - // See http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html - static std::string BuildFilterString(const std::string &path, - const std::string &interface, - const std::string &member); - - // Handles callback on DBus messages by DBus system. - static DBusHandlerResult DBusCallback(DBusConnection *dbus_conn, - DBusMessage *message, - void *instance); - - // Handles callback on DBus messages to each DBusSigFilter instance. - DBusHandlerResult Callback(DBusMessage *message); - - // From MessageHandler. - virtual void OnMessage(Message *message); - - // Returns the DBus monitor filter string. - const std::string &filter() const { return filter_; } - - private: - // On caller thread. - virtual void ProcessSignal(DBusMessage *message) = 0; - - Thread *caller_thread_; - const std::string filter_; -}; - -// DBusMonitor is a class for DBus signal monitoring. -// -// The caller-thread calls AddFilter() first to add the signals that it wants to -// monitor and then calls StartMonitoring() to start the monitoring. -// This will create a worker-thread which listens on DBus connection and sends -// DBus signals back through the callback. -// The worker-thread will be running forever until either StopMonitoring() is -// called from the caller-thread or the worker-thread hit some error. -// -// Programming model: -// 1. Caller-thread: Creates an object of DBusMonitor. -// 2. Caller-thread: Calls DBusMonitor::AddFilter() one or several times. -// 3. Caller-thread: StartMonitoring(). -// ... -// 4. Worker-thread: DBus signal recieved. Post a message to caller-thread. -// 5. Caller-thread: DBusFilterBase::ProcessSignal() is invoked. -// ... -// 6. Caller-thread: StopMonitoring(). -// -// Assumption: -// AddFilter(), StartMonitoring(), and StopMonitoring() methods are called by -// a single thread. Hence, there is no need to make them thread safe. -class DBusMonitor { - public: - // Status of DBus monitoring. - enum DBusMonitorStatus { - DMS_NOT_INITIALIZED, // Not initialized. - DMS_INITIALIZING, // Initializing the monitoring thread. - DMS_RUNNING, // Monitoring. - DMS_STOPPED, // Not monitoring. Stopped normally. - DMS_FAILED, // Not monitoring. Failed. - }; - - // Returns the DBus-Glib symbol table. - // We should only use this function to access DBus-Glib symbols. - static LibDBusGlibSymbolTable *GetDBusGlibSymbolTable(); - - // Creates an instance of DBusMonitor. - static DBusMonitor *Create(DBusBusType type); - ~DBusMonitor(); - - // Adds a filter to DBusMonitor. - bool AddFilter(DBusSigFilter *filter); - - // Starts DBus message monitoring. - bool StartMonitoring(); - - // Stops DBus message monitoring. - bool StopMonitoring(); - - // Gets the status of DBus monitoring. - DBusMonitorStatus GetStatus(); - - private: - // Forward declaration. Defined in the .cc file. - class DBusMonitoringThread; - - explicit DBusMonitor(DBusBusType type); - - // Updates status_ when monitoring status has changed. - void OnMonitoringStatusChanged(DBusMonitorStatus status); - - DBusBusType type_; - DBusMonitorStatus status_; - DBusMonitoringThread *monitoring_thread_; - std::vector filter_list_; -}; - -} // namespace rtc - -#endif // HAVE_DBUS_GLIB - -#endif // WEBRTC_BASE_DBUS_H_ diff --git a/include/webrtc/base/deprecation.h b/include/webrtc/base/deprecation.h deleted file mode 100644 index 459b898..0000000 --- a/include/webrtc/base/deprecation.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_DEPRECATION_H_ -#define WEBRTC_BASE_DEPRECATION_H_ - -// Annotate the declarations of deprecated functions with this to cause a -// compiler warning when they're used. Like so: -// -// RTC_DEPRECATED std::pony PonyPlz(const std::pony_spec& ps); -// -// NOTE 1: The annotation goes on the declaration in the .h file, not the -// definition in the .cc file! -// -// NOTE 2: In order to keep unit testing the deprecated function without -// getting warnings, do something like this: -// -// std::pony DEPRECATED_PonyPlz(const std::pony_spec& ps); -// RTC_DEPRECATED inline std::pony PonyPlz(const std::pony_spec& ps) { -// return DEPRECATED_PonyPlz(ps); -// } -// -// In other words, rename the existing function, and provide an inline wrapper -// using the original name that calls it. That way, callers who are willing to -// call it using the DEPRECATED_-prefixed name don't get the warning. -// -// TODO(kwiberg): Remove this when we can use [[deprecated]] from C++14. -#if defined(_MSC_VER) -// Note: Deprecation warnings seem to fail to trigger on Windows -// (https://bugs.chromium.org/p/webrtc/issues/detail?id=5368). -#define RTC_DEPRECATED __declspec(deprecated) -#elif defined(__GNUC__) -#define RTC_DEPRECATED __attribute__((deprecated)) -#else -#define RTC_DEPRECATED -#endif - -#endif // WEBRTC_BASE_DEPRECATION_H_ diff --git a/include/webrtc/base/diskcache.h b/include/webrtc/base/diskcache.h deleted file mode 100644 index 4ac1be1..0000000 --- a/include/webrtc/base/diskcache.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_DISKCACHE_H__ -#define WEBRTC_BASE_DISKCACHE_H__ - -#include -#include - -#if defined(WEBRTC_WIN) -#undef UnlockResource -#endif // WEBRTC_WIN - -namespace rtc { - -class StreamInterface; - -/////////////////////////////////////////////////////////////////////////////// -// DiskCache - An LRU cache of streams, stored on disk. -// -// Streams are identified by a unique resource id. Multiple streams can be -// associated with each resource id, distinguished by an index. When old -// resources are flushed from the cache, all streams associated with those -// resources are removed together. -// DiskCache is designed to persist across executions of the program. It is -// safe for use from an arbitrary number of users on a single thread, but not -// from multiple threads or other processes. -/////////////////////////////////////////////////////////////////////////////// - -class DiskCache { -public: - DiskCache(); - virtual ~DiskCache(); - - bool Initialize(const std::string& folder, size_t size); - bool Purge(); - - bool LockResource(const std::string& id); - StreamInterface* WriteResource(const std::string& id, size_t index); - bool UnlockResource(const std::string& id); - - StreamInterface* ReadResource(const std::string& id, size_t index) const; - - bool HasResource(const std::string& id) const; - bool HasResourceStream(const std::string& id, size_t index) const; - bool DeleteResource(const std::string& id); - - protected: - virtual bool InitializeEntries() = 0; - virtual bool PurgeFiles() = 0; - - virtual bool FileExists(const std::string& filename) const = 0; - virtual bool DeleteFile(const std::string& filename) const = 0; - - enum LockState { LS_UNLOCKED, LS_LOCKED, LS_UNLOCKING }; - struct Entry { - LockState lock_state; - mutable size_t accessors; - size_t size; - size_t streams; - time_t last_modified; - }; - typedef std::map EntryMap; - friend class DiskCacheAdapter; - - bool CheckLimit(); - - std::string IdToFilename(const std::string& id, size_t index) const; - bool FilenameToId(const std::string& filename, std::string* id, - size_t* index) const; - - const Entry* GetEntry(const std::string& id) const { - return const_cast(this)->GetOrCreateEntry(id, false); - } - Entry* GetOrCreateEntry(const std::string& id, bool create); - - void ReleaseResource(const std::string& id, size_t index) const; - - std::string folder_; - size_t max_cache_, total_size_; - EntryMap map_; - mutable size_t total_accessors_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// CacheLock - Automatically manage locking and unlocking, with optional -// rollback semantics -/////////////////////////////////////////////////////////////////////////////// - -class CacheLock { -public: - CacheLock(DiskCache* cache, const std::string& id, bool rollback = false) - : cache_(cache), id_(id), rollback_(rollback) - { - locked_ = cache_->LockResource(id_); - } - ~CacheLock() { - if (locked_) { - cache_->UnlockResource(id_); - if (rollback_) { - cache_->DeleteResource(id_); - } - } - } - bool IsLocked() const { return locked_; } - void Commit() { rollback_ = false; } - -private: - DiskCache* cache_; - std::string id_; - bool rollback_, locked_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_DISKCACHE_H__ diff --git a/include/webrtc/base/diskcache_win32.h b/include/webrtc/base/diskcache_win32.h deleted file mode 100644 index 42cb9b0..0000000 --- a/include/webrtc/base/diskcache_win32.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2006 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_DISKCACHEWIN32_H__ -#define WEBRTC_BASE_DISKCACHEWIN32_H__ - -#include "webrtc/base/diskcache.h" - -namespace rtc { - -class DiskCacheWin32 : public DiskCache { - protected: - virtual bool InitializeEntries(); - virtual bool PurgeFiles(); - - virtual bool FileExists(const std::string& filename) const; - virtual bool DeleteFile(const std::string& filename) const; -}; - -} - -#endif // WEBRTC_BASE_DISKCACHEWIN32_H__ diff --git a/include/webrtc/base/dscp.h b/include/webrtc/base/dscp.h deleted file mode 100644 index 970ff93..0000000 --- a/include/webrtc/base/dscp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2013 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_DSCP_H_ -#define WEBRTC_BASE_DSCP_H_ - -namespace rtc { -// Differentiated Services Code Point. -// See http://tools.ietf.org/html/rfc2474 for details. -enum DiffServCodePoint { - DSCP_NO_CHANGE = -1, - DSCP_DEFAULT = 0, // Same as DSCP_CS0 - DSCP_CS0 = 0, // The default - DSCP_CS1 = 8, // Bulk/background traffic - DSCP_AF11 = 10, - DSCP_AF12 = 12, - DSCP_AF13 = 14, - DSCP_CS2 = 16, - DSCP_AF21 = 18, - DSCP_AF22 = 20, - DSCP_AF23 = 22, - DSCP_CS3 = 24, - DSCP_AF31 = 26, - DSCP_AF32 = 28, - DSCP_AF33 = 30, - DSCP_CS4 = 32, - DSCP_AF41 = 34, // Video - DSCP_AF42 = 36, // Video - DSCP_AF43 = 38, // Video - DSCP_CS5 = 40, // Video - DSCP_EF = 46, // Voice - DSCP_CS6 = 48, // Voice - DSCP_CS7 = 56, // Control messages -}; - -} // namespace rtc - - #endif // WEBRTC_BASE_DSCP_H_ diff --git a/include/webrtc/base/event.h b/include/webrtc/base/event.h deleted file mode 100644 index 5237151..0000000 --- a/include/webrtc/base/event.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_EVENT_H__ -#define WEBRTC_BASE_EVENT_H__ - -#if defined(WEBRTC_WIN) -#include "webrtc/base/win32.h" // NOLINT: consider this a system header. -#elif defined(WEBRTC_POSIX) -#include -#else -#error "Must define either WEBRTC_WIN or WEBRTC_POSIX." -#endif - -#include "webrtc/base/basictypes.h" - -namespace rtc { - -class Event { - public: - static const int kForever = -1; - - Event(bool manual_reset, bool initially_signaled); - ~Event(); - - void Set(); - void Reset(); - - // Wait for the event to become signaled, for the specified number of - // |milliseconds|. To wait indefinetly, pass kForever. - bool Wait(int milliseconds); - - private: -#if defined(WEBRTC_WIN) - HANDLE event_handle_; -#elif defined(WEBRTC_POSIX) - pthread_mutex_t event_mutex_; - pthread_cond_t event_cond_; - const bool is_manual_reset_; - bool event_status_; -#endif -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_EVENT_H__ diff --git a/include/webrtc/base/event_tracer.h b/include/webrtc/base/event_tracer.h deleted file mode 100644 index 51c8cfd..0000000 --- a/include/webrtc/base/event_tracer.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This file defines the interface for event tracing in WebRTC. -// -// Event log handlers are set through SetupEventTracer(). User of this API will -// provide two function pointers to handle event tracing calls. -// -// * GetCategoryEnabledPtr -// Event tracing system calls this function to determine if a particular -// event category is enabled. -// -// * AddTraceEventPtr -// Adds a tracing event. It is the user's responsibility to log the data -// provided. -// -// Parameters for the above two functions are described in trace_event.h. - -#ifndef WEBRTC_BASE_EVENT_TRACER_H_ -#define WEBRTC_BASE_EVENT_TRACER_H_ - -#include - -namespace webrtc { - -typedef const unsigned char* (*GetCategoryEnabledPtr)(const char* name); -typedef void (*AddTraceEventPtr)(char phase, - const unsigned char* category_enabled, - const char* name, - unsigned long long id, - int num_args, - const char** arg_names, - const unsigned char* arg_types, - const unsigned long long* arg_values, - unsigned char flags); - -// User of WebRTC can call this method to setup event tracing. -// -// This method must be called before any WebRTC methods. Functions -// provided should be thread-safe. -void SetupEventTracer( - GetCategoryEnabledPtr get_category_enabled_ptr, - AddTraceEventPtr add_trace_event_ptr); - -// This class defines interface for the event tracing system to call -// internally. Do not call these methods directly. -class EventTracer { - public: - static const unsigned char* GetCategoryEnabled( - const char* name); - - static void AddTraceEvent( - char phase, - const unsigned char* category_enabled, - const char* name, - unsigned long long id, - int num_args, - const char** arg_names, - const unsigned char* arg_types, - const unsigned long long* arg_values, - unsigned char flags); -}; - -} // namespace webrtc - -namespace rtc { -namespace tracing { -// Set up internal event tracer. -void SetupInternalTracer(); -bool StartInternalCapture(const char* filename); -void StartInternalCaptureToFile(FILE* file); -void StopInternalCapture(); -// Make sure we run this, this will tear down the internal tracing. -void ShutdownInternalTracer(); -} // namespace tracing -} // namespace rtc - -#endif // WEBRTC_BASE_EVENT_TRACER_H_ diff --git a/include/webrtc/base/exp_filter.h b/include/webrtc/base/exp_filter.h deleted file mode 100644 index 174159b..0000000 --- a/include/webrtc/base/exp_filter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_EXP_FILTER_H_ -#define WEBRTC_BASE_EXP_FILTER_H_ - -namespace rtc { - -// This class can be used, for example, for smoothing the result of bandwidth -// estimation and packet loss estimation. - -class ExpFilter { - public: - static const float kValueUndefined; - - explicit ExpFilter(float alpha, float max = kValueUndefined) - : max_(max) { - Reset(alpha); - } - - // Resets the filter to its initial state, and resets filter factor base to - // the given value |alpha|. - void Reset(float alpha); - - // Applies the filter with a given exponent on the provided sample: - // y(k) = min(alpha_^ exp * y(k-1) + (1 - alpha_^ exp) * sample, max_). - float Apply(float exp, float sample); - - // Returns current filtered value. - float filtered() const { return filtered_; } - - // Changes the filter factor base to the given value |alpha|. - void UpdateBase(float alpha); - - private: - float alpha_; // Filter factor base. - float filtered_; // Current filter output. - const float max_; -}; -} // namespace rtc - -#endif // WEBRTC_BASE_EXP_FILTER_H_ diff --git a/include/webrtc/base/fakenetwork.h b/include/webrtc/base/fakenetwork.h deleted file mode 100644 index 4d98c6c..0000000 --- a/include/webrtc/base/fakenetwork.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2009 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FAKENETWORK_H_ -#define WEBRTC_BASE_FAKENETWORK_H_ - -#include -#include - -#include "webrtc/base/network.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/stringencode.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -const int kFakeIPv4NetworkPrefixLength = 24; -const int kFakeIPv6NetworkPrefixLength = 64; - -// Fake network manager that allows us to manually specify the IPs to use. -class FakeNetworkManager : public NetworkManagerBase, - public MessageHandler { - public: - FakeNetworkManager() : thread_(Thread::Current()) {} - - typedef std::vector IfaceList; - - void AddInterface(const SocketAddress& iface) { - // Ensure a unique name for the interface if its name is not given. - AddInterface(iface, "test" + rtc::ToString(next_index_++)); - } - - void AddInterface(const SocketAddress& iface, const std::string& if_name) { - SocketAddress address(if_name, 0); - address.SetResolvedIP(iface.ipaddr()); - ifaces_.push_back(address); - DoUpdateNetworks(); - } - - void RemoveInterface(const SocketAddress& iface) { - for (IfaceList::iterator it = ifaces_.begin(); - it != ifaces_.end(); ++it) { - if (it->EqualIPs(iface)) { - ifaces_.erase(it); - break; - } - } - DoUpdateNetworks(); - } - - virtual void StartUpdating() { - ++start_count_; - if (start_count_ == 1) { - sent_first_update_ = false; - thread_->Post(this); - } else { - if (sent_first_update_) { - SignalNetworksChanged(); - } - } - } - - virtual void StopUpdating() { --start_count_; } - - // MessageHandler interface. - virtual void OnMessage(Message* msg) { - DoUpdateNetworks(); - } - - using NetworkManagerBase::set_enumeration_permission; - using NetworkManagerBase::set_default_local_addresses; - - private: - void DoUpdateNetworks() { - if (start_count_ == 0) - return; - std::vector networks; - for (IfaceList::iterator it = ifaces_.begin(); - it != ifaces_.end(); ++it) { - int prefix_length = 0; - if (it->ipaddr().family() == AF_INET) { - prefix_length = kFakeIPv4NetworkPrefixLength; - } else if (it->ipaddr().family() == AF_INET6) { - prefix_length = kFakeIPv6NetworkPrefixLength; - } - IPAddress prefix = TruncateIP(it->ipaddr(), prefix_length); - scoped_ptr net(new Network(it->hostname(), - it->hostname(), - prefix, - prefix_length)); - net->set_default_local_address_provider(this); - net->AddIP(it->ipaddr()); - networks.push_back(net.release()); - } - bool changed; - MergeNetworkList(networks, &changed); - if (changed || !sent_first_update_) { - SignalNetworksChanged(); - sent_first_update_ = true; - } - } - - Thread* thread_; - IfaceList ifaces_; - int next_index_ = 0; - int start_count_ = 0; - bool sent_first_update_ = false; - - IPAddress default_local_ipv4_address_; - IPAddress default_local_ipv6_address_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_FAKENETWORK_H_ diff --git a/include/webrtc/base/fakesslidentity.h b/include/webrtc/base/fakesslidentity.h deleted file mode 100644 index ec603a5..0000000 --- a/include/webrtc/base/fakesslidentity.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FAKESSLIDENTITY_H_ -#define WEBRTC_BASE_FAKESSLIDENTITY_H_ - -#include -#include - -#include "webrtc/base/common.h" -#include "webrtc/base/messagedigest.h" -#include "webrtc/base/sslidentity.h" - -namespace rtc { - -class FakeSSLCertificate : public rtc::SSLCertificate { - public: - // SHA-1 is the default digest algorithm because it is available in all build - // configurations used for unit testing. - explicit FakeSSLCertificate(const std::string& data) - : data_(data), digest_algorithm_(DIGEST_SHA_1), expiration_time_(-1) {} - explicit FakeSSLCertificate(const std::vector& certs) - : data_(certs.front()), - digest_algorithm_(DIGEST_SHA_1), - expiration_time_(-1) { - std::vector::const_iterator it; - // Skip certs[0]. - for (it = certs.begin() + 1; it != certs.end(); ++it) { - certs_.push_back(FakeSSLCertificate(*it)); - } - } - virtual FakeSSLCertificate* GetReference() const { - return new FakeSSLCertificate(*this); - } - virtual std::string ToPEMString() const { - return data_; - } - virtual void ToDER(Buffer* der_buffer) const { - std::string der_string; - VERIFY(SSLIdentity::PemToDer(kPemTypeCertificate, data_, &der_string)); - der_buffer->SetData(der_string.c_str(), der_string.size()); - } - int64_t CertificateExpirationTime() const override { - return expiration_time_; - } - void SetCertificateExpirationTime(int64_t expiration_time) { - expiration_time_ = expiration_time; - } - void set_digest_algorithm(const std::string& algorithm) { - digest_algorithm_ = algorithm; - } - virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const { - *algorithm = digest_algorithm_; - return true; - } - virtual bool ComputeDigest(const std::string& algorithm, - unsigned char* digest, - size_t size, - size_t* length) const { - *length = rtc::ComputeDigest(algorithm, data_.c_str(), data_.size(), - digest, size); - return (*length != 0); - } - virtual bool GetChain(SSLCertChain** chain) const { - if (certs_.empty()) - return false; - std::vector new_certs(certs_.size()); - std::transform(certs_.begin(), certs_.end(), new_certs.begin(), DupCert); - *chain = new SSLCertChain(new_certs); - std::for_each(new_certs.begin(), new_certs.end(), DeleteCert); - return true; - } - - private: - static FakeSSLCertificate* DupCert(FakeSSLCertificate cert) { - return cert.GetReference(); - } - static void DeleteCert(SSLCertificate* cert) { delete cert; } - std::string data_; - std::vector certs_; - std::string digest_algorithm_; - // Expiration time in seconds relative to epoch, 1970-01-01T00:00:00Z (UTC). - int64_t expiration_time_; -}; - -class FakeSSLIdentity : public rtc::SSLIdentity { - public: - explicit FakeSSLIdentity(const std::string& data) : cert_(data) {} - explicit FakeSSLIdentity(const FakeSSLCertificate& cert) : cert_(cert) {} - virtual FakeSSLIdentity* GetReference() const { - return new FakeSSLIdentity(*this); - } - virtual const FakeSSLCertificate& certificate() const { return cert_; } - private: - FakeSSLCertificate cert_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_FAKESSLIDENTITY_H_ diff --git a/include/webrtc/base/faketaskrunner.h b/include/webrtc/base/faketaskrunner.h deleted file mode 100644 index 88e4826..0000000 --- a/include/webrtc/base/faketaskrunner.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// A fake TaskRunner for use in unit tests. - -#ifndef WEBRTC_BASE_FAKETASKRUNNER_H_ -#define WEBRTC_BASE_FAKETASKRUNNER_H_ - -#include "webrtc/base/taskparent.h" -#include "webrtc/base/taskrunner.h" - -namespace rtc { - -class FakeTaskRunner : public TaskRunner { - public: - FakeTaskRunner() : current_time_(0) {} - virtual ~FakeTaskRunner() {} - - virtual void WakeTasks() { RunTasks(); } - - virtual int64_t CurrentTime() { - // Implement if needed. - return current_time_++; - } - - int64_t current_time_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_FAKETASKRUNNER_H_ diff --git a/include/webrtc/base/filerotatingstream.h b/include/webrtc/base/filerotatingstream.h deleted file mode 100644 index 9e8e35d..0000000 --- a/include/webrtc/base/filerotatingstream.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FILEROTATINGSTREAM_H_ -#define WEBRTC_BASE_FILEROTATINGSTREAM_H_ - -#include -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -// FileRotatingStream writes to a file in the directory specified in the -// constructor. It rotates the files once the current file is full. The -// individual file size and the number of files used is configurable in the -// constructor. Open() must be called before using this stream. -class FileRotatingStream : public StreamInterface { - public: - // Use this constructor for reading a directory previously written to with - // this stream. - FileRotatingStream(const std::string& dir_path, - const std::string& file_prefix); - - // Use this constructor for writing to a directory. Files in the directory - // matching the prefix will be deleted on open. - FileRotatingStream(const std::string& dir_path, - const std::string& file_prefix, - size_t max_file_size, - size_t num_files); - - ~FileRotatingStream() override; - - // StreamInterface methods. - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - bool Flush() override; - // Returns the total file size currently used on disk. - bool GetSize(size_t* size) const override; - void Close() override; - - // Opens the appropriate file(s). Call this before using the stream. - bool Open(); - - // Disabling buffering causes writes to block until disk is updated. This is - // enabled by default for performance. - bool DisableBuffering(); - - // Returns the path used for the i-th newest file, where the 0th file is the - // newest file. The file may or may not exist, this is just used for - // formatting. Index must be less than GetNumFiles(). - std::string GetFilePath(size_t index) const; - - // Returns the number of files that will used by this stream. - size_t GetNumFiles() { return file_names_.size(); } - - protected: - size_t GetMaxFileSize() const { return max_file_size_; } - - void SetMaxFileSize(size_t size) { max_file_size_ = size; } - - size_t GetRotationIndex() const { return rotation_index_; } - - void SetRotationIndex(size_t index) { rotation_index_ = index; } - - virtual void OnRotation() {} - - private: - enum Mode { kRead, kWrite }; - - FileRotatingStream(const std::string& dir_path, - const std::string& file_prefix, - size_t max_file_size, - size_t num_files, - Mode mode); - - bool OpenCurrentFile(); - void CloseCurrentFile(); - - // Rotates the files by creating a new current file, renaming the - // existing files, and deleting the oldest one. e.g. - // file_0 -> file_1 - // file_1 -> file_2 - // file_2 -> delete - // create new file_0 - void RotateFiles(); - - // Returns a list of file names in the directory beginning with the prefix. - std::vector GetFilesWithPrefix() const; - // Private version of GetFilePath. - std::string GetFilePath(size_t index, size_t num_files) const; - - const std::string dir_path_; - const std::string file_prefix_; - const Mode mode_; - - // FileStream is used to write to the current file. - scoped_ptr file_stream_; - // Convenience storage for file names so we don't generate them over and over. - std::vector file_names_; - size_t max_file_size_; - size_t current_file_index_; - // The rotation index indicates the index of the file that will be - // deleted first on rotation. Indices lower than this index will be rotated. - size_t rotation_index_; - // Number of bytes written to current file. We need this because with - // buffering the file size read from disk might not be accurate. - size_t current_bytes_written_; - bool disable_buffering_; - - RTC_DISALLOW_COPY_AND_ASSIGN(FileRotatingStream); -}; - -// CallSessionFileRotatingStream is meant to be used in situations where we will -// have limited disk space. Its purpose is to read and write logs up to a -// maximum size. Once the maximum size is exceeded, logs from the middle are -// deleted whereas logs from the beginning and end are preserved. The reason for -// this is because we anticipate that in WebRTC the beginning and end of the -// logs are most useful for call diagnostics. -// -// This implementation simply writes to a single file until -// |max_total_log_size| / 2 bytes are written to it, and subsequently writes to -// a set of rotating files. We do this by inheriting FileRotatingStream and -// setting the appropriate internal variables so that we don't delete the last -// (earliest) file on rotate, and that that file's size is bigger. -// -// Open() must be called before using this stream. -class CallSessionFileRotatingStream : public FileRotatingStream { - public: - // Use this constructor for reading a directory previously written to with - // this stream. - explicit CallSessionFileRotatingStream(const std::string& dir_path); - // Use this constructor for writing to a directory. Files in the directory - // matching what's used by the stream will be deleted. |max_total_log_size| - // must be at least 4. - CallSessionFileRotatingStream(const std::string& dir_path, - size_t max_total_log_size); - ~CallSessionFileRotatingStream() override {} - - protected: - void OnRotation() override; - - private: - static size_t GetRotatingLogSize(size_t max_total_log_size); - static size_t GetNumRotatingLogFiles(size_t max_total_log_size); - static const char* kLogPrefix; - static const size_t kRotatingLogFileDefaultSize; - - const size_t max_total_log_size_; - size_t num_rotations_; - - RTC_DISALLOW_COPY_AND_ASSIGN(CallSessionFileRotatingStream); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_FILEROTATINGSTREAM_H_ diff --git a/include/webrtc/base/fileutils.h b/include/webrtc/base/fileutils.h deleted file mode 100644 index bf02571..0000000 --- a/include/webrtc/base/fileutils.h +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FILEUTILS_H_ -#define WEBRTC_BASE_FILEUTILS_H_ - -#include - -#if !defined(WEBRTC_WIN) -#include -#include -#include -#include -#include -#endif - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/common.h" -#include "webrtc/base/platform_file.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -class FileStream; -class Pathname; - -////////////////////////// -// Directory Iterator // -////////////////////////// - -// A DirectoryIterator is created with a given directory. It originally points -// to the first file in the directory, and can be advanecd with Next(). This -// allows you to get information about each file. - -class DirectoryIterator { - friend class Filesystem; - public: - // Constructor - DirectoryIterator(); - // Destructor - virtual ~DirectoryIterator(); - - // Starts traversing a directory - // dir is the directory to traverse - // returns true if the directory exists and is valid - // The iterator will point to the first entry in the directory - virtual bool Iterate(const Pathname &path); - - // Advances to the next file - // returns true if there were more files in the directory. - virtual bool Next(); - - // returns true if the file currently pointed to is a directory - virtual bool IsDirectory() const; - - // returns the name of the file currently pointed to - virtual std::string Name() const; - - // returns the size of the file currently pointed to - virtual size_t FileSize() const; - - // returns true if the file is older than seconds - virtual bool OlderThan(int seconds) const; - - // checks whether current file is a special directory file "." or ".." - bool IsDots() const { - std::string filename(Name()); - return (filename.compare(".") == 0) || (filename.compare("..") == 0); - } - - private: - std::string directory_; -#if defined(WEBRTC_WIN) - WIN32_FIND_DATA data_; - HANDLE handle_; -#else - DIR *dir_; - struct dirent *dirent_; - struct stat stat_; -#endif -}; - -enum FileTimeType { FTT_CREATED, FTT_MODIFIED, FTT_ACCESSED }; - -class FilesystemInterface { - public: - virtual ~FilesystemInterface() {} - - // Returns a DirectoryIterator for a given pathname. - // TODO: Do fancy abstracted stuff - virtual DirectoryIterator* IterateDirectory(); - - // Opens a file. Returns an open StreamInterface if function succeeds. - // Otherwise, returns NULL. - // TODO: Add an error param to indicate failure reason, similar to - // FileStream::Open - virtual FileStream *OpenFile(const Pathname &filename, - const std::string &mode) = 0; - - // Atomically creates an empty file accessible only to the current user if one - // does not already exist at the given path, otherwise fails. This is the only - // secure way to create a file in a shared temp directory (e.g., C:\Temp on - // Windows or /tmp on Linux). - // Note that if it is essential that a file be successfully created then the - // app must generate random names and retry on failure, or else it will be - // vulnerable to a trivial DoS. - virtual bool CreatePrivateFile(const Pathname &filename) = 0; - - // This will attempt to delete the path located at filename. - // It ASSERTS and returns false if the path points to a folder or a - // non-existent file. - virtual bool DeleteFile(const Pathname &filename) = 0; - - // This will attempt to delete the empty folder located at 'folder' - // It ASSERTS and returns false if the path points to a file or a non-existent - // folder. It fails normally if the folder is not empty or can otherwise - // not be deleted. - virtual bool DeleteEmptyFolder(const Pathname &folder) = 0; - - // This will call IterateDirectory, to get a directory iterator, and then - // call DeleteFolderAndContents and DeleteFile on every path contained in this - // folder. If the folder is empty, this returns true. - virtual bool DeleteFolderContents(const Pathname &folder); - - // This deletes the contents of a folder, recursively, and then deletes - // the folder itself. - virtual bool DeleteFolderAndContents(const Pathname& folder); - - // This will delete whatever is located at path, be it a file or a folder. - // If it is a folder, it will delete it recursively by calling - // DeleteFolderAndContents - bool DeleteFileOrFolder(const Pathname &path) { - if (IsFolder(path)) - return DeleteFolderAndContents(path); - else - return DeleteFile(path); - } - - // Creates a directory. This will call itself recursively to create /foo/bar - // even if /foo does not exist. Returns true if the function succeeds. - virtual bool CreateFolder(const Pathname &pathname) = 0; - - // This moves a file from old_path to new_path, where "old_path" is a - // plain file. This ASSERTs and returns false if old_path points to a - // directory, and returns true if the function succeeds. - // If the new path is on a different volume than the old path, this function - // will attempt to copy and, if that succeeds, delete the old path. - virtual bool MoveFolder(const Pathname &old_path, - const Pathname &new_path) = 0; - - // This moves a directory from old_path to new_path, where "old_path" is a - // directory. This ASSERTs and returns false if old_path points to a plain - // file, and returns true if the function succeeds. - // If the new path is on a different volume, this function will attempt to - // copy and if that succeeds, delete the old path. - virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path) = 0; - - // This attempts to move whatever is located at old_path to new_path, - // be it a file or folder. - bool MoveFileOrFolder(const Pathname &old_path, const Pathname &new_path) { - if (IsFile(old_path)) { - return MoveFile(old_path, new_path); - } else { - return MoveFolder(old_path, new_path); - } - } - - // This copies a file from old_path to new_path. This method ASSERTs and - // returns false if old_path is a folder, and returns true if the copy - // succeeds. - virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path) = 0; - - // This copies a folder from old_path to new_path. - bool CopyFolder(const Pathname &old_path, const Pathname &new_path); - - bool CopyFileOrFolder(const Pathname &old_path, const Pathname &new_path) { - if (IsFile(old_path)) - return CopyFile(old_path, new_path); - else - return CopyFolder(old_path, new_path); - } - - // Returns true if pathname refers to a directory - virtual bool IsFolder(const Pathname& pathname) = 0; - - // Returns true if pathname refers to a file - virtual bool IsFile(const Pathname& pathname) = 0; - - // Returns true if pathname refers to no filesystem object, every parent - // directory either exists, or is also absent. - virtual bool IsAbsent(const Pathname& pathname) = 0; - - // Returns true if pathname represents a temporary location on the system. - virtual bool IsTemporaryPath(const Pathname& pathname) = 0; - - // A folder appropriate for storing temporary files (Contents are - // automatically deleted when the program exits) - virtual bool GetTemporaryFolder(Pathname &path, bool create, - const std::string *append) = 0; - - virtual std::string TempFilename(const Pathname &dir, - const std::string &prefix) = 0; - - // Determines the size of the file indicated by path. - virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; - - // Determines a timestamp associated with the file indicated by path. - virtual bool GetFileTime(const Pathname& path, FileTimeType which, - time_t* time) = 0; - - // Returns the path to the running application. - // Note: This is not guaranteed to work on all platforms. Be aware of the - // limitations before using it, and robustly handle failure. - virtual bool GetAppPathname(Pathname* path) = 0; - - // Get a folder that is unique to the current application, which is suitable - // for sharing data between executions of the app. If the per_user arg is - // true, the folder is also specific to the current user. - virtual bool GetAppDataFolder(Pathname* path, bool per_user) = 0; - - // Get a temporary folder that is unique to the current user and application. - // TODO: Re-evaluate the goals of this function. We probably just need any - // directory that won't collide with another existing directory, and which - // will be cleaned up when the program exits. - virtual bool GetAppTempFolder(Pathname* path) = 0; - - // Delete the contents of the folder returned by GetAppTempFolder - bool CleanAppTempFolder(); - - virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) = 0; - - // Returns the absolute path of the current directory. - virtual Pathname GetCurrentDirectory() = 0; - - // Note: These might go into some shared config section later, but they're - // used by some methods in this interface, so we're leaving them here for now. - void SetOrganizationName(const std::string& organization) { - organization_name_ = organization; - } - void GetOrganizationName(std::string* organization) { - ASSERT(NULL != organization); - *organization = organization_name_; - } - void SetApplicationName(const std::string& application) { - application_name_ = application; - } - void GetApplicationName(std::string* application) { - ASSERT(NULL != application); - *application = application_name_; - } - - protected: - std::string organization_name_; - std::string application_name_; -}; - -class Filesystem { - public: - static FilesystemInterface *default_filesystem() { - ASSERT(default_filesystem_ != NULL); - return default_filesystem_; - } - - static void set_default_filesystem(FilesystemInterface *filesystem) { - default_filesystem_ = filesystem; - } - - static FilesystemInterface *swap_default_filesystem( - FilesystemInterface *filesystem) { - FilesystemInterface *cur = default_filesystem_; - default_filesystem_ = filesystem; - return cur; - } - - static DirectoryIterator *IterateDirectory() { - return EnsureDefaultFilesystem()->IterateDirectory(); - } - - static bool CreateFolder(const Pathname &pathname) { - return EnsureDefaultFilesystem()->CreateFolder(pathname); - } - - static FileStream *OpenFile(const Pathname &filename, - const std::string &mode) { - return EnsureDefaultFilesystem()->OpenFile(filename, mode); - } - - static bool CreatePrivateFile(const Pathname &filename) { - return EnsureDefaultFilesystem()->CreatePrivateFile(filename); - } - - static bool DeleteFile(const Pathname &filename) { - return EnsureDefaultFilesystem()->DeleteFile(filename); - } - - static bool DeleteEmptyFolder(const Pathname &folder) { - return EnsureDefaultFilesystem()->DeleteEmptyFolder(folder); - } - - static bool DeleteFolderContents(const Pathname &folder) { - return EnsureDefaultFilesystem()->DeleteFolderContents(folder); - } - - static bool DeleteFolderAndContents(const Pathname &folder) { - return EnsureDefaultFilesystem()->DeleteFolderAndContents(folder); - } - - static bool MoveFolder(const Pathname &old_path, const Pathname &new_path) { - return EnsureDefaultFilesystem()->MoveFolder(old_path, new_path); - } - - static bool MoveFile(const Pathname &old_path, const Pathname &new_path) { - return EnsureDefaultFilesystem()->MoveFile(old_path, new_path); - } - - static bool CopyFolder(const Pathname &old_path, const Pathname &new_path) { - return EnsureDefaultFilesystem()->CopyFolder(old_path, new_path); - } - - static bool CopyFile(const Pathname &old_path, const Pathname &new_path) { - return EnsureDefaultFilesystem()->CopyFile(old_path, new_path); - } - - static bool IsFolder(const Pathname& pathname) { - return EnsureDefaultFilesystem()->IsFolder(pathname); - } - - static bool IsFile(const Pathname &pathname) { - return EnsureDefaultFilesystem()->IsFile(pathname); - } - - static bool IsAbsent(const Pathname &pathname) { - return EnsureDefaultFilesystem()->IsAbsent(pathname); - } - - static bool IsTemporaryPath(const Pathname& pathname) { - return EnsureDefaultFilesystem()->IsTemporaryPath(pathname); - } - - static bool GetTemporaryFolder(Pathname &path, bool create, - const std::string *append) { - return EnsureDefaultFilesystem()->GetTemporaryFolder(path, create, append); - } - - static std::string TempFilename(const Pathname &dir, - const std::string &prefix) { - return EnsureDefaultFilesystem()->TempFilename(dir, prefix); - } - - static bool GetFileSize(const Pathname& path, size_t* size) { - return EnsureDefaultFilesystem()->GetFileSize(path, size); - } - - static bool GetFileTime(const Pathname& path, FileTimeType which, - time_t* time) { - return EnsureDefaultFilesystem()->GetFileTime(path, which, time); - } - - static bool GetAppPathname(Pathname* path) { - return EnsureDefaultFilesystem()->GetAppPathname(path); - } - - static bool GetAppDataFolder(Pathname* path, bool per_user) { - return EnsureDefaultFilesystem()->GetAppDataFolder(path, per_user); - } - - static bool GetAppTempFolder(Pathname* path) { - return EnsureDefaultFilesystem()->GetAppTempFolder(path); - } - - static bool CleanAppTempFolder() { - return EnsureDefaultFilesystem()->CleanAppTempFolder(); - } - - static bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) { - return EnsureDefaultFilesystem()->GetDiskFreeSpace(path, freebytes); - } - - // Definition has to be in the .cc file due to returning forward-declared - // Pathname by value. - static Pathname GetCurrentDirectory(); - - static void SetOrganizationName(const std::string& organization) { - EnsureDefaultFilesystem()->SetOrganizationName(organization); - } - - static void GetOrganizationName(std::string* organization) { - EnsureDefaultFilesystem()->GetOrganizationName(organization); - } - - static void SetApplicationName(const std::string& application) { - EnsureDefaultFilesystem()->SetApplicationName(application); - } - - static void GetApplicationName(std::string* application) { - EnsureDefaultFilesystem()->GetApplicationName(application); - } - - private: - static FilesystemInterface* default_filesystem_; - - static FilesystemInterface *EnsureDefaultFilesystem(); - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); -}; - -class FilesystemScope{ - public: - explicit FilesystemScope(FilesystemInterface *new_fs) { - old_fs_ = Filesystem::swap_default_filesystem(new_fs); - } - ~FilesystemScope() { - Filesystem::set_default_filesystem(old_fs_); - } - private: - FilesystemInterface* old_fs_; - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); -}; - -// Generates a unique filename based on the input path. If no path component -// is specified, it uses the temporary directory. If a filename is provided, -// up to 100 variations of form basename-N.extension are tried. When -// create_empty is true, an empty file of this name is created (which -// decreases the chance of a temporary filename collision with another -// process). -bool CreateUniqueFile(Pathname& path, bool create_empty); - -} // namespace rtc - -#endif // WEBRTC_BASE_FILEUTILS_H_ diff --git a/include/webrtc/base/fileutils_mock.h b/include/webrtc/base/fileutils_mock.h deleted file mode 100644 index 428d444..0000000 --- a/include/webrtc/base/fileutils_mock.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FILEUTILS_MOCK_H_ -#define WEBRTC_BASE_FILEUTILS_MOCK_H_ - -#include -#include -#include - -#include "webrtc/base/fileutils.h" -#include "webrtc/base/gunit.h" -#include "webrtc/base/pathutils.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -class FakeFileStream : public FileStream { - public: - explicit FakeFileStream(const std::string & contents) : - string_stream_(contents) - {} - - virtual StreamResult Read(void* buffer, size_t buffer_len, - size_t* read, int* error) { - return string_stream_.Read(buffer, buffer_len, read, error); - } - - virtual void Close() { - return string_stream_.Close(); - } - virtual bool GetSize(size_t* size) const { - return string_stream_.GetSize(size); - } - - private: - StringStream string_stream_; -}; - -class FakeDirectoryIterator : public DirectoryIterator { - public: - typedef std::pair File; - - /* - * files should be sorted by directory - * put '/' at the end of file if you want it to be a directory - * - * Sample list: - * /var/dir/file1 - * /var/dir/file2 - * /var/dir/subdir1/ - * /var/dir/subdir2/ - * /var/dir2/file2 - * /var/dir3/ - * - * you can call Iterate for any path: /var, /var/dir, /var/dir2 - * unrelated files will be ignored - */ - explicit FakeDirectoryIterator(const std::vector& all_files) : - all_files_(all_files) {} - - virtual bool Iterate(const Pathname& path) { - path_iterator_ = all_files_.begin(); - path_ = path.pathname(); - - // make sure path ends end with '/' - if (path_.rfind(Pathname::DefaultFolderDelimiter()) != path_.size() - 1) - path_ += Pathname::DefaultFolderDelimiter(); - - return FakeDirectoryIterator::Search(std::string("")); - } - - virtual bool Next() { - std::string current_name = Name(); - path_iterator_++; - return FakeDirectoryIterator::Search(current_name); - } - - bool Search(const std::string& current_name) { - for (; path_iterator_ != all_files_.end(); path_iterator_++) { - if (path_iterator_->first.find(path_) == 0 - && Name().compare(current_name) != 0) { - return true; - } - } - - return false; - } - - virtual bool IsDirectory() const { - std::string sub_path = path_iterator_->first; - - return std::string::npos != - sub_path.find(Pathname::DefaultFolderDelimiter(), path_.size()); - } - - virtual std::string Name() const { - std::string sub_path = path_iterator_->first; - - // path - top level path (ex. /var/lib) - // sub_path - subpath under top level path (ex. /var/lib/dir/dir/file ) - // find shortest non-trivial common path. (ex. /var/lib/dir) - size_t start = path_.size(); - size_t end = sub_path.find(Pathname::DefaultFolderDelimiter(), start); - - if (end != std::string::npos) { - return sub_path.substr(start, end - start); - } else { - return sub_path.substr(start); - } - } - - private: - const std::vector all_files_; - - std::string path_; - std::vector::const_iterator path_iterator_; -}; - -class FakeFileSystem : public FilesystemInterface { - public: - typedef std::pair File; - - explicit FakeFileSystem(const std::vector& all_files) : - all_files_(all_files) {} - - virtual DirectoryIterator *IterateDirectory() { - return new FakeDirectoryIterator(all_files_); - } - - virtual FileStream * OpenFile( - const Pathname &filename, - const std::string &mode) { - std::vector::const_iterator i_files = all_files_.begin(); - std::string path = filename.pathname(); - - for (; i_files != all_files_.end(); i_files++) { - if (i_files->first.compare(path) == 0) { - return new FakeFileStream(i_files->second); - } - } - - return NULL; - } - - bool CreatePrivateFile(const Pathname &filename) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool DeleteFile(const Pathname &filename) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool DeleteEmptyFolder(const Pathname &folder) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool DeleteFolderContents(const Pathname &folder) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool DeleteFolderAndContents(const Pathname &folder) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool CreateFolder(const Pathname &pathname) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool MoveFolder(const Pathname &old_path, const Pathname &new_path) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool MoveFile(const Pathname &old_path, const Pathname &new_path) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool CopyFile(const Pathname &old_path, const Pathname &new_path) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool IsFolder(const Pathname &pathname) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool IsFile(const Pathname &pathname) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool IsAbsent(const Pathname &pathname) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool IsTemporaryPath(const Pathname &pathname) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool GetTemporaryFolder(Pathname &path, bool create, - const std::string *append) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - std::string TempFilename(const Pathname &dir, const std::string &prefix) { - EXPECT_TRUE(false) << "Unsupported operation"; - return std::string(); - } - bool GetFileSize(const Pathname &path, size_t *size) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool GetFileTime(const Pathname &path, FileTimeType which, - time_t* time) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool GetAppPathname(Pathname *path) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool GetAppDataFolder(Pathname *path, bool per_user) { - EXPECT_TRUE(per_user) << "Unsupported operation"; -#if defined(WEBRTC_WIN) - path->SetPathname("c:\\Users\\test_user", ""); -#else - path->SetPathname("/home/user/test_user", ""); -#endif - return true; - } - bool GetAppTempFolder(Pathname *path) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) { - EXPECT_TRUE(false) << "Unsupported operation"; - return false; - } - Pathname GetCurrentDirectory() { - return Pathname(); - } - - private: - const std::vector all_files_; -}; -} // namespace rtc - -#endif // WEBRTC_BASE_FILEUTILS_MOCK_H_ diff --git a/include/webrtc/base/firewallsocketserver.h b/include/webrtc/base/firewallsocketserver.h deleted file mode 100644 index 26fc75e..0000000 --- a/include/webrtc/base/firewallsocketserver.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FIREWALLSOCKETSERVER_H_ -#define WEBRTC_BASE_FIREWALLSOCKETSERVER_H_ - -#include -#include "webrtc/base/socketserver.h" -#include "webrtc/base/criticalsection.h" - -namespace rtc { - -class FirewallManager; - -// This SocketServer shim simulates a rule-based firewall server. - -enum FirewallProtocol { FP_UDP, FP_TCP, FP_ANY }; -enum FirewallDirection { FD_IN, FD_OUT, FD_ANY }; - -class FirewallSocketServer : public SocketServer { - public: - FirewallSocketServer(SocketServer * server, - FirewallManager * manager = NULL, - bool should_delete_server = false); - ~FirewallSocketServer() override; - - SocketServer* socketserver() const { return server_; } - void set_socketserver(SocketServer* server) { - if (server_ && should_delete_server_) { - delete server_; - server_ = NULL; - should_delete_server_ = false; - } - server_ = server; - } - - // Settings to control whether CreateSocket or Socket::Listen succeed. - void set_udp_sockets_enabled(bool enabled) { udp_sockets_enabled_ = enabled; } - void set_tcp_sockets_enabled(bool enabled) { tcp_sockets_enabled_ = enabled; } - bool tcp_listen_enabled() const { return tcp_listen_enabled_; } - void set_tcp_listen_enabled(bool enabled) { tcp_listen_enabled_ = enabled; } - - // Rules govern the behavior of Connect/Accept/Send/Recv attempts. - void AddRule(bool allow, FirewallProtocol p = FP_ANY, - FirewallDirection d = FD_ANY, - const SocketAddress& addr = SocketAddress()); - void AddRule(bool allow, FirewallProtocol p, - const SocketAddress& src, const SocketAddress& dst); - void ClearRules(); - - bool Check(FirewallProtocol p, - const SocketAddress& src, const SocketAddress& dst); - - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - void SetMessageQueue(MessageQueue* queue) override; - bool Wait(int cms, bool process_io) override; - void WakeUp() override; - - Socket * WrapSocket(Socket * sock, int type); - AsyncSocket * WrapSocket(AsyncSocket * sock, int type); - - private: - SocketServer * server_; - FirewallManager * manager_; - CriticalSection crit_; - struct Rule { - bool allow; - FirewallProtocol p; - FirewallDirection d; - SocketAddress src; - SocketAddress dst; - }; - std::vector rules_; - bool should_delete_server_; - bool udp_sockets_enabled_; - bool tcp_sockets_enabled_; - bool tcp_listen_enabled_; -}; - -// FirewallManager allows you to manage firewalls in multiple threads together - -class FirewallManager { - public: - FirewallManager(); - ~FirewallManager(); - - void AddServer(FirewallSocketServer * server); - void RemoveServer(FirewallSocketServer * server); - - void AddRule(bool allow, FirewallProtocol p = FP_ANY, - FirewallDirection d = FD_ANY, - const SocketAddress& addr = SocketAddress()); - void ClearRules(); - - private: - CriticalSection crit_; - std::vector servers_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_FIREWALLSOCKETSERVER_H_ diff --git a/include/webrtc/base/flags.h b/include/webrtc/base/flags.h deleted file mode 100644 index 4ce857b..0000000 --- a/include/webrtc/base/flags.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright 2006 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -// Originally comes from shared/commandlineflags/flags.h - -// Flags are defined and declared using DEFINE_xxx and DECLARE_xxx macros, -// where xxx is the flag type. Flags are referred to via FLAG_yyy, -// where yyy is the flag name. For intialization and iteration of flags, -// see the FlagList class. For full programmatic access to any -// flag, see the Flag class. -// -// The implementation only relies and basic C++ functionality -// and needs no special library or STL support. - -#ifndef WEBRTC_BASE_FLAGS_H__ -#define WEBRTC_BASE_FLAGS_H__ - -#include - -#include "webrtc/base/checks.h" -#include "webrtc/base/common.h" - -namespace rtc { - -// Internal use only. -union FlagValue { - // Note: Because in C++ non-bool values are silently converted into - // bool values ('bool b = "false";' results in b == true!), we pass - // and int argument to New_BOOL as this appears to be safer - sigh. - // In particular, it prevents the (not uncommon!) bug where a bool - // flag is defined via: DEFINE_bool(flag, "false", "some comment");. - static FlagValue New_BOOL(int b) { - FlagValue v; - v.b = (b != 0); - return v; - } - - static FlagValue New_INT(int i) { - FlagValue v; - v.i = i; - return v; - } - - static FlagValue New_FLOAT(float f) { - FlagValue v; - v.f = f; - return v; - } - - static FlagValue New_STRING(const char* s) { - FlagValue v; - v.s = s; - return v; - } - - bool b; - int i; - double f; - const char* s; -}; - - -// Each flag can be accessed programmatically via a Flag object. -class Flag { - public: - enum Type { BOOL, INT, FLOAT, STRING }; - - // Internal use only. - Flag(const char* file, const char* name, const char* comment, - Type type, void* variable, FlagValue default_); - - // General flag information - const char* file() const { return file_; } - const char* name() const { return name_; } - const char* comment() const { return comment_; } - - // Flag type - Type type() const { return type_; } - - // Flag variables - bool* bool_variable() const { - assert(type_ == BOOL); - return &variable_->b; - } - - int* int_variable() const { - assert(type_ == INT); - return &variable_->i; - } - - double* float_variable() const { - assert(type_ == FLOAT); - return &variable_->f; - } - - const char** string_variable() const { - assert(type_ == STRING); - return &variable_->s; - } - - // Default values - bool bool_default() const { - assert(type_ == BOOL); - return default_.b; - } - - int int_default() const { - assert(type_ == INT); - return default_.i; - } - - double float_default() const { - assert(type_ == FLOAT); - return default_.f; - } - - const char* string_default() const { - assert(type_ == STRING); - return default_.s; - } - - // Resets a flag to its default value - void SetToDefault(); - - // Iteration support - Flag* next() const { return next_; } - - // Prints flag information. The current flag value is only printed - // if print_current_value is set. - void Print(bool print_current_value); - - private: - const char* file_; - const char* name_; - const char* comment_; - - Type type_; - FlagValue* variable_; - FlagValue default_; - - Flag* next_; - - friend class FlagList; // accesses next_ -}; - - -// Internal use only. -#define DEFINE_FLAG(type, c_type, name, default, comment) \ - /* define and initialize the flag */ \ - c_type FLAG_##name = (default); \ - /* register the flag */ \ - static rtc::Flag Flag_##name(__FILE__, #name, (comment), \ - rtc::Flag::type, &FLAG_##name, \ - rtc::FlagValue::New_##type(default)) - - -// Internal use only. -#define DECLARE_FLAG(c_type, name) \ - /* declare the external flag */ \ - extern c_type FLAG_##name - - -// Use the following macros to define a new flag: -#define DEFINE_bool(name, default, comment) \ - DEFINE_FLAG(BOOL, bool, name, default, comment) -#define DEFINE_int(name, default, comment) \ - DEFINE_FLAG(INT, int, name, default, comment) -#define DEFINE_float(name, default, comment) \ - DEFINE_FLAG(FLOAT, double, name, default, comment) -#define DEFINE_string(name, default, comment) \ - DEFINE_FLAG(STRING, const char*, name, default, comment) - - -// Use the following macros to declare a flag defined elsewhere: -#define DECLARE_bool(name) DECLARE_FLAG(bool, name) -#define DECLARE_int(name) DECLARE_FLAG(int, name) -#define DECLARE_float(name) DECLARE_FLAG(double, name) -#define DECLARE_string(name) DECLARE_FLAG(const char*, name) - - -// The global list of all flags. -class FlagList { - public: - FlagList(); - - // The NULL-terminated list of all flags. Traverse with Flag::next(). - static Flag* list() { return list_; } - - // If file != NULL, prints information for all flags defined in file; - // otherwise prints information for all flags in all files. The current - // flag value is only printed if print_current_value is set. - static void Print(const char* file, bool print_current_value); - - // Lookup a flag by name. Returns the matching flag or NULL. - static Flag* Lookup(const char* name); - - // Helper function to parse flags: Takes an argument arg and splits it into - // a flag name and flag value (or NULL if they are missing). is_bool is set - // if the arg started with "-no" or "--no". The buffer may be used to NUL- - // terminate the name, it must be large enough to hold any possible name. - static void SplitArgument(const char* arg, - char* buffer, int buffer_size, - const char** name, const char** value, - bool* is_bool); - - // Set the flag values by parsing the command line. If remove_flags - // is set, the flags and associated values are removed from (argc, - // argv). Returns 0 if no error occurred. Otherwise, returns the - // argv index > 0 for the argument where an error occurred. In that - // case, (argc, argv) will remain unchanged indepdendent of the - // remove_flags value, and no assumptions about flag settings should - // be made. - // - // The following syntax for flags is accepted (both '-' and '--' are ok): - // - // --flag (bool flags only) - // --noflag (bool flags only) - // --flag=value (non-bool flags only, no spaces around '=') - // --flag value (non-bool flags only) - static int SetFlagsFromCommandLine(int* argc, - const char** argv, - bool remove_flags); - static inline int SetFlagsFromCommandLine(int* argc, - char** argv, - bool remove_flags) { - return SetFlagsFromCommandLine(argc, const_cast(argv), - remove_flags); - } - - // Registers a new flag. Called during program initialization. Not - // thread-safe. - static void Register(Flag* flag); - - private: - static Flag* list_; -}; - -#if defined(WEBRTC_WIN) -// A helper class to translate Windows command line arguments into UTF8, -// which then allows us to just pass them to the flags system. -// This encapsulates all the work of getting the command line and translating -// it to an array of 8-bit strings; all you have to do is create one of these, -// and then call argc() and argv(). -class WindowsCommandLineArguments { - public: - WindowsCommandLineArguments(); - ~WindowsCommandLineArguments(); - - int argc() { return argc_; } - char **argv() { return argv_; } - private: - int argc_; - char **argv_; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(WindowsCommandLineArguments); -}; -#endif // WEBRTC_WIN - -} // namespace rtc - -#endif // SHARED_COMMANDLINEFLAGS_FLAGS_H__ diff --git a/include/webrtc/base/format_macros.h b/include/webrtc/base/format_macros.h deleted file mode 100644 index 90f86a6..0000000 --- a/include/webrtc/base/format_macros.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FORMAT_MACROS_H_ -#define WEBRTC_BASE_FORMAT_MACROS_H_ - -// This file defines the format macros for some integer types and is derived -// from Chromium's base/format_macros.h. - -// To print a 64-bit value in a portable way: -// int64_t value; -// printf("xyz:%" PRId64, value); -// The "d" in the macro corresponds to %d; you can also use PRIu64 etc. -// -// To print a size_t value in a portable way: -// size_t size; -// printf("xyz: %" PRIuS, size); -// The "u" in the macro corresponds to %u, and S is for "size". - -#include "webrtc/typedefs.h" - -#if defined(WEBRTC_POSIX) - -#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64) -#error "inttypes.h has already been included before this header file, but " -#error "without __STDC_FORMAT_MACROS defined." -#endif - -#if !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif - -#include - -#if !defined(PRIuS) -#define PRIuS "zu" -#endif - -// The size of NSInteger and NSUInteger varies between 32-bit and 64-bit -// architectures and Apple does not provides standard format macros and -// recommends casting. This has many drawbacks, so instead define macros -// for formatting those types. -#if defined(WEBRTC_MAC) -#if defined(WEBRTC_ARCH_64_BITS) -#if !defined(PRIdNS) -#define PRIdNS "ld" -#endif -#if !defined(PRIuNS) -#define PRIuNS "lu" -#endif -#if !defined(PRIxNS) -#define PRIxNS "lx" -#endif -#else // defined(WEBRTC_ARCH_64_BITS) -#if !defined(PRIdNS) -#define PRIdNS "d" -#endif -#if !defined(PRIuNS) -#define PRIuNS "u" -#endif -#if !defined(PRIxNS) -#define PRIxNS "x" -#endif -#endif -#endif // defined(WEBRTC_MAC) - -#else // WEBRTC_WIN - -#include - -#if !defined(PRId64) -#define PRId64 "I64d" -#endif - -#if !defined(PRIu64) -#define PRIu64 "I64u" -#endif - -#if !defined(PRIx64) -#define PRIx64 "I64x" -#endif - -#if !defined(PRIuS) -#define PRIuS "Iu" -#endif - -#endif - -#endif // WEBRTC_BASE_FORMAT_MACROS_H_ diff --git a/include/webrtc/base/gunit.h b/include/webrtc/base/gunit.h deleted file mode 100644 index 1a6c363..0000000 --- a/include/webrtc/base/gunit.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_GUNIT_H_ -#define WEBRTC_BASE_GUNIT_H_ - -#include "webrtc/base/logging.h" -#include "webrtc/base/thread.h" -#if defined(GTEST_RELATIVE_PATH) -#include "testing/gtest/include/gtest/gtest.h" -#else -#include "testing/base/public/gunit.h" -#endif - -// Wait until "ex" is true, or "timeout" expires. -#define WAIT(ex, timeout) \ - for (uint32_t start = rtc::Time(); !(ex) && rtc::Time() < start + timeout;) \ - rtc::Thread::Current()->ProcessMessages(1); - -// This returns the result of the test in res, so that we don't re-evaluate -// the expression in the XXXX_WAIT macros below, since that causes problems -// when the expression is only true the first time you check it. -#define WAIT_(ex, timeout, res) \ - do { \ - uint32_t start = rtc::Time(); \ - res = (ex); \ - while (!res && rtc::Time() < start + timeout) { \ - rtc::Thread::Current()->ProcessMessages(1); \ - res = (ex); \ - } \ - } while (0) - -// The typical EXPECT_XXXX and ASSERT_XXXXs, but done until true or a timeout. -#define EXPECT_TRUE_WAIT(ex, timeout) \ - do { \ - bool res; \ - WAIT_(ex, timeout, res); \ - if (!res) EXPECT_TRUE(ex); \ - } while (0) - -#define EXPECT_EQ_WAIT(v1, v2, timeout) \ - do { \ - bool res; \ - WAIT_(v1 == v2, timeout, res); \ - if (!res) EXPECT_EQ(v1, v2); \ - } while (0) - -#define ASSERT_TRUE_WAIT(ex, timeout) \ - do { \ - bool res; \ - WAIT_(ex, timeout, res); \ - if (!res) ASSERT_TRUE(ex); \ - } while (0) - -#define ASSERT_EQ_WAIT(v1, v2, timeout) \ - do { \ - bool res; \ - WAIT_(v1 == v2, timeout, res); \ - if (!res) ASSERT_EQ(v1, v2); \ - } while (0) - -// Version with a "soft" timeout and a margin. This logs if the timeout is -// exceeded, but it only fails if the expression still isn't true after the -// margin time passes. -#define EXPECT_TRUE_WAIT_MARGIN(ex, timeout, margin) \ - do { \ - bool res; \ - WAIT_(ex, timeout, res); \ - if (res) { \ - break; \ - } \ - LOG(LS_WARNING) << "Expression " << #ex << " still not true after " << \ - timeout << "ms; waiting an additional " << margin << "ms"; \ - WAIT_(ex, margin, res); \ - if (!res) { \ - EXPECT_TRUE(ex); \ - } \ - } while (0) - -#endif // WEBRTC_BASE_GUNIT_H_ diff --git a/include/webrtc/base/gunit_prod.h b/include/webrtc/base/gunit_prod.h deleted file mode 100644 index dc39bbd..0000000 --- a/include/webrtc/base/gunit_prod.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_GUNIT_PROD_H_ -#define WEBRTC_BASE_GUNIT_PROD_H_ - -#if defined(WEBRTC_ANDROID) -// Android doesn't use gtest at all, so anything that relies on gtest should -// check this define first. -#define NO_GTEST -#elif defined (GTEST_RELATIVE_PATH) -#include "gtest/gtest_prod.h" -#else -#include "testing/base/gunit_prod.h" -#endif - -#endif // WEBRTC_BASE_GUNIT_PROD_H_ diff --git a/include/webrtc/base/helpers.h b/include/webrtc/base/helpers.h deleted file mode 100644 index 0e79373..0000000 --- a/include/webrtc/base/helpers.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_HELPERS_H_ -#define WEBRTC_BASE_HELPERS_H_ - -#include -#include "webrtc/base/basictypes.h" - -namespace rtc { - -// For testing, we can return predictable data. -void SetRandomTestMode(bool test); - -// Initializes the RNG, and seeds it with the specified entropy. -bool InitRandom(int seed); -bool InitRandom(const char* seed, size_t len); - -// Generates a (cryptographically) random string of the given length. -// We generate base64 values so that they will be printable. -// WARNING: could silently fail. Use the version below instead. -std::string CreateRandomString(size_t length); - -// Generates a (cryptographically) random string of the given length. -// We generate base64 values so that they will be printable. -// Return false if the random number generator failed. -bool CreateRandomString(size_t length, std::string* str); - -// Generates a (cryptographically) random string of the given length, -// with characters from the given table. Return false if the random -// number generator failed. -bool CreateRandomString(size_t length, const std::string& table, - std::string* str); - -// Generates a (cryptographically) random UUID version 4 string. -std::string CreateRandomUuid(); - -// Generates a random id. -uint32_t CreateRandomId(); - -// Generates a 64 bit random id. -uint64_t CreateRandomId64(); - -// Generates a random id > 0. -uint32_t CreateRandomNonZeroId(); - -// Generates a random double between 0.0 (inclusive) and 1.0 (exclusive). -double CreateRandomDouble(); - -} // namespace rtc - -#endif // WEBRTC_BASE_HELPERS_H_ diff --git a/include/webrtc/base/httpbase.h b/include/webrtc/base/httpbase.h deleted file mode 100644 index 7f368f8..0000000 --- a/include/webrtc/base/httpbase.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef WEBRTC_BASE_HTTPBASE_H__ -#define WEBRTC_BASE_HTTPBASE_H__ - -#include "webrtc/base/httpcommon.h" - -namespace rtc { - -class StreamInterface; - -/////////////////////////////////////////////////////////////////////////////// -// HttpParser - Parses an HTTP stream provided via Process and end_of_input, and -// generates events for: -// Structural Elements: Leader, Headers, Document Data -// Events: End of Headers, End of Document, Errors -/////////////////////////////////////////////////////////////////////////////// - -class HttpParser { -public: - enum ProcessResult { PR_CONTINUE, PR_BLOCK, PR_COMPLETE }; - HttpParser(); - virtual ~HttpParser(); - - void reset(); - ProcessResult Process(const char* buffer, size_t len, size_t* processed, - HttpError* error); - bool is_valid_end_of_input() const; - void complete(HttpError err); - - size_t GetDataRemaining() const { return data_size_; } - -protected: - ProcessResult ProcessLine(const char* line, size_t len, HttpError* error); - - // HttpParser Interface - virtual ProcessResult ProcessLeader(const char* line, size_t len, - HttpError* error) = 0; - virtual ProcessResult ProcessHeader(const char* name, size_t nlen, - const char* value, size_t vlen, - HttpError* error) = 0; - virtual ProcessResult ProcessHeaderComplete(bool chunked, size_t& data_size, - HttpError* error) = 0; - virtual ProcessResult ProcessData(const char* data, size_t len, size_t& read, - HttpError* error) = 0; - virtual void OnComplete(HttpError err) = 0; - -private: - enum State { - ST_LEADER, ST_HEADERS, - ST_CHUNKSIZE, ST_CHUNKTERM, ST_TRAILERS, - ST_DATA, ST_COMPLETE - } state_; - bool chunked_; - size_t data_size_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// IHttpNotify -/////////////////////////////////////////////////////////////////////////////// - -enum HttpMode { HM_NONE, HM_CONNECT, HM_RECV, HM_SEND }; - -class IHttpNotify { -public: - virtual ~IHttpNotify() {} - virtual HttpError onHttpHeaderComplete(bool chunked, size_t& data_size) = 0; - virtual void onHttpComplete(HttpMode mode, HttpError err) = 0; - virtual void onHttpClosed(HttpError err) = 0; -}; - -/////////////////////////////////////////////////////////////////////////////// -// HttpBase - Provides a state machine for implementing HTTP-based components. -// Attach HttpBase to a StreamInterface which represents a bidirectional HTTP -// stream, and then call send() or recv() to initiate sending or receiving one -// side of an HTTP transaction. By default, HttpBase operates as an I/O pump, -// moving data from the HTTP stream to the HttpData object and vice versa. -// However, it can also operate in stream mode, in which case the user of the -// stream interface drives I/O via calls to Read(). -/////////////////////////////////////////////////////////////////////////////// - -class HttpBase -: private HttpParser, - public sigslot::has_slots<> -{ -public: - HttpBase(); - ~HttpBase() override; - - void notify(IHttpNotify* notify) { notify_ = notify; } - bool attach(StreamInterface* stream); - StreamInterface* stream() { return http_stream_; } - StreamInterface* detach(); - bool isConnected() const; - - void send(HttpData* data); - void recv(HttpData* data); - void abort(HttpError err); - - HttpMode mode() const { return mode_; } - - void set_ignore_data(bool ignore) { ignore_data_ = ignore; } - bool ignore_data() const { return ignore_data_; } - - // Obtaining this stream puts HttpBase into stream mode until the stream - // is closed. HttpBase can only expose one open stream interface at a time. - // Further calls will return NULL. - StreamInterface* GetDocumentStream(); - -protected: - // Do cleanup when the http stream closes (error may be 0 for a clean - // shutdown), and return the error code to signal. - HttpError HandleStreamClose(int error); - - // DoReceiveLoop acts as a data pump, pulling data from the http stream, - // pushing it through the HttpParser, and then populating the HttpData object - // based on the callbacks from the parser. One of the most interesting - // callbacks is ProcessData, which provides the actual http document body. - // This data is then written to the HttpData::document. As a result, data - // flows from the network to the document, with some incidental protocol - // parsing in between. - // Ideally, we would pass in the document* to DoReceiveLoop, to more easily - // support GetDocumentStream(). However, since the HttpParser is callback - // driven, we are forced to store the pointer somewhere until the callback - // is triggered. - // Returns true if the received document has finished, and - // HttpParser::complete should be called. - bool DoReceiveLoop(HttpError* err); - - void read_and_process_data(); - void flush_data(); - bool queue_headers(); - void do_complete(HttpError err = HE_NONE); - - void OnHttpStreamEvent(StreamInterface* stream, int events, int error); - void OnDocumentEvent(StreamInterface* stream, int events, int error); - - // HttpParser Interface - ProcessResult ProcessLeader(const char* line, - size_t len, - HttpError* error) override; - ProcessResult ProcessHeader(const char* name, - size_t nlen, - const char* value, - size_t vlen, - HttpError* error) override; - ProcessResult ProcessHeaderComplete(bool chunked, - size_t& data_size, - HttpError* error) override; - ProcessResult ProcessData(const char* data, - size_t len, - size_t& read, - HttpError* error) override; - void OnComplete(HttpError err) override; - -private: - class DocumentStream; - friend class DocumentStream; - - enum { kBufferSize = 32 * 1024 }; - - HttpMode mode_; - HttpData* data_; - IHttpNotify* notify_; - StreamInterface* http_stream_; - DocumentStream* doc_stream_; - char buffer_[kBufferSize]; - size_t len_; - - bool ignore_data_, chunk_data_; - HttpData::const_iterator header_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_HTTPBASE_H__ diff --git a/include/webrtc/base/httpclient.h b/include/webrtc/base/httpclient.h deleted file mode 100644 index e7d2c5c..0000000 --- a/include/webrtc/base/httpclient.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_HTTPCLIENT_H__ -#define WEBRTC_BASE_HTTPCLIENT_H__ - -#include "webrtc/base/common.h" -#include "webrtc/base/httpbase.h" -#include "webrtc/base/nethelpers.h" -#include "webrtc/base/proxyinfo.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/socketpool.h" - -namespace rtc { - -////////////////////////////////////////////////////////////////////// -// Client-specific http utilities -////////////////////////////////////////////////////////////////////// - -// Write cache-relevant response headers to output stream. If size is non-null, -// it contains the length of the output in bytes. output may be null if only -// the length is desired. -bool HttpWriteCacheHeaders(const HttpResponseData* response, - StreamInterface* output, size_t* size); -// Read cached headers from a stream, and them merge them into the response -// object using the specified combine operation. -bool HttpReadCacheHeaders(StreamInterface* input, - HttpResponseData* response, - HttpData::HeaderCombine combine); - -////////////////////////////////////////////////////////////////////// -// HttpClient -// Implements an HTTP 1.1 client. -////////////////////////////////////////////////////////////////////// - -class DiskCache; -class HttpClient; -class IPNetPool; - -class SignalThread; -// What to do: Define STRICT_HTTP_ERROR=1 in your makefile. Use HttpError in -// your code (HttpErrorType should only be used for code that is shared -// with groups which have not yet migrated). -#if STRICT_HTTP_ERROR -typedef HttpError HttpErrorType; -#else // !STRICT_HTTP_ERROR -typedef int HttpErrorType; -#endif // !STRICT_HTTP_ERROR - -class HttpClient : private IHttpNotify, public sigslot::has_slots<> { -public: - // If HttpRequestData and HttpResponseData objects are provided, they must - // be freed by the caller. Otherwise, an internal object is allocated. - HttpClient(const std::string& agent, StreamPool* pool, - HttpTransaction* transaction = NULL); - ~HttpClient() override; - - void set_pool(StreamPool* pool) { pool_ = pool; } - - void set_agent(const std::string& agent) { agent_ = agent; } - const std::string& agent() const { return agent_; } - - void set_proxy(const ProxyInfo& proxy) { proxy_ = proxy; } - const ProxyInfo& proxy() const { return proxy_; } - - // Request retries occur when the connection closes before the beginning of - // an http response is received. In these cases, the http server may have - // timed out the keepalive connection before it received our request. Note - // that if a request document cannot be rewound, no retry is made. The - // default is 1. - void set_request_retries(size_t retries) { retries_ = retries; } - size_t request_retries() const { return retries_; } - - enum RedirectAction { REDIRECT_DEFAULT, REDIRECT_ALWAYS, REDIRECT_NEVER }; - void set_redirect_action(RedirectAction action) { redirect_action_ = action; } - RedirectAction redirect_action() const { return redirect_action_; } - - enum UriForm { URI_DEFAULT, URI_ABSOLUTE, URI_RELATIVE }; - void set_uri_form(UriForm form) { uri_form_ = form; } - UriForm uri_form() const { return uri_form_; } - - void set_cache(DiskCache* cache) { ASSERT(!IsCacheActive()); cache_ = cache; } - bool cache_enabled() const { return (NULL != cache_); } - - // reset clears the server, request, and response structures. It will also - // abort an active request. - void reset(); - - void set_server(const SocketAddress& address); - const SocketAddress& server() const { return server_; } - - // Note: in order for HttpClient to retry a POST in response to - // an authentication challenge, a redirect response, or socket disconnection, - // the request document must support 'replaying' by calling Rewind() on it. - HttpTransaction* transaction() { return transaction_; } - const HttpTransaction* transaction() const { return transaction_; } - HttpRequestData& request() { return transaction_->request; } - const HttpRequestData& request() const { return transaction_->request; } - HttpResponseData& response() { return transaction_->response; } - const HttpResponseData& response() const { return transaction_->response; } - - // convenience methods - void prepare_get(const std::string& url); - void prepare_post(const std::string& url, const std::string& content_type, - StreamInterface* request_doc); - - // Convert HttpClient to a pull-based I/O model. - StreamInterface* GetDocumentStream(); - - // After you finish setting up your request, call start. - void start(); - - // Signalled when the header has finished downloading, before the document - // content is processed. You may change the response document in response - // to this signal. The second parameter indicates whether this is an - // intermediate (false) or final (true) header. An intermediate header is - // one that generates another request, such as a redirect or authentication - // challenge. The third parameter indicates the length of the response - // document, or else SIZE_UNKNOWN. Note: Do NOT abort the request in response - // to this signal. - sigslot::signal3 SignalHeaderAvailable; - // Signalled when the current request finishes. On success, err is 0. - sigslot::signal2 SignalHttpClientComplete; - -protected: - void connect(); - void release(); - - bool ShouldRedirect(std::string* location) const; - - bool BeginCacheFile(); - HttpError WriteCacheHeaders(const std::string& id); - void CompleteCacheFile(); - - bool CheckCache(); - HttpError ReadCacheHeaders(const std::string& id, bool override); - HttpError ReadCacheBody(const std::string& id); - - bool PrepareValidate(); - HttpError CompleteValidate(); - - HttpError OnHeaderAvailable(bool ignore_data, bool chunked, size_t data_size); - - void StartDNSLookup(); - void OnResolveResult(AsyncResolverInterface* resolver); - - // IHttpNotify Interface - HttpError onHttpHeaderComplete(bool chunked, size_t& data_size) override; - void onHttpComplete(HttpMode mode, HttpError err) override; - void onHttpClosed(HttpError err) override; - -private: - enum CacheState { CS_READY, CS_WRITING, CS_READING, CS_VALIDATING }; - bool IsCacheActive() const { return (cache_state_ > CS_READY); } - - std::string agent_; - StreamPool* pool_; - HttpBase base_; - SocketAddress server_; - ProxyInfo proxy_; - HttpTransaction* transaction_; - bool free_transaction_; - size_t retries_, attempt_, redirects_; - RedirectAction redirect_action_; - UriForm uri_form_; - scoped_ptr context_; - DiskCache* cache_; - CacheState cache_state_; - AsyncResolverInterface* resolver_; -}; - -////////////////////////////////////////////////////////////////////// -// HttpClientDefault - Default implementation of HttpClient -////////////////////////////////////////////////////////////////////// - -class HttpClientDefault : public ReuseSocketPool, public HttpClient { -public: - HttpClientDefault(SocketFactory* factory, const std::string& agent, - HttpTransaction* transaction = NULL); -}; - -////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_HTTPCLIENT_H__ diff --git a/include/webrtc/base/httpcommon-inl.h b/include/webrtc/base/httpcommon-inl.h deleted file mode 100644 index 188d9e6..0000000 --- a/include/webrtc/base/httpcommon-inl.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_HTTPCOMMON_INL_H__ -#define WEBRTC_BASE_HTTPCOMMON_INL_H__ - -#include "webrtc/base/arraysize.h" -#include "webrtc/base/common.h" -#include "webrtc/base/httpcommon.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// Url -/////////////////////////////////////////////////////////////////////////////// - -template -void Url::do_set_url(const CTYPE* val, size_t len) { - if (ascnicmp(val, "http://", 7) == 0) { - val += 7; len -= 7; - secure_ = false; - } else if (ascnicmp(val, "https://", 8) == 0) { - val += 8; len -= 8; - secure_ = true; - } else { - clear(); - return; - } - const CTYPE* path = strchrn(val, len, static_cast('/')); - if (!path) { - path = val + len; - } - size_t address_length = (path - val); - do_set_address(val, address_length); - do_set_full_path(path, len - address_length); -} - -template -void Url::do_set_address(const CTYPE* val, size_t len) { - if (const CTYPE* at = strchrn(val, len, static_cast('@'))) { - // Everything before the @ is a user:password combo, so skip it. - len -= at - val + 1; - val = at + 1; - } - if (const CTYPE* colon = strchrn(val, len, static_cast(':'))) { - host_.assign(val, colon - val); - // Note: In every case, we're guaranteed that colon is followed by a null, - // or non-numeric character. - port_ = static_cast(::strtoul(colon + 1, NULL, 10)); - // TODO: Consider checking for invalid data following port number. - } else { - host_.assign(val, len); - port_ = HttpDefaultPort(secure_); - } -} - -template -void Url::do_set_full_path(const CTYPE* val, size_t len) { - const CTYPE* query = strchrn(val, len, static_cast('?')); - if (!query) { - query = val + len; - } - size_t path_length = (query - val); - if (0 == path_length) { - // TODO: consider failing in this case. - path_.assign(1, static_cast('/')); - } else { - ASSERT(val[0] == static_cast('/')); - path_.assign(val, path_length); - } - query_.assign(query, len - path_length); -} - -template -void Url::do_get_url(string* val) const { - CTYPE protocol[9]; - asccpyn(protocol, arraysize(protocol), secure_ ? "https://" : "http://"); - val->append(protocol); - do_get_address(val); - do_get_full_path(val); -} - -template -void Url::do_get_address(string* val) const { - val->append(host_); - if (port_ != HttpDefaultPort(secure_)) { - CTYPE format[5], port[32]; - asccpyn(format, arraysize(format), ":%hu"); - sprintfn(port, arraysize(port), format, port_); - val->append(port); - } -} - -template -void Url::do_get_full_path(string* val) const { - val->append(path_); - val->append(query_); -} - -template -bool Url::get_attribute(const string& name, string* value) const { - if (query_.empty()) - return false; - - std::string::size_type pos = query_.find(name, 1); - if (std::string::npos == pos) - return false; - - pos += name.length() + 1; - if ((pos > query_.length()) || (static_cast('=') != query_[pos-1])) - return false; - - std::string::size_type end = query_.find(static_cast('&'), pos); - if (std::string::npos == end) { - end = query_.length(); - } - value->assign(query_.substr(pos, end - pos)); - return true; -} - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ diff --git a/include/webrtc/base/httpcommon.h b/include/webrtc/base/httpcommon.h deleted file mode 100644 index addc1bc..0000000 --- a/include/webrtc/base/httpcommon.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_HTTPCOMMON_H__ -#define WEBRTC_BASE_HTTPCOMMON_H__ - -#include -#include -#include -#include "webrtc/base/basictypes.h" -#include "webrtc/base/common.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -class CryptString; -class SocketAddress; - -////////////////////////////////////////////////////////////////////// -// Constants -////////////////////////////////////////////////////////////////////// - -enum HttpCode { - HC_OK = 200, - HC_NON_AUTHORITATIVE = 203, - HC_NO_CONTENT = 204, - HC_PARTIAL_CONTENT = 206, - - HC_MULTIPLE_CHOICES = 300, - HC_MOVED_PERMANENTLY = 301, - HC_FOUND = 302, - HC_SEE_OTHER = 303, - HC_NOT_MODIFIED = 304, - HC_MOVED_TEMPORARILY = 307, - - HC_BAD_REQUEST = 400, - HC_UNAUTHORIZED = 401, - HC_FORBIDDEN = 403, - HC_NOT_FOUND = 404, - HC_PROXY_AUTHENTICATION_REQUIRED = 407, - HC_GONE = 410, - - HC_INTERNAL_SERVER_ERROR = 500, - HC_NOT_IMPLEMENTED = 501, - HC_SERVICE_UNAVAILABLE = 503, -}; - -enum HttpVersion { - HVER_1_0, HVER_1_1, HVER_UNKNOWN, - HVER_LAST = HVER_UNKNOWN -}; - -enum HttpVerb { - HV_GET, HV_POST, HV_PUT, HV_DELETE, HV_CONNECT, HV_HEAD, - HV_LAST = HV_HEAD -}; - -enum HttpError { - HE_NONE, - HE_PROTOCOL, // Received non-valid HTTP data - HE_DISCONNECTED, // Connection closed unexpectedly - HE_OVERFLOW, // Received too much data for internal buffers - HE_CONNECT_FAILED, // The socket failed to connect. - HE_SOCKET_ERROR, // An error occurred on a connected socket - HE_SHUTDOWN, // Http object is being destroyed - HE_OPERATION_CANCELLED, // Connection aborted locally - HE_AUTH, // Proxy Authentication Required - HE_CERTIFICATE_EXPIRED, // During SSL negotiation - HE_STREAM, // Problem reading or writing to the document - HE_CACHE, // Problem reading from cache - HE_DEFAULT -}; - -enum HttpHeader { - HH_AGE, - HH_CACHE_CONTROL, - HH_CONNECTION, - HH_CONTENT_DISPOSITION, - HH_CONTENT_LENGTH, - HH_CONTENT_RANGE, - HH_CONTENT_TYPE, - HH_COOKIE, - HH_DATE, - HH_ETAG, - HH_EXPIRES, - HH_HOST, - HH_IF_MODIFIED_SINCE, - HH_IF_NONE_MATCH, - HH_KEEP_ALIVE, - HH_LAST_MODIFIED, - HH_LOCATION, - HH_PROXY_AUTHENTICATE, - HH_PROXY_AUTHORIZATION, - HH_PROXY_CONNECTION, - HH_RANGE, - HH_SET_COOKIE, - HH_TE, - HH_TRAILERS, - HH_TRANSFER_ENCODING, - HH_UPGRADE, - HH_USER_AGENT, - HH_WWW_AUTHENTICATE, - HH_LAST = HH_WWW_AUTHENTICATE -}; - -const uint16_t HTTP_DEFAULT_PORT = 80; -const uint16_t HTTP_SECURE_PORT = 443; - -////////////////////////////////////////////////////////////////////// -// Utility Functions -////////////////////////////////////////////////////////////////////// - -inline HttpError mkerr(HttpError err, HttpError def_err = HE_DEFAULT) { - return (err != HE_NONE) ? err : def_err; -} - -const char* ToString(HttpVersion version); -bool FromString(HttpVersion& version, const std::string& str); - -const char* ToString(HttpVerb verb); -bool FromString(HttpVerb& verb, const std::string& str); - -const char* ToString(HttpHeader header); -bool FromString(HttpHeader& header, const std::string& str); - -inline bool HttpCodeIsInformational(uint32_t code) { - return ((code / 100) == 1); -} -inline bool HttpCodeIsSuccessful(uint32_t code) { - return ((code / 100) == 2); -} -inline bool HttpCodeIsRedirection(uint32_t code) { - return ((code / 100) == 3); -} -inline bool HttpCodeIsClientError(uint32_t code) { - return ((code / 100) == 4); -} -inline bool HttpCodeIsServerError(uint32_t code) { - return ((code / 100) == 5); -} - -bool HttpCodeHasBody(uint32_t code); -bool HttpCodeIsCacheable(uint32_t code); -bool HttpHeaderIsEndToEnd(HttpHeader header); -bool HttpHeaderIsCollapsible(HttpHeader header); - -struct HttpData; -bool HttpShouldKeepAlive(const HttpData& data); - -typedef std::pair HttpAttribute; -typedef std::vector HttpAttributeList; -void HttpComposeAttributes(const HttpAttributeList& attributes, char separator, - std::string* composed); -void HttpParseAttributes(const char * data, size_t len, - HttpAttributeList& attributes); -bool HttpHasAttribute(const HttpAttributeList& attributes, - const std::string& name, - std::string* value); -bool HttpHasNthAttribute(HttpAttributeList& attributes, - size_t index, - std::string* name, - std::string* value); - -// Convert RFC1123 date (DoW, DD Mon YYYY HH:MM:SS TZ) to unix timestamp -bool HttpDateToSeconds(const std::string& date, time_t* seconds); - -inline uint16_t HttpDefaultPort(bool secure) { - return secure ? HTTP_SECURE_PORT : HTTP_DEFAULT_PORT; -} - -// Returns the http server notation for a given address -std::string HttpAddress(const SocketAddress& address, bool secure); - -// functional for insensitive std::string compare -struct iless { - bool operator()(const std::string& lhs, const std::string& rhs) const { - return (::_stricmp(lhs.c_str(), rhs.c_str()) < 0); - } -}; - -// put quotes around a string and escape any quotes inside it -std::string quote(const std::string& str); - -////////////////////////////////////////////////////////////////////// -// Url -////////////////////////////////////////////////////////////////////// - -template -class Url { -public: - typedef typename Traits::string string; - - // TODO: Implement Encode/Decode - static int Encode(const CTYPE* source, CTYPE* destination, size_t len); - static int Encode(const string& source, string& destination); - static int Decode(const CTYPE* source, CTYPE* destination, size_t len); - static int Decode(const string& source, string& destination); - - Url(const string& url) { do_set_url(url.c_str(), url.size()); } - Url(const string& path, const string& host, uint16_t port = HTTP_DEFAULT_PORT) - : host_(host), port_(port), secure_(HTTP_SECURE_PORT == port) { - set_full_path(path); - } - - bool valid() const { return !host_.empty(); } - void clear() { - host_.clear(); - port_ = HTTP_DEFAULT_PORT; - secure_ = false; - path_.assign(1, static_cast('/')); - query_.clear(); - } - - void set_url(const string& val) { - do_set_url(val.c_str(), val.size()); - } - string url() const { - string val; do_get_url(&val); return val; - } - - void set_address(const string& val) { - do_set_address(val.c_str(), val.size()); - } - string address() const { - string val; do_get_address(&val); return val; - } - - void set_full_path(const string& val) { - do_set_full_path(val.c_str(), val.size()); - } - string full_path() const { - string val; do_get_full_path(&val); return val; - } - - void set_host(const string& val) { host_ = val; } - const string& host() const { return host_; } - - void set_port(uint16_t val) { port_ = val; } - uint16_t port() const { return port_; } - - void set_secure(bool val) { secure_ = val; } - bool secure() const { return secure_; } - - void set_path(const string& val) { - if (val.empty()) { - path_.assign(1, static_cast('/')); - } else { - ASSERT(val[0] == static_cast('/')); - path_ = val; - } - } - const string& path() const { return path_; } - - void set_query(const string& val) { - ASSERT(val.empty() || (val[0] == static_cast('?'))); - query_ = val; - } - const string& query() const { return query_; } - - bool get_attribute(const string& name, string* value) const; - -private: - void do_set_url(const CTYPE* val, size_t len); - void do_set_address(const CTYPE* val, size_t len); - void do_set_full_path(const CTYPE* val, size_t len); - - void do_get_url(string* val) const; - void do_get_address(string* val) const; - void do_get_full_path(string* val) const; - - string host_, path_, query_; - uint16_t port_; - bool secure_; -}; - -////////////////////////////////////////////////////////////////////// -// HttpData -////////////////////////////////////////////////////////////////////// - -struct HttpData { - typedef std::multimap HeaderMap; - typedef HeaderMap::const_iterator const_iterator; - typedef HeaderMap::iterator iterator; - - HttpVersion version; - scoped_ptr document; - - HttpData(); - - enum HeaderCombine { HC_YES, HC_NO, HC_AUTO, HC_REPLACE, HC_NEW }; - void changeHeader(const std::string& name, const std::string& value, - HeaderCombine combine); - inline void addHeader(const std::string& name, const std::string& value, - bool append = true) { - changeHeader(name, value, append ? HC_AUTO : HC_NO); - } - inline void setHeader(const std::string& name, const std::string& value, - bool overwrite = true) { - changeHeader(name, value, overwrite ? HC_REPLACE : HC_NEW); - } - // Returns count of erased headers - size_t clearHeader(const std::string& name); - // Returns iterator to next header - iterator clearHeader(iterator header); - - // keep in mind, this may not do what you want in the face of multiple headers - bool hasHeader(const std::string& name, std::string* value) const; - - inline const_iterator begin() const { - return headers_.begin(); - } - inline const_iterator end() const { - return headers_.end(); - } - inline iterator begin() { - return headers_.begin(); - } - inline iterator end() { - return headers_.end(); - } - inline const_iterator begin(const std::string& name) const { - return headers_.lower_bound(name); - } - inline const_iterator end(const std::string& name) const { - return headers_.upper_bound(name); - } - inline iterator begin(const std::string& name) { - return headers_.lower_bound(name); - } - inline iterator end(const std::string& name) { - return headers_.upper_bound(name); - } - - // Convenience methods using HttpHeader - inline void changeHeader(HttpHeader header, const std::string& value, - HeaderCombine combine) { - changeHeader(ToString(header), value, combine); - } - inline void addHeader(HttpHeader header, const std::string& value, - bool append = true) { - addHeader(ToString(header), value, append); - } - inline void setHeader(HttpHeader header, const std::string& value, - bool overwrite = true) { - setHeader(ToString(header), value, overwrite); - } - inline void clearHeader(HttpHeader header) { - clearHeader(ToString(header)); - } - inline bool hasHeader(HttpHeader header, std::string* value) const { - return hasHeader(ToString(header), value); - } - inline const_iterator begin(HttpHeader header) const { - return headers_.lower_bound(ToString(header)); - } - inline const_iterator end(HttpHeader header) const { - return headers_.upper_bound(ToString(header)); - } - inline iterator begin(HttpHeader header) { - return headers_.lower_bound(ToString(header)); - } - inline iterator end(HttpHeader header) { - return headers_.upper_bound(ToString(header)); - } - - void setContent(const std::string& content_type, StreamInterface* document); - void setDocumentAndLength(StreamInterface* document); - - virtual size_t formatLeader(char* buffer, size_t size) const = 0; - virtual HttpError parseLeader(const char* line, size_t len) = 0; - -protected: - virtual ~HttpData(); - void clear(bool release_document); - void copy(const HttpData& src); - -private: - HeaderMap headers_; -}; - -struct HttpRequestData : public HttpData { - HttpVerb verb; - std::string path; - - HttpRequestData() : verb(HV_GET) { } - - void clear(bool release_document); - void copy(const HttpRequestData& src); - - size_t formatLeader(char* buffer, size_t size) const override; - HttpError parseLeader(const char* line, size_t len) override; - - bool getAbsoluteUri(std::string* uri) const; - bool getRelativeUri(std::string* host, std::string* path) const; -}; - -struct HttpResponseData : public HttpData { - uint32_t scode; - std::string message; - - HttpResponseData() : scode(HC_INTERNAL_SERVER_ERROR) { } - void clear(bool release_document); - void copy(const HttpResponseData& src); - - // Convenience methods - void set_success(uint32_t scode = HC_OK); - void set_success(const std::string& content_type, - StreamInterface* document, - uint32_t scode = HC_OK); - void set_redirect(const std::string& location, - uint32_t scode = HC_MOVED_TEMPORARILY); - void set_error(uint32_t scode); - - size_t formatLeader(char* buffer, size_t size) const override; - HttpError parseLeader(const char* line, size_t len) override; -}; - -struct HttpTransaction { - HttpRequestData request; - HttpResponseData response; -}; - -////////////////////////////////////////////////////////////////////// -// Http Authentication -////////////////////////////////////////////////////////////////////// - -struct HttpAuthContext { - std::string auth_method; - HttpAuthContext(const std::string& auth) : auth_method(auth) { } - virtual ~HttpAuthContext() { } -}; - -enum HttpAuthResult { HAR_RESPONSE, HAR_IGNORE, HAR_CREDENTIALS, HAR_ERROR }; - -// 'context' is used by this function to record information between calls. -// Start by passing a null pointer, then pass the same pointer each additional -// call. When the authentication attempt is finished, delete the context. -HttpAuthResult HttpAuthenticate( - const char * challenge, size_t len, - const SocketAddress& server, - const std::string& method, const std::string& uri, - const std::string& username, const CryptString& password, - HttpAuthContext *& context, std::string& response, std::string& auth_method); - -////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_HTTPCOMMON_H__ diff --git a/include/webrtc/base/httprequest.h b/include/webrtc/base/httprequest.h deleted file mode 100644 index fa2ffdb..0000000 --- a/include/webrtc/base/httprequest.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2006 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef _HTTPREQUEST_H_ -#define _HTTPREQUEST_H_ - -#include "webrtc/base/httpclient.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/proxyinfo.h" -#include "webrtc/base/socketserver.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/sslsocketfactory.h" // Deprecated include - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// HttpRequest -/////////////////////////////////////////////////////////////////////////////// - -class FirewallManager; -class MemoryStream; - -class HttpRequest { -public: - HttpRequest(const std::string &user_agent); - ~HttpRequest(); - - void Send(); - - void set_proxy(const ProxyInfo& proxy) { - proxy_ = proxy; - } - void set_firewall(FirewallManager * firewall) { - firewall_ = firewall; - } - - // The DNS name of the host to connect to. - const std::string& host() { return host_; } - void set_host(const std::string& host) { host_ = host; } - - // The port to connect to on the target host. - int port() { return port_; } - void set_port(int port) { port_ = port; } - - // Whether the request should use SSL. - bool secure() { return secure_; } - void set_secure(bool secure) { secure_ = secure; } - - // Returns the redirect when redirection occurs - const std::string& response_redirect() { return response_redirect_; } - - // Time to wait on the download, in ms. Default is 5000 (5s) - int timeout() { return timeout_; } - void set_timeout(int timeout) { timeout_ = timeout; } - - // Fail redirects to allow analysis of redirect urls, etc. - bool fail_redirect() const { return fail_redirect_; } - void set_fail_redirect(bool fail_redirect) { fail_redirect_ = fail_redirect; } - - HttpRequestData& request() { return client_.request(); } - HttpResponseData& response() { return client_.response(); } - HttpErrorType error() { return error_; } - -protected: - void set_error(HttpErrorType error) { error_ = error; } - -private: - ProxyInfo proxy_; - FirewallManager * firewall_; - std::string host_; - int port_; - bool secure_; - int timeout_; - bool fail_redirect_; - HttpClient client_; - HttpErrorType error_; - std::string response_redirect_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// HttpMonitor -/////////////////////////////////////////////////////////////////////////////// - -class HttpMonitor : public sigslot::has_slots<> { -public: - HttpMonitor(SocketServer *ss); - - void reset() { - complete_ = false; - error_ = HE_DEFAULT; - } - - bool done() const { return complete_; } - HttpErrorType error() const { return error_; } - - void Connect(HttpClient* http); - void OnHttpClientComplete(HttpClient * http, HttpErrorType error); - -private: - bool complete_; - HttpErrorType error_; - SocketServer *ss_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc_ - -#endif // _HTTPREQUEST_H_ diff --git a/include/webrtc/base/httpserver.h b/include/webrtc/base/httpserver.h deleted file mode 100644 index 30c8f4c..0000000 --- a/include/webrtc/base/httpserver.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_HTTPSERVER_H__ -#define WEBRTC_BASE_HTTPSERVER_H__ - -#include -#include "webrtc/base/httpbase.h" - -namespace rtc { - -class AsyncSocket; -class HttpServer; -class SocketAddress; - -////////////////////////////////////////////////////////////////////// -// HttpServer -////////////////////////////////////////////////////////////////////// - -const int HTTP_INVALID_CONNECTION_ID = 0; - -struct HttpServerTransaction : public HttpTransaction { -public: - HttpServerTransaction(int id) : connection_id_(id) { } - int connection_id() const { return connection_id_; } - -private: - int connection_id_; -}; - -class HttpServer { -public: - HttpServer(); - virtual ~HttpServer(); - - int HandleConnection(StreamInterface* stream); - // Due to sigslot issues, we can't destroy some streams at an arbitrary time. - sigslot::signal3 SignalConnectionClosed; - - // This signal occurs when the HTTP request headers have been received, but - // before the request body is written to the request document. By default, - // the request document is a MemoryStream. By handling this signal, the - // document can be overridden, in which case the third signal argument should - // be set to true. In the case where the request body should be ignored, - // the document can be set to NULL. Note that the transaction object is still - // owened by the HttpServer at this point. - sigslot::signal3 - SignalHttpRequestHeader; - - // An HTTP request has been made, and is available in the transaction object. - // Populate the transaction's response, and then return the object via the - // Respond method. Note that during this time, ownership of the transaction - // object is transferred, so it may be passed between threads, although - // respond must be called on the server's active thread. - sigslot::signal2 SignalHttpRequest; - void Respond(HttpServerTransaction* transaction); - - // If you want to know when a request completes, listen to this event. - sigslot::signal3 - SignalHttpRequestComplete; - - // Stop processing the connection indicated by connection_id. - // Unless force is true, the server will complete sending a response that is - // in progress. - void Close(int connection_id, bool force); - void CloseAll(bool force); - - // After calling CloseAll, this event is signalled to indicate that all - // outstanding connections have closed. - sigslot::signal1 SignalCloseAllComplete; - -private: - class Connection : private IHttpNotify { - public: - Connection(int connection_id, HttpServer* server); - ~Connection() override; - - void BeginProcess(StreamInterface* stream); - StreamInterface* EndProcess(); - - void Respond(HttpServerTransaction* transaction); - void InitiateClose(bool force); - - // IHttpNotify Interface - HttpError onHttpHeaderComplete(bool chunked, size_t& data_size) override; - void onHttpComplete(HttpMode mode, HttpError err) override; - void onHttpClosed(HttpError err) override; - - int connection_id_; - HttpServer* server_; - HttpBase base_; - HttpServerTransaction* current_; - bool signalling_, close_; - }; - - Connection* Find(int connection_id); - void Remove(int connection_id); - - friend class Connection; - typedef std::map ConnectionMap; - - ConnectionMap connections_; - int next_connection_id_; - bool closing_; -}; - -////////////////////////////////////////////////////////////////////// - -class HttpListenServer : public HttpServer, public sigslot::has_slots<> { -public: - HttpListenServer(); - ~HttpListenServer() override; - - int Listen(const SocketAddress& address); - bool GetAddress(SocketAddress* address) const; - void StopListening(); - -private: - void OnReadEvent(AsyncSocket* socket); - void OnConnectionClosed(HttpServer* server, int connection_id, - StreamInterface* stream); - - scoped_ptr listener_; -}; - -////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_HTTPSERVER_H__ diff --git a/include/webrtc/base/ifaddrs-android.h b/include/webrtc/base/ifaddrs-android.h deleted file mode 100644 index 10890af..0000000 --- a/include/webrtc/base/ifaddrs-android.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2013 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_IFADDRS_ANDROID_H_ -#define WEBRTC_BASE_IFADDRS_ANDROID_H_ - -#include -#include - - -// Implementation of getifaddrs for Android. -// Fills out a list of ifaddr structs (see below) which contain information -// about every network interface available on the host. -// See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function). -struct ifaddrs { - struct ifaddrs* ifa_next; - char* ifa_name; - unsigned int ifa_flags; - struct sockaddr* ifa_addr; - struct sockaddr* ifa_netmask; - // Real ifaddrs has broadcast, point to point and data members. - // We don't need them (yet?). -}; - -namespace rtc { - -int getifaddrs(struct ifaddrs** result); -void freeifaddrs(struct ifaddrs* addrs); - -} // namespace rtc - -#endif // WEBRTC_BASE_IFADDRS_ANDROID_H_ diff --git a/include/webrtc/base/ipaddress.h b/include/webrtc/base/ipaddress.h deleted file mode 100644 index ef1e3d8..0000000 --- a/include/webrtc/base/ipaddress.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_IPADDRESS_H_ -#define WEBRTC_BASE_IPADDRESS_H_ - -#if defined(WEBRTC_POSIX) -#include -#include -#include -#include -#endif -#if defined(WEBRTC_WIN) -#include -#include -#endif -#include -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/byteorder.h" -#if defined(WEBRTC_WIN) -#include "webrtc/base/win32.h" -#endif - -namespace rtc { - -enum IPv6AddressFlag { - IPV6_ADDRESS_FLAG_NONE = 0x00, - - // Temporary address is dynamic by nature and will not carry MAC - // address. - IPV6_ADDRESS_FLAG_TEMPORARY = 1 << 0, - - // Temporary address could become deprecated once the preferred - // lifetime is reached. It is still valid but just shouldn't be used - // to create new connection. - IPV6_ADDRESS_FLAG_DEPRECATED = 1 << 1, -}; - -// Version-agnostic IP address class, wraps a union of in_addr and in6_addr. -class IPAddress { - public: - IPAddress() : family_(AF_UNSPEC) { - ::memset(&u_, 0, sizeof(u_)); - } - - explicit IPAddress(const in_addr& ip4) : family_(AF_INET) { - memset(&u_, 0, sizeof(u_)); - u_.ip4 = ip4; - } - - explicit IPAddress(const in6_addr& ip6) : family_(AF_INET6) { - u_.ip6 = ip6; - } - - explicit IPAddress(uint32_t ip_in_host_byte_order) : family_(AF_INET) { - memset(&u_, 0, sizeof(u_)); - u_.ip4.s_addr = HostToNetwork32(ip_in_host_byte_order); - } - - IPAddress(const IPAddress& other) : family_(other.family_) { - ::memcpy(&u_, &other.u_, sizeof(u_)); - } - - virtual ~IPAddress() {} - - const IPAddress & operator=(const IPAddress& other) { - family_ = other.family_; - ::memcpy(&u_, &other.u_, sizeof(u_)); - return *this; - } - - bool operator==(const IPAddress& other) const; - bool operator!=(const IPAddress& other) const; - bool operator <(const IPAddress& other) const; - bool operator >(const IPAddress& other) const; - friend std::ostream& operator<<(std::ostream& os, const IPAddress& addr); - - int family() const { return family_; } - in_addr ipv4_address() const; - in6_addr ipv6_address() const; - - // Returns the number of bytes needed to store the raw address. - size_t Size() const; - - // Wraps inet_ntop. - std::string ToString() const; - - // Same as ToString but anonymizes it by hiding the last part. - std::string ToSensitiveString() const; - - // Returns an unmapped address from a possibly-mapped address. - // Returns the same address if this isn't a mapped address. - IPAddress Normalized() const; - - // Returns this address as an IPv6 address. - // Maps v4 addresses (as ::ffff:a.b.c.d), returns v6 addresses unchanged. - IPAddress AsIPv6Address() const; - - // For socketaddress' benefit. Returns the IP in host byte order. - uint32_t v4AddressAsHostOrderInteger() const; - - // Whether this is an unspecified IP address. - bool IsNil() const; - - private: - int family_; - union { - in_addr ip4; - in6_addr ip6; - } u_; -}; - -// IP class which could represent IPv6 address flags which is only -// meaningful in IPv6 case. -class InterfaceAddress : public IPAddress { - public: - InterfaceAddress() : ipv6_flags_(IPV6_ADDRESS_FLAG_NONE) {} - - InterfaceAddress(IPAddress ip) - : IPAddress(ip), ipv6_flags_(IPV6_ADDRESS_FLAG_NONE) {} - - InterfaceAddress(IPAddress addr, int ipv6_flags) - : IPAddress(addr), ipv6_flags_(ipv6_flags) {} - - InterfaceAddress(const in6_addr& ip6, int ipv6_flags) - : IPAddress(ip6), ipv6_flags_(ipv6_flags) {} - - const InterfaceAddress & operator=(const InterfaceAddress& other); - - bool operator==(const InterfaceAddress& other) const; - bool operator!=(const InterfaceAddress& other) const; - - int ipv6_flags() const { return ipv6_flags_; } - friend std::ostream& operator<<(std::ostream& os, - const InterfaceAddress& addr); - - private: - int ipv6_flags_; -}; - -bool IPFromAddrInfo(struct addrinfo* info, IPAddress* out); -bool IPFromString(const std::string& str, IPAddress* out); -bool IPFromString(const std::string& str, int flags, - InterfaceAddress* out); -bool IPIsAny(const IPAddress& ip); -bool IPIsLoopback(const IPAddress& ip); -bool IPIsPrivate(const IPAddress& ip); -bool IPIsUnspec(const IPAddress& ip); -size_t HashIP(const IPAddress& ip); - -// These are only really applicable for IPv6 addresses. -bool IPIs6Bone(const IPAddress& ip); -bool IPIs6To4(const IPAddress& ip); -bool IPIsLinkLocal(const IPAddress& ip); -bool IPIsMacBased(const IPAddress& ip); -bool IPIsSiteLocal(const IPAddress& ip); -bool IPIsTeredo(const IPAddress& ip); -bool IPIsULA(const IPAddress& ip); -bool IPIsV4Compatibility(const IPAddress& ip); -bool IPIsV4Mapped(const IPAddress& ip); - -// Returns the precedence value for this IP as given in RFC3484. -int IPAddressPrecedence(const IPAddress& ip); - -// Returns 'ip' truncated to be 'length' bits long. -IPAddress TruncateIP(const IPAddress& ip, int length); - -IPAddress GetLoopbackIP(int family); -IPAddress GetAnyIP(int family); - -// Returns the number of contiguously set bits, counting from the MSB in network -// byte order, in this IPAddress. Bits after the first 0 encountered are not -// counted. -int CountIPMaskBits(IPAddress mask); - -} // namespace rtc - -#endif // WEBRTC_BASE_IPADDRESS_H_ diff --git a/include/webrtc/base/json.h b/include/webrtc/base/json.h deleted file mode 100644 index 4c0d222..0000000 --- a/include/webrtc/base/json.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_JSON_H_ -#define WEBRTC_BASE_JSON_H_ - -#include -#include - -#if !defined(WEBRTC_EXTERNAL_JSON) -#include "json/json.h" -#else -#include "third_party/jsoncpp/json.h" -#endif - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// JSON Helpers -/////////////////////////////////////////////////////////////////////////////// - -// Robust conversion operators, better than the ones in JsonCpp. -bool GetIntFromJson(const Json::Value& in, int* out); -bool GetUIntFromJson(const Json::Value& in, unsigned int* out); -bool GetStringFromJson(const Json::Value& in, std::string* out); -bool GetBoolFromJson(const Json::Value& in, bool* out); -bool GetDoubleFromJson(const Json::Value& in, double* out); - -// Pull values out of a JSON array. -bool GetValueFromJsonArray(const Json::Value& in, size_t n, - Json::Value* out); -bool GetIntFromJsonArray(const Json::Value& in, size_t n, - int* out); -bool GetUIntFromJsonArray(const Json::Value& in, size_t n, - unsigned int* out); -bool GetStringFromJsonArray(const Json::Value& in, size_t n, - std::string* out); -bool GetBoolFromJsonArray(const Json::Value& in, size_t n, - bool* out); -bool GetDoubleFromJsonArray(const Json::Value& in, size_t n, - double* out); - -// Convert json arrays to std::vector -bool JsonArrayToValueVector(const Json::Value& in, - std::vector* out); -bool JsonArrayToIntVector(const Json::Value& in, - std::vector* out); -bool JsonArrayToUIntVector(const Json::Value& in, - std::vector* out); -bool JsonArrayToStringVector(const Json::Value& in, - std::vector* out); -bool JsonArrayToBoolVector(const Json::Value& in, - std::vector* out); -bool JsonArrayToDoubleVector(const Json::Value& in, - std::vector* out); - -// Convert std::vector to json array -Json::Value ValueVectorToJsonArray(const std::vector& in); -Json::Value IntVectorToJsonArray(const std::vector& in); -Json::Value UIntVectorToJsonArray(const std::vector& in); -Json::Value StringVectorToJsonArray(const std::vector& in); -Json::Value BoolVectorToJsonArray(const std::vector& in); -Json::Value DoubleVectorToJsonArray(const std::vector& in); - -// Pull values out of a JSON object. -bool GetValueFromJsonObject(const Json::Value& in, const std::string& k, - Json::Value* out); -bool GetIntFromJsonObject(const Json::Value& in, const std::string& k, - int* out); -bool GetUIntFromJsonObject(const Json::Value& in, const std::string& k, - unsigned int* out); -bool GetStringFromJsonObject(const Json::Value& in, const std::string& k, - std::string* out); -bool GetBoolFromJsonObject(const Json::Value& in, const std::string& k, - bool* out); -bool GetDoubleFromJsonObject(const Json::Value& in, const std::string& k, - double* out); - -// Writes out a Json value as a string. -std::string JsonValueToString(const Json::Value& json); - -} // namespace rtc - -#endif // WEBRTC_BASE_JSON_H_ diff --git a/include/webrtc/base/keep_ref_until_done.h b/include/webrtc/base/keep_ref_until_done.h deleted file mode 100644 index 269e1c8..0000000 --- a/include/webrtc/base/keep_ref_until_done.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_KEEP_REF_UNTIL_DONE_H_ -#define WEBRTC_BASE_KEEP_REF_UNTIL_DONE_H_ - -#include "webrtc/base/bind.h" -#include "webrtc/base/callback.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ref_ptr.h" - -namespace rtc { - -namespace impl { -template -static inline void DoNothing(const scoped_refptr& object) {} -} // namespace impl - -// KeepRefUntilDone keeps a reference to |object| until the returned -// callback goes out of scope. If the returned callback is copied, the -// reference will be released when the last callback goes out of scope. -template -static inline Callback0 KeepRefUntilDone(ObjectT* object) { - return rtc::Bind(&impl::DoNothing, scoped_refptr(object)); -} - -template -static inline Callback0 KeepRefUntilDone( - const scoped_refptr& object) { - return rtc::Bind(&impl::DoNothing, object); -} - -} // namespace rtc - - -#endif // WEBRTC_BASE_KEEP_REF_UNTIL_DONE_H_ diff --git a/include/webrtc/base/latebindingsymboltable.h b/include/webrtc/base/latebindingsymboltable.h deleted file mode 100644 index 636e7d0..0000000 --- a/include/webrtc/base/latebindingsymboltable.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_LATEBINDINGSYMBOLTABLE_H_ -#define WEBRTC_BASE_LATEBINDINGSYMBOLTABLE_H_ - -#include - -#include "webrtc/base/common.h" - -namespace rtc { - -#if defined(WEBRTC_POSIX) -typedef void *DllHandle; -#else -#error Not implemented for this platform -#endif - -// This is the base class for "symbol table" classes to simplify the dynamic -// loading of symbols from DLLs. Currently the implementation only supports -// Linux and OS X, and pure C symbols (or extern "C" symbols that wrap C++ -// functions). Sub-classes for specific DLLs are generated via the "supermacro" -// files latebindingsymboltable.h.def and latebindingsymboltable.cc.def. See -// talk/sound/pulseaudiosymboltable.(h|cc) for an example. -class LateBindingSymbolTable { - public: - struct TableInfo { - const char *dll_name; - int num_symbols; - // Array of size num_symbols. - const char *const *symbol_names; - }; - - LateBindingSymbolTable(const TableInfo *info, void **table); - ~LateBindingSymbolTable(); - - bool IsLoaded() const; - // Loads the DLL and the symbol table. Returns true iff the DLL and symbol - // table loaded successfully. - bool Load(); - // Like load, but allows overriding the dll path for when the dll path is - // dynamic. - bool LoadFromPath(const char *dll_path); - void Unload(); - - // Gets the raw OS handle to the DLL. Be careful what you do with it. - DllHandle GetDllHandle() const { return handle_; } - - private: - void ClearSymbols(); - - const TableInfo *info_; - void **table_; - DllHandle handle_; - bool undefined_symbols_; - - RTC_DISALLOW_COPY_AND_ASSIGN(LateBindingSymbolTable); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_LATEBINDINGSYMBOLTABLE_H_ diff --git a/include/webrtc/base/libdbusglibsymboltable.h b/include/webrtc/base/libdbusglibsymboltable.h deleted file mode 100644 index b87b4c1..0000000 --- a/include/webrtc/base/libdbusglibsymboltable.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_LIBDBUSGLIBSYMBOLTABLE_H_ -#define WEBRTC_BASE_LIBDBUSGLIBSYMBOLTABLE_H_ - -#ifdef HAVE_DBUS_GLIB - -#include -#include - -#include "webrtc/base/latebindingsymboltable.h" - -namespace rtc { - -#define LIBDBUS_GLIB_CLASS_NAME LibDBusGlibSymbolTable -// The libdbus-glib symbols we need, as an X-Macro list. -// This list must contain precisely every libdbus-glib function that is used in -// dbus.cc. -#define LIBDBUS_GLIB_SYMBOLS_LIST \ - X(dbus_bus_add_match) \ - X(dbus_connection_add_filter) \ - X(dbus_connection_close) \ - X(dbus_connection_remove_filter) \ - X(dbus_connection_set_exit_on_disconnect) \ - X(dbus_g_bus_get) \ - X(dbus_g_bus_get_private) \ - X(dbus_g_connection_get_connection) \ - X(dbus_g_connection_unref) \ - X(dbus_g_thread_init) \ - X(dbus_message_get_interface) \ - X(dbus_message_get_member) \ - X(dbus_message_get_path) \ - X(dbus_message_get_type) \ - X(dbus_message_iter_get_arg_type) \ - X(dbus_message_iter_get_basic) \ - X(dbus_message_iter_init) \ - X(dbus_message_ref) \ - X(dbus_message_unref) - -#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBDBUS_GLIB_CLASS_NAME -#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBDBUS_GLIB_SYMBOLS_LIST -#include "webrtc/base/latebindingsymboltable.h.def" - -} // namespace rtc - -#endif // HAVE_DBUS_GLIB - -#endif // WEBRTC_BASE_LIBDBUSGLIBSYMBOLTABLE_H_ diff --git a/include/webrtc/base/linked_ptr.h b/include/webrtc/base/linked_ptr.h deleted file mode 100644 index 65e5a00..0000000 --- a/include/webrtc/base/linked_ptr.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -/* - * linked_ptr - simple reference linked pointer - * (like reference counting, just using a linked list of the references - * instead of their count.) - * - * The implementation stores three pointers for every linked_ptr, but - * does not allocate anything on the free store. - */ - -#ifndef WEBRTC_BASE_LINKED_PTR_H__ -#define WEBRTC_BASE_LINKED_PTR_H__ - -namespace rtc { - -/* For ANSI-challenged compilers, you may want to #define - * NO_MEMBER_TEMPLATES, explicit or mutable */ -#define NO_MEMBER_TEMPLATES - -template class linked_ptr -{ -public: - -#ifndef NO_MEMBER_TEMPLATES -# define TEMPLATE_FUNCTION template - TEMPLATE_FUNCTION friend class linked_ptr; -#else -# define TEMPLATE_FUNCTION - typedef X Y; -#endif - - typedef X element_type; - - explicit linked_ptr(X* p = 0) throw() - : itsPtr(p) {itsPrev = itsNext = this;} - ~linked_ptr() - {release();} - linked_ptr(const linked_ptr& r) throw() - {acquire(r);} - linked_ptr& operator=(const linked_ptr& r) - { - if (this != &r) { - release(); - acquire(r); - } - return *this; - } - -#ifndef NO_MEMBER_TEMPLATES - template friend class linked_ptr; - template linked_ptr(const linked_ptr& r) throw() - {acquire(r);} - template linked_ptr& operator=(const linked_ptr& r) - { - if (this != &r) { - release(); - acquire(r); - } - return *this; - } -#endif // NO_MEMBER_TEMPLATES - - X& operator*() const throw() {return *itsPtr;} - X* operator->() const throw() {return itsPtr;} - X* get() const throw() {return itsPtr;} - bool unique() const throw() {return itsPrev ? itsPrev==this : true;} - -private: - X* itsPtr; - mutable const linked_ptr* itsPrev; - mutable const linked_ptr* itsNext; - - void acquire(const linked_ptr& r) throw() - { // insert this to the list - itsPtr = r.itsPtr; - itsNext = r.itsNext; - itsNext->itsPrev = this; - itsPrev = &r; -#ifndef mutable - r.itsNext = this; -#else // for ANSI-challenged compilers - (const_cast*>(&r))->itsNext = this; -#endif - } - -#ifndef NO_MEMBER_TEMPLATES - template void acquire(const linked_ptr& r) throw() - { // insert this to the list - itsPtr = r.itsPtr; - itsNext = r.itsNext; - itsNext->itsPrev = this; - itsPrev = &r; -#ifndef mutable - r.itsNext = this; -#else // for ANSI-challenged compilers - (const_cast*>(&r))->itsNext = this; -#endif - } -#endif // NO_MEMBER_TEMPLATES - - void release() - { // erase this from the list, delete if unique - if (unique()) delete itsPtr; - else { - itsPrev->itsNext = itsNext; - itsNext->itsPrev = itsPrev; - itsPrev = itsNext = 0; - } - itsPtr = 0; - } -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_LINKED_PTR_H__ - diff --git a/include/webrtc/base/linux.h b/include/webrtc/base/linux.h deleted file mode 100644 index ba73b85..0000000 --- a/include/webrtc/base/linux.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_LINUX_H_ -#define WEBRTC_BASE_LINUX_H_ - -#if defined(WEBRTC_LINUX) -#include -#include -#include - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -////////////////////////////////////////////////////////////////////////////// -// ConfigParser parses a FileStream of an ".ini."-type format into a map. -////////////////////////////////////////////////////////////////////////////// - -// Sample Usage: -// ConfigParser parser; -// ConfigParser::MapVector key_val_pairs; -// if (parser.Open(inifile) && parser.Parse(&key_val_pairs)) { -// for (int section_num=0; i < key_val_pairs.size(); ++section_num) { -// std::string val1 = key_val_pairs[section_num][key1]; -// std::string val2 = key_val_pairs[section_num][key2]; -// // Do something with valn; -// } -// } - -class ConfigParser { - public: - typedef std::map SimpleMap; - typedef std::vector MapVector; - - ConfigParser(); - virtual ~ConfigParser(); - - virtual bool Open(const std::string& filename); - virtual void Attach(StreamInterface* stream); - virtual bool Parse(MapVector* key_val_pairs); - virtual bool ParseSection(SimpleMap* key_val_pair); - virtual bool ParseLine(std::string* key, std::string* value); - - private: - scoped_ptr instream_; -}; - -////////////////////////////////////////////////////////////////////////////// -// ProcCpuInfo reads CPU info from the /proc subsystem on any *NIX platform. -////////////////////////////////////////////////////////////////////////////// - -// Sample Usage: -// ProcCpuInfo proc_info; -// int no_of_cpu; -// if (proc_info.LoadFromSystem()) { -// std::string out_str; -// proc_info.GetNumCpus(&no_of_cpu); -// proc_info.GetCpuStringValue(0, "vendor_id", &out_str); -// } -// } - -class ProcCpuInfo { - public: - ProcCpuInfo(); - virtual ~ProcCpuInfo(); - - // Reads the proc subsystem's cpu info into memory. If this fails, this - // returns false; if it succeeds, it returns true. - virtual bool LoadFromSystem(); - - // Obtains the number of logical CPU threads and places the value num. - virtual bool GetNumCpus(int* num); - - // Obtains the number of physical CPU cores and places the value num. - virtual bool GetNumPhysicalCpus(int* num); - - // Obtains the CPU family id. - virtual bool GetCpuFamily(int* id); - - // Obtains the number of sections in /proc/cpuinfo, which may be greater - // than the number of CPUs (e.g. on ARM) - virtual bool GetSectionCount(size_t* count); - - // Looks for the CPU proc item with the given name for the given section - // number and places the string value in result. - virtual bool GetSectionStringValue(size_t section_num, const std::string& key, - std::string* result); - - // Looks for the CPU proc item with the given name for the given section - // number and places the int value in result. - virtual bool GetSectionIntValue(size_t section_num, const std::string& key, - int* result); - - private: - ConfigParser::MapVector sections_; -}; - -// Returns the output of "uname". -std::string ReadLinuxUname(); - -// Returns the content (int) of -// /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq -// Returns -1 on error. -int ReadCpuMaxFreq(); - -} // namespace rtc - -#endif // defined(WEBRTC_LINUX) -#endif // WEBRTC_BASE_LINUX_H_ diff --git a/include/webrtc/base/linuxfdwalk.h b/include/webrtc/base/linuxfdwalk.h deleted file mode 100644 index fe5a697..0000000 --- a/include/webrtc/base/linuxfdwalk.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_LINUXFDWALK_H_ -#define WEBRTC_BASE_LINUXFDWALK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -// Linux port of SunOS's fdwalk(3) call. It loops over all open file descriptors -// and calls func on each one. Additionally, it is safe to use from the child -// of a fork that hasn't exec'ed yet, so you can use it to close all open file -// descriptors prior to exec'ing a daemon. -// The return value is 0 if successful, or else -1 and errno is set. The -// possible errors include any error that can be returned by opendir(), -// readdir(), or closedir(), plus EBADF if there are problems parsing the -// contents of /proc/self/fd. -// The file descriptors that are enumerated will not include the file descriptor -// used for the enumeration itself. -int fdwalk(void (*func)(void *, int), void *opaque); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBRTC_BASE_LINUXFDWALK_H_ diff --git a/include/webrtc/base/logging.h b/include/webrtc/base/logging.h deleted file mode 100644 index e40ca44..0000000 --- a/include/webrtc/base/logging.h +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// LOG(...) an ostream target that can be used to send formatted -// output to a variety of logging targets, such as debugger console, stderr, -// or any LogSink. -// The severity level passed as the first argument to the LOGging -// functions is used as a filter, to limit the verbosity of the logging. -// Static members of LogMessage documented below are used to control the -// verbosity and target of the output. -// There are several variations on the LOG macro which facilitate logging -// of common error conditions, detailed below. - -// LOG(sev) logs the given stream at severity "sev", which must be a -// compile-time constant of the LoggingSeverity type, without the namespace -// prefix. -// LOG_V(sev) Like LOG(), but sev is a run-time variable of the LoggingSeverity -// type (basically, it just doesn't prepend the namespace). -// LOG_F(sev) Like LOG(), but includes the name of the current function. -// LOG_T(sev) Like LOG(), but includes the this pointer. -// LOG_T_F(sev) Like LOG_F(), but includes the this pointer. -// LOG_GLE(M)(sev [, mod]) attempt to add a string description of the -// HRESULT returned by GetLastError. The "M" variant allows searching of a -// DLL's string table for the error description. -// LOG_ERRNO(sev) attempts to add a string description of an errno-derived -// error. errno and associated facilities exist on both Windows and POSIX, -// but on Windows they only apply to the C/C++ runtime. -// LOG_ERR(sev) is an alias for the platform's normal error system, i.e. _GLE on -// Windows and _ERRNO on POSIX. -// (The above three also all have _EX versions that let you specify the error -// code, rather than using the last one.) -// LOG_E(sev, ctx, err, ...) logs a detailed error interpreted using the -// specified context. -// LOG_CHECK_LEVEL(sev) (and LOG_CHECK_LEVEL_V(sev)) can be used as a test -// before performing expensive or sensitive operations whose sole purpose is -// to output logging data at the desired level. -// Lastly, PLOG(sev, err) is an alias for LOG_ERR_EX. - -#ifndef WEBRTC_BASE_LOGGING_H_ -#define WEBRTC_BASE_LOGGING_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" // NOLINT -#endif - -#include -#include -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/thread_annotations.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// ConstantLabel can be used to easily generate string names from constant -// values. This can be useful for logging descriptive names of error messages. -// Usage: -// const ConstantLabel LIBRARY_ERRORS[] = { -// KLABEL(SOME_ERROR), -// KLABEL(SOME_OTHER_ERROR), -// ... -// LASTLABEL -// } -// -// int err = LibraryFunc(); -// LOG(LS_ERROR) << "LibraryFunc returned: " -// << ErrorName(err, LIBRARY_ERRORS); - -struct ConstantLabel { int value; const char * label; }; -#define KLABEL(x) { x, #x } -#define TLABEL(x, y) { x, y } -#define LASTLABEL { 0, 0 } - -const char* FindLabel(int value, const ConstantLabel entries[]); -std::string ErrorName(int err, const ConstantLabel* err_table); - -////////////////////////////////////////////////////////////////////// - -// Note that the non-standard LoggingSeverity aliases exist because they are -// still in broad use. The meanings of the levels are: -// LS_SENSITIVE: Information which should only be logged with the consent -// of the user, due to privacy concerns. -// LS_VERBOSE: This level is for data which we do not want to appear in the -// normal debug log, but should appear in diagnostic logs. -// LS_INFO: Chatty level used in debugging for all sorts of things, the default -// in debug builds. -// LS_WARNING: Something that may warrant investigation. -// LS_ERROR: Something that should not have occurred. -// LS_NONE: Don't log. -enum LoggingSeverity { - LS_SENSITIVE, - LS_VERBOSE, - LS_INFO, - LS_WARNING, - LS_ERROR, - LS_NONE, - INFO = LS_INFO, - WARNING = LS_WARNING, - LERROR = LS_ERROR -}; - -// LogErrorContext assists in interpreting the meaning of an error value. -enum LogErrorContext { - ERRCTX_NONE, - ERRCTX_ERRNO, // System-local errno - ERRCTX_HRESULT, // Windows HRESULT - ERRCTX_OSSTATUS, // MacOS OSStatus - - // Abbreviations for LOG_E macro - ERRCTX_EN = ERRCTX_ERRNO, // LOG_E(sev, EN, x) - ERRCTX_HR = ERRCTX_HRESULT, // LOG_E(sev, HR, x) - ERRCTX_OS = ERRCTX_OSSTATUS, // LOG_E(sev, OS, x) -}; - -// Virtual sink interface that can receive log messages. -class LogSink { - public: - LogSink() {} - virtual ~LogSink() {} - virtual void OnLogMessage(const std::string& message) = 0; -}; - -class LogMessage { - public: - LogMessage(const char* file, int line, LoggingSeverity sev, - LogErrorContext err_ctx = ERRCTX_NONE, int err = 0, - const char* module = NULL); - - LogMessage(const char* file, - int line, - LoggingSeverity sev, - const std::string& tag); - - ~LogMessage(); - - static inline bool Loggable(LoggingSeverity sev) { return (sev >= min_sev_); } - std::ostream& stream() { return print_stream_; } - - // Returns the time at which this function was called for the first time. - // The time will be used as the logging start time. - // If this is not called externally, the LogMessage ctor also calls it, in - // which case the logging start time will be the time of the first LogMessage - // instance is created. - static uint32_t LogStartTime(); - - // Returns the wall clock equivalent of |LogStartTime|, in seconds from the - // epoch. - static uint32_t WallClockStartTime(); - - // LogThreads: Display the thread identifier of the current thread - static void LogThreads(bool on = true); - - // LogTimestamps: Display the elapsed time of the program - static void LogTimestamps(bool on = true); - - // These are the available logging channels - // Debug: Debug console on Windows, otherwise stderr - static void LogToDebug(LoggingSeverity min_sev); - static LoggingSeverity GetLogToDebug() { return dbg_sev_; } - - // Sets whether logs will be directed to stderr in debug mode. - static void SetLogToStderr(bool log_to_stderr); - - // Stream: Any non-blocking stream interface. LogMessage takes ownership of - // the stream. Multiple streams may be specified by using AddLogToStream. - // LogToStream is retained for backwards compatibility; when invoked, it - // will discard any previously set streams and install the specified stream. - // GetLogToStream gets the severity for the specified stream, of if none - // is specified, the minimum stream severity. - // RemoveLogToStream removes the specified stream, without destroying it. - static int GetLogToStream(LogSink* stream = NULL); - static void AddLogToStream(LogSink* stream, LoggingSeverity min_sev); - static void RemoveLogToStream(LogSink* stream); - - // Testing against MinLogSeverity allows code to avoid potentially expensive - // logging operations by pre-checking the logging level. - static int GetMinLogSeverity() { return min_sev_; } - - // Parses the provided parameter stream to configure the options above. - // Useful for configuring logging from the command line. - static void ConfigureLogging(const char* params); - - private: - typedef std::pair StreamAndSeverity; - typedef std::list StreamList; - - // Updates min_sev_ appropriately when debug sinks change. - static void UpdateMinLogSeverity(); - - // These write out the actual log messages. - static void OutputToDebug(const std::string& msg, - LoggingSeverity severity, - const std::string& tag); - - // The ostream that buffers the formatted message before output - std::ostringstream print_stream_; - - // The severity level of this message - LoggingSeverity severity_; - - // The Android debug output tag. - std::string tag_; - - // String data generated in the constructor, that should be appended to - // the message before output. - std::string extra_; - - // dbg_sev_ is the thresholds for those output targets - // min_sev_ is the minimum (most verbose) of those levels, and is used - // as a short-circuit in the logging macros to identify messages that won't - // be logged. - // ctx_sev_ is the minimum level at which file context is displayed - static LoggingSeverity min_sev_, dbg_sev_, ctx_sev_; - - // The output streams and their associated severities - static StreamList streams_; - - // Flags for formatting options - static bool thread_, timestamp_; - - // Determines if logs will be directed to stderr in debug mode. - static bool log_to_stderr_; - - RTC_DISALLOW_COPY_AND_ASSIGN(LogMessage); -}; - -////////////////////////////////////////////////////////////////////// -// Logging Helpers -////////////////////////////////////////////////////////////////////// - -class LogMultilineState { - public: - size_t unprintable_count_[2]; - LogMultilineState() { - unprintable_count_[0] = unprintable_count_[1] = 0; - } -}; - -// When possible, pass optional state variable to track various data across -// multiple calls to LogMultiline. Otherwise, pass NULL. -void LogMultiline(LoggingSeverity level, const char* label, bool input, - const void* data, size_t len, bool hex_mode, - LogMultilineState* state); - -#ifndef LOG - -// The following non-obvious technique for implementation of a -// conditional log stream was stolen from google3/base/logging.h. - -// This class is used to explicitly ignore values in the conditional -// logging macros. This avoids compiler warnings like "value computed -// is not used" and "statement has no effect". - -class LogMessageVoidify { - public: - LogMessageVoidify() { } - // This has to be an operator with a precedence lower than << but - // higher than ?: - void operator&(std::ostream&) { } -}; - -#define LOG_SEVERITY_PRECONDITION(sev) \ - !(rtc::LogMessage::Loggable(sev)) \ - ? (void) 0 \ - : rtc::LogMessageVoidify() & - -#define LOG(sev) \ - LOG_SEVERITY_PRECONDITION(rtc::sev) \ - rtc::LogMessage(__FILE__, __LINE__, rtc::sev).stream() - -// The _V version is for when a variable is passed in. It doesn't do the -// namespace concatination. -#define LOG_V(sev) \ - LOG_SEVERITY_PRECONDITION(sev) \ - rtc::LogMessage(__FILE__, __LINE__, sev).stream() - -// The _F version prefixes the message with the current function name. -#if (defined(__GNUC__) && !defined(NDEBUG)) || defined(WANT_PRETTY_LOG_F) -#define LOG_F(sev) LOG(sev) << __PRETTY_FUNCTION__ << ": " -#define LOG_T_F(sev) LOG(sev) << this << ": " << __PRETTY_FUNCTION__ << ": " -#else -#define LOG_F(sev) LOG(sev) << __FUNCTION__ << ": " -#define LOG_T_F(sev) LOG(sev) << this << ": " << __FUNCTION__ << ": " -#endif - -#define LOG_CHECK_LEVEL(sev) \ - rtc::LogCheckLevel(rtc::sev) -#define LOG_CHECK_LEVEL_V(sev) \ - rtc::LogCheckLevel(sev) - -inline bool LogCheckLevel(LoggingSeverity sev) { - return (LogMessage::GetMinLogSeverity() <= sev); -} - -#define LOG_E(sev, ctx, err, ...) \ - LOG_SEVERITY_PRECONDITION(rtc::sev) \ - rtc::LogMessage(__FILE__, __LINE__, rtc::sev, \ - rtc::ERRCTX_ ## ctx, err , ##__VA_ARGS__) \ - .stream() - -#define LOG_T(sev) LOG(sev) << this << ": " - -#define LOG_ERRNO_EX(sev, err) \ - LOG_E(sev, ERRNO, err) -#define LOG_ERRNO(sev) \ - LOG_ERRNO_EX(sev, errno) - -#if defined(WEBRTC_WIN) -#define LOG_GLE_EX(sev, err) \ - LOG_E(sev, HRESULT, err) -#define LOG_GLE(sev) \ - LOG_GLE_EX(sev, GetLastError()) -#define LOG_GLEM(sev, mod) \ - LOG_E(sev, HRESULT, GetLastError(), mod) -#define LOG_ERR_EX(sev, err) \ - LOG_GLE_EX(sev, err) -#define LOG_ERR(sev) \ - LOG_GLE(sev) -#define LAST_SYSTEM_ERROR \ - (::GetLastError()) -#elif __native_client__ -#define LOG_ERR_EX(sev, err) \ - LOG(sev) -#define LOG_ERR(sev) \ - LOG(sev) -#define LAST_SYSTEM_ERROR \ - (0) -#elif defined(WEBRTC_POSIX) -#define LOG_ERR_EX(sev, err) \ - LOG_ERRNO_EX(sev, err) -#define LOG_ERR(sev) \ - LOG_ERRNO(sev) -#define LAST_SYSTEM_ERROR \ - (errno) -#endif // WEBRTC_WIN - -#define LOG_TAG(sev, tag) \ - LOG_SEVERITY_PRECONDITION(sev) \ - rtc::LogMessage(NULL, 0, sev, tag).stream() - -#define PLOG(sev, err) \ - LOG_ERR_EX(sev, err) - -// TODO(?): Add an "assert" wrapper that logs in the same manner. - -#endif // LOG - -} // namespace rtc - -#endif // WEBRTC_BASE_LOGGING_H_ diff --git a/include/webrtc/base/logsinks.h b/include/webrtc/base/logsinks.h deleted file mode 100644 index eabf056..0000000 --- a/include/webrtc/base/logsinks.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_FILE_ROTATING_LOG_SINK_H_ -#define WEBRTC_BASE_FILE_ROTATING_LOG_SINK_H_ - -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/filerotatingstream.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -// Log sink that uses a FileRotatingStream to write to disk. -// Init() must be called before adding this sink. -class FileRotatingLogSink : public LogSink { - public: - // |num_log_files| must be greater than 1 and |max_log_size| must be greater - // than 0. - FileRotatingLogSink(const std::string& log_dir_path, - const std::string& log_prefix, - size_t max_log_size, - size_t num_log_files); - ~FileRotatingLogSink() override; - - // Writes the message to the current file. It will spill over to the next - // file if needed. - void OnLogMessage(const std::string& message) override; - - // Deletes any existing files in the directory and creates a new log file. - virtual bool Init(); - - // Disables buffering on the underlying stream. - bool DisableBuffering(); - - protected: - explicit FileRotatingLogSink(FileRotatingStream* stream); - - private: - scoped_ptr stream_; - - RTC_DISALLOW_COPY_AND_ASSIGN(FileRotatingLogSink); -}; - -// Log sink that uses a CallSessionFileRotatingStream to write to disk. -// Init() must be called before adding this sink. -class CallSessionFileRotatingLogSink : public FileRotatingLogSink { - public: - CallSessionFileRotatingLogSink(const std::string& log_dir_path, - size_t max_total_log_size); - ~CallSessionFileRotatingLogSink() override; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(CallSessionFileRotatingLogSink); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_FILE_ROTATING_LOG_SINK_H_ diff --git a/include/webrtc/base/macasyncsocket.h b/include/webrtc/base/macasyncsocket.h deleted file mode 100644 index 5861ee3..0000000 --- a/include/webrtc/base/macasyncsocket.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -// MacAsyncSocket is a kind of AsyncSocket. It only creates sockets -// of the TCP type, and does not (yet) support listen and accept. It works -// asynchronously, which means that users of this socket should connect to -// the various events declared in asyncsocket.h to receive notifications about -// this socket. - -#ifndef WEBRTC_BASE_MACASYNCSOCKET_H__ -#define WEBRTC_BASE_MACASYNCSOCKET_H__ - -#include - -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/nethelpers.h" - -namespace rtc { - -class MacBaseSocketServer; - -class MacAsyncSocket : public AsyncSocket, public sigslot::has_slots<> { - public: - MacAsyncSocket(MacBaseSocketServer* ss, int family); - ~MacAsyncSocket() override; - - bool valid() const { return source_ != NULL; } - - // Socket interface - SocketAddress GetLocalAddress() const override; - SocketAddress GetRemoteAddress() const override; - int Bind(const SocketAddress& addr) override; - int Connect(const SocketAddress& addr) override; - int Send(const void* buffer, size_t length) override; - int SendTo(const void* buffer, - size_t length, - const SocketAddress& addr) override; - int Recv(void* buffer, size_t length) override; - int RecvFrom(void* buffer, size_t length, SocketAddress* out_addr) override; - int Listen(int backlog) override; - MacAsyncSocket* Accept(SocketAddress* out_addr) override; - int Close() override; - int GetError() const override; - void SetError(int error) override; - ConnState GetState() const override; - int EstimateMTU(uint16_t* mtu) override; - int GetOption(Option opt, int* value) override; - int SetOption(Option opt, int value) override; - - // For the MacBaseSocketServer to disable callbacks when process_io is false. - void EnableCallbacks(); - void DisableCallbacks(); - - protected: - void OnResolveResult(SignalThread* thread); - int DoConnect(const SocketAddress& addr); - - private: - // Creates an async socket from an existing bsd socket - MacAsyncSocket(MacBaseSocketServer* ss, int family, int native_socket); - - // Attaches the socket to the CFRunloop and sets the wrapped bsd socket - // to async mode - void Initialize(int family); - - // Translate the SocketAddress into a CFDataRef to pass to CF socket - // functions. Caller must call CFRelease on the result when done. - static CFDataRef CopyCFAddress(const SocketAddress& address); - - // Callback for the underlying CFSocketRef. - static void MacAsyncSocketCallBack(CFSocketRef s, - CFSocketCallBackType callbackType, - CFDataRef address, - const void* data, - void* info); - - MacBaseSocketServer* ss_; - CFSocketRef socket_; - int native_socket_; - CFRunLoopSourceRef source_; - int current_callbacks_; - bool disabled_; - int error_; - ConnState state_; - AsyncResolver* resolver_; - - RTC_DISALLOW_COPY_AND_ASSIGN(MacAsyncSocket); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MACASYNCSOCKET_H__ diff --git a/include/webrtc/base/maccocoasocketserver.h b/include/webrtc/base/maccocoasocketserver.h deleted file mode 100644 index 0acf8d7..0000000 --- a/include/webrtc/base/maccocoasocketserver.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2007 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// A libjingle compatible SocketServer for OSX/iOS/Cocoa. - -#ifndef WEBRTC_BASE_MACCOCOASOCKETSERVER_H_ -#define WEBRTC_BASE_MACCOCOASOCKETSERVER_H_ - -#include "webrtc/base/macsocketserver.h" - -#ifdef __OBJC__ -@class NSTimer, MacCocoaSocketServerHelperRtc; -#else -class NSTimer; -class MacCocoaSocketServerHelperRtc; -#endif - -namespace rtc { - -// A socketserver implementation that wraps the main cocoa -// application loop accessed through [NSApp run]. -class MacCocoaSocketServer : public MacBaseSocketServer { - public: - explicit MacCocoaSocketServer(); - ~MacCocoaSocketServer() override; - - bool Wait(int cms, bool process_io) override; - void WakeUp() override; - - private: - MacCocoaSocketServerHelperRtc* helper_; - NSTimer* timer_; // Weak. - // The count of how many times we're inside the NSApplication main loop. - int run_count_; - - RTC_DISALLOW_COPY_AND_ASSIGN(MacCocoaSocketServer); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MACCOCOASOCKETSERVER_H_ diff --git a/include/webrtc/base/maccocoathreadhelper.h b/include/webrtc/base/maccocoathreadhelper.h deleted file mode 100644 index 255d081..0000000 --- a/include/webrtc/base/maccocoathreadhelper.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Helper function for using Cocoa with Posix threads. This header should be -// included from C/C++ files that want to use some Cocoa functionality without -// using the .mm extension (mostly for files that are compiled on multiple -// platforms). - -#ifndef WEBRTC_BASE_MACCOCOATHREADHELPER_H__ -#define WEBRTC_BASE_MACCOCOATHREADHELPER_H__ - -namespace rtc { - -// Cocoa must be "put into multithreading mode" before Cocoa functionality can -// be used on POSIX threads. This function does that. -void InitCocoaMultiThreading(); - -} // namespace rtc - -#endif // WEBRTC_BASE_MACCOCOATHREADHELPER_H__ diff --git a/include/webrtc/base/macconversion.h b/include/webrtc/base/macconversion.h deleted file mode 100644 index 63b27cf..0000000 --- a/include/webrtc/base/macconversion.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MACCONVERSION_H_ -#define WEBRTC_BASE_MACCONVERSION_H_ - -#if defined(WEBRTC_MAC) || defined(WEBRTC_IOS) - -#include - -#include - -// given a CFStringRef, attempt to convert it to a C++ string. -// returns true if it succeeds, false otherwise. -// We can safely assume, given our context, that the string is -// going to be in ASCII, because it will either be an IP address, -// or a domain name, which is guaranteed to be ASCII-representable. -bool p_convertHostCFStringRefToCPPString(const CFStringRef cfstr, - std::string& cppstr); - -// Convert the CFNumber to an integer, putting the integer in the location -// given, and returhing true, if the conversion succeeds. -// If given a NULL or a non-CFNumber, returns false. -// This is pretty aggresive about trying to convert to int. -bool p_convertCFNumberToInt(CFNumberRef cfn, int* i); - -// given a CFNumberRef, determine if it represents a true value. -bool p_isCFNumberTrue(CFNumberRef cfn); - -#endif // WEBRTC_MAC || WEBRTC_IOS - -#endif // WEBRTC_BASE_MACCONVERSION_H_ diff --git a/include/webrtc/base/macsocketserver.h b/include/webrtc/base/macsocketserver.h deleted file mode 100644 index f85628b..0000000 --- a/include/webrtc/base/macsocketserver.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2007 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_BASE_MACSOCKETSERVER_H__ -#define WEBRTC_BASE_MACSOCKETSERVER_H__ - -#include -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) // Invalid on IOS -#include -#endif -#include "webrtc/base/physicalsocketserver.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// MacBaseSocketServer -/////////////////////////////////////////////////////////////////////////////// -class MacAsyncSocket; - -class MacBaseSocketServer : public PhysicalSocketServer { - public: - MacBaseSocketServer(); - ~MacBaseSocketServer() override; - - // SocketServer Interface - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - bool Wait(int cms, bool process_io) override = 0; - void WakeUp() override = 0; - - void RegisterSocket(MacAsyncSocket* socket); - void UnregisterSocket(MacAsyncSocket* socket); - - // PhysicalSocketServer Overrides - bool SetPosixSignalHandler(int signum, void (*handler)(int)) override; - - protected: - void EnableSocketCallbacks(bool enable); - const std::set& sockets() { - return sockets_; - } - - private: - static void FileDescriptorCallback(CFFileDescriptorRef ref, - CFOptionFlags flags, - void* context); - - std::set sockets_; -}; - -// Core Foundation implementation of the socket server. While idle it -// will run the current CF run loop. When the socket server has work -// to do the run loop will be paused. Does not support Carbon or Cocoa -// UI interaction. -class MacCFSocketServer : public MacBaseSocketServer { - public: - MacCFSocketServer(); - ~MacCFSocketServer() override; - - // SocketServer Interface - bool Wait(int cms, bool process_io) override; - void WakeUp() override; - void OnWakeUpCallback(); - - private: - CFRunLoopRef run_loop_; - CFRunLoopSourceRef wake_up_; -}; - -#ifndef CARBON_DEPRECATED - -/////////////////////////////////////////////////////////////////////////////// -// MacCarbonSocketServer -/////////////////////////////////////////////////////////////////////////////// - -// Interacts with the Carbon event queue. While idle it will block, -// waiting for events. When the socket server has work to do, it will -// post a 'wake up' event to the queue, causing the thread to exit the -// event loop until the next call to Wait. Other events are dispatched -// to their target. Supports Carbon and Cocoa UI interaction. -class MacCarbonSocketServer : public MacBaseSocketServer { - public: - MacCarbonSocketServer(); - virtual ~MacCarbonSocketServer(); - - // SocketServer Interface - virtual bool Wait(int cms, bool process_io); - virtual void WakeUp(); - - private: - EventQueueRef event_queue_; - EventRef wake_up_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// MacCarbonAppSocketServer -/////////////////////////////////////////////////////////////////////////////// - -// Runs the Carbon application event loop on the current thread while -// idle. When the socket server has work to do, it will post an event -// to the queue, causing the thread to exit the event loop until the -// next call to Wait. Other events are automatically dispatched to -// their target. -class MacCarbonAppSocketServer : public MacBaseSocketServer { - public: - MacCarbonAppSocketServer(); - virtual ~MacCarbonAppSocketServer(); - - // SocketServer Interface - virtual bool Wait(int cms, bool process_io); - virtual void WakeUp(); - - private: - static OSStatus WakeUpEventHandler(EventHandlerCallRef next, EventRef event, - void *data); - static void TimerHandler(EventLoopTimerRef timer, void *data); - - EventQueueRef event_queue_; - EventHandlerRef event_handler_; - EventLoopTimerRef timer_; -}; - -#endif -} // namespace rtc - -#endif // WEBRTC_BASE_MACSOCKETSERVER_H__ diff --git a/include/webrtc/base/macutils.h b/include/webrtc/base/macutils.h deleted file mode 100644 index 35c3d18..0000000 --- a/include/webrtc/base/macutils.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2007 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MACUTILS_H__ -#define WEBRTC_BASE_MACUTILS_H__ - -#include -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -#include -#endif -#include - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// - -// Note that some of these functions work for both iOS and Mac OS X. The ones -// that are specific to Mac are #ifdef'ed as such. - -bool ToUtf8(const CFStringRef str16, std::string* str8); -bool ToUtf16(const std::string& str8, CFStringRef* str16); - -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -void DecodeFourChar(UInt32 fc, std::string* out); - -enum MacOSVersionName { - kMacOSUnknown, // ??? - kMacOSOlder, // 10.2- - kMacOSPanther, // 10.3 - kMacOSTiger, // 10.4 - kMacOSLeopard, // 10.5 - kMacOSSnowLeopard, // 10.6 - kMacOSLion, // 10.7 - kMacOSMountainLion, // 10.8 - kMacOSMavericks, // 10.9 - kMacOSNewer, // 10.10+ -}; - -bool GetOSVersion(int* major, int* minor, int* bugfix); -MacOSVersionName GetOSVersionName(); -bool GetQuickTimeVersion(std::string* version); - -// Runs the given apple script. Only supports scripts that does not -// require user interaction. -bool RunAppleScript(const std::string& script); -#endif - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_MACUTILS_H__ diff --git a/include/webrtc/base/macwindowpicker.h b/include/webrtc/base/macwindowpicker.h deleted file mode 100644 index 99091a9..0000000 --- a/include/webrtc/base/macwindowpicker.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_BASE_MACWINDOWPICKER_H_ -#define WEBRTC_BASE_MACWINDOWPICKER_H_ - -#include "webrtc/base/windowpicker.h" - -namespace rtc { - -class MacWindowPicker : public WindowPicker { - public: - MacWindowPicker(); - ~MacWindowPicker() override; - bool Init() override; - bool IsVisible(const WindowId& id) override; - bool MoveToFront(const WindowId& id) override; - bool GetWindowList(WindowDescriptionList* descriptions) override; - bool GetDesktopList(DesktopDescriptionList* descriptions) override; - bool GetDesktopDimensions(const DesktopId& id, - int* width, - int* height) override; - - private: - void* lib_handle_; - void* get_window_list_; - void* get_window_list_desc_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MACWINDOWPICKER_H_ diff --git a/include/webrtc/base/mathutils.h b/include/webrtc/base/mathutils.h deleted file mode 100644 index e2b2126..0000000 --- a/include/webrtc/base/mathutils.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2005 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MATHUTILS_H_ -#define WEBRTC_BASE_MATHUTILS_H_ - -#include - -#ifndef M_PI -#define M_PI 3.14159265359f -#endif - -#endif // WEBRTC_BASE_MATHUTILS_H_ diff --git a/include/webrtc/base/md5.h b/include/webrtc/base/md5.h deleted file mode 100644 index 45e00b7..0000000 --- a/include/webrtc/base/md5.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This is the header file for the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - * - */ - -// Changes(fbarchard): Ported to C++ and Google style guide. -// Made context first parameter in MD5Final for consistency with Sha1. -// Changes(hellner): added rtc namespace -// Changes(pbos): Reverted types back to uint32(8)_t with _t suffix. - -#ifndef WEBRTC_BASE_MD5_H_ -#define WEBRTC_BASE_MD5_H_ - -#include -#include - -namespace rtc { - -struct MD5Context { - uint32_t buf[4]; - uint32_t bits[2]; - uint32_t in[16]; -}; - -void MD5Init(MD5Context* context); -void MD5Update(MD5Context* context, const uint8_t* data, size_t len); -void MD5Final(MD5Context* context, uint8_t digest[16]); -void MD5Transform(uint32_t buf[4], const uint32_t in[16]); - -} // namespace rtc - -#endif // WEBRTC_BASE_MD5_H_ diff --git a/include/webrtc/base/md5digest.h b/include/webrtc/base/md5digest.h deleted file mode 100644 index 3f8d656..0000000 --- a/include/webrtc/base/md5digest.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MD5DIGEST_H_ -#define WEBRTC_BASE_MD5DIGEST_H_ - -#include "webrtc/base/md5.h" -#include "webrtc/base/messagedigest.h" - -namespace rtc { - -// A simple wrapper for our MD5 implementation. -class Md5Digest : public MessageDigest { - public: - enum { kSize = 16 }; - Md5Digest() { - MD5Init(&ctx_); - } - size_t Size() const override; - void Update(const void* buf, size_t len) override; - size_t Finish(void* buf, size_t len) override; - - private: - MD5Context ctx_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MD5DIGEST_H_ diff --git a/include/webrtc/base/messagedigest.h b/include/webrtc/base/messagedigest.h deleted file mode 100644 index 5cfcb47..0000000 --- a/include/webrtc/base/messagedigest.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MESSAGEDIGEST_H_ -#define WEBRTC_BASE_MESSAGEDIGEST_H_ - -#include - -namespace rtc { - -// Definitions for the digest algorithms. -extern const char DIGEST_MD5[]; -extern const char DIGEST_SHA_1[]; -extern const char DIGEST_SHA_224[]; -extern const char DIGEST_SHA_256[]; -extern const char DIGEST_SHA_384[]; -extern const char DIGEST_SHA_512[]; - -// A general class for computing hashes. -class MessageDigest { - public: - enum { kMaxSize = 64 }; // Maximum known size (SHA-512) - virtual ~MessageDigest() {} - // Returns the digest output size (e.g. 16 bytes for MD5). - virtual size_t Size() const = 0; - // Updates the digest with |len| bytes from |buf|. - virtual void Update(const void* buf, size_t len) = 0; - // Outputs the digest value to |buf| with length |len|. - // Returns the number of bytes written, i.e., Size(). - virtual size_t Finish(void* buf, size_t len) = 0; -}; - -// A factory class for creating digest objects. -class MessageDigestFactory { - public: - static MessageDigest* Create(const std::string& alg); -}; - -// A whitelist of approved digest algorithms from RFC 4572 (FIPS 180). -bool IsFips180DigestAlgorithm(const std::string& alg); - -// Functions to create hashes. - -// Computes the hash of |in_len| bytes of |input|, using the |digest| hash -// implementation, and outputs the hash to the buffer |output|, which is -// |out_len| bytes long. Returns the number of bytes written to |output| if -// successful, or 0 if |out_len| was too small. -size_t ComputeDigest(MessageDigest* digest, const void* input, size_t in_len, - void* output, size_t out_len); -// Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns 0 if there is no -// digest with the given name. -size_t ComputeDigest(const std::string& alg, const void* input, size_t in_len, - void* output, size_t out_len); -// Computes the hash of |input| using the |digest| hash implementation, and -// returns it as a hex-encoded string. -std::string ComputeDigest(MessageDigest* digest, const std::string& input); -// Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns empty string if -// there is no digest with the given name. -std::string ComputeDigest(const std::string& alg, const std::string& input); -// Like the previous function, but returns an explicit result code. -bool ComputeDigest(const std::string& alg, const std::string& input, - std::string* output); - -// Shorthand way to compute a hex-encoded hash using MD5. -inline std::string MD5(const std::string& input) { - return ComputeDigest(DIGEST_MD5, input); -} - -// Functions to compute RFC 2104 HMACs. - -// Computes the HMAC of |in_len| bytes of |input|, using the |digest| hash -// implementation and |key_len| bytes of |key| to key the HMAC, and outputs -// the HMAC to the buffer |output|, which is |out_len| bytes long. Returns the -// number of bytes written to |output| if successful, or 0 if |out_len| was too -// small. -size_t ComputeHmac(MessageDigest* digest, const void* key, size_t key_len, - const void* input, size_t in_len, - void* output, size_t out_len); -// Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns 0 if there is no -// digest with the given name. -size_t ComputeHmac(const std::string& alg, const void* key, size_t key_len, - const void* input, size_t in_len, - void* output, size_t out_len); -// Computes the HMAC of |input| using the |digest| hash implementation and |key| -// to key the HMAC, and returns it as a hex-encoded string. -std::string ComputeHmac(MessageDigest* digest, const std::string& key, - const std::string& input); -// Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns empty string if -// there is no digest with the given name. -std::string ComputeHmac(const std::string& alg, const std::string& key, - const std::string& input); -// Like the previous function, but returns an explicit result code. -bool ComputeHmac(const std::string& alg, const std::string& key, - const std::string& input, std::string* output); - -} // namespace rtc - -#endif // WEBRTC_BASE_MESSAGEDIGEST_H_ diff --git a/include/webrtc/base/messagehandler.h b/include/webrtc/base/messagehandler.h deleted file mode 100644 index b55b229..0000000 --- a/include/webrtc/base/messagehandler.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MESSAGEHANDLER_H_ -#define WEBRTC_BASE_MESSAGEHANDLER_H_ - -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -struct Message; - -// Messages get dispatched to a MessageHandler - -class MessageHandler { - public: - virtual ~MessageHandler(); - virtual void OnMessage(Message* msg) = 0; - - protected: - MessageHandler() {} - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(MessageHandler); -}; - -// Helper class to facilitate executing a functor on a thread. -template -class FunctorMessageHandler : public MessageHandler { - public: - explicit FunctorMessageHandler(const FunctorT& functor) - : functor_(functor) {} - virtual void OnMessage(Message* msg) { - result_ = functor_(); - } - const ReturnT& result() const { return result_; } - - private: - FunctorT functor_; - ReturnT result_; -}; - -// Specialization for rtc::scoped_ptr. -template -class FunctorMessageHandler, FunctorT> - : public MessageHandler { - public: - explicit FunctorMessageHandler(const FunctorT& functor) : functor_(functor) {} - virtual void OnMessage(Message* msg) { result_ = std::move(functor_()); } - rtc::scoped_ptr result() { return std::move(result_); } - - private: - FunctorT functor_; - rtc::scoped_ptr result_; -}; - -// Specialization for ReturnT of void. -template -class FunctorMessageHandler : public MessageHandler { - public: - explicit FunctorMessageHandler(const FunctorT& functor) - : functor_(functor) {} - virtual void OnMessage(Message* msg) { - functor_(); - } - void result() const {} - - private: - FunctorT functor_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MESSAGEHANDLER_H_ diff --git a/include/webrtc/base/messagequeue.h b/include/webrtc/base/messagequeue.h deleted file mode 100644 index c3ab3b6..0000000 --- a/include/webrtc/base/messagequeue.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MESSAGEQUEUE_H_ -#define WEBRTC_BASE_MESSAGEQUEUE_H_ - -#include - -#include -#include -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketserver.h" -#include "webrtc/base/timeutils.h" - -namespace rtc { - -struct Message; -class MessageQueue; - -// MessageQueueManager does cleanup of of message queues - -class MessageQueueManager { - public: - static void Add(MessageQueue *message_queue); - static void Remove(MessageQueue *message_queue); - static void Clear(MessageHandler *handler); - - // For testing purposes, we expose whether or not the MessageQueueManager - // instance has been initialized. It has no other use relative to the rest of - // the functions of this class, which auto-initialize the underlying - // MessageQueueManager instance when necessary. - static bool IsInitialized(); - - private: - static MessageQueueManager* Instance(); - - MessageQueueManager(); - ~MessageQueueManager(); - - void AddInternal(MessageQueue *message_queue); - void RemoveInternal(MessageQueue *message_queue); - void ClearInternal(MessageHandler *handler); - - static MessageQueueManager* instance_; - // This list contains all live MessageQueues. - std::vector message_queues_; - CriticalSection crit_; -}; - -// Derive from this for specialized data -// App manages lifetime, except when messages are purged - -class MessageData { - public: - MessageData() {} - virtual ~MessageData() {} -}; - -template -class TypedMessageData : public MessageData { - public: - explicit TypedMessageData(const T& data) : data_(data) { } - const T& data() const { return data_; } - T& data() { return data_; } - private: - T data_; -}; - -// Like TypedMessageData, but for pointers that require a delete. -template -class ScopedMessageData : public MessageData { - public: - explicit ScopedMessageData(T* data) : data_(data) { } - const scoped_ptr& data() const { return data_; } - scoped_ptr& data() { return data_; } - private: - scoped_ptr data_; -}; - -// Like ScopedMessageData, but for reference counted pointers. -template -class ScopedRefMessageData : public MessageData { - public: - explicit ScopedRefMessageData(T* data) : data_(data) { } - const scoped_refptr& data() const { return data_; } - scoped_refptr& data() { return data_; } - private: - scoped_refptr data_; -}; - -template -inline MessageData* WrapMessageData(const T& data) { - return new TypedMessageData(data); -} - -template -inline const T& UseMessageData(MessageData* data) { - return static_cast< TypedMessageData* >(data)->data(); -} - -template -class DisposeData : public MessageData { - public: - explicit DisposeData(T* data) : data_(data) { } - virtual ~DisposeData() { delete data_; } - private: - T* data_; -}; - -const uint32_t MQID_ANY = static_cast(-1); -const uint32_t MQID_DISPOSE = static_cast(-2); - -// No destructor - -struct Message { - Message() { - memset(this, 0, sizeof(*this)); - } - inline bool Match(MessageHandler* handler, uint32_t id) const { - return (handler == NULL || handler == phandler) - && (id == MQID_ANY || id == message_id); - } - MessageHandler *phandler; - uint32_t message_id; - MessageData *pdata; - uint32_t ts_sensitive; -}; - -typedef std::list MessageList; - -// DelayedMessage goes into a priority queue, sorted by trigger time. Messages -// with the same trigger time are processed in num_ (FIFO) order. - -class DelayedMessage { - public: - DelayedMessage(int delay, uint32_t trigger, uint32_t num, const Message& msg) - : cmsDelay_(delay), msTrigger_(trigger), num_(num), msg_(msg) {} - - bool operator< (const DelayedMessage& dmsg) const { - return (dmsg.msTrigger_ < msTrigger_) - || ((dmsg.msTrigger_ == msTrigger_) && (dmsg.num_ < num_)); - } - - int cmsDelay_; // for debugging - uint32_t msTrigger_; - uint32_t num_; - Message msg_; -}; - -class MessageQueue { - public: - static const int kForever = -1; - - explicit MessageQueue(SocketServer* ss = NULL); - virtual ~MessageQueue(); - - SocketServer* socketserver() { return ss_; } - void set_socketserver(SocketServer* ss); - - // Note: The behavior of MessageQueue has changed. When a MQ is stopped, - // futher Posts and Sends will fail. However, any pending Sends and *ready* - // Posts (as opposed to unexpired delayed Posts) will be delivered before - // Get (or Peek) returns false. By guaranteeing delivery of those messages, - // we eliminate the race condition when an MessageHandler and MessageQueue - // may be destroyed independently of each other. - virtual void Quit(); - virtual bool IsQuitting(); - virtual void Restart(); - - // Get() will process I/O until: - // 1) A message is available (returns true) - // 2) cmsWait seconds have elapsed (returns false) - // 3) Stop() is called (returns false) - virtual bool Get(Message *pmsg, int cmsWait = kForever, - bool process_io = true); - virtual bool Peek(Message *pmsg, int cmsWait = 0); - virtual void Post(MessageHandler* phandler, - uint32_t id = 0, - MessageData* pdata = NULL, - bool time_sensitive = false); - virtual void PostDelayed(int cmsDelay, - MessageHandler* phandler, - uint32_t id = 0, - MessageData* pdata = NULL); - virtual void PostAt(uint32_t tstamp, - MessageHandler* phandler, - uint32_t id = 0, - MessageData* pdata = NULL); - virtual void Clear(MessageHandler* phandler, - uint32_t id = MQID_ANY, - MessageList* removed = NULL); - virtual void Dispatch(Message *pmsg); - virtual void ReceiveSends(); - - // Amount of time until the next message can be retrieved - virtual int GetDelay(); - - bool empty() const { return size() == 0u; } - size_t size() const { - CritScope cs(&crit_); // msgq_.size() is not thread safe. - return msgq_.size() + dmsgq_.size() + (fPeekKeep_ ? 1u : 0u); - } - - // Internally posts a message which causes the doomed object to be deleted - template void Dispose(T* doomed) { - if (doomed) { - Post(NULL, MQID_DISPOSE, new DisposeData(doomed)); - } - } - - // When this signal is sent out, any references to this queue should - // no longer be used. - sigslot::signal0<> SignalQueueDestroyed; - - protected: - class PriorityQueue : public std::priority_queue { - public: - container_type& container() { return c; } - void reheap() { make_heap(c.begin(), c.end(), comp); } - }; - - void DoDelayPost(int cmsDelay, - uint32_t tstamp, - MessageHandler* phandler, - uint32_t id, - MessageData* pdata); - - // The SocketServer is not owned by MessageQueue. - SocketServer* ss_; - // If a server isn't supplied in the constructor, use this one. - scoped_ptr default_ss_; - bool fStop_; - bool fPeekKeep_; - Message msgPeek_; - MessageList msgq_; - PriorityQueue dmsgq_; - uint32_t dmsgq_next_num_; - mutable CriticalSection crit_; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MESSAGEQUEUE_H_ diff --git a/include/webrtc/base/multipart.h b/include/webrtc/base/multipart.h deleted file mode 100644 index a099230..0000000 --- a/include/webrtc/base/multipart.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_MULTIPART_H__ -#define WEBRTC_BASE_MULTIPART_H__ - -#include -#include - -#include "webrtc/base/sigslot.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// MultipartStream - Implements an RFC2046 multipart stream by concatenating -// the supplied parts together, and adding the correct boundaries. -/////////////////////////////////////////////////////////////////////////////// - -class MultipartStream : public StreamInterface, public sigslot::has_slots<> { - public: - MultipartStream(const std::string& type, const std::string& boundary); - ~MultipartStream() override; - - void GetContentType(std::string* content_type); - - // Note: If content_disposition and/or content_type are the empty string, - // they will be omitted. - bool AddPart(StreamInterface* data_stream, - const std::string& content_disposition, - const std::string& content_type); - bool AddPart(const std::string& data, - const std::string& content_disposition, - const std::string& content_type); - void EndParts(); - - // Calculates the size of a part before actually adding the part. - size_t GetPartSize(const std::string& data, - const std::string& content_disposition, - const std::string& content_type) const; - size_t GetEndPartSize() const; - - // StreamInterface - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - bool SetPosition(size_t position) override; - bool GetPosition(size_t* position) const override; - bool GetSize(size_t* size) const override; - bool GetAvailable(size_t* size) const override; - - private: - typedef std::vector PartList; - - // StreamInterface Slots - void OnEvent(StreamInterface* stream, int events, int error); - - std::string type_, boundary_; - PartList parts_; - bool adding_; - size_t current_; // The index into parts_ of the current read position. - size_t position_; // The current read position in bytes. - - RTC_DISALLOW_COPY_AND_ASSIGN(MultipartStream); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_MULTIPART_H__ diff --git a/include/webrtc/base/natserver.h b/include/webrtc/base/natserver.h deleted file mode 100644 index b6a02fe..0000000 --- a/include/webrtc/base/natserver.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NATSERVER_H_ -#define WEBRTC_BASE_NATSERVER_H_ - -#include -#include - -#include "webrtc/base/asyncudpsocket.h" -#include "webrtc/base/socketaddresspair.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/socketfactory.h" -#include "webrtc/base/nattypes.h" -#include "webrtc/base/proxyserver.h" - -namespace rtc { - -// Change how routes (socketaddress pairs) are compared based on the type of -// NAT. The NAT server maintains a hashtable of the routes that it knows -// about. So these affect which routes are treated the same. -struct RouteCmp { - explicit RouteCmp(NAT* nat); - size_t operator()(const SocketAddressPair& r) const; - bool operator()( - const SocketAddressPair& r1, const SocketAddressPair& r2) const; - - bool symmetric; -}; - -// Changes how addresses are compared based on the filtering rules of the NAT. -struct AddrCmp { - explicit AddrCmp(NAT* nat); - size_t operator()(const SocketAddress& r) const; - bool operator()(const SocketAddress& r1, const SocketAddress& r2) const; - - bool use_ip; - bool use_port; -}; - -// Implements the NAT device. It listens for packets on the internal network, -// translates them, and sends them out over the external network. -// -// TCP connections initiated from the internal side of the NAT server are -// also supported, by making a connection to the NAT server's TCP address and -// then sending the remote address in quasi-STUN format. The connection status -// will be indicated back to the client as a 1 byte status code, where '0' -// indicates success. - -const int NAT_SERVER_UDP_PORT = 4237; -const int NAT_SERVER_TCP_PORT = 4238; - -class NATServer : public sigslot::has_slots<> { - public: - NATServer( - NATType type, SocketFactory* internal, - const SocketAddress& internal_udp_addr, - const SocketAddress& internal_tcp_addr, - SocketFactory* external, const SocketAddress& external_ip); - ~NATServer() override; - - SocketAddress internal_udp_address() const { - return udp_server_socket_->GetLocalAddress(); - } - - SocketAddress internal_tcp_address() const { - return tcp_proxy_server_->GetServerAddress(); - } - - // Packets received on one of the networks. - void OnInternalUDPPacket(AsyncPacketSocket* socket, const char* buf, - size_t size, const SocketAddress& addr, - const PacketTime& packet_time); - void OnExternalUDPPacket(AsyncPacketSocket* socket, const char* buf, - size_t size, const SocketAddress& remote_addr, - const PacketTime& packet_time); - - private: - typedef std::set AddressSet; - - /* Records a translation and the associated external socket. */ - struct TransEntry { - TransEntry(const SocketAddressPair& r, AsyncUDPSocket* s, NAT* nat); - ~TransEntry(); - - void WhitelistInsert(const SocketAddress& addr); - bool WhitelistContains(const SocketAddress& ext_addr); - - SocketAddressPair route; - AsyncUDPSocket* socket; - AddressSet* whitelist; - CriticalSection crit_; - }; - - typedef std::map InternalMap; - typedef std::map ExternalMap; - - /* Creates a new entry that translates the given route. */ - void Translate(const SocketAddressPair& route); - - /* Determines whether the NAT would filter out a packet from this address. */ - bool ShouldFilterOut(TransEntry* entry, const SocketAddress& ext_addr); - - NAT* nat_; - SocketFactory* external_; - SocketAddress external_ip_; - AsyncUDPSocket* udp_server_socket_; - ProxyServer* tcp_proxy_server_; - InternalMap* int_map_; - ExternalMap* ext_map_; - RTC_DISALLOW_COPY_AND_ASSIGN(NATServer); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_NATSERVER_H_ diff --git a/include/webrtc/base/natsocketfactory.h b/include/webrtc/base/natsocketfactory.h deleted file mode 100644 index 9ca0739..0000000 --- a/include/webrtc/base/natsocketfactory.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NATSOCKETFACTORY_H_ -#define WEBRTC_BASE_NATSOCKETFACTORY_H_ - -#include -#include -#include - -#include "webrtc/base/natserver.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/socketserver.h" - -namespace rtc { - -const size_t kNATEncodedIPv4AddressSize = 8U; -const size_t kNATEncodedIPv6AddressSize = 20U; - -// Used by the NAT socket implementation. -class NATInternalSocketFactory { - public: - virtual ~NATInternalSocketFactory() {} - virtual AsyncSocket* CreateInternalSocket(int family, int type, - const SocketAddress& local_addr, SocketAddress* nat_addr) = 0; -}; - -// Creates sockets that will send all traffic through a NAT, using an existing -// NATServer instance running at nat_addr. The actual data is sent using sockets -// from a socket factory, given to the constructor. -class NATSocketFactory : public SocketFactory, public NATInternalSocketFactory { - public: - NATSocketFactory(SocketFactory* factory, const SocketAddress& nat_udp_addr, - const SocketAddress& nat_tcp_addr); - - // SocketFactory implementation - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - // NATInternalSocketFactory implementation - AsyncSocket* CreateInternalSocket(int family, - int type, - const SocketAddress& local_addr, - SocketAddress* nat_addr) override; - - private: - SocketFactory* factory_; - SocketAddress nat_udp_addr_; - SocketAddress nat_tcp_addr_; - RTC_DISALLOW_COPY_AND_ASSIGN(NATSocketFactory); -}; - -// Creates sockets that will send traffic through a NAT depending on what -// address they bind to. This can be used to simulate a client on a NAT sending -// to a client that is not behind a NAT. -// Note that the internal addresses of clients must be unique. This is because -// there is only one socketserver per thread, and the Bind() address is used to -// figure out which NAT (if any) the socket should talk to. -// -// Example with 3 NATs (2 cascaded), and 3 clients. -// ss->AddTranslator("1.2.3.4", "192.168.0.1", NAT_ADDR_RESTRICTED); -// ss->AddTranslator("99.99.99.99", "10.0.0.1", NAT_SYMMETRIC)-> -// AddTranslator("10.0.0.2", "192.168.1.1", NAT_OPEN_CONE); -// ss->GetTranslator("1.2.3.4")->AddClient("1.2.3.4", "192.168.0.2"); -// ss->GetTranslator("99.99.99.99")->AddClient("10.0.0.3"); -// ss->GetTranslator("99.99.99.99")->GetTranslator("10.0.0.2")-> -// AddClient("192.168.1.2"); -class NATSocketServer : public SocketServer, public NATInternalSocketFactory { - public: - class Translator; - // holds a list of NATs - class TranslatorMap : private std::map { - public: - ~TranslatorMap(); - Translator* Get(const SocketAddress& ext_ip); - Translator* Add(const SocketAddress& ext_ip, Translator*); - void Remove(const SocketAddress& ext_ip); - Translator* FindClient(const SocketAddress& int_ip); - }; - - // a specific NAT - class Translator { - public: - Translator(NATSocketServer* server, NATType type, - const SocketAddress& int_addr, SocketFactory* ext_factory, - const SocketAddress& ext_addr); - ~Translator(); - - SocketFactory* internal_factory() { return internal_factory_.get(); } - SocketAddress internal_udp_address() const { - return nat_server_->internal_udp_address(); - } - SocketAddress internal_tcp_address() const { - return SocketAddress(); // nat_server_->internal_tcp_address(); - } - - Translator* GetTranslator(const SocketAddress& ext_ip); - Translator* AddTranslator(const SocketAddress& ext_ip, - const SocketAddress& int_ip, NATType type); - void RemoveTranslator(const SocketAddress& ext_ip); - - bool AddClient(const SocketAddress& int_ip); - void RemoveClient(const SocketAddress& int_ip); - - // Looks for the specified client in this or a child NAT. - Translator* FindClient(const SocketAddress& int_ip); - - private: - NATSocketServer* server_; - scoped_ptr internal_factory_; - scoped_ptr nat_server_; - TranslatorMap nats_; - std::set clients_; - }; - - explicit NATSocketServer(SocketServer* ss); - - SocketServer* socketserver() { return server_; } - MessageQueue* queue() { return msg_queue_; } - - Translator* GetTranslator(const SocketAddress& ext_ip); - Translator* AddTranslator(const SocketAddress& ext_ip, - const SocketAddress& int_ip, NATType type); - void RemoveTranslator(const SocketAddress& ext_ip); - - // SocketServer implementation - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - void SetMessageQueue(MessageQueue* queue) override; - bool Wait(int cms, bool process_io) override; - void WakeUp() override; - - // NATInternalSocketFactory implementation - AsyncSocket* CreateInternalSocket(int family, - int type, - const SocketAddress& local_addr, - SocketAddress* nat_addr) override; - - private: - SocketServer* server_; - MessageQueue* msg_queue_; - TranslatorMap nats_; - RTC_DISALLOW_COPY_AND_ASSIGN(NATSocketServer); -}; - -// Free-standing NAT helper functions. -size_t PackAddressForNAT(char* buf, size_t buf_size, - const SocketAddress& remote_addr); -size_t UnpackAddressFromNAT(const char* buf, size_t buf_size, - SocketAddress* remote_addr); -} // namespace rtc - -#endif // WEBRTC_BASE_NATSOCKETFACTORY_H_ diff --git a/include/webrtc/base/nattypes.h b/include/webrtc/base/nattypes.h deleted file mode 100644 index 27e4b2f..0000000 --- a/include/webrtc/base/nattypes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NATTYPE_H__ -#define WEBRTC_BASE_NATTYPE_H__ - -namespace rtc { - -/* Identifies each type of NAT that can be simulated. */ -enum NATType { - NAT_OPEN_CONE, - NAT_ADDR_RESTRICTED, - NAT_PORT_RESTRICTED, - NAT_SYMMETRIC -}; - -// Implements the rules for each specific type of NAT. -class NAT { -public: - virtual ~NAT() { } - - // Determines whether this NAT uses both source and destination address when - // checking whether a mapping already exists. - virtual bool IsSymmetric() = 0; - - // Determines whether this NAT drops packets received from a different IP - // the one last sent to. - virtual bool FiltersIP() = 0; - - // Determines whether this NAT drops packets received from a different port - // the one last sent to. - virtual bool FiltersPort() = 0; - - // Returns an implementation of the given type of NAT. - static NAT* Create(NATType type); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_NATTYPE_H__ diff --git a/include/webrtc/base/nethelpers.h b/include/webrtc/base/nethelpers.h deleted file mode 100644 index 2c72c0b..0000000 --- a/include/webrtc/base/nethelpers.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NETHELPERS_H_ -#define WEBRTC_BASE_NETHELPERS_H_ - -#if defined(WEBRTC_POSIX) -#include -#include -#elif WEBRTC_WIN -#include // NOLINT -#endif - -#include - -#include "webrtc/base/asyncresolverinterface.h" -#include "webrtc/base/signalthread.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketaddress.h" - -namespace rtc { - -class AsyncResolverTest; - -// AsyncResolver will perform async DNS resolution, signaling the result on -// the SignalDone from AsyncResolverInterface when the operation completes. -class AsyncResolver : public SignalThread, public AsyncResolverInterface { - public: - AsyncResolver(); - ~AsyncResolver() override; - - void Start(const SocketAddress& addr) override; - bool GetResolvedAddress(int family, SocketAddress* addr) const override; - int GetError() const override; - void Destroy(bool wait) override; - - const std::vector& addresses() const { return addresses_; } - void set_error(int error) { error_ = error; } - - protected: - void DoWork() override; - void OnWorkDone() override; - - private: - SocketAddress addr_; - std::vector addresses_; - int error_; -}; - -// rtc namespaced wrappers for inet_ntop and inet_pton so we can avoid -// the windows-native versions of these. -const char* inet_ntop(int af, const void *src, char* dst, socklen_t size); -int inet_pton(int af, const char* src, void *dst); - -bool HasIPv6Enabled(); -} // namespace rtc - -#endif // WEBRTC_BASE_NETHELPERS_H_ diff --git a/include/webrtc/base/network.h b/include/webrtc/base/network.h deleted file mode 100644 index 8980b5d..0000000 --- a/include/webrtc/base/network.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NETWORK_H_ -#define WEBRTC_BASE_NETWORK_H_ - -#include -#include -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/ipaddress.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" - -#if defined(WEBRTC_POSIX) -struct ifaddrs; -#endif // defined(WEBRTC_POSIX) - -namespace rtc { - -extern const char kPublicIPv4Host[]; -extern const char kPublicIPv6Host[]; - -class Network; -class NetworkMonitorInterface; -class Thread; - -enum AdapterType { - // This enum resembles the one in Chromium net::ConnectionType. - ADAPTER_TYPE_UNKNOWN = 0, - ADAPTER_TYPE_ETHERNET = 1 << 0, - ADAPTER_TYPE_WIFI = 1 << 1, - ADAPTER_TYPE_CELLULAR = 1 << 2, - ADAPTER_TYPE_VPN = 1 << 3, - ADAPTER_TYPE_LOOPBACK = 1 << 4 -}; - -// By default, ignore loopback interfaces on the host. -const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK; - -// Makes a string key for this network. Used in the network manager's maps. -// Network objects are keyed on interface name, network prefix and the -// length of that prefix. -std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, - int prefix_length); - -class DefaultLocalAddressProvider { - public: - virtual ~DefaultLocalAddressProvider() = default; - // The default local address is the local address used in multi-homed endpoint - // when the any address (0.0.0.0 or ::) is used as the local address. It's - // important to check the return value as a IP family may not be enabled. - virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0; -}; - -// Generic network manager interface. It provides list of local -// networks. -class NetworkManager : public DefaultLocalAddressProvider { - public: - typedef std::vector NetworkList; - - // This enum indicates whether adapter enumeration is allowed. - enum EnumerationPermission { - ENUMERATION_ALLOWED, // Adapter enumeration is allowed. Getting 0 network - // from GetNetworks means that there is no network - // available. - ENUMERATION_BLOCKED, // Adapter enumeration is disabled. - // GetAnyAddressNetworks() should be used instead. - }; - - NetworkManager(); - ~NetworkManager() override; - - // Called when network list is updated. - sigslot::signal0<> SignalNetworksChanged; - - // Indicates a failure when getting list of network interfaces. - sigslot::signal0<> SignalError; - - // Start/Stop monitoring of network interfaces - // list. SignalNetworksChanged or SignalError is emitted immediately - // after StartUpdating() is called. After that SignalNetworksChanged - // is emitted whenever list of networks changes. - virtual void StartUpdating() = 0; - virtual void StopUpdating() = 0; - - // Returns the current list of networks available on this machine. - // StartUpdating() must be called before this method is called. - // It makes sure that repeated calls return the same object for a - // given network, so that quality is tracked appropriately. Does not - // include ignored networks. - virtual void GetNetworks(NetworkList* networks) const = 0; - - // return the current permission state of GetNetworks() - virtual EnumerationPermission enumeration_permission() const; - - // "AnyAddressNetwork" is a network which only contains single "any address" - // IP address. (i.e. INADDR_ANY for IPv4 or in6addr_any for IPv6). This is - // useful as binding to such interfaces allow default routing behavior like - // http traffic. - // TODO(guoweis): remove this body when chromium implements this. - virtual void GetAnyAddressNetworks(NetworkList* networks) {} - - bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; - - // Dumps a list of networks available to LS_INFO. - virtual void DumpNetworks(bool include_ignored) {} - - struct Stats { - int ipv4_network_count; - int ipv6_network_count; - Stats() { - ipv4_network_count = 0; - ipv6_network_count = 0; - } - }; -}; - -// Base class for NetworkManager implementations. -class NetworkManagerBase : public NetworkManager { - public: - NetworkManagerBase(); - ~NetworkManagerBase() override; - - void GetNetworks(std::vector* networks) const override; - void GetAnyAddressNetworks(NetworkList* networks) override; - bool ipv6_enabled() const { return ipv6_enabled_; } - void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; } - - void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; } - int max_ipv6_networks() { return max_ipv6_networks_; } - - EnumerationPermission enumeration_permission() const override; - - bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; - - protected: - typedef std::map NetworkMap; - // Updates |networks_| with the networks listed in |list|. If - // |network_map_| already has a Network object for a network listed - // in the |list| then it is reused. Accept ownership of the Network - // objects in the |list|. |changed| will be set to true if there is - // any change in the network list. - void MergeNetworkList(const NetworkList& list, bool* changed); - - // |stats| will be populated even if |*changed| is false. - void MergeNetworkList(const NetworkList& list, - bool* changed, - NetworkManager::Stats* stats); - - void set_enumeration_permission(EnumerationPermission state) { - enumeration_permission_ = state; - } - - void set_default_local_addresses(const IPAddress& ipv4, - const IPAddress& ipv6); - - private: - friend class NetworkTest; - - EnumerationPermission enumeration_permission_; - - NetworkList networks_; - int max_ipv6_networks_; - - NetworkMap networks_map_; - bool ipv6_enabled_; - - rtc::scoped_ptr ipv4_any_address_network_; - rtc::scoped_ptr ipv6_any_address_network_; - - IPAddress default_local_ipv4_address_; - IPAddress default_local_ipv6_address_; -}; - -// Basic implementation of the NetworkManager interface that gets list -// of networks using OS APIs. -class BasicNetworkManager : public NetworkManagerBase, - public MessageHandler, - public sigslot::has_slots<> { - public: - BasicNetworkManager(); - ~BasicNetworkManager() override; - - void StartUpdating() override; - void StopUpdating() override; - - // Logs the available networks. - void DumpNetworks(bool include_ignored) override; - - // MessageHandler interface. - void OnMessage(Message* msg) override; - bool started() { return start_count_ > 0; } - - // Sets the network ignore list, which is empty by default. Any network on the - // ignore list will be filtered from network enumeration results. - void set_network_ignore_list(const std::vector& list) { - network_ignore_list_ = list; - } - - // Sets the network types to ignore. For instance, calling this with - // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and - // loopback interfaces. Set to kDefaultNetworkIgnoreMask by default. - void set_network_ignore_mask(int network_ignore_mask) { - // TODO(phoglund): implement support for other types than loopback. - // See https://code.google.com/p/webrtc/issues/detail?id=4288. - // Then remove set_network_ignore_list. - network_ignore_mask_ = network_ignore_mask; - } - - int network_ignore_mask() const { return network_ignore_mask_; } - -#if defined(WEBRTC_LINUX) - // Sets the flag for ignoring non-default routes. - void set_ignore_non_default_routes(bool value) { - ignore_non_default_routes_ = true; - } -#endif - - protected: -#if defined(WEBRTC_POSIX) - // Separated from CreateNetworks for tests. - void ConvertIfAddrs(ifaddrs* interfaces, - bool include_ignored, - NetworkList* networks) const; -#endif // defined(WEBRTC_POSIX) - - // Creates a network object for each network available on the machine. - bool CreateNetworks(bool include_ignored, NetworkList* networks) const; - - // Determines if a network should be ignored. This should only be determined - // based on the network's property instead of any individual IP. - bool IsIgnoredNetwork(const Network& network) const; - - // This function connects a UDP socket to a public address and returns the - // local address associated it. Since it binds to the "any" address - // internally, it returns the default local address on a multi-homed endpoint. - IPAddress QueryDefaultLocalAddress(int family) const; - - private: - friend class NetworkTest; - - // Creates a network monitor and listens for network updates. - void StartNetworkMonitor(); - // Stops and removes the network monitor. - void StopNetworkMonitor(); - // Called when it receives updates from the network monitor. - void OnNetworksChanged(); - - // Updates the networks and reschedules the next update. - void UpdateNetworksContinually(); - // Only updates the networks; does not reschedule the next update. - void UpdateNetworksOnce(); - - Thread* thread_; - bool sent_first_update_; - int start_count_; - std::vector network_ignore_list_; - int network_ignore_mask_; - bool ignore_non_default_routes_; - scoped_ptr network_monitor_; -}; - -// Represents a Unix-type network interface, with a name and single address. -class Network { - public: - Network(const std::string& name, - const std::string& description, - const IPAddress& prefix, - int prefix_length); - - Network(const std::string& name, - const std::string& description, - const IPAddress& prefix, - int prefix_length, - AdapterType type); - ~Network(); - - const DefaultLocalAddressProvider* default_local_address_provider() { - return default_local_address_provider_; - } - void set_default_local_address_provider( - const DefaultLocalAddressProvider* provider) { - default_local_address_provider_ = provider; - } - - // Returns the name of the interface this network is associated wtih. - const std::string& name() const { return name_; } - - // Returns the OS-assigned name for this network. This is useful for - // debugging but should not be sent over the wire (for privacy reasons). - const std::string& description() const { return description_; } - - // Returns the prefix for this network. - const IPAddress& prefix() const { return prefix_; } - // Returns the length, in bits, of this network's prefix. - int prefix_length() const { return prefix_length_; } - - // |key_| has unique value per network interface. Used in sorting network - // interfaces. Key is derived from interface name and it's prefix. - std::string key() const { return key_; } - - // Returns the Network's current idea of the 'best' IP it has. - // Or return an unset IP if this network has no active addresses. - // Here is the rule on how we mark the IPv6 address as ignorable for WebRTC. - // 1) return all global temporary dynamic and non-deprecrated ones. - // 2) if #1 not available, return global ones. - // 3) if #2 not available, use ULA ipv6 as last resort. (ULA stands - // for unique local address, which is not route-able in open - // internet but might be useful for a close WebRTC deployment. - - // TODO(guoweis): rule #3 actually won't happen at current - // implementation. The reason being that ULA address starting with - // 0xfc 0r 0xfd will be grouped into its own Network. The result of - // that is WebRTC will have one extra Network to generate candidates - // but the lack of rule #3 shouldn't prevent turning on IPv6 since - // ULA should only be tried in a close deployment anyway. - - // Note that when not specifying any flag, it's treated as case global - // IPv6 address - IPAddress GetBestIP() const; - - // Keep the original function here for now. - // TODO(guoweis): Remove this when all callers are migrated to GetBestIP(). - IPAddress ip() const { return GetBestIP(); } - - // Adds an active IP address to this network. Does not check for duplicates. - void AddIP(const InterfaceAddress& ip) { ips_.push_back(ip); } - - // Sets the network's IP address list. Returns true if new IP addresses were - // detected. Passing true to already_changed skips this check. - bool SetIPs(const std::vector& ips, bool already_changed); - // Get the list of IP Addresses associated with this network. - const std::vector& GetIPs() const { return ips_;} - // Clear the network's list of addresses. - void ClearIPs() { ips_.clear(); } - - // Returns the scope-id of the network's address. - // Should only be relevant for link-local IPv6 addresses. - int scope_id() const { return scope_id_; } - void set_scope_id(int id) { scope_id_ = id; } - - // Indicates whether this network should be ignored, perhaps because - // the IP is 0, or the interface is one we know is invalid. - bool ignored() const { return ignored_; } - void set_ignored(bool ignored) { ignored_ = ignored; } - - AdapterType type() const { return type_; } - int preference() const { return preference_; } - void set_preference(int preference) { preference_ = preference; } - - // Debugging description of this network - std::string ToString() const; - - private: - const DefaultLocalAddressProvider* default_local_address_provider_ = nullptr; - std::string name_; - std::string description_; - IPAddress prefix_; - int prefix_length_; - std::string key_; - std::vector ips_; - int scope_id_; - bool ignored_; - AdapterType type_; - int preference_; - - friend class NetworkManager; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_NETWORK_H_ diff --git a/include/webrtc/base/networkmonitor.h b/include/webrtc/base/networkmonitor.h deleted file mode 100644 index c45c817..0000000 --- a/include/webrtc/base/networkmonitor.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NETWORKMONITOR_H_ -#define WEBRTC_BASE_NETWORKMONITOR_H_ - -#include "webrtc/base/logging.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" - -namespace rtc { -/* - * Receives network-change events via |OnNetworksChanged| and signals the - * networks changed event. - * - * Threading consideration: - * It is expected that all upstream operations (from native to Java) are - * performed from the worker thread. This includes creating, starting and - * stopping the monitor. This avoids the potential race condition when creating - * the singleton Java NetworkMonitor class. Downstream operations can be from - * any thread, but this class will forward all the downstream operations onto - * the worker thread. - * - * Memory consideration: - * NetworkMonitor is owned by the caller (NetworkManager). The global network - * monitor factory is owned by the factory itself but needs to be released from - * the factory creator. - */ -// Generic network monitor interface. It starts and stops monitoring network -// changes, and fires the SignalNetworksChanged event when networks change. -class NetworkMonitorInterface { - public: - NetworkMonitorInterface(); - virtual ~NetworkMonitorInterface(); - - sigslot::signal0<> SignalNetworksChanged; - - virtual void Start() = 0; - virtual void Stop() = 0; - - // Implementations should call this method on the base when networks change, - // and the base will fire SignalNetworksChanged on the right thread. - virtual void OnNetworksChanged() = 0; -}; - -class NetworkMonitorBase : public NetworkMonitorInterface, - public MessageHandler, - public sigslot::has_slots<> { - public: - NetworkMonitorBase(); - ~NetworkMonitorBase() override; - - void OnNetworksChanged() override; - - void OnMessage(Message* msg) override; - - private: - Thread* thread_; -}; - -/* - * NetworkMonitorFactory creates NetworkMonitors. - */ -class NetworkMonitorFactory { - public: - // This is not thread-safe; it should be called once (or once per audio/video - // call) during the call initialization. - static void SetFactory(NetworkMonitorFactory* factory); - - static void ReleaseFactory(NetworkMonitorFactory* factory); - static NetworkMonitorFactory* GetFactory(); - - virtual NetworkMonitorInterface* CreateNetworkMonitor() = 0; - - virtual ~NetworkMonitorFactory(); - - protected: - NetworkMonitorFactory(); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_NETWORKMONITOR_H_ diff --git a/include/webrtc/base/nullsocketserver.h b/include/webrtc/base/nullsocketserver.h deleted file mode 100644 index 5378e43..0000000 --- a/include/webrtc/base/nullsocketserver.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_NULLSOCKETSERVER_H_ -#define WEBRTC_BASE_NULLSOCKETSERVER_H_ - -#include "webrtc/base/event.h" -#include "webrtc/base/physicalsocketserver.h" - -namespace rtc { - -// NullSocketServer - -class NullSocketServer : public rtc::SocketServer { - public: - NullSocketServer() : event_(false, false) {} - - virtual bool Wait(int cms, bool process_io) { - event_.Wait(cms); - return true; - } - - virtual void WakeUp() { - event_.Set(); - } - - virtual rtc::Socket* CreateSocket(int type) { - ASSERT(false); - return NULL; - } - - virtual rtc::Socket* CreateSocket(int family, int type) { - ASSERT(false); - return NULL; - } - - virtual rtc::AsyncSocket* CreateAsyncSocket(int type) { - ASSERT(false); - return NULL; - } - - virtual rtc::AsyncSocket* CreateAsyncSocket(int family, int type) { - ASSERT(false); - return NULL; - } - - - private: - rtc::Event event_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_NULLSOCKETSERVER_H_ diff --git a/include/webrtc/base/objc/NSString+StdString.h b/include/webrtc/base/objc/NSString+StdString.h deleted file mode 100644 index 532032b..0000000 --- a/include/webrtc/base/objc/NSString+StdString.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import - -#include - -NS_ASSUME_NONNULL_BEGIN - -@interface NSString (StdString) - -@property(nonatomic, readonly) std::string stdString; - -+ (std::string)stdStringForString:(NSString *)nsString; - -@end - -NS_ASSUME_NONNULL_END diff --git a/include/webrtc/base/objc/RTCCameraPreviewView.h b/include/webrtc/base/objc/RTCCameraPreviewView.h deleted file mode 100644 index 03e94c2..0000000 --- a/include/webrtc/base/objc/RTCCameraPreviewView.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import -#import - -@class AVCaptureSession; -@class RTCAVFoundationVideoSource; - -/** RTCCameraPreviewView is a view that renders local video from an - * AVCaptureSession. - */ -@interface RTCCameraPreviewView : UIView - -/** The capture session being rendered in the view. Capture session - * is assigned to AVCaptureVideoPreviewLayer async in the same - * queue that the AVCaptureSession is started/stopped. - */ -@property(nonatomic, strong) AVCaptureSession *captureSession; - -@end diff --git a/include/webrtc/base/objc/RTCDispatcher.h b/include/webrtc/base/objc/RTCDispatcher.h deleted file mode 100644 index c32b93d..0000000 --- a/include/webrtc/base/objc/RTCDispatcher.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RTCDispatcherQueueType) { - // Main dispatcher queue. - RTCDispatcherTypeMain, - // Used for starting/stopping AVCaptureSession, and assigning - // capture session to AVCaptureVideoPreviewLayer. - RTCDispatcherTypeCaptureSession, -}; - -/** Dispatcher that asynchronously dispatches blocks to a specific - * shared dispatch queue. - */ -@interface RTCDispatcher : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -/** Dispatch the block asynchronously on the queue for dispatchType. - * @param dispatchType The queue type to dispatch on. - * @param block The block to dispatch asynchronously. - */ -+ (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType - block:(dispatch_block_t)block; - -@end diff --git a/include/webrtc/base/objc/RTCLogging.h b/include/webrtc/base/objc/RTCLogging.h deleted file mode 100644 index 19fade5..0000000 --- a/include/webrtc/base/objc/RTCLogging.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import - -// Subset of rtc::LoggingSeverity. -typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { - kRTCLoggingSeverityVerbose, - kRTCLoggingSeverityInfo, - kRTCLoggingSeverityWarning, - kRTCLoggingSeverityError, -}; - -#if defined(__cplusplus) -extern "C" void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); -extern "C" void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); -extern "C" NSString* RTCFileName(const char* filePath); -#else - -// Wrapper for C++ LOG(sev) macros. -// Logs the log string to the webrtc logstream for the given severity. -extern void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); - -// Wrapper for rtc::LogMessage::LogToDebug. -// Sets the minimum severity to be logged to console. -extern void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); - -// Returns the filename with the path prefix removed. -extern NSString* RTCFileName(const char* filePath); - -#endif - -// Some convenience macros. - -#define RTCLogString(format, ...) \ - [NSString stringWithFormat:@"(%@:%d %s): " format, \ - RTCFileName(__FILE__), \ - __LINE__, \ - __FUNCTION__, \ - ##__VA_ARGS__] - -#define RTCLogFormat(severity, format, ...) \ - do { \ - NSString* log_string = RTCLogString(format, ##__VA_ARGS__); \ - RTCLogEx(severity, log_string); \ - } while (false) - -#define RTCLogVerbose(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityVerbose, format, ##__VA_ARGS__) \ - -#define RTCLogInfo(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityInfo, format, ##__VA_ARGS__) \ - -#define RTCLogWarning(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityWarning, format, ##__VA_ARGS__) \ - -#define RTCLogError(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityError, format, ##__VA_ARGS__) \ - -#if !defined(NDEBUG) -#define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__) -#else -#define RTCLogDebug(format, ...) \ - do { \ - } while (false) -#endif - -#define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__) diff --git a/include/webrtc/base/openssl.h b/include/webrtc/base/openssl.h deleted file mode 100644 index 2071619..0000000 --- a/include/webrtc/base/openssl.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2013 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPENSSL_H_ -#define WEBRTC_BASE_OPENSSL_H_ - -#include - -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) -#error OpenSSL is older than 1.0.0, which is the minimum supported version. -#endif - -#endif // WEBRTC_BASE_OPENSSL_H_ diff --git a/include/webrtc/base/openssladapter.h b/include/webrtc/base/openssladapter.h deleted file mode 100644 index cdf45e6..0000000 --- a/include/webrtc/base/openssladapter.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPENSSLADAPTER_H__ -#define WEBRTC_BASE_OPENSSLADAPTER_H__ - -#include -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/ssladapter.h" - -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; -typedef struct x509_store_ctx_st X509_STORE_CTX; - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// - -class OpenSSLAdapter : public SSLAdapter, public MessageHandler { -public: - static bool InitializeSSL(VerificationCallback callback); - static bool InitializeSSLThread(); - static bool CleanupSSL(); - - OpenSSLAdapter(AsyncSocket* socket); - ~OpenSSLAdapter() override; - - void SetMode(SSLMode mode) override; - int StartSSL(const char* hostname, bool restartable) override; - int Send(const void* pv, size_t cb) override; - int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override; - int Recv(void* pv, size_t cb) override; - int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override; - int Close() override; - - // Note that the socket returns ST_CONNECTING while SSL is being negotiated. - ConnState GetState() const override; - -protected: - void OnConnectEvent(AsyncSocket* socket) override; - void OnReadEvent(AsyncSocket* socket) override; - void OnWriteEvent(AsyncSocket* socket) override; - void OnCloseEvent(AsyncSocket* socket, int err) override; - -private: - enum SSLState { - SSL_NONE, SSL_WAIT, SSL_CONNECTING, SSL_CONNECTED, SSL_ERROR - }; - - enum { MSG_TIMEOUT }; - - int BeginSSL(); - int ContinueSSL(); - void Error(const char* context, int err, bool signal = true); - void Cleanup(); - - void OnMessage(Message* msg) override; - - static bool VerifyServerName(SSL* ssl, const char* host, - bool ignore_bad_cert); - bool SSLPostConnectionCheck(SSL* ssl, const char* host); -#if !defined(NDEBUG) - static void SSLInfoCallback(const SSL* s, int where, int ret); -#endif - static int SSLVerifyCallback(int ok, X509_STORE_CTX* store); - static VerificationCallback custom_verify_callback_; - friend class OpenSSLStreamAdapter; // for custom_verify_callback_; - - static bool ConfigureTrustedRootCertificates(SSL_CTX* ctx); - SSL_CTX* SetupSSLContext(); - - SSLState state_; - bool ssl_read_needs_write_; - bool ssl_write_needs_read_; - // If true, socket will retain SSL configuration after Close. - bool restartable_; - - SSL* ssl_; - SSL_CTX* ssl_ctx_; - std::string ssl_host_name_; - // Do DTLS or not - SSLMode ssl_mode_; - - bool custom_verification_succeeded_; -}; - -///////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_OPENSSLADAPTER_H__ diff --git a/include/webrtc/base/openssldigest.h b/include/webrtc/base/openssldigest.h deleted file mode 100644 index 413df45..0000000 --- a/include/webrtc/base/openssldigest.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPENSSLDIGEST_H_ -#define WEBRTC_BASE_OPENSSLDIGEST_H_ - -#include - -#include "webrtc/base/messagedigest.h" - -namespace rtc { - -// An implementation of the digest class that uses OpenSSL. -class OpenSSLDigest : public MessageDigest { - public: - // Creates an OpenSSLDigest with |algorithm| as the hash algorithm. - explicit OpenSSLDigest(const std::string& algorithm); - ~OpenSSLDigest() override; - // Returns the digest output size (e.g. 16 bytes for MD5). - size_t Size() const override; - // Updates the digest with |len| bytes from |buf|. - void Update(const void* buf, size_t len) override; - // Outputs the digest value to |buf| with length |len|. - size_t Finish(void* buf, size_t len) override; - - // Helper function to look up a digest's EVP by name. - static bool GetDigestEVP(const std::string &algorithm, - const EVP_MD** md); - // Helper function to look up a digest's name by EVP. - static bool GetDigestName(const EVP_MD* md, - std::string* algorithm); - // Helper function to get the length of a digest. - static bool GetDigestSize(const std::string &algorithm, - size_t* len); - - private: - EVP_MD_CTX ctx_; - const EVP_MD* md_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_OPENSSLDIGEST_H_ diff --git a/include/webrtc/base/opensslidentity.h b/include/webrtc/base/opensslidentity.h deleted file mode 100644 index c8aa69a..0000000 --- a/include/webrtc/base/opensslidentity.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPENSSLIDENTITY_H_ -#define WEBRTC_BASE_OPENSSLIDENTITY_H_ - -#include -#include - -#include - -#include "webrtc/base/common.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sslidentity.h" - -typedef struct ssl_ctx_st SSL_CTX; - -namespace rtc { - -// OpenSSLKeyPair encapsulates an OpenSSL EVP_PKEY* keypair object, -// which is reference counted inside the OpenSSL library. -class OpenSSLKeyPair { - public: - explicit OpenSSLKeyPair(EVP_PKEY* pkey) : pkey_(pkey) { - ASSERT(pkey_ != NULL); - } - - static OpenSSLKeyPair* Generate(const KeyParams& key_params); - - virtual ~OpenSSLKeyPair(); - - virtual OpenSSLKeyPair* GetReference(); - - EVP_PKEY* pkey() const { return pkey_; } - - private: - void AddReference(); - - EVP_PKEY* pkey_; - - RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyPair); -}; - -// OpenSSLCertificate encapsulates an OpenSSL X509* certificate object, -// which is also reference counted inside the OpenSSL library. -class OpenSSLCertificate : public SSLCertificate { - public: - // Caller retains ownership of the X509 object. - explicit OpenSSLCertificate(X509* x509) : x509_(x509) { - AddReference(); - } - - static OpenSSLCertificate* Generate(OpenSSLKeyPair* key_pair, - const SSLIdentityParams& params); - static OpenSSLCertificate* FromPEMString(const std::string& pem_string); - - ~OpenSSLCertificate() override; - - OpenSSLCertificate* GetReference() const override; - - X509* x509() const { return x509_; } - - std::string ToPEMString() const override; - - void ToDER(Buffer* der_buffer) const override; - - // Compute the digest of the certificate given algorithm - bool ComputeDigest(const std::string& algorithm, - unsigned char* digest, - size_t size, - size_t* length) const override; - - // Compute the digest of a certificate as an X509 * - static bool ComputeDigest(const X509* x509, - const std::string& algorithm, - unsigned char* digest, - size_t size, - size_t* length); - - bool GetSignatureDigestAlgorithm(std::string* algorithm) const override; - bool GetChain(SSLCertChain** chain) const override; - - int64_t CertificateExpirationTime() const override; - - private: - void AddReference() const; - - X509* x509_; - - RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate); -}; - -// Holds a keypair and certificate together, and a method to generate -// them consistently. -class OpenSSLIdentity : public SSLIdentity { - public: - static OpenSSLIdentity* Generate(const std::string& common_name, - const KeyParams& key_params); - static OpenSSLIdentity* GenerateForTest(const SSLIdentityParams& params); - static SSLIdentity* FromPEMStrings(const std::string& private_key, - const std::string& certificate); - ~OpenSSLIdentity() override; - - const OpenSSLCertificate& certificate() const override; - OpenSSLIdentity* GetReference() const override; - - // Configure an SSL context object to use our key and certificate. - bool ConfigureIdentity(SSL_CTX* ctx); - - private: - OpenSSLIdentity(OpenSSLKeyPair* key_pair, OpenSSLCertificate* certificate); - - static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params); - - scoped_ptr key_pair_; - scoped_ptr certificate_; - - RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); -}; - - -} // namespace rtc - -#endif // WEBRTC_BASE_OPENSSLIDENTITY_H_ diff --git a/include/webrtc/base/opensslstreamadapter.h b/include/webrtc/base/opensslstreamadapter.h deleted file mode 100644 index e57b2a3..0000000 --- a/include/webrtc/base/opensslstreamadapter.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ -#define WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ - -#include -#include - -#include "webrtc/base/buffer.h" -#include "webrtc/base/sslstreamadapter.h" -#include "webrtc/base/opensslidentity.h" - -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; -typedef struct ssl_cipher_st SSL_CIPHER; -typedef struct x509_store_ctx_st X509_STORE_CTX; - -namespace rtc { - -// This class was written with OpenSSLAdapter (a socket adapter) as a -// starting point. It has similar structure and functionality, with -// the peer-to-peer mode added. -// -// Static methods to initialize and deinit the SSL library are in -// OpenSSLAdapter. This class also uses -// OpenSSLAdapter::custom_verify_callback_ (a static field). These -// should probably be moved out to a neutral class. -// -// In a few cases I have factored out some OpenSSLAdapter code into -// static methods so it can be reused from this class. Eventually that -// code should probably be moved to a common support -// class. Unfortunately there remain a few duplicated sections of -// code. I have not done more restructuring because I did not want to -// affect existing code that uses OpenSSLAdapter. -// -// This class does not support the SSL connection restart feature -// present in OpenSSLAdapter. I am not entirely sure how the feature -// is useful and I am not convinced that it works properly. -// -// This implementation is careful to disallow data exchange after an -// SSL error, and it has an explicit SSL_CLOSED state. It should not -// be possible to send any data in clear after one of the StartSSL -// methods has been called. - -// Look in sslstreamadapter.h for documentation of the methods. - -class OpenSSLIdentity; - -/////////////////////////////////////////////////////////////////////////////// - -class OpenSSLStreamAdapter : public SSLStreamAdapter { - public: - explicit OpenSSLStreamAdapter(StreamInterface* stream); - ~OpenSSLStreamAdapter() override; - - void SetIdentity(SSLIdentity* identity) override; - - // Default argument is for compatibility - void SetServerRole(SSLRole role = SSL_SERVER) override; - bool SetPeerCertificateDigest(const std::string& digest_alg, - const unsigned char* digest_val, - size_t digest_len) override; - - bool GetPeerCertificate(SSLCertificate** cert) const override; - - int StartSSLWithServer(const char* server_name) override; - int StartSSLWithPeer() override; - void SetMode(SSLMode mode) override; - void SetMaxProtocolVersion(SSLProtocolVersion version) override; - - StreamResult Read(void* data, - size_t data_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - StreamState GetState() const override; - - // TODO(guoweis): Move this away from a static class method. - static std::string SslCipherSuiteToName(int crypto_suite); - - bool GetSslCipherSuite(int* cipher) override; - - // Key Extractor interface - bool ExportKeyingMaterial(const std::string& label, - const uint8_t* context, - size_t context_len, - bool use_context, - uint8_t* result, - size_t result_len) override; - - // DTLS-SRTP interface - bool SetDtlsSrtpCryptoSuites(const std::vector& crypto_suites) override; - bool GetDtlsSrtpCryptoSuite(int* crypto_suite) override; - - // Capabilities interfaces - static bool HaveDtls(); - static bool HaveDtlsSrtp(); - static bool HaveExporter(); - - // TODO(guoweis): Move this away from a static class method. - static int GetDefaultSslCipherForTest(SSLProtocolVersion version, - KeyType key_type); - - protected: - void OnEvent(StreamInterface* stream, int events, int err) override; - - private: - enum SSLState { - // Before calling one of the StartSSL methods, data flows - // in clear text. - SSL_NONE, - SSL_WAIT, // waiting for the stream to open to start SSL negotiation - SSL_CONNECTING, // SSL negotiation in progress - SSL_CONNECTED, // SSL stream successfully established - SSL_ERROR, // some SSL error occurred, stream is closed - SSL_CLOSED // Clean close - }; - - enum { MSG_TIMEOUT = MSG_MAX+1}; - - // The following three methods return 0 on success and a negative - // error code on failure. The error code may be from OpenSSL or -1 - // on some other error cases, so it can't really be interpreted - // unfortunately. - - // Go from state SSL_NONE to either SSL_CONNECTING or SSL_WAIT, - // depending on whether the underlying stream is already open or - // not. - int StartSSL(); - // Prepare SSL library, state is SSL_CONNECTING. - int BeginSSL(); - // Perform SSL negotiation steps. - int ContinueSSL(); - - // Error handler helper. signal is given as true for errors in - // asynchronous contexts (when an error method was not returned - // through some other method), and in that case an SE_CLOSE event is - // raised on the stream with the specified error. - // A 0 error means a graceful close, otherwise there is not really enough - // context to interpret the error code. - void Error(const char* context, int err, bool signal); - void Cleanup(); - - // Override MessageHandler - void OnMessage(Message* msg) override; - - // Flush the input buffers by reading left bytes (for DTLS) - void FlushInput(unsigned int left); - - // SSL library configuration - SSL_CTX* SetupSSLContext(); - // SSL verification check - bool SSLPostConnectionCheck(SSL* ssl, const char* server_name, - const X509* peer_cert, - const std::string& peer_digest); - // SSL certification verification error handler, called back from - // the openssl library. Returns an int interpreted as a boolean in - // the C style: zero means verification failure, non-zero means - // passed. - static int SSLVerifyCallback(int ok, X509_STORE_CTX* store); - - SSLState state_; - SSLRole role_; - int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED - // Whether the SSL negotiation is blocked on needing to read or - // write to the wrapped stream. - bool ssl_read_needs_write_; - bool ssl_write_needs_read_; - - SSL* ssl_; - SSL_CTX* ssl_ctx_; - - // Our key and certificate, mostly useful in peer-to-peer mode. - scoped_ptr identity_; - // in traditional mode, the server name that the server's certificate - // must specify. Empty in peer-to-peer mode. - std::string ssl_server_name_; - // The certificate that the peer must present or did present. Initially - // null in traditional mode, until the connection is established. - scoped_ptr peer_certificate_; - // In peer-to-peer mode, the digest of the certificate that - // the peer must present. - Buffer peer_certificate_digest_value_; - std::string peer_certificate_digest_algorithm_; - - // OpenSSLAdapter::custom_verify_callback_ result - bool custom_verification_succeeded_; - - // The DtlsSrtp ciphers - std::string srtp_ciphers_; - - // Do DTLS or not - SSLMode ssl_mode_; - - // Max. allowed protocol version - SSLProtocolVersion ssl_max_version_; -}; - -///////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ diff --git a/include/webrtc/base/optional.h b/include/webrtc/base/optional.h deleted file mode 100644 index 6e7535b..0000000 --- a/include/webrtc/base/optional.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPTIONAL_H_ -#define WEBRTC_BASE_OPTIONAL_H_ - -#include -#include - -#include "webrtc/base/checks.h" - -namespace rtc { - -// Simple std::experimental::optional-wannabe. It either contains a T or not. -// In order to keep the implementation simple and portable, this implementation -// actually contains a (default-constructed) T even when it supposedly doesn't -// contain a value; use e.g. rtc::scoped_ptr instead if that's too -// expensive. -// -// A moved-from Optional may only be destroyed, and assigned to if T allows -// being assigned to after having been moved from. Specifically, you may not -// assume that it just doesn't contain a value anymore. -// -// Examples of good places to use Optional: -// -// - As a class or struct member, when the member doesn't always have a value: -// struct Prisoner { -// std::string name; -// Optional cell_number; // Empty if not currently incarcerated. -// }; -// -// - As a return value for functions that may fail to return a value on all -// allowed inputs. For example, a function that searches an array might -// return an Optional (the index where it found the element, or -// nothing if it didn't find it); and a function that parses numbers might -// return Optional (the parsed number, or nothing if parsing failed). -// -// Examples of bad places to use Optional: -// -// - As a return value for functions that may fail because of disallowed -// inputs. For example, a string length function should not return -// Optional so that it can return nothing in case the caller passed -// it a null pointer; the function should probably use RTC_[D]CHECK instead, -// and return plain size_t. -// -// - As a return value for functions that may fail to return a value on all -// allowed inputs, but need to tell the caller what went wrong. Returning -// Optional when parsing a single number as in the example above -// might make sense, but any larger parse job is probably going to need to -// tell the caller what the problem was, not just that there was one. -// -// TODO(kwiberg): Get rid of this class when the standard library has -// std::optional (and we're allowed to use it). -template -class Optional final { - public: - // Construct an empty Optional. - Optional() : has_value_(false) {} - - // Construct an Optional that contains a value. - explicit Optional(const T& val) : value_(val), has_value_(true) {} - explicit Optional(T&& val) - : value_(static_cast(val)), has_value_(true) {} - - // Copy and move constructors. - // TODO(kwiberg): =default the move constructor when MSVC supports it. - Optional(const Optional&) = default; - Optional(Optional&& m) - : value_(static_cast(m.value_)), has_value_(m.has_value_) {} - - // Assignment. - // TODO(kwiberg): =default the move assignment op when MSVC supports it. - Optional& operator=(const Optional&) = default; - Optional& operator=(Optional&& m) { - value_ = static_cast(m.value_); - has_value_ = m.has_value_; - return *this; - } - - friend void swap(Optional& m1, Optional& m2) { - using std::swap; - swap(m1.value_, m2.value_); - swap(m1.has_value_, m2.has_value_); - } - - // Conversion to bool to test if we have a value. - explicit operator bool() const { return has_value_; } - - // Dereferencing. Only allowed if we have a value. - const T* operator->() const { - RTC_DCHECK(has_value_); - return &value_; - } - T* operator->() { - RTC_DCHECK(has_value_); - return &value_; - } - const T& operator*() const { - RTC_DCHECK(has_value_); - return value_; - } - T& operator*() { - RTC_DCHECK(has_value_); - return value_; - } - - // Dereference with a default value in case we don't have a value. - const T& value_or(const T& default_val) const { - return has_value_ ? value_ : default_val; - } - - // Equality tests. Two Optionals are equal if they contain equivalent values, - // or - // if they're both empty. - friend bool operator==(const Optional& m1, const Optional& m2) { - return m1.has_value_ && m2.has_value_ ? m1.value_ == m2.value_ - : m1.has_value_ == m2.has_value_; - } - friend bool operator!=(const Optional& m1, const Optional& m2) { - return m1.has_value_ && m2.has_value_ ? m1.value_ != m2.value_ - : m1.has_value_ != m2.has_value_; - } - - private: - // Invariant: Unless *this has been moved from, value_ is default-initialized - // (or copied or moved from a default-initialized T) if !has_value_. - T value_; - bool has_value_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_OPTIONAL_H_ diff --git a/include/webrtc/base/optionsfile.h b/include/webrtc/base/optionsfile.h deleted file mode 100644 index 9eb484e..0000000 --- a/include/webrtc/base/optionsfile.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_OPTIONSFILE_H_ -#define WEBRTC_BASE_OPTIONSFILE_H_ - -#include -#include - -namespace rtc { - -// Implements storage of simple options in a text file on disk. This is -// cross-platform, but it is intended mostly for Linux where there is no -// first-class options storage system. -class OptionsFile { - public: - OptionsFile(const std::string &path); - ~OptionsFile(); - - // Loads the file from disk, overwriting the in-memory values. - bool Load(); - // Saves the contents in memory, overwriting the on-disk values. - bool Save(); - - bool GetStringValue(const std::string& option, std::string* out_val) const; - bool GetIntValue(const std::string& option, int* out_val) const; - bool SetStringValue(const std::string& option, const std::string& val); - bool SetIntValue(const std::string& option, int val); - bool RemoveValue(const std::string& option); - - private: - typedef std::map OptionsMap; - - static bool IsLegalName(const std::string &name); - static bool IsLegalValue(const std::string &value); - - std::string path_; - OptionsMap options_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_OPTIONSFILE_H_ diff --git a/include/webrtc/base/pathutils.h b/include/webrtc/base/pathutils.h deleted file mode 100644 index 2d5819f..0000000 --- a/include/webrtc/base/pathutils.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PATHUTILS_H__ -#define WEBRTC_BASE_PATHUTILS_H__ - -#include -// Temporary, until deprecated helpers are removed. -#include "webrtc/base/fileutils.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// Pathname - parsing of pathnames into components, and vice versa. -// -// To establish consistent terminology, a filename never contains a folder -// component. A folder never contains a filename. A pathname may include -// a folder and/or filename component. Here are some examples: -// -// pathname() /home/john/example.txt -// folder() /home/john/ -// filename() example.txt -// parent_folder() /home/ -// folder_name() john/ -// basename() example -// extension() .txt -// -// Basename may begin, end, and/or include periods, but no folder delimiters. -// If extension exists, it consists of a period followed by zero or more -// non-period/non-delimiter characters, and basename is non-empty. -/////////////////////////////////////////////////////////////////////////////// - -class Pathname { -public: - // Folder delimiters are slash and backslash - static bool IsFolderDelimiter(char ch); - static char DefaultFolderDelimiter(); - - Pathname(); - Pathname(const std::string& pathname); - Pathname(const std::string& folder, const std::string& filename); - - // Set's the default folder delimiter for this Pathname - char folder_delimiter() const { return folder_delimiter_; } - void SetFolderDelimiter(char delimiter); - - // Normalize changes all folder delimiters to folder_delimiter() - void Normalize(); - - // Reset to the empty pathname - void clear(); - - // Returns true if the pathname is empty. Note: this->pathname().empty() - // is always false. - bool empty() const; - - std::string url() const; - - // Returns the folder and filename components. If the pathname is empty, - // returns a string representing the current directory (as a relative path, - // i.e., "."). - std::string pathname() const; - void SetPathname(const std::string& pathname); - void SetPathname(const std::string& folder, const std::string& filename); - - // Append pathname to the current folder (if any). Any existing filename - // will be discarded. - void AppendPathname(const std::string& pathname); - - std::string folder() const; - std::string folder_name() const; - std::string parent_folder() const; - // SetFolder and AppendFolder will append a folder delimiter, if needed. - void SetFolder(const std::string& folder); - void AppendFolder(const std::string& folder); - - std::string basename() const; - bool SetBasename(const std::string& basename); - - std::string extension() const; - // SetExtension will prefix a period, if needed. - bool SetExtension(const std::string& extension); - - std::string filename() const; - bool SetFilename(const std::string& filename); - -#if defined(WEBRTC_WIN) - bool GetDrive(char* drive, uint32_t bytes) const; - static bool GetDrive(char* drive, - uint32_t bytes, - const std::string& pathname); -#endif - -private: - std::string folder_, basename_, extension_; - char folder_delimiter_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// Global Helpers (deprecated) -/////////////////////////////////////////////////////////////////////////////// - -inline void SetOrganizationName(const std::string& organization) { - Filesystem::SetOrganizationName(organization); -} -inline void SetApplicationName(const std::string& application) { - Filesystem::SetApplicationName(application); -} -inline void GetOrganizationName(std::string* organization) { - Filesystem::GetOrganizationName(organization); -} -inline void GetApplicationName(std::string* application) { - Filesystem::GetApplicationName(application); -} -inline bool CreateFolder(const Pathname& path) { - return Filesystem::CreateFolder(path); -} -inline bool FinishPath(Pathname& path, bool create, const std::string& append) { - if (!append.empty()) - path.AppendFolder(append); - return !create || CreateFolder(path); -} -// Note: this method uses the convention of / for the temporary -// folder. Filesystem uses /. We will be migrating exclusively -// to // eventually. Since these are temp folders, -// it's probably ok to orphan them during the transition. -inline bool GetTemporaryFolder(Pathname& path, bool create, - const std::string& append) { - std::string application_name; - Filesystem::GetApplicationName(&application_name); - ASSERT(!application_name.empty()); - return Filesystem::GetTemporaryFolder(path, create, &application_name) - && FinishPath(path, create, append); -} -inline bool GetAppDataFolder(Pathname& path, bool create, - const std::string& append) { - ASSERT(!create); // TODO: Support create flag on Filesystem::GetAppDataFolder. - return Filesystem::GetAppDataFolder(&path, true) - && FinishPath(path, create, append); -} -inline bool CleanupTemporaryFolder() { - Pathname path; - if (!GetTemporaryFolder(path, false, "")) - return false; - if (Filesystem::IsAbsent(path)) - return true; - if (!Filesystem::IsTemporaryPath(path)) { - ASSERT(false); - return false; - } - return Filesystem::DeleteFolderContents(path); -} - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_PATHUTILS_H__ diff --git a/include/webrtc/base/physicalsocketserver.h b/include/webrtc/base/physicalsocketserver.h deleted file mode 100644 index ae1f10f..0000000 --- a/include/webrtc/base/physicalsocketserver.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ -#define WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ - -#include - -#include "webrtc/base/asyncfile.h" -#include "webrtc/base/nethelpers.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/socketserver.h" -#include "webrtc/base/criticalsection.h" - -#if defined(WEBRTC_POSIX) -typedef int SOCKET; -#endif // WEBRTC_POSIX - -namespace rtc { - -// Event constants for the Dispatcher class. -enum DispatcherEvent { - DE_READ = 0x0001, - DE_WRITE = 0x0002, - DE_CONNECT = 0x0004, - DE_CLOSE = 0x0008, - DE_ACCEPT = 0x0010, -}; - -class Signaler; -#if defined(WEBRTC_POSIX) -class PosixSignalDispatcher; -#endif - -class Dispatcher { - public: - virtual ~Dispatcher() {} - virtual uint32_t GetRequestedEvents() = 0; - virtual void OnPreEvent(uint32_t ff) = 0; - virtual void OnEvent(uint32_t ff, int err) = 0; -#if defined(WEBRTC_WIN) - virtual WSAEVENT GetWSAEvent() = 0; - virtual SOCKET GetSocket() = 0; - virtual bool CheckSignalClose() = 0; -#elif defined(WEBRTC_POSIX) - virtual int GetDescriptor() = 0; - virtual bool IsDescriptorClosed() = 0; -#endif -}; - -// A socket server that provides the real sockets of the underlying OS. -class PhysicalSocketServer : public SocketServer { - public: - PhysicalSocketServer(); - ~PhysicalSocketServer() override; - - // SocketFactory: - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - // Internal Factory for Accept - AsyncSocket* WrapSocket(SOCKET s); - - // SocketServer: - bool Wait(int cms, bool process_io) override; - void WakeUp() override; - - void Add(Dispatcher* dispatcher); - void Remove(Dispatcher* dispatcher); - -#if defined(WEBRTC_POSIX) - AsyncFile* CreateFile(int fd); - - // Sets the function to be executed in response to the specified POSIX signal. - // The function is executed from inside Wait() using the "self-pipe trick"-- - // regardless of which thread receives the signal--and hence can safely - // manipulate user-level data structures. - // "handler" may be SIG_IGN, SIG_DFL, or a user-specified function, just like - // with signal(2). - // Only one PhysicalSocketServer should have user-level signal handlers. - // Dispatching signals on multiple PhysicalSocketServers is not reliable. - // The signal mask is not modified. It is the caller's responsibily to - // maintain it as desired. - virtual bool SetPosixSignalHandler(int signum, void (*handler)(int)); - - protected: - Dispatcher* signal_dispatcher(); -#endif - - private: - typedef std::vector DispatcherList; - typedef std::vector IteratorList; - -#if defined(WEBRTC_POSIX) - static bool InstallSignal(int signum, void (*handler)(int)); - - scoped_ptr signal_dispatcher_; -#endif - DispatcherList dispatchers_; - IteratorList iterators_; - Signaler* signal_wakeup_; - CriticalSection crit_; - bool fWait_; -#if defined(WEBRTC_WIN) - WSAEVENT socket_ev_; -#endif -}; - -class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> { - public: - PhysicalSocket(PhysicalSocketServer* ss, SOCKET s = INVALID_SOCKET); - ~PhysicalSocket() override; - - // Creates the underlying OS socket (same as the "socket" function). - virtual bool Create(int family, int type); - - SocketAddress GetLocalAddress() const override; - SocketAddress GetRemoteAddress() const override; - - int Bind(const SocketAddress& bind_addr) override; - int Connect(const SocketAddress& addr) override; - - int GetError() const override; - void SetError(int error) override; - - ConnState GetState() const override; - - int GetOption(Option opt, int* value) override; - int SetOption(Option opt, int value) override; - - int Send(const void* pv, size_t cb) override; - int SendTo(const void* buffer, - size_t length, - const SocketAddress& addr) override; - - int Recv(void* buffer, size_t length) override; - int RecvFrom(void* buffer, size_t length, SocketAddress* out_addr) override; - - int Listen(int backlog) override; - AsyncSocket* Accept(SocketAddress* out_addr) override; - - int Close() override; - - int EstimateMTU(uint16_t* mtu) override; - - SocketServer* socketserver() { return ss_; } - - protected: - int DoConnect(const SocketAddress& connect_addr); - - // Make virtual so ::accept can be overwritten in tests. - virtual SOCKET DoAccept(SOCKET socket, sockaddr* addr, socklen_t* addrlen); - - void OnResolveResult(AsyncResolverInterface* resolver); - - void UpdateLastError(); - void MaybeRemapSendError(); - - static int TranslateOption(Option opt, int* slevel, int* sopt); - - PhysicalSocketServer* ss_; - SOCKET s_; - uint8_t enabled_events_; - bool udp_; - mutable CriticalSection crit_; - int error_ GUARDED_BY(crit_); - ConnState state_; - AsyncResolver* resolver_; - -#if !defined(NDEBUG) - std::string dbg_addr_; -#endif -}; - -class SocketDispatcher : public Dispatcher, public PhysicalSocket { - public: - explicit SocketDispatcher(PhysicalSocketServer *ss); - SocketDispatcher(SOCKET s, PhysicalSocketServer *ss); - ~SocketDispatcher() override; - - bool Initialize(); - - virtual bool Create(int type); - bool Create(int family, int type) override; - -#if defined(WEBRTC_WIN) - WSAEVENT GetWSAEvent() override; - SOCKET GetSocket() override; - bool CheckSignalClose() override; -#elif defined(WEBRTC_POSIX) - int GetDescriptor() override; - bool IsDescriptorClosed() override; -#endif - - uint32_t GetRequestedEvents() override; - void OnPreEvent(uint32_t ff) override; - void OnEvent(uint32_t ff, int err) override; - - int Close() override; - -#if defined(WEBRTC_WIN) - private: - static int next_id_; - int id_; - bool signal_close_; - int signal_err_; -#endif // WEBRTC_WIN -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_PHYSICALSOCKETSERVER_H__ diff --git a/include/webrtc/base/platform_file.h b/include/webrtc/base/platform_file.h deleted file mode 100644 index 12e08e9..0000000 --- a/include/webrtc/base/platform_file.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PLATFORM_FILE_H_ -#define WEBRTC_BASE_PLATFORM_FILE_H_ - -#include - -#if defined(WEBRTC_WIN) -#include -#endif - -namespace rtc { - -#if defined(WEBRTC_WIN) -typedef HANDLE PlatformFile; -#elif defined(WEBRTC_POSIX) -typedef int PlatformFile; -#else -#error Unsupported platform -#endif - -extern const PlatformFile kInvalidPlatformFileValue; - -// Associates a standard FILE stream with an existing PlatformFile. -// Note that after this function has returned a valid FILE stream, -// the PlatformFile should no longer be used. -FILE* FdopenPlatformFileForWriting(PlatformFile file); - -// Closes a PlatformFile. -// Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile. -// Use fclose instead. -bool ClosePlatformFile(PlatformFile file); - -} // namespace rtc - -#endif // WEBRTC_BASE_PLATFORM_FILE_H_ diff --git a/include/webrtc/base/platform_thread.h b/include/webrtc/base/platform_thread.h deleted file mode 100644 index 53465e4..0000000 --- a/include/webrtc/base/platform_thread.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PLATFORM_THREAD_H_ -#define WEBRTC_BASE_PLATFORM_THREAD_H_ - -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/event.h" -#include "webrtc/base/platform_thread_types.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/thread_checker.h" - -namespace rtc { - -PlatformThreadId CurrentThreadId(); -PlatformThreadRef CurrentThreadRef(); - -// Compares two thread identifiers for equality. -bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b); - -// Sets the current thread name. -void SetCurrentThreadName(const char* name); - -// Callback function that the spawned thread will enter once spawned. -// A return value of false is interpreted as that the function has no -// more work to do and that the thread can be released. -typedef bool (*ThreadRunFunction)(void*); - -enum ThreadPriority { -#ifdef WEBRTC_WIN - kLowPriority = THREAD_PRIORITY_BELOW_NORMAL, - kNormalPriority = THREAD_PRIORITY_NORMAL, - kHighPriority = THREAD_PRIORITY_ABOVE_NORMAL, - kHighestPriority = THREAD_PRIORITY_HIGHEST, - kRealtimePriority = THREAD_PRIORITY_TIME_CRITICAL -#else - kLowPriority = 1, - kNormalPriority = 2, - kHighPriority = 3, - kHighestPriority = 4, - kRealtimePriority = 5 -#endif -}; - -// Represents a simple worker thread. The implementation must be assumed -// to be single threaded, meaning that all methods of the class, must be -// called from the same thread, including instantiation. -class PlatformThread { - public: - PlatformThread(ThreadRunFunction func, void* obj, const char* thread_name); - virtual ~PlatformThread(); - - // Spawns a thread and tries to set thread priority according to the priority - // from when CreateThread was called. - void Start(); - - bool IsRunning() const; - - // Stops (joins) the spawned thread. - void Stop(); - - // Set the priority of the thread. Must be called when thread is running. - bool SetPriority(ThreadPriority priority); - - private: - void Run(); - - ThreadRunFunction const run_function_; - void* const obj_; - // TODO(pbos): Make sure call sites use string literals and update to a const - // char* instead of a std::string. - const std::string name_; - rtc::ThreadChecker thread_checker_; -#if defined(WEBRTC_WIN) - static DWORD WINAPI StartThread(void* param); - - bool stop_; - HANDLE thread_; -#else - static void* StartThread(void* param); - - rtc::Event stop_event_; - - pthread_t thread_; -#endif // defined(WEBRTC_WIN) - RTC_DISALLOW_COPY_AND_ASSIGN(PlatformThread); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_PLATFORM_THREAD_H_ diff --git a/include/webrtc/base/platform_thread_types.h b/include/webrtc/base/platform_thread_types.h deleted file mode 100644 index 546fffd..0000000 --- a/include/webrtc/base/platform_thread_types.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PLATFORM_THREAD_TYPES_H_ -#define WEBRTC_BASE_PLATFORM_THREAD_TYPES_H_ - -#if defined(WEBRTC_WIN) -#include -#include -#elif defined(WEBRTC_POSIX) -#include -#include -#endif - -namespace rtc { -#if defined(WEBRTC_WIN) -typedef DWORD PlatformThreadId; -typedef DWORD PlatformThreadRef; -#elif defined(WEBRTC_POSIX) -typedef pid_t PlatformThreadId; -typedef pthread_t PlatformThreadRef; -#endif -} // namespace rtc - -#endif // WEBRTC_BASE_PLATFORM_THREAD_TYPES_H_ diff --git a/include/webrtc/base/posix.h b/include/webrtc/base/posix.h deleted file mode 100644 index 8d1c2b1..0000000 --- a/include/webrtc/base/posix.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_POSIX_H_ -#define WEBRTC_BASE_POSIX_H_ - -namespace rtc { - -// Runs the given executable name as a daemon, so that it executes concurrently -// with this process. Upon completion, the daemon process will automatically be -// reaped by init(8), so an error exit status or a failure to start the -// executable are not reported. Returns true if the daemon process was forked -// successfully, else false. -bool RunAsDaemon(const char *file, const char *const argv[]); - -} // namespace rtc - -#endif // WEBRTC_BASE_POSIX_H_ diff --git a/include/webrtc/base/profiler.h b/include/webrtc/base/profiler.h deleted file mode 100644 index 419763f..0000000 --- a/include/webrtc/base/profiler.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2013 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// A simple wall-clock profiler for instrumented code. -// Example: -// void MyLongFunction() { -// PROFILE_F(); // Time the execution of this function. -// // Do something -// { // Time just what is in this scope. -// PROFILE("My event"); -// // Do something else -// } -// } -// Another example: -// void StartAsyncProcess() { -// PROFILE_START("My async event"); -// DoSomethingAsyncAndThenCall(&Callback); -// } -// void Callback() { -// PROFILE_STOP("My async event"); -// // Handle callback. -// } - -#ifndef WEBRTC_BASE_PROFILER_H_ -#define WEBRTC_BASE_PROFILER_H_ - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/common.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/sharedexclusivelock.h" - -// Profiling could be switched via a build flag, but for now, it's always on. -#ifndef ENABLE_PROFILING -#define ENABLE_PROFILING -#endif - -#ifdef ENABLE_PROFILING - -#define UV_HELPER2(x) _uv_ ## x -#define UV_HELPER(x) UV_HELPER2(x) -#define UNIQUE_VAR UV_HELPER(__LINE__) - -// Profiles the current scope. -#define PROFILE(msg) rtc::ProfilerScope UNIQUE_VAR(msg) -// When placed at the start of a function, profiles the current function. -#define PROFILE_F() PROFILE(__FUNCTION__) -// Reports current timings to the log at severity |sev|. -#define PROFILE_DUMP_ALL(sev) \ - rtc::Profiler::Instance()->ReportAllToLog(__FILE__, __LINE__, sev) -// Reports current timings for all events whose names are prefixed by |prefix| -// to the log at severity |sev|. Using a unique event name as |prefix| will -// report only that event. -#define PROFILE_DUMP(sev, prefix) \ - rtc::Profiler::Instance()->ReportToLog(__FILE__, __LINE__, sev, prefix) -// Starts and stops a profile event. Useful when an event is not easily -// captured within a scope (eg, an async call with a callback when done). -#define PROFILE_START(msg) rtc::Profiler::Instance()->StartEvent(msg) -#define PROFILE_STOP(msg) rtc::Profiler::Instance()->StopEvent(msg) -// TODO(ryanpetrie): Consider adding PROFILE_DUMP_EVERY(sev, iterations) - -#undef UV_HELPER2 -#undef UV_HELPER -#undef UNIQUE_VAR - -#else // ENABLE_PROFILING - -#define PROFILE(msg) (void)0 -#define PROFILE_F() (void)0 -#define PROFILE_DUMP_ALL(sev) (void)0 -#define PROFILE_DUMP(sev, prefix) (void)0 -#define PROFILE_START(msg) (void)0 -#define PROFILE_STOP(msg) (void)0 - -#endif // ENABLE_PROFILING - -namespace rtc { - -// Tracks information for one profiler event. -class ProfilerEvent { - public: - ProfilerEvent(); - void Start(); - void Stop(); - void Stop(uint64_t stop_time); - double standard_deviation() const; - double total_time() const { return total_time_; } - double mean() const { return mean_; } - double minimum() const { return minimum_; } - double maximum() const { return maximum_; } - int event_count() const { return event_count_; } - bool is_started() const { return start_count_ > 0; } - - private: - uint64_t current_start_time_; - double total_time_; - double mean_; - double sum_of_squared_differences_; - double minimum_; - double maximum_; - int start_count_; - int event_count_; -}; - -// Singleton that owns ProfilerEvents and reports results. Prefer to use -// macros, defined above, rather than directly calling Profiler methods. -class Profiler { - public: - ~Profiler(); - void StartEvent(const std::string& event_name); - void StopEvent(const std::string& event_name); - void ReportToLog(const char* file, int line, LoggingSeverity severity_to_use, - const std::string& event_prefix); - void ReportAllToLog(const char* file, int line, - LoggingSeverity severity_to_use); - const ProfilerEvent* GetEvent(const std::string& event_name) const; - // Clears all _stopped_ events. Returns true if _all_ events were cleared. - bool Clear(); - - static Profiler* Instance(); - private: - Profiler(); - - typedef std::map EventMap; - EventMap events_; - mutable SharedExclusiveLock lock_; - - RTC_DISALLOW_COPY_AND_ASSIGN(Profiler); -}; - -// Starts an event on construction and stops it on destruction. -// Used by PROFILE macro. -class ProfilerScope { - public: - explicit ProfilerScope(const std::string& event_name) - : event_name_(event_name) { - Profiler::Instance()->StartEvent(event_name_); - } - ~ProfilerScope() { - Profiler::Instance()->StopEvent(event_name_); - } - private: - std::string event_name_; - - RTC_DISALLOW_COPY_AND_ASSIGN(ProfilerScope); -}; - -std::ostream& operator<<(std::ostream& stream, - const ProfilerEvent& profiler_event); - -} // namespace rtc - -#endif // WEBRTC_BASE_PROFILER_H_ diff --git a/include/webrtc/base/proxydetect.h b/include/webrtc/base/proxydetect.h deleted file mode 100644 index f9bf5f8..0000000 --- a/include/webrtc/base/proxydetect.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2007 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef _PROXYDETECT_H_ -#define _PROXYDETECT_H_ - -#include "webrtc/base/proxyinfo.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -namespace rtc { -// Auto-detect the proxy server. Returns true if a proxy is configured, -// although hostname may be empty if the proxy is not required for -// the given URL. - -bool GetProxySettingsForUrl(const char* agent, const char* url, - rtc::ProxyInfo* proxy, - bool long_operation = false); - -} // namespace rtc - -#endif // _PROXYDETECT_H_ diff --git a/include/webrtc/base/proxyinfo.h b/include/webrtc/base/proxyinfo.h deleted file mode 100644 index 2251b13..0000000 --- a/include/webrtc/base/proxyinfo.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PROXYINFO_H__ -#define WEBRTC_BASE_PROXYINFO_H__ - -#include -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/cryptstring.h" - -namespace rtc { - -enum ProxyType { - PROXY_NONE, - PROXY_HTTPS, - PROXY_SOCKS5, - PROXY_UNKNOWN -}; -const char * ProxyToString(ProxyType proxy); - -struct ProxyInfo { - ProxyType type; - SocketAddress address; - std::string autoconfig_url; - bool autodetect; - std::string bypass_list; - std::string username; - CryptString password; - - ProxyInfo(); - ~ProxyInfo(); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_PROXYINFO_H__ diff --git a/include/webrtc/base/proxyserver.h b/include/webrtc/base/proxyserver.h deleted file mode 100644 index adb26ae..0000000 --- a/include/webrtc/base/proxyserver.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_PROXYSERVER_H_ -#define WEBRTC_BASE_PROXYSERVER_H_ - -#include -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/socketadapters.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -class SocketFactory; - -// ProxyServer is a base class that allows for easy construction of proxy -// servers. With its helper class ProxyBinding, it contains all the necessary -// logic for receiving and bridging connections. The specific client-server -// proxy protocol is implemented by an instance of the AsyncProxyServerSocket -// class; children of ProxyServer implement WrapSocket appropriately to return -// the correct protocol handler. - -class ProxyBinding : public sigslot::has_slots<> { - public: - ProxyBinding(AsyncProxyServerSocket* in_socket, AsyncSocket* out_socket); - ~ProxyBinding() override; - sigslot::signal1 SignalDestroyed; - - private: - void OnConnectRequest(AsyncProxyServerSocket* socket, - const SocketAddress& addr); - void OnInternalRead(AsyncSocket* socket); - void OnInternalWrite(AsyncSocket* socket); - void OnInternalClose(AsyncSocket* socket, int err); - void OnExternalConnect(AsyncSocket* socket); - void OnExternalRead(AsyncSocket* socket); - void OnExternalWrite(AsyncSocket* socket); - void OnExternalClose(AsyncSocket* socket, int err); - - static void Read(AsyncSocket* socket, FifoBuffer* buffer); - static void Write(AsyncSocket* socket, FifoBuffer* buffer); - void Destroy(); - - static const int kBufferSize = 4096; - scoped_ptr int_socket_; - scoped_ptr ext_socket_; - bool connected_; - FifoBuffer out_buffer_; - FifoBuffer in_buffer_; - RTC_DISALLOW_COPY_AND_ASSIGN(ProxyBinding); -}; - -class ProxyServer : public sigslot::has_slots<> { - public: - ProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr, - SocketFactory* ext_factory, const SocketAddress& ext_ip); - ~ProxyServer() override; - - // Returns the address to which the proxy server is bound - SocketAddress GetServerAddress(); - - protected: - void OnAcceptEvent(AsyncSocket* socket); - virtual AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) = 0; - void OnBindingDestroyed(ProxyBinding* binding); - - private: - typedef std::list BindingList; - SocketFactory* ext_factory_; - SocketAddress ext_ip_; - scoped_ptr server_socket_; - BindingList bindings_; - RTC_DISALLOW_COPY_AND_ASSIGN(ProxyServer); -}; - -// SocksProxyServer is a simple extension of ProxyServer to implement SOCKS. -class SocksProxyServer : public ProxyServer { - public: - SocksProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr, - SocketFactory* ext_factory, const SocketAddress& ext_ip) - : ProxyServer(int_factory, int_addr, ext_factory, ext_ip) { - } - protected: - AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) override; - RTC_DISALLOW_COPY_AND_ASSIGN(SocksProxyServer); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_PROXYSERVER_H_ diff --git a/include/webrtc/base/random.h b/include/webrtc/base/random.h deleted file mode 100644 index 647b84c..0000000 --- a/include/webrtc/base/random.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_RANDOM_H_ -#define WEBRTC_BASE_RANDOM_H_ - -#include - -#include "webrtc/typedefs.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/checks.h" - -namespace webrtc { - -class Random { - public: - explicit Random(uint64_t seed); - - // Return pseudo-random integer of the specified type. - // We need to limit the size to 32 bits to keep the output close to uniform. - template - T Rand() { - static_assert(std::numeric_limits::is_integer && - std::numeric_limits::radix == 2 && - std::numeric_limits::digits <= 32, - "Rand is only supported for built-in integer types that are " - "32 bits or smaller."); - return static_cast(NextOutput()); - } - - // Uniformly distributed pseudo-random number in the interval [0, t]. - uint32_t Rand(uint32_t t); - - // Uniformly distributed pseudo-random number in the interval [low, high]. - uint32_t Rand(uint32_t low, uint32_t high); - - // Uniformly distributed pseudo-random number in the interval [low, high]. - int32_t Rand(int32_t low, int32_t high); - - // Normal Distribution. - double Gaussian(double mean, double standard_deviation); - - // Exponential Distribution. - double Exponential(double lambda); - - private: - // Outputs a nonzero 64-bit random number. - uint64_t NextOutput() { - state_ ^= state_ >> 12; - state_ ^= state_ << 25; - state_ ^= state_ >> 27; - RTC_DCHECK(state_ != 0x0ULL); - return state_ * 2685821657736338717ull; - } - - uint64_t state_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Random); -}; - -// Return pseudo-random number in the interval [0.0, 1.0). -template <> -float Random::Rand(); - -// Return pseudo-random number in the interval [0.0, 1.0). -template <> -double Random::Rand(); - -// Return pseudo-random boolean value. -template <> -bool Random::Rand(); - -} // namespace webrtc - -#endif // WEBRTC_BASE_RANDOM_H_ diff --git a/include/webrtc/base/ratelimiter.h b/include/webrtc/base/ratelimiter.h deleted file mode 100644 index cf5d6b0..0000000 --- a/include/webrtc/base/ratelimiter.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_RATELIMITER_H_ -#define WEBRTC_BASE_RATELIMITER_H_ - -#include -#include "webrtc/base/basictypes.h" - -namespace rtc { - -// Limits the rate of use to a certain maximum quantity per period of -// time. Use, for example, for simple bandwidth throttling. -// -// It's implemented like a diet plan: You have so many calories per -// day. If you hit the limit, you can't eat any more until the next -// day. -class RateLimiter { - public: - // For example, 100kb per second. - RateLimiter(size_t max, double period) - : max_per_period_(max), - period_length_(period), - used_in_period_(0), - period_start_(0.0), - period_end_(period) { - } - virtual ~RateLimiter() {} - - // Returns true if if the desired quantity is available in the - // current period (< (max - used)). Once the given time passes the - // end of the period, used is set to zero and more use is available. - bool CanUse(size_t desired, double time); - // Increment the quantity used this period. If past the end of a - // period, a new period is started. - void Use(size_t used, double time); - - size_t used_in_period() const { - return used_in_period_; - } - - size_t max_per_period() const { - return max_per_period_; - } - - private: - size_t max_per_period_; - double period_length_; - size_t used_in_period_; - double period_start_; - double period_end_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_RATELIMITER_H_ diff --git a/include/webrtc/base/ratetracker.h b/include/webrtc/base/ratetracker.h deleted file mode 100644 index d49d7ca..0000000 --- a/include/webrtc/base/ratetracker.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_RATETRACKER_H_ -#define WEBRTC_BASE_RATETRACKER_H_ - -#include -#include "webrtc/base/basictypes.h" - -namespace rtc { - -// Computes units per second over a given interval by tracking the units over -// each bucket of a given size and calculating the instantaneous rate assuming -// that over each bucket the rate was constant. -class RateTracker { - public: - RateTracker(uint32_t bucket_milliseconds, size_t bucket_count); - virtual ~RateTracker(); - - // Computes the average rate over the most recent interval_milliseconds, - // or if the first sample was added within this period, computes the rate - // since the first sample was added. - double ComputeRateForInterval(uint32_t interval_milliseconds) const; - - // Computes the average rate over the rate tracker's recording interval - // of bucket_milliseconds * bucket_count. - double ComputeRate() const { - return ComputeRateForInterval(bucket_milliseconds_ * - static_cast(bucket_count_)); - } - - // Computes the average rate since the first sample was added to the - // rate tracker. - double ComputeTotalRate() const; - - // The total number of samples added. - size_t TotalSampleCount() const; - - // Reads the current time in order to determine the appropriate bucket for - // these samples, and increments the count for that bucket by sample_count. - void AddSamples(size_t sample_count); - - protected: - // overrideable for tests - virtual uint32_t Time() const; - - private: - void EnsureInitialized(); - size_t NextBucketIndex(size_t bucket_index) const; - - const uint32_t bucket_milliseconds_; - const size_t bucket_count_; - size_t* sample_buckets_; - size_t total_sample_count_; - size_t current_bucket_; - uint32_t bucket_start_time_milliseconds_; - uint32_t initialization_time_milliseconds_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_RATETRACKER_H_ diff --git a/include/webrtc/base/refcount.h b/include/webrtc/base/refcount.h deleted file mode 100644 index 55ce23a..0000000 --- a/include/webrtc/base/refcount.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_REFCOUNT_H_ -#define WEBRTC_BASE_REFCOUNT_H_ - -#include - -#include "webrtc/base/atomicops.h" - -namespace rtc { - -// Reference count interface. -class RefCountInterface { - public: - virtual int AddRef() const = 0; - virtual int Release() const = 0; - protected: - virtual ~RefCountInterface() {} -}; - -template -class RefCountedObject : public T { - public: - RefCountedObject() : ref_count_(0) { - } - - template - explicit RefCountedObject(P p) : T(p), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2) : T(p1, p2), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2, P3 p3) : T(p1, p2, p3), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4) - : T(p1, p2, p3, p4), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) - : T(p1, p2, p3, p4, p5), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) - : T(p1, p2, p3, p4, p5, p6), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) - : T(p1, p2, p3, p4, p5, p6, p7), ref_count_(0) { - } - - template - RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) - : T(p1, p2, p3, p4, p5, p6, p7, p8), ref_count_(0) { - } - - template - RefCountedObject( - P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) - : T(p1, p2, p3, p4, p5, p6, p7, p8, p9), ref_count_(0) { - } - - template - RefCountedObject( - P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) - : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), ref_count_(0) { - } - - template - RefCountedObject( - P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, - P11 p11) - : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), ref_count_(0) { - } - - virtual int AddRef() const { - return AtomicOps::Increment(&ref_count_); - } - - virtual int Release() const { - int count = AtomicOps::Decrement(&ref_count_); - if (!count) { - delete this; - } - return count; - } - - // Return whether the reference count is one. If the reference count is used - // in the conventional way, a reference count of 1 implies that the current - // thread owns the reference and no other thread shares it. This call - // performs the test for a reference count of one, and performs the memory - // barrier needed for the owning thread to act on the object, knowing that it - // has exclusive access to the object. - virtual bool HasOneRef() const { - return AtomicOps::AcquireLoad(&ref_count_) == 1; - } - - protected: - virtual ~RefCountedObject() { - } - - mutable volatile int ref_count_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_REFCOUNT_H_ diff --git a/include/webrtc/base/referencecountedsingletonfactory.h b/include/webrtc/base/referencecountedsingletonfactory.h deleted file mode 100644 index f955986..0000000 --- a/include/webrtc/base/referencecountedsingletonfactory.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_REFERENCECOUNTEDSINGLETONFACTORY_H_ -#define WEBRTC_BASE_REFERENCECOUNTEDSINGLETONFACTORY_H_ - -#include "webrtc/base/common.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -template class rcsf_ptr; - -// A ReferenceCountedSingletonFactory is an object which owns another object, -// and doles out the owned object to consumers in a reference-counted manner. -// Thus, the factory owns at most one object of the desired kind, and -// hands consumers a special pointer to it, through which they can access it. -// When the consumers delete the pointer, the reference count goes down, -// and if the reference count hits zero, the factory can throw the object -// away. If a consumer requests the pointer and the factory has none, -// it can create one on the fly and pass it back. -template -class ReferenceCountedSingletonFactory { - friend class rcsf_ptr; - public: - ReferenceCountedSingletonFactory() : ref_count_(0) {} - - virtual ~ReferenceCountedSingletonFactory() { - ASSERT(ref_count_ == 0); - } - - protected: - // Must be implemented in a sub-class. The sub-class may choose whether or not - // to cache the instance across lifetimes by either reset()'ing or not - // reset()'ing the scoped_ptr in CleanupInstance(). - virtual bool SetupInstance() = 0; - virtual void CleanupInstance() = 0; - - scoped_ptr instance_; - - private: - Interface* GetInstance() { - rtc::CritScope cs(&crit_); - if (ref_count_ == 0) { - if (!SetupInstance()) { - LOG(LS_VERBOSE) << "Failed to setup instance"; - return NULL; - } - ASSERT(instance_.get() != NULL); - } - ++ref_count_; - - LOG(LS_VERBOSE) << "Number of references: " << ref_count_; - return instance_.get(); - } - - void ReleaseInstance() { - rtc::CritScope cs(&crit_); - ASSERT(ref_count_ > 0); - ASSERT(instance_.get() != NULL); - --ref_count_; - LOG(LS_VERBOSE) << "Number of references: " << ref_count_; - if (ref_count_ == 0) { - CleanupInstance(); - } - } - - CriticalSection crit_; - int ref_count_; - - RTC_DISALLOW_COPY_AND_ASSIGN(ReferenceCountedSingletonFactory); -}; - -template -class rcsf_ptr { - public: - // Create a pointer that uses the factory to get the instance. - // This is lazy - it won't generate the instance until it is requested. - explicit rcsf_ptr(ReferenceCountedSingletonFactory* factory) - : instance_(NULL), - factory_(factory) { - } - - ~rcsf_ptr() { - release(); - } - - Interface& operator*() { - EnsureAcquired(); - return *instance_; - } - - Interface* operator->() { - EnsureAcquired(); - return instance_; - } - - // Gets the pointer, creating the singleton if necessary. May return NULL if - // creation failed. - Interface* get() { - Acquire(); - return instance_; - } - - // Set instance to NULL and tell the factory we aren't using the instance - // anymore. - void release() { - if (instance_) { - instance_ = NULL; - factory_->ReleaseInstance(); - } - } - - // Lets us know whether instance is valid or not right now. - // Even though attempts to use the instance will automatically create it, it - // is advisable to check this because creation can fail. - bool valid() const { - return instance_ != NULL; - } - - // Returns the factory that this pointer is using. - ReferenceCountedSingletonFactory* factory() const { - return factory_; - } - - private: - void EnsureAcquired() { - Acquire(); - ASSERT(instance_ != NULL); - } - - void Acquire() { - // Since we're getting a singleton back, acquire is a noop if instance is - // already populated. - if (!instance_) { - instance_ = factory_->GetInstance(); - } - } - - Interface* instance_; - ReferenceCountedSingletonFactory* factory_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(rcsf_ptr); -}; - -}; // namespace rtc - -#endif // WEBRTC_BASE_REFERENCECOUNTEDSINGLETONFACTORY_H_ diff --git a/include/webrtc/base/rollingaccumulator.h b/include/webrtc/base/rollingaccumulator.h deleted file mode 100644 index e105380..0000000 --- a/include/webrtc/base/rollingaccumulator.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ROLLINGACCUMULATOR_H_ -#define WEBRTC_BASE_ROLLINGACCUMULATOR_H_ - -#include -#include - -#include "webrtc/base/common.h" - -namespace rtc { - -// RollingAccumulator stores and reports statistics -// over N most recent samples. -// -// T is assumed to be an int, long, double or float. -template -class RollingAccumulator { - public: - explicit RollingAccumulator(size_t max_count) - : samples_(max_count) { - Reset(); - } - ~RollingAccumulator() { - } - - size_t max_count() const { - return samples_.size(); - } - - size_t count() const { - return count_; - } - - void Reset() { - count_ = 0U; - next_index_ = 0U; - sum_ = 0.0; - sum_2_ = 0.0; - max_ = T(); - max_stale_ = false; - min_ = T(); - min_stale_ = false; - } - - void AddSample(T sample) { - if (count_ == max_count()) { - // Remove oldest sample. - T sample_to_remove = samples_[next_index_]; - sum_ -= sample_to_remove; - sum_2_ -= sample_to_remove * sample_to_remove; - if (sample_to_remove >= max_) { - max_stale_ = true; - } - if (sample_to_remove <= min_) { - min_stale_ = true; - } - } else { - // Increase count of samples. - ++count_; - } - // Add new sample. - samples_[next_index_] = sample; - sum_ += sample; - sum_2_ += sample * sample; - if (count_ == 1 || sample >= max_) { - max_ = sample; - max_stale_ = false; - } - if (count_ == 1 || sample <= min_) { - min_ = sample; - min_stale_ = false; - } - // Update next_index_. - next_index_ = (next_index_ + 1) % max_count(); - } - - T ComputeSum() const { - return static_cast(sum_); - } - - double ComputeMean() const { - if (count_ == 0) { - return 0.0; - } - return sum_ / count_; - } - - T ComputeMax() const { - if (max_stale_) { - ASSERT(count_ > 0 && - "It shouldn't be possible for max_stale_ && count_ == 0"); - max_ = samples_[next_index_]; - for (size_t i = 1u; i < count_; i++) { - max_ = std::max(max_, samples_[(next_index_ + i) % max_count()]); - } - max_stale_ = false; - } - return max_; - } - - T ComputeMin() const { - if (min_stale_) { - ASSERT(count_ > 0 && - "It shouldn't be possible for min_stale_ && count_ == 0"); - min_ = samples_[next_index_]; - for (size_t i = 1u; i < count_; i++) { - min_ = std::min(min_, samples_[(next_index_ + i) % max_count()]); - } - min_stale_ = false; - } - return min_; - } - - // O(n) time complexity. - // Weights nth sample with weight (learning_rate)^n. Learning_rate should be - // between (0.0, 1.0], otherwise the non-weighted mean is returned. - double ComputeWeightedMean(double learning_rate) const { - if (count_ < 1 || learning_rate <= 0.0 || learning_rate >= 1.0) { - return ComputeMean(); - } - double weighted_mean = 0.0; - double current_weight = 1.0; - double weight_sum = 0.0; - const size_t max_size = max_count(); - for (size_t i = 0; i < count_; ++i) { - current_weight *= learning_rate; - weight_sum += current_weight; - // Add max_size to prevent underflow. - size_t index = (next_index_ + max_size - i - 1) % max_size; - weighted_mean += current_weight * samples_[index]; - } - return weighted_mean / weight_sum; - } - - // Compute estimated variance. Estimation is more accurate - // as the number of samples grows. - double ComputeVariance() const { - if (count_ == 0) { - return 0.0; - } - // Var = E[x^2] - (E[x])^2 - double count_inv = 1.0 / count_; - double mean_2 = sum_2_ * count_inv; - double mean = sum_ * count_inv; - return mean_2 - (mean * mean); - } - - private: - size_t count_; - size_t next_index_; - double sum_; // Sum(x) - double to avoid overflow - double sum_2_; // Sum(x*x) - double to avoid overflow - mutable T max_; - mutable bool max_stale_; - mutable T min_; - mutable bool min_stale_; - std::vector samples_; - - RTC_DISALLOW_COPY_AND_ASSIGN(RollingAccumulator); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ROLLINGACCUMULATOR_H_ diff --git a/include/webrtc/base/rtccertificate.h b/include/webrtc/base/rtccertificate.h deleted file mode 100644 index 600739b..0000000 --- a/include/webrtc/base/rtccertificate.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_RTCCERTIFICATE_H_ -#define WEBRTC_BASE_RTCCERTIFICATE_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/base/sslidentity.h" - -namespace rtc { - -// A thin abstraction layer between "lower level crypto stuff" like -// SSLCertificate and WebRTC usage. Takes ownership of some lower level objects, -// reference counting protects these from premature destruction. -class RTCCertificate : public RefCountInterface { - public: - // Takes ownership of |identity|. - static scoped_refptr Create(scoped_ptr identity); - - // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z. - uint64_t Expires() const; - // Checks if the certificate has expired, where |now| is expressed in ms - // relative to epoch, 1970-01-01T00:00:00Z. - bool HasExpired(uint64_t now) const; - const SSLCertificate& ssl_certificate() const; - - // TODO(hbos): If possible, remove once RTCCertificate and its - // ssl_certificate() is used in all relevant places. Should not pass around - // raw SSLIdentity* for the sake of accessing SSLIdentity::certificate(). - // However, some places might need SSLIdentity* for its public/private key... - SSLIdentity* identity() const { return identity_.get(); } - - protected: - explicit RTCCertificate(SSLIdentity* identity); - ~RTCCertificate() override; - - private: - // The SSLIdentity is the owner of the SSLCertificate. To protect our - // ssl_certificate() we take ownership of |identity_|. - scoped_ptr identity_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_RTCCERTIFICATE_H_ diff --git a/include/webrtc/base/safe_conversions.h b/include/webrtc/base/safe_conversions.h deleted file mode 100644 index 51239bc..0000000 --- a/include/webrtc/base/safe_conversions.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/numerics/safe_conversions.h. - -#ifndef WEBRTC_BASE_SAFE_CONVERSIONS_H_ -#define WEBRTC_BASE_SAFE_CONVERSIONS_H_ - -#include - -#include "webrtc/base/checks.h" -#include "webrtc/base/safe_conversions_impl.h" - -namespace rtc { - -// Convenience function that returns true if the supplied value is in range -// for the destination type. -template -inline bool IsValueInRangeForNumericType(Src value) { - return internal::RangeCheck(value) == internal::TYPE_VALID; -} - -// checked_cast<> is analogous to static_cast<> for numeric types, -// except that it CHECKs that the specified numeric conversion will not -// overflow or underflow. NaN source will always trigger a CHECK. -template -inline Dst checked_cast(Src value) { - RTC_CHECK(IsValueInRangeForNumericType(value)); - return static_cast(value); -} - -// saturated_cast<> is analogous to static_cast<> for numeric types, except -// that the specified numeric conversion will saturate rather than overflow or -// underflow. NaN assignment to an integral will trigger a RTC_CHECK condition. -template -inline Dst saturated_cast(Src value) { - // Optimization for floating point values, which already saturate. - if (std::numeric_limits::is_iec559) - return static_cast(value); - - switch (internal::RangeCheck(value)) { - case internal::TYPE_VALID: - return static_cast(value); - - case internal::TYPE_UNDERFLOW: - return std::numeric_limits::min(); - - case internal::TYPE_OVERFLOW: - return std::numeric_limits::max(); - - // Should fail only on attempting to assign NaN to a saturated integer. - case internal::TYPE_INVALID: - FATAL(); - return std::numeric_limits::max(); - } - - FATAL(); - return static_cast(value); -} - -} // namespace rtc - -#endif // WEBRTC_BASE_SAFE_CONVERSIONS_H_ diff --git a/include/webrtc/base/safe_conversions_impl.h b/include/webrtc/base/safe_conversions_impl.h deleted file mode 100644 index 52e52ef..0000000 --- a/include/webrtc/base/safe_conversions_impl.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/numerics/safe_conversions_impl.h. - -#ifndef WEBRTC_BASE_SAFE_CONVERSIONS_IMPL_H_ -#define WEBRTC_BASE_SAFE_CONVERSIONS_IMPL_H_ - -#include - -namespace rtc { -namespace internal { - -enum DstSign { - DST_UNSIGNED, - DST_SIGNED -}; - -enum SrcSign { - SRC_UNSIGNED, - SRC_SIGNED -}; - -enum DstRange { - OVERLAPS_RANGE, - CONTAINS_RANGE -}; - -// Helper templates to statically determine if our destination type can contain -// all values represented by the source type. - -template ::is_signed ? - DST_SIGNED : DST_UNSIGNED, - SrcSign IsSrcSigned = std::numeric_limits::is_signed ? - SRC_SIGNED : SRC_UNSIGNED> -struct StaticRangeCheck {}; - -template -struct StaticRangeCheck { - typedef std::numeric_limits DstLimits; - typedef std::numeric_limits SrcLimits; - // Compare based on max_exponent, which we must compute for integrals. - static const size_t kDstMaxExponent = DstLimits::is_iec559 ? - DstLimits::max_exponent : - (sizeof(Dst) * 8 - 1); - static const size_t kSrcMaxExponent = SrcLimits::is_iec559 ? - SrcLimits::max_exponent : - (sizeof(Src) * 8 - 1); - static const DstRange value = kDstMaxExponent >= kSrcMaxExponent ? - CONTAINS_RANGE : OVERLAPS_RANGE; -}; - -template -struct StaticRangeCheck { - static const DstRange value = sizeof(Dst) >= sizeof(Src) ? - CONTAINS_RANGE : OVERLAPS_RANGE; -}; - -template -struct StaticRangeCheck { - typedef std::numeric_limits DstLimits; - typedef std::numeric_limits SrcLimits; - // Compare based on max_exponent, which we must compute for integrals. - static const size_t kDstMaxExponent = DstLimits::is_iec559 ? - DstLimits::max_exponent : - (sizeof(Dst) * 8 - 1); - static const size_t kSrcMaxExponent = sizeof(Src) * 8; - static const DstRange value = kDstMaxExponent >= kSrcMaxExponent ? - CONTAINS_RANGE : OVERLAPS_RANGE; -}; - -template -struct StaticRangeCheck { - static const DstRange value = OVERLAPS_RANGE; -}; - - -enum RangeCheckResult { - TYPE_VALID = 0, // Value can be represented by the destination type. - TYPE_UNDERFLOW = 1, // Value would overflow. - TYPE_OVERFLOW = 2, // Value would underflow. - TYPE_INVALID = 3 // Source value is invalid (i.e. NaN). -}; - -// This macro creates a RangeCheckResult from an upper and lower bound -// check by taking advantage of the fact that only NaN can be out of range in -// both directions at once. -#define BASE_NUMERIC_RANGE_CHECK_RESULT(is_in_upper_bound, is_in_lower_bound) \ - RangeCheckResult(((is_in_upper_bound) ? 0 : TYPE_OVERFLOW) | \ - ((is_in_lower_bound) ? 0 : TYPE_UNDERFLOW)) - -template ::is_signed ? - DST_SIGNED : DST_UNSIGNED, - SrcSign IsSrcSigned = std::numeric_limits::is_signed ? - SRC_SIGNED : SRC_UNSIGNED, - DstRange IsSrcRangeContained = StaticRangeCheck::value> -struct RangeCheckImpl {}; - -// The following templates are for ranges that must be verified at runtime. We -// split it into checks based on signedness to avoid confusing casts and -// compiler warnings on signed an unsigned comparisons. - -// Dst range always contains the result: nothing to check. -template -struct RangeCheckImpl { - static RangeCheckResult Check(Src value) { - return TYPE_VALID; - } -}; - -// Signed to signed narrowing. -template -struct RangeCheckImpl { - static RangeCheckResult Check(Src value) { - typedef std::numeric_limits DstLimits; - return DstLimits::is_iec559 ? - BASE_NUMERIC_RANGE_CHECK_RESULT( - value <= static_cast(DstLimits::max()), - value >= static_cast(DstLimits::max() * -1)) : - BASE_NUMERIC_RANGE_CHECK_RESULT( - value <= static_cast(DstLimits::max()), - value >= static_cast(DstLimits::min())); - } -}; - -// Unsigned to unsigned narrowing. -template -struct RangeCheckImpl { - static RangeCheckResult Check(Src value) { - typedef std::numeric_limits DstLimits; - return BASE_NUMERIC_RANGE_CHECK_RESULT( - value <= static_cast(DstLimits::max()), true); - } -}; - -// Unsigned to signed. -template -struct RangeCheckImpl { - static RangeCheckResult Check(Src value) { - typedef std::numeric_limits DstLimits; - return sizeof(Dst) > sizeof(Src) ? TYPE_VALID : - BASE_NUMERIC_RANGE_CHECK_RESULT( - value <= static_cast(DstLimits::max()), true); - } -}; - -// Signed to unsigned. -template -struct RangeCheckImpl { - static RangeCheckResult Check(Src value) { - typedef std::numeric_limits DstLimits; - typedef std::numeric_limits SrcLimits; - // Compare based on max_exponent, which we must compute for integrals. - static const size_t kDstMaxExponent = sizeof(Dst) * 8; - static const size_t kSrcMaxExponent = SrcLimits::is_iec559 ? - SrcLimits::max_exponent : - (sizeof(Src) * 8 - 1); - return (kDstMaxExponent >= kSrcMaxExponent) ? - BASE_NUMERIC_RANGE_CHECK_RESULT(true, value >= static_cast(0)) : - BASE_NUMERIC_RANGE_CHECK_RESULT( - value <= static_cast(DstLimits::max()), - value >= static_cast(0)); - } -}; - -template -inline RangeCheckResult RangeCheck(Src value) { - static_assert(std::numeric_limits::is_specialized, - "argument must be numeric"); - static_assert(std::numeric_limits::is_specialized, - "result must be numeric"); - return RangeCheckImpl::Check(value); -} - -} // namespace internal -} // namespace rtc - -#endif // WEBRTC_BASE_SAFE_CONVERSIONS_IMPL_H_ diff --git a/include/webrtc/base/scoped_autorelease_pool.h b/include/webrtc/base/scoped_autorelease_pool.h deleted file mode 100644 index 9aac112..0000000 --- a/include/webrtc/base/scoped_autorelease_pool.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Automatically initialize and and free an autoreleasepool. Never allocate -// an instance of this class using "new" - that will result in a compile-time -// error. Only use it as a stack object. -// -// Note: NSAutoreleasePool docs say that you should not normally need to -// declare an NSAutoreleasePool as a member of an object - but there's nothing -// that indicates it will be a problem, as long as the stack lifetime of the -// pool exactly matches the stack lifetime of the object. - -#ifndef WEBRTC_BASE_SCOPED_AUTORELEASE_POOL_H__ -#define WEBRTC_BASE_SCOPED_AUTORELEASE_POOL_H__ - -#if defined(WEBRTC_MAC) - -#include "webrtc/base/common.h" - -// This header may be included from Obj-C files or C++ files. -#ifdef __OBJC__ -@class NSAutoreleasePool; -#else -class NSAutoreleasePool; -#endif - -namespace rtc { - -class ScopedAutoreleasePool { - public: - ScopedAutoreleasePool(); - ~ScopedAutoreleasePool(); - - private: - // Declaring private overrides of new and delete here enforces the "only use - // as a stack object" discipline. - // - // Note: new is declared as "throw()" to get around a gcc warning about new - // returning NULL, but this method will never get called and therefore will - // never actually throw any exception. - void* operator new(size_t size) throw() { return NULL; } - void operator delete (void* ptr) {} - - NSAutoreleasePool* pool_; - - RTC_DISALLOW_COPY_AND_ASSIGN(ScopedAutoreleasePool); -}; - -} // namespace rtc - -#endif // WEBRTC_MAC -#endif // WEBRTC_BASE_SCOPED_AUTORELEASE_POOL_H__ diff --git a/include/webrtc/base/scoped_ptr.h b/include/webrtc/base/scoped_ptr.h deleted file mode 100644 index db615f3..0000000 --- a/include/webrtc/base/scoped_ptr.h +++ /dev/null @@ -1,621 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/memory/scoped_ptr.h. - -// Scopers help you manage ownership of a pointer, helping you easily manage a -// pointer within a scope, and automatically destroying the pointer at the end -// of a scope. There are two main classes you will use, which correspond to the -// operators new/delete and new[]/delete[]. -// -// Example usage (scoped_ptr): -// { -// scoped_ptr foo(new Foo("wee")); -// } // foo goes out of scope, releasing the pointer with it. -// -// { -// scoped_ptr foo; // No pointer managed. -// foo.reset(new Foo("wee")); // Now a pointer is managed. -// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed. -// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed. -// foo->Method(); // Foo::Method() called. -// foo.get()->Method(); // Foo::Method() called. -// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer -// // manages a pointer. -// foo.reset(new Foo("wee4")); // foo manages a pointer again. -// foo.reset(); // Foo("wee4") destroyed, foo no longer -// // manages a pointer. -// } // foo wasn't managing a pointer, so nothing was destroyed. -// -// Example usage (scoped_ptr): -// { -// scoped_ptr foo(new Foo[100]); -// foo.get()->Method(); // Foo::Method on the 0th element. -// foo[10].Method(); // Foo::Method on the 10th element. -// } -// -// These scopers also implement part of the functionality of C++11 unique_ptr -// in that they are "movable but not copyable." You can use the scopers in the -// parameter and return types of functions to signify ownership transfer in to -// and out of a function. When calling a function that has a scoper as the -// argument type, it must be called with the result of calling std::move on an -// analogous scoper, or another function that generates a temporary; passing by -// copy will NOT work. Here is an example using scoped_ptr: -// -// void TakesOwnership(scoped_ptr arg) { -// // Do something with arg -// } -// scoped_ptr CreateFoo() { -// // No need for calling std::move because we are constructing a temporary -// // for the return value. -// return scoped_ptr(new Foo("new")); -// } -// scoped_ptr PassThru(scoped_ptr arg) { -// return std::move(arg); -// } -// -// { -// scoped_ptr ptr(new Foo("yay")); // ptr manages Foo("yay"). -// TakesOwnership(std::move(ptr)); // ptr no longer owns Foo("yay"). -// scoped_ptr ptr2 = CreateFoo(); // ptr2 owns the return Foo. -// scoped_ptr ptr3 = // ptr3 now owns what was in ptr2. -// PassThru(std::move(ptr2)); // ptr2 is correspondingly nullptr. -// } -// -// Notice that if you do not call std::move when returning from PassThru(), or -// when invoking TakesOwnership(), the code will not compile because scopers -// are not copyable; they only implement move semantics which require calling -// std::move to signify a destructive transfer of state. CreateFoo() is -// different though because we are constructing a temporary on the return line -// and thus can avoid needing to call std::move. - -#ifndef WEBRTC_BASE_SCOPED_PTR_H__ -#define WEBRTC_BASE_SCOPED_PTR_H__ - -// This is an implementation designed to match the anticipated future TR2 -// implementation of the scoped_ptr class. - -#include -#include -#include - -#include // For std::swap(). -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/template_util.h" -#include "webrtc/typedefs.h" - -namespace rtc { - -// Function object which deletes its parameter, which must be a pointer. -// If C is an array type, invokes 'delete[]' on the parameter; otherwise, -// invokes 'delete'. The default deleter for scoped_ptr. -template -struct DefaultDeleter { - DefaultDeleter() {} - template DefaultDeleter(const DefaultDeleter& other) { - // IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor - // if U* is implicitly convertible to T* and U is not an array type. - // - // Correct implementation should use SFINAE to disable this - // constructor. However, since there are no other 1-argument constructors, - // using a static_assert based on is_convertible<> and requiring - // complete types is simpler and will cause compile failures for equivalent - // misuses. - // - // Note, the is_convertible check also ensures that U is not an - // array. T is guaranteed to be a non-array, so any U* where U is an array - // cannot convert to T*. - enum { T_must_be_complete = sizeof(T) }; - enum { U_must_be_complete = sizeof(U) }; - static_assert(rtc::is_convertible::value, - "U* must implicitly convert to T*"); - } - inline void operator()(T* ptr) const { - enum { type_must_be_complete = sizeof(T) }; - delete ptr; - } -}; - -// Specialization of DefaultDeleter for array types. -template -struct DefaultDeleter { - inline void operator()(T* ptr) const { - enum { type_must_be_complete = sizeof(T) }; - delete[] ptr; - } - - private: - // Disable this operator for any U != T because it is undefined to execute - // an array delete when the static type of the array mismatches the dynamic - // type. - // - // References: - // C++98 [expr.delete]p3 - // http://cplusplus.github.com/LWG/lwg-defects.html#938 - template void operator()(U* array) const; -}; - -template -struct DefaultDeleter { - // Never allow someone to declare something like scoped_ptr. - static_assert(sizeof(T) == -1, "do not use array with size as type"); -}; - -// Function object which invokes 'free' on its parameter, which must be -// a pointer. Can be used to store malloc-allocated pointers in scoped_ptr: -// -// scoped_ptr foo_ptr( -// static_cast(malloc(sizeof(int)))); -struct FreeDeleter { - inline void operator()(void* ptr) const { - free(ptr); - } -}; - -namespace internal { - -template -struct ShouldAbortOnSelfReset { - template - static rtc::internal::NoType Test(const typename U::AllowSelfReset*); - - template - static rtc::internal::YesType Test(...); - - static const bool value = - sizeof(Test(0)) == sizeof(rtc::internal::YesType); -}; - -// Minimal implementation of the core logic of scoped_ptr, suitable for -// reuse in both scoped_ptr and its specializations. -template -class scoped_ptr_impl { - public: - explicit scoped_ptr_impl(T* p) : data_(p) {} - - // Initializer for deleters that have data parameters. - scoped_ptr_impl(T* p, const D& d) : data_(p, d) {} - - // Templated constructor that destructively takes the value from another - // scoped_ptr_impl. - template - scoped_ptr_impl(scoped_ptr_impl* other) - : data_(other->release(), other->get_deleter()) { - // We do not support move-only deleters. We could modify our move - // emulation to have rtc::subtle::move() and rtc::subtle::forward() - // functions that are imperfect emulations of their C++11 equivalents, - // but until there's a requirement, just assume deleters are copyable. - } - - template - void TakeState(scoped_ptr_impl* other) { - // See comment in templated constructor above regarding lack of support - // for move-only deleters. - reset(other->release()); - get_deleter() = other->get_deleter(); - } - - ~scoped_ptr_impl() { - if (data_.ptr != nullptr) { - // Not using get_deleter() saves one function call in non-optimized - // builds. - static_cast(data_)(data_.ptr); - } - } - - void reset(T* p) { - // This is a self-reset, which is no longer allowed for default deleters: - // https://crbug.com/162971 - assert(!ShouldAbortOnSelfReset::value || p == nullptr || p != data_.ptr); - - // Note that running data_.ptr = p can lead to undefined behavior if - // get_deleter()(get()) deletes this. In order to prevent this, reset() - // should update the stored pointer before deleting its old value. - // - // However, changing reset() to use that behavior may cause current code to - // break in unexpected ways. If the destruction of the owned object - // dereferences the scoped_ptr when it is destroyed by a call to reset(), - // then it will incorrectly dispatch calls to |p| rather than the original - // value of |data_.ptr|. - // - // During the transition period, set the stored pointer to nullptr while - // deleting the object. Eventually, this safety check will be removed to - // prevent the scenario initially described from occurring and - // http://crbug.com/176091 can be closed. - T* old = data_.ptr; - data_.ptr = nullptr; - if (old != nullptr) - static_cast(data_)(old); - data_.ptr = p; - } - - T* get() const { return data_.ptr; } - - D& get_deleter() { return data_; } - const D& get_deleter() const { return data_; } - - void swap(scoped_ptr_impl& p2) { - // Standard swap idiom: 'using std::swap' ensures that std::swap is - // present in the overload set, but we call swap unqualified so that - // any more-specific overloads can be used, if available. - using std::swap; - swap(static_cast(data_), static_cast(p2.data_)); - swap(data_.ptr, p2.data_.ptr); - } - - T* release() { - T* old_ptr = data_.ptr; - data_.ptr = nullptr; - return old_ptr; - } - - T** accept() { - reset(nullptr); - return &(data_.ptr); - } - - T** use() { - return &(data_.ptr); - } - - private: - // Needed to allow type-converting constructor. - template friend class scoped_ptr_impl; - - // Use the empty base class optimization to allow us to have a D - // member, while avoiding any space overhead for it when D is an - // empty class. See e.g. http://www.cantrip.org/emptyopt.html for a good - // discussion of this technique. - struct Data : public D { - explicit Data(T* ptr_in) : ptr(ptr_in) {} - Data(T* ptr_in, const D& other) : D(other), ptr(ptr_in) {} - T* ptr; - }; - - Data data_; - - RTC_DISALLOW_COPY_AND_ASSIGN(scoped_ptr_impl); -}; - -} // namespace internal - -// A scoped_ptr is like a T*, except that the destructor of scoped_ptr -// automatically deletes the pointer it holds (if any). -// That is, scoped_ptr owns the T object that it points to. -// Like a T*, a scoped_ptr may hold either nullptr or a pointer to a T -// object. Also like T*, scoped_ptr is thread-compatible, and once you -// dereference it, you get the thread safety guarantees of T. -// -// The size of scoped_ptr is small. On most compilers, when using the -// DefaultDeleter, sizeof(scoped_ptr) == sizeof(T*). Custom deleters will -// increase the size proportional to whatever state they need to have. See -// comments inside scoped_ptr_impl<> for details. -// -// Current implementation targets having a strict subset of C++11's -// unique_ptr<> features. Known deficiencies include not supporting move-only -// deleters, function pointers as deleters, and deleters with reference -// types. -template > -class scoped_ptr { - - // TODO(ajm): If we ever import RefCountedBase, this check needs to be - // enabled. - //static_assert(rtc::internal::IsNotRefCounted::value, - // "T is refcounted type and needs scoped refptr"); - - public: - // The element and deleter types. - typedef T element_type; - typedef D deleter_type; - - // Constructor. Defaults to initializing with nullptr. - scoped_ptr() : impl_(nullptr) {} - - // Constructor. Takes ownership of p. - explicit scoped_ptr(element_type* p) : impl_(p) {} - - // Constructor. Allows initialization of a stateful deleter. - scoped_ptr(element_type* p, const D& d) : impl_(p, d) {} - - // Constructor. Allows construction from a nullptr. - scoped_ptr(std::nullptr_t) : impl_(nullptr) {} - - // Constructor. Allows construction from a scoped_ptr rvalue for a - // convertible type and deleter. - // - // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this constructor distinct - // from the normal move constructor. By C++11 20.7.1.2.1.21, this constructor - // has different post-conditions if D is a reference type. Since this - // implementation does not support deleters with reference type, - // we do not need a separate move constructor allowing us to avoid one - // use of SFINAE. You only need to care about this if you modify the - // implementation of scoped_ptr. - template - scoped_ptr(scoped_ptr&& other) - : impl_(&other.impl_) { - static_assert(!rtc::is_array::value, "U cannot be an array"); - } - - // operator=. Allows assignment from a scoped_ptr rvalue for a convertible - // type and deleter. - // - // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this operator= distinct from - // the normal move assignment operator. By C++11 20.7.1.2.3.4, this templated - // form has different requirements on for move-only Deleters. Since this - // implementation does not support move-only Deleters, we do not need a - // separate move assignment operator allowing us to avoid one use of SFINAE. - // You only need to care about this if you modify the implementation of - // scoped_ptr. - template - scoped_ptr& operator=(scoped_ptr&& rhs) { - static_assert(!rtc::is_array::value, "U cannot be an array"); - impl_.TakeState(&rhs.impl_); - return *this; - } - - // operator=. Allows assignment from a nullptr. Deletes the currently owned - // object, if any. - scoped_ptr& operator=(std::nullptr_t) { - reset(); - return *this; - } - - // Deleted copy constructor and copy assignment, to make the type move-only. - scoped_ptr(const scoped_ptr& other) = delete; - scoped_ptr& operator=(const scoped_ptr& other) = delete; - - // Get an rvalue reference. (sp.Pass() does the same thing as std::move(sp).) - scoped_ptr&& Pass() { return static_cast(*this); } - - // Reset. Deletes the currently owned object, if any. - // Then takes ownership of a new object, if given. - void reset(element_type* p = nullptr) { impl_.reset(p); } - - // Accessors to get the owned object. - // operator* and operator-> will assert() if there is no current object. - element_type& operator*() const { - assert(impl_.get() != nullptr); - return *impl_.get(); - } - element_type* operator->() const { - assert(impl_.get() != nullptr); - return impl_.get(); - } - element_type* get() const { return impl_.get(); } - - // Access to the deleter. - deleter_type& get_deleter() { return impl_.get_deleter(); } - const deleter_type& get_deleter() const { return impl_.get_deleter(); } - - // Allow scoped_ptr to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - // - // Note that this trick is only safe when the == and != operators - // are declared explicitly, as otherwise "scoped_ptr1 == - // scoped_ptr2" will compile but do the wrong thing (i.e., convert - // to Testable and then do the comparison). - private: - typedef rtc::internal::scoped_ptr_impl - scoped_ptr::*Testable; - - public: - operator Testable() const { - return impl_.get() ? &scoped_ptr::impl_ : nullptr; - } - - // Comparison operators. - // These return whether two scoped_ptr refer to the same object, not just to - // two different but equal objects. - bool operator==(const element_type* p) const { return impl_.get() == p; } - bool operator!=(const element_type* p) const { return impl_.get() != p; } - - // Swap two scoped pointers. - void swap(scoped_ptr& p2) { - impl_.swap(p2.impl_); - } - - // Release a pointer. - // The return value is the current pointer held by this object. If this object - // holds a nullptr, the return value is nullptr. After this operation, this - // object will hold a nullptr, and will not own the object any more. - element_type* release() WARN_UNUSED_RESULT { - return impl_.release(); - } - - // Delete the currently held pointer and return a pointer - // to allow overwriting of the current pointer address. - element_type** accept() WARN_UNUSED_RESULT { - return impl_.accept(); - } - - // Return a pointer to the current pointer address. - element_type** use() WARN_UNUSED_RESULT { - return impl_.use(); - } - - private: - // Needed to reach into |impl_| in the constructor. - template friend class scoped_ptr; - rtc::internal::scoped_ptr_impl impl_; - - // Forbidden for API compatibility with std::unique_ptr. - explicit scoped_ptr(int disallow_construction_from_null); - - // Forbid comparison of scoped_ptr types. If U != T, it totally - // doesn't make sense, and if U == T, it still doesn't make sense - // because you should never have the same object owned by two different - // scoped_ptrs. - template bool operator==(scoped_ptr const& p2) const; - template bool operator!=(scoped_ptr const& p2) const; -}; - -template -class scoped_ptr { - public: - // The element and deleter types. - typedef T element_type; - typedef D deleter_type; - - // Constructor. Defaults to initializing with nullptr. - scoped_ptr() : impl_(nullptr) {} - - // Constructor. Stores the given array. Note that the argument's type - // must exactly match T*. In particular: - // - it cannot be a pointer to a type derived from T, because it is - // inherently unsafe in the general case to access an array through a - // pointer whose dynamic type does not match its static type (eg., if - // T and the derived types had different sizes access would be - // incorrectly calculated). Deletion is also always undefined - // (C++98 [expr.delete]p3). If you're doing this, fix your code. - // - it cannot be const-qualified differently from T per unique_ptr spec - // (http://cplusplus.github.com/LWG/lwg-active.html#2118). Users wanting - // to work around this may use implicit_cast(). - // However, because of the first bullet in this comment, users MUST - // NOT use implicit_cast() to upcast the static type of the array. - explicit scoped_ptr(element_type* array) : impl_(array) {} - - // Constructor. Allows construction from a nullptr. - scoped_ptr(std::nullptr_t) : impl_(nullptr) {} - - // Constructor. Allows construction from a scoped_ptr rvalue. - scoped_ptr(scoped_ptr&& other) : impl_(&other.impl_) {} - - // operator=. Allows assignment from a scoped_ptr rvalue. - scoped_ptr& operator=(scoped_ptr&& rhs) { - impl_.TakeState(&rhs.impl_); - return *this; - } - - // operator=. Allows assignment from a nullptr. Deletes the currently owned - // array, if any. - scoped_ptr& operator=(std::nullptr_t) { - reset(); - return *this; - } - - // Deleted copy constructor and copy assignment, to make the type move-only. - scoped_ptr(const scoped_ptr& other) = delete; - scoped_ptr& operator=(const scoped_ptr& other) = delete; - - // Get an rvalue reference. (sp.Pass() does the same thing as std::move(sp).) - scoped_ptr&& Pass() { return static_cast(*this); } - - // Reset. Deletes the currently owned array, if any. - // Then takes ownership of a new object, if given. - void reset(element_type* array = nullptr) { impl_.reset(array); } - - // Accessors to get the owned array. - element_type& operator[](size_t i) const { - assert(impl_.get() != nullptr); - return impl_.get()[i]; - } - element_type* get() const { return impl_.get(); } - - // Access to the deleter. - deleter_type& get_deleter() { return impl_.get_deleter(); } - const deleter_type& get_deleter() const { return impl_.get_deleter(); } - - // Allow scoped_ptr to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - private: - typedef rtc::internal::scoped_ptr_impl - scoped_ptr::*Testable; - - public: - operator Testable() const { - return impl_.get() ? &scoped_ptr::impl_ : nullptr; - } - - // Comparison operators. - // These return whether two scoped_ptr refer to the same object, not just to - // two different but equal objects. - bool operator==(element_type* array) const { return impl_.get() == array; } - bool operator!=(element_type* array) const { return impl_.get() != array; } - - // Swap two scoped pointers. - void swap(scoped_ptr& p2) { - impl_.swap(p2.impl_); - } - - // Release a pointer. - // The return value is the current pointer held by this object. If this object - // holds a nullptr, the return value is nullptr. After this operation, this - // object will hold a nullptr, and will not own the object any more. - element_type* release() WARN_UNUSED_RESULT { - return impl_.release(); - } - - // Delete the currently held pointer and return a pointer - // to allow overwriting of the current pointer address. - element_type** accept() WARN_UNUSED_RESULT { - return impl_.accept(); - } - - // Return a pointer to the current pointer address. - element_type** use() WARN_UNUSED_RESULT { - return impl_.use(); - } - - private: - // Force element_type to be a complete type. - enum { type_must_be_complete = sizeof(element_type) }; - - // Actually hold the data. - rtc::internal::scoped_ptr_impl impl_; - - // Disable initialization from any type other than element_type*, by - // providing a constructor that matches such an initialization, but is - // private and has no definition. This is disabled because it is not safe to - // call delete[] on an array whose static type does not match its dynamic - // type. - template explicit scoped_ptr(U* array); - explicit scoped_ptr(int disallow_construction_from_null); - - // Disable reset() from any type other than element_type*, for the same - // reasons as the constructor above. - template void reset(U* array); - void reset(int disallow_reset_from_null); - - // Forbid comparison of scoped_ptr types. If U != T, it totally - // doesn't make sense, and if U == T, it still doesn't make sense - // because you should never have the same object owned by two different - // scoped_ptrs. - template bool operator==(scoped_ptr const& p2) const; - template bool operator!=(scoped_ptr const& p2) const; -}; - -template -void swap(rtc::scoped_ptr& p1, rtc::scoped_ptr& p2) { - p1.swap(p2); -} - -} // namespace rtc - -template -bool operator==(T* p1, const rtc::scoped_ptr& p2) { - return p1 == p2.get(); -} - -template -bool operator!=(T* p1, const rtc::scoped_ptr& p2) { - return p1 != p2.get(); -} - -// A function to convert T* into scoped_ptr -// Doing e.g. make_scoped_ptr(new FooBarBaz(arg)) is a shorter notation -// for scoped_ptr >(new FooBarBaz(arg)) -template -rtc::scoped_ptr rtc_make_scoped_ptr(T* ptr) { - return rtc::scoped_ptr(ptr); -} - -#endif // #ifndef WEBRTC_BASE_SCOPED_PTR_H__ diff --git a/include/webrtc/base/scoped_ref_ptr.h b/include/webrtc/base/scoped_ref_ptr.h deleted file mode 100644 index a71c20a..0000000 --- a/include/webrtc/base/scoped_ref_ptr.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Originally these classes are from Chromium. -// http://src.chromium.org/viewvc/chrome/trunk/src/base/memory/ref_counted.h?view=markup - -// -// A smart pointer class for reference counted objects. Use this class instead -// of calling AddRef and Release manually on a reference counted object to -// avoid common memory leaks caused by forgetting to Release an object -// reference. Sample usage: -// -// class MyFoo : public RefCounted { -// ... -// }; -// -// void some_function() { -// scoped_refptr foo = new MyFoo(); -// foo->Method(param); -// // |foo| is released when this function returns -// } -// -// void some_other_function() { -// scoped_refptr foo = new MyFoo(); -// ... -// foo = NULL; // explicitly releases |foo| -// ... -// if (foo) -// foo->Method(param); -// } -// -// The above examples show how scoped_refptr acts like a pointer to T. -// Given two scoped_refptr classes, it is also possible to exchange -// references between the two objects, like so: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b.swap(a); -// // now, |b| references the MyFoo object, and |a| references NULL. -// } -// -// To make both |a| and |b| in the above example reference the same MyFoo -// object, simply use the assignment operator: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b = a; -// // now, |a| and |b| each own a reference to the same MyFoo object. -// } -// - -#ifndef WEBRTC_BASE_SCOPED_REF_PTR_H_ -#define WEBRTC_BASE_SCOPED_REF_PTR_H_ - -#include - -namespace rtc { - -template -class scoped_refptr { - public: - scoped_refptr() : ptr_(NULL) { - } - - scoped_refptr(T* p) : ptr_(p) { - if (ptr_) - ptr_->AddRef(); - } - - scoped_refptr(const scoped_refptr& r) : ptr_(r.ptr_) { - if (ptr_) - ptr_->AddRef(); - } - - template - scoped_refptr(const scoped_refptr& r) : ptr_(r.get()) { - if (ptr_) - ptr_->AddRef(); - } - - ~scoped_refptr() { - if (ptr_) - ptr_->Release(); - } - - T* get() const { return ptr_; } - operator T*() const { return ptr_; } - T* operator->() const { return ptr_; } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - T* release() { - T* retVal = ptr_; - ptr_ = NULL; - return retVal; - } - - scoped_refptr& operator=(T* p) { - // AddRef first so that self assignment should work - if (p) - p->AddRef(); - if (ptr_ ) - ptr_ ->Release(); - ptr_ = p; - return *this; - } - - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.ptr_; - } - - template - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.get(); - } - - void swap(T** pp) { - T* p = ptr_; - ptr_ = *pp; - *pp = p; - } - - void swap(scoped_refptr& r) { - swap(&r.ptr_); - } - - protected: - T* ptr_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SCOPED_REF_PTR_H_ diff --git a/include/webrtc/base/scopedptrcollection.h b/include/webrtc/base/scopedptrcollection.h deleted file mode 100644 index cfdb6f9..0000000 --- a/include/webrtc/base/scopedptrcollection.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Stores a collection of pointers that are deleted when the container is -// destructed. - -#ifndef WEBRTC_BASE_SCOPEDPTRCOLLECTION_H_ -#define WEBRTC_BASE_SCOPEDPTRCOLLECTION_H_ - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" - -namespace rtc { - -template -class ScopedPtrCollection { - public: - typedef std::vector VectorT; - - ScopedPtrCollection() { } - ~ScopedPtrCollection() { - for (typename VectorT::iterator it = collection_.begin(); - it != collection_.end(); ++it) { - delete *it; - } - } - - const VectorT& collection() const { return collection_; } - void Reserve(size_t size) { - collection_.reserve(size); - } - void PushBack(T* t) { - collection_.push_back(t); - } - - // Remove |t| from the collection without deleting it. - void Remove(T* t) { - collection_.erase(std::remove(collection_.begin(), collection_.end(), t), - collection_.end()); - } - - private: - VectorT collection_; - - RTC_DISALLOW_COPY_AND_ASSIGN(ScopedPtrCollection); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SCOPEDPTRCOLLECTION_H_ diff --git a/include/webrtc/base/sec_buffer.h b/include/webrtc/base/sec_buffer.h deleted file mode 100644 index e6ffea4..0000000 --- a/include/webrtc/base/sec_buffer.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// @file Contains utility classes that make it easier to use SecBuffers - -#ifndef WEBRTC_BASE_SEC_BUFFER_H__ -#define WEBRTC_BASE_SEC_BUFFER_H__ - -namespace rtc { - -// A base class for CSecBuffer. Contains -// all implementation that does not require -// template arguments. -class CSecBufferBase : public SecBuffer { - public: - CSecBufferBase() { - Clear(); - } - - // Uses the SSPI to free a pointer, must be - // used for buffers returned from SSPI APIs. - static void FreeSSPI(void *ptr) { - if ( ptr ) { - SECURITY_STATUS status; - status = ::FreeContextBuffer(ptr); - ASSERT(SEC_E_OK == status); // "Freeing context buffer" - } - } - - // Deletes a buffer with operator delete - static void FreeDelete(void *ptr) { - delete [] reinterpret_cast(ptr); - } - - // A noop delete, for buffers over other - // people's memory - static void FreeNone(void *ptr) { - } - - protected: - // Clears the buffer to EMPTY & NULL - void Clear() { - this->BufferType = SECBUFFER_EMPTY; - this->cbBuffer = 0; - this->pvBuffer = NULL; - } -}; - -// Wrapper class for SecBuffer to take care -// of initialization and destruction. -template -class CSecBuffer: public CSecBufferBase { - public: - // Initializes buffer to empty & NULL - CSecBuffer() { - } - - // Frees any allocated memory - ~CSecBuffer() { - Release(); - } - - // Frees the buffer appropriately, and re-nulls - void Release() { - pfnFreeBuffer(this->pvBuffer); - Clear(); - } - - private: - // A placeholder function for compile-time asserts on the class - void CompileAsserts() { - // never invoked... - assert(false); // _T("Notreached") - - // This class must not extend the size of SecBuffer, since - // we use arrays of CSecBuffer in CSecBufferBundle below - cassert(sizeof(CSecBuffer == sizeof(SecBuffer))); - } -}; - -// Contains all generic implementation for the -// SecBufferBundle class -class SecBufferBundleBase { - public: -}; - -// A template class that bundles a SecBufferDesc with -// one or more SecBuffers for convenience. Can take -// care of deallocating buffers appropriately, as indicated -// by pfnFreeBuffer function. -// By default does no deallocation. -template -class CSecBufferBundle : public SecBufferBundleBase { - public: - // Constructs a security buffer bundle with num_buffers - // buffers, all of which are empty and nulled. - CSecBufferBundle() { - desc_.ulVersion = SECBUFFER_VERSION; - desc_.cBuffers = num_buffers; - desc_.pBuffers = buffers_; - } - - // Frees all currently used buffers. - ~CSecBufferBundle() { - Release(); - } - - // Accessor for the descriptor - PSecBufferDesc desc() { - return &desc_; - } - - // Accessor for the descriptor - PSecBufferDesc desc() const { - return &desc_; - } - - // returns the i-th security buffer - SecBuffer &operator[] (size_t num) { - ASSERT(num < num_buffers); // "Buffer index out of bounds" - return buffers_[num]; - } - - // returns the i-th security buffer - const SecBuffer &operator[] (size_t num) const { - ASSERT(num < num_buffers); // "Buffer index out of bounds" - return buffers_[num]; - } - - // Frees all non-NULL security buffers, - // using the deallocation function - void Release() { - for ( size_t i = 0; i < num_buffers; ++i ) { - buffers_[i].Release(); - } - } - - private: - // Our descriptor - SecBufferDesc desc_; - // Our bundled buffers, each takes care of its own - // initialization and destruction - CSecBuffer buffers_[num_buffers]; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SEC_BUFFER_H__ diff --git a/include/webrtc/base/sha1.h b/include/webrtc/base/sha1.h deleted file mode 100644 index aa5a6a5..0000000 --- a/include/webrtc/base/sha1.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SHA-1 in C - * By Steve Reid - * 100% Public Domain - * -*/ - -// Ported to C++, Google style, under namespace rtc. - -#ifndef WEBRTC_BASE_SHA1_H_ -#define WEBRTC_BASE_SHA1_H_ - -#include -#include - -namespace rtc { - -struct SHA1_CTX { - uint32_t state[5]; - // TODO: Change bit count to uint64_t. - uint32_t count[2]; // Bit count of input. - uint8_t buffer[64]; -}; - -#define SHA1_DIGEST_SIZE 20 - -void SHA1Init(SHA1_CTX* context); -void SHA1Update(SHA1_CTX* context, const uint8_t* data, size_t len); -void SHA1Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]); - -#endif // WEBRTC_BASE_SHA1_H_ - -} // namespace rtc diff --git a/include/webrtc/base/sha1digest.h b/include/webrtc/base/sha1digest.h deleted file mode 100644 index d321cb8..0000000 --- a/include/webrtc/base/sha1digest.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SHA1DIGEST_H_ -#define WEBRTC_BASE_SHA1DIGEST_H_ - -#include "webrtc/base/messagedigest.h" -#include "webrtc/base/sha1.h" - -namespace rtc { - -// A simple wrapper for our SHA-1 implementation. -class Sha1Digest : public MessageDigest { - public: - enum { kSize = SHA1_DIGEST_SIZE }; - Sha1Digest() { - SHA1Init(&ctx_); - } - size_t Size() const override; - void Update(const void* buf, size_t len) override; - size_t Finish(void* buf, size_t len) override; - - private: - SHA1_CTX ctx_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SHA1DIGEST_H_ diff --git a/include/webrtc/base/sharedexclusivelock.h b/include/webrtc/base/sharedexclusivelock.h deleted file mode 100644 index a6ca573..0000000 --- a/include/webrtc/base/sharedexclusivelock.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SHAREDEXCLUSIVELOCK_H_ -#define WEBRTC_BASE_SHAREDEXCLUSIVELOCK_H_ - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/event.h" - -namespace rtc { - -// This class provides shared-exclusive lock. It can be used in cases like -// multiple-readers/single-writer model. -class LOCKABLE SharedExclusiveLock { - public: - SharedExclusiveLock(); - - // Locking/unlocking methods. It is encouraged to use SharedScope or - // ExclusiveScope for protection. - void LockExclusive() EXCLUSIVE_LOCK_FUNCTION(); - void UnlockExclusive() UNLOCK_FUNCTION(); - void LockShared(); - void UnlockShared(); - - private: - rtc::CriticalSection cs_exclusive_; - rtc::CriticalSection cs_shared_; - rtc::Event shared_count_is_zero_; - int shared_count_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SharedExclusiveLock); -}; - -class SCOPED_LOCKABLE SharedScope { - public: - explicit SharedScope(SharedExclusiveLock* lock) SHARED_LOCK_FUNCTION(lock) - : lock_(lock) { - lock_->LockShared(); - } - - ~SharedScope() UNLOCK_FUNCTION() { lock_->UnlockShared(); } - - private: - SharedExclusiveLock* lock_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SharedScope); -}; - -class SCOPED_LOCKABLE ExclusiveScope { - public: - explicit ExclusiveScope(SharedExclusiveLock* lock) - EXCLUSIVE_LOCK_FUNCTION(lock) - : lock_(lock) { - lock_->LockExclusive(); - } - - ~ExclusiveScope() UNLOCK_FUNCTION() { lock_->UnlockExclusive(); } - - private: - SharedExclusiveLock* lock_; - - RTC_DISALLOW_COPY_AND_ASSIGN(ExclusiveScope); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SHAREDEXCLUSIVELOCK_H_ diff --git a/include/webrtc/base/signalthread.h b/include/webrtc/base/signalthread.h deleted file mode 100644 index ec250c6..0000000 --- a/include/webrtc/base/signalthread.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SIGNALTHREAD_H_ -#define WEBRTC_BASE_SIGNALTHREAD_H_ - -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// SignalThread - Base class for worker threads. The main thread should call -// Start() to begin work, and then follow one of these models: -// Normal: Wait for SignalWorkDone, and then call Release to destroy. -// Cancellation: Call Release(true), to abort the worker thread. -// Fire-and-forget: Call Release(false), which allows the thread to run to -// completion, and then self-destruct without further notification. -// Periodic tasks: Wait for SignalWorkDone, then eventually call Start() -// again to repeat the task. When the instance isn't needed anymore, -// call Release. DoWork, OnWorkStart and OnWorkStop are called again, -// on a new thread. -// The subclass should override DoWork() to perform the background task. By -// periodically calling ContinueWork(), it can check for cancellation. -// OnWorkStart and OnWorkDone can be overridden to do pre- or post-work -// tasks in the context of the main thread. -/////////////////////////////////////////////////////////////////////////////// - -class SignalThread - : public sigslot::has_slots<>, - protected MessageHandler { - public: - SignalThread(); - - // Context: Main Thread. Call before Start to change the worker's name. - bool SetName(const std::string& name, const void* obj); - - // Context: Main Thread. Call to begin the worker thread. - void Start(); - - // Context: Main Thread. If the worker thread is not running, deletes the - // object immediately. Otherwise, asks the worker thread to abort processing, - // and schedules the object to be deleted once the worker exits. - // SignalWorkDone will not be signalled. If wait is true, does not return - // until the thread is deleted. - void Destroy(bool wait); - - // Context: Main Thread. If the worker thread is complete, deletes the - // object immediately. Otherwise, schedules the object to be deleted once - // the worker thread completes. SignalWorkDone will be signalled. - void Release(); - - // Context: Main Thread. Signalled when work is complete. - sigslot::signal1 SignalWorkDone; - - enum { ST_MSG_WORKER_DONE, ST_MSG_FIRST_AVAILABLE }; - - protected: - ~SignalThread() override; - - Thread* worker() { return &worker_; } - - // Context: Main Thread. Subclass should override to do pre-work setup. - virtual void OnWorkStart() { } - - // Context: Worker Thread. Subclass should override to do work. - virtual void DoWork() = 0; - - // Context: Worker Thread. Subclass should call periodically to - // dispatch messages and determine if the thread should terminate. - bool ContinueWork(); - - // Context: Worker Thread. Subclass should override when extra work is - // needed to abort the worker thread. - virtual void OnWorkStop() { } - - // Context: Main Thread. Subclass should override to do post-work cleanup. - virtual void OnWorkDone() { } - - // Context: Any Thread. If subclass overrides, be sure to call the base - // implementation. Do not use (message_id < ST_MSG_FIRST_AVAILABLE) - void OnMessage(Message* msg) override; - - private: - enum State { - kInit, // Initialized, but not started - kRunning, // Started and doing work - kReleasing, // Same as running, but to be deleted when work is done - kComplete, // Work is done - kStopping, // Work is being interrupted - }; - - class Worker : public Thread { - public: - explicit Worker(SignalThread* parent) : parent_(parent) {} - ~Worker() override; - void Run() override; - - private: - SignalThread* parent_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Worker); - }; - - class SCOPED_LOCKABLE EnterExit { - public: - explicit EnterExit(SignalThread* t) EXCLUSIVE_LOCK_FUNCTION(t->cs_) - : t_(t) { - t_->cs_.Enter(); - // If refcount_ is zero then the object has already been deleted and we - // will be double-deleting it in ~EnterExit()! (shouldn't happen) - ASSERT(t_->refcount_ != 0); - ++t_->refcount_; - } - ~EnterExit() UNLOCK_FUNCTION() { - bool d = (0 == --t_->refcount_); - t_->cs_.Leave(); - if (d) - delete t_; - } - - private: - SignalThread* t_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EnterExit); - }; - - void Run(); - void OnMainThreadDestroyed(); - - Thread* main_; - Worker worker_; - CriticalSection cs_; - State state_; - int refcount_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SignalThread); -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_SIGNALTHREAD_H_ diff --git a/include/webrtc/base/sigslot.h b/include/webrtc/base/sigslot.h deleted file mode 100644 index a5fd5f7..0000000 --- a/include/webrtc/base/sigslot.h +++ /dev/null @@ -1,2804 +0,0 @@ -// sigslot.h: Signal/Slot classes -// -// Written by Sarah Thompson (sarah@telergy.com) 2002. -// -// License: Public domain. You are free to use this code however you like, with the proviso that -// the author takes on no responsibility or liability for any use. -// -// QUICK DOCUMENTATION -// -// (see also the full documentation at http://sigslot.sourceforge.net/) -// -// #define switches -// SIGSLOT_PURE_ISO - Define this to force ISO C++ compliance. This also disables -// all of the thread safety support on platforms where it is -// available. -// -// SIGSLOT_USE_POSIX_THREADS - Force use of Posix threads when using a C++ compiler other than -// gcc on a platform that supports Posix threads. (When using gcc, -// this is the default - use SIGSLOT_PURE_ISO to disable this if -// necessary) -// -// SIGSLOT_DEFAULT_MT_POLICY - Where thread support is enabled, this defaults to multi_threaded_global. -// Otherwise, the default is single_threaded. #define this yourself to -// override the default. In pure ISO mode, anything other than -// single_threaded will cause a compiler error. -// -// PLATFORM NOTES -// -// Win32 - On Win32, the WEBRTC_WIN symbol must be #defined. Most mainstream -// compilers do this by default, but you may need to define it -// yourself if your build environment is less standard. This causes -// the Win32 thread support to be compiled in and used automatically. -// -// Unix/Linux/BSD, etc. - If you're using gcc, it is assumed that you have Posix threads -// available, so they are used automatically. You can override this -// (as under Windows) with the SIGSLOT_PURE_ISO switch. If you're using -// something other than gcc but still want to use Posix threads, you -// need to #define SIGSLOT_USE_POSIX_THREADS. -// -// ISO C++ - If none of the supported platforms are detected, or if -// SIGSLOT_PURE_ISO is defined, all multithreading support is turned off, -// along with any code that might cause a pure ISO C++ environment to -// complain. Before you ask, gcc -ansi -pedantic won't compile this -// library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of -// errors that aren't really there. If you feel like investigating this, -// please contact the author. -// -// -// THREADING MODES -// -// single_threaded - Your program is assumed to be single threaded from the point of view -// of signal/slot usage (i.e. all objects using signals and slots are -// created and destroyed from a single thread). Behaviour if objects are -// destroyed concurrently is undefined (i.e. you'll get the occasional -// segmentation fault/memory exception). -// -// multi_threaded_global - Your program is assumed to be multi threaded. Objects using signals and -// slots can be safely created and destroyed from any thread, even when -// connections exist. In multi_threaded_global mode, this is achieved by a -// single global mutex (actually a critical section on Windows because they -// are faster). This option uses less OS resources, but results in more -// opportunities for contention, possibly resulting in more context switches -// than are strictly necessary. -// -// multi_threaded_local - Behaviour in this mode is essentially the same as multi_threaded_global, -// except that each signal, and each object that inherits has_slots, all -// have their own mutex/critical section. In practice, this means that -// mutex collisions (and hence context switches) only happen if they are -// absolutely essential. However, on some platforms, creating a lot of -// mutexes can slow down the whole OS, so use this option with care. -// -// USING THE LIBRARY -// -// See the full documentation at http://sigslot.sourceforge.net/ -// -// -// Libjingle specific: -// This file has been modified such that has_slots and signalx do not have to be -// using the same threading requirements. E.g. it is possible to connect a -// has_slots and signal0 or -// has_slots and signal0. -// If has_slots is single threaded the user must ensure that it is not trying -// to connect or disconnect to signalx concurrently or data race may occur. -// If signalx is single threaded the user must ensure that disconnect, connect -// or signal is not happening concurrently or data race may occur. - -#ifndef WEBRTC_BASE_SIGSLOT_H__ -#define WEBRTC_BASE_SIGSLOT_H__ - -#include -#include -#include - -// On our copy of sigslot.h, we set single threading as default. -#define SIGSLOT_DEFAULT_MT_POLICY single_threaded - -#if defined(SIGSLOT_PURE_ISO) || (!defined(WEBRTC_WIN) && !defined(__GNUG__) && !defined(SIGSLOT_USE_POSIX_THREADS)) -# define _SIGSLOT_SINGLE_THREADED -#elif defined(WEBRTC_WIN) -# define _SIGSLOT_HAS_WIN32_THREADS -# if !defined(WIN32_LEAN_AND_MEAN) -# define WIN32_LEAN_AND_MEAN -# endif -# include "webrtc/base/win32.h" -#elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS) -# define _SIGSLOT_HAS_POSIX_THREADS -# include -#else -# define _SIGSLOT_SINGLE_THREADED -#endif - -#ifndef SIGSLOT_DEFAULT_MT_POLICY -# ifdef _SIGSLOT_SINGLE_THREADED -# define SIGSLOT_DEFAULT_MT_POLICY single_threaded -# else -# define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local -# endif -#endif - -// TODO: change this namespace to rtc? -namespace sigslot { - - class single_threaded - { - public: - single_threaded() - { - ; - } - - virtual ~single_threaded() {} - - virtual void lock() {} - - virtual void unlock() {} - }; - -#ifdef _SIGSLOT_HAS_WIN32_THREADS - // The multi threading policies only get compiled in if they are enabled. - class multi_threaded_global - { - public: - multi_threaded_global() - { - static bool isinitialised = false; - - if(!isinitialised) - { - InitializeCriticalSection(get_critsec()); - isinitialised = true; - } - } - - multi_threaded_global(const multi_threaded_global&) - { - ; - } - - virtual ~multi_threaded_global() - { - ; - } - - virtual void lock() - { - EnterCriticalSection(get_critsec()); - } - - virtual void unlock() - { - LeaveCriticalSection(get_critsec()); - } - - private: - CRITICAL_SECTION* get_critsec() - { - static CRITICAL_SECTION g_critsec; - return &g_critsec; - } - }; - - class multi_threaded_local - { - public: - multi_threaded_local() - { - InitializeCriticalSection(&m_critsec); - } - - multi_threaded_local(const multi_threaded_local&) - { - InitializeCriticalSection(&m_critsec); - } - - virtual ~multi_threaded_local() - { - DeleteCriticalSection(&m_critsec); - } - - virtual void lock() - { - EnterCriticalSection(&m_critsec); - } - - virtual void unlock() - { - LeaveCriticalSection(&m_critsec); - } - - private: - CRITICAL_SECTION m_critsec; - }; -#endif // _SIGSLOT_HAS_WIN32_THREADS - -#ifdef _SIGSLOT_HAS_POSIX_THREADS - // The multi threading policies only get compiled in if they are enabled. - class multi_threaded_global - { - public: - multi_threaded_global(); - multi_threaded_global(const multi_threaded_global&); - virtual ~multi_threaded_global(); - virtual void lock(); - virtual void unlock(); - - private: - pthread_mutex_t* get_mutex() - { - static pthread_mutex_t g_mutex; - return &g_mutex; - } - }; - - class multi_threaded_local - { - public: - multi_threaded_local(); - multi_threaded_local(const multi_threaded_local&); - virtual ~multi_threaded_local(); - virtual void lock(); - virtual void unlock(); - - private: - pthread_mutex_t m_mutex; - }; -#endif // _SIGSLOT_HAS_POSIX_THREADS - - template - class lock_block - { - public: - mt_policy *m_mutex; - - lock_block(mt_policy *mtx) - : m_mutex(mtx) - { - m_mutex->lock(); - } - - ~lock_block() - { - m_mutex->unlock(); - } - }; - - class has_slots_interface; - - template - class _connection_base0 - { - public: - virtual ~_connection_base0() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit() = 0; - virtual _connection_base0* clone() = 0; - virtual _connection_base0* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base1 - { - public: - virtual ~_connection_base1() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type) = 0; - virtual _connection_base1* clone() = 0; - virtual _connection_base1* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base2 - { - public: - virtual ~_connection_base2() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type) = 0; - virtual _connection_base2* clone() = 0; - virtual _connection_base2* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base3 - { - public: - virtual ~_connection_base3() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type, arg3_type) = 0; - virtual _connection_base3* clone() = 0; - virtual _connection_base3* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base4 - { - public: - virtual ~_connection_base4() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0; - virtual _connection_base4* clone() = 0; - virtual _connection_base4* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base5 - { - public: - virtual ~_connection_base5() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type) = 0; - virtual _connection_base5* clone() = 0; - virtual _connection_base5* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base6 - { - public: - virtual ~_connection_base6() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, - arg6_type) = 0; - virtual _connection_base6* clone() = 0; - virtual _connection_base6* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base7 - { - public: - virtual ~_connection_base7() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, - arg6_type, arg7_type) = 0; - virtual _connection_base7* clone() = 0; - virtual _connection_base7* duplicate(has_slots_interface* pnewdest) = 0; - }; - - template - class _connection_base8 - { - public: - virtual ~_connection_base8() {} - virtual has_slots_interface* getdest() const = 0; - virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, - arg6_type, arg7_type, arg8_type) = 0; - virtual _connection_base8* clone() = 0; - virtual _connection_base8* duplicate(has_slots_interface* pnewdest) = 0; - }; - - class _signal_base_interface - { - public: - virtual ~_signal_base_interface() {} - virtual void slot_disconnect(has_slots_interface* pslot) = 0; - virtual void slot_duplicate(const has_slots_interface* poldslot, has_slots_interface* pnewslot) = 0; - }; - - template - class _signal_base : public _signal_base_interface, public mt_policy - { - }; - - class has_slots_interface - { - public: - has_slots_interface() - { - ; - } - - virtual void signal_connect(_signal_base_interface* sender) = 0; - - virtual void signal_disconnect(_signal_base_interface* sender) = 0; - - virtual ~has_slots_interface() - { - } - - virtual void disconnect_all() = 0; - }; - - template - class has_slots : public has_slots_interface, public mt_policy - { - private: - typedef std::set<_signal_base_interface*> sender_set; - typedef sender_set::const_iterator const_iterator; - - public: - has_slots() - { - ; - } - - has_slots(const has_slots& hs) - { - lock_block lock(this); - const_iterator it = hs.m_senders.begin(); - const_iterator itEnd = hs.m_senders.end(); - - while(it != itEnd) - { - (*it)->slot_duplicate(&hs, this); - m_senders.insert(*it); - ++it; - } - } - - void signal_connect(_signal_base_interface* sender) - { - lock_block lock(this); - m_senders.insert(sender); - } - - void signal_disconnect(_signal_base_interface* sender) - { - lock_block lock(this); - m_senders.erase(sender); - } - - virtual ~has_slots() - { - disconnect_all(); - } - - void disconnect_all() - { - lock_block lock(this); - const_iterator it = m_senders.begin(); - const_iterator itEnd = m_senders.end(); - - while(it != itEnd) - { - (*it)->slot_disconnect(this); - ++it; - } - - m_senders.erase(m_senders.begin(), m_senders.end()); - } - - private: - sender_set m_senders; - }; - - template - class _signal_base0 : public _signal_base - { - public: - typedef std::list<_connection_base0 *> connections_list; - - _signal_base0() - { - ; - } - - _signal_base0(const _signal_base0& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - ~_signal_base0() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base1 : public _signal_base - { - public: - typedef std::list<_connection_base1 *> connections_list; - - _signal_base1() - { - ; - } - - _signal_base1(const _signal_base1& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base1() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base2 : public _signal_base - { - public: - typedef std::list<_connection_base2 *> - connections_list; - - _signal_base2() - { - ; - } - - _signal_base2(const _signal_base2& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base2() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base3 : public _signal_base - { - public: - typedef std::list<_connection_base3 *> - connections_list; - - _signal_base3() - { - ; - } - - _signal_base3(const _signal_base3& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base3() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base4 : public _signal_base - { - public: - typedef std::list<_connection_base4 *> connections_list; - - _signal_base4() - { - ; - } - - _signal_base4(const _signal_base4& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base4() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base5 : public _signal_base - { - public: - typedef std::list<_connection_base5 *> connections_list; - - _signal_base5() - { - ; - } - - _signal_base5(const _signal_base5& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base5() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base6 : public _signal_base - { - public: - typedef std::list<_connection_base6 *> connections_list; - - _signal_base6() - { - ; - } - - _signal_base6(const _signal_base6& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base6() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base7 : public _signal_base - { - public: - typedef std::list<_connection_base7 *> connections_list; - - _signal_base7() - { - ; - } - - _signal_base7(const _signal_base7& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base7() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - template - class _signal_base8 : public _signal_base - { - public: - typedef std::list<_connection_base8 *> - connections_list; - - _signal_base8() - { - ; - } - - _signal_base8(const _signal_base8& s) - : _signal_base(s) - { - lock_block lock(this); - typename connections_list::const_iterator it = s.m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = s.m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_connect(this); - m_connected_slots.push_back((*it)->clone()); - - ++it; - } - } - - void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == oldtarget) - { - m_connected_slots.push_back((*it)->duplicate(newtarget)); - } - - ++it; - } - } - - ~_signal_base8() - { - disconnect_all(); - } - - bool is_empty() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - return it == itEnd; - } - - void disconnect_all() - { - lock_block lock(this); - typename connections_list::const_iterator it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - (*it)->getdest()->signal_disconnect(this); - delete *it; - - ++it; - } - - m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); - } - -#if !defined(NDEBUG) - bool connected(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - while(it != itEnd) - { - itNext = it; - ++itNext; - if ((*it)->getdest() == pclass) - return true; - it = itNext; - } - return false; - } -#endif - - void disconnect(has_slots_interface* pclass) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - if((*it)->getdest() == pclass) - { - delete *it; - m_connected_slots.erase(it); - pclass->signal_disconnect(this); - return; - } - - ++it; - } - } - - void slot_disconnect(has_slots_interface* pslot) - { - lock_block lock(this); - typename connections_list::iterator it = m_connected_slots.begin(); - typename connections_list::iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - typename connections_list::iterator itNext = it; - ++itNext; - - if((*it)->getdest() == pslot) - { - delete *it; - m_connected_slots.erase(it); - } - - it = itNext; - } - } - - protected: - connections_list m_connected_slots; - }; - - - template - class _connection0 : public _connection_base0 - { - public: - _connection0() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection0(dest_type* pobject, void (dest_type::*pmemfun)()) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection0() - { - } - - virtual _connection_base0* clone() - { - return new _connection0(*this); - } - - virtual _connection_base0* duplicate(has_slots_interface* pnewdest) - { - return new _connection0((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit() - { - (m_pobject->*m_pmemfun)(); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(); - }; - - template - class _connection1 : public _connection_base1 - { - public: - _connection1() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection1() - { - } - - virtual _connection_base1* clone() - { - return new _connection1(*this); - } - - virtual _connection_base1* duplicate(has_slots_interface* pnewdest) - { - return new _connection1((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1) - { - (m_pobject->*m_pmemfun)(a1); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type); - }; - - template - class _connection2 : public _connection_base2 - { - public: - _connection2() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection2() - { - } - - virtual _connection_base2* clone() - { - return new _connection2(*this); - } - - virtual _connection_base2* duplicate(has_slots_interface* pnewdest) - { - return new _connection2((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2) - { - (m_pobject->*m_pmemfun)(a1, a2); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type); - }; - - template - class _connection3 : public _connection_base3 - { - public: - _connection3() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection3() - { - } - - virtual _connection_base3* clone() - { - return new _connection3(*this); - } - - virtual _connection_base3* duplicate(has_slots_interface* pnewdest) - { - return new _connection3((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3) - { - (m_pobject->*m_pmemfun)(a1, a2, a3); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type); - }; - - template - class _connection4 : public _connection_base4 - { - public: - _connection4() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection4() - { - } - - virtual _connection_base4* clone() - { - return new _connection4(*this); - } - - virtual _connection_base4* duplicate(has_slots_interface* pnewdest) - { - return new _connection4((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, - arg4_type a4) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, - arg4_type); - }; - - template - class _connection5 : public _connection_base5 - { - public: - _connection5() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection5() - { - } - - virtual _connection_base5* clone() - { - return new _connection5(*this); - } - - virtual _connection_base5* duplicate(has_slots_interface* pnewdest) - { - return new _connection5((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type); - }; - - template - class _connection6 : public _connection_base6 - { - public: - _connection6() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection6() - { - } - - virtual _connection_base6* clone() - { - return new _connection6(*this); - } - - virtual _connection_base6* duplicate(has_slots_interface* pnewdest) - { - return new _connection6((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type); - }; - - template - class _connection7 : public _connection_base7 - { - public: - _connection7() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection7() - { - } - - virtual _connection_base7* clone() - { - return new _connection7(*this); - } - - virtual _connection_base7* duplicate(has_slots_interface* pnewdest) - { - return new _connection7((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type); - }; - - template - class _connection8 : public _connection_base8 - { - public: - _connection8() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, - arg7_type, arg8_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection8() - { - } - - virtual _connection_base8* clone() - { - return new _connection8(*this); - } - - virtual _connection_base8* duplicate(has_slots_interface* pnewdest) - { - return new _connection8((dest_type *)pnewdest, m_pmemfun); - } - - virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - virtual has_slots_interface* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type); - }; - - template - class signal0 : public _signal_base0 - { - public: - typedef _signal_base0 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal0() - { - ; - } - - signal0(const signal0& s) - : _signal_base0(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)()) - { - lock_block lock(this); - _connection0* conn = - new _connection0(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit() - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(); - - it = itNext; - } - } - - void operator()() - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(); - - it = itNext; - } - } - }; - - template - class signal1 : public _signal_base1 - { - public: - typedef _signal_base1 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal1() - { - ; - } - - signal1(const signal1& s) - : _signal_base1(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type)) - { - lock_block lock(this); - _connection1* conn = - new _connection1(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1); - - it = itNext; - } - } - - void operator()(arg1_type a1) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1); - - it = itNext; - } - } - }; - - template - class signal2 : public _signal_base2 - { - public: - typedef _signal_base2 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal2() - { - ; - } - - signal2(const signal2& s) - : _signal_base2(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type)) - { - lock_block lock(this); - _connection2* conn = new - _connection2(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2); - - it = itNext; - } - } - }; - - template - class signal3 : public _signal_base3 - { - public: - typedef _signal_base3 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal3() - { - ; - } - - signal3(const signal3& s) - : _signal_base3(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type)) - { - lock_block lock(this); - _connection3* conn = - new _connection3(pclass, - pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2, arg3_type a3) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3); - - it = itNext; - } - } - }; - - template - class signal4 : public _signal_base4 - { - public: - typedef _signal_base4 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal4() - { - ; - } - - signal4(const signal4& s) - : _signal_base4(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type)) - { - lock_block lock(this); - _connection4* - conn = new _connection4(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4); - - it = itNext; - } - } - }; - - template - class signal5 : public _signal_base5 - { - public: - typedef _signal_base5 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal5() - { - ; - } - - signal5(const signal5& s) - : _signal_base5(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type)) - { - lock_block lock(this); - _connection5* conn = new _connection5(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5); - - it = itNext; - } - } - }; - - - template - class signal6 : public _signal_base6 - { - public: - typedef _signal_base6 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal6() - { - ; - } - - signal6(const signal6& s) - : _signal_base6(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type)) - { - lock_block lock(this); - _connection6* conn = - new _connection6(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5, a6); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5, a6); - - it = itNext; - } - } - }; - - template - class signal7 : public _signal_base7 - { - public: - typedef _signal_base7 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal7() - { - ; - } - - signal7(const signal7& s) - : _signal_base7(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, - arg7_type)) - { - lock_block lock(this); - _connection7* conn = - new _connection7(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5, a6, a7); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5, a6, a7); - - it = itNext; - } - } - }; - - template - class signal8 : public _signal_base8 - { - public: - typedef _signal_base8 base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal8() - { - ; - } - - signal8(const signal8& s) - : _signal_base8(s) - { - ; - } - - template - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, - arg7_type, arg8_type)) - { - lock_block lock(this); - _connection8* conn = - new _connection8(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8) - { - lock_block lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8); - - it = itNext; - } - } - }; - -}; // namespace sigslot - -#endif // WEBRTC_BASE_SIGSLOT_H__ diff --git a/include/webrtc/base/sigslotrepeater.h b/include/webrtc/base/sigslotrepeater.h deleted file mode 100644 index d1c891e..0000000 --- a/include/webrtc/base/sigslotrepeater.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2006 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SIGSLOTREPEATER_H__ -#define WEBRTC_BASE_SIGSLOTREPEATER_H__ - -// repeaters are both signals and slots, which are designed as intermediate -// pass-throughs for signals and slots which don't know about each other (for -// modularity or encapsulation). This eliminates the need to declare a signal -// handler whose sole purpose is to fire another signal. The repeater connects -// to the originating signal using the 'repeat' method. When the repeated -// signal fires, the repeater will also fire. - -#include "webrtc/base/sigslot.h" - -namespace sigslot { - - template - class repeater0 : public signal0, - public has_slots - { - public: - typedef signal0 base_type; - typedef repeater0 this_type; - - repeater0() { } - repeater0(const this_type& s) : base_type(s) { } - - void reemit() { signal0::emit(); } - void repeat(base_type &s) { s.connect(this, &this_type::reemit); } - void stop(base_type &s) { s.disconnect(this); } - }; - - template - class repeater1 : public signal1, - public has_slots - { - public: - typedef signal1 base_type; - typedef repeater1 this_type; - - repeater1() { } - repeater1(const this_type& s) : base_type(s) { } - - void reemit(arg1_type a1) { signal1::emit(a1); } - void repeat(base_type& s) { s.connect(this, &this_type::reemit); } - void stop(base_type &s) { s.disconnect(this); } - }; - - template - class repeater2 : public signal2, - public has_slots - { - public: - typedef signal2 base_type; - typedef repeater2 this_type; - - repeater2() { } - repeater2(const this_type& s) : base_type(s) { } - - void reemit(arg1_type a1, arg2_type a2) { signal2::emit(a1,a2); } - void repeat(base_type& s) { s.connect(this, &this_type::reemit); } - void stop(base_type &s) { s.disconnect(this); } - }; - - template - class repeater3 : public signal3, - public has_slots - { - public: - typedef signal3 base_type; - typedef repeater3 this_type; - - repeater3() { } - repeater3(const this_type& s) : base_type(s) { } - - void reemit(arg1_type a1, arg2_type a2, arg3_type a3) { - signal3::emit(a1,a2,a3); - } - void repeat(base_type& s) { s.connect(this, &this_type::reemit); } - void stop(base_type &s) { s.disconnect(this); } - }; - -} // namespace sigslot - -#endif // WEBRTC_BASE_SIGSLOTREPEATER_H__ diff --git a/include/webrtc/base/sigslottester.h b/include/webrtc/base/sigslottester.h deleted file mode 100755 index cdbd44a..0000000 --- a/include/webrtc/base/sigslottester.h +++ /dev/null @@ -1,199 +0,0 @@ -// This file was GENERATED by command: -// pump.py sigslottester.h.pump -// DO NOT EDIT BY HAND!!! - -/* - * Copyright 2014 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SIGSLOTTESTER_H_ -#define WEBRTC_BASE_SIGSLOTTESTER_H_ - -// To generate sigslottester.h from sigslottester.h.pump, execute: -// /home/build/google3/third_party/gtest/scripts/pump.py sigslottester.h.pump - - -// SigslotTester(s) are utility classes to check if signals owned by an -// object are being invoked at the right time and with the right arguments. -// They are meant to be used in tests. Tests must provide "capture" pointers -// (i.e. address of variables) where the arguments from the signal callback -// can be stored. -// -// Example: -// /* Some signal */ -// sigslot::signal1 foo; -// -// /* We want to monitor foo in some test. Note how signal argument is -// const std::string&, but capture-type is std::string. Capture type -// must be type that can be assigned to. */ -// std::string capture; -// SigslotTester1 slot(&foo, &capture); -// foo.emit("hello"); -// EXPECT_EQ(1, slot.callback_count()); -// EXPECT_EQ("hello", capture); -// /* See unit-tests for more examples */ - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/sigslot.h" - -namespace rtc { - -// For all the templates below: -// - A1-A5 is the type of the argument i in the callback. Signals may and often -// do use const-references here for efficiency. -// - C1-C5 is the type of the variable to capture argument i. These should be -// non-const value types suitable for use as lvalues. - -template -class SigslotTester1 : public sigslot::has_slots<> { - public: - SigslotTester1(sigslot::signal1* signal, - C1* capture1) - : callback_count_(0), - capture1_(capture1) { - signal->connect(this, &SigslotTester1::OnSignalCallback); - } - - int callback_count() const { return callback_count_; } - - private: - void OnSignalCallback(A1 arg1) { - callback_count_++; - *capture1_ = arg1; - } - - int callback_count_; - C1* capture1_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester1); -}; - -template -class SigslotTester2 : public sigslot::has_slots<> { - public: - SigslotTester2(sigslot::signal2* signal, - C1* capture1, C2* capture2) - : callback_count_(0), - capture1_(capture1), capture2_(capture2) { - signal->connect(this, &SigslotTester2::OnSignalCallback); - } - - int callback_count() const { return callback_count_; } - - private: - void OnSignalCallback(A1 arg1, A2 arg2) { - callback_count_++; - *capture1_ = arg1; - *capture2_ = arg2; - } - - int callback_count_; - C1* capture1_; - C2* capture2_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester2); -}; - -template -class SigslotTester3 : public sigslot::has_slots<> { - public: - SigslotTester3(sigslot::signal3* signal, - C1* capture1, C2* capture2, C3* capture3) - : callback_count_(0), - capture1_(capture1), capture2_(capture2), capture3_(capture3) { - signal->connect(this, &SigslotTester3::OnSignalCallback); - } - - int callback_count() const { return callback_count_; } - - private: - void OnSignalCallback(A1 arg1, A2 arg2, A3 arg3) { - callback_count_++; - *capture1_ = arg1; - *capture2_ = arg2; - *capture3_ = arg3; - } - - int callback_count_; - C1* capture1_; - C2* capture2_; - C3* capture3_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester3); -}; - -template -class SigslotTester4 : public sigslot::has_slots<> { - public: - SigslotTester4(sigslot::signal4* signal, - C1* capture1, C2* capture2, C3* capture3, C4* capture4) - : callback_count_(0), - capture1_(capture1), capture2_(capture2), capture3_(capture3), - capture4_(capture4) { - signal->connect(this, &SigslotTester4::OnSignalCallback); - } - - int callback_count() const { return callback_count_; } - - private: - void OnSignalCallback(A1 arg1, A2 arg2, A3 arg3, A4 arg4) { - callback_count_++; - *capture1_ = arg1; - *capture2_ = arg2; - *capture3_ = arg3; - *capture4_ = arg4; - } - - int callback_count_; - C1* capture1_; - C2* capture2_; - C3* capture3_; - C4* capture4_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester4); -}; - -template -class SigslotTester5 : public sigslot::has_slots<> { - public: - SigslotTester5(sigslot::signal5* signal, - C1* capture1, C2* capture2, C3* capture3, C4* capture4, - C5* capture5) - : callback_count_(0), - capture1_(capture1), capture2_(capture2), capture3_(capture3), - capture4_(capture4), capture5_(capture5) { - signal->connect(this, &SigslotTester5::OnSignalCallback); - } - - int callback_count() const { return callback_count_; } - - private: - void OnSignalCallback(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) { - callback_count_++; - *capture1_ = arg1; - *capture2_ = arg2; - *capture3_ = arg3; - *capture4_ = arg4; - *capture5_ = arg5; - } - - int callback_count_; - C1* capture1_; - C2* capture2_; - C3* capture3_; - C4* capture4_; - C5* capture5_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester5); -}; -} // namespace rtc - -#endif // WEBRTC_BASE_SIGSLOTTESTER_H_ diff --git a/include/webrtc/base/socket.h b/include/webrtc/base/socket.h deleted file mode 100644 index 22326cb..0000000 --- a/include/webrtc/base/socket.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKET_H__ -#define WEBRTC_BASE_SOCKET_H__ - -#include - -#if defined(WEBRTC_POSIX) -#include -#include -#include -#include -#define SOCKET_EACCES EACCES -#endif - -#if defined(WEBRTC_WIN) -#include "webrtc/base/win32.h" -#endif - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/socketaddress.h" - -// Rather than converting errors into a private namespace, -// Reuse the POSIX socket api errors. Note this depends on -// Win32 compatibility. - -#if defined(WEBRTC_WIN) -#undef EWOULDBLOCK // Remove errno.h's definition for each macro below. -#define EWOULDBLOCK WSAEWOULDBLOCK -#undef EINPROGRESS -#define EINPROGRESS WSAEINPROGRESS -#undef EALREADY -#define EALREADY WSAEALREADY -#undef ENOTSOCK -#define ENOTSOCK WSAENOTSOCK -#undef EDESTADDRREQ -#define EDESTADDRREQ WSAEDESTADDRREQ -#undef EMSGSIZE -#define EMSGSIZE WSAEMSGSIZE -#undef EPROTOTYPE -#define EPROTOTYPE WSAEPROTOTYPE -#undef ENOPROTOOPT -#define ENOPROTOOPT WSAENOPROTOOPT -#undef EPROTONOSUPPORT -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#undef ESOCKTNOSUPPORT -#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -#undef EOPNOTSUPP -#define EOPNOTSUPP WSAEOPNOTSUPP -#undef EPFNOSUPPORT -#define EPFNOSUPPORT WSAEPFNOSUPPORT -#undef EAFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#undef EADDRINUSE -#define EADDRINUSE WSAEADDRINUSE -#undef EADDRNOTAVAIL -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#undef ENETDOWN -#define ENETDOWN WSAENETDOWN -#undef ENETUNREACH -#define ENETUNREACH WSAENETUNREACH -#undef ENETRESET -#define ENETRESET WSAENETRESET -#undef ECONNABORTED -#define ECONNABORTED WSAECONNABORTED -#undef ECONNRESET -#define ECONNRESET WSAECONNRESET -#undef ENOBUFS -#define ENOBUFS WSAENOBUFS -#undef EISCONN -#define EISCONN WSAEISCONN -#undef ENOTCONN -#define ENOTCONN WSAENOTCONN -#undef ESHUTDOWN -#define ESHUTDOWN WSAESHUTDOWN -#undef ETOOMANYREFS -#define ETOOMANYREFS WSAETOOMANYREFS -#undef ETIMEDOUT -#define ETIMEDOUT WSAETIMEDOUT -#undef ECONNREFUSED -#define ECONNREFUSED WSAECONNREFUSED -#undef ELOOP -#define ELOOP WSAELOOP -#undef ENAMETOOLONG -#define ENAMETOOLONG WSAENAMETOOLONG -#undef EHOSTDOWN -#define EHOSTDOWN WSAEHOSTDOWN -#undef EHOSTUNREACH -#define EHOSTUNREACH WSAEHOSTUNREACH -#undef ENOTEMPTY -#define ENOTEMPTY WSAENOTEMPTY -#undef EPROCLIM -#define EPROCLIM WSAEPROCLIM -#undef EUSERS -#define EUSERS WSAEUSERS -#undef EDQUOT -#define EDQUOT WSAEDQUOT -#undef ESTALE -#define ESTALE WSAESTALE -#undef EREMOTE -#define EREMOTE WSAEREMOTE -#undef EACCES -#define SOCKET_EACCES WSAEACCES -#endif // WEBRTC_WIN - -#if defined(WEBRTC_POSIX) -#define INVALID_SOCKET (-1) -#define SOCKET_ERROR (-1) -#define closesocket(s) close(s) -#endif // WEBRTC_POSIX - -namespace rtc { - -inline bool IsBlockingError(int e) { - return (e == EWOULDBLOCK) || (e == EAGAIN) || (e == EINPROGRESS); -} - -struct SentPacket { - SentPacket() : packet_id(-1), send_time_ms(-1) {} - SentPacket(int packet_id, int64_t send_time_ms) - : packet_id(packet_id), send_time_ms(send_time_ms) {} - - int packet_id; - int64_t send_time_ms; -}; - -// General interface for the socket implementations of various networks. The -// methods match those of normal UNIX sockets very closely. -class Socket { - public: - virtual ~Socket() {} - - // Returns the address to which the socket is bound. If the socket is not - // bound, then the any-address is returned. - virtual SocketAddress GetLocalAddress() const = 0; - - // Returns the address to which the socket is connected. If the socket is - // not connected, then the any-address is returned. - virtual SocketAddress GetRemoteAddress() const = 0; - - virtual int Bind(const SocketAddress& addr) = 0; - virtual int Connect(const SocketAddress& addr) = 0; - virtual int Send(const void *pv, size_t cb) = 0; - virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr) = 0; - virtual int Recv(void *pv, size_t cb) = 0; - virtual int RecvFrom(void *pv, size_t cb, SocketAddress *paddr) = 0; - virtual int Listen(int backlog) = 0; - virtual Socket *Accept(SocketAddress *paddr) = 0; - virtual int Close() = 0; - virtual int GetError() const = 0; - virtual void SetError(int error) = 0; - inline bool IsBlocking() const { return IsBlockingError(GetError()); } - - enum ConnState { - CS_CLOSED, - CS_CONNECTING, - CS_CONNECTED - }; - virtual ConnState GetState() const = 0; - - // Fills in the given uint16_t with the current estimate of the MTU along the - // path to the address to which this socket is connected. NOTE: This method - // can block for up to 10 seconds on Windows. - virtual int EstimateMTU(uint16_t* mtu) = 0; - - enum Option { - OPT_DONTFRAGMENT, - OPT_RCVBUF, // receive buffer size - OPT_SNDBUF, // send buffer size - OPT_NODELAY, // whether Nagle algorithm is enabled - OPT_IPV6_V6ONLY, // Whether the socket is IPv6 only. - OPT_DSCP, // DSCP code - OPT_RTP_SENDTIME_EXTN_ID, // This is a non-traditional socket option param. - // This is specific to libjingle and will be used - // if SendTime option is needed at socket level. - }; - virtual int GetOption(Option opt, int* value) = 0; - virtual int SetOption(Option opt, int value) = 0; - - protected: - Socket() {} - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(Socket); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKET_H__ diff --git a/include/webrtc/base/socket_unittest.h b/include/webrtc/base/socket_unittest.h deleted file mode 100644 index e4a6b32..0000000 --- a/include/webrtc/base/socket_unittest.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2009 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKET_UNITTEST_H_ -#define WEBRTC_BASE_SOCKET_UNITTEST_H_ - -#include "webrtc/base/gunit.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -// Generic socket tests, to be used when testing individual socketservers. -// Derive your specific test class from SocketTest, install your -// socketserver, and call the SocketTest test methods. -class SocketTest : public testing::Test { - protected: - SocketTest() : kIPv4Loopback(INADDR_LOOPBACK), - kIPv6Loopback(in6addr_loopback), - ss_(nullptr) {} - virtual void SetUp() { ss_ = Thread::Current()->socketserver(); } - void TestConnectIPv4(); - void TestConnectIPv6(); - void TestConnectWithDnsLookupIPv4(); - void TestConnectWithDnsLookupIPv6(); - void TestConnectFailIPv4(); - void TestConnectFailIPv6(); - void TestConnectWithDnsLookupFailIPv4(); - void TestConnectWithDnsLookupFailIPv6(); - void TestConnectWithClosedSocketIPv4(); - void TestConnectWithClosedSocketIPv6(); - void TestConnectWhileNotClosedIPv4(); - void TestConnectWhileNotClosedIPv6(); - void TestServerCloseDuringConnectIPv4(); - void TestServerCloseDuringConnectIPv6(); - void TestClientCloseDuringConnectIPv4(); - void TestClientCloseDuringConnectIPv6(); - void TestServerCloseIPv4(); - void TestServerCloseIPv6(); - void TestCloseInClosedCallbackIPv4(); - void TestCloseInClosedCallbackIPv6(); - void TestSocketServerWaitIPv4(); - void TestSocketServerWaitIPv6(); - void TestTcpIPv4(); - void TestTcpIPv6(); - void TestSingleFlowControlCallbackIPv4(); - void TestSingleFlowControlCallbackIPv6(); - void TestUdpIPv4(); - void TestUdpIPv6(); - void TestUdpReadyToSendIPv4(); - void TestUdpReadyToSendIPv6(); - void TestGetSetOptionsIPv4(); - void TestGetSetOptionsIPv6(); - - static const int kTimeout = 5000; // ms - const IPAddress kIPv4Loopback; - const IPAddress kIPv6Loopback; - - private: - void ConnectInternal(const IPAddress& loopback); - void ConnectWithDnsLookupInternal(const IPAddress& loopback, - const std::string& host); - void ConnectFailInternal(const IPAddress& loopback); - - void ConnectWithDnsLookupFailInternal(const IPAddress& loopback); - void ConnectWithClosedSocketInternal(const IPAddress& loopback); - void ConnectWhileNotClosedInternal(const IPAddress& loopback); - void ServerCloseDuringConnectInternal(const IPAddress& loopback); - void ClientCloseDuringConnectInternal(const IPAddress& loopback); - void ServerCloseInternal(const IPAddress& loopback); - void CloseInClosedCallbackInternal(const IPAddress& loopback); - void SocketServerWaitInternal(const IPAddress& loopback); - void TcpInternal(const IPAddress& loopback); - void SingleFlowControlCallbackInternal(const IPAddress& loopback); - void UdpInternal(const IPAddress& loopback); - void UdpReadyToSend(const IPAddress& loopback); - void GetSetOptionsInternal(const IPAddress& loopback); - - SocketServer* ss_; -}; - -// For unbound sockets, GetLocalAddress / GetRemoteAddress return AF_UNSPEC -// values on Windows, but an empty address of the same family on Linux/MacOS X. -bool IsUnspecOrEmptyIP(const IPAddress& address); - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKET_UNITTEST_H_ diff --git a/include/webrtc/base/socketadapters.h b/include/webrtc/base/socketadapters.h deleted file mode 100644 index ece591d..0000000 --- a/include/webrtc/base/socketadapters.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETADAPTERS_H_ -#define WEBRTC_BASE_SOCKETADAPTERS_H_ - -#include -#include - -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/cryptstring.h" -#include "webrtc/base/logging.h" - -namespace rtc { - -struct HttpAuthContext; -class ByteBuffer; - -/////////////////////////////////////////////////////////////////////////////// - -// Implements a socket adapter that can buffer and process data internally, -// as in the case of connecting to a proxy, where you must speak the proxy -// protocol before commencing normal socket behavior. -class BufferedReadAdapter : public AsyncSocketAdapter { - public: - BufferedReadAdapter(AsyncSocket* socket, size_t buffer_size); - ~BufferedReadAdapter() override; - - int Send(const void* pv, size_t cb) override; - int Recv(void* pv, size_t cb) override; - - protected: - int DirectSend(const void* pv, size_t cb) { - return AsyncSocketAdapter::Send(pv, cb); - } - - void BufferInput(bool on = true); - virtual void ProcessInput(char* data, size_t* len) = 0; - - void OnReadEvent(AsyncSocket* socket) override; - - private: - char * buffer_; - size_t buffer_size_, data_len_; - bool buffering_; - RTC_DISALLOW_COPY_AND_ASSIGN(BufferedReadAdapter); -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Interface for implementing proxy server sockets. -class AsyncProxyServerSocket : public BufferedReadAdapter { - public: - AsyncProxyServerSocket(AsyncSocket* socket, size_t buffer_size); - ~AsyncProxyServerSocket() override; - sigslot::signal2 SignalConnectRequest; - virtual void SendConnectResult(int err, const SocketAddress& addr) = 0; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Implements a socket adapter that performs the client side of a -// fake SSL handshake. Used for "ssltcp" P2P functionality. -class AsyncSSLSocket : public BufferedReadAdapter { - public: - explicit AsyncSSLSocket(AsyncSocket* socket); - - int Connect(const SocketAddress& addr) override; - - protected: - void OnConnectEvent(AsyncSocket* socket) override; - void ProcessInput(char* data, size_t* len) override; - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSSLSocket); -}; - -// Implements a socket adapter that performs the server side of a -// fake SSL handshake. Used when implementing a relay server that does "ssltcp". -class AsyncSSLServerSocket : public BufferedReadAdapter { - public: - explicit AsyncSSLServerSocket(AsyncSocket* socket); - - protected: - void ProcessInput(char* data, size_t* len) override; - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSSLServerSocket); -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Implements a socket adapter that speaks the HTTP/S proxy protocol. -class AsyncHttpsProxySocket : public BufferedReadAdapter { - public: - AsyncHttpsProxySocket(AsyncSocket* socket, const std::string& user_agent, - const SocketAddress& proxy, - const std::string& username, const CryptString& password); - ~AsyncHttpsProxySocket() override; - - // If connect is forced, the adapter will always issue an HTTP CONNECT to the - // target address. Otherwise, it will connect only if the destination port - // is not port 80. - void SetForceConnect(bool force) { force_connect_ = force; } - - int Connect(const SocketAddress& addr) override; - SocketAddress GetRemoteAddress() const override; - int Close() override; - ConnState GetState() const override; - - protected: - void OnConnectEvent(AsyncSocket* socket) override; - void OnCloseEvent(AsyncSocket* socket, int err) override; - void ProcessInput(char* data, size_t* len) override; - - bool ShouldIssueConnect() const; - void SendRequest(); - void ProcessLine(char* data, size_t len); - void EndResponse(); - void Error(int error); - - private: - SocketAddress proxy_, dest_; - std::string agent_, user_, headers_; - CryptString pass_; - bool force_connect_; - size_t content_length_; - int defer_error_; - bool expect_close_; - enum ProxyState { - PS_INIT, PS_LEADER, PS_AUTHENTICATE, PS_SKIP_HEADERS, PS_ERROR_HEADERS, - PS_TUNNEL_HEADERS, PS_SKIP_BODY, PS_TUNNEL, PS_WAIT_CLOSE, PS_ERROR - } state_; - HttpAuthContext * context_; - std::string unknown_mechanisms_; - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncHttpsProxySocket); -}; - -/* TODO: Implement this. -class AsyncHttpsProxyServerSocket : public AsyncProxyServerSocket { - public: - explicit AsyncHttpsProxyServerSocket(AsyncSocket* socket); - - private: - virtual void ProcessInput(char * data, size_t& len); - void Error(int error); - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncHttpsProxyServerSocket); -}; -*/ - -/////////////////////////////////////////////////////////////////////////////// - -// Implements a socket adapter that speaks the SOCKS proxy protocol. -class AsyncSocksProxySocket : public BufferedReadAdapter { - public: - AsyncSocksProxySocket(AsyncSocket* socket, const SocketAddress& proxy, - const std::string& username, const CryptString& password); - ~AsyncSocksProxySocket() override; - - int Connect(const SocketAddress& addr) override; - SocketAddress GetRemoteAddress() const override; - int Close() override; - ConnState GetState() const override; - - protected: - void OnConnectEvent(AsyncSocket* socket) override; - void ProcessInput(char* data, size_t* len) override; - - void SendHello(); - void SendConnect(); - void SendAuth(); - void Error(int error); - - private: - enum State { - SS_INIT, SS_HELLO, SS_AUTH, SS_CONNECT, SS_TUNNEL, SS_ERROR - }; - State state_; - SocketAddress proxy_, dest_; - std::string user_; - CryptString pass_; - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSocksProxySocket); -}; - -// Implements a proxy server socket for the SOCKS protocol. -class AsyncSocksProxyServerSocket : public AsyncProxyServerSocket { - public: - explicit AsyncSocksProxyServerSocket(AsyncSocket* socket); - - private: - void ProcessInput(char* data, size_t* len) override; - void DirectSend(const ByteBuffer& buf); - - void HandleHello(ByteBuffer* request); - void SendHelloReply(uint8_t method); - void HandleAuth(ByteBuffer* request); - void SendAuthReply(uint8_t result); - void HandleConnect(ByteBuffer* request); - void SendConnectResult(int result, const SocketAddress& addr) override; - - void Error(int error); - - static const int kBufferSize = 1024; - enum State { - SS_HELLO, SS_AUTH, SS_CONNECT, SS_CONNECT_PENDING, SS_TUNNEL, SS_ERROR - }; - State state_; - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSocksProxyServerSocket); -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Implements a socket adapter that logs everything that it sends and receives. -class LoggingSocketAdapter : public AsyncSocketAdapter { - public: - LoggingSocketAdapter(AsyncSocket* socket, LoggingSeverity level, - const char * label, bool hex_mode = false); - - int Send(const void* pv, size_t cb) override; - int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override; - int Recv(void* pv, size_t cb) override; - int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override; - int Close() override; - - protected: - void OnConnectEvent(AsyncSocket* socket) override; - void OnCloseEvent(AsyncSocket* socket, int err) override; - - private: - LoggingSeverity level_; - std::string label_; - bool hex_mode_; - LogMultilineState lms_; - RTC_DISALLOW_COPY_AND_ASSIGN(LoggingSocketAdapter); -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETADAPTERS_H_ diff --git a/include/webrtc/base/socketaddress.h b/include/webrtc/base/socketaddress.h deleted file mode 100644 index 175d7a9..0000000 --- a/include/webrtc/base/socketaddress.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETADDRESS_H_ -#define WEBRTC_BASE_SOCKETADDRESS_H_ - -#include -#include -#include -#include "webrtc/base/basictypes.h" -#include "webrtc/base/ipaddress.h" - -#undef SetPort - -struct sockaddr_in; -struct sockaddr_storage; - -namespace rtc { - -// Records an IP address and port. -class SocketAddress { - public: - // Creates a nil address. - SocketAddress(); - - // Creates the address with the given host and port. Host may be a - // literal IP string or a hostname to be resolved later. - SocketAddress(const std::string& hostname, int port); - - // Creates the address with the given IP and port. - // IP is given as an integer in host byte order. V4 only, to be deprecated. - SocketAddress(uint32_t ip_as_host_order_integer, int port); - - // Creates the address with the given IP and port. - SocketAddress(const IPAddress& ip, int port); - - // Creates a copy of the given address. - SocketAddress(const SocketAddress& addr); - - // Resets to the nil address. - void Clear(); - - // Determines if this is a nil address (empty hostname, any IP, null port) - bool IsNil() const; - - // Returns true if ip and port are set. - bool IsComplete() const; - - // Replaces our address with the given one. - SocketAddress& operator=(const SocketAddress& addr); - - // Changes the IP of this address to the given one, and clears the hostname - // IP is given as an integer in host byte order. V4 only, to be deprecated.. - void SetIP(uint32_t ip_as_host_order_integer); - - // Changes the IP of this address to the given one, and clears the hostname. - void SetIP(const IPAddress& ip); - - // Changes the hostname of this address to the given one. - // Does not resolve the address; use Resolve to do so. - void SetIP(const std::string& hostname); - - // Sets the IP address while retaining the hostname. Useful for bypassing - // DNS for a pre-resolved IP. - // IP is given as an integer in host byte order. V4 only, to be deprecated. - void SetResolvedIP(uint32_t ip_as_host_order_integer); - - // Sets the IP address while retaining the hostname. Useful for bypassing - // DNS for a pre-resolved IP. - void SetResolvedIP(const IPAddress& ip); - - // Changes the port of this address to the given one. - void SetPort(int port); - - // Returns the hostname. - const std::string& hostname() const { return hostname_; } - - // Returns the IP address as a host byte order integer. - // Returns 0 for non-v4 addresses. - uint32_t ip() const; - - const IPAddress& ipaddr() const; - - int family() const {return ip_.family(); } - - // Returns the port part of this address. - uint16_t port() const; - - // Returns the scope ID associated with this address. Scope IDs are a - // necessary addition to IPv6 link-local addresses, with different network - // interfaces having different scope-ids for their link-local addresses. - // IPv4 address do not have scope_ids and sockaddr_in structures do not have - // a field for them. - int scope_id() const {return scope_id_; } - void SetScopeID(int id) { scope_id_ = id; } - - // Returns the 'host' portion of the address (hostname or IP) in a form - // suitable for use in a URI. If both IP and hostname are present, hostname - // is preferred. IPv6 addresses are enclosed in square brackets ('[' and ']'). - std::string HostAsURIString() const; - - // Same as HostAsURIString but anonymizes IP addresses by hiding the last - // part. - std::string HostAsSensitiveURIString() const; - - // Returns the port as a string. - std::string PortAsString() const; - - // Returns hostname:port or [hostname]:port. - std::string ToString() const; - - // Same as ToString but anonymizes it by hiding the last part. - std::string ToSensitiveString() const; - - // Parses hostname:port and [hostname]:port. - bool FromString(const std::string& str); - - friend std::ostream& operator<<(std::ostream& os, const SocketAddress& addr); - - // Determines whether this represents a missing / any IP address. - // That is, 0.0.0.0 or ::. - // Hostname and/or port may be set. - bool IsAnyIP() const; - - // Determines whether the IP address refers to a loopback address. - // For v4 addresses this means the address is in the range 127.0.0.0/8. - // For v6 addresses this means the address is ::1. - bool IsLoopbackIP() const; - - // Determines whether the IP address is in one of the private ranges: - // For v4: 127.0.0.0/8 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12. - // For v6: FE80::/16 and ::1. - bool IsPrivateIP() const; - - // Determines whether the hostname has been resolved to an IP. - bool IsUnresolvedIP() const; - - // Determines whether this address is identical to the given one. - bool operator ==(const SocketAddress& addr) const; - inline bool operator !=(const SocketAddress& addr) const { - return !this->operator ==(addr); - } - - // Compares based on IP and then port. - bool operator <(const SocketAddress& addr) const; - - // Determines whether this address has the same IP as the one given. - bool EqualIPs(const SocketAddress& addr) const; - - // Determines whether this address has the same port as the one given. - bool EqualPorts(const SocketAddress& addr) const; - - // Hashes this address into a small number. - size_t Hash() const; - - // Write this address to a sockaddr_in. - // If IPv6, will zero out the sockaddr_in and sets family to AF_UNSPEC. - void ToSockAddr(sockaddr_in* saddr) const; - - // Read this address from a sockaddr_in. - bool FromSockAddr(const sockaddr_in& saddr); - - // Read and write the address to/from a sockaddr_storage. - // Dual stack version always sets family to AF_INET6, and maps v4 addresses. - // The other version doesn't map, and outputs an AF_INET address for - // v4 or mapped addresses, and AF_INET6 addresses for others. - // Returns the size of the sockaddr_in or sockaddr_in6 structure that is - // written to the sockaddr_storage, or zero on failure. - size_t ToDualStackSockAddrStorage(sockaddr_storage* saddr) const; - size_t ToSockAddrStorage(sockaddr_storage* saddr) const; - - private: - std::string hostname_; - IPAddress ip_; - uint16_t port_; - int scope_id_; - bool literal_; // Indicates that 'hostname_' contains a literal IP string. -}; - -bool SocketAddressFromSockAddrStorage(const sockaddr_storage& saddr, - SocketAddress* out); -SocketAddress EmptySocketAddressWithFamily(int family); - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETADDRESS_H_ diff --git a/include/webrtc/base/socketaddresspair.h b/include/webrtc/base/socketaddresspair.h deleted file mode 100644 index 73a627f..0000000 --- a/include/webrtc/base/socketaddresspair.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETADDRESSPAIR_H__ -#define WEBRTC_BASE_SOCKETADDRESSPAIR_H__ - -#include "webrtc/base/socketaddress.h" - -namespace rtc { - -// Records a pair (source,destination) of socket addresses. The two addresses -// identify a connection between two machines. (For UDP, this "connection" is -// not maintained explicitly in a socket.) -class SocketAddressPair { -public: - SocketAddressPair() {} - SocketAddressPair(const SocketAddress& srs, const SocketAddress& dest); - - const SocketAddress& source() const { return src_; } - const SocketAddress& destination() const { return dest_; } - - bool operator ==(const SocketAddressPair& r) const; - bool operator <(const SocketAddressPair& r) const; - - size_t Hash() const; - -private: - SocketAddress src_; - SocketAddress dest_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETADDRESSPAIR_H__ diff --git a/include/webrtc/base/socketfactory.h b/include/webrtc/base/socketfactory.h deleted file mode 100644 index fe0f32b..0000000 --- a/include/webrtc/base/socketfactory.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETFACTORY_H__ -#define WEBRTC_BASE_SOCKETFACTORY_H__ - -#include "webrtc/base/socket.h" -#include "webrtc/base/asyncsocket.h" - -namespace rtc { - -class SocketFactory { -public: - virtual ~SocketFactory() {} - - // Returns a new socket for blocking communication. The type can be - // SOCK_DGRAM and SOCK_STREAM. - // TODO: C++ inheritance rules mean that all users must have both - // CreateSocket(int) and CreateSocket(int,int). Will remove CreateSocket(int) - // (and CreateAsyncSocket(int) when all callers are changed. - virtual Socket* CreateSocket(int type) = 0; - virtual Socket* CreateSocket(int family, int type) = 0; - // Returns a new socket for nonblocking communication. The type can be - // SOCK_DGRAM and SOCK_STREAM. - virtual AsyncSocket* CreateAsyncSocket(int type) = 0; - virtual AsyncSocket* CreateAsyncSocket(int family, int type) = 0; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETFACTORY_H__ diff --git a/include/webrtc/base/socketpool.h b/include/webrtc/base/socketpool.h deleted file mode 100644 index 5ceab20..0000000 --- a/include/webrtc/base/socketpool.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETPOOL_H_ -#define WEBRTC_BASE_SOCKETPOOL_H_ - -#include -#include -#include "webrtc/base/logging.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketaddress.h" - -namespace rtc { - -class AsyncSocket; -class LoggingAdapter; -class SocketFactory; -class SocketStream; -class StreamInterface; - -////////////////////////////////////////////////////////////////////// -// StreamPool -////////////////////////////////////////////////////////////////////// - -class StreamPool { -public: - virtual ~StreamPool() { } - - virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote, - int* err) = 0; - virtual void ReturnConnectedStream(StreamInterface* stream) = 0; -}; - -/////////////////////////////////////////////////////////////////////////////// -// StreamCache - Caches a set of open streams, defers creation/destruction to -// the supplied StreamPool. -/////////////////////////////////////////////////////////////////////////////// - -class StreamCache : public StreamPool, public sigslot::has_slots<> { -public: - StreamCache(StreamPool* pool); - ~StreamCache() override; - - // StreamPool Interface - StreamInterface* RequestConnectedStream(const SocketAddress& remote, - int* err) override; - void ReturnConnectedStream(StreamInterface* stream) override; - -private: - typedef std::pair ConnectedStream; - typedef std::list ConnectedList; - - void OnStreamEvent(StreamInterface* stream, int events, int err); - - // We delegate stream creation and deletion to this pool. - StreamPool* pool_; - // Streams that are in use (returned from RequestConnectedStream). - ConnectedList active_; - // Streams which were returned to us, but are still open. - ConnectedList cached_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// NewSocketPool -// Creates a new stream on every request -/////////////////////////////////////////////////////////////////////////////// - -class NewSocketPool : public StreamPool { -public: - NewSocketPool(SocketFactory* factory); - ~NewSocketPool() override; - - // StreamPool Interface - StreamInterface* RequestConnectedStream(const SocketAddress& remote, - int* err) override; - void ReturnConnectedStream(StreamInterface* stream) override; - -private: - SocketFactory* factory_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// ReuseSocketPool -// Maintains a single socket at a time, and will reuse it without closing if -// the destination address is the same. -/////////////////////////////////////////////////////////////////////////////// - -class ReuseSocketPool : public StreamPool, public sigslot::has_slots<> { -public: - ReuseSocketPool(SocketFactory* factory); - ~ReuseSocketPool() override; - - // StreamPool Interface - StreamInterface* RequestConnectedStream(const SocketAddress& remote, - int* err) override; - void ReturnConnectedStream(StreamInterface* stream) override; - -private: - void OnStreamEvent(StreamInterface* stream, int events, int err); - - SocketFactory* factory_; - SocketStream* stream_; - SocketAddress remote_; - bool checked_out_; // Whether the stream is currently checked out -}; - -/////////////////////////////////////////////////////////////////////////////// -// LoggingPoolAdapter - Adapts a StreamPool to supply streams with attached -// LoggingAdapters. -/////////////////////////////////////////////////////////////////////////////// - -class LoggingPoolAdapter : public StreamPool { -public: - LoggingPoolAdapter(StreamPool* pool, LoggingSeverity level, - const std::string& label, bool binary_mode); - ~LoggingPoolAdapter() override; - - // StreamPool Interface - StreamInterface* RequestConnectedStream(const SocketAddress& remote, - int* err) override; - void ReturnConnectedStream(StreamInterface* stream) override; - -private: - StreamPool* pool_; - LoggingSeverity level_; - std::string label_; - bool binary_mode_; - typedef std::deque StreamList; - StreamList recycle_bin_; -}; - -////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETPOOL_H_ diff --git a/include/webrtc/base/socketserver.h b/include/webrtc/base/socketserver.h deleted file mode 100644 index 15c56f4..0000000 --- a/include/webrtc/base/socketserver.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETSERVER_H_ -#define WEBRTC_BASE_SOCKETSERVER_H_ - -#include "webrtc/base/socketfactory.h" - -namespace rtc { - -class MessageQueue; - -// Provides the ability to wait for activity on a set of sockets. The Thread -// class provides a nice wrapper on a socket server. -// -// The server is also a socket factory. The sockets it creates will be -// notified of asynchronous I/O from this server's Wait method. -class SocketServer : public SocketFactory { - public: - static const int kForever = -1; - - // When the socket server is installed into a Thread, this function is - // called to allow the socket server to use the thread's message queue for - // any messaging that it might need to perform. - virtual void SetMessageQueue(MessageQueue* queue) {} - - // Sleeps until: - // 1) cms milliseconds have elapsed (unless cms == kForever) - // 2) WakeUp() is called - // While sleeping, I/O is performed if process_io is true. - virtual bool Wait(int cms, bool process_io) = 0; - - // Causes the current wait (if one is in progress) to wake up. - virtual void WakeUp() = 0; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETSERVER_H_ diff --git a/include/webrtc/base/socketstream.h b/include/webrtc/base/socketstream.h deleted file mode 100644 index fd8b559..0000000 --- a/include/webrtc/base/socketstream.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2005 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SOCKETSTREAM_H_ -#define WEBRTC_BASE_SOCKETSTREAM_H_ - -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/common.h" -#include "webrtc/base/stream.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// - -class SocketStream : public StreamInterface, public sigslot::has_slots<> { - public: - explicit SocketStream(AsyncSocket* socket); - ~SocketStream() override; - - void Attach(AsyncSocket* socket); - AsyncSocket* Detach(); - - AsyncSocket* GetSocket() { return socket_; } - - StreamState GetState() const override; - - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - - void Close() override; - - private: - void OnConnectEvent(AsyncSocket* socket); - void OnReadEvent(AsyncSocket* socket); - void OnWriteEvent(AsyncSocket* socket); - void OnCloseEvent(AsyncSocket* socket, int err); - - AsyncSocket* socket_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SocketStream); -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_SOCKETSTREAM_H_ diff --git a/include/webrtc/base/ssladapter.h b/include/webrtc/base/ssladapter.h deleted file mode 100644 index 57e8ee9..0000000 --- a/include/webrtc/base/ssladapter.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SSLADAPTER_H_ -#define WEBRTC_BASE_SSLADAPTER_H_ - -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/sslstreamadapter.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// - -class SSLAdapter : public AsyncSocketAdapter { - public: - explicit SSLAdapter(AsyncSocket* socket) - : AsyncSocketAdapter(socket), ignore_bad_cert_(false) { } - - bool ignore_bad_cert() const { return ignore_bad_cert_; } - void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } - - // Do DTLS or TLS (default is TLS, if unspecified) - virtual void SetMode(SSLMode mode) = 0; - - // StartSSL returns 0 if successful. - // If StartSSL is called while the socket is closed or connecting, the SSL - // negotiation will begin as soon as the socket connects. - virtual int StartSSL(const char* hostname, bool restartable) = 0; - - // Create the default SSL adapter for this platform. On failure, returns NULL - // and deletes |socket|. Otherwise, the returned SSLAdapter takes ownership - // of |socket|. - static SSLAdapter* Create(AsyncSocket* socket); - - private: - // If true, the server certificate need not match the configured hostname. - bool ignore_bad_cert_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -typedef bool (*VerificationCallback)(void* cert); - -// Call this on the main thread, before using SSL. -// Call CleanupSSLThread when finished with SSL. -bool InitializeSSL(VerificationCallback callback = NULL); - -// Call to initialize additional threads. -bool InitializeSSLThread(); - -// Call to cleanup additional threads, and also the main thread. -bool CleanupSSL(); - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_SSLADAPTER_H_ diff --git a/include/webrtc/base/sslconfig.h b/include/webrtc/base/sslconfig.h deleted file mode 100644 index 6aabad0..0000000 --- a/include/webrtc/base/sslconfig.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SSLCONFIG_H_ -#define WEBRTC_BASE_SSLCONFIG_H_ - -// If no preference has been indicated, default to SChannel on Windows and -// OpenSSL everywhere else, if it is available. -#if !defined(SSL_USE_SCHANNEL) && !defined(SSL_USE_OPENSSL) -#if defined(WEBRTC_WIN) - -#define SSL_USE_SCHANNEL 1 - -#else // defined(WEBRTC_WIN) - -#if defined(HAVE_OPENSSL_SSL_H) -#define SSL_USE_OPENSSL 1 -#endif - -#endif // !defined(WEBRTC_WIN) -#endif - -#endif // WEBRTC_BASE_SSLCONFIG_H_ diff --git a/include/webrtc/base/sslfingerprint.h b/include/webrtc/base/sslfingerprint.h deleted file mode 100644 index 735238d..0000000 --- a/include/webrtc/base/sslfingerprint.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SSLFINGERPRINT_H_ -#define WEBRTC_BASE_SSLFINGERPRINT_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/sslidentity.h" - -namespace rtc { - -class SSLCertificate; - -struct SSLFingerprint { - static SSLFingerprint* Create(const std::string& algorithm, - const rtc::SSLIdentity* identity); - - static SSLFingerprint* Create(const std::string& algorithm, - const rtc::SSLCertificate* cert); - - static SSLFingerprint* CreateFromRfc4572(const std::string& algorithm, - const std::string& fingerprint); - - SSLFingerprint(const std::string& algorithm, - const uint8_t* digest_in, - size_t digest_len); - - SSLFingerprint(const SSLFingerprint& from); - - bool operator==(const SSLFingerprint& other) const; - - std::string GetRfc4572Fingerprint() const; - - std::string ToString(); - - std::string algorithm; - rtc::Buffer digest; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SSLFINGERPRINT_H_ diff --git a/include/webrtc/base/sslidentity.h b/include/webrtc/base/sslidentity.h deleted file mode 100644 index a143ee4..0000000 --- a/include/webrtc/base/sslidentity.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Handling of certificates and keypairs for SSLStreamAdapter's peer mode. - -#ifndef WEBRTC_BASE_SSLIDENTITY_H_ -#define WEBRTC_BASE_SSLIDENTITY_H_ - -#include -#include -#include - -#include "webrtc/base/buffer.h" -#include "webrtc/base/messagedigest.h" -#include "webrtc/base/timeutils.h" - -namespace rtc { - -// Forward declaration due to circular dependency with SSLCertificate. -class SSLCertChain; - -// Abstract interface overridden by SSL library specific -// implementations. - -// A somewhat opaque type used to encapsulate a certificate. -// Wraps the SSL library's notion of a certificate, with reference counting. -// The SSLCertificate object is pretty much immutable once created. -// (The OpenSSL implementation only does reference counting and -// possibly caching of intermediate results.) -class SSLCertificate { - public: - // Parses and build a certificate from a PEM encoded string. - // Returns NULL on failure. - // The length of the string representation of the certificate is - // stored in *pem_length if it is non-NULL, and only if - // parsing was successful. - // Caller is responsible for freeing the returned object. - static SSLCertificate* FromPEMString(const std::string& pem_string); - virtual ~SSLCertificate() {} - - // Returns a new SSLCertificate object instance wrapping the same - // underlying certificate, including its chain if present. - // Caller is responsible for freeing the returned object. - virtual SSLCertificate* GetReference() const = 0; - - // Provides the cert chain, or returns false. The caller owns the chain. - // The chain includes a copy of each certificate, excluding the leaf. - virtual bool GetChain(SSLCertChain** chain) const = 0; - - // Returns a PEM encoded string representation of the certificate. - virtual std::string ToPEMString() const = 0; - - // Provides a DER encoded binary representation of the certificate. - virtual void ToDER(Buffer* der_buffer) const = 0; - - // Gets the name of the digest algorithm that was used to compute this - // certificate's signature. - virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const = 0; - - // Compute the digest of the certificate given algorithm - virtual bool ComputeDigest(const std::string& algorithm, - unsigned char* digest, - size_t size, - size_t* length) const = 0; - - // Returns the time in seconds relative to epoch, 1970-01-01T00:00:00Z (UTC), - // or -1 if an expiration time could not be retrieved. - virtual int64_t CertificateExpirationTime() const = 0; -}; - -// SSLCertChain is a simple wrapper for a vector of SSLCertificates. It serves -// primarily to ensure proper memory management (especially deletion) of the -// SSLCertificate pointers. -class SSLCertChain { - public: - // These constructors copy the provided SSLCertificate(s), so the caller - // retains ownership. - explicit SSLCertChain(const std::vector& certs); - explicit SSLCertChain(const SSLCertificate* cert); - ~SSLCertChain(); - - // Vector access methods. - size_t GetSize() const { return certs_.size(); } - - // Returns a temporary reference, only valid until the chain is destroyed. - const SSLCertificate& Get(size_t pos) const { return *(certs_[pos]); } - - // Returns a new SSLCertChain object instance wrapping the same underlying - // certificate chain. Caller is responsible for freeing the returned object. - SSLCertChain* Copy() const { - return new SSLCertChain(certs_); - } - - private: - // Helper function for duplicating a vector of certificates. - static SSLCertificate* DupCert(const SSLCertificate* cert) { - return cert->GetReference(); - } - - // Helper function for deleting a vector of certificates. - static void DeleteCert(SSLCertificate* cert) { delete cert; } - - std::vector certs_; - - RTC_DISALLOW_COPY_AND_ASSIGN(SSLCertChain); -}; - -// KT_DEFAULT is currently an alias for KT_RSA. This is likely to change. -// KT_LAST is intended for vector declarations and loops over all key types; -// it does not represent any key type in itself. -// TODO(hbos,torbjorng): Don't change KT_DEFAULT without first updating -// PeerConnectionFactory_nativeCreatePeerConnection's certificate generation -// code. -enum KeyType { KT_RSA, KT_ECDSA, KT_LAST, KT_DEFAULT = KT_RSA }; - -static const int kRsaDefaultModSize = 1024; -static const int kRsaDefaultExponent = 0x10001; // = 2^16+1 = 65537 -static const int kRsaMinModSize = 1024; -static const int kRsaMaxModSize = 8192; - -struct RSAParams { - unsigned int mod_size; - unsigned int pub_exp; -}; - -enum ECCurve { EC_NIST_P256, /* EC_FANCY, */ EC_LAST }; - -class KeyParams { - public: - // Generate a KeyParams object from a simple KeyType, using default params. - explicit KeyParams(KeyType key_type = KT_DEFAULT); - - // Generate a a KeyParams for RSA with explicit parameters. - static KeyParams RSA(int mod_size = kRsaDefaultModSize, - int pub_exp = kRsaDefaultExponent); - - // Generate a a KeyParams for ECDSA specifying the curve. - static KeyParams ECDSA(ECCurve curve = EC_NIST_P256); - - // Check validity of a KeyParams object. Since the factory functions have - // no way of returning errors, this function can be called after creation - // to make sure the parameters are OK. - bool IsValid() const; - - RSAParams rsa_params() const; - - ECCurve ec_curve() const; - - KeyType type() const { return type_; } - - private: - KeyType type_; - union { - RSAParams rsa; - ECCurve curve; - } params_; -}; - -// TODO(hbos): Remove once rtc::KeyType (to be modified) and -// blink::WebRTCKeyType (to be landed) match. By using this function in Chromium -// appropriately we can change KeyType enum -> class without breaking Chromium. -KeyType IntKeyTypeFamilyToKeyType(int key_type_family); - -// Parameters for generating a certificate. If |common_name| is non-empty, it -// will be used for the certificate's subject and issuer name, otherwise a -// random string will be used. -struct SSLIdentityParams { - std::string common_name; - time_t not_before; // Absolute time since epoch in seconds. - time_t not_after; // Absolute time since epoch in seconds. - KeyParams key_params; -}; - -// Our identity in an SSL negotiation: a keypair and certificate (both -// with the same public key). -// This too is pretty much immutable once created. -class SSLIdentity { - public: - // Generates an identity (keypair and self-signed certificate). If - // common_name is non-empty, it will be used for the certificate's - // subject and issuer name, otherwise a random string will be used. - // Returns NULL on failure. - // Caller is responsible for freeing the returned object. - static SSLIdentity* Generate(const std::string& common_name, - const KeyParams& key_param); - static SSLIdentity* Generate(const std::string& common_name, - KeyType key_type) { - return Generate(common_name, KeyParams(key_type)); - } - - // Generates an identity with the specified validity period. - static SSLIdentity* GenerateForTest(const SSLIdentityParams& params); - - // Construct an identity from a private key and a certificate. - static SSLIdentity* FromPEMStrings(const std::string& private_key, - const std::string& certificate); - - virtual ~SSLIdentity() {} - - // Returns a new SSLIdentity object instance wrapping the same - // identity information. - // Caller is responsible for freeing the returned object. - // TODO(hbos,torbjorng): Rename to a less confusing name. - virtual SSLIdentity* GetReference() const = 0; - - // Returns a temporary reference to the certificate. - virtual const SSLCertificate& certificate() const = 0; - - // Helpers for parsing converting between PEM and DER format. - static bool PemToDer(const std::string& pem_type, - const std::string& pem_string, - std::string* der); - static std::string DerToPem(const std::string& pem_type, - const unsigned char* data, - size_t length); -}; - -// Convert from ASN1 time as restricted by RFC 5280 to seconds from 1970-01-01 -// 00.00 ("epoch"). If the ASN1 time cannot be read, return -1. The data at -// |s| is not 0-terminated; its char count is defined by |length|. -int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format); - -extern const char kPemTypeCertificate[]; -extern const char kPemTypeRsaPrivateKey[]; -extern const char kPemTypeEcPrivateKey[]; - -} // namespace rtc - -#endif // WEBRTC_BASE_SSLIDENTITY_H_ diff --git a/include/webrtc/base/sslroots.h b/include/webrtc/base/sslroots.h deleted file mode 100644 index 0464ac8..0000000 --- a/include/webrtc/base/sslroots.h +++ /dev/null @@ -1,4266 +0,0 @@ -// This file is the root certificates in C form that are needed to connect to -// Google. - -// It was generated with the following command line: -// > python tools/sslroots/generate_sslroots.py -// https://pki.google.com/roots.pem - -/* subject:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA */ -/* issuer :/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA */ - - -const unsigned char GlobalSign_Root_CA_certificate[889]={ -0x30,0x82,0x03,0x75,0x30,0x82,0x02,0x5D,0xA0,0x03,0x02,0x01,0x02,0x02,0x0B,0x04, -0x00,0x00,0x00,0x00,0x01,0x15,0x4B,0x5A,0xC3,0x94,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x57,0x31,0x0B,0x30,0x09,0x06, -0x03,0x55,0x04,0x06,0x13,0x02,0x42,0x45,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04, -0x0A,0x13,0x10,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x20,0x6E,0x76, -0x2D,0x73,0x61,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x0B,0x13,0x07,0x52,0x6F, -0x6F,0x74,0x20,0x43,0x41,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x03,0x13,0x12, -0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x20,0x52,0x6F,0x6F,0x74,0x20, -0x43,0x41,0x30,0x1E,0x17,0x0D,0x39,0x38,0x30,0x39,0x30,0x31,0x31,0x32,0x30,0x30, -0x30,0x30,0x5A,0x17,0x0D,0x32,0x38,0x30,0x31,0x32,0x38,0x31,0x32,0x30,0x30,0x30, -0x30,0x5A,0x30,0x57,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x42, -0x45,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0A,0x13,0x10,0x47,0x6C,0x6F,0x62, -0x61,0x6C,0x53,0x69,0x67,0x6E,0x20,0x6E,0x76,0x2D,0x73,0x61,0x31,0x10,0x30,0x0E, -0x06,0x03,0x55,0x04,0x0B,0x13,0x07,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x03,0x13,0x12,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53, -0x69,0x67,0x6E,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82, -0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xDA,0x0E,0xE6,0x99, -0x8D,0xCE,0xA3,0xE3,0x4F,0x8A,0x7E,0xFB,0xF1,0x8B,0x83,0x25,0x6B,0xEA,0x48,0x1F, -0xF1,0x2A,0xB0,0xB9,0x95,0x11,0x04,0xBD,0xF0,0x63,0xD1,0xE2,0x67,0x66,0xCF,0x1C, -0xDD,0xCF,0x1B,0x48,0x2B,0xEE,0x8D,0x89,0x8E,0x9A,0xAF,0x29,0x80,0x65,0xAB,0xE9, -0xC7,0x2D,0x12,0xCB,0xAB,0x1C,0x4C,0x70,0x07,0xA1,0x3D,0x0A,0x30,0xCD,0x15,0x8D, -0x4F,0xF8,0xDD,0xD4,0x8C,0x50,0x15,0x1C,0xEF,0x50,0xEE,0xC4,0x2E,0xF7,0xFC,0xE9, -0x52,0xF2,0x91,0x7D,0xE0,0x6D,0xD5,0x35,0x30,0x8E,0x5E,0x43,0x73,0xF2,0x41,0xE9, -0xD5,0x6A,0xE3,0xB2,0x89,0x3A,0x56,0x39,0x38,0x6F,0x06,0x3C,0x88,0x69,0x5B,0x2A, -0x4D,0xC5,0xA7,0x54,0xB8,0x6C,0x89,0xCC,0x9B,0xF9,0x3C,0xCA,0xE5,0xFD,0x89,0xF5, -0x12,0x3C,0x92,0x78,0x96,0xD6,0xDC,0x74,0x6E,0x93,0x44,0x61,0xD1,0x8D,0xC7,0x46, -0xB2,0x75,0x0E,0x86,0xE8,0x19,0x8A,0xD5,0x6D,0x6C,0xD5,0x78,0x16,0x95,0xA2,0xE9, -0xC8,0x0A,0x38,0xEB,0xF2,0x24,0x13,0x4F,0x73,0x54,0x93,0x13,0x85,0x3A,0x1B,0xBC, -0x1E,0x34,0xB5,0x8B,0x05,0x8C,0xB9,0x77,0x8B,0xB1,0xDB,0x1F,0x20,0x91,0xAB,0x09, -0x53,0x6E,0x90,0xCE,0x7B,0x37,0x74,0xB9,0x70,0x47,0x91,0x22,0x51,0x63,0x16,0x79, -0xAE,0xB1,0xAE,0x41,0x26,0x08,0xC8,0x19,0x2B,0xD1,0x46,0xAA,0x48,0xD6,0x64,0x2A, -0xD7,0x83,0x34,0xFF,0x2C,0x2A,0xC1,0x6C,0x19,0x43,0x4A,0x07,0x85,0xE7,0xD3,0x7C, -0xF6,0x21,0x68,0xEF,0xEA,0xF2,0x52,0x9F,0x7F,0x93,0x90,0xCF,0x02,0x03,0x01,0x00, -0x01,0xA3,0x42,0x30,0x40,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04, -0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04, -0x14,0x60,0x7B,0x66,0x1A,0x45,0x0D,0x97,0xCA,0x89,0x50,0x2F,0x7D,0x04,0xCD,0x34, -0xA8,0xFF,0xFC,0xFD,0x4B,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0xD6,0x73,0xE7,0x7C,0x4F,0x76,0xD0, -0x8D,0xBF,0xEC,0xBA,0xA2,0xBE,0x34,0xC5,0x28,0x32,0xB5,0x7C,0xFC,0x6C,0x9C,0x2C, -0x2B,0xBD,0x09,0x9E,0x53,0xBF,0x6B,0x5E,0xAA,0x11,0x48,0xB6,0xE5,0x08,0xA3,0xB3, -0xCA,0x3D,0x61,0x4D,0xD3,0x46,0x09,0xB3,0x3E,0xC3,0xA0,0xE3,0x63,0x55,0x1B,0xF2, -0xBA,0xEF,0xAD,0x39,0xE1,0x43,0xB9,0x38,0xA3,0xE6,0x2F,0x8A,0x26,0x3B,0xEF,0xA0, -0x50,0x56,0xF9,0xC6,0x0A,0xFD,0x38,0xCD,0xC4,0x0B,0x70,0x51,0x94,0x97,0x98,0x04, -0xDF,0xC3,0x5F,0x94,0xD5,0x15,0xC9,0x14,0x41,0x9C,0xC4,0x5D,0x75,0x64,0x15,0x0D, -0xFF,0x55,0x30,0xEC,0x86,0x8F,0xFF,0x0D,0xEF,0x2C,0xB9,0x63,0x46,0xF6,0xAA,0xFC, -0xDF,0xBC,0x69,0xFD,0x2E,0x12,0x48,0x64,0x9A,0xE0,0x95,0xF0,0xA6,0xEF,0x29,0x8F, -0x01,0xB1,0x15,0xB5,0x0C,0x1D,0xA5,0xFE,0x69,0x2C,0x69,0x24,0x78,0x1E,0xB3,0xA7, -0x1C,0x71,0x62,0xEE,0xCA,0xC8,0x97,0xAC,0x17,0x5D,0x8A,0xC2,0xF8,0x47,0x86,0x6E, -0x2A,0xC4,0x56,0x31,0x95,0xD0,0x67,0x89,0x85,0x2B,0xF9,0x6C,0xA6,0x5D,0x46,0x9D, -0x0C,0xAA,0x82,0xE4,0x99,0x51,0xDD,0x70,0xB7,0xDB,0x56,0x3D,0x61,0xE4,0x6A,0xE1, -0x5C,0xD6,0xF6,0xFE,0x3D,0xDE,0x41,0xCC,0x07,0xAE,0x63,0x52,0xBF,0x53,0x53,0xF4, -0x2B,0xE9,0xC7,0xFD,0xB6,0xF7,0x82,0x5F,0x85,0xD2,0x41,0x18,0xDB,0x81,0xB3,0x04, -0x1C,0xC5,0x1F,0xA4,0x80,0x6F,0x15,0x20,0xC9,0xDE,0x0C,0x88,0x0A,0x1D,0xD6,0x66, -0x55,0xE2,0xFC,0x48,0xC9,0x29,0x26,0x69,0xE0, -}; - - -/* subject:/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust RSA Certification Authority */ -/* issuer :/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust RSA Certification Authority */ - - -const unsigned char USERTrust_RSA_Certification_Authority_certificate[1506]={ -0x30,0x82,0x05,0xDE,0x30,0x82,0x03,0xC6,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x01, -0xFD,0x6D,0x30,0xFC,0xA3,0xCA,0x51,0xA8,0x1B,0xBC,0x64,0x0E,0x35,0x03,0x2D,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C,0x05,0x00,0x30,0x81, -0x88,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13, -0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x4E,0x65,0x77,0x20,0x4A,0x65,0x72, -0x73,0x65,0x79,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x07,0x13,0x0B,0x4A,0x65, -0x72,0x73,0x65,0x79,0x20,0x43,0x69,0x74,0x79,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55, -0x04,0x0A,0x13,0x15,0x54,0x68,0x65,0x20,0x55,0x53,0x45,0x52,0x54,0x52,0x55,0x53, -0x54,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55, -0x04,0x03,0x13,0x25,0x55,0x53,0x45,0x52,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x53, -0x41,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20, -0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x31,0x30,0x30, -0x32,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31, -0x31,0x38,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0x88,0x31,0x0B,0x30,0x09, -0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55, -0x04,0x08,0x13,0x0A,0x4E,0x65,0x77,0x20,0x4A,0x65,0x72,0x73,0x65,0x79,0x31,0x14, -0x30,0x12,0x06,0x03,0x55,0x04,0x07,0x13,0x0B,0x4A,0x65,0x72,0x73,0x65,0x79,0x20, -0x43,0x69,0x74,0x79,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0A,0x13,0x15,0x54, -0x68,0x65,0x20,0x55,0x53,0x45,0x52,0x54,0x52,0x55,0x53,0x54,0x20,0x4E,0x65,0x74, -0x77,0x6F,0x72,0x6B,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x03,0x13,0x25,0x55, -0x53,0x45,0x52,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x53,0x41,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F, -0x72,0x69,0x74,0x79,0x30,0x82,0x02,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x02,0x0F,0x00,0x30,0x82,0x02,0x0A, -0x02,0x82,0x02,0x01,0x00,0x80,0x12,0x65,0x17,0x36,0x0E,0xC3,0xDB,0x08,0xB3,0xD0, -0xAC,0x57,0x0D,0x76,0xED,0xCD,0x27,0xD3,0x4C,0xAD,0x50,0x83,0x61,0xE2,0xAA,0x20, -0x4D,0x09,0x2D,0x64,0x09,0xDC,0xCE,0x89,0x9F,0xCC,0x3D,0xA9,0xEC,0xF6,0xCF,0xC1, -0xDC,0xF1,0xD3,0xB1,0xD6,0x7B,0x37,0x28,0x11,0x2B,0x47,0xDA,0x39,0xC6,0xBC,0x3A, -0x19,0xB4,0x5F,0xA6,0xBD,0x7D,0x9D,0xA3,0x63,0x42,0xB6,0x76,0xF2,0xA9,0x3B,0x2B, -0x91,0xF8,0xE2,0x6F,0xD0,0xEC,0x16,0x20,0x90,0x09,0x3E,0xE2,0xE8,0x74,0xC9,0x18, -0xB4,0x91,0xD4,0x62,0x64,0xDB,0x7F,0xA3,0x06,0xF1,0x88,0x18,0x6A,0x90,0x22,0x3C, -0xBC,0xFE,0x13,0xF0,0x87,0x14,0x7B,0xF6,0xE4,0x1F,0x8E,0xD4,0xE4,0x51,0xC6,0x11, -0x67,0x46,0x08,0x51,0xCB,0x86,0x14,0x54,0x3F,0xBC,0x33,0xFE,0x7E,0x6C,0x9C,0xFF, -0x16,0x9D,0x18,0xBD,0x51,0x8E,0x35,0xA6,0xA7,0x66,0xC8,0x72,0x67,0xDB,0x21,0x66, -0xB1,0xD4,0x9B,0x78,0x03,0xC0,0x50,0x3A,0xE8,0xCC,0xF0,0xDC,0xBC,0x9E,0x4C,0xFE, -0xAF,0x05,0x96,0x35,0x1F,0x57,0x5A,0xB7,0xFF,0xCE,0xF9,0x3D,0xB7,0x2C,0xB6,0xF6, -0x54,0xDD,0xC8,0xE7,0x12,0x3A,0x4D,0xAE,0x4C,0x8A,0xB7,0x5C,0x9A,0xB4,0xB7,0x20, -0x3D,0xCA,0x7F,0x22,0x34,0xAE,0x7E,0x3B,0x68,0x66,0x01,0x44,0xE7,0x01,0x4E,0x46, -0x53,0x9B,0x33,0x60,0xF7,0x94,0xBE,0x53,0x37,0x90,0x73,0x43,0xF3,0x32,0xC3,0x53, -0xEF,0xDB,0xAA,0xFE,0x74,0x4E,0x69,0xC7,0x6B,0x8C,0x60,0x93,0xDE,0xC4,0xC7,0x0C, -0xDF,0xE1,0x32,0xAE,0xCC,0x93,0x3B,0x51,0x78,0x95,0x67,0x8B,0xEE,0x3D,0x56,0xFE, -0x0C,0xD0,0x69,0x0F,0x1B,0x0F,0xF3,0x25,0x26,0x6B,0x33,0x6D,0xF7,0x6E,0x47,0xFA, -0x73,0x43,0xE5,0x7E,0x0E,0xA5,0x66,0xB1,0x29,0x7C,0x32,0x84,0x63,0x55,0x89,0xC4, -0x0D,0xC1,0x93,0x54,0x30,0x19,0x13,0xAC,0xD3,0x7D,0x37,0xA7,0xEB,0x5D,0x3A,0x6C, -0x35,0x5C,0xDB,0x41,0xD7,0x12,0xDA,0xA9,0x49,0x0B,0xDF,0xD8,0x80,0x8A,0x09,0x93, -0x62,0x8E,0xB5,0x66,0xCF,0x25,0x88,0xCD,0x84,0xB8,0xB1,0x3F,0xA4,0x39,0x0F,0xD9, -0x02,0x9E,0xEB,0x12,0x4C,0x95,0x7C,0xF3,0x6B,0x05,0xA9,0x5E,0x16,0x83,0xCC,0xB8, -0x67,0xE2,0xE8,0x13,0x9D,0xCC,0x5B,0x82,0xD3,0x4C,0xB3,0xED,0x5B,0xFF,0xDE,0xE5, -0x73,0xAC,0x23,0x3B,0x2D,0x00,0xBF,0x35,0x55,0x74,0x09,0x49,0xD8,0x49,0x58,0x1A, -0x7F,0x92,0x36,0xE6,0x51,0x92,0x0E,0xF3,0x26,0x7D,0x1C,0x4D,0x17,0xBC,0xC9,0xEC, -0x43,0x26,0xD0,0xBF,0x41,0x5F,0x40,0xA9,0x44,0x44,0xF4,0x99,0xE7,0x57,0x87,0x9E, -0x50,0x1F,0x57,0x54,0xA8,0x3E,0xFD,0x74,0x63,0x2F,0xB1,0x50,0x65,0x09,0xE6,0x58, -0x42,0x2E,0x43,0x1A,0x4C,0xB4,0xF0,0x25,0x47,0x59,0xFA,0x04,0x1E,0x93,0xD4,0x26, -0x46,0x4A,0x50,0x81,0xB2,0xDE,0xBE,0x78,0xB7,0xFC,0x67,0x15,0xE1,0xC9,0x57,0x84, -0x1E,0x0F,0x63,0xD6,0xE9,0x62,0xBA,0xD6,0x5F,0x55,0x2E,0xEA,0x5C,0xC6,0x28,0x08, -0x04,0x25,0x39,0xB8,0x0E,0x2B,0xA9,0xF2,0x4C,0x97,0x1C,0x07,0x3F,0x0D,0x52,0xF5, -0xED,0xEF,0x2F,0x82,0x0F,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x1D, -0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x53,0x79,0xBF,0x5A,0xAA,0x2B,0x4A, -0xCF,0x54,0x80,0xE1,0xD8,0x9B,0xC0,0x9D,0xF2,0xB2,0x03,0x66,0xCB,0x30,0x0E,0x06, -0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06, -0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C,0x05,0x00,0x03,0x82,0x02, -0x01,0x00,0x5C,0xD4,0x7C,0x0D,0xCF,0xF7,0x01,0x7D,0x41,0x99,0x65,0x0C,0x73,0xC5, -0x52,0x9F,0xCB,0xF8,0xCF,0x99,0x06,0x7F,0x1B,0xDA,0x43,0x15,0x9F,0x9E,0x02,0x55, -0x57,0x96,0x14,0xF1,0x52,0x3C,0x27,0x87,0x94,0x28,0xED,0x1F,0x3A,0x01,0x37,0xA2, -0x76,0xFC,0x53,0x50,0xC0,0x84,0x9B,0xC6,0x6B,0x4E,0xBA,0x8C,0x21,0x4F,0xA2,0x8E, -0x55,0x62,0x91,0xF3,0x69,0x15,0xD8,0xBC,0x88,0xE3,0xC4,0xAA,0x0B,0xFD,0xEF,0xA8, -0xE9,0x4B,0x55,0x2A,0x06,0x20,0x6D,0x55,0x78,0x29,0x19,0xEE,0x5F,0x30,0x5C,0x4B, -0x24,0x11,0x55,0xFF,0x24,0x9A,0x6E,0x5E,0x2A,0x2B,0xEE,0x0B,0x4D,0x9F,0x7F,0xF7, -0x01,0x38,0x94,0x14,0x95,0x43,0x07,0x09,0xFB,0x60,0xA9,0xEE,0x1C,0xAB,0x12,0x8C, -0xA0,0x9A,0x5E,0xA7,0x98,0x6A,0x59,0x6D,0x8B,0x3F,0x08,0xFB,0xC8,0xD1,0x45,0xAF, -0x18,0x15,0x64,0x90,0x12,0x0F,0x73,0x28,0x2E,0xC5,0xE2,0x24,0x4E,0xFC,0x58,0xEC, -0xF0,0xF4,0x45,0xFE,0x22,0xB3,0xEB,0x2F,0x8E,0xD2,0xD9,0x45,0x61,0x05,0xC1,0x97, -0x6F,0xA8,0x76,0x72,0x8F,0x8B,0x8C,0x36,0xAF,0xBF,0x0D,0x05,0xCE,0x71,0x8D,0xE6, -0xA6,0x6F,0x1F,0x6C,0xA6,0x71,0x62,0xC5,0xD8,0xD0,0x83,0x72,0x0C,0xF1,0x67,0x11, -0x89,0x0C,0x9C,0x13,0x4C,0x72,0x34,0xDF,0xBC,0xD5,0x71,0xDF,0xAA,0x71,0xDD,0xE1, -0xB9,0x6C,0x8C,0x3C,0x12,0x5D,0x65,0xDA,0xBD,0x57,0x12,0xB6,0x43,0x6B,0xFF,0xE5, -0xDE,0x4D,0x66,0x11,0x51,0xCF,0x99,0xAE,0xEC,0x17,0xB6,0xE8,0x71,0x91,0x8C,0xDE, -0x49,0xFE,0xDD,0x35,0x71,0xA2,0x15,0x27,0x94,0x1C,0xCF,0x61,0xE3,0x26,0xBB,0x6F, -0xA3,0x67,0x25,0x21,0x5D,0xE6,0xDD,0x1D,0x0B,0x2E,0x68,0x1B,0x3B,0x82,0xAF,0xEC, -0x83,0x67,0x85,0xD4,0x98,0x51,0x74,0xB1,0xB9,0x99,0x80,0x89,0xFF,0x7F,0x78,0x19, -0x5C,0x79,0x4A,0x60,0x2E,0x92,0x40,0xAE,0x4C,0x37,0x2A,0x2C,0xC9,0xC7,0x62,0xC8, -0x0E,0x5D,0xF7,0x36,0x5B,0xCA,0xE0,0x25,0x25,0x01,0xB4,0xDD,0x1A,0x07,0x9C,0x77, -0x00,0x3F,0xD0,0xDC,0xD5,0xEC,0x3D,0xD4,0xFA,0xBB,0x3F,0xCC,0x85,0xD6,0x6F,0x7F, -0xA9,0x2D,0xDF,0xB9,0x02,0xF7,0xF5,0x97,0x9A,0xB5,0x35,0xDA,0xC3,0x67,0xB0,0x87, -0x4A,0xA9,0x28,0x9E,0x23,0x8E,0xFF,0x5C,0x27,0x6B,0xE1,0xB0,0x4F,0xF3,0x07,0xEE, -0x00,0x2E,0xD4,0x59,0x87,0xCB,0x52,0x41,0x95,0xEA,0xF4,0x47,0xD7,0xEE,0x64,0x41, -0x55,0x7C,0x8D,0x59,0x02,0x95,0xDD,0x62,0x9D,0xC2,0xB9,0xEE,0x5A,0x28,0x74,0x84, -0xA5,0x9B,0xB7,0x90,0xC7,0x0C,0x07,0xDF,0xF5,0x89,0x36,0x74,0x32,0xD6,0x28,0xC1, -0xB0,0xB0,0x0B,0xE0,0x9C,0x4C,0xC3,0x1C,0xD6,0xFC,0xE3,0x69,0xB5,0x47,0x46,0x81, -0x2F,0xA2,0x82,0xAB,0xD3,0x63,0x44,0x70,0xC4,0x8D,0xFF,0x2D,0x33,0xBA,0xAD,0x8F, -0x7B,0xB5,0x70,0x88,0xAE,0x3E,0x19,0xCF,0x40,0x28,0xD8,0xFC,0xC8,0x90,0xBB,0x5D, -0x99,0x22,0xF5,0x52,0xE6,0x58,0xC5,0x1F,0x88,0x31,0x43,0xEE,0x88,0x1D,0xD7,0xC6, -0x8E,0x3C,0x43,0x6A,0x1D,0xA7,0x18,0xDE,0x7D,0x3D,0x16,0xF1,0x62,0xF9,0xCA,0x90, -0xA8,0xFD, -}; - - -/* subject:/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority */ -/* issuer :/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority */ - - -const unsigned char Starfield_Class_2_CA_certificate[1043]={ -0x30,0x82,0x04,0x0F,0x30,0x82,0x02,0xF7,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x00, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x68,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x25, -0x30,0x23,0x06,0x03,0x55,0x04,0x0A,0x13,0x1C,0x53,0x74,0x61,0x72,0x66,0x69,0x65, -0x6C,0x64,0x20,0x54,0x65,0x63,0x68,0x6E,0x6F,0x6C,0x6F,0x67,0x69,0x65,0x73,0x2C, -0x20,0x49,0x6E,0x63,0x2E,0x31,0x32,0x30,0x30,0x06,0x03,0x55,0x04,0x0B,0x13,0x29, -0x53,0x74,0x61,0x72,0x66,0x69,0x65,0x6C,0x64,0x20,0x43,0x6C,0x61,0x73,0x73,0x20, -0x32,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20, -0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x34,0x30, -0x36,0x32,0x39,0x31,0x37,0x33,0x39,0x31,0x36,0x5A,0x17,0x0D,0x33,0x34,0x30,0x36, -0x32,0x39,0x31,0x37,0x33,0x39,0x31,0x36,0x5A,0x30,0x68,0x31,0x0B,0x30,0x09,0x06, -0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04, -0x0A,0x13,0x1C,0x53,0x74,0x61,0x72,0x66,0x69,0x65,0x6C,0x64,0x20,0x54,0x65,0x63, -0x68,0x6E,0x6F,0x6C,0x6F,0x67,0x69,0x65,0x73,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31, -0x32,0x30,0x30,0x06,0x03,0x55,0x04,0x0B,0x13,0x29,0x53,0x74,0x61,0x72,0x66,0x69, -0x65,0x6C,0x64,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72, -0x69,0x74,0x79,0x30,0x82,0x01,0x20,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0D,0x00,0x30,0x82,0x01,0x08,0x02, -0x82,0x01,0x01,0x00,0xB7,0x32,0xC8,0xFE,0xE9,0x71,0xA6,0x04,0x85,0xAD,0x0C,0x11, -0x64,0xDF,0xCE,0x4D,0xEF,0xC8,0x03,0x18,0x87,0x3F,0xA1,0xAB,0xFB,0x3C,0xA6,0x9F, -0xF0,0xC3,0xA1,0xDA,0xD4,0xD8,0x6E,0x2B,0x53,0x90,0xFB,0x24,0xA4,0x3E,0x84,0xF0, -0x9E,0xE8,0x5F,0xEC,0xE5,0x27,0x44,0xF5,0x28,0xA6,0x3F,0x7B,0xDE,0xE0,0x2A,0xF0, -0xC8,0xAF,0x53,0x2F,0x9E,0xCA,0x05,0x01,0x93,0x1E,0x8F,0x66,0x1C,0x39,0xA7,0x4D, -0xFA,0x5A,0xB6,0x73,0x04,0x25,0x66,0xEB,0x77,0x7F,0xE7,0x59,0xC6,0x4A,0x99,0x25, -0x14,0x54,0xEB,0x26,0xC7,0xF3,0x7F,0x19,0xD5,0x30,0x70,0x8F,0xAF,0xB0,0x46,0x2A, -0xFF,0xAD,0xEB,0x29,0xED,0xD7,0x9F,0xAA,0x04,0x87,0xA3,0xD4,0xF9,0x89,0xA5,0x34, -0x5F,0xDB,0x43,0x91,0x82,0x36,0xD9,0x66,0x3C,0xB1,0xB8,0xB9,0x82,0xFD,0x9C,0x3A, -0x3E,0x10,0xC8,0x3B,0xEF,0x06,0x65,0x66,0x7A,0x9B,0x19,0x18,0x3D,0xFF,0x71,0x51, -0x3C,0x30,0x2E,0x5F,0xBE,0x3D,0x77,0x73,0xB2,0x5D,0x06,0x6C,0xC3,0x23,0x56,0x9A, -0x2B,0x85,0x26,0x92,0x1C,0xA7,0x02,0xB3,0xE4,0x3F,0x0D,0xAF,0x08,0x79,0x82,0xB8, -0x36,0x3D,0xEA,0x9C,0xD3,0x35,0xB3,0xBC,0x69,0xCA,0xF5,0xCC,0x9D,0xE8,0xFD,0x64, -0x8D,0x17,0x80,0x33,0x6E,0x5E,0x4A,0x5D,0x99,0xC9,0x1E,0x87,0xB4,0x9D,0x1A,0xC0, -0xD5,0x6E,0x13,0x35,0x23,0x5E,0xDF,0x9B,0x5F,0x3D,0xEF,0xD6,0xF7,0x76,0xC2,0xEA, -0x3E,0xBB,0x78,0x0D,0x1C,0x42,0x67,0x6B,0x04,0xD8,0xF8,0xD6,0xDA,0x6F,0x8B,0xF2, -0x44,0xA0,0x01,0xAB,0x02,0x01,0x03,0xA3,0x81,0xC5,0x30,0x81,0xC2,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xBF,0x5F,0xB7,0xD1,0xCE,0xDD,0x1F,0x86, -0xF4,0x5B,0x55,0xAC,0xDC,0xD7,0x10,0xC2,0x0E,0xA9,0x88,0xE7,0x30,0x81,0x92,0x06, -0x03,0x55,0x1D,0x23,0x04,0x81,0x8A,0x30,0x81,0x87,0x80,0x14,0xBF,0x5F,0xB7,0xD1, -0xCE,0xDD,0x1F,0x86,0xF4,0x5B,0x55,0xAC,0xDC,0xD7,0x10,0xC2,0x0E,0xA9,0x88,0xE7, -0xA1,0x6C,0xA4,0x6A,0x30,0x68,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13, -0x02,0x55,0x53,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x0A,0x13,0x1C,0x53,0x74, -0x61,0x72,0x66,0x69,0x65,0x6C,0x64,0x20,0x54,0x65,0x63,0x68,0x6E,0x6F,0x6C,0x6F, -0x67,0x69,0x65,0x73,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x32,0x30,0x30,0x06,0x03, -0x55,0x04,0x0B,0x13,0x29,0x53,0x74,0x61,0x72,0x66,0x69,0x65,0x6C,0x64,0x20,0x43, -0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, -0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x82,0x01, -0x00,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82, -0x01,0x01,0x00,0x05,0x9D,0x3F,0x88,0x9D,0xD1,0xC9,0x1A,0x55,0xA1,0xAC,0x69,0xF3, -0xF3,0x59,0xDA,0x9B,0x01,0x87,0x1A,0x4F,0x57,0xA9,0xA1,0x79,0x09,0x2A,0xDB,0xF7, -0x2F,0xB2,0x1E,0xCC,0xC7,0x5E,0x6A,0xD8,0x83,0x87,0xA1,0x97,0xEF,0x49,0x35,0x3E, -0x77,0x06,0x41,0x58,0x62,0xBF,0x8E,0x58,0xB8,0x0A,0x67,0x3F,0xEC,0xB3,0xDD,0x21, -0x66,0x1F,0xC9,0x54,0xFA,0x72,0xCC,0x3D,0x4C,0x40,0xD8,0x81,0xAF,0x77,0x9E,0x83, -0x7A,0xBB,0xA2,0xC7,0xF5,0x34,0x17,0x8E,0xD9,0x11,0x40,0xF4,0xFC,0x2C,0x2A,0x4D, -0x15,0x7F,0xA7,0x62,0x5D,0x2E,0x25,0xD3,0x00,0x0B,0x20,0x1A,0x1D,0x68,0xF9,0x17, -0xB8,0xF4,0xBD,0x8B,0xED,0x28,0x59,0xDD,0x4D,0x16,0x8B,0x17,0x83,0xC8,0xB2,0x65, -0xC7,0x2D,0x7A,0xA5,0xAA,0xBC,0x53,0x86,0x6D,0xDD,0x57,0xA4,0xCA,0xF8,0x20,0x41, -0x0B,0x68,0xF0,0xF4,0xFB,0x74,0xBE,0x56,0x5D,0x7A,0x79,0xF5,0xF9,0x1D,0x85,0xE3, -0x2D,0x95,0xBE,0xF5,0x71,0x90,0x43,0xCC,0x8D,0x1F,0x9A,0x00,0x0A,0x87,0x29,0xE9, -0x55,0x22,0x58,0x00,0x23,0xEA,0xE3,0x12,0x43,0x29,0x5B,0x47,0x08,0xDD,0x8C,0x41, -0x6A,0x65,0x06,0xA8,0xE5,0x21,0xAA,0x41,0xB4,0x95,0x21,0x95,0xB9,0x7D,0xD1,0x34, -0xAB,0x13,0xD6,0xAD,0xBC,0xDC,0xE2,0x3D,0x39,0xCD,0xBD,0x3E,0x75,0x70,0xA1,0x18, -0x59,0x03,0xC9,0x22,0xB4,0x8F,0x9C,0xD5,0x5E,0x2A,0xD7,0xA5,0xB6,0xD4,0x0A,0x6D, -0xF8,0xB7,0x40,0x11,0x46,0x9A,0x1F,0x79,0x0E,0x62,0xBF,0x0F,0x97,0xEC,0xE0,0x2F, -0x1F,0x17,0x94, -}; - - -/* subject:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 1999 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G3 */ -/* issuer :/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 1999 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G3 */ - - -const unsigned char Verisign_Class_3_Public_Primary_Certification_Authority___G3_certificate[1054]={ -0x30,0x82,0x04,0x1A,0x30,0x82,0x03,0x02,0x02,0x11,0x00,0x9B,0x7E,0x06,0x49,0xA3, -0x3E,0x62,0xB9,0xD5,0xEE,0x90,0x48,0x71,0x29,0xEF,0x57,0x30,0x0D,0x06,0x09,0x2A, -0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81,0xCA,0x31,0x0B,0x30, -0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03, -0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49, -0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56,0x65, -0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74, -0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31,0x28, -0x63,0x29,0x20,0x31,0x39,0x39,0x39,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E, -0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74, -0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79, -0x31,0x45,0x30,0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69,0x53, -0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62,0x6C, -0x69,0x63,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x20,0x2D,0x20,0x47,0x33,0x30,0x1E,0x17,0x0D,0x39,0x39,0x31,0x30,0x30, -0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x36,0x30,0x37,0x31,0x36, -0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0xCA,0x31,0x0B,0x30,0x09,0x06,0x03, -0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A, -0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E, -0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56,0x65,0x72,0x69,0x53, -0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72, -0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31,0x28,0x63,0x29,0x20, -0x31,0x39,0x39,0x39,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49, -0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72, -0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x45,0x30, -0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E, -0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x20, -0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20, -0x2D,0x20,0x47,0x33,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A, -0x02,0x82,0x01,0x01,0x00,0xCB,0xBA,0x9C,0x52,0xFC,0x78,0x1F,0x1A,0x1E,0x6F,0x1B, -0x37,0x73,0xBD,0xF8,0xC9,0x6B,0x94,0x12,0x30,0x4F,0xF0,0x36,0x47,0xF5,0xD0,0x91, -0x0A,0xF5,0x17,0xC8,0xA5,0x61,0xC1,0x16,0x40,0x4D,0xFB,0x8A,0x61,0x90,0xE5,0x76, -0x20,0xC1,0x11,0x06,0x7D,0xAB,0x2C,0x6E,0xA6,0xF5,0x11,0x41,0x8E,0xFA,0x2D,0xAD, -0x2A,0x61,0x59,0xA4,0x67,0x26,0x4C,0xD0,0xE8,0xBC,0x52,0x5B,0x70,0x20,0x04,0x58, -0xD1,0x7A,0xC9,0xA4,0x69,0xBC,0x83,0x17,0x64,0xAD,0x05,0x8B,0xBC,0xD0,0x58,0xCE, -0x8D,0x8C,0xF5,0xEB,0xF0,0x42,0x49,0x0B,0x9D,0x97,0x27,0x67,0x32,0x6E,0xE1,0xAE, -0x93,0x15,0x1C,0x70,0xBC,0x20,0x4D,0x2F,0x18,0xDE,0x92,0x88,0xE8,0x6C,0x85,0x57, -0x11,0x1A,0xE9,0x7E,0xE3,0x26,0x11,0x54,0xA2,0x45,0x96,0x55,0x83,0xCA,0x30,0x89, -0xE8,0xDC,0xD8,0xA3,0xED,0x2A,0x80,0x3F,0x7F,0x79,0x65,0x57,0x3E,0x15,0x20,0x66, -0x08,0x2F,0x95,0x93,0xBF,0xAA,0x47,0x2F,0xA8,0x46,0x97,0xF0,0x12,0xE2,0xFE,0xC2, -0x0A,0x2B,0x51,0xE6,0x76,0xE6,0xB7,0x46,0xB7,0xE2,0x0D,0xA6,0xCC,0xA8,0xC3,0x4C, -0x59,0x55,0x89,0xE6,0xE8,0x53,0x5C,0x1C,0xEA,0x9D,0xF0,0x62,0x16,0x0B,0xA7,0xC9, -0x5F,0x0C,0xF0,0xDE,0xC2,0x76,0xCE,0xAF,0xF7,0x6A,0xF2,0xFA,0x41,0xA6,0xA2,0x33, -0x14,0xC9,0xE5,0x7A,0x63,0xD3,0x9E,0x62,0x37,0xD5,0x85,0x65,0x9E,0x0E,0xE6,0x53, -0x24,0x74,0x1B,0x5E,0x1D,0x12,0x53,0x5B,0xC7,0x2C,0xE7,0x83,0x49,0x3B,0x15,0xAE, -0x8A,0x68,0xB9,0x57,0x97,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x11,0x14, -0x96,0xC1,0xAB,0x92,0x08,0xF7,0x3F,0x2F,0xC9,0xB2,0xFE,0xE4,0x5A,0x9F,0x64,0xDE, -0xDB,0x21,0x4F,0x86,0x99,0x34,0x76,0x36,0x57,0xDD,0xD0,0x15,0x2F,0xC5,0xAD,0x7F, -0x15,0x1F,0x37,0x62,0x73,0x3E,0xD4,0xE7,0x5F,0xCE,0x17,0x03,0xDB,0x35,0xFA,0x2B, -0xDB,0xAE,0x60,0x09,0x5F,0x1E,0x5F,0x8F,0x6E,0xBB,0x0B,0x3D,0xEA,0x5A,0x13,0x1E, -0x0C,0x60,0x6F,0xB5,0xC0,0xB5,0x23,0x22,0x2E,0x07,0x0B,0xCB,0xA9,0x74,0xCB,0x47, -0xBB,0x1D,0xC1,0xD7,0xA5,0x6B,0xCC,0x2F,0xD2,0x42,0xFD,0x49,0xDD,0xA7,0x89,0xCF, -0x53,0xBA,0xDA,0x00,0x5A,0x28,0xBF,0x82,0xDF,0xF8,0xBA,0x13,0x1D,0x50,0x86,0x82, -0xFD,0x8E,0x30,0x8F,0x29,0x46,0xB0,0x1E,0x3D,0x35,0xDA,0x38,0x62,0x16,0x18,0x4A, -0xAD,0xE6,0xB6,0x51,0x6C,0xDE,0xAF,0x62,0xEB,0x01,0xD0,0x1E,0x24,0xFE,0x7A,0x8F, -0x12,0x1A,0x12,0x68,0xB8,0xFB,0x66,0x99,0x14,0x14,0x45,0x5C,0xAE,0xE7,0xAE,0x69, -0x17,0x81,0x2B,0x5A,0x37,0xC9,0x5E,0x2A,0xF4,0xC6,0xE2,0xA1,0x5C,0x54,0x9B,0xA6, -0x54,0x00,0xCF,0xF0,0xF1,0xC1,0xC7,0x98,0x30,0x1A,0x3B,0x36,0x16,0xDB,0xA3,0x6E, -0xEA,0xFD,0xAD,0xB2,0xC2,0xDA,0xEF,0x02,0x47,0x13,0x8A,0xC0,0xF1,0xB3,0x31,0xAD, -0x4F,0x1C,0xE1,0x4F,0x9C,0xAF,0x0F,0x0C,0x9D,0xF7,0x78,0x0D,0xD8,0xF4,0x35,0x56, -0x80,0xDA,0xB7,0x6D,0x17,0x8F,0x9D,0x1E,0x81,0x64,0xE1,0xFE,0xC5,0x45,0xBA,0xAD, -0x6B,0xB9,0x0A,0x7A,0x4E,0x4F,0x4B,0x84,0xEE,0x4B,0xF1,0x7D,0xDD,0x11, -}; - - -/* subject:/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority */ -/* issuer :/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority */ - - -const unsigned char USERTrust_ECC_Certification_Authority_certificate[659]={ -0x30,0x82,0x02,0x8F,0x30,0x82,0x02,0x15,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x5C, -0x8B,0x99,0xC5,0x5A,0x94,0xC5,0xD2,0x71,0x56,0xDE,0xCD,0x89,0x80,0xCC,0x26,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x81,0x88,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06, -0x03,0x55,0x04,0x08,0x13,0x0A,0x4E,0x65,0x77,0x20,0x4A,0x65,0x72,0x73,0x65,0x79, -0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x07,0x13,0x0B,0x4A,0x65,0x72,0x73,0x65, -0x79,0x20,0x43,0x69,0x74,0x79,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0A,0x13, -0x15,0x54,0x68,0x65,0x20,0x55,0x53,0x45,0x52,0x54,0x52,0x55,0x53,0x54,0x20,0x4E, -0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x03,0x13, -0x25,0x55,0x53,0x45,0x52,0x54,0x72,0x75,0x73,0x74,0x20,0x45,0x43,0x43,0x20,0x43, -0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74, -0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x31,0x30,0x30,0x32,0x30,0x31, -0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x38,0x32, -0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0x88,0x31,0x0B,0x30,0x09,0x06,0x03,0x55, -0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13, -0x0A,0x4E,0x65,0x77,0x20,0x4A,0x65,0x72,0x73,0x65,0x79,0x31,0x14,0x30,0x12,0x06, -0x03,0x55,0x04,0x07,0x13,0x0B,0x4A,0x65,0x72,0x73,0x65,0x79,0x20,0x43,0x69,0x74, -0x79,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0A,0x13,0x15,0x54,0x68,0x65,0x20, -0x55,0x53,0x45,0x52,0x54,0x52,0x55,0x53,0x54,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72, -0x6B,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x03,0x13,0x25,0x55,0x53,0x45,0x52, -0x54,0x72,0x75,0x73,0x74,0x20,0x45,0x43,0x43,0x20,0x43,0x65,0x72,0x74,0x69,0x66, -0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74, -0x79,0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05, -0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0x1A,0xAC,0x54,0x5A,0xA9,0xF9,0x68, -0x23,0xE7,0x7A,0xD5,0x24,0x6F,0x53,0xC6,0x5A,0xD8,0x4B,0xAB,0xC6,0xD5,0xB6,0xD1, -0xE6,0x73,0x71,0xAE,0xDD,0x9C,0xD6,0x0C,0x61,0xFD,0xDB,0xA0,0x89,0x03,0xB8,0x05, -0x14,0xEC,0x57,0xCE,0xEE,0x5D,0x3F,0xE2,0x21,0xB3,0xCE,0xF7,0xD4,0x8A,0x79,0xE0, -0xA3,0x83,0x7E,0x2D,0x97,0xD0,0x61,0xC4,0xF1,0x99,0xDC,0x25,0x91,0x63,0xAB,0x7F, -0x30,0xA3,0xB4,0x70,0xE2,0xC7,0xA1,0x33,0x9C,0xF3,0xBF,0x2E,0x5C,0x53,0xB1,0x5F, -0xB3,0x7D,0x32,0x7F,0x8A,0x34,0xE3,0x79,0x79,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x3A,0xE1,0x09,0x86,0xD4,0xCF,0x19,0xC2, -0x96,0x76,0x74,0x49,0x76,0xDC,0xE0,0x35,0xC6,0x63,0x63,0x9A,0x30,0x0E,0x06,0x03, -0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03, -0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0A,0x06, -0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x68,0x00,0x30,0x65,0x02,0x30, -0x36,0x67,0xA1,0x16,0x08,0xDC,0xE4,0x97,0x00,0x41,0x1D,0x4E,0xBE,0xE1,0x63,0x01, -0xCF,0x3B,0xAA,0x42,0x11,0x64,0xA0,0x9D,0x94,0x39,0x02,0x11,0x79,0x5C,0x7B,0x1D, -0xFA,0x64,0xB9,0xEE,0x16,0x42,0xB3,0xBF,0x8A,0xC2,0x09,0xC4,0xEC,0xE4,0xB1,0x4D, -0x02,0x31,0x00,0xE9,0x2A,0x61,0x47,0x8C,0x52,0x4A,0x4B,0x4E,0x18,0x70,0xF6,0xD6, -0x44,0xD6,0x6E,0xF5,0x83,0xBA,0x6D,0x58,0xBD,0x24,0xD9,0x56,0x48,0xEA,0xEF,0xC4, -0xA2,0x46,0x81,0x88,0x6A,0x3A,0x46,0xD1,0xA9,0x9B,0x4D,0xC9,0x61,0xDA,0xD1,0x5D, -0x57,0x6A,0x18, -}; - - -/* subject:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA */ -/* issuer :/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA */ - - -const unsigned char GeoTrust_Global_CA_certificate[856]={ -0x30,0x82,0x03,0x54,0x30,0x82,0x02,0x3C,0xA0,0x03,0x02,0x01,0x02,0x02,0x03,0x02, -0x34,0x56,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05, -0x00,0x30,0x42,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53, -0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72, -0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04, -0x03,0x13,0x12,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x47,0x6C,0x6F,0x62, -0x61,0x6C,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x32,0x30,0x35,0x32,0x31,0x30, -0x34,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x32,0x30,0x35,0x32,0x31,0x30,0x34, -0x30,0x30,0x30,0x30,0x5A,0x30,0x42,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06, -0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47, -0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1B,0x30,0x19, -0x06,0x03,0x55,0x04,0x03,0x13,0x12,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20, -0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F, -0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xDA,0xCC,0x18,0x63,0x30,0xFD, -0xF4,0x17,0x23,0x1A,0x56,0x7E,0x5B,0xDF,0x3C,0x6C,0x38,0xE4,0x71,0xB7,0x78,0x91, -0xD4,0xBC,0xA1,0xD8,0x4C,0xF8,0xA8,0x43,0xB6,0x03,0xE9,0x4D,0x21,0x07,0x08,0x88, -0xDA,0x58,0x2F,0x66,0x39,0x29,0xBD,0x05,0x78,0x8B,0x9D,0x38,0xE8,0x05,0xB7,0x6A, -0x7E,0x71,0xA4,0xE6,0xC4,0x60,0xA6,0xB0,0xEF,0x80,0xE4,0x89,0x28,0x0F,0x9E,0x25, -0xD6,0xED,0x83,0xF3,0xAD,0xA6,0x91,0xC7,0x98,0xC9,0x42,0x18,0x35,0x14,0x9D,0xAD, -0x98,0x46,0x92,0x2E,0x4F,0xCA,0xF1,0x87,0x43,0xC1,0x16,0x95,0x57,0x2D,0x50,0xEF, -0x89,0x2D,0x80,0x7A,0x57,0xAD,0xF2,0xEE,0x5F,0x6B,0xD2,0x00,0x8D,0xB9,0x14,0xF8, -0x14,0x15,0x35,0xD9,0xC0,0x46,0xA3,0x7B,0x72,0xC8,0x91,0xBF,0xC9,0x55,0x2B,0xCD, -0xD0,0x97,0x3E,0x9C,0x26,0x64,0xCC,0xDF,0xCE,0x83,0x19,0x71,0xCA,0x4E,0xE6,0xD4, -0xD5,0x7B,0xA9,0x19,0xCD,0x55,0xDE,0xC8,0xEC,0xD2,0x5E,0x38,0x53,0xE5,0x5C,0x4F, -0x8C,0x2D,0xFE,0x50,0x23,0x36,0xFC,0x66,0xE6,0xCB,0x8E,0xA4,0x39,0x19,0x00,0xB7, -0x95,0x02,0x39,0x91,0x0B,0x0E,0xFE,0x38,0x2E,0xD1,0x1D,0x05,0x9A,0xF6,0x4D,0x3E, -0x6F,0x0F,0x07,0x1D,0xAF,0x2C,0x1E,0x8F,0x60,0x39,0xE2,0xFA,0x36,0x53,0x13,0x39, -0xD4,0x5E,0x26,0x2B,0xDB,0x3D,0xA8,0x14,0xBD,0x32,0xEB,0x18,0x03,0x28,0x52,0x04, -0x71,0xE5,0xAB,0x33,0x3D,0xE1,0x38,0xBB,0x07,0x36,0x84,0x62,0x9C,0x79,0xEA,0x16, -0x30,0xF4,0x5F,0xC0,0x2B,0xE8,0x71,0x6B,0xE4,0xF9,0x02,0x03,0x01,0x00,0x01,0xA3, -0x53,0x30,0x51,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30, -0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xC0, -0x7A,0x98,0x68,0x8D,0x89,0xFB,0xAB,0x05,0x64,0x0C,0x11,0x7D,0xAA,0x7D,0x65,0xB8, -0xCA,0xCC,0x4E,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14, -0xC0,0x7A,0x98,0x68,0x8D,0x89,0xFB,0xAB,0x05,0x64,0x0C,0x11,0x7D,0xAA,0x7D,0x65, -0xB8,0xCA,0xCC,0x4E,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01, -0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x35,0xE3,0x29,0x6A,0xE5,0x2F,0x5D,0x54, -0x8E,0x29,0x50,0x94,0x9F,0x99,0x1A,0x14,0xE4,0x8F,0x78,0x2A,0x62,0x94,0xA2,0x27, -0x67,0x9E,0xD0,0xCF,0x1A,0x5E,0x47,0xE9,0xC1,0xB2,0xA4,0xCF,0xDD,0x41,0x1A,0x05, -0x4E,0x9B,0x4B,0xEE,0x4A,0x6F,0x55,0x52,0xB3,0x24,0xA1,0x37,0x0A,0xEB,0x64,0x76, -0x2A,0x2E,0x2C,0xF3,0xFD,0x3B,0x75,0x90,0xBF,0xFA,0x71,0xD8,0xC7,0x3D,0x37,0xD2, -0xB5,0x05,0x95,0x62,0xB9,0xA6,0xDE,0x89,0x3D,0x36,0x7B,0x38,0x77,0x48,0x97,0xAC, -0xA6,0x20,0x8F,0x2E,0xA6,0xC9,0x0C,0xC2,0xB2,0x99,0x45,0x00,0xC7,0xCE,0x11,0x51, -0x22,0x22,0xE0,0xA5,0xEA,0xB6,0x15,0x48,0x09,0x64,0xEA,0x5E,0x4F,0x74,0xF7,0x05, -0x3E,0xC7,0x8A,0x52,0x0C,0xDB,0x15,0xB4,0xBD,0x6D,0x9B,0xE5,0xC6,0xB1,0x54,0x68, -0xA9,0xE3,0x69,0x90,0xB6,0x9A,0xA5,0x0F,0xB8,0xB9,0x3F,0x20,0x7D,0xAE,0x4A,0xB5, -0xB8,0x9C,0xE4,0x1D,0xB6,0xAB,0xE6,0x94,0xA5,0xC1,0xC7,0x83,0xAD,0xDB,0xF5,0x27, -0x87,0x0E,0x04,0x6C,0xD5,0xFF,0xDD,0xA0,0x5D,0xED,0x87,0x52,0xB7,0x2B,0x15,0x02, -0xAE,0x39,0xA6,0x6A,0x74,0xE9,0xDA,0xC4,0xE7,0xBC,0x4D,0x34,0x1E,0xA9,0x5C,0x4D, -0x33,0x5F,0x92,0x09,0x2F,0x88,0x66,0x5D,0x77,0x97,0xC7,0x1D,0x76,0x13,0xA9,0xD5, -0xE5,0xF1,0x16,0x09,0x11,0x35,0xD5,0xAC,0xDB,0x24,0x71,0x70,0x2C,0x98,0x56,0x0B, -0xD9,0x17,0xB4,0xD1,0xE3,0x51,0x2B,0x5E,0x75,0xE8,0xD5,0xD0,0xDC,0x4F,0x34,0xED, -0xC2,0x05,0x66,0x80,0xA1,0xCB,0xE6,0x33, -}; - - -/* subject:/C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2 */ -/* issuer :/C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2 */ - - -const unsigned char Starfield_Root_Certificate_Authority___G2_certificate[993]={ -0x30,0x82,0x03,0xDD,0x30,0x82,0x02,0xC5,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x00, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30, -0x81,0x8F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31, -0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x08,0x13,0x07,0x41,0x72,0x69,0x7A,0x6F,0x6E, -0x61,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x07,0x13,0x0A,0x53,0x63,0x6F,0x74, -0x74,0x73,0x64,0x61,0x6C,0x65,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x0A,0x13, -0x1C,0x53,0x74,0x61,0x72,0x66,0x69,0x65,0x6C,0x64,0x20,0x54,0x65,0x63,0x68,0x6E, -0x6F,0x6C,0x6F,0x67,0x69,0x65,0x73,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x32,0x30, -0x30,0x06,0x03,0x55,0x04,0x03,0x13,0x29,0x53,0x74,0x61,0x72,0x66,0x69,0x65,0x6C, -0x64,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, -0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x47, -0x32,0x30,0x1E,0x17,0x0D,0x30,0x39,0x30,0x39,0x30,0x31,0x30,0x30,0x30,0x30,0x30, -0x30,0x5A,0x17,0x0D,0x33,0x37,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39, -0x5A,0x30,0x81,0x8F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55, -0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x08,0x13,0x07,0x41,0x72,0x69,0x7A, -0x6F,0x6E,0x61,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x07,0x13,0x0A,0x53,0x63, -0x6F,0x74,0x74,0x73,0x64,0x61,0x6C,0x65,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04, -0x0A,0x13,0x1C,0x53,0x74,0x61,0x72,0x66,0x69,0x65,0x6C,0x64,0x20,0x54,0x65,0x63, -0x68,0x6E,0x6F,0x6C,0x6F,0x67,0x69,0x65,0x73,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31, -0x32,0x30,0x30,0x06,0x03,0x55,0x04,0x03,0x13,0x29,0x53,0x74,0x61,0x72,0x66,0x69, -0x65,0x6C,0x64,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69, -0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D, -0x20,0x47,0x32,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02, -0x82,0x01,0x01,0x00,0xBD,0xED,0xC1,0x03,0xFC,0xF6,0x8F,0xFC,0x02,0xB1,0x6F,0x5B, -0x9F,0x48,0xD9,0x9D,0x79,0xE2,0xA2,0xB7,0x03,0x61,0x56,0x18,0xC3,0x47,0xB6,0xD7, -0xCA,0x3D,0x35,0x2E,0x89,0x43,0xF7,0xA1,0x69,0x9B,0xDE,0x8A,0x1A,0xFD,0x13,0x20, -0x9C,0xB4,0x49,0x77,0x32,0x29,0x56,0xFD,0xB9,0xEC,0x8C,0xDD,0x22,0xFA,0x72,0xDC, -0x27,0x61,0x97,0xEE,0xF6,0x5A,0x84,0xEC,0x6E,0x19,0xB9,0x89,0x2C,0xDC,0x84,0x5B, -0xD5,0x74,0xFB,0x6B,0x5F,0xC5,0x89,0xA5,0x10,0x52,0x89,0x46,0x55,0xF4,0xB8,0x75, -0x1C,0xE6,0x7F,0xE4,0x54,0xAE,0x4B,0xF8,0x55,0x72,0x57,0x02,0x19,0xF8,0x17,0x71, -0x59,0xEB,0x1E,0x28,0x07,0x74,0xC5,0x9D,0x48,0xBE,0x6C,0xB4,0xF4,0xA4,0xB0,0xF3, -0x64,0x37,0x79,0x92,0xC0,0xEC,0x46,0x5E,0x7F,0xE1,0x6D,0x53,0x4C,0x62,0xAF,0xCD, -0x1F,0x0B,0x63,0xBB,0x3A,0x9D,0xFB,0xFC,0x79,0x00,0x98,0x61,0x74,0xCF,0x26,0x82, -0x40,0x63,0xF3,0xB2,0x72,0x6A,0x19,0x0D,0x99,0xCA,0xD4,0x0E,0x75,0xCC,0x37,0xFB, -0x8B,0x89,0xC1,0x59,0xF1,0x62,0x7F,0x5F,0xB3,0x5F,0x65,0x30,0xF8,0xA7,0xB7,0x4D, -0x76,0x5A,0x1E,0x76,0x5E,0x34,0xC0,0xE8,0x96,0x56,0x99,0x8A,0xB3,0xF0,0x7F,0xA4, -0xCD,0xBD,0xDC,0x32,0x31,0x7C,0x91,0xCF,0xE0,0x5F,0x11,0xF8,0x6B,0xAA,0x49,0x5C, -0xD1,0x99,0x94,0xD1,0xA2,0xE3,0x63,0x5B,0x09,0x76,0xB5,0x56,0x62,0xE1,0x4B,0x74, -0x1D,0x96,0xD4,0x26,0xD4,0x08,0x04,0x59,0xD0,0x98,0x0E,0x0E,0xE6,0xDE,0xFC,0xC3, -0xEC,0x1F,0x90,0xF1,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06, -0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E, -0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D, -0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x7C,0x0C,0x32,0x1F,0xA7,0xD9,0x30, -0x7F,0xC4,0x7D,0x68,0xA3,0x62,0xA8,0xA1,0xCE,0xAB,0x07,0x5B,0x27,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01, -0x00,0x11,0x59,0xFA,0x25,0x4F,0x03,0x6F,0x94,0x99,0x3B,0x9A,0x1F,0x82,0x85,0x39, -0xD4,0x76,0x05,0x94,0x5E,0xE1,0x28,0x93,0x6D,0x62,0x5D,0x09,0xC2,0xA0,0xA8,0xD4, -0xB0,0x75,0x38,0xF1,0x34,0x6A,0x9D,0xE4,0x9F,0x8A,0x86,0x26,0x51,0xE6,0x2C,0xD1, -0xC6,0x2D,0x6E,0x95,0x20,0x4A,0x92,0x01,0xEC,0xB8,0x8A,0x67,0x7B,0x31,0xE2,0x67, -0x2E,0x8C,0x95,0x03,0x26,0x2E,0x43,0x9D,0x4A,0x31,0xF6,0x0E,0xB5,0x0C,0xBB,0xB7, -0xE2,0x37,0x7F,0x22,0xBA,0x00,0xA3,0x0E,0x7B,0x52,0xFB,0x6B,0xBB,0x3B,0xC4,0xD3, -0x79,0x51,0x4E,0xCD,0x90,0xF4,0x67,0x07,0x19,0xC8,0x3C,0x46,0x7A,0x0D,0x01,0x7D, -0xC5,0x58,0xE7,0x6D,0xE6,0x85,0x30,0x17,0x9A,0x24,0xC4,0x10,0xE0,0x04,0xF7,0xE0, -0xF2,0x7F,0xD4,0xAA,0x0A,0xFF,0x42,0x1D,0x37,0xED,0x94,0xE5,0x64,0x59,0x12,0x20, -0x77,0x38,0xD3,0x32,0x3E,0x38,0x81,0x75,0x96,0x73,0xFA,0x68,0x8F,0xB1,0xCB,0xCE, -0x1F,0xC5,0xEC,0xFA,0x9C,0x7E,0xCF,0x7E,0xB1,0xF1,0x07,0x2D,0xB6,0xFC,0xBF,0xCA, -0xA4,0xBF,0xD0,0x97,0x05,0x4A,0xBC,0xEA,0x18,0x28,0x02,0x90,0xBD,0x54,0x78,0x09, -0x21,0x71,0xD3,0xD1,0x7D,0x1D,0xD9,0x16,0xB0,0xA9,0x61,0x3D,0xD0,0x0A,0x00,0x22, -0xFC,0xC7,0x7B,0xCB,0x09,0x64,0x45,0x0B,0x3B,0x40,0x81,0xF7,0x7D,0x7C,0x32,0xF5, -0x98,0xCA,0x58,0x8E,0x7D,0x2A,0xEE,0x90,0x59,0x73,0x64,0xF9,0x36,0x74,0x5E,0x25, -0xA1,0xF5,0x66,0x05,0x2E,0x7F,0x39,0x15,0xA9,0x2A,0xFB,0x50,0x8B,0x8E,0x85,0x69, -0xF4, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root G3 */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root G3 */ - - -const unsigned char DigiCert_Global_Root_G3_certificate[579]={ -0x30,0x82,0x02,0x3F,0x30,0x82,0x01,0xC5,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x05, -0x55,0x56,0xBC,0xF2,0x5E,0xA4,0x35,0x35,0xC3,0xA4,0x0F,0xD5,0xAB,0x45,0x72,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x61,0x31,0x0B,0x30, -0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03, -0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49,0x6E, -0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77,0x77,0x77,0x2E, -0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x20,0x30,0x1E, -0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20, -0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F,0x74,0x20,0x47,0x33,0x30,0x1E, -0x17,0x0D,0x31,0x33,0x30,0x38,0x30,0x31,0x31,0x32,0x30,0x30,0x30,0x30,0x5A,0x17, -0x0D,0x33,0x38,0x30,0x31,0x31,0x35,0x31,0x32,0x30,0x30,0x30,0x30,0x5A,0x30,0x61, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F,0x74,0x20,0x47, -0x33,0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05, -0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0xDD,0xA7,0xD9,0xBB,0x8A,0xB8,0x0B, -0xFB,0x0B,0x7F,0x21,0xD2,0xF0,0xBE,0xBE,0x73,0xF3,0x33,0x5D,0x1A,0xBC,0x34,0xEA, -0xDE,0xC6,0x9B,0xBC,0xD0,0x95,0xF6,0xF0,0xCC,0xD0,0x0B,0xBA,0x61,0x5B,0x51,0x46, -0x7E,0x9E,0x2D,0x9F,0xEE,0x8E,0x63,0x0C,0x17,0xEC,0x07,0x70,0xF5,0xCF,0x84,0x2E, -0x40,0x83,0x9C,0xE8,0x3F,0x41,0x6D,0x3B,0xAD,0xD3,0xA4,0x14,0x59,0x36,0x78,0x9D, -0x03,0x43,0xEE,0x10,0x13,0x6C,0x72,0xDE,0xAE,0x88,0xA7,0xA1,0x6B,0xB5,0x43,0xCE, -0x67,0xDC,0x23,0xFF,0x03,0x1C,0xA3,0xE2,0x3E,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06, -0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E, -0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x1D, -0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xB3,0xDB,0x48,0xA4,0xF9,0xA1,0xC5, -0xD8,0xAE,0x36,0x41,0xCC,0x11,0x63,0x69,0x62,0x29,0xBC,0x4B,0xC6,0x30,0x0A,0x06, -0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x68,0x00,0x30,0x65,0x02,0x31, -0x00,0xAD,0xBC,0xF2,0x6C,0x3F,0x12,0x4A,0xD1,0x2D,0x39,0xC3,0x0A,0x09,0x97,0x73, -0xF4,0x88,0x36,0x8C,0x88,0x27,0xBB,0xE6,0x88,0x8D,0x50,0x85,0xA7,0x63,0xF9,0x9E, -0x32,0xDE,0x66,0x93,0x0F,0xF1,0xCC,0xB1,0x09,0x8F,0xDD,0x6C,0xAB,0xFA,0x6B,0x7F, -0xA0,0x02,0x30,0x39,0x66,0x5B,0xC2,0x64,0x8D,0xB8,0x9E,0x50,0xDC,0xA8,0xD5,0x49, -0xA2,0xED,0xC7,0xDC,0xD1,0x49,0x7F,0x17,0x01,0xB8,0xC8,0x86,0x8F,0x4E,0x8C,0x88, -0x2B,0xA8,0x9A,0xA9,0x8A,0xC5,0xD1,0x00,0xBD,0xF8,0x54,0xE2,0x9A,0xE5,0x5B,0x7C, -0xB3,0x27,0x17, -}; - - -/* subject:/C=US/O=thawte, Inc./OU=(c) 2007 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA - G2 */ -/* issuer :/C=US/O=thawte, Inc./OU=(c) 2007 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA - G2 */ - - -const unsigned char thawte_Primary_Root_CA___G2_certificate[652]={ -0x30,0x82,0x02,0x88,0x30,0x82,0x02,0x0D,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x35, -0xFC,0x26,0x5C,0xD9,0x84,0x4F,0xC9,0x3D,0x26,0x3D,0x57,0x9B,0xAE,0xD7,0x56,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x81,0x84,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0C,0x74,0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E, -0x63,0x2E,0x31,0x38,0x30,0x36,0x06,0x03,0x55,0x04,0x0B,0x13,0x2F,0x28,0x63,0x29, -0x20,0x32,0x30,0x30,0x37,0x20,0x74,0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E, -0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69, -0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x24,0x30,0x22, -0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x74,0x68,0x61,0x77,0x74,0x65,0x20,0x50,0x72, -0x69,0x6D,0x61,0x72,0x79,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20, -0x47,0x32,0x30,0x1E,0x17,0x0D,0x30,0x37,0x31,0x31,0x30,0x35,0x30,0x30,0x30,0x30, -0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x38,0x32,0x33,0x35,0x39,0x35, -0x39,0x5A,0x30,0x81,0x84,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02, -0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x74,0x68,0x61, -0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x38,0x30,0x36,0x06,0x03,0x55, -0x04,0x0B,0x13,0x2F,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x37,0x20,0x74,0x68,0x61, -0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20, -0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F, -0x6E,0x6C,0x79,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x74,0x68, -0x61,0x77,0x74,0x65,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x52,0x6F,0x6F, -0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x47,0x32,0x30,0x76,0x30,0x10,0x06,0x07,0x2A, -0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05,0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00, -0x04,0xA2,0xD5,0x9C,0x82,0x7B,0x95,0x9D,0xF1,0x52,0x78,0x87,0xFE,0x8A,0x16,0xBF, -0x05,0xE6,0xDF,0xA3,0x02,0x4F,0x0D,0x07,0xC6,0x00,0x51,0xBA,0x0C,0x02,0x52,0x2D, -0x22,0xA4,0x42,0x39,0xC4,0xFE,0x8F,0xEA,0xC9,0xC1,0xBE,0xD4,0x4D,0xFF,0x9F,0x7A, -0x9E,0xE2,0xB1,0x7C,0x9A,0xAD,0xA7,0x86,0x09,0x73,0x87,0xD1,0xE7,0x9A,0xE3,0x7A, -0xA5,0xAA,0x6E,0xFB,0xBA,0xB3,0x70,0xC0,0x67,0x88,0xA2,0x35,0xD4,0xA3,0x9A,0xB1, -0xFD,0xAD,0xC2,0xEF,0x31,0xFA,0xA8,0xB9,0xF3,0xFB,0x08,0xC6,0x91,0xD1,0xFB,0x29, -0x95,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04, -0x14,0x9A,0xD8,0x00,0x30,0x00,0xE7,0x6B,0x7F,0x85,0x18,0xEE,0x8B,0xB6,0xCE,0x8A, -0x0C,0xF8,0x11,0xE1,0xBB,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03, -0x03,0x03,0x69,0x00,0x30,0x66,0x02,0x31,0x00,0xDD,0xF8,0xE0,0x57,0x47,0x5B,0xA7, -0xE6,0x0A,0xC3,0xBD,0xF5,0x80,0x8A,0x97,0x35,0x0D,0x1B,0x89,0x3C,0x54,0x86,0x77, -0x28,0xCA,0xA1,0xF4,0x79,0xDE,0xB5,0xE6,0x38,0xB0,0xF0,0x65,0x70,0x8C,0x7F,0x02, -0x54,0xC2,0xBF,0xFF,0xD8,0xA1,0x3E,0xD9,0xCF,0x02,0x31,0x00,0xC4,0x8D,0x94,0xFC, -0xDC,0x53,0xD2,0xDC,0x9D,0x78,0x16,0x1F,0x15,0x33,0x23,0x53,0x52,0xE3,0x5A,0x31, -0x5D,0x9D,0xCA,0xAE,0xBD,0x13,0x29,0x44,0x0D,0x27,0x5B,0xA8,0xE7,0x68,0x9C,0x12, -0xF7,0x58,0x3F,0x2E,0x72,0x02,0x57,0xA3,0x8F,0xA1,0x14,0x2E, -}; - - -/* subject:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2008 VeriSign, Inc. - For authorized use only/CN=VeriSign Universal Root Certification Authority */ -/* issuer :/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2008 VeriSign, Inc. - For authorized use only/CN=VeriSign Universal Root Certification Authority */ - - -const unsigned char VeriSign_Universal_Root_Certification_Authority_certificate[1213]={ -0x30,0x82,0x04,0xB9,0x30,0x82,0x03,0xA1,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x40, -0x1A,0xC4,0x64,0x21,0xB3,0x13,0x21,0x03,0x0E,0xBB,0xE4,0x12,0x1A,0xC5,0x1D,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x81, -0xBD,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17, -0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67, -0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B, -0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74, -0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04, -0x0B,0x13,0x31,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x38,0x20,0x56,0x65,0x72,0x69, -0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72, -0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20, -0x6F,0x6E,0x6C,0x79,0x31,0x38,0x30,0x36,0x06,0x03,0x55,0x04,0x03,0x13,0x2F,0x56, -0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73,0x61, -0x6C,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, -0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E, -0x17,0x0D,0x30,0x38,0x30,0x34,0x30,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17, -0x0D,0x33,0x37,0x31,0x32,0x30,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81, -0xBD,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17, -0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67, -0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B, -0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74, -0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04, -0x0B,0x13,0x31,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x38,0x20,0x56,0x65,0x72,0x69, -0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72, -0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20, -0x6F,0x6E,0x6C,0x79,0x31,0x38,0x30,0x36,0x06,0x03,0x55,0x04,0x03,0x13,0x2F,0x56, -0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73,0x61, -0x6C,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, -0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x82, -0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05, -0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xC7, -0x61,0x37,0x5E,0xB1,0x01,0x34,0xDB,0x62,0xD7,0x15,0x9B,0xFF,0x58,0x5A,0x8C,0x23, -0x23,0xD6,0x60,0x8E,0x91,0xD7,0x90,0x98,0x83,0x7A,0xE6,0x58,0x19,0x38,0x8C,0xC5, -0xF6,0xE5,0x64,0x85,0xB4,0xA2,0x71,0xFB,0xED,0xBD,0xB9,0xDA,0xCD,0x4D,0x00,0xB4, -0xC8,0x2D,0x73,0xA5,0xC7,0x69,0x71,0x95,0x1F,0x39,0x3C,0xB2,0x44,0x07,0x9C,0xE8, -0x0E,0xFA,0x4D,0x4A,0xC4,0x21,0xDF,0x29,0x61,0x8F,0x32,0x22,0x61,0x82,0xC5,0x87, -0x1F,0x6E,0x8C,0x7C,0x5F,0x16,0x20,0x51,0x44,0xD1,0x70,0x4F,0x57,0xEA,0xE3,0x1C, -0xE3,0xCC,0x79,0xEE,0x58,0xD8,0x0E,0xC2,0xB3,0x45,0x93,0xC0,0x2C,0xE7,0x9A,0x17, -0x2B,0x7B,0x00,0x37,0x7A,0x41,0x33,0x78,0xE1,0x33,0xE2,0xF3,0x10,0x1A,0x7F,0x87, -0x2C,0xBE,0xF6,0xF5,0xF7,0x42,0xE2,0xE5,0xBF,0x87,0x62,0x89,0x5F,0x00,0x4B,0xDF, -0xC5,0xDD,0xE4,0x75,0x44,0x32,0x41,0x3A,0x1E,0x71,0x6E,0x69,0xCB,0x0B,0x75,0x46, -0x08,0xD1,0xCA,0xD2,0x2B,0x95,0xD0,0xCF,0xFB,0xB9,0x40,0x6B,0x64,0x8C,0x57,0x4D, -0xFC,0x13,0x11,0x79,0x84,0xED,0x5E,0x54,0xF6,0x34,0x9F,0x08,0x01,0xF3,0x10,0x25, -0x06,0x17,0x4A,0xDA,0xF1,0x1D,0x7A,0x66,0x6B,0x98,0x60,0x66,0xA4,0xD9,0xEF,0xD2, -0x2E,0x82,0xF1,0xF0,0xEF,0x09,0xEA,0x44,0xC9,0x15,0x6A,0xE2,0x03,0x6E,0x33,0xD3, -0xAC,0x9F,0x55,0x00,0xC7,0xF6,0x08,0x6A,0x94,0xB9,0x5F,0xDC,0xE0,0x33,0xF1,0x84, -0x60,0xF9,0x5B,0x27,0x11,0xB4,0xFC,0x16,0xF2,0xBB,0x56,0x6A,0x80,0x25,0x8D,0x02, -0x03,0x01,0x00,0x01,0xA3,0x81,0xB2,0x30,0x81,0xAF,0x30,0x0F,0x06,0x03,0x55,0x1D, -0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55, -0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x6D,0x06,0x08,0x2B, -0x06,0x01,0x05,0x05,0x07,0x01,0x0C,0x04,0x61,0x30,0x5F,0xA1,0x5D,0xA0,0x5B,0x30, -0x59,0x30,0x57,0x30,0x55,0x16,0x09,0x69,0x6D,0x61,0x67,0x65,0x2F,0x67,0x69,0x66, -0x30,0x21,0x30,0x1F,0x30,0x07,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x04,0x14,0x8F, -0xE5,0xD3,0x1A,0x86,0xAC,0x8D,0x8E,0x6B,0xC3,0xCF,0x80,0x6A,0xD4,0x48,0x18,0x2C, -0x7B,0x19,0x2E,0x30,0x25,0x16,0x23,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x6C,0x6F, -0x67,0x6F,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F, -0x76,0x73,0x6C,0x6F,0x67,0x6F,0x2E,0x67,0x69,0x66,0x30,0x1D,0x06,0x03,0x55,0x1D, -0x0E,0x04,0x16,0x04,0x14,0xB6,0x77,0xFA,0x69,0x48,0x47,0x9F,0x53,0x12,0xD5,0xC2, -0xEA,0x07,0x32,0x76,0x07,0xD1,0x97,0x07,0x19,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48, -0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x4A,0xF8,0xF8, -0xB0,0x03,0xE6,0x2C,0x67,0x7B,0xE4,0x94,0x77,0x63,0xCC,0x6E,0x4C,0xF9,0x7D,0x0E, -0x0D,0xDC,0xC8,0xB9,0x35,0xB9,0x70,0x4F,0x63,0xFA,0x24,0xFA,0x6C,0x83,0x8C,0x47, -0x9D,0x3B,0x63,0xF3,0x9A,0xF9,0x76,0x32,0x95,0x91,0xB1,0x77,0xBC,0xAC,0x9A,0xBE, -0xB1,0xE4,0x31,0x21,0xC6,0x81,0x95,0x56,0x5A,0x0E,0xB1,0xC2,0xD4,0xB1,0xA6,0x59, -0xAC,0xF1,0x63,0xCB,0xB8,0x4C,0x1D,0x59,0x90,0x4A,0xEF,0x90,0x16,0x28,0x1F,0x5A, -0xAE,0x10,0xFB,0x81,0x50,0x38,0x0C,0x6C,0xCC,0xF1,0x3D,0xC3,0xF5,0x63,0xE3,0xB3, -0xE3,0x21,0xC9,0x24,0x39,0xE9,0xFD,0x15,0x66,0x46,0xF4,0x1B,0x11,0xD0,0x4D,0x73, -0xA3,0x7D,0x46,0xF9,0x3D,0xED,0xA8,0x5F,0x62,0xD4,0xF1,0x3F,0xF8,0xE0,0x74,0x57, -0x2B,0x18,0x9D,0x81,0xB4,0xC4,0x28,0xDA,0x94,0x97,0xA5,0x70,0xEB,0xAC,0x1D,0xBE, -0x07,0x11,0xF0,0xD5,0xDB,0xDD,0xE5,0x8C,0xF0,0xD5,0x32,0xB0,0x83,0xE6,0x57,0xE2, -0x8F,0xBF,0xBE,0xA1,0xAA,0xBF,0x3D,0x1D,0xB5,0xD4,0x38,0xEA,0xD7,0xB0,0x5C,0x3A, -0x4F,0x6A,0x3F,0x8F,0xC0,0x66,0x6C,0x63,0xAA,0xE9,0xD9,0xA4,0x16,0xF4,0x81,0xD1, -0x95,0x14,0x0E,0x7D,0xCD,0x95,0x34,0xD9,0xD2,0x8F,0x70,0x73,0x81,0x7B,0x9C,0x7E, -0xBD,0x98,0x61,0xD8,0x45,0x87,0x98,0x90,0xC5,0xEB,0x86,0x30,0xC6,0x35,0xBF,0xF0, -0xFF,0xC3,0x55,0x88,0x83,0x4B,0xEF,0x05,0x92,0x06,0x71,0xF2,0xB8,0x98,0x93,0xB7, -0xEC,0xCD,0x82,0x61,0xF1,0x38,0xE6,0x4F,0x97,0x98,0x2A,0x5A,0x8D, -}; - - -/* subject:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2007 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G4 */ -/* issuer :/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2007 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G4 */ - - -const unsigned char VeriSign_Class_3_Public_Primary_Certification_Authority___G4_certificate[904]={ -0x30,0x82,0x03,0x84,0x30,0x82,0x03,0x0A,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x2F, -0x80,0xFE,0x23,0x8C,0x0E,0x22,0x0F,0x48,0x67,0x12,0x28,0x91,0x87,0xAC,0xB3,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x81,0xCA,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20, -0x49,0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56, -0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65, -0x74,0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31, -0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x37,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67, -0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75, -0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C, -0x79,0x31,0x45,0x30,0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69, -0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62, -0x6C,0x69,0x63,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72, -0x69,0x74,0x79,0x20,0x2D,0x20,0x47,0x34,0x30,0x1E,0x17,0x0D,0x30,0x37,0x31,0x31, -0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31, -0x38,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0xCA,0x31,0x0B,0x30,0x09,0x06, -0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04, -0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63, -0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56,0x65,0x72,0x69, -0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74,0x77,0x6F, -0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31,0x28,0x63,0x29, -0x20,0x32,0x30,0x30,0x37,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20, -0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F, -0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x45, -0x30,0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69,0x53,0x69,0x67, -0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62,0x6C,0x69,0x63, -0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69, -0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79, -0x20,0x2D,0x20,0x47,0x34,0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D, -0x02,0x01,0x06,0x05,0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0xA7,0x56,0x7A, -0x7C,0x52,0xDA,0x64,0x9B,0x0E,0x2D,0x5C,0xD8,0x5E,0xAC,0x92,0x3D,0xFE,0x01,0xE6, -0x19,0x4A,0x3D,0x14,0x03,0x4B,0xFA,0x60,0x27,0x20,0xD9,0x83,0x89,0x69,0xFA,0x54, -0xC6,0x9A,0x18,0x5E,0x55,0x2A,0x64,0xDE,0x06,0xF6,0x8D,0x4A,0x3B,0xAD,0x10,0x3C, -0x65,0x3D,0x90,0x88,0x04,0x89,0xE0,0x30,0x61,0xB3,0xAE,0x5D,0x01,0xA7,0x7B,0xDE, -0x7C,0xB2,0xBE,0xCA,0x65,0x61,0x00,0x86,0xAE,0xDA,0x8F,0x7B,0xD0,0x89,0xAD,0x4D, -0x1D,0x59,0x9A,0x41,0xB1,0xBC,0x47,0x80,0xDC,0x9E,0x62,0xC3,0xF9,0xA3,0x81,0xB2, -0x30,0x81,0xAF,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30, -0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04, -0x03,0x02,0x01,0x06,0x30,0x6D,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x0C, -0x04,0x61,0x30,0x5F,0xA1,0x5D,0xA0,0x5B,0x30,0x59,0x30,0x57,0x30,0x55,0x16,0x09, -0x69,0x6D,0x61,0x67,0x65,0x2F,0x67,0x69,0x66,0x30,0x21,0x30,0x1F,0x30,0x07,0x06, -0x05,0x2B,0x0E,0x03,0x02,0x1A,0x04,0x14,0x8F,0xE5,0xD3,0x1A,0x86,0xAC,0x8D,0x8E, -0x6B,0xC3,0xCF,0x80,0x6A,0xD4,0x48,0x18,0x2C,0x7B,0x19,0x2E,0x30,0x25,0x16,0x23, -0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x6C,0x6F,0x67,0x6F,0x2E,0x76,0x65,0x72,0x69, -0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x76,0x73,0x6C,0x6F,0x67,0x6F,0x2E, -0x67,0x69,0x66,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xB3,0x16, -0x91,0xFD,0xEE,0xA6,0x6E,0xE4,0xB5,0x2E,0x49,0x8F,0x87,0x78,0x81,0x80,0xEC,0xE5, -0xB1,0xB5,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x68, -0x00,0x30,0x65,0x02,0x30,0x66,0x21,0x0C,0x18,0x26,0x60,0x5A,0x38,0x7B,0x56,0x42, -0xE0,0xA7,0xFC,0x36,0x84,0x51,0x91,0x20,0x2C,0x76,0x4D,0x43,0x3D,0xC4,0x1D,0x84, -0x23,0xD0,0xAC,0xD6,0x7C,0x35,0x06,0xCE,0xCD,0x69,0xBD,0x90,0x0D,0xDB,0x6C,0x48, -0x42,0x1D,0x0E,0xAA,0x42,0x02,0x31,0x00,0x9C,0x3D,0x48,0x39,0x23,0x39,0x58,0x1A, -0x15,0x12,0x59,0x6A,0x9E,0xEF,0xD5,0x59,0xB2,0x1D,0x52,0x2C,0x99,0x71,0xCD,0xC7, -0x29,0xDF,0x1B,0x2A,0x61,0x7B,0x71,0xD1,0xDE,0xF3,0xC0,0xE5,0x0D,0x3A,0x4A,0xAA, -0x2D,0xA7,0xD8,0x86,0x2A,0xDD,0x2E,0x10, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root G2 */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root G2 */ - - -const unsigned char DigiCert_Global_Root_G2_certificate[914]={ -0x30,0x82,0x03,0x8E,0x30,0x82,0x02,0x76,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x03, -0x3A,0xF1,0xE6,0xA7,0x11,0xA9,0xA0,0xBB,0x28,0x64,0xB1,0x1D,0x09,0xFA,0xE5,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x61, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F,0x74,0x20,0x47, -0x32,0x30,0x1E,0x17,0x0D,0x31,0x33,0x30,0x38,0x30,0x31,0x31,0x32,0x30,0x30,0x30, -0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x35,0x31,0x32,0x30,0x30,0x30,0x30, -0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53, -0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43, -0x65,0x72,0x74,0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B, -0x13,0x10,0x77,0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63, -0x6F,0x6D,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x44,0x69,0x67, -0x69,0x43,0x65,0x72,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F, -0x74,0x20,0x47,0x32,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A, -0x02,0x82,0x01,0x01,0x00,0xBB,0x37,0xCD,0x34,0xDC,0x7B,0x6B,0xC9,0xB2,0x68,0x90, -0xAD,0x4A,0x75,0xFF,0x46,0xBA,0x21,0x0A,0x08,0x8D,0xF5,0x19,0x54,0xC9,0xFB,0x88, -0xDB,0xF3,0xAE,0xF2,0x3A,0x89,0x91,0x3C,0x7A,0xE6,0xAB,0x06,0x1A,0x6B,0xCF,0xAC, -0x2D,0xE8,0x5E,0x09,0x24,0x44,0xBA,0x62,0x9A,0x7E,0xD6,0xA3,0xA8,0x7E,0xE0,0x54, -0x75,0x20,0x05,0xAC,0x50,0xB7,0x9C,0x63,0x1A,0x6C,0x30,0xDC,0xDA,0x1F,0x19,0xB1, -0xD7,0x1E,0xDE,0xFD,0xD7,0xE0,0xCB,0x94,0x83,0x37,0xAE,0xEC,0x1F,0x43,0x4E,0xDD, -0x7B,0x2C,0xD2,0xBD,0x2E,0xA5,0x2F,0xE4,0xA9,0xB8,0xAD,0x3A,0xD4,0x99,0xA4,0xB6, -0x25,0xE9,0x9B,0x6B,0x00,0x60,0x92,0x60,0xFF,0x4F,0x21,0x49,0x18,0xF7,0x67,0x90, -0xAB,0x61,0x06,0x9C,0x8F,0xF2,0xBA,0xE9,0xB4,0xE9,0x92,0x32,0x6B,0xB5,0xF3,0x57, -0xE8,0x5D,0x1B,0xCD,0x8C,0x1D,0xAB,0x95,0x04,0x95,0x49,0xF3,0x35,0x2D,0x96,0xE3, -0x49,0x6D,0xDD,0x77,0xE3,0xFB,0x49,0x4B,0xB4,0xAC,0x55,0x07,0xA9,0x8F,0x95,0xB3, -0xB4,0x23,0xBB,0x4C,0x6D,0x45,0xF0,0xF6,0xA9,0xB2,0x95,0x30,0xB4,0xFD,0x4C,0x55, -0x8C,0x27,0x4A,0x57,0x14,0x7C,0x82,0x9D,0xCD,0x73,0x92,0xD3,0x16,0x4A,0x06,0x0C, -0x8C,0x50,0xD1,0x8F,0x1E,0x09,0xBE,0x17,0xA1,0xE6,0x21,0xCA,0xFD,0x83,0xE5,0x10, -0xBC,0x83,0xA5,0x0A,0xC4,0x67,0x28,0xF6,0x73,0x14,0x14,0x3D,0x46,0x76,0xC3,0x87, -0x14,0x89,0x21,0x34,0x4D,0xAF,0x0F,0x45,0x0C,0xA6,0x49,0xA1,0xBA,0xBB,0x9C,0xC5, -0xB1,0x33,0x83,0x29,0x85,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0F, -0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30, -0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30, -0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x4E,0x22,0x54,0x20,0x18,0x95, -0xE6,0xE3,0x6E,0xE6,0x0F,0xFA,0xFA,0xB9,0x12,0xED,0x06,0x17,0x8F,0x39,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01, -0x01,0x00,0x60,0x67,0x28,0x94,0x6F,0x0E,0x48,0x63,0xEB,0x31,0xDD,0xEA,0x67,0x18, -0xD5,0x89,0x7D,0x3C,0xC5,0x8B,0x4A,0x7F,0xE9,0xBE,0xDB,0x2B,0x17,0xDF,0xB0,0x5F, -0x73,0x77,0x2A,0x32,0x13,0x39,0x81,0x67,0x42,0x84,0x23,0xF2,0x45,0x67,0x35,0xEC, -0x88,0xBF,0xF8,0x8F,0xB0,0x61,0x0C,0x34,0xA4,0xAE,0x20,0x4C,0x84,0xC6,0xDB,0xF8, -0x35,0xE1,0x76,0xD9,0xDF,0xA6,0x42,0xBB,0xC7,0x44,0x08,0x86,0x7F,0x36,0x74,0x24, -0x5A,0xDA,0x6C,0x0D,0x14,0x59,0x35,0xBD,0xF2,0x49,0xDD,0xB6,0x1F,0xC9,0xB3,0x0D, -0x47,0x2A,0x3D,0x99,0x2F,0xBB,0x5C,0xBB,0xB5,0xD4,0x20,0xE1,0x99,0x5F,0x53,0x46, -0x15,0xDB,0x68,0x9B,0xF0,0xF3,0x30,0xD5,0x3E,0x31,0xE2,0x8D,0x84,0x9E,0xE3,0x8A, -0xDA,0xDA,0x96,0x3E,0x35,0x13,0xA5,0x5F,0xF0,0xF9,0x70,0x50,0x70,0x47,0x41,0x11, -0x57,0x19,0x4E,0xC0,0x8F,0xAE,0x06,0xC4,0x95,0x13,0x17,0x2F,0x1B,0x25,0x9F,0x75, -0xF2,0xB1,0x8E,0x99,0xA1,0x6F,0x13,0xB1,0x41,0x71,0xFE,0x88,0x2A,0xC8,0x4F,0x10, -0x20,0x55,0xD7,0xF3,0x14,0x45,0xE5,0xE0,0x44,0xF4,0xEA,0x87,0x95,0x32,0x93,0x0E, -0xFE,0x53,0x46,0xFA,0x2C,0x9D,0xFF,0x8B,0x22,0xB9,0x4B,0xD9,0x09,0x45,0xA4,0xDE, -0xA4,0xB8,0x9A,0x58,0xDD,0x1B,0x7D,0x52,0x9F,0x8E,0x59,0x43,0x88,0x81,0xA4,0x9E, -0x26,0xD5,0x6F,0xAD,0xDD,0x0D,0xC6,0x37,0x7D,0xED,0x03,0x92,0x1B,0xE5,0x77,0x5F, -0x76,0xEE,0x3C,0x8D,0xC4,0x5D,0x56,0x5B,0xA2,0xD9,0x66,0x6E,0xB3,0x35,0x37,0xE5, -0x32,0xB6, -}; - - -/* subject:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Class 1 CA Root */ -/* issuer :/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Class 1 CA Root */ - - -const unsigned char AddTrust_Low_Value_Services_Root_certificate[1052]={ -0x30,0x82,0x04,0x18,0x30,0x82,0x03,0x00,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x65,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14, -0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73, -0x74,0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0B,0x13,0x14,0x41, -0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77, -0x6F,0x72,0x6B,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x03,0x13,0x18,0x41,0x64, -0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43, -0x41,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x30,0x35,0x33,0x30, -0x31,0x30,0x33,0x38,0x33,0x31,0x5A,0x17,0x0D,0x32,0x30,0x30,0x35,0x33,0x30,0x31, -0x30,0x33,0x38,0x33,0x31,0x5A,0x30,0x65,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x53,0x45,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B, -0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06, -0x03,0x55,0x04,0x0B,0x13,0x14,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54, -0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x21,0x30,0x1F,0x06,0x03, -0x55,0x04,0x03,0x13,0x18,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x43,0x6C, -0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01, -0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00, -0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0x96,0x96, -0xD4,0x21,0x49,0x60,0xE2,0x6B,0xE8,0x41,0x07,0x0C,0xDE,0xC4,0xE0,0xDC,0x13,0x23, -0xCD,0xC1,0x35,0xC7,0xFB,0xD6,0x4E,0x11,0x0A,0x67,0x5E,0xF5,0x06,0x5B,0x6B,0xA5, -0x08,0x3B,0x5B,0x29,0x16,0x3A,0xE7,0x87,0xB2,0x34,0x06,0xC5,0xBC,0x05,0xA5,0x03, -0x7C,0x82,0xCB,0x29,0x10,0xAE,0xE1,0x88,0x81,0xBD,0xD6,0x9E,0xD3,0xFE,0x2D,0x56, -0xC1,0x15,0xCE,0xE3,0x26,0x9D,0x15,0x2E,0x10,0xFB,0x06,0x8F,0x30,0x04,0xDE,0xA7, -0xB4,0x63,0xB4,0xFF,0xB1,0x9C,0xAE,0x3C,0xAF,0x77,0xB6,0x56,0xC5,0xB5,0xAB,0xA2, -0xE9,0x69,0x3A,0x3D,0x0E,0x33,0x79,0x32,0x3F,0x70,0x82,0x92,0x99,0x61,0x6D,0x8D, -0x30,0x08,0x8F,0x71,0x3F,0xA6,0x48,0x57,0x19,0xF8,0x25,0xDC,0x4B,0x66,0x5C,0xA5, -0x74,0x8F,0x98,0xAE,0xC8,0xF9,0xC0,0x06,0x22,0xE7,0xAC,0x73,0xDF,0xA5,0x2E,0xFB, -0x52,0xDC,0xB1,0x15,0x65,0x20,0xFA,0x35,0x66,0x69,0xDE,0xDF,0x2C,0xF1,0x6E,0xBC, -0x30,0xDB,0x2C,0x24,0x12,0xDB,0xEB,0x35,0x35,0x68,0x90,0xCB,0x00,0xB0,0x97,0x21, -0x3D,0x74,0x21,0x23,0x65,0x34,0x2B,0xBB,0x78,0x59,0xA3,0xD6,0xE1,0x76,0x39,0x9A, -0xA4,0x49,0x8E,0x8C,0x74,0xAF,0x6E,0xA4,0x9A,0xA3,0xD9,0x9B,0xD2,0x38,0x5C,0x9B, -0xA2,0x18,0xCC,0x75,0x23,0x84,0xBE,0xEB,0xE2,0x4D,0x33,0x71,0x8E,0x1A,0xF0,0xC2, -0xF8,0xC7,0x1D,0xA2,0xAD,0x03,0x97,0x2C,0xF8,0xCF,0x25,0xC6,0xF6,0xB8,0x24,0x31, -0xB1,0x63,0x5D,0x92,0x7F,0x63,0xF0,0x25,0xC9,0x53,0x2E,0x1F,0xBF,0x4D,0x02,0x03, -0x01,0x00,0x01,0xA3,0x81,0xD2,0x30,0x81,0xCF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E, -0x04,0x16,0x04,0x14,0x95,0xB1,0xB4,0xF0,0x94,0xB6,0xBD,0xC7,0xDA,0xD1,0x11,0x09, -0x21,0xBE,0xC1,0xAF,0x49,0xFD,0x10,0x7B,0x30,0x0B,0x06,0x03,0x55,0x1D,0x0F,0x04, -0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x81,0x8F,0x06,0x03,0x55,0x1D,0x23,0x04,0x81, -0x87,0x30,0x81,0x84,0x80,0x14,0x95,0xB1,0xB4,0xF0,0x94,0xB6,0xBD,0xC7,0xDA,0xD1, -0x11,0x09,0x21,0xBE,0xC1,0xAF,0x49,0xFD,0x10,0x7B,0xA1,0x69,0xA4,0x67,0x30,0x65, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14,0x30, -0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74, -0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0B,0x13,0x14,0x41,0x64, -0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F, -0x72,0x6B,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x03,0x13,0x18,0x41,0x64,0x64, -0x54,0x72,0x75,0x73,0x74,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41, -0x20,0x52,0x6F,0x6F,0x74,0x82,0x01,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x2C,0x6D,0x64,0x1B, -0x1F,0xCD,0x0D,0xDD,0xB9,0x01,0xFA,0x96,0x63,0x34,0x32,0x48,0x47,0x99,0xAE,0x97, -0xED,0xFD,0x72,0x16,0xA6,0x73,0x47,0x5A,0xF4,0xEB,0xDD,0xE9,0xF5,0xD6,0xFB,0x45, -0xCC,0x29,0x89,0x44,0x5D,0xBF,0x46,0x39,0x3D,0xE8,0xEE,0xBC,0x4D,0x54,0x86,0x1E, -0x1D,0x6C,0xE3,0x17,0x27,0x43,0xE1,0x89,0x56,0x2B,0xA9,0x6F,0x72,0x4E,0x49,0x33, -0xE3,0x72,0x7C,0x2A,0x23,0x9A,0xBC,0x3E,0xFF,0x28,0x2A,0xED,0xA3,0xFF,0x1C,0x23, -0xBA,0x43,0x57,0x09,0x67,0x4D,0x4B,0x62,0x06,0x2D,0xF8,0xFF,0x6C,0x9D,0x60,0x1E, -0xD8,0x1C,0x4B,0x7D,0xB5,0x31,0x2F,0xD9,0xD0,0x7C,0x5D,0xF8,0xDE,0x6B,0x83,0x18, -0x78,0x37,0x57,0x2F,0xE8,0x33,0x07,0x67,0xDF,0x1E,0xC7,0x6B,0x2A,0x95,0x76,0xAE, -0x8F,0x57,0xA3,0xF0,0xF4,0x52,0xB4,0xA9,0x53,0x08,0xCF,0xE0,0x4F,0xD3,0x7A,0x53, -0x8B,0xFD,0xBB,0x1C,0x56,0x36,0xF2,0xFE,0xB2,0xB6,0xE5,0x76,0xBB,0xD5,0x22,0x65, -0xA7,0x3F,0xFE,0xD1,0x66,0xAD,0x0B,0xBC,0x6B,0x99,0x86,0xEF,0x3F,0x7D,0xF3,0x18, -0x32,0xCA,0x7B,0xC6,0xE3,0xAB,0x64,0x46,0x95,0xF8,0x26,0x69,0xD9,0x55,0x83,0x7B, -0x2C,0x96,0x07,0xFF,0x59,0x2C,0x44,0xA3,0xC6,0xE5,0xE9,0xA9,0xDC,0xA1,0x63,0x80, -0x5A,0x21,0x5E,0x21,0xCF,0x53,0x54,0xF0,0xBA,0x6F,0x89,0xDB,0xA8,0xAA,0x95,0xCF, -0x8B,0xE3,0x71,0xCC,0x1E,0x1B,0x20,0x44,0x08,0xC0,0x7A,0xB6,0x40,0xFD,0xC4,0xE4, -0x35,0xE1,0x1D,0x16,0x1C,0xD0,0xBC,0x2B,0x8E,0xD6,0x71,0xD9, -}; - - -/* subject:/C=US/O=AffirmTrust/CN=AffirmTrust Premium ECC */ -/* issuer :/C=US/O=AffirmTrust/CN=AffirmTrust Premium ECC */ - - -const unsigned char AffirmTrust_Premium_ECC_certificate[514]={ -0x30,0x82,0x01,0xFE,0x30,0x82,0x01,0x85,0xA0,0x03,0x02,0x01,0x02,0x02,0x08,0x74, -0x97,0x25,0x8A,0xC7,0x3F,0x7A,0x54,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D, -0x04,0x03,0x03,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02, -0x55,0x53,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x0C,0x0B,0x41,0x66,0x66, -0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04, -0x03,0x0C,0x17,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x20,0x50, -0x72,0x65,0x6D,0x69,0x75,0x6D,0x20,0x45,0x43,0x43,0x30,0x1E,0x17,0x0D,0x31,0x30, -0x30,0x31,0x32,0x39,0x31,0x34,0x32,0x30,0x32,0x34,0x5A,0x17,0x0D,0x34,0x30,0x31, -0x32,0x33,0x31,0x31,0x34,0x32,0x30,0x32,0x34,0x5A,0x30,0x45,0x31,0x0B,0x30,0x09, -0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06,0x03,0x55, -0x04,0x0A,0x0C,0x0B,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x31, -0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x0C,0x17,0x41,0x66,0x66,0x69,0x72,0x6D, -0x54,0x72,0x75,0x73,0x74,0x20,0x50,0x72,0x65,0x6D,0x69,0x75,0x6D,0x20,0x45,0x43, -0x43,0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05, -0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0x0D,0x30,0x5E,0x1B,0x15,0x9D,0x03, -0xD0,0xA1,0x79,0x35,0xB7,0x3A,0x3C,0x92,0x7A,0xCA,0x15,0x1C,0xCD,0x62,0xF3,0x9C, -0x26,0x5C,0x07,0x3D,0xE5,0x54,0xFA,0xA3,0xD6,0xCC,0x12,0xEA,0xF4,0x14,0x5F,0xE8, -0x8E,0x19,0xAB,0x2F,0x2E,0x48,0xE6,0xAC,0x18,0x43,0x78,0xAC,0xD0,0x37,0xC3,0xBD, -0xB2,0xCD,0x2C,0xE6,0x47,0xE2,0x1A,0xE6,0x63,0xB8,0x3D,0x2E,0x2F,0x78,0xC4,0x4F, -0xDB,0xF4,0x0F,0xA4,0x68,0x4C,0x55,0x72,0x6B,0x95,0x1D,0x4E,0x18,0x42,0x95,0x78, -0xCC,0x37,0x3C,0x91,0xE2,0x9B,0x65,0x2B,0x29,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9A,0xAF,0x29,0x7A,0xC0,0x11,0x35,0x35, -0x26,0x51,0x30,0x00,0xC3,0x6A,0xFE,0x40,0xD5,0xAE,0xD6,0x3C,0x30,0x0F,0x06,0x03, -0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06, -0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0A,0x06, -0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x67,0x00,0x30,0x64,0x02,0x30, -0x17,0x09,0xF3,0x87,0x88,0x50,0x5A,0xAF,0xC8,0xC0,0x42,0xBF,0x47,0x5F,0xF5,0x6C, -0x6A,0x86,0xE0,0xC4,0x27,0x74,0xE4,0x38,0x53,0xD7,0x05,0x7F,0x1B,0x34,0xE3,0xC6, -0x2F,0xB3,0xCA,0x09,0x3C,0x37,0x9D,0xD7,0xE7,0xB8,0x46,0xF1,0xFD,0xA1,0xE2,0x71, -0x02,0x30,0x42,0x59,0x87,0x43,0xD4,0x51,0xDF,0xBA,0xD3,0x09,0x32,0x5A,0xCE,0x88, -0x7E,0x57,0x3D,0x9C,0x5F,0x42,0x6B,0xF5,0x07,0x2D,0xB5,0xF0,0x82,0x93,0xF9,0x59, -0x6F,0xAE,0x64,0xFA,0x58,0xE5,0x8B,0x1E,0xE3,0x63,0xBE,0xB5,0x81,0xCD,0x6F,0x02, -0x8C,0x79, -}; - - -/* subject:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 1999 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 4 Public Primary Certification Authority - G3 */ -/* issuer :/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 1999 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 4 Public Primary Certification Authority - G3 */ - - -const unsigned char Verisign_Class_4_Public_Primary_Certification_Authority___G3_certificate[1054]={ -0x30,0x82,0x04,0x1A,0x30,0x82,0x03,0x02,0x02,0x11,0x00,0xEC,0xA0,0xA7,0x8B,0x6E, -0x75,0x6A,0x01,0xCF,0xC4,0x7C,0xCC,0x2F,0x94,0x5E,0xD7,0x30,0x0D,0x06,0x09,0x2A, -0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81,0xCA,0x31,0x0B,0x30, -0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03, -0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49, -0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56,0x65, -0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74, -0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31,0x28, -0x63,0x29,0x20,0x31,0x39,0x39,0x39,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E, -0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74, -0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79, -0x31,0x45,0x30,0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69,0x53, -0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x34,0x20,0x50,0x75,0x62,0x6C, -0x69,0x63,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x20,0x2D,0x20,0x47,0x33,0x30,0x1E,0x17,0x0D,0x39,0x39,0x31,0x30,0x30, -0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x36,0x30,0x37,0x31,0x36, -0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0xCA,0x31,0x0B,0x30,0x09,0x06,0x03, -0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A, -0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E, -0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56,0x65,0x72,0x69,0x53, -0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72, -0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31,0x28,0x63,0x29,0x20, -0x31,0x39,0x39,0x39,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49, -0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72, -0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x45,0x30, -0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E, -0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x34,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x20, -0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20, -0x2D,0x20,0x47,0x33,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A, -0x02,0x82,0x01,0x01,0x00,0xAD,0xCB,0xA5,0x11,0x69,0xC6,0x59,0xAB,0xF1,0x8F,0xB5, -0x19,0x0F,0x56,0xCE,0xCC,0xB5,0x1F,0x20,0xE4,0x9E,0x26,0x25,0x4B,0xE0,0x73,0x65, -0x89,0x59,0xDE,0xD0,0x83,0xE4,0xF5,0x0F,0xB5,0xBB,0xAD,0xF1,0x7C,0xE8,0x21,0xFC, -0xE4,0xE8,0x0C,0xEE,0x7C,0x45,0x22,0x19,0x76,0x92,0xB4,0x13,0xB7,0x20,0x5B,0x09, -0xFA,0x61,0xAE,0xA8,0xF2,0xA5,0x8D,0x85,0xC2,0x2A,0xD6,0xDE,0x66,0x36,0xD2,0x9B, -0x02,0xF4,0xA8,0x92,0x60,0x7C,0x9C,0x69,0xB4,0x8F,0x24,0x1E,0xD0,0x86,0x52,0xF6, -0x32,0x9C,0x41,0x58,0x1E,0x22,0xBD,0xCD,0x45,0x62,0x95,0x08,0x6E,0xD0,0x66,0xDD, -0x53,0xA2,0xCC,0xF0,0x10,0xDC,0x54,0x73,0x8B,0x04,0xA1,0x46,0x33,0x33,0x5C,0x17, -0x40,0xB9,0x9E,0x4D,0xD3,0xF3,0xBE,0x55,0x83,0xE8,0xB1,0x89,0x8E,0x5A,0x7C,0x9A, -0x96,0x22,0x90,0x3B,0x88,0x25,0xF2,0xD2,0x53,0x88,0x02,0x0C,0x0B,0x78,0xF2,0xE6, -0x37,0x17,0x4B,0x30,0x46,0x07,0xE4,0x80,0x6D,0xA6,0xD8,0x96,0x2E,0xE8,0x2C,0xF8, -0x11,0xB3,0x38,0x0D,0x66,0xA6,0x9B,0xEA,0xC9,0x23,0x5B,0xDB,0x8E,0xE2,0xF3,0x13, -0x8E,0x1A,0x59,0x2D,0xAA,0x02,0xF0,0xEC,0xA4,0x87,0x66,0xDC,0xC1,0x3F,0xF5,0xD8, -0xB9,0xF4,0xEC,0x82,0xC6,0xD2,0x3D,0x95,0x1D,0xE5,0xC0,0x4F,0x84,0xC9,0xD9,0xA3, -0x44,0x28,0x06,0x6A,0xD7,0x45,0xAC,0xF0,0x6B,0x6A,0xEF,0x4E,0x5F,0xF8,0x11,0x82, -0x1E,0x38,0x63,0x34,0x66,0x50,0xD4,0x3E,0x93,0x73,0xFA,0x30,0xC3,0x66,0xAD,0xFF, -0x93,0x2D,0x97,0xEF,0x03,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x8F,0xFA, -0x25,0x6B,0x4F,0x5B,0xE4,0xA4,0x4E,0x27,0x55,0xAB,0x22,0x15,0x59,0x3C,0xCA,0xB5, -0x0A,0xD4,0x4A,0xDB,0xAB,0xDD,0xA1,0x5F,0x53,0xC5,0xA0,0x57,0x39,0xC2,0xCE,0x47, -0x2B,0xBE,0x3A,0xC8,0x56,0xBF,0xC2,0xD9,0x27,0x10,0x3A,0xB1,0x05,0x3C,0xC0,0x77, -0x31,0xBB,0x3A,0xD3,0x05,0x7B,0x6D,0x9A,0x1C,0x30,0x8C,0x80,0xCB,0x93,0x93,0x2A, -0x83,0xAB,0x05,0x51,0x82,0x02,0x00,0x11,0x67,0x6B,0xF3,0x88,0x61,0x47,0x5F,0x03, -0x93,0xD5,0x5B,0x0D,0xE0,0xF1,0xD4,0xA1,0x32,0x35,0x85,0xB2,0x3A,0xDB,0xB0,0x82, -0xAB,0xD1,0xCB,0x0A,0xBC,0x4F,0x8C,0x5B,0xC5,0x4B,0x00,0x3B,0x1F,0x2A,0x82,0xA6, -0x7E,0x36,0x85,0xDC,0x7E,0x3C,0x67,0x00,0xB5,0xE4,0x3B,0x52,0xE0,0xA8,0xEB,0x5D, -0x15,0xF9,0xC6,0x6D,0xF0,0xAD,0x1D,0x0E,0x85,0xB7,0xA9,0x9A,0x73,0x14,0x5A,0x5B, -0x8F,0x41,0x28,0xC0,0xD5,0xE8,0x2D,0x4D,0xA4,0x5E,0xCD,0xAA,0xD9,0xED,0xCE,0xDC, -0xD8,0xD5,0x3C,0x42,0x1D,0x17,0xC1,0x12,0x5D,0x45,0x38,0xC3,0x38,0xF3,0xFC,0x85, -0x2E,0x83,0x46,0x48,0xB2,0xD7,0x20,0x5F,0x92,0x36,0x8F,0xE7,0x79,0x0F,0x98,0x5E, -0x99,0xE8,0xF0,0xD0,0xA4,0xBB,0xF5,0x53,0xBD,0x2A,0xCE,0x59,0xB0,0xAF,0x6E,0x7F, -0x6C,0xBB,0xD2,0x1E,0x00,0xB0,0x21,0xED,0xF8,0x41,0x62,0x82,0xB9,0xD8,0xB2,0xC4, -0xBB,0x46,0x50,0xF3,0x31,0xC5,0x8F,0x01,0xA8,0x74,0xEB,0xF5,0x78,0x27,0xDA,0xE7, -0xF7,0x66,0x43,0xF3,0x9E,0x83,0x3E,0x20,0xAA,0xC3,0x35,0x60,0x91,0xCE, -}; - - -/* subject:/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2006 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA */ -/* issuer :/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2006 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA */ - - -const unsigned char thawte_Primary_Root_CA_certificate[1060]={ -0x30,0x82,0x04,0x20,0x30,0x82,0x03,0x08,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x34, -0x4E,0xD5,0x57,0x20,0xD5,0xED,0xEC,0x49,0xF4,0x2F,0xCE,0x37,0xDB,0x2B,0x6D,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81, -0xA9,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15, -0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x74,0x68,0x61,0x77,0x74,0x65,0x2C, -0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x03,0x55,0x04,0x0B,0x13,0x1F, -0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x53,0x65, -0x72,0x76,0x69,0x63,0x65,0x73,0x20,0x44,0x69,0x76,0x69,0x73,0x69,0x6F,0x6E,0x31, -0x38,0x30,0x36,0x06,0x03,0x55,0x04,0x0B,0x13,0x2F,0x28,0x63,0x29,0x20,0x32,0x30, -0x30,0x36,0x20,0x74,0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20, -0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64, -0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55, -0x04,0x03,0x13,0x16,0x74,0x68,0x61,0x77,0x74,0x65,0x20,0x50,0x72,0x69,0x6D,0x61, -0x72,0x79,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x36, -0x31,0x31,0x31,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x36,0x30, -0x37,0x31,0x36,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0xA9,0x31,0x0B,0x30, -0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03, -0x55,0x04,0x0A,0x13,0x0C,0x74,0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63, -0x2E,0x31,0x28,0x30,0x26,0x06,0x03,0x55,0x04,0x0B,0x13,0x1F,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x53,0x65,0x72,0x76,0x69,0x63, -0x65,0x73,0x20,0x44,0x69,0x76,0x69,0x73,0x69,0x6F,0x6E,0x31,0x38,0x30,0x36,0x06, -0x03,0x55,0x04,0x0B,0x13,0x2F,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x36,0x20,0x74, -0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F, -0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65, -0x20,0x6F,0x6E,0x6C,0x79,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16, -0x74,0x68,0x61,0x77,0x74,0x65,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x52, -0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82, -0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAC,0xA0,0xF0,0xFB,0x80,0x59,0xD4,0x9C,0xC7, -0xA4,0xCF,0x9D,0xA1,0x59,0x73,0x09,0x10,0x45,0x0C,0x0D,0x2C,0x6E,0x68,0xF1,0x6C, -0x5B,0x48,0x68,0x49,0x59,0x37,0xFC,0x0B,0x33,0x19,0xC2,0x77,0x7F,0xCC,0x10,0x2D, -0x95,0x34,0x1C,0xE6,0xEB,0x4D,0x09,0xA7,0x1C,0xD2,0xB8,0xC9,0x97,0x36,0x02,0xB7, -0x89,0xD4,0x24,0x5F,0x06,0xC0,0xCC,0x44,0x94,0x94,0x8D,0x02,0x62,0x6F,0xEB,0x5A, -0xDD,0x11,0x8D,0x28,0x9A,0x5C,0x84,0x90,0x10,0x7A,0x0D,0xBD,0x74,0x66,0x2F,0x6A, -0x38,0xA0,0xE2,0xD5,0x54,0x44,0xEB,0x1D,0x07,0x9F,0x07,0xBA,0x6F,0xEE,0xE9,0xFD, -0x4E,0x0B,0x29,0xF5,0x3E,0x84,0xA0,0x01,0xF1,0x9C,0xAB,0xF8,0x1C,0x7E,0x89,0xA4, -0xE8,0xA1,0xD8,0x71,0x65,0x0D,0xA3,0x51,0x7B,0xEE,0xBC,0xD2,0x22,0x60,0x0D,0xB9, -0x5B,0x9D,0xDF,0xBA,0xFC,0x51,0x5B,0x0B,0xAF,0x98,0xB2,0xE9,0x2E,0xE9,0x04,0xE8, -0x62,0x87,0xDE,0x2B,0xC8,0xD7,0x4E,0xC1,0x4C,0x64,0x1E,0xDD,0xCF,0x87,0x58,0xBA, -0x4A,0x4F,0xCA,0x68,0x07,0x1D,0x1C,0x9D,0x4A,0xC6,0xD5,0x2F,0x91,0xCC,0x7C,0x71, -0x72,0x1C,0xC5,0xC0,0x67,0xEB,0x32,0xFD,0xC9,0x92,0x5C,0x94,0xDA,0x85,0xC0,0x9B, -0xBF,0x53,0x7D,0x2B,0x09,0xF4,0x8C,0x9D,0x91,0x1F,0x97,0x6A,0x52,0xCB,0xDE,0x09, -0x36,0xA4,0x77,0xD8,0x7B,0x87,0x50,0x44,0xD5,0x3E,0x6E,0x29,0x69,0xFB,0x39,0x49, -0x26,0x1E,0x09,0xA5,0x80,0x7B,0x40,0x2D,0xEB,0xE8,0x27,0x85,0xC9,0xFE,0x61,0xFD, -0x7E,0xE6,0x7C,0x97,0x1D,0xD5,0x9D,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40, -0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01, -0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01, -0x06,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x7B,0x5B,0x45,0xCF, -0xAF,0xCE,0xCB,0x7A,0xFD,0x31,0x92,0x1A,0x6A,0xB6,0xF3,0x46,0xEB,0x57,0x48,0x50, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03, -0x82,0x01,0x01,0x00,0x79,0x11,0xC0,0x4B,0xB3,0x91,0xB6,0xFC,0xF0,0xE9,0x67,0xD4, -0x0D,0x6E,0x45,0xBE,0x55,0xE8,0x93,0xD2,0xCE,0x03,0x3F,0xED,0xDA,0x25,0xB0,0x1D, -0x57,0xCB,0x1E,0x3A,0x76,0xA0,0x4C,0xEC,0x50,0x76,0xE8,0x64,0x72,0x0C,0xA4,0xA9, -0xF1,0xB8,0x8B,0xD6,0xD6,0x87,0x84,0xBB,0x32,0xE5,0x41,0x11,0xC0,0x77,0xD9,0xB3, -0x60,0x9D,0xEB,0x1B,0xD5,0xD1,0x6E,0x44,0x44,0xA9,0xA6,0x01,0xEC,0x55,0x62,0x1D, -0x77,0xB8,0x5C,0x8E,0x48,0x49,0x7C,0x9C,0x3B,0x57,0x11,0xAC,0xAD,0x73,0x37,0x8E, -0x2F,0x78,0x5C,0x90,0x68,0x47,0xD9,0x60,0x60,0xE6,0xFC,0x07,0x3D,0x22,0x20,0x17, -0xC4,0xF7,0x16,0xE9,0xC4,0xD8,0x72,0xF9,0xC8,0x73,0x7C,0xDF,0x16,0x2F,0x15,0xA9, -0x3E,0xFD,0x6A,0x27,0xB6,0xA1,0xEB,0x5A,0xBA,0x98,0x1F,0xD5,0xE3,0x4D,0x64,0x0A, -0x9D,0x13,0xC8,0x61,0xBA,0xF5,0x39,0x1C,0x87,0xBA,0xB8,0xBD,0x7B,0x22,0x7F,0xF6, -0xFE,0xAC,0x40,0x79,0xE5,0xAC,0x10,0x6F,0x3D,0x8F,0x1B,0x79,0x76,0x8B,0xC4,0x37, -0xB3,0x21,0x18,0x84,0xE5,0x36,0x00,0xEB,0x63,0x20,0x99,0xB9,0xE9,0xFE,0x33,0x04, -0xBB,0x41,0xC8,0xC1,0x02,0xF9,0x44,0x63,0x20,0x9E,0x81,0xCE,0x42,0xD3,0xD6,0x3F, -0x2C,0x76,0xD3,0x63,0x9C,0x59,0xDD,0x8F,0xA6,0xE1,0x0E,0xA0,0x2E,0x41,0xF7,0x2E, -0x95,0x47,0xCF,0xBC,0xFD,0x33,0xF3,0xF6,0x0B,0x61,0x7E,0x7E,0x91,0x2B,0x81,0x47, -0xC2,0x27,0x30,0xEE,0xA7,0x10,0x5D,0x37,0x8F,0x5C,0x39,0x2B,0xE4,0x04,0xF0,0x7B, -0x8D,0x56,0x8C,0x68, -}; - - -/* subject:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Public CA Root */ -/* issuer :/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Public CA Root */ - - -const unsigned char AddTrust_Public_Services_Root_certificate[1049]={ -0x30,0x82,0x04,0x15,0x30,0x82,0x02,0xFD,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x64,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14, -0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73, -0x74,0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0B,0x13,0x14,0x41, -0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77, -0x6F,0x72,0x6B,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x41,0x64, -0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x43,0x41, -0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x30,0x35,0x33,0x30,0x31, -0x30,0x34,0x31,0x35,0x30,0x5A,0x17,0x0D,0x32,0x30,0x30,0x35,0x33,0x30,0x31,0x30, -0x34,0x31,0x35,0x30,0x5A,0x30,0x64,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06, -0x13,0x02,0x53,0x45,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41, -0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06,0x03, -0x55,0x04,0x0B,0x13,0x14,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54,0x54, -0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x20,0x30,0x1E,0x06,0x03,0x55, -0x04,0x03,0x13,0x17,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x50,0x75,0x62, -0x6C,0x69,0x63,0x20,0x43,0x41,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0x22,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82, -0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xE9,0x1A,0x30,0x8F, -0x83,0x88,0x14,0xC1,0x20,0xD8,0x3C,0x9B,0x8F,0x1B,0x7E,0x03,0x74,0xBB,0xDA,0x69, -0xD3,0x46,0xA5,0xF8,0x8E,0xC2,0x0C,0x11,0x90,0x51,0xA5,0x2F,0x66,0x54,0x40,0x55, -0xEA,0xDB,0x1F,0x4A,0x56,0xEE,0x9F,0x23,0x6E,0xF4,0x39,0xCB,0xA1,0xB9,0x6F,0xF2, -0x7E,0xF9,0x5D,0x87,0x26,0x61,0x9E,0x1C,0xF8,0xE2,0xEC,0xA6,0x81,0xF8,0x21,0xC5, -0x24,0xCC,0x11,0x0C,0x3F,0xDB,0x26,0x72,0x7A,0xC7,0x01,0x97,0x07,0x17,0xF9,0xD7, -0x18,0x2C,0x30,0x7D,0x0E,0x7A,0x1E,0x62,0x1E,0xC6,0x4B,0xC0,0xFD,0x7D,0x62,0x77, -0xD3,0x44,0x1E,0x27,0xF6,0x3F,0x4B,0x44,0xB3,0xB7,0x38,0xD9,0x39,0x1F,0x60,0xD5, -0x51,0x92,0x73,0x03,0xB4,0x00,0x69,0xE3,0xF3,0x14,0x4E,0xEE,0xD1,0xDC,0x09,0xCF, -0x77,0x34,0x46,0x50,0xB0,0xF8,0x11,0xF2,0xFE,0x38,0x79,0xF7,0x07,0x39,0xFE,0x51, -0x92,0x97,0x0B,0x5B,0x08,0x5F,0x34,0x86,0x01,0xAD,0x88,0x97,0xEB,0x66,0xCD,0x5E, -0xD1,0xFF,0xDC,0x7D,0xF2,0x84,0xDA,0xBA,0x77,0xAD,0xDC,0x80,0x08,0xC7,0xA7,0x87, -0xD6,0x55,0x9F,0x97,0x6A,0xE8,0xC8,0x11,0x64,0xBA,0xE7,0x19,0x29,0x3F,0x11,0xB3, -0x78,0x90,0x84,0x20,0x52,0x5B,0x11,0xEF,0x78,0xD0,0x83,0xF6,0xD5,0x48,0x90,0xD0, -0x30,0x1C,0xCF,0x80,0xF9,0x60,0xFE,0x79,0xE4,0x88,0xF2,0xDD,0x00,0xEB,0x94,0x45, -0xEB,0x65,0x94,0x69,0x40,0xBA,0xC0,0xD5,0xB4,0xB8,0xBA,0x7D,0x04,0x11,0xA8,0xEB, -0x31,0x05,0x96,0x94,0x4E,0x58,0x21,0x8E,0x9F,0xD0,0x60,0xFD,0x02,0x03,0x01,0x00, -0x01,0xA3,0x81,0xD1,0x30,0x81,0xCE,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16, -0x04,0x14,0x81,0x3E,0x37,0xD8,0x92,0xB0,0x1F,0x77,0x9F,0x5C,0xB4,0xAB,0x73,0xAA, -0xE7,0xF6,0x34,0x60,0x2F,0xFA,0x30,0x0B,0x06,0x03,0x55,0x1D,0x0F,0x04,0x04,0x03, -0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30, -0x03,0x01,0x01,0xFF,0x30,0x81,0x8E,0x06,0x03,0x55,0x1D,0x23,0x04,0x81,0x86,0x30, -0x81,0x83,0x80,0x14,0x81,0x3E,0x37,0xD8,0x92,0xB0,0x1F,0x77,0x9F,0x5C,0xB4,0xAB, -0x73,0xAA,0xE7,0xF6,0x34,0x60,0x2F,0xFA,0xA1,0x68,0xA4,0x66,0x30,0x64,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14,0x30,0x12,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x41, -0x42,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0B,0x13,0x14,0x41,0x64,0x64,0x54, -0x72,0x75,0x73,0x74,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B, -0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x41,0x64,0x64,0x54,0x72, -0x75,0x73,0x74,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x43,0x41,0x20,0x52,0x6F, -0x6F,0x74,0x82,0x01,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x03,0xF7,0x15,0x4A,0xF8,0x24,0xDA, -0x23,0x56,0x16,0x93,0x76,0xDD,0x36,0x28,0xB9,0xAE,0x1B,0xB8,0xC3,0xF1,0x64,0xBA, -0x20,0x18,0x78,0x95,0x29,0x27,0x57,0x05,0xBC,0x7C,0x2A,0xF4,0xB9,0x51,0x55,0xDA, -0x87,0x02,0xDE,0x0F,0x16,0x17,0x31,0xF8,0xAA,0x79,0x2E,0x09,0x13,0xBB,0xAF,0xB2, -0x20,0x19,0x12,0xE5,0x93,0xF9,0x4B,0xF9,0x83,0xE8,0x44,0xD5,0xB2,0x41,0x25,0xBF, -0x88,0x75,0x6F,0xFF,0x10,0xFC,0x4A,0x54,0xD0,0x5F,0xF0,0xFA,0xEF,0x36,0x73,0x7D, -0x1B,0x36,0x45,0xC6,0x21,0x6D,0xB4,0x15,0xB8,0x4E,0xCF,0x9C,0x5C,0xA5,0x3D,0x5A, -0x00,0x8E,0x06,0xE3,0x3C,0x6B,0x32,0x7B,0xF2,0x9F,0xF0,0xB6,0xFD,0xDF,0xF0,0x28, -0x18,0x48,0xF0,0xC6,0xBC,0xD0,0xBF,0x34,0x80,0x96,0xC2,0x4A,0xB1,0x6D,0x8E,0xC7, -0x90,0x45,0xDE,0x2F,0x67,0xAC,0x45,0x04,0xA3,0x7A,0xDC,0x55,0x92,0xC9,0x47,0x66, -0xD8,0x1A,0x8C,0xC7,0xED,0x9C,0x4E,0x9A,0xE0,0x12,0xBB,0xB5,0x6A,0x4C,0x84,0xE1, -0xE1,0x22,0x0D,0x87,0x00,0x64,0xFE,0x8C,0x7D,0x62,0x39,0x65,0xA6,0xEF,0x42,0xB6, -0x80,0x25,0x12,0x61,0x01,0xA8,0x24,0x13,0x70,0x00,0x11,0x26,0x5F,0xFA,0x35,0x50, -0xC5,0x48,0xCC,0x06,0x47,0xE8,0x27,0xD8,0x70,0x8D,0x5F,0x64,0xE6,0xA1,0x44,0x26, -0x5E,0x22,0xEC,0x92,0xCD,0xFF,0x42,0x9A,0x44,0x21,0x6D,0x5C,0xC5,0xE3,0x22,0x1D, -0x5F,0x47,0x12,0xE7,0xCE,0x5F,0x5D,0xFA,0xD8,0xAA,0xB1,0x33,0x2D,0xD9,0x76,0xF2, -0x4E,0x3A,0x33,0x0C,0x2B,0xB3,0x2D,0x90,0x06, -}; - - -/* subject:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Qualified CA Root */ -/* issuer :/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Qualified CA Root */ - - -const unsigned char AddTrust_Qualified_Certificates_Root_certificate[1058]={ -0x30,0x82,0x04,0x1E,0x30,0x82,0x03,0x06,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x67,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14, -0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73, -0x74,0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0B,0x13,0x14,0x41, -0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77, -0x6F,0x72,0x6B,0x31,0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x41,0x64, -0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x51,0x75,0x61,0x6C,0x69,0x66,0x69,0x65,0x64, -0x20,0x43,0x41,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x30,0x35, -0x33,0x30,0x31,0x30,0x34,0x34,0x35,0x30,0x5A,0x17,0x0D,0x32,0x30,0x30,0x35,0x33, -0x30,0x31,0x30,0x34,0x34,0x35,0x30,0x5A,0x30,0x67,0x31,0x0B,0x30,0x09,0x06,0x03, -0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A, -0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x41,0x42,0x31,0x1D,0x30, -0x1B,0x06,0x03,0x55,0x04,0x0B,0x13,0x14,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74, -0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x23,0x30,0x21, -0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20, -0x51,0x75,0x61,0x6C,0x69,0x66,0x69,0x65,0x64,0x20,0x43,0x41,0x20,0x52,0x6F,0x6F, -0x74,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01, -0x01,0x00,0xE4,0x1E,0x9A,0xFE,0xDC,0x09,0x5A,0x87,0xA4,0x9F,0x47,0xBE,0x11,0x5F, -0xAF,0x84,0x34,0xDB,0x62,0x3C,0x79,0x78,0xB7,0xE9,0x30,0xB5,0xEC,0x0C,0x1C,0x2A, -0xC4,0x16,0xFF,0xE0,0xEC,0x71,0xEB,0x8A,0xF5,0x11,0x6E,0xED,0x4F,0x0D,0x91,0xD2, -0x12,0x18,0x2D,0x49,0x15,0x01,0xC2,0xA4,0x22,0x13,0xC7,0x11,0x64,0xFF,0x22,0x12, -0x9A,0xB9,0x8E,0x5C,0x2F,0x08,0xCF,0x71,0x6A,0xB3,0x67,0x01,0x59,0xF1,0x5D,0x46, -0xF3,0xB0,0x78,0xA5,0xF6,0x0E,0x42,0x7A,0xE3,0x7F,0x1B,0xCC,0xD0,0xF0,0xB7,0x28, -0xFD,0x2A,0xEA,0x9E,0xB3,0xB0,0xB9,0x04,0xAA,0xFD,0xF6,0xC7,0xB4,0xB1,0xB8,0x2A, -0xA0,0xFB,0x58,0xF1,0x19,0xA0,0x6F,0x70,0x25,0x7E,0x3E,0x69,0x4A,0x7F,0x0F,0x22, -0xD8,0xEF,0xAD,0x08,0x11,0x9A,0x29,0x99,0xE1,0xAA,0x44,0x45,0x9A,0x12,0x5E,0x3E, -0x9D,0x6D,0x52,0xFC,0xE7,0xA0,0x3D,0x68,0x2F,0xF0,0x4B,0x70,0x7C,0x13,0x38,0xAD, -0xBC,0x15,0x25,0xF1,0xD6,0xCE,0xAB,0xA2,0xC0,0x31,0xD6,0x2F,0x9F,0xE0,0xFF,0x14, -0x59,0xFC,0x84,0x93,0xD9,0x87,0x7C,0x4C,0x54,0x13,0xEB,0x9F,0xD1,0x2D,0x11,0xF8, -0x18,0x3A,0x3A,0xDE,0x25,0xD9,0xF7,0xD3,0x40,0xED,0xA4,0x06,0x12,0xC4,0x3B,0xE1, -0x91,0xC1,0x56,0x35,0xF0,0x14,0xDC,0x65,0x36,0x09,0x6E,0xAB,0xA4,0x07,0xC7,0x35, -0xD1,0xC2,0x03,0x33,0x36,0x5B,0x75,0x26,0x6D,0x42,0xF1,0x12,0x6B,0x43,0x6F,0x4B, -0x71,0x94,0xFA,0x34,0x1D,0xED,0x13,0x6E,0xCA,0x80,0x7F,0x98,0x2F,0x6C,0xB9,0x65, -0xD8,0xE9,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0xD4,0x30,0x81,0xD1,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x39,0x95,0x8B,0x62,0x8B,0x5C,0xC9,0xD4, -0x80,0xBA,0x58,0x0F,0x97,0x3F,0x15,0x08,0x43,0xCC,0x98,0xA7,0x30,0x0B,0x06,0x03, -0x55,0x1D,0x0F,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13, -0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x81,0x91,0x06,0x03,0x55, -0x1D,0x23,0x04,0x81,0x89,0x30,0x81,0x86,0x80,0x14,0x39,0x95,0x8B,0x62,0x8B,0x5C, -0xC9,0xD4,0x80,0xBA,0x58,0x0F,0x97,0x3F,0x15,0x08,0x43,0xCC,0x98,0xA7,0xA1,0x6B, -0xA4,0x69,0x30,0x67,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53, -0x45,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54, -0x72,0x75,0x73,0x74,0x20,0x41,0x42,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0B, -0x13,0x14,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x54,0x54,0x50,0x20,0x4E, -0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,0x13, -0x1A,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x51,0x75,0x61,0x6C,0x69,0x66, -0x69,0x65,0x64,0x20,0x43,0x41,0x20,0x52,0x6F,0x6F,0x74,0x82,0x01,0x01,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01, -0x01,0x00,0x19,0xAB,0x75,0xEA,0xF8,0x8B,0x65,0x61,0x95,0x13,0xBA,0x69,0x04,0xEF, -0x86,0xCA,0x13,0xA0,0xC7,0xAA,0x4F,0x64,0x1B,0x3F,0x18,0xF6,0xA8,0x2D,0x2C,0x55, -0x8F,0x05,0xB7,0x30,0xEA,0x42,0x6A,0x1D,0xC0,0x25,0x51,0x2D,0xA7,0xBF,0x0C,0xB3, -0xED,0xEF,0x08,0x7F,0x6C,0x3C,0x46,0x1A,0xEA,0x18,0x43,0xDF,0x76,0xCC,0xF9,0x66, -0x86,0x9C,0x2C,0x68,0xF5,0xE9,0x17,0xF8,0x31,0xB3,0x18,0xC4,0xD6,0x48,0x7D,0x23, -0x4C,0x68,0xC1,0x7E,0xBB,0x01,0x14,0x6F,0xC5,0xD9,0x6E,0xDE,0xBB,0x04,0x42,0x6A, -0xF8,0xF6,0x5C,0x7D,0xE5,0xDA,0xFA,0x87,0xEB,0x0D,0x35,0x52,0x67,0xD0,0x9E,0x97, -0x76,0x05,0x93,0x3F,0x95,0xC7,0x01,0xE6,0x69,0x55,0x38,0x7F,0x10,0x61,0x99,0xC9, -0xE3,0x5F,0xA6,0xCA,0x3E,0x82,0x63,0x48,0xAA,0xE2,0x08,0x48,0x3E,0xAA,0xF2,0xB2, -0x85,0x62,0xA6,0xB4,0xA7,0xD9,0xBD,0x37,0x9C,0x68,0xB5,0x2D,0x56,0x7D,0xB0,0xB7, -0x3F,0xA0,0xB1,0x07,0xD6,0xE9,0x4F,0xDC,0xDE,0x45,0x71,0x30,0x32,0x7F,0x1B,0x2E, -0x09,0xF9,0xBF,0x52,0xA1,0xEE,0xC2,0x80,0x3E,0x06,0x5C,0x2E,0x55,0x40,0xC1,0x1B, -0xF5,0x70,0x45,0xB0,0xDC,0x5D,0xFA,0xF6,0x72,0x5A,0x77,0xD2,0x63,0xCD,0xCF,0x58, -0x89,0x00,0x42,0x63,0x3F,0x79,0x39,0xD0,0x44,0xB0,0x82,0x6E,0x41,0x19,0xE8,0xDD, -0xE0,0xC1,0x88,0x5A,0xD1,0x1E,0x71,0x93,0x1F,0x24,0x30,0x74,0xE5,0x1E,0xA8,0xDE, -0x3C,0x27,0x37,0x7F,0x83,0xAE,0x9E,0x77,0xCF,0xF0,0x30,0xB1,0xFF,0x4B,0x99,0xE8, -0xC6,0xA1, -}; - - -/* subject:/C=US/O=GeoTrust Inc./OU=(c) 2008 GeoTrust Inc. - For authorized use only/CN=GeoTrust Primary Certification Authority - G3 */ -/* issuer :/C=US/O=GeoTrust Inc./OU=(c) 2008 GeoTrust Inc. - For authorized use only/CN=GeoTrust Primary Certification Authority - G3 */ - - -const unsigned char GeoTrust_Primary_Certification_Authority___G3_certificate[1026]={ -0x30,0x82,0x03,0xFE,0x30,0x82,0x02,0xE6,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x15, -0xAC,0x6E,0x94,0x19,0xB2,0x79,0x4B,0x41,0xF6,0x27,0xA9,0xC3,0x18,0x0F,0x1F,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x81, -0x98,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16, -0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73, -0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x39,0x30,0x37,0x06,0x03,0x55,0x04,0x0B,0x13, -0x30,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x38,0x20,0x47,0x65,0x6F,0x54,0x72,0x75, -0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75, -0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C, -0x79,0x31,0x36,0x30,0x34,0x06,0x03,0x55,0x04,0x03,0x13,0x2D,0x47,0x65,0x6F,0x54, -0x72,0x75,0x73,0x74,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F, -0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x47,0x33,0x30,0x1E,0x17,0x0D,0x30,0x38,0x30, -0x34,0x30,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x37,0x31,0x32, -0x30,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0x98,0x31,0x0B,0x30,0x09, -0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55, -0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63, -0x2E,0x31,0x39,0x30,0x37,0x06,0x03,0x55,0x04,0x0B,0x13,0x30,0x28,0x63,0x29,0x20, -0x32,0x30,0x30,0x38,0x20,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E, -0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69, -0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x36,0x30,0x34, -0x06,0x03,0x55,0x04,0x03,0x13,0x2D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20, -0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20, -0x2D,0x20,0x47,0x33,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A, -0x02,0x82,0x01,0x01,0x00,0xDC,0xE2,0x5E,0x62,0x58,0x1D,0x33,0x57,0x39,0x32,0x33, -0xFA,0xEB,0xCB,0x87,0x8C,0xA7,0xD4,0x4A,0xDD,0x06,0x88,0xEA,0x64,0x8E,0x31,0x98, -0xA5,0x38,0x90,0x1E,0x98,0xCF,0x2E,0x63,0x2B,0xF0,0x46,0xBC,0x44,0xB2,0x89,0xA1, -0xC0,0x28,0x0C,0x49,0x70,0x21,0x95,0x9F,0x64,0xC0,0xA6,0x93,0x12,0x02,0x65,0x26, -0x86,0xC6,0xA5,0x89,0xF0,0xFA,0xD7,0x84,0xA0,0x70,0xAF,0x4F,0x1A,0x97,0x3F,0x06, -0x44,0xD5,0xC9,0xEB,0x72,0x10,0x7D,0xE4,0x31,0x28,0xFB,0x1C,0x61,0xE6,0x28,0x07, -0x44,0x73,0x92,0x22,0x69,0xA7,0x03,0x88,0x6C,0x9D,0x63,0xC8,0x52,0xDA,0x98,0x27, -0xE7,0x08,0x4C,0x70,0x3E,0xB4,0xC9,0x12,0xC1,0xC5,0x67,0x83,0x5D,0x33,0xF3,0x03, -0x11,0xEC,0x6A,0xD0,0x53,0xE2,0xD1,0xBA,0x36,0x60,0x94,0x80,0xBB,0x61,0x63,0x6C, -0x5B,0x17,0x7E,0xDF,0x40,0x94,0x1E,0xAB,0x0D,0xC2,0x21,0x28,0x70,0x88,0xFF,0xD6, -0x26,0x6C,0x6C,0x60,0x04,0x25,0x4E,0x55,0x7E,0x7D,0xEF,0xBF,0x94,0x48,0xDE,0xB7, -0x1D,0xDD,0x70,0x8D,0x05,0x5F,0x88,0xA5,0x9B,0xF2,0xC2,0xEE,0xEA,0xD1,0x40,0x41, -0x6D,0x62,0x38,0x1D,0x56,0x06,0xC5,0x03,0x47,0x51,0x20,0x19,0xFC,0x7B,0x10,0x0B, -0x0E,0x62,0xAE,0x76,0x55,0xBF,0x5F,0x77,0xBE,0x3E,0x49,0x01,0x53,0x3D,0x98,0x25, -0x03,0x76,0x24,0x5A,0x1D,0xB4,0xDB,0x89,0xEA,0x79,0xE5,0xB6,0xB3,0x3B,0x3F,0xBA, -0x4C,0x28,0x41,0x7F,0x06,0xAC,0x6A,0x8E,0xC1,0xD0,0xF6,0x05,0x1D,0x7D,0xE6,0x42, -0x86,0xE3,0xA5,0xD5,0x47,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0F, -0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30, -0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30, -0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xC4,0x79,0xCA,0x8E,0xA1,0x4E, -0x03,0x1D,0x1C,0xDC,0x6B,0xDB,0x31,0x5B,0x94,0x3E,0x3F,0x30,0x7F,0x2D,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01, -0x01,0x00,0x2D,0xC5,0x13,0xCF,0x56,0x80,0x7B,0x7A,0x78,0xBD,0x9F,0xAE,0x2C,0x99, -0xE7,0xEF,0xDA,0xDF,0x94,0x5E,0x09,0x69,0xA7,0xE7,0x6E,0x68,0x8C,0xBD,0x72,0xBE, -0x47,0xA9,0x0E,0x97,0x12,0xB8,0x4A,0xF1,0x64,0xD3,0x39,0xDF,0x25,0x34,0xD4,0xC1, -0xCD,0x4E,0x81,0xF0,0x0F,0x04,0xC4,0x24,0xB3,0x34,0x96,0xC6,0xA6,0xAA,0x30,0xDF, -0x68,0x61,0x73,0xD7,0xF9,0x8E,0x85,0x89,0xEF,0x0E,0x5E,0x95,0x28,0x4A,0x2A,0x27, -0x8F,0x10,0x8E,0x2E,0x7C,0x86,0xC4,0x02,0x9E,0xDA,0x0C,0x77,0x65,0x0E,0x44,0x0D, -0x92,0xFD,0xFD,0xB3,0x16,0x36,0xFA,0x11,0x0D,0x1D,0x8C,0x0E,0x07,0x89,0x6A,0x29, -0x56,0xF7,0x72,0xF4,0xDD,0x15,0x9C,0x77,0x35,0x66,0x57,0xAB,0x13,0x53,0xD8,0x8E, -0xC1,0x40,0xC5,0xD7,0x13,0x16,0x5A,0x72,0xC7,0xB7,0x69,0x01,0xC4,0x7A,0xB1,0x83, -0x01,0x68,0x7D,0x8D,0x41,0xA1,0x94,0x18,0xC1,0x25,0x5C,0xFC,0xF0,0xFE,0x83,0x02, -0x87,0x7C,0x0D,0x0D,0xCF,0x2E,0x08,0x5C,0x4A,0x40,0x0D,0x3E,0xEC,0x81,0x61,0xE6, -0x24,0xDB,0xCA,0xE0,0x0E,0x2D,0x07,0xB2,0x3E,0x56,0xDC,0x8D,0xF5,0x41,0x85,0x07, -0x48,0x9B,0x0C,0x0B,0xCB,0x49,0x3F,0x7D,0xEC,0xB7,0xFD,0xCB,0x8D,0x67,0x89,0x1A, -0xAB,0xED,0xBB,0x1E,0xA3,0x00,0x08,0x08,0x17,0x2A,0x82,0x5C,0x31,0x5D,0x46,0x8A, -0x2D,0x0F,0x86,0x9B,0x74,0xD9,0x45,0xFB,0xD4,0x40,0xB1,0x7A,0xAA,0x68,0x2D,0x86, -0xB2,0x99,0x22,0xE1,0xC1,0x2B,0xC7,0x9C,0xF8,0xF3,0x5F,0xA8,0x82,0x12,0xEB,0x19, -0x11,0x2D, -}; - - -/* subject:/C=US/O=GeoTrust Inc./CN=GeoTrust Universal CA 2 */ -/* issuer :/C=US/O=GeoTrust Inc./CN=GeoTrust Universal CA 2 */ - - -const unsigned char GeoTrust_Universal_CA_2_certificate[1392]={ -0x30,0x82,0x05,0x6C,0x30,0x82,0x03,0x54,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x47,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16, -0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73, -0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13, -0x17,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x55,0x6E,0x69,0x76,0x65,0x72, -0x73,0x61,0x6C,0x20,0x43,0x41,0x20,0x32,0x30,0x1E,0x17,0x0D,0x30,0x34,0x30,0x33, -0x30,0x34,0x30,0x35,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x39,0x30,0x33,0x30, -0x34,0x30,0x35,0x30,0x30,0x30,0x30,0x5A,0x30,0x47,0x31,0x0B,0x30,0x09,0x06,0x03, -0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A, -0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31, -0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x47,0x65,0x6F,0x54,0x72,0x75, -0x73,0x74,0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73,0x61,0x6C,0x20,0x43,0x41,0x20, -0x32,0x30,0x82,0x02,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x01,0x05,0x00,0x03,0x82,0x02,0x0F,0x00,0x30,0x82,0x02,0x0A,0x02,0x82,0x02, -0x01,0x00,0xB3,0x54,0x52,0xC1,0xC9,0x3E,0xF2,0xD9,0xDC,0xB1,0x53,0x1A,0x59,0x29, -0xE7,0xB1,0xC3,0x45,0x28,0xE5,0xD7,0xD1,0xED,0xC5,0xC5,0x4B,0xA1,0xAA,0x74,0x7B, -0x57,0xAF,0x4A,0x26,0xFC,0xD8,0xF5,0x5E,0xA7,0x6E,0x19,0xDB,0x74,0x0C,0x4F,0x35, -0x5B,0x32,0x0B,0x01,0xE3,0xDB,0xEB,0x7A,0x77,0x35,0xEA,0xAA,0x5A,0xE0,0xD6,0xE8, -0xA1,0x57,0x94,0xF0,0x90,0xA3,0x74,0x56,0x94,0x44,0x30,0x03,0x1E,0x5C,0x4E,0x2B, -0x85,0x26,0x74,0x82,0x7A,0x0C,0x76,0xA0,0x6F,0x4D,0xCE,0x41,0x2D,0xA0,0x15,0x06, -0x14,0x5F,0xB7,0x42,0xCD,0x7B,0x8F,0x58,0x61,0x34,0xDC,0x2A,0x08,0xF9,0x2E,0xC3, -0x01,0xA6,0x22,0x44,0x1C,0x4C,0x07,0x82,0xE6,0x5B,0xCE,0xD0,0x4A,0x7C,0x04,0xD3, -0x19,0x73,0x27,0xF0,0xAA,0x98,0x7F,0x2E,0xAF,0x4E,0xEB,0x87,0x1E,0x24,0x77,0x6A, -0x5D,0xB6,0xE8,0x5B,0x45,0xBA,0xDC,0xC3,0xA1,0x05,0x6F,0x56,0x8E,0x8F,0x10,0x26, -0xA5,0x49,0xC3,0x2E,0xD7,0x41,0x87,0x22,0xE0,0x4F,0x86,0xCA,0x60,0xB5,0xEA,0xA1, -0x63,0xC0,0x01,0x97,0x10,0x79,0xBD,0x00,0x3C,0x12,0x6D,0x2B,0x15,0xB1,0xAC,0x4B, -0xB1,0xEE,0x18,0xB9,0x4E,0x96,0xDC,0xDC,0x76,0xFF,0x3B,0xBE,0xCF,0x5F,0x03,0xC0, -0xFC,0x3B,0xE8,0xBE,0x46,0x1B,0xFF,0xDA,0x40,0xC2,0x52,0xF7,0xFE,0xE3,0x3A,0xF7, -0x6A,0x77,0x35,0xD0,0xDA,0x8D,0xEB,0x5E,0x18,0x6A,0x31,0xC7,0x1E,0xBA,0x3C,0x1B, -0x28,0xD6,0x6B,0x54,0xC6,0xAA,0x5B,0xD7,0xA2,0x2C,0x1B,0x19,0xCC,0xA2,0x02,0xF6, -0x9B,0x59,0xBD,0x37,0x6B,0x86,0xB5,0x6D,0x82,0xBA,0xD8,0xEA,0xC9,0x56,0xBC,0xA9, -0x36,0x58,0xFD,0x3E,0x19,0xF3,0xED,0x0C,0x26,0xA9,0x93,0x38,0xF8,0x4F,0xC1,0x5D, -0x22,0x06,0xD0,0x97,0xEA,0xE1,0xAD,0xC6,0x55,0xE0,0x81,0x2B,0x28,0x83,0x3A,0xFA, -0xF4,0x7B,0x21,0x51,0x00,0xBE,0x52,0x38,0xCE,0xCD,0x66,0x79,0xA8,0xF4,0x81,0x56, -0xE2,0xD0,0x83,0x09,0x47,0x51,0x5B,0x50,0x6A,0xCF,0xDB,0x48,0x1A,0x5D,0x3E,0xF7, -0xCB,0xF6,0x65,0xF7,0x6C,0xF1,0x95,0xF8,0x02,0x3B,0x32,0x56,0x82,0x39,0x7A,0x5B, -0xBD,0x2F,0x89,0x1B,0xBF,0xA1,0xB4,0xE8,0xFF,0x7F,0x8D,0x8C,0xDF,0x03,0xF1,0x60, -0x4E,0x58,0x11,0x4C,0xEB,0xA3,0x3F,0x10,0x2B,0x83,0x9A,0x01,0x73,0xD9,0x94,0x6D, -0x84,0x00,0x27,0x66,0xAC,0xF0,0x70,0x40,0x09,0x42,0x92,0xAD,0x4F,0x93,0x0D,0x61, -0x09,0x51,0x24,0xD8,0x92,0xD5,0x0B,0x94,0x61,0xB2,0x87,0xB2,0xED,0xFF,0x9A,0x35, -0xFF,0x85,0x54,0xCA,0xED,0x44,0x43,0xAC,0x1B,0x3C,0x16,0x6B,0x48,0x4A,0x0A,0x1C, -0x40,0x88,0x1F,0x92,0xC2,0x0B,0x00,0x05,0xFF,0xF2,0xC8,0x02,0x4A,0xA4,0xAA,0xA9, -0xCC,0x99,0x96,0x9C,0x2F,0x58,0xE0,0x7D,0xE1,0xBE,0xBB,0x07,0xDC,0x5F,0x04,0x72, -0x5C,0x31,0x34,0xC3,0xEC,0x5F,0x2D,0xE0,0x3D,0x64,0x90,0x22,0xE6,0xD1,0xEC,0xB8, -0x2E,0xDD,0x59,0xAE,0xD9,0xA1,0x37,0xBF,0x54,0x35,0xDC,0x73,0x32,0x4F,0x8C,0x04, -0x1E,0x33,0xB2,0xC9,0x46,0xF1,0xD8,0x5C,0xC8,0x55,0x50,0xC9,0x68,0xBD,0xA8,0xBA, -0x36,0x09,0x02,0x03,0x01,0x00,0x01,0xA3,0x63,0x30,0x61,0x30,0x0F,0x06,0x03,0x55, -0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03, -0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x76,0xF3,0x55,0xE1,0xFA,0xA4,0x36,0xFB,0xF0, -0x9F,0x5C,0x62,0x71,0xED,0x3C,0xF4,0x47,0x38,0x10,0x2B,0x30,0x1F,0x06,0x03,0x55, -0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x76,0xF3,0x55,0xE1,0xFA,0xA4,0x36,0xFB, -0xF0,0x9F,0x5C,0x62,0x71,0xED,0x3C,0xF4,0x47,0x38,0x10,0x2B,0x30,0x0E,0x06,0x03, -0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x02,0x01,0x00, -0x66,0xC1,0xC6,0x23,0xF3,0xD9,0xE0,0x2E,0x6E,0x5F,0xE8,0xCF,0xAE,0xB0,0xB0,0x25, -0x4D,0x2B,0xF8,0x3B,0x58,0x9B,0x40,0x24,0x37,0x5A,0xCB,0xAB,0x16,0x49,0xFF,0xB3, -0x75,0x79,0x33,0xA1,0x2F,0x6D,0x70,0x17,0x34,0x91,0xFE,0x67,0x7E,0x8F,0xEC,0x9B, -0xE5,0x5E,0x82,0xA9,0x55,0x1F,0x2F,0xDC,0xD4,0x51,0x07,0x12,0xFE,0xAC,0x16,0x3E, -0x2C,0x35,0xC6,0x63,0xFC,0xDC,0x10,0xEB,0x0D,0xA3,0xAA,0xD0,0x7C,0xCC,0xD1,0xD0, -0x2F,0x51,0x2E,0xC4,0x14,0x5A,0xDE,0xE8,0x19,0xE1,0x3E,0xC6,0xCC,0xA4,0x29,0xE7, -0x2E,0x84,0xAA,0x06,0x30,0x78,0x76,0x54,0x73,0x28,0x98,0x59,0x38,0xE0,0x00,0x0D, -0x62,0xD3,0x42,0x7D,0x21,0x9F,0xAE,0x3D,0x3A,0x8C,0xD5,0xFA,0x77,0x0D,0x18,0x2B, -0x16,0x0E,0x5F,0x36,0xE1,0xFC,0x2A,0xB5,0x30,0x24,0xCF,0xE0,0x63,0x0C,0x7B,0x58, -0x1A,0xFE,0x99,0xBA,0x42,0x12,0xB1,0x91,0xF4,0x7C,0x68,0xE2,0xC8,0xE8,0xAF,0x2C, -0xEA,0xC9,0x7E,0xAE,0xBB,0x2A,0x3D,0x0D,0x15,0xDC,0x34,0x95,0xB6,0x18,0x74,0xA8, -0x6A,0x0F,0xC7,0xB4,0xF4,0x13,0xC4,0xE4,0x5B,0xED,0x0A,0xD2,0xA4,0x97,0x4C,0x2A, -0xED,0x2F,0x6C,0x12,0x89,0x3D,0xF1,0x27,0x70,0xAA,0x6A,0x03,0x52,0x21,0x9F,0x40, -0xA8,0x67,0x50,0xF2,0xF3,0x5A,0x1F,0xDF,0xDF,0x23,0xF6,0xDC,0x78,0x4E,0xE6,0x98, -0x4F,0x55,0x3A,0x53,0xE3,0xEF,0xF2,0xF4,0x9F,0xC7,0x7C,0xD8,0x58,0xAF,0x29,0x22, -0x97,0xB8,0xE0,0xBD,0x91,0x2E,0xB0,0x76,0xEC,0x57,0x11,0xCF,0xEF,0x29,0x44,0xF3, -0xE9,0x85,0x7A,0x60,0x63,0xE4,0x5D,0x33,0x89,0x17,0xD9,0x31,0xAA,0xDA,0xD6,0xF3, -0x18,0x35,0x72,0xCF,0x87,0x2B,0x2F,0x63,0x23,0x84,0x5D,0x84,0x8C,0x3F,0x57,0xA0, -0x88,0xFC,0x99,0x91,0x28,0x26,0x69,0x99,0xD4,0x8F,0x97,0x44,0xBE,0x8E,0xD5,0x48, -0xB1,0xA4,0x28,0x29,0xF1,0x15,0xB4,0xE1,0xE5,0x9E,0xDD,0xF8,0x8F,0xA6,0x6F,0x26, -0xD7,0x09,0x3C,0x3A,0x1C,0x11,0x0E,0xA6,0x6C,0x37,0xF7,0xAD,0x44,0x87,0x2C,0x28, -0xC7,0xD8,0x74,0x82,0xB3,0xD0,0x6F,0x4A,0x57,0xBB,0x35,0x29,0x27,0xA0,0x8B,0xE8, -0x21,0xA7,0x87,0x64,0x36,0x5D,0xCC,0xD8,0x16,0xAC,0xC7,0xB2,0x27,0x40,0x92,0x55, -0x38,0x28,0x8D,0x51,0x6E,0xDD,0x14,0x67,0x53,0x6C,0x71,0x5C,0x26,0x84,0x4D,0x75, -0x5A,0xB6,0x7E,0x60,0x56,0xA9,0x4D,0xAD,0xFB,0x9B,0x1E,0x97,0xF3,0x0D,0xD9,0xD2, -0x97,0x54,0x77,0xDA,0x3D,0x12,0xB7,0xE0,0x1E,0xEF,0x08,0x06,0xAC,0xF9,0x85,0x87, -0xE9,0xA2,0xDC,0xAF,0x7E,0x18,0x12,0x83,0xFD,0x56,0x17,0x41,0x2E,0xD5,0x29,0x82, -0x7D,0x99,0xF4,0x31,0xF6,0x71,0xA9,0xCF,0x2C,0x01,0x27,0xA5,0x05,0xB9,0xAA,0xB2, -0x48,0x4E,0x2A,0xEF,0x9F,0x93,0x52,0x51,0x95,0x3C,0x52,0x73,0x8E,0x56,0x4C,0x17, -0x40,0xC0,0x09,0x28,0xE4,0x8B,0x6A,0x48,0x53,0xDB,0xEC,0xCD,0x55,0x55,0xF1,0xC6, -0xF8,0xE9,0xA2,0x2C,0x4C,0xA6,0xD1,0x26,0x5F,0x7E,0xAF,0x5A,0x4C,0xDA,0x1F,0xA6, -0xF2,0x1C,0x2C,0x7E,0xAE,0x02,0x16,0xD2,0x56,0xD0,0x2F,0x57,0x53,0x47,0xE8,0x92, -}; - - -/* subject:/C=IE/O=Baltimore/OU=CyberTrust/CN=Baltimore CyberTrust Root */ -/* issuer :/C=IE/O=Baltimore/OU=CyberTrust/CN=Baltimore CyberTrust Root */ - - -const unsigned char Baltimore_CyberTrust_Root_certificate[891]={ -0x30,0x82,0x03,0x77,0x30,0x82,0x02,0x5F,0xA0,0x03,0x02,0x01,0x02,0x02,0x04,0x02, -0x00,0x00,0xB9,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, -0x05,0x00,0x30,0x5A,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x49, -0x45,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x0A,0x13,0x09,0x42,0x61,0x6C,0x74, -0x69,0x6D,0x6F,0x72,0x65,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0B,0x13,0x0A, -0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x31,0x22,0x30,0x20,0x06,0x03, -0x55,0x04,0x03,0x13,0x19,0x42,0x61,0x6C,0x74,0x69,0x6D,0x6F,0x72,0x65,0x20,0x43, -0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E, -0x17,0x0D,0x30,0x30,0x30,0x35,0x31,0x32,0x31,0x38,0x34,0x36,0x30,0x30,0x5A,0x17, -0x0D,0x32,0x35,0x30,0x35,0x31,0x32,0x32,0x33,0x35,0x39,0x30,0x30,0x5A,0x30,0x5A, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x49,0x45,0x31,0x12,0x30, -0x10,0x06,0x03,0x55,0x04,0x0A,0x13,0x09,0x42,0x61,0x6C,0x74,0x69,0x6D,0x6F,0x72, -0x65,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0B,0x13,0x0A,0x43,0x79,0x62,0x65, -0x72,0x54,0x72,0x75,0x73,0x74,0x31,0x22,0x30,0x20,0x06,0x03,0x55,0x04,0x03,0x13, -0x19,0x42,0x61,0x6C,0x74,0x69,0x6D,0x6F,0x72,0x65,0x20,0x43,0x79,0x62,0x65,0x72, -0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0x22,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01, -0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xA3,0x04,0xBB,0x22,0xAB, -0x98,0x3D,0x57,0xE8,0x26,0x72,0x9A,0xB5,0x79,0xD4,0x29,0xE2,0xE1,0xE8,0x95,0x80, -0xB1,0xB0,0xE3,0x5B,0x8E,0x2B,0x29,0x9A,0x64,0xDF,0xA1,0x5D,0xED,0xB0,0x09,0x05, -0x6D,0xDB,0x28,0x2E,0xCE,0x62,0xA2,0x62,0xFE,0xB4,0x88,0xDA,0x12,0xEB,0x38,0xEB, -0x21,0x9D,0xC0,0x41,0x2B,0x01,0x52,0x7B,0x88,0x77,0xD3,0x1C,0x8F,0xC7,0xBA,0xB9, -0x88,0xB5,0x6A,0x09,0xE7,0x73,0xE8,0x11,0x40,0xA7,0xD1,0xCC,0xCA,0x62,0x8D,0x2D, -0xE5,0x8F,0x0B,0xA6,0x50,0xD2,0xA8,0x50,0xC3,0x28,0xEA,0xF5,0xAB,0x25,0x87,0x8A, -0x9A,0x96,0x1C,0xA9,0x67,0xB8,0x3F,0x0C,0xD5,0xF7,0xF9,0x52,0x13,0x2F,0xC2,0x1B, -0xD5,0x70,0x70,0xF0,0x8F,0xC0,0x12,0xCA,0x06,0xCB,0x9A,0xE1,0xD9,0xCA,0x33,0x7A, -0x77,0xD6,0xF8,0xEC,0xB9,0xF1,0x68,0x44,0x42,0x48,0x13,0xD2,0xC0,0xC2,0xA4,0xAE, -0x5E,0x60,0xFE,0xB6,0xA6,0x05,0xFC,0xB4,0xDD,0x07,0x59,0x02,0xD4,0x59,0x18,0x98, -0x63,0xF5,0xA5,0x63,0xE0,0x90,0x0C,0x7D,0x5D,0xB2,0x06,0x7A,0xF3,0x85,0xEA,0xEB, -0xD4,0x03,0xAE,0x5E,0x84,0x3E,0x5F,0xFF,0x15,0xED,0x69,0xBC,0xF9,0x39,0x36,0x72, -0x75,0xCF,0x77,0x52,0x4D,0xF3,0xC9,0x90,0x2C,0xB9,0x3D,0xE5,0xC9,0x23,0x53,0x3F, -0x1F,0x24,0x98,0x21,0x5C,0x07,0x99,0x29,0xBD,0xC6,0x3A,0xEC,0xE7,0x6E,0x86,0x3A, -0x6B,0x97,0x74,0x63,0x33,0xBD,0x68,0x18,0x31,0xF0,0x78,0x8D,0x76,0xBF,0xFC,0x9E, -0x8E,0x5D,0x2A,0x86,0xA7,0x4D,0x90,0xDC,0x27,0x1A,0x39,0x02,0x03,0x01,0x00,0x01, -0xA3,0x45,0x30,0x43,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xE5, -0x9D,0x59,0x30,0x82,0x47,0x58,0xCC,0xAC,0xFA,0x08,0x54,0x36,0x86,0x7B,0x3A,0xB5, -0x04,0x4D,0xF0,0x30,0x12,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x08,0x30, -0x06,0x01,0x01,0xFF,0x02,0x01,0x03,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01, -0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x85,0x0C,0x5D,0x8E,0xE4, -0x6F,0x51,0x68,0x42,0x05,0xA0,0xDD,0xBB,0x4F,0x27,0x25,0x84,0x03,0xBD,0xF7,0x64, -0xFD,0x2D,0xD7,0x30,0xE3,0xA4,0x10,0x17,0xEB,0xDA,0x29,0x29,0xB6,0x79,0x3F,0x76, -0xF6,0x19,0x13,0x23,0xB8,0x10,0x0A,0xF9,0x58,0xA4,0xD4,0x61,0x70,0xBD,0x04,0x61, -0x6A,0x12,0x8A,0x17,0xD5,0x0A,0xBD,0xC5,0xBC,0x30,0x7C,0xD6,0xE9,0x0C,0x25,0x8D, -0x86,0x40,0x4F,0xEC,0xCC,0xA3,0x7E,0x38,0xC6,0x37,0x11,0x4F,0xED,0xDD,0x68,0x31, -0x8E,0x4C,0xD2,0xB3,0x01,0x74,0xEE,0xBE,0x75,0x5E,0x07,0x48,0x1A,0x7F,0x70,0xFF, -0x16,0x5C,0x84,0xC0,0x79,0x85,0xB8,0x05,0xFD,0x7F,0xBE,0x65,0x11,0xA3,0x0F,0xC0, -0x02,0xB4,0xF8,0x52,0x37,0x39,0x04,0xD5,0xA9,0x31,0x7A,0x18,0xBF,0xA0,0x2A,0xF4, -0x12,0x99,0xF7,0xA3,0x45,0x82,0xE3,0x3C,0x5E,0xF5,0x9D,0x9E,0xB5,0xC8,0x9E,0x7C, -0x2E,0xC8,0xA4,0x9E,0x4E,0x08,0x14,0x4B,0x6D,0xFD,0x70,0x6D,0x6B,0x1A,0x63,0xBD, -0x64,0xE6,0x1F,0xB7,0xCE,0xF0,0xF2,0x9F,0x2E,0xBB,0x1B,0xB7,0xF2,0x50,0x88,0x73, -0x92,0xC2,0xE2,0xE3,0x16,0x8D,0x9A,0x32,0x02,0xAB,0x8E,0x18,0xDD,0xE9,0x10,0x11, -0xEE,0x7E,0x35,0xAB,0x90,0xAF,0x3E,0x30,0x94,0x7A,0xD0,0x33,0x3D,0xA7,0x65,0x0F, -0xF5,0xFC,0x8E,0x9E,0x62,0xCF,0x47,0x44,0x2C,0x01,0x5D,0xBB,0x1D,0xB5,0x32,0xD2, -0x47,0xD2,0x38,0x2E,0xD0,0xFE,0x81,0xDC,0x32,0x6A,0x1E,0xB5,0xEE,0x3C,0xD5,0xFC, -0xE7,0x81,0x1D,0x19,0xC3,0x24,0x42,0xEA,0x63,0x39,0xA9, -}; - - -/* subject:/OU=GlobalSign Root CA - R2/O=GlobalSign/CN=GlobalSign */ -/* issuer :/OU=GlobalSign Root CA - R2/O=GlobalSign/CN=GlobalSign */ - - -const unsigned char GlobalSign_Root_CA___R2_certificate[958]={ -0x30,0x82,0x03,0xBA,0x30,0x82,0x02,0xA2,0xA0,0x03,0x02,0x01,0x02,0x02,0x0B,0x04, -0x00,0x00,0x00,0x00,0x01,0x0F,0x86,0x26,0xE6,0x0D,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x4C,0x31,0x20,0x30,0x1E,0x06, -0x03,0x55,0x04,0x0B,0x13,0x17,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E, -0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x52,0x32,0x31,0x13,0x30, -0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69, -0x67,0x6E,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F, -0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x32,0x31, -0x35,0x30,0x38,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x31,0x31,0x32,0x31,0x35, -0x30,0x38,0x30,0x30,0x30,0x30,0x5A,0x30,0x4C,0x31,0x20,0x30,0x1E,0x06,0x03,0x55, -0x04,0x0B,0x13,0x17,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x20,0x52, -0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x52,0x32,0x31,0x13,0x30,0x11,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E, -0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61, -0x6C,0x53,0x69,0x67,0x6E,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48, -0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01, -0x0A,0x02,0x82,0x01,0x01,0x00,0xA6,0xCF,0x24,0x0E,0xBE,0x2E,0x6F,0x28,0x99,0x45, -0x42,0xC4,0xAB,0x3E,0x21,0x54,0x9B,0x0B,0xD3,0x7F,0x84,0x70,0xFA,0x12,0xB3,0xCB, -0xBF,0x87,0x5F,0xC6,0x7F,0x86,0xD3,0xB2,0x30,0x5C,0xD6,0xFD,0xAD,0xF1,0x7B,0xDC, -0xE5,0xF8,0x60,0x96,0x09,0x92,0x10,0xF5,0xD0,0x53,0xDE,0xFB,0x7B,0x7E,0x73,0x88, -0xAC,0x52,0x88,0x7B,0x4A,0xA6,0xCA,0x49,0xA6,0x5E,0xA8,0xA7,0x8C,0x5A,0x11,0xBC, -0x7A,0x82,0xEB,0xBE,0x8C,0xE9,0xB3,0xAC,0x96,0x25,0x07,0x97,0x4A,0x99,0x2A,0x07, -0x2F,0xB4,0x1E,0x77,0xBF,0x8A,0x0F,0xB5,0x02,0x7C,0x1B,0x96,0xB8,0xC5,0xB9,0x3A, -0x2C,0xBC,0xD6,0x12,0xB9,0xEB,0x59,0x7D,0xE2,0xD0,0x06,0x86,0x5F,0x5E,0x49,0x6A, -0xB5,0x39,0x5E,0x88,0x34,0xEC,0xBC,0x78,0x0C,0x08,0x98,0x84,0x6C,0xA8,0xCD,0x4B, -0xB4,0xA0,0x7D,0x0C,0x79,0x4D,0xF0,0xB8,0x2D,0xCB,0x21,0xCA,0xD5,0x6C,0x5B,0x7D, -0xE1,0xA0,0x29,0x84,0xA1,0xF9,0xD3,0x94,0x49,0xCB,0x24,0x62,0x91,0x20,0xBC,0xDD, -0x0B,0xD5,0xD9,0xCC,0xF9,0xEA,0x27,0x0A,0x2B,0x73,0x91,0xC6,0x9D,0x1B,0xAC,0xC8, -0xCB,0xE8,0xE0,0xA0,0xF4,0x2F,0x90,0x8B,0x4D,0xFB,0xB0,0x36,0x1B,0xF6,0x19,0x7A, -0x85,0xE0,0x6D,0xF2,0x61,0x13,0x88,0x5C,0x9F,0xE0,0x93,0x0A,0x51,0x97,0x8A,0x5A, -0xCE,0xAF,0xAB,0xD5,0xF7,0xAA,0x09,0xAA,0x60,0xBD,0xDC,0xD9,0x5F,0xDF,0x72,0xA9, -0x60,0x13,0x5E,0x00,0x01,0xC9,0x4A,0xFA,0x3F,0xA4,0xEA,0x07,0x03,0x21,0x02,0x8E, -0x82,0xCA,0x03,0xC2,0x9B,0x8F,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0x9C,0x30,0x81, -0x99,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01, -0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01, -0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9B,0xE2,0x07, -0x57,0x67,0x1C,0x1E,0xC0,0x6A,0x06,0xDE,0x59,0xB4,0x9A,0x2D,0xDF,0xDC,0x19,0x86, -0x2E,0x30,0x36,0x06,0x03,0x55,0x1D,0x1F,0x04,0x2F,0x30,0x2D,0x30,0x2B,0xA0,0x29, -0xA0,0x27,0x86,0x25,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x67, -0x6C,0x6F,0x62,0x61,0x6C,0x73,0x69,0x67,0x6E,0x2E,0x6E,0x65,0x74,0x2F,0x72,0x6F, -0x6F,0x74,0x2D,0x72,0x32,0x2E,0x63,0x72,0x6C,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23, -0x04,0x18,0x30,0x16,0x80,0x14,0x9B,0xE2,0x07,0x57,0x67,0x1C,0x1E,0xC0,0x6A,0x06, -0xDE,0x59,0xB4,0x9A,0x2D,0xDF,0xDC,0x19,0x86,0x2E,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x99,0x81, -0x53,0x87,0x1C,0x68,0x97,0x86,0x91,0xEC,0xE0,0x4A,0xB8,0x44,0x0B,0xAB,0x81,0xAC, -0x27,0x4F,0xD6,0xC1,0xB8,0x1C,0x43,0x78,0xB3,0x0C,0x9A,0xFC,0xEA,0x2C,0x3C,0x6E, -0x61,0x1B,0x4D,0x4B,0x29,0xF5,0x9F,0x05,0x1D,0x26,0xC1,0xB8,0xE9,0x83,0x00,0x62, -0x45,0xB6,0xA9,0x08,0x93,0xB9,0xA9,0x33,0x4B,0x18,0x9A,0xC2,0xF8,0x87,0x88,0x4E, -0xDB,0xDD,0x71,0x34,0x1A,0xC1,0x54,0xDA,0x46,0x3F,0xE0,0xD3,0x2A,0xAB,0x6D,0x54, -0x22,0xF5,0x3A,0x62,0xCD,0x20,0x6F,0xBA,0x29,0x89,0xD7,0xDD,0x91,0xEE,0xD3,0x5C, -0xA2,0x3E,0xA1,0x5B,0x41,0xF5,0xDF,0xE5,0x64,0x43,0x2D,0xE9,0xD5,0x39,0xAB,0xD2, -0xA2,0xDF,0xB7,0x8B,0xD0,0xC0,0x80,0x19,0x1C,0x45,0xC0,0x2D,0x8C,0xE8,0xF8,0x2D, -0xA4,0x74,0x56,0x49,0xC5,0x05,0xB5,0x4F,0x15,0xDE,0x6E,0x44,0x78,0x39,0x87,0xA8, -0x7E,0xBB,0xF3,0x79,0x18,0x91,0xBB,0xF4,0x6F,0x9D,0xC1,0xF0,0x8C,0x35,0x8C,0x5D, -0x01,0xFB,0xC3,0x6D,0xB9,0xEF,0x44,0x6D,0x79,0x46,0x31,0x7E,0x0A,0xFE,0xA9,0x82, -0xC1,0xFF,0xEF,0xAB,0x6E,0x20,0xC4,0x50,0xC9,0x5F,0x9D,0x4D,0x9B,0x17,0x8C,0x0C, -0xE5,0x01,0xC9,0xA0,0x41,0x6A,0x73,0x53,0xFA,0xA5,0x50,0xB4,0x6E,0x25,0x0F,0xFB, -0x4C,0x18,0xF4,0xFD,0x52,0xD9,0x8E,0x69,0xB1,0xE8,0x11,0x0F,0xDE,0x88,0xD8,0xFB, -0x1D,0x49,0xF7,0xAA,0xDE,0x95,0xCF,0x20,0x78,0xC2,0x60,0x12,0xDB,0x25,0x40,0x8C, -0x6A,0xFC,0x7E,0x42,0x38,0x40,0x64,0x12,0xF7,0x9E,0x81,0xE1,0x93,0x2E, -}; - - -/* subject:/OU=GlobalSign Root CA - R3/O=GlobalSign/CN=GlobalSign */ -/* issuer :/OU=GlobalSign Root CA - R3/O=GlobalSign/CN=GlobalSign */ - - -const unsigned char GlobalSign_Root_CA___R3_certificate[867]={ -0x30,0x82,0x03,0x5F,0x30,0x82,0x02,0x47,0xA0,0x03,0x02,0x01,0x02,0x02,0x0B,0x04, -0x00,0x00,0x00,0x00,0x01,0x21,0x58,0x53,0x08,0xA2,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x4C,0x31,0x20,0x30,0x1E,0x06, -0x03,0x55,0x04,0x0B,0x13,0x17,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E, -0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x52,0x33,0x31,0x13,0x30, -0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69, -0x67,0x6E,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F, -0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x30,0x1E,0x17,0x0D,0x30,0x39,0x30,0x33,0x31, -0x38,0x31,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x39,0x30,0x33,0x31,0x38, -0x31,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x4C,0x31,0x20,0x30,0x1E,0x06,0x03,0x55, -0x04,0x0B,0x13,0x17,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x20,0x52, -0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x52,0x33,0x31,0x13,0x30,0x11,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E, -0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61, -0x6C,0x53,0x69,0x67,0x6E,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48, -0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01, -0x0A,0x02,0x82,0x01,0x01,0x00,0xCC,0x25,0x76,0x90,0x79,0x06,0x78,0x22,0x16,0xF5, -0xC0,0x83,0xB6,0x84,0xCA,0x28,0x9E,0xFD,0x05,0x76,0x11,0xC5,0xAD,0x88,0x72,0xFC, -0x46,0x02,0x43,0xC7,0xB2,0x8A,0x9D,0x04,0x5F,0x24,0xCB,0x2E,0x4B,0xE1,0x60,0x82, -0x46,0xE1,0x52,0xAB,0x0C,0x81,0x47,0x70,0x6C,0xDD,0x64,0xD1,0xEB,0xF5,0x2C,0xA3, -0x0F,0x82,0x3D,0x0C,0x2B,0xAE,0x97,0xD7,0xB6,0x14,0x86,0x10,0x79,0xBB,0x3B,0x13, -0x80,0x77,0x8C,0x08,0xE1,0x49,0xD2,0x6A,0x62,0x2F,0x1F,0x5E,0xFA,0x96,0x68,0xDF, -0x89,0x27,0x95,0x38,0x9F,0x06,0xD7,0x3E,0xC9,0xCB,0x26,0x59,0x0D,0x73,0xDE,0xB0, -0xC8,0xE9,0x26,0x0E,0x83,0x15,0xC6,0xEF,0x5B,0x8B,0xD2,0x04,0x60,0xCA,0x49,0xA6, -0x28,0xF6,0x69,0x3B,0xF6,0xCB,0xC8,0x28,0x91,0xE5,0x9D,0x8A,0x61,0x57,0x37,0xAC, -0x74,0x14,0xDC,0x74,0xE0,0x3A,0xEE,0x72,0x2F,0x2E,0x9C,0xFB,0xD0,0xBB,0xBF,0xF5, -0x3D,0x00,0xE1,0x06,0x33,0xE8,0x82,0x2B,0xAE,0x53,0xA6,0x3A,0x16,0x73,0x8C,0xDD, -0x41,0x0E,0x20,0x3A,0xC0,0xB4,0xA7,0xA1,0xE9,0xB2,0x4F,0x90,0x2E,0x32,0x60,0xE9, -0x57,0xCB,0xB9,0x04,0x92,0x68,0x68,0xE5,0x38,0x26,0x60,0x75,0xB2,0x9F,0x77,0xFF, -0x91,0x14,0xEF,0xAE,0x20,0x49,0xFC,0xAD,0x40,0x15,0x48,0xD1,0x02,0x31,0x61,0x19, -0x5E,0xB8,0x97,0xEF,0xAD,0x77,0xB7,0x64,0x9A,0x7A,0xBF,0x5F,0xC1,0x13,0xEF,0x9B, -0x62,0xFB,0x0D,0x6C,0xE0,0x54,0x69,0x16,0xA9,0x03,0xDA,0x6E,0xE9,0x83,0x93,0x71, -0x76,0xC6,0x69,0x85,0x82,0x17,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30, -0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30, -0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF, -0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x8F,0xF0,0x4B,0x7F,0xA8, -0x2E,0x45,0x24,0xAE,0x4D,0x50,0xFA,0x63,0x9A,0x8B,0xDE,0xE2,0xDD,0x1B,0xBC,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82, -0x01,0x01,0x00,0x4B,0x40,0xDB,0xC0,0x50,0xAA,0xFE,0xC8,0x0C,0xEF,0xF7,0x96,0x54, -0x45,0x49,0xBB,0x96,0x00,0x09,0x41,0xAC,0xB3,0x13,0x86,0x86,0x28,0x07,0x33,0xCA, -0x6B,0xE6,0x74,0xB9,0xBA,0x00,0x2D,0xAE,0xA4,0x0A,0xD3,0xF5,0xF1,0xF1,0x0F,0x8A, -0xBF,0x73,0x67,0x4A,0x83,0xC7,0x44,0x7B,0x78,0xE0,0xAF,0x6E,0x6C,0x6F,0x03,0x29, -0x8E,0x33,0x39,0x45,0xC3,0x8E,0xE4,0xB9,0x57,0x6C,0xAA,0xFC,0x12,0x96,0xEC,0x53, -0xC6,0x2D,0xE4,0x24,0x6C,0xB9,0x94,0x63,0xFB,0xDC,0x53,0x68,0x67,0x56,0x3E,0x83, -0xB8,0xCF,0x35,0x21,0xC3,0xC9,0x68,0xFE,0xCE,0xDA,0xC2,0x53,0xAA,0xCC,0x90,0x8A, -0xE9,0xF0,0x5D,0x46,0x8C,0x95,0xDD,0x7A,0x58,0x28,0x1A,0x2F,0x1D,0xDE,0xCD,0x00, -0x37,0x41,0x8F,0xED,0x44,0x6D,0xD7,0x53,0x28,0x97,0x7E,0xF3,0x67,0x04,0x1E,0x15, -0xD7,0x8A,0x96,0xB4,0xD3,0xDE,0x4C,0x27,0xA4,0x4C,0x1B,0x73,0x73,0x76,0xF4,0x17, -0x99,0xC2,0x1F,0x7A,0x0E,0xE3,0x2D,0x08,0xAD,0x0A,0x1C,0x2C,0xFF,0x3C,0xAB,0x55, -0x0E,0x0F,0x91,0x7E,0x36,0xEB,0xC3,0x57,0x49,0xBE,0xE1,0x2E,0x2D,0x7C,0x60,0x8B, -0xC3,0x41,0x51,0x13,0x23,0x9D,0xCE,0xF7,0x32,0x6B,0x94,0x01,0xA8,0x99,0xE7,0x2C, -0x33,0x1F,0x3A,0x3B,0x25,0xD2,0x86,0x40,0xCE,0x3B,0x2C,0x86,0x78,0xC9,0x61,0x2F, -0x14,0xBA,0xEE,0xDB,0x55,0x6F,0xDF,0x84,0xEE,0x05,0x09,0x4D,0xBD,0x28,0xD8,0x72, -0xCE,0xD3,0x62,0x50,0x65,0x1E,0xEB,0x92,0x97,0x83,0x31,0xD9,0xB3,0xB5,0xCA,0x47, -0x58,0x3F,0x5F, -}; - - -/* subject:/C=US/O=AffirmTrust/CN=AffirmTrust Networking */ -/* issuer :/C=US/O=AffirmTrust/CN=AffirmTrust Networking */ - - -const unsigned char AffirmTrust_Networking_certificate[848]={ -0x30,0x82,0x03,0x4C,0x30,0x82,0x02,0x34,0xA0,0x03,0x02,0x01,0x02,0x02,0x08,0x7C, -0x4F,0x04,0x39,0x1C,0xD4,0x99,0x2D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x44,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x0C,0x0B, -0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x31,0x1F,0x30,0x1D,0x06, -0x03,0x55,0x04,0x03,0x0C,0x16,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73, -0x74,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x69,0x6E,0x67,0x30,0x1E,0x17,0x0D, -0x31,0x30,0x30,0x31,0x32,0x39,0x31,0x34,0x30,0x38,0x32,0x34,0x5A,0x17,0x0D,0x33, -0x30,0x31,0x32,0x33,0x31,0x31,0x34,0x30,0x38,0x32,0x34,0x5A,0x30,0x44,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06, -0x03,0x55,0x04,0x0A,0x0C,0x0B,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73, -0x74,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x0C,0x16,0x41,0x66,0x66,0x69, -0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x69, -0x6E,0x67,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82, -0x01,0x01,0x00,0xB4,0x84,0xCC,0x33,0x17,0x2E,0x6B,0x94,0x6C,0x6B,0x61,0x52,0xA0, -0xEB,0xA3,0xCF,0x79,0x94,0x4C,0xE5,0x94,0x80,0x99,0xCB,0x55,0x64,0x44,0x65,0x8F, -0x67,0x64,0xE2,0x06,0xE3,0x5C,0x37,0x49,0xF6,0x2F,0x9B,0x84,0x84,0x1E,0x2D,0xF2, -0x60,0x9D,0x30,0x4E,0xCC,0x84,0x85,0xE2,0x2C,0xCF,0x1E,0x9E,0xFE,0x36,0xAB,0x33, -0x77,0x35,0x44,0xD8,0x35,0x96,0x1A,0x3D,0x36,0xE8,0x7A,0x0E,0xD8,0xD5,0x47,0xA1, -0x6A,0x69,0x8B,0xD9,0xFC,0xBB,0x3A,0xAE,0x79,0x5A,0xD5,0xF4,0xD6,0x71,0xBB,0x9A, -0x90,0x23,0x6B,0x9A,0xB7,0x88,0x74,0x87,0x0C,0x1E,0x5F,0xB9,0x9E,0x2D,0xFA,0xAB, -0x53,0x2B,0xDC,0xBB,0x76,0x3E,0x93,0x4C,0x08,0x08,0x8C,0x1E,0xA2,0x23,0x1C,0xD4, -0x6A,0xAD,0x22,0xBA,0x99,0x01,0x2E,0x6D,0x65,0xCB,0xBE,0x24,0x66,0x55,0x24,0x4B, -0x40,0x44,0xB1,0x1B,0xD7,0xE1,0xC2,0x85,0xC0,0xDE,0x10,0x3F,0x3D,0xED,0xB8,0xFC, -0xF1,0xF1,0x23,0x53,0xDC,0xBF,0x65,0x97,0x6F,0xD9,0xF9,0x40,0x71,0x8D,0x7D,0xBD, -0x95,0xD4,0xCE,0xBE,0xA0,0x5E,0x27,0x23,0xDE,0xFD,0xA6,0xD0,0x26,0x0E,0x00,0x29, -0xEB,0x3C,0x46,0xF0,0x3D,0x60,0xBF,0x3F,0x50,0xD2,0xDC,0x26,0x41,0x51,0x9E,0x14, -0x37,0x42,0x04,0xA3,0x70,0x57,0xA8,0x1B,0x87,0xED,0x2D,0xFA,0x7B,0xEE,0x8C,0x0A, -0xE3,0xA9,0x66,0x89,0x19,0xCB,0x41,0xF9,0xDD,0x44,0x36,0x61,0xCF,0xE2,0x77,0x46, -0xC8,0x7D,0xF6,0xF4,0x92,0x81,0x36,0xFD,0xDB,0x34,0xF1,0x72,0x7E,0xF3,0x0C,0x16, -0xBD,0xB4,0x15,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06,0x03, -0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x07,0x1F,0xD2,0xE7,0x9C,0xDA,0xC2,0x6E,0xA2, -0x40,0xB4,0xB0,0x7A,0x50,0x10,0x50,0x74,0xC4,0xC8,0xBD,0x30,0x0F,0x06,0x03,0x55, -0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03, -0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00, -0x89,0x57,0xB2,0x16,0x7A,0xA8,0xC2,0xFD,0xD6,0xD9,0x9B,0x9B,0x34,0xC2,0x9C,0xB4, -0x32,0x14,0x4D,0xA7,0xA4,0xDF,0xEC,0xBE,0xA7,0xBE,0xF8,0x43,0xDB,0x91,0x37,0xCE, -0xB4,0x32,0x2E,0x50,0x55,0x1A,0x35,0x4E,0x76,0x43,0x71,0x20,0xEF,0x93,0x77,0x4E, -0x15,0x70,0x2E,0x87,0xC3,0xC1,0x1D,0x6D,0xDC,0xCB,0xB5,0x27,0xD4,0x2C,0x56,0xD1, -0x52,0x53,0x3A,0x44,0xD2,0x73,0xC8,0xC4,0x1B,0x05,0x65,0x5A,0x62,0x92,0x9C,0xEE, -0x41,0x8D,0x31,0xDB,0xE7,0x34,0xEA,0x59,0x21,0xD5,0x01,0x7A,0xD7,0x64,0xB8,0x64, -0x39,0xCD,0xC9,0xED,0xAF,0xED,0x4B,0x03,0x48,0xA7,0xA0,0x99,0x01,0x80,0xDC,0x65, -0xA3,0x36,0xAE,0x65,0x59,0x48,0x4F,0x82,0x4B,0xC8,0x65,0xF1,0x57,0x1D,0xE5,0x59, -0x2E,0x0A,0x3F,0x6C,0xD8,0xD1,0xF5,0xE5,0x09,0xB4,0x6C,0x54,0x00,0x0A,0xE0,0x15, -0x4D,0x87,0x75,0x6D,0xB7,0x58,0x96,0x5A,0xDD,0x6D,0xD2,0x00,0xA0,0xF4,0x9B,0x48, -0xBE,0xC3,0x37,0xA4,0xBA,0x36,0xE0,0x7C,0x87,0x85,0x97,0x1A,0x15,0xA2,0xDE,0x2E, -0xA2,0x5B,0xBD,0xAF,0x18,0xF9,0x90,0x50,0xCD,0x70,0x59,0xF8,0x27,0x67,0x47,0xCB, -0xC7,0xA0,0x07,0x3A,0x7D,0xD1,0x2C,0x5D,0x6C,0x19,0x3A,0x66,0xB5,0x7D,0xFD,0x91, -0x6F,0x82,0xB1,0xBE,0x08,0x93,0xDB,0x14,0x47,0xF1,0xA2,0x37,0xC7,0x45,0x9E,0x3C, -0xC7,0x77,0xAF,0x64,0xA8,0x93,0xDF,0xF6,0x69,0x83,0x82,0x60,0xF2,0x49,0x42,0x34, -0xED,0x5A,0x00,0x54,0x85,0x1C,0x16,0x36,0x92,0x0C,0x5C,0xFA,0xA6,0xAD,0xBF,0xDB, -}; - - -/* subject:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root */ -/* issuer :/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root */ - - -const unsigned char AddTrust_External_Root_certificate[1082]={ -0x30,0x82,0x04,0x36,0x30,0x82,0x03,0x1E,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x6F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31,0x14, -0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75,0x73, -0x74,0x20,0x41,0x42,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x41, -0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x45,0x78,0x74,0x65,0x72,0x6E,0x61,0x6C, -0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x22,0x30,0x20, -0x06,0x03,0x55,0x04,0x03,0x13,0x19,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20, -0x45,0x78,0x74,0x65,0x72,0x6E,0x61,0x6C,0x20,0x43,0x41,0x20,0x52,0x6F,0x6F,0x74, -0x30,0x1E,0x17,0x0D,0x30,0x30,0x30,0x35,0x33,0x30,0x31,0x30,0x34,0x38,0x33,0x38, -0x5A,0x17,0x0D,0x32,0x30,0x30,0x35,0x33,0x30,0x31,0x30,0x34,0x38,0x33,0x38,0x5A, -0x30,0x6F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53,0x45,0x31, -0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54,0x72,0x75, -0x73,0x74,0x20,0x41,0x42,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D, -0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x45,0x78,0x74,0x65,0x72,0x6E,0x61, -0x6C,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x22,0x30, -0x20,0x06,0x03,0x55,0x04,0x03,0x13,0x19,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74, -0x20,0x45,0x78,0x74,0x65,0x72,0x6E,0x61,0x6C,0x20,0x43,0x41,0x20,0x52,0x6F,0x6F, -0x74,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01, -0x01,0x00,0xB7,0xF7,0x1A,0x33,0xE6,0xF2,0x00,0x04,0x2D,0x39,0xE0,0x4E,0x5B,0xED, -0x1F,0xBC,0x6C,0x0F,0xCD,0xB5,0xFA,0x23,0xB6,0xCE,0xDE,0x9B,0x11,0x33,0x97,0xA4, -0x29,0x4C,0x7D,0x93,0x9F,0xBD,0x4A,0xBC,0x93,0xED,0x03,0x1A,0xE3,0x8F,0xCF,0xE5, -0x6D,0x50,0x5A,0xD6,0x97,0x29,0x94,0x5A,0x80,0xB0,0x49,0x7A,0xDB,0x2E,0x95,0xFD, -0xB8,0xCA,0xBF,0x37,0x38,0x2D,0x1E,0x3E,0x91,0x41,0xAD,0x70,0x56,0xC7,0xF0,0x4F, -0x3F,0xE8,0x32,0x9E,0x74,0xCA,0xC8,0x90,0x54,0xE9,0xC6,0x5F,0x0F,0x78,0x9D,0x9A, -0x40,0x3C,0x0E,0xAC,0x61,0xAA,0x5E,0x14,0x8F,0x9E,0x87,0xA1,0x6A,0x50,0xDC,0xD7, -0x9A,0x4E,0xAF,0x05,0xB3,0xA6,0x71,0x94,0x9C,0x71,0xB3,0x50,0x60,0x0A,0xC7,0x13, -0x9D,0x38,0x07,0x86,0x02,0xA8,0xE9,0xA8,0x69,0x26,0x18,0x90,0xAB,0x4C,0xB0,0x4F, -0x23,0xAB,0x3A,0x4F,0x84,0xD8,0xDF,0xCE,0x9F,0xE1,0x69,0x6F,0xBB,0xD7,0x42,0xD7, -0x6B,0x44,0xE4,0xC7,0xAD,0xEE,0x6D,0x41,0x5F,0x72,0x5A,0x71,0x08,0x37,0xB3,0x79, -0x65,0xA4,0x59,0xA0,0x94,0x37,0xF7,0x00,0x2F,0x0D,0xC2,0x92,0x72,0xDA,0xD0,0x38, -0x72,0xDB,0x14,0xA8,0x45,0xC4,0x5D,0x2A,0x7D,0xB7,0xB4,0xD6,0xC4,0xEE,0xAC,0xCD, -0x13,0x44,0xB7,0xC9,0x2B,0xDD,0x43,0x00,0x25,0xFA,0x61,0xB9,0x69,0x6A,0x58,0x23, -0x11,0xB7,0xA7,0x33,0x8F,0x56,0x75,0x59,0xF5,0xCD,0x29,0xD7,0x46,0xB7,0x0A,0x2B, -0x65,0xB6,0xD3,0x42,0x6F,0x15,0xB2,0xB8,0x7B,0xFB,0xEF,0xE9,0x5D,0x53,0xD5,0x34, -0x5A,0x27,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0xDC,0x30,0x81,0xD9,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xAD,0xBD,0x98,0x7A,0x34,0xB4,0x26,0xF7, -0xFA,0xC4,0x26,0x54,0xEF,0x03,0xBD,0xE0,0x24,0xCB,0x54,0x1A,0x30,0x0B,0x06,0x03, -0x55,0x1D,0x0F,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13, -0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x81,0x99,0x06,0x03,0x55, -0x1D,0x23,0x04,0x81,0x91,0x30,0x81,0x8E,0x80,0x14,0xAD,0xBD,0x98,0x7A,0x34,0xB4, -0x26,0xF7,0xFA,0xC4,0x26,0x54,0xEF,0x03,0xBD,0xE0,0x24,0xCB,0x54,0x1A,0xA1,0x73, -0xA4,0x71,0x30,0x6F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x53, -0x45,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x41,0x64,0x64,0x54, -0x72,0x75,0x73,0x74,0x20,0x41,0x42,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B, -0x13,0x1D,0x41,0x64,0x64,0x54,0x72,0x75,0x73,0x74,0x20,0x45,0x78,0x74,0x65,0x72, -0x6E,0x61,0x6C,0x20,0x54,0x54,0x50,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31, -0x22,0x30,0x20,0x06,0x03,0x55,0x04,0x03,0x13,0x19,0x41,0x64,0x64,0x54,0x72,0x75, -0x73,0x74,0x20,0x45,0x78,0x74,0x65,0x72,0x6E,0x61,0x6C,0x20,0x43,0x41,0x20,0x52, -0x6F,0x6F,0x74,0x82,0x01,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0xB0,0x9B,0xE0,0x85,0x25,0xC2, -0xD6,0x23,0xE2,0x0F,0x96,0x06,0x92,0x9D,0x41,0x98,0x9C,0xD9,0x84,0x79,0x81,0xD9, -0x1E,0x5B,0x14,0x07,0x23,0x36,0x65,0x8F,0xB0,0xD8,0x77,0xBB,0xAC,0x41,0x6C,0x47, -0x60,0x83,0x51,0xB0,0xF9,0x32,0x3D,0xE7,0xFC,0xF6,0x26,0x13,0xC7,0x80,0x16,0xA5, -0xBF,0x5A,0xFC,0x87,0xCF,0x78,0x79,0x89,0x21,0x9A,0xE2,0x4C,0x07,0x0A,0x86,0x35, -0xBC,0xF2,0xDE,0x51,0xC4,0xD2,0x96,0xB7,0xDC,0x7E,0x4E,0xEE,0x70,0xFD,0x1C,0x39, -0xEB,0x0C,0x02,0x51,0x14,0x2D,0x8E,0xBD,0x16,0xE0,0xC1,0xDF,0x46,0x75,0xE7,0x24, -0xAD,0xEC,0xF4,0x42,0xB4,0x85,0x93,0x70,0x10,0x67,0xBA,0x9D,0x06,0x35,0x4A,0x18, -0xD3,0x2B,0x7A,0xCC,0x51,0x42,0xA1,0x7A,0x63,0xD1,0xE6,0xBB,0xA1,0xC5,0x2B,0xC2, -0x36,0xBE,0x13,0x0D,0xE6,0xBD,0x63,0x7E,0x79,0x7B,0xA7,0x09,0x0D,0x40,0xAB,0x6A, -0xDD,0x8F,0x8A,0xC3,0xF6,0xF6,0x8C,0x1A,0x42,0x05,0x51,0xD4,0x45,0xF5,0x9F,0xA7, -0x62,0x21,0x68,0x15,0x20,0x43,0x3C,0x99,0xE7,0x7C,0xBD,0x24,0xD8,0xA9,0x91,0x17, -0x73,0x88,0x3F,0x56,0x1B,0x31,0x38,0x18,0xB4,0x71,0x0F,0x9A,0xCD,0xC8,0x0E,0x9E, -0x8E,0x2E,0x1B,0xE1,0x8C,0x98,0x83,0xCB,0x1F,0x31,0xF1,0x44,0x4C,0xC6,0x04,0x73, -0x49,0x76,0x60,0x0F,0xC7,0xF8,0xBD,0x17,0x80,0x6B,0x2E,0xE9,0xCC,0x4C,0x0E,0x5A, -0x9A,0x79,0x0F,0x20,0x0A,0x2E,0xD5,0x9E,0x63,0x26,0x1E,0x55,0x92,0x94,0xD8,0x82, -0x17,0x5A,0x7B,0xD0,0xBC,0xC7,0x8F,0x4E,0x86,0x04, -}; - - -/* subject:/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2008 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA - G3 */ -/* issuer :/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2008 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA - G3 */ - - -const unsigned char thawte_Primary_Root_CA___G3_certificate[1070]={ -0x30,0x82,0x04,0x2A,0x30,0x82,0x03,0x12,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x60, -0x01,0x97,0xB7,0x46,0xA7,0xEA,0xB4,0xB4,0x9A,0xD6,0x4B,0x2F,0xF7,0x90,0xFB,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x81, -0xAE,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15, -0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x74,0x68,0x61,0x77,0x74,0x65,0x2C, -0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x03,0x55,0x04,0x0B,0x13,0x1F, -0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x53,0x65, -0x72,0x76,0x69,0x63,0x65,0x73,0x20,0x44,0x69,0x76,0x69,0x73,0x69,0x6F,0x6E,0x31, -0x38,0x30,0x36,0x06,0x03,0x55,0x04,0x0B,0x13,0x2F,0x28,0x63,0x29,0x20,0x32,0x30, -0x30,0x38,0x20,0x74,0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20, -0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64, -0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x24,0x30,0x22,0x06,0x03,0x55, -0x04,0x03,0x13,0x1B,0x74,0x68,0x61,0x77,0x74,0x65,0x20,0x50,0x72,0x69,0x6D,0x61, -0x72,0x79,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x47,0x33,0x30, -0x1E,0x17,0x0D,0x30,0x38,0x30,0x34,0x30,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x5A, -0x17,0x0D,0x33,0x37,0x31,0x32,0x30,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30, -0x81,0xAE,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31, -0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x74,0x68,0x61,0x77,0x74,0x65, -0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x03,0x55,0x04,0x0B,0x13, -0x1F,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x53, -0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x20,0x44,0x69,0x76,0x69,0x73,0x69,0x6F,0x6E, -0x31,0x38,0x30,0x36,0x06,0x03,0x55,0x04,0x0B,0x13,0x2F,0x28,0x63,0x29,0x20,0x32, -0x30,0x30,0x38,0x20,0x74,0x68,0x61,0x77,0x74,0x65,0x2C,0x20,0x49,0x6E,0x63,0x2E, -0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65, -0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x24,0x30,0x22,0x06,0x03, -0x55,0x04,0x03,0x13,0x1B,0x74,0x68,0x61,0x77,0x74,0x65,0x20,0x50,0x72,0x69,0x6D, -0x61,0x72,0x79,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x47,0x33, -0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01, -0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01, -0x00,0xB2,0xBF,0x27,0x2C,0xFB,0xDB,0xD8,0x5B,0xDD,0x78,0x7B,0x1B,0x9E,0x77,0x66, -0x81,0xCB,0x3E,0xBC,0x7C,0xAE,0xF3,0xA6,0x27,0x9A,0x34,0xA3,0x68,0x31,0x71,0x38, -0x33,0x62,0xE4,0xF3,0x71,0x66,0x79,0xB1,0xA9,0x65,0xA3,0xA5,0x8B,0xD5,0x8F,0x60, -0x2D,0x3F,0x42,0xCC,0xAA,0x6B,0x32,0xC0,0x23,0xCB,0x2C,0x41,0xDD,0xE4,0xDF,0xFC, -0x61,0x9C,0xE2,0x73,0xB2,0x22,0x95,0x11,0x43,0x18,0x5F,0xC4,0xB6,0x1F,0x57,0x6C, -0x0A,0x05,0x58,0x22,0xC8,0x36,0x4C,0x3A,0x7C,0xA5,0xD1,0xCF,0x86,0xAF,0x88,0xA7, -0x44,0x02,0x13,0x74,0x71,0x73,0x0A,0x42,0x59,0x02,0xF8,0x1B,0x14,0x6B,0x42,0xDF, -0x6F,0x5F,0xBA,0x6B,0x82,0xA2,0x9D,0x5B,0xE7,0x4A,0xBD,0x1E,0x01,0x72,0xDB,0x4B, -0x74,0xE8,0x3B,0x7F,0x7F,0x7D,0x1F,0x04,0xB4,0x26,0x9B,0xE0,0xB4,0x5A,0xAC,0x47, -0x3D,0x55,0xB8,0xD7,0xB0,0x26,0x52,0x28,0x01,0x31,0x40,0x66,0xD8,0xD9,0x24,0xBD, -0xF6,0x2A,0xD8,0xEC,0x21,0x49,0x5C,0x9B,0xF6,0x7A,0xE9,0x7F,0x55,0x35,0x7E,0x96, -0x6B,0x8D,0x93,0x93,0x27,0xCB,0x92,0xBB,0xEA,0xAC,0x40,0xC0,0x9F,0xC2,0xF8,0x80, -0xCF,0x5D,0xF4,0x5A,0xDC,0xCE,0x74,0x86,0xA6,0x3E,0x6C,0x0B,0x53,0xCA,0xBD,0x92, -0xCE,0x19,0x06,0x72,0xE6,0x0C,0x5C,0x38,0x69,0xC7,0x04,0xD6,0xBC,0x6C,0xCE,0x5B, -0xF6,0xF7,0x68,0x9C,0xDC,0x25,0x15,0x48,0x88,0xA1,0xE9,0xA9,0xF8,0x98,0x9C,0xE0, -0xF3,0xD5,0x31,0x28,0x61,0x11,0x6C,0x67,0x96,0x8D,0x39,0x99,0xCB,0xC2,0x45,0x24, -0x39,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06,0x03,0x55,0x1D, -0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55, -0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D,0x06,0x03,0x55, -0x1D,0x0E,0x04,0x16,0x04,0x14,0xAD,0x6C,0xAA,0x94,0x60,0x9C,0xED,0xE4,0xFF,0xFA, -0x3E,0x0A,0x74,0x2B,0x63,0x03,0xF7,0xB6,0x59,0xBF,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x1A,0x40, -0xD8,0x95,0x65,0xAC,0x09,0x92,0x89,0xC6,0x39,0xF4,0x10,0xE5,0xA9,0x0E,0x66,0x53, -0x5D,0x78,0xDE,0xFA,0x24,0x91,0xBB,0xE7,0x44,0x51,0xDF,0xC6,0x16,0x34,0x0A,0xEF, -0x6A,0x44,0x51,0xEA,0x2B,0x07,0x8A,0x03,0x7A,0xC3,0xEB,0x3F,0x0A,0x2C,0x52,0x16, -0xA0,0x2B,0x43,0xB9,0x25,0x90,0x3F,0x70,0xA9,0x33,0x25,0x6D,0x45,0x1A,0x28,0x3B, -0x27,0xCF,0xAA,0xC3,0x29,0x42,0x1B,0xDF,0x3B,0x4C,0xC0,0x33,0x34,0x5B,0x41,0x88, -0xBF,0x6B,0x2B,0x65,0xAF,0x28,0xEF,0xB2,0xF5,0xC3,0xAA,0x66,0xCE,0x7B,0x56,0xEE, -0xB7,0xC8,0xCB,0x67,0xC1,0xC9,0x9C,0x1A,0x18,0xB8,0xC4,0xC3,0x49,0x03,0xF1,0x60, -0x0E,0x50,0xCD,0x46,0xC5,0xF3,0x77,0x79,0xF7,0xB6,0x15,0xE0,0x38,0xDB,0xC7,0x2F, -0x28,0xA0,0x0C,0x3F,0x77,0x26,0x74,0xD9,0x25,0x12,0xDA,0x31,0xDA,0x1A,0x1E,0xDC, -0x29,0x41,0x91,0x22,0x3C,0x69,0xA7,0xBB,0x02,0xF2,0xB6,0x5C,0x27,0x03,0x89,0xF4, -0x06,0xEA,0x9B,0xE4,0x72,0x82,0xE3,0xA1,0x09,0xC1,0xE9,0x00,0x19,0xD3,0x3E,0xD4, -0x70,0x6B,0xBA,0x71,0xA6,0xAA,0x58,0xAE,0xF4,0xBB,0xE9,0x6C,0xB6,0xEF,0x87,0xCC, -0x9B,0xBB,0xFF,0x39,0xE6,0x56,0x61,0xD3,0x0A,0xA7,0xC4,0x5C,0x4C,0x60,0x7B,0x05, -0x77,0x26,0x7A,0xBF,0xD8,0x07,0x52,0x2C,0x62,0xF7,0x70,0x63,0xD9,0x39,0xBC,0x6F, -0x1C,0xC2,0x79,0xDC,0x76,0x29,0xAF,0xCE,0xC5,0x2C,0x64,0x04,0x5E,0x88,0x36,0x6E, -0x31,0xD4,0x40,0x1A,0x62,0x34,0x36,0x3F,0x35,0x01,0xAE,0xAC,0x63,0xA0, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root CA */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root CA */ - - -const unsigned char DigiCert_Assured_ID_Root_CA_certificate[955]={ -0x30,0x82,0x03,0xB7,0x30,0x82,0x02,0x9F,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x0C, -0xE7,0xE0,0xE5,0x17,0xD8,0x46,0xFE,0x8F,0xE5,0x60,0xFC,0x1B,0xF0,0x30,0x39,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x65, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x20,0x49,0x44,0x20,0x52,0x6F, -0x6F,0x74,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x31,0x31,0x30,0x30, -0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x31,0x31,0x31,0x31,0x30,0x30,0x30, -0x30,0x30,0x30,0x30,0x5A,0x30,0x65,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06, -0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44, -0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06, -0x03,0x55,0x04,0x0B,0x13,0x10,0x77,0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65, -0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13, -0x1B,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x41,0x73,0x73,0x75,0x72,0x65, -0x64,0x20,0x49,0x44,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03, -0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAD,0x0E,0x15, -0xCE,0xE4,0x43,0x80,0x5C,0xB1,0x87,0xF3,0xB7,0x60,0xF9,0x71,0x12,0xA5,0xAE,0xDC, -0x26,0x94,0x88,0xAA,0xF4,0xCE,0xF5,0x20,0x39,0x28,0x58,0x60,0x0C,0xF8,0x80,0xDA, -0xA9,0x15,0x95,0x32,0x61,0x3C,0xB5,0xB1,0x28,0x84,0x8A,0x8A,0xDC,0x9F,0x0A,0x0C, -0x83,0x17,0x7A,0x8F,0x90,0xAC,0x8A,0xE7,0x79,0x53,0x5C,0x31,0x84,0x2A,0xF6,0x0F, -0x98,0x32,0x36,0x76,0xCC,0xDE,0xDD,0x3C,0xA8,0xA2,0xEF,0x6A,0xFB,0x21,0xF2,0x52, -0x61,0xDF,0x9F,0x20,0xD7,0x1F,0xE2,0xB1,0xD9,0xFE,0x18,0x64,0xD2,0x12,0x5B,0x5F, -0xF9,0x58,0x18,0x35,0xBC,0x47,0xCD,0xA1,0x36,0xF9,0x6B,0x7F,0xD4,0xB0,0x38,0x3E, -0xC1,0x1B,0xC3,0x8C,0x33,0xD9,0xD8,0x2F,0x18,0xFE,0x28,0x0F,0xB3,0xA7,0x83,0xD6, -0xC3,0x6E,0x44,0xC0,0x61,0x35,0x96,0x16,0xFE,0x59,0x9C,0x8B,0x76,0x6D,0xD7,0xF1, -0xA2,0x4B,0x0D,0x2B,0xFF,0x0B,0x72,0xDA,0x9E,0x60,0xD0,0x8E,0x90,0x35,0xC6,0x78, -0x55,0x87,0x20,0xA1,0xCF,0xE5,0x6D,0x0A,0xC8,0x49,0x7C,0x31,0x98,0x33,0x6C,0x22, -0xE9,0x87,0xD0,0x32,0x5A,0xA2,0xBA,0x13,0x82,0x11,0xED,0x39,0x17,0x9D,0x99,0x3A, -0x72,0xA1,0xE6,0xFA,0xA4,0xD9,0xD5,0x17,0x31,0x75,0xAE,0x85,0x7D,0x22,0xAE,0x3F, -0x01,0x46,0x86,0xF6,0x28,0x79,0xC8,0xB1,0xDA,0xE4,0x57,0x17,0xC4,0x7E,0x1C,0x0E, -0xB0,0xB4,0x92,0xA6,0x56,0xB3,0xBD,0xB2,0x97,0xED,0xAA,0xA7,0xF0,0xB7,0xC5,0xA8, -0x3F,0x95,0x16,0xD0,0xFF,0xA1,0x96,0xEB,0x08,0x5F,0x18,0x77,0x4F,0x02,0x03,0x01, -0x00,0x01,0xA3,0x63,0x30,0x61,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF, -0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16, -0x04,0x14,0x45,0xEB,0xA2,0xAF,0xF4,0x92,0xCB,0x82,0x31,0x2D,0x51,0x8B,0xA7,0xA7, -0x21,0x9D,0xF3,0x6D,0xC8,0x0F,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30, -0x16,0x80,0x14,0x45,0xEB,0xA2,0xAF,0xF4,0x92,0xCB,0x82,0x31,0x2D,0x51,0x8B,0xA7, -0xA7,0x21,0x9D,0xF3,0x6D,0xC8,0x0F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0xA2,0x0E,0xBC,0xDF,0xE2, -0xED,0xF0,0xE3,0x72,0x73,0x7A,0x64,0x94,0xBF,0xF7,0x72,0x66,0xD8,0x32,0xE4,0x42, -0x75,0x62,0xAE,0x87,0xEB,0xF2,0xD5,0xD9,0xDE,0x56,0xB3,0x9F,0xCC,0xCE,0x14,0x28, -0xB9,0x0D,0x97,0x60,0x5C,0x12,0x4C,0x58,0xE4,0xD3,0x3D,0x83,0x49,0x45,0x58,0x97, -0x35,0x69,0x1A,0xA8,0x47,0xEA,0x56,0xC6,0x79,0xAB,0x12,0xD8,0x67,0x81,0x84,0xDF, -0x7F,0x09,0x3C,0x94,0xE6,0xB8,0x26,0x2C,0x20,0xBD,0x3D,0xB3,0x28,0x89,0xF7,0x5F, -0xFF,0x22,0xE2,0x97,0x84,0x1F,0xE9,0x65,0xEF,0x87,0xE0,0xDF,0xC1,0x67,0x49,0xB3, -0x5D,0xEB,0xB2,0x09,0x2A,0xEB,0x26,0xED,0x78,0xBE,0x7D,0x3F,0x2B,0xF3,0xB7,0x26, -0x35,0x6D,0x5F,0x89,0x01,0xB6,0x49,0x5B,0x9F,0x01,0x05,0x9B,0xAB,0x3D,0x25,0xC1, -0xCC,0xB6,0x7F,0xC2,0xF1,0x6F,0x86,0xC6,0xFA,0x64,0x68,0xEB,0x81,0x2D,0x94,0xEB, -0x42,0xB7,0xFA,0x8C,0x1E,0xDD,0x62,0xF1,0xBE,0x50,0x67,0xB7,0x6C,0xBD,0xF3,0xF1, -0x1F,0x6B,0x0C,0x36,0x07,0x16,0x7F,0x37,0x7C,0xA9,0x5B,0x6D,0x7A,0xF1,0x12,0x46, -0x60,0x83,0xD7,0x27,0x04,0xBE,0x4B,0xCE,0x97,0xBE,0xC3,0x67,0x2A,0x68,0x11,0xDF, -0x80,0xE7,0x0C,0x33,0x66,0xBF,0x13,0x0D,0x14,0x6E,0xF3,0x7F,0x1F,0x63,0x10,0x1E, -0xFA,0x8D,0x1B,0x25,0x6D,0x6C,0x8F,0xA5,0xB7,0x61,0x01,0xB1,0xD2,0xA3,0x26,0xA1, -0x10,0x71,0x9D,0xAD,0xE2,0xC3,0xF9,0xC3,0x99,0x51,0xB7,0x2B,0x07,0x08,0xCE,0x2E, -0xE6,0x50,0xB2,0xA7,0xFA,0x0A,0x45,0x2F,0xA2,0xF0,0xF2, -}; - - -/* subject:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority */ -/* issuer :/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority */ - - -const unsigned char Go_Daddy_Class_2_CA_certificate[1028]={ -0x30,0x82,0x04,0x00,0x30,0x82,0x02,0xE8,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x00, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x63,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x21, -0x30,0x1F,0x06,0x03,0x55,0x04,0x0A,0x13,0x18,0x54,0x68,0x65,0x20,0x47,0x6F,0x20, -0x44,0x61,0x64,0x64,0x79,0x20,0x47,0x72,0x6F,0x75,0x70,0x2C,0x20,0x49,0x6E,0x63, -0x2E,0x31,0x31,0x30,0x2F,0x06,0x03,0x55,0x04,0x0B,0x13,0x28,0x47,0x6F,0x20,0x44, -0x61,0x64,0x64,0x79,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F, -0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x34,0x30,0x36,0x32,0x39,0x31,0x37, -0x30,0x36,0x32,0x30,0x5A,0x17,0x0D,0x33,0x34,0x30,0x36,0x32,0x39,0x31,0x37,0x30, -0x36,0x32,0x30,0x5A,0x30,0x63,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13, -0x02,0x55,0x53,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x0A,0x13,0x18,0x54,0x68, -0x65,0x20,0x47,0x6F,0x20,0x44,0x61,0x64,0x64,0x79,0x20,0x47,0x72,0x6F,0x75,0x70, -0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x31,0x30,0x2F,0x06,0x03,0x55,0x04,0x0B,0x13, -0x28,0x47,0x6F,0x20,0x44,0x61,0x64,0x64,0x79,0x20,0x43,0x6C,0x61,0x73,0x73,0x20, -0x32,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20, -0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x82,0x01,0x20,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0D, -0x00,0x30,0x82,0x01,0x08,0x02,0x82,0x01,0x01,0x00,0xDE,0x9D,0xD7,0xEA,0x57,0x18, -0x49,0xA1,0x5B,0xEB,0xD7,0x5F,0x48,0x86,0xEA,0xBE,0xDD,0xFF,0xE4,0xEF,0x67,0x1C, -0xF4,0x65,0x68,0xB3,0x57,0x71,0xA0,0x5E,0x77,0xBB,0xED,0x9B,0x49,0xE9,0x70,0x80, -0x3D,0x56,0x18,0x63,0x08,0x6F,0xDA,0xF2,0xCC,0xD0,0x3F,0x7F,0x02,0x54,0x22,0x54, -0x10,0xD8,0xB2,0x81,0xD4,0xC0,0x75,0x3D,0x4B,0x7F,0xC7,0x77,0xC3,0x3E,0x78,0xAB, -0x1A,0x03,0xB5,0x20,0x6B,0x2F,0x6A,0x2B,0xB1,0xC5,0x88,0x7E,0xC4,0xBB,0x1E,0xB0, -0xC1,0xD8,0x45,0x27,0x6F,0xAA,0x37,0x58,0xF7,0x87,0x26,0xD7,0xD8,0x2D,0xF6,0xA9, -0x17,0xB7,0x1F,0x72,0x36,0x4E,0xA6,0x17,0x3F,0x65,0x98,0x92,0xDB,0x2A,0x6E,0x5D, -0xA2,0xFE,0x88,0xE0,0x0B,0xDE,0x7F,0xE5,0x8D,0x15,0xE1,0xEB,0xCB,0x3A,0xD5,0xE2, -0x12,0xA2,0x13,0x2D,0xD8,0x8E,0xAF,0x5F,0x12,0x3D,0xA0,0x08,0x05,0x08,0xB6,0x5C, -0xA5,0x65,0x38,0x04,0x45,0x99,0x1E,0xA3,0x60,0x60,0x74,0xC5,0x41,0xA5,0x72,0x62, -0x1B,0x62,0xC5,0x1F,0x6F,0x5F,0x1A,0x42,0xBE,0x02,0x51,0x65,0xA8,0xAE,0x23,0x18, -0x6A,0xFC,0x78,0x03,0xA9,0x4D,0x7F,0x80,0xC3,0xFA,0xAB,0x5A,0xFC,0xA1,0x40,0xA4, -0xCA,0x19,0x16,0xFE,0xB2,0xC8,0xEF,0x5E,0x73,0x0D,0xEE,0x77,0xBD,0x9A,0xF6,0x79, -0x98,0xBC,0xB1,0x07,0x67,0xA2,0x15,0x0D,0xDD,0xA0,0x58,0xC6,0x44,0x7B,0x0A,0x3E, -0x62,0x28,0x5F,0xBA,0x41,0x07,0x53,0x58,0xCF,0x11,0x7E,0x38,0x74,0xC5,0xF8,0xFF, -0xB5,0x69,0x90,0x8F,0x84,0x74,0xEA,0x97,0x1B,0xAF,0x02,0x01,0x03,0xA3,0x81,0xC0, -0x30,0x81,0xBD,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xD2,0xC4, -0xB0,0xD2,0x91,0xD4,0x4C,0x11,0x71,0xB3,0x61,0xCB,0x3D,0xA1,0xFE,0xDD,0xA8,0x6A, -0xD4,0xE3,0x30,0x81,0x8D,0x06,0x03,0x55,0x1D,0x23,0x04,0x81,0x85,0x30,0x81,0x82, -0x80,0x14,0xD2,0xC4,0xB0,0xD2,0x91,0xD4,0x4C,0x11,0x71,0xB3,0x61,0xCB,0x3D,0xA1, -0xFE,0xDD,0xA8,0x6A,0xD4,0xE3,0xA1,0x67,0xA4,0x65,0x30,0x63,0x31,0x0B,0x30,0x09, -0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x21,0x30,0x1F,0x06,0x03,0x55, -0x04,0x0A,0x13,0x18,0x54,0x68,0x65,0x20,0x47,0x6F,0x20,0x44,0x61,0x64,0x64,0x79, -0x20,0x47,0x72,0x6F,0x75,0x70,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x31,0x30,0x2F, -0x06,0x03,0x55,0x04,0x0B,0x13,0x28,0x47,0x6F,0x20,0x44,0x61,0x64,0x64,0x79,0x20, -0x43,0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x82, -0x01,0x00,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05,0x30,0x03,0x01,0x01,0xFF, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03, -0x82,0x01,0x01,0x00,0x32,0x4B,0xF3,0xB2,0xCA,0x3E,0x91,0xFC,0x12,0xC6,0xA1,0x07, -0x8C,0x8E,0x77,0xA0,0x33,0x06,0x14,0x5C,0x90,0x1E,0x18,0xF7,0x08,0xA6,0x3D,0x0A, -0x19,0xF9,0x87,0x80,0x11,0x6E,0x69,0xE4,0x96,0x17,0x30,0xFF,0x34,0x91,0x63,0x72, -0x38,0xEE,0xCC,0x1C,0x01,0xA3,0x1D,0x94,0x28,0xA4,0x31,0xF6,0x7A,0xC4,0x54,0xD7, -0xF6,0xE5,0x31,0x58,0x03,0xA2,0xCC,0xCE,0x62,0xDB,0x94,0x45,0x73,0xB5,0xBF,0x45, -0xC9,0x24,0xB5,0xD5,0x82,0x02,0xAD,0x23,0x79,0x69,0x8D,0xB8,0xB6,0x4D,0xCE,0xCF, -0x4C,0xCA,0x33,0x23,0xE8,0x1C,0x88,0xAA,0x9D,0x8B,0x41,0x6E,0x16,0xC9,0x20,0xE5, -0x89,0x9E,0xCD,0x3B,0xDA,0x70,0xF7,0x7E,0x99,0x26,0x20,0x14,0x54,0x25,0xAB,0x6E, -0x73,0x85,0xE6,0x9B,0x21,0x9D,0x0A,0x6C,0x82,0x0E,0xA8,0xF8,0xC2,0x0C,0xFA,0x10, -0x1E,0x6C,0x96,0xEF,0x87,0x0D,0xC4,0x0F,0x61,0x8B,0xAD,0xEE,0x83,0x2B,0x95,0xF8, -0x8E,0x92,0x84,0x72,0x39,0xEB,0x20,0xEA,0x83,0xED,0x83,0xCD,0x97,0x6E,0x08,0xBC, -0xEB,0x4E,0x26,0xB6,0x73,0x2B,0xE4,0xD3,0xF6,0x4C,0xFE,0x26,0x71,0xE2,0x61,0x11, -0x74,0x4A,0xFF,0x57,0x1A,0x87,0x0F,0x75,0x48,0x2E,0xCF,0x51,0x69,0x17,0xA0,0x02, -0x12,0x61,0x95,0xD5,0xD1,0x40,0xB2,0x10,0x4C,0xEE,0xC4,0xAC,0x10,0x43,0xA6,0xA5, -0x9E,0x0A,0xD5,0x95,0x62,0x9A,0x0D,0xCF,0x88,0x82,0xC5,0x32,0x0C,0xE4,0x2B,0x9F, -0x45,0xE6,0x0D,0x9F,0x28,0x9C,0xB1,0xB9,0x2A,0x5A,0x57,0xAD,0x37,0x0F,0xAF,0x1D, -0x7F,0xDB,0xBD,0x9F, -}; - - -/* subject:/C=US/O=GeoTrust Inc./CN=GeoTrust Primary Certification Authority */ -/* issuer :/C=US/O=GeoTrust Inc./CN=GeoTrust Primary Certification Authority */ - - -const unsigned char GeoTrust_Primary_Certification_Authority_certificate[896]={ -0x30,0x82,0x03,0x7C,0x30,0x82,0x02,0x64,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x18, -0xAC,0xB5,0x6A,0xFD,0x69,0xB6,0x15,0x3A,0x63,0x6C,0xAF,0xDA,0xFA,0xC4,0xA1,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x58, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30, -0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74, -0x20,0x49,0x6E,0x63,0x2E,0x31,0x31,0x30,0x2F,0x06,0x03,0x55,0x04,0x03,0x13,0x28, -0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79, -0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41, -0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x31, -0x32,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x36,0x30,0x37,0x31, -0x36,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03, -0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A, -0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31, -0x31,0x30,0x2F,0x06,0x03,0x55,0x04,0x03,0x13,0x28,0x47,0x65,0x6F,0x54,0x72,0x75, -0x73,0x74,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82, -0x01,0x01,0x00,0xBE,0xB8,0x15,0x7B,0xFF,0xD4,0x7C,0x7D,0x67,0xAD,0x83,0x64,0x7B, -0xC8,0x42,0x53,0x2D,0xDF,0xF6,0x84,0x08,0x20,0x61,0xD6,0x01,0x59,0x6A,0x9C,0x44, -0x11,0xAF,0xEF,0x76,0xFD,0x95,0x7E,0xCE,0x61,0x30,0xBB,0x7A,0x83,0x5F,0x02,0xBD, -0x01,0x66,0xCA,0xEE,0x15,0x8D,0x6F,0xA1,0x30,0x9C,0xBD,0xA1,0x85,0x9E,0x94,0x3A, -0xF3,0x56,0x88,0x00,0x31,0xCF,0xD8,0xEE,0x6A,0x96,0x02,0xD9,0xED,0x03,0x8C,0xFB, -0x75,0x6D,0xE7,0xEA,0xB8,0x55,0x16,0x05,0x16,0x9A,0xF4,0xE0,0x5E,0xB1,0x88,0xC0, -0x64,0x85,0x5C,0x15,0x4D,0x88,0xC7,0xB7,0xBA,0xE0,0x75,0xE9,0xAD,0x05,0x3D,0x9D, -0xC7,0x89,0x48,0xE0,0xBB,0x28,0xC8,0x03,0xE1,0x30,0x93,0x64,0x5E,0x52,0xC0,0x59, -0x70,0x22,0x35,0x57,0x88,0x8A,0xF1,0x95,0x0A,0x83,0xD7,0xBC,0x31,0x73,0x01,0x34, -0xED,0xEF,0x46,0x71,0xE0,0x6B,0x02,0xA8,0x35,0x72,0x6B,0x97,0x9B,0x66,0xE0,0xCB, -0x1C,0x79,0x5F,0xD8,0x1A,0x04,0x68,0x1E,0x47,0x02,0xE6,0x9D,0x60,0xE2,0x36,0x97, -0x01,0xDF,0xCE,0x35,0x92,0xDF,0xBE,0x67,0xC7,0x6D,0x77,0x59,0x3B,0x8F,0x9D,0xD6, -0x90,0x15,0x94,0xBC,0x42,0x34,0x10,0xC1,0x39,0xF9,0xB1,0x27,0x3E,0x7E,0xD6,0x8A, -0x75,0xC5,0xB2,0xAF,0x96,0xD3,0xA2,0xDE,0x9B,0xE4,0x98,0xBE,0x7D,0xE1,0xE9,0x81, -0xAD,0xB6,0x6F,0xFC,0xD7,0x0E,0xDA,0xE0,0x34,0xB0,0x0D,0x1A,0x77,0xE7,0xE3,0x08, -0x98,0xEF,0x58,0xFA,0x9C,0x84,0xB7,0x36,0xAF,0xC2,0xDF,0xAC,0xD2,0xF4,0x10,0x06, -0x70,0x71,0x35,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06,0x03, -0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06, -0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x2C,0xD5,0x50,0x41,0x97,0x15,0x8B,0xF0, -0x8F,0x36,0x61,0x5B,0x4A,0xFB,0x6B,0xD9,0x99,0xC9,0x33,0x92,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00, -0x5A,0x70,0x7F,0x2C,0xDD,0xB7,0x34,0x4F,0xF5,0x86,0x51,0xA9,0x26,0xBE,0x4B,0xB8, -0xAA,0xF1,0x71,0x0D,0xDC,0x61,0xC7,0xA0,0xEA,0x34,0x1E,0x7A,0x77,0x0F,0x04,0x35, -0xE8,0x27,0x8F,0x6C,0x90,0xBF,0x91,0x16,0x24,0x46,0x3E,0x4A,0x4E,0xCE,0x2B,0x16, -0xD5,0x0B,0x52,0x1D,0xFC,0x1F,0x67,0xA2,0x02,0x45,0x31,0x4F,0xCE,0xF3,0xFA,0x03, -0xA7,0x79,0x9D,0x53,0x6A,0xD9,0xDA,0x63,0x3A,0xF8,0x80,0xD7,0xD3,0x99,0xE1,0xA5, -0xE1,0xBE,0xD4,0x55,0x71,0x98,0x35,0x3A,0xBE,0x93,0xEA,0xAE,0xAD,0x42,0xB2,0x90, -0x6F,0xE0,0xFC,0x21,0x4D,0x35,0x63,0x33,0x89,0x49,0xD6,0x9B,0x4E,0xCA,0xC7,0xE7, -0x4E,0x09,0x00,0xF7,0xDA,0xC7,0xEF,0x99,0x62,0x99,0x77,0xB6,0x95,0x22,0x5E,0x8A, -0xA0,0xAB,0xF4,0xB8,0x78,0x98,0xCA,0x38,0x19,0x99,0xC9,0x72,0x9E,0x78,0xCD,0x4B, -0xAC,0xAF,0x19,0xA0,0x73,0x12,0x2D,0xFC,0xC2,0x41,0xBA,0x81,0x91,0xDA,0x16,0x5A, -0x31,0xB7,0xF9,0xB4,0x71,0x80,0x12,0x48,0x99,0x72,0x73,0x5A,0x59,0x53,0xC1,0x63, -0x52,0x33,0xED,0xA7,0xC9,0xD2,0x39,0x02,0x70,0xFA,0xE0,0xB1,0x42,0x66,0x29,0xAA, -0x9B,0x51,0xED,0x30,0x54,0x22,0x14,0x5F,0xD9,0xAB,0x1D,0xC1,0xE4,0x94,0xF0,0xF8, -0xF5,0x2B,0xF7,0xEA,0xCA,0x78,0x46,0xD6,0xB8,0x91,0xFD,0xA6,0x0D,0x2B,0x1A,0x14, -0x01,0x3E,0x80,0xF0,0x42,0xA0,0x95,0x07,0x5E,0x6D,0xCD,0xCC,0x4B,0xA4,0x45,0x8D, -0xAB,0x12,0xE8,0xB3,0xDE,0x5A,0xE5,0xA0,0x7C,0xE8,0x0F,0x22,0x1D,0x5A,0xE9,0x59, -}; - - -/* subject:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G5 */ -/* issuer :/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G5 */ - - -const unsigned char VeriSign_Class_3_Public_Primary_Certification_Authority___G5_certificate[1239]={ -0x30,0x82,0x04,0xD3,0x30,0x82,0x03,0xBB,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x18, -0xDA,0xD1,0x9E,0x26,0x7D,0xE8,0xBB,0x4A,0x21,0x58,0xCD,0xCC,0x6B,0x3B,0x4A,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81, -0xCA,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17, -0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67, -0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B, -0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74, -0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04, -0x0B,0x13,0x31,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x36,0x20,0x56,0x65,0x72,0x69, -0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72, -0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20, -0x6F,0x6E,0x6C,0x79,0x31,0x45,0x30,0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56, -0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20, -0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43, -0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74, -0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x47,0x35,0x30,0x1E,0x17,0x0D,0x30, -0x36,0x31,0x31,0x30,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x36, -0x30,0x37,0x31,0x36,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0xCA,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20, -0x49,0x6E,0x63,0x2E,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x56, -0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65, -0x74,0x77,0x6F,0x72,0x6B,0x31,0x3A,0x30,0x38,0x06,0x03,0x55,0x04,0x0B,0x13,0x31, -0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67, -0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75, -0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C, -0x79,0x31,0x45,0x30,0x43,0x06,0x03,0x55,0x04,0x03,0x13,0x3C,0x56,0x65,0x72,0x69, -0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62, -0x6C,0x69,0x63,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72, -0x69,0x74,0x79,0x20,0x2D,0x20,0x47,0x35,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00, -0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAF,0x24,0x08,0x08,0x29,0x7A,0x35, -0x9E,0x60,0x0C,0xAA,0xE7,0x4B,0x3B,0x4E,0xDC,0x7C,0xBC,0x3C,0x45,0x1C,0xBB,0x2B, -0xE0,0xFE,0x29,0x02,0xF9,0x57,0x08,0xA3,0x64,0x85,0x15,0x27,0xF5,0xF1,0xAD,0xC8, -0x31,0x89,0x5D,0x22,0xE8,0x2A,0xAA,0xA6,0x42,0xB3,0x8F,0xF8,0xB9,0x55,0xB7,0xB1, -0xB7,0x4B,0xB3,0xFE,0x8F,0x7E,0x07,0x57,0xEC,0xEF,0x43,0xDB,0x66,0x62,0x15,0x61, -0xCF,0x60,0x0D,0xA4,0xD8,0xDE,0xF8,0xE0,0xC3,0x62,0x08,0x3D,0x54,0x13,0xEB,0x49, -0xCA,0x59,0x54,0x85,0x26,0xE5,0x2B,0x8F,0x1B,0x9F,0xEB,0xF5,0xA1,0x91,0xC2,0x33, -0x49,0xD8,0x43,0x63,0x6A,0x52,0x4B,0xD2,0x8F,0xE8,0x70,0x51,0x4D,0xD1,0x89,0x69, -0x7B,0xC7,0x70,0xF6,0xB3,0xDC,0x12,0x74,0xDB,0x7B,0x5D,0x4B,0x56,0xD3,0x96,0xBF, -0x15,0x77,0xA1,0xB0,0xF4,0xA2,0x25,0xF2,0xAF,0x1C,0x92,0x67,0x18,0xE5,0xF4,0x06, -0x04,0xEF,0x90,0xB9,0xE4,0x00,0xE4,0xDD,0x3A,0xB5,0x19,0xFF,0x02,0xBA,0xF4,0x3C, -0xEE,0xE0,0x8B,0xEB,0x37,0x8B,0xEC,0xF4,0xD7,0xAC,0xF2,0xF6,0xF0,0x3D,0xAF,0xDD, -0x75,0x91,0x33,0x19,0x1D,0x1C,0x40,0xCB,0x74,0x24,0x19,0x21,0x93,0xD9,0x14,0xFE, -0xAC,0x2A,0x52,0xC7,0x8F,0xD5,0x04,0x49,0xE4,0x8D,0x63,0x47,0x88,0x3C,0x69,0x83, -0xCB,0xFE,0x47,0xBD,0x2B,0x7E,0x4F,0xC5,0x95,0xAE,0x0E,0x9D,0xD4,0xD1,0x43,0xC0, -0x67,0x73,0xE3,0x14,0x08,0x7E,0xE5,0x3F,0x9F,0x73,0xB8,0x33,0x0A,0xCF,0x5D,0x3F, -0x34,0x87,0x96,0x8A,0xEE,0x53,0xE8,0x25,0x15,0x02,0x03,0x01,0x00,0x01,0xA3,0x81, -0xB2,0x30,0x81,0xAF,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05, -0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04, -0x04,0x03,0x02,0x01,0x06,0x30,0x6D,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x01, -0x0C,0x04,0x61,0x30,0x5F,0xA1,0x5D,0xA0,0x5B,0x30,0x59,0x30,0x57,0x30,0x55,0x16, -0x09,0x69,0x6D,0x61,0x67,0x65,0x2F,0x67,0x69,0x66,0x30,0x21,0x30,0x1F,0x30,0x07, -0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x04,0x14,0x8F,0xE5,0xD3,0x1A,0x86,0xAC,0x8D, -0x8E,0x6B,0xC3,0xCF,0x80,0x6A,0xD4,0x48,0x18,0x2C,0x7B,0x19,0x2E,0x30,0x25,0x16, -0x23,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x6C,0x6F,0x67,0x6F,0x2E,0x76,0x65,0x72, -0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x76,0x73,0x6C,0x6F,0x67,0x6F, -0x2E,0x67,0x69,0x66,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x7F, -0xD3,0x65,0xA7,0xC2,0xDD,0xEC,0xBB,0xF0,0x30,0x09,0xF3,0x43,0x39,0xFA,0x02,0xAF, -0x33,0x31,0x33,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, -0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x93,0x24,0x4A,0x30,0x5F,0x62,0xCF,0xD8,0x1A, -0x98,0x2F,0x3D,0xEA,0xDC,0x99,0x2D,0xBD,0x77,0xF6,0xA5,0x79,0x22,0x38,0xEC,0xC4, -0xA7,0xA0,0x78,0x12,0xAD,0x62,0x0E,0x45,0x70,0x64,0xC5,0xE7,0x97,0x66,0x2D,0x98, -0x09,0x7E,0x5F,0xAF,0xD6,0xCC,0x28,0x65,0xF2,0x01,0xAA,0x08,0x1A,0x47,0xDE,0xF9, -0xF9,0x7C,0x92,0x5A,0x08,0x69,0x20,0x0D,0xD9,0x3E,0x6D,0x6E,0x3C,0x0D,0x6E,0xD8, -0xE6,0x06,0x91,0x40,0x18,0xB9,0xF8,0xC1,0xED,0xDF,0xDB,0x41,0xAA,0xE0,0x96,0x20, -0xC9,0xCD,0x64,0x15,0x38,0x81,0xC9,0x94,0xEE,0xA2,0x84,0x29,0x0B,0x13,0x6F,0x8E, -0xDB,0x0C,0xDD,0x25,0x02,0xDB,0xA4,0x8B,0x19,0x44,0xD2,0x41,0x7A,0x05,0x69,0x4A, -0x58,0x4F,0x60,0xCA,0x7E,0x82,0x6A,0x0B,0x02,0xAA,0x25,0x17,0x39,0xB5,0xDB,0x7F, -0xE7,0x84,0x65,0x2A,0x95,0x8A,0xBD,0x86,0xDE,0x5E,0x81,0x16,0x83,0x2D,0x10,0xCC, -0xDE,0xFD,0xA8,0x82,0x2A,0x6D,0x28,0x1F,0x0D,0x0B,0xC4,0xE5,0xE7,0x1A,0x26,0x19, -0xE1,0xF4,0x11,0x6F,0x10,0xB5,0x95,0xFC,0xE7,0x42,0x05,0x32,0xDB,0xCE,0x9D,0x51, -0x5E,0x28,0xB6,0x9E,0x85,0xD3,0x5B,0xEF,0xA5,0x7D,0x45,0x40,0x72,0x8E,0xB7,0x0E, -0x6B,0x0E,0x06,0xFB,0x33,0x35,0x48,0x71,0xB8,0x9D,0x27,0x8B,0xC4,0x65,0x5F,0x0D, -0x86,0x76,0x9C,0x44,0x7A,0xF6,0x95,0x5C,0xF6,0x5D,0x32,0x08,0x33,0xA4,0x54,0xB6, -0x18,0x3F,0x68,0x5C,0xF2,0x42,0x4A,0x85,0x38,0x54,0x83,0x5F,0xD1,0xE8,0x2C,0xF2, -0xAC,0x11,0xD6,0xA8,0xED,0x63,0x6A, -}; - - -/* subject:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority */ -/* issuer :/C=US/O=Equifax/OU=Equifax Secure Certificate Authority */ - - -const unsigned char Equifax_Secure_CA_certificate[804]={ -0x30,0x82,0x03,0x20,0x30,0x82,0x02,0x89,0xA0,0x03,0x02,0x01,0x02,0x02,0x04,0x35, -0xDE,0xF4,0xCF,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, -0x05,0x00,0x30,0x4E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55, -0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x0A,0x13,0x07,0x45,0x71,0x75,0x69, -0x66,0x61,0x78,0x31,0x2D,0x30,0x2B,0x06,0x03,0x55,0x04,0x0B,0x13,0x24,0x45,0x71, -0x75,0x69,0x66,0x61,0x78,0x20,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x38,0x30,0x38,0x32,0x32,0x31,0x36,0x34,0x31, -0x35,0x31,0x5A,0x17,0x0D,0x31,0x38,0x30,0x38,0x32,0x32,0x31,0x36,0x34,0x31,0x35, -0x31,0x5A,0x30,0x4E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55, -0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x0A,0x13,0x07,0x45,0x71,0x75,0x69, -0x66,0x61,0x78,0x31,0x2D,0x30,0x2B,0x06,0x03,0x55,0x04,0x0B,0x13,0x24,0x45,0x71, -0x75,0x69,0x66,0x61,0x78,0x20,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x30,0x81,0x9F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xC1, -0x5D,0xB1,0x58,0x67,0x08,0x62,0xEE,0xA0,0x9A,0x2D,0x1F,0x08,0x6D,0x91,0x14,0x68, -0x98,0x0A,0x1E,0xFE,0xDA,0x04,0x6F,0x13,0x84,0x62,0x21,0xC3,0xD1,0x7C,0xCE,0x9F, -0x05,0xE0,0xB8,0x01,0xF0,0x4E,0x34,0xEC,0xE2,0x8A,0x95,0x04,0x64,0xAC,0xF1,0x6B, -0x53,0x5F,0x05,0xB3,0xCB,0x67,0x80,0xBF,0x42,0x02,0x8E,0xFE,0xDD,0x01,0x09,0xEC, -0xE1,0x00,0x14,0x4F,0xFC,0xFB,0xF0,0x0C,0xDD,0x43,0xBA,0x5B,0x2B,0xE1,0x1F,0x80, -0x70,0x99,0x15,0x57,0x93,0x16,0xF1,0x0F,0x97,0x6A,0xB7,0xC2,0x68,0x23,0x1C,0xCC, -0x4D,0x59,0x30,0xAC,0x51,0x1E,0x3B,0xAF,0x2B,0xD6,0xEE,0x63,0x45,0x7B,0xC5,0xD9, -0x5F,0x50,0xD2,0xE3,0x50,0x0F,0x3A,0x88,0xE7,0xBF,0x14,0xFD,0xE0,0xC7,0xB9,0x02, -0x03,0x01,0x00,0x01,0xA3,0x82,0x01,0x09,0x30,0x82,0x01,0x05,0x30,0x70,0x06,0x03, -0x55,0x1D,0x1F,0x04,0x69,0x30,0x67,0x30,0x65,0xA0,0x63,0xA0,0x61,0xA4,0x5F,0x30, -0x5D,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x10, -0x30,0x0E,0x06,0x03,0x55,0x04,0x0A,0x13,0x07,0x45,0x71,0x75,0x69,0x66,0x61,0x78, -0x31,0x2D,0x30,0x2B,0x06,0x03,0x55,0x04,0x0B,0x13,0x24,0x45,0x71,0x75,0x69,0x66, -0x61,0x78,0x20,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x43,0x65,0x72,0x74,0x69,0x66, -0x69,0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x31, -0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x03,0x13,0x04,0x43,0x52,0x4C,0x31,0x30,0x1A, -0x06,0x03,0x55,0x1D,0x10,0x04,0x13,0x30,0x11,0x81,0x0F,0x32,0x30,0x31,0x38,0x30, -0x38,0x32,0x32,0x31,0x36,0x34,0x31,0x35,0x31,0x5A,0x30,0x0B,0x06,0x03,0x55,0x1D, -0x0F,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18, -0x30,0x16,0x80,0x14,0x48,0xE6,0x68,0xF9,0x2B,0xD2,0xB2,0x95,0xD7,0x47,0xD8,0x23, -0x20,0x10,0x4F,0x33,0x98,0x90,0x9F,0xD4,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04, -0x16,0x04,0x14,0x48,0xE6,0x68,0xF9,0x2B,0xD2,0xB2,0x95,0xD7,0x47,0xD8,0x23,0x20, -0x10,0x4F,0x33,0x98,0x90,0x9F,0xD4,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05, -0x30,0x03,0x01,0x01,0xFF,0x30,0x1A,0x06,0x09,0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07, -0x41,0x00,0x04,0x0D,0x30,0x0B,0x1B,0x05,0x56,0x33,0x2E,0x30,0x63,0x03,0x02,0x06, -0xC0,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00, -0x03,0x81,0x81,0x00,0x58,0xCE,0x29,0xEA,0xFC,0xF7,0xDE,0xB5,0xCE,0x02,0xB9,0x17, -0xB5,0x85,0xD1,0xB9,0xE3,0xE0,0x95,0xCC,0x25,0x31,0x0D,0x00,0xA6,0x92,0x6E,0x7F, -0xB6,0x92,0x63,0x9E,0x50,0x95,0xD1,0x9A,0x6F,0xE4,0x11,0xDE,0x63,0x85,0x6E,0x98, -0xEE,0xA8,0xFF,0x5A,0xC8,0xD3,0x55,0xB2,0x66,0x71,0x57,0xDE,0xC0,0x21,0xEB,0x3D, -0x2A,0xA7,0x23,0x49,0x01,0x04,0x86,0x42,0x7B,0xFC,0xEE,0x7F,0xA2,0x16,0x52,0xB5, -0x67,0x67,0xD3,0x40,0xDB,0x3B,0x26,0x58,0xB2,0x28,0x77,0x3D,0xAE,0x14,0x77,0x61, -0xD6,0xFA,0x2A,0x66,0x27,0xA0,0x0D,0xFA,0xA7,0x73,0x5C,0xEA,0x70,0xF1,0x94,0x21, -0x65,0x44,0x5F,0xFA,0xFC,0xEF,0x29,0x68,0xA9,0xA2,0x87,0x79,0xEF,0x79,0xEF,0x4F, -0xAC,0x07,0x77,0x38, -}; - - -/* subject:/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048) */ -/* issuer :/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048) */ - - -const unsigned char Entrust_net_Premium_2048_Secure_Server_CA_certificate[1120]={ -0x30,0x82,0x04,0x5C,0x30,0x82,0x03,0x44,0xA0,0x03,0x02,0x01,0x02,0x02,0x04,0x38, -0x63,0xB9,0x66,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, -0x05,0x00,0x30,0x81,0xB4,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x13,0x0B, -0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x31,0x40,0x30,0x3E,0x06, -0x03,0x55,0x04,0x0B,0x14,0x37,0x77,0x77,0x77,0x2E,0x65,0x6E,0x74,0x72,0x75,0x73, -0x74,0x2E,0x6E,0x65,0x74,0x2F,0x43,0x50,0x53,0x5F,0x32,0x30,0x34,0x38,0x20,0x69, -0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x2E,0x20,0x28, -0x6C,0x69,0x6D,0x69,0x74,0x73,0x20,0x6C,0x69,0x61,0x62,0x2E,0x29,0x31,0x25,0x30, -0x23,0x06,0x03,0x55,0x04,0x0B,0x13,0x1C,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x39, -0x20,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x20,0x4C,0x69,0x6D, -0x69,0x74,0x65,0x64,0x31,0x33,0x30,0x31,0x06,0x03,0x55,0x04,0x03,0x13,0x2A,0x45, -0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x20,0x28,0x32,0x30,0x34,0x38,0x29,0x30,0x1E,0x17,0x0D,0x39,0x39,0x31, -0x32,0x32,0x34,0x31,0x37,0x35,0x30,0x35,0x31,0x5A,0x17,0x0D,0x31,0x39,0x31,0x32, -0x32,0x34,0x31,0x38,0x32,0x30,0x35,0x31,0x5A,0x30,0x81,0xB4,0x31,0x14,0x30,0x12, -0x06,0x03,0x55,0x04,0x0A,0x13,0x0B,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E, -0x65,0x74,0x31,0x40,0x30,0x3E,0x06,0x03,0x55,0x04,0x0B,0x14,0x37,0x77,0x77,0x77, -0x2E,0x65,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x2F,0x43,0x50,0x53, -0x5F,0x32,0x30,0x34,0x38,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79, -0x20,0x72,0x65,0x66,0x2E,0x20,0x28,0x6C,0x69,0x6D,0x69,0x74,0x73,0x20,0x6C,0x69, -0x61,0x62,0x2E,0x29,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x0B,0x13,0x1C,0x28, -0x63,0x29,0x20,0x31,0x39,0x39,0x39,0x20,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E, -0x6E,0x65,0x74,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x33,0x30,0x31,0x06, -0x03,0x55,0x04,0x03,0x13,0x2A,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65, -0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20, -0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x28,0x32,0x30,0x34,0x38,0x29, -0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01, -0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01, -0x00,0xAD,0x4D,0x4B,0xA9,0x12,0x86,0xB2,0xEA,0xA3,0x20,0x07,0x15,0x16,0x64,0x2A, -0x2B,0x4B,0xD1,0xBF,0x0B,0x4A,0x4D,0x8E,0xED,0x80,0x76,0xA5,0x67,0xB7,0x78,0x40, -0xC0,0x73,0x42,0xC8,0x68,0xC0,0xDB,0x53,0x2B,0xDD,0x5E,0xB8,0x76,0x98,0x35,0x93, -0x8B,0x1A,0x9D,0x7C,0x13,0x3A,0x0E,0x1F,0x5B,0xB7,0x1E,0xCF,0xE5,0x24,0x14,0x1E, -0xB1,0x81,0xA9,0x8D,0x7D,0xB8,0xCC,0x6B,0x4B,0x03,0xF1,0x02,0x0C,0xDC,0xAB,0xA5, -0x40,0x24,0x00,0x7F,0x74,0x94,0xA1,0x9D,0x08,0x29,0xB3,0x88,0x0B,0xF5,0x87,0x77, -0x9D,0x55,0xCD,0xE4,0xC3,0x7E,0xD7,0x6A,0x64,0xAB,0x85,0x14,0x86,0x95,0x5B,0x97, -0x32,0x50,0x6F,0x3D,0xC8,0xBA,0x66,0x0C,0xE3,0xFC,0xBD,0xB8,0x49,0xC1,0x76,0x89, -0x49,0x19,0xFD,0xC0,0xA8,0xBD,0x89,0xA3,0x67,0x2F,0xC6,0x9F,0xBC,0x71,0x19,0x60, -0xB8,0x2D,0xE9,0x2C,0xC9,0x90,0x76,0x66,0x7B,0x94,0xE2,0xAF,0x78,0xD6,0x65,0x53, -0x5D,0x3C,0xD6,0x9C,0xB2,0xCF,0x29,0x03,0xF9,0x2F,0xA4,0x50,0xB2,0xD4,0x48,0xCE, -0x05,0x32,0x55,0x8A,0xFD,0xB2,0x64,0x4C,0x0E,0xE4,0x98,0x07,0x75,0xDB,0x7F,0xDF, -0xB9,0x08,0x55,0x60,0x85,0x30,0x29,0xF9,0x7B,0x48,0xA4,0x69,0x86,0xE3,0x35,0x3F, -0x1E,0x86,0x5D,0x7A,0x7A,0x15,0xBD,0xEF,0x00,0x8E,0x15,0x22,0x54,0x17,0x00,0x90, -0x26,0x93,0xBC,0x0E,0x49,0x68,0x91,0xBF,0xF8,0x47,0xD3,0x9D,0x95,0x42,0xC1,0x0E, -0x4D,0xDF,0x6F,0x26,0xCF,0xC3,0x18,0x21,0x62,0x66,0x43,0x70,0xD6,0xD5,0xC0,0x07, -0xE1,0x02,0x03,0x01,0x00,0x01,0xA3,0x74,0x30,0x72,0x30,0x11,0x06,0x09,0x60,0x86, -0x48,0x01,0x86,0xF8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x00,0x07,0x30,0x1F,0x06, -0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x55,0xE4,0x81,0xD1,0x11,0x80, -0xBE,0xD8,0x89,0xB9,0x08,0xA3,0x31,0xF9,0xA1,0x24,0x09,0x16,0xB9,0x70,0x30,0x1D, -0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x55,0xE4,0x81,0xD1,0x11,0x80,0xBE, -0xD8,0x89,0xB9,0x08,0xA3,0x31,0xF9,0xA1,0x24,0x09,0x16,0xB9,0x70,0x30,0x1D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x41,0x00,0x04,0x10,0x30,0x0E,0x1B,0x08, -0x56,0x35,0x2E,0x30,0x3A,0x34,0x2E,0x30,0x03,0x02,0x04,0x90,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00, -0x59,0x47,0xAC,0x21,0x84,0x8A,0x17,0xC9,0x9C,0x89,0x53,0x1E,0xBA,0x80,0x85,0x1A, -0xC6,0x3C,0x4E,0x3E,0xB1,0x9C,0xB6,0x7C,0xC6,0x92,0x5D,0x18,0x64,0x02,0xE3,0xD3, -0x06,0x08,0x11,0x61,0x7C,0x63,0xE3,0x2B,0x9D,0x31,0x03,0x70,0x76,0xD2,0xA3,0x28, -0xA0,0xF4,0xBB,0x9A,0x63,0x73,0xED,0x6D,0xE5,0x2A,0xDB,0xED,0x14,0xA9,0x2B,0xC6, -0x36,0x11,0xD0,0x2B,0xEB,0x07,0x8B,0xA5,0xDA,0x9E,0x5C,0x19,0x9D,0x56,0x12,0xF5, -0x54,0x29,0xC8,0x05,0xED,0xB2,0x12,0x2A,0x8D,0xF4,0x03,0x1B,0xFF,0xE7,0x92,0x10, -0x87,0xB0,0x3A,0xB5,0xC3,0x9D,0x05,0x37,0x12,0xA3,0xC7,0xF4,0x15,0xB9,0xD5,0xA4, -0x39,0x16,0x9B,0x53,0x3A,0x23,0x91,0xF1,0xA8,0x82,0xA2,0x6A,0x88,0x68,0xC1,0x79, -0x02,0x22,0xBC,0xAA,0xA6,0xD6,0xAE,0xDF,0xB0,0x14,0x5F,0xB8,0x87,0xD0,0xDD,0x7C, -0x7F,0x7B,0xFF,0xAF,0x1C,0xCF,0xE6,0xDB,0x07,0xAD,0x5E,0xDB,0x85,0x9D,0xD0,0x2B, -0x0D,0x33,0xDB,0x04,0xD1,0xE6,0x49,0x40,0x13,0x2B,0x76,0xFB,0x3E,0xE9,0x9C,0x89, -0x0F,0x15,0xCE,0x18,0xB0,0x85,0x78,0x21,0x4F,0x6B,0x4F,0x0E,0xFA,0x36,0x67,0xCD, -0x07,0xF2,0xFF,0x08,0xD0,0xE2,0xDE,0xD9,0xBF,0x2A,0xAF,0xB8,0x87,0x86,0x21,0x3C, -0x04,0xCA,0xB7,0x94,0x68,0x7F,0xCF,0x3C,0xE9,0x98,0xD7,0x38,0xFF,0xEC,0xC0,0xD9, -0x50,0xF0,0x2E,0x4B,0x58,0xAE,0x46,0x6F,0xD0,0x2E,0xC3,0x60,0xDA,0x72,0x55,0x72, -0xBD,0x4C,0x45,0x9E,0x61,0xBA,0xBF,0x84,0x81,0x92,0x03,0xD1,0xD2,0x69,0x7C,0xC5, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root G3 */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root G3 */ - - -const unsigned char DigiCert_Assured_ID_Root_G3_certificate[586]={ -0x30,0x82,0x02,0x46,0x30,0x82,0x01,0xCD,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x0B, -0xA1,0x5A,0xFA,0x1D,0xDF,0xA0,0xB5,0x49,0x44,0xAF,0xCD,0x24,0xA0,0x6C,0xEC,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x65,0x31,0x0B,0x30, -0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03, -0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49,0x6E, -0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77,0x77,0x77,0x2E, -0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x24,0x30,0x22, -0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20, -0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x20,0x49,0x44,0x20,0x52,0x6F,0x6F,0x74,0x20, -0x47,0x33,0x30,0x1E,0x17,0x0D,0x31,0x33,0x30,0x38,0x30,0x31,0x31,0x32,0x30,0x30, -0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x35,0x31,0x32,0x30,0x30,0x30, -0x30,0x5A,0x30,0x65,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55, -0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69, -0x43,0x65,0x72,0x74,0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04, -0x0B,0x13,0x10,0x77,0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E, -0x63,0x6F,0x6D,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x69, -0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x20,0x49, -0x44,0x20,0x52,0x6F,0x6F,0x74,0x20,0x47,0x33,0x30,0x76,0x30,0x10,0x06,0x07,0x2A, -0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05,0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00, -0x04,0x19,0xE7,0xBC,0xAC,0x44,0x65,0xED,0xCD,0xB8,0x3F,0x58,0xFB,0x8D,0xB1,0x57, -0xA9,0x44,0x2D,0x05,0x15,0xF2,0xEF,0x0B,0xFF,0x10,0x74,0x9F,0xB5,0x62,0x52,0x5F, -0x66,0x7E,0x1F,0xE5,0xDC,0x1B,0x45,0x79,0x0B,0xCC,0xC6,0x53,0x0A,0x9D,0x8D,0x5D, -0x02,0xD9,0xA9,0x59,0xDE,0x02,0x5A,0xF6,0x95,0x2A,0x0E,0x8D,0x38,0x4A,0x8A,0x49, -0xC6,0xBC,0xC6,0x03,0x38,0x07,0x5F,0x55,0xDA,0x7E,0x09,0x6E,0xE2,0x7F,0x5E,0xD0, -0x45,0x20,0x0F,0x59,0x76,0x10,0xD6,0xA0,0x24,0xF0,0x2D,0xDE,0x36,0xF2,0x6C,0x29, -0x39,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04, -0x14,0xCB,0xD0,0xBD,0xA9,0xE1,0x98,0x05,0x51,0xA1,0x4D,0x37,0xA2,0x83,0x79,0xCE, -0x8D,0x1D,0x2A,0xE4,0x84,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03, -0x03,0x03,0x67,0x00,0x30,0x64,0x02,0x30,0x25,0xA4,0x81,0x45,0x02,0x6B,0x12,0x4B, -0x75,0x74,0x4F,0xC8,0x23,0xE3,0x70,0xF2,0x75,0x72,0xDE,0x7C,0x89,0xF0,0xCF,0x91, -0x72,0x61,0x9E,0x5E,0x10,0x92,0x59,0x56,0xB9,0x83,0xC7,0x10,0xE7,0x38,0xE9,0x58, -0x26,0x36,0x7D,0xD5,0xE4,0x34,0x86,0x39,0x02,0x30,0x7C,0x36,0x53,0xF0,0x30,0xE5, -0x62,0x63,0x3A,0x99,0xE2,0xB6,0xA3,0x3B,0x9B,0x34,0xFA,0x1E,0xDA,0x10,0x92,0x71, -0x5E,0x91,0x13,0xA7,0xDD,0xA4,0x6E,0x92,0xCC,0x32,0xD6,0xF5,0x21,0x66,0xC7,0x2F, -0xEA,0x96,0x63,0x6A,0x65,0x45,0x92,0x95,0x01,0xB4, -}; - - -/* subject:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO Certification Authority */ -/* issuer :/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO Certification Authority */ - - -const unsigned char COMODO_Certification_Authority_certificate[1057]={ -0x30,0x82,0x04,0x1D,0x30,0x82,0x03,0x05,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x4E, -0x81,0x2D,0x8A,0x82,0x65,0xE0,0x0B,0x02,0xEE,0x3E,0x35,0x02,0x46,0xE5,0x3D,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81, -0x81,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x13,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72, -0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06, -0x03,0x55,0x04,0x07,0x13,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30, -0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x43, -0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x27,0x30,0x25,0x06,0x03,0x55, -0x04,0x03,0x13,0x1E,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69, -0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x32,0x30,0x31,0x30,0x30,0x30,0x30, -0x30,0x30,0x5A,0x17,0x0D,0x32,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35, -0x39,0x5A,0x30,0x81,0x81,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02, -0x47,0x42,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x13,0x12,0x47,0x72,0x65, -0x61,0x74,0x65,0x72,0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31, -0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72, -0x64,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x43,0x4F,0x4D,0x4F, -0x44,0x4F,0x20,0x43,0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x27,0x30, -0x25,0x06,0x03,0x55,0x04,0x03,0x13,0x1E,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x43, -0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74, -0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82, -0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD0,0x40,0x8B,0x8B,0x72,0xE3,0x91,0x1B,0xF7, -0x51,0xC1,0x1B,0x54,0x04,0x98,0xD3,0xA9,0xBF,0xC1,0xE6,0x8A,0x5D,0x3B,0x87,0xFB, -0xBB,0x88,0xCE,0x0D,0xE3,0x2F,0x3F,0x06,0x96,0xF0,0xA2,0x29,0x50,0x99,0xAE,0xDB, -0x3B,0xA1,0x57,0xB0,0x74,0x51,0x71,0xCD,0xED,0x42,0x91,0x4D,0x41,0xFE,0xA9,0xC8, -0xD8,0x6A,0x86,0x77,0x44,0xBB,0x59,0x66,0x97,0x50,0x5E,0xB4,0xD4,0x2C,0x70,0x44, -0xCF,0xDA,0x37,0x95,0x42,0x69,0x3C,0x30,0xC4,0x71,0xB3,0x52,0xF0,0x21,0x4D,0xA1, -0xD8,0xBA,0x39,0x7C,0x1C,0x9E,0xA3,0x24,0x9D,0xF2,0x83,0x16,0x98,0xAA,0x16,0x7C, -0x43,0x9B,0x15,0x5B,0xB7,0xAE,0x34,0x91,0xFE,0xD4,0x62,0x26,0x18,0x46,0x9A,0x3F, -0xEB,0xC1,0xF9,0xF1,0x90,0x57,0xEB,0xAC,0x7A,0x0D,0x8B,0xDB,0x72,0x30,0x6A,0x66, -0xD5,0xE0,0x46,0xA3,0x70,0xDC,0x68,0xD9,0xFF,0x04,0x48,0x89,0x77,0xDE,0xB5,0xE9, -0xFB,0x67,0x6D,0x41,0xE9,0xBC,0x39,0xBD,0x32,0xD9,0x62,0x02,0xF1,0xB1,0xA8,0x3D, -0x6E,0x37,0x9C,0xE2,0x2F,0xE2,0xD3,0xA2,0x26,0x8B,0xC6,0xB8,0x55,0x43,0x88,0xE1, -0x23,0x3E,0xA5,0xD2,0x24,0x39,0x6A,0x47,0xAB,0x00,0xD4,0xA1,0xB3,0xA9,0x25,0xFE, -0x0D,0x3F,0xA7,0x1D,0xBA,0xD3,0x51,0xC1,0x0B,0xA4,0xDA,0xAC,0x38,0xEF,0x55,0x50, -0x24,0x05,0x65,0x46,0x93,0x34,0x4F,0x2D,0x8D,0xAD,0xC6,0xD4,0x21,0x19,0xD2,0x8E, -0xCA,0x05,0x61,0x71,0x07,0x73,0x47,0xE5,0x8A,0x19,0x12,0xBD,0x04,0x4D,0xCE,0x4E, -0x9C,0xA5,0x48,0xAC,0xBB,0x26,0xF7,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0x8E,0x30, -0x81,0x8B,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x0B,0x58,0xE5, -0x8B,0xC6,0x4C,0x15,0x37,0xA4,0x40,0xA9,0x30,0xA9,0x21,0xBE,0x47,0x36,0x5A,0x56, -0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01, -0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01, -0x01,0xFF,0x30,0x49,0x06,0x03,0x55,0x1D,0x1F,0x04,0x42,0x30,0x40,0x30,0x3E,0xA0, -0x3C,0xA0,0x3A,0x86,0x38,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E, -0x63,0x6F,0x6D,0x6F,0x64,0x6F,0x63,0x61,0x2E,0x63,0x6F,0x6D,0x2F,0x43,0x4F,0x4D, -0x4F,0x44,0x4F,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E, -0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x2E,0x63,0x72,0x6C,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01, -0x00,0x3E,0x98,0x9E,0x9B,0xF6,0x1B,0xE9,0xD7,0x39,0xB7,0x78,0xAE,0x1D,0x72,0x18, -0x49,0xD3,0x87,0xE4,0x43,0x82,0xEB,0x3F,0xC9,0xAA,0xF5,0xA8,0xB5,0xEF,0x55,0x7C, -0x21,0x52,0x65,0xF9,0xD5,0x0D,0xE1,0x6C,0xF4,0x3E,0x8C,0x93,0x73,0x91,0x2E,0x02, -0xC4,0x4E,0x07,0x71,0x6F,0xC0,0x8F,0x38,0x61,0x08,0xA8,0x1E,0x81,0x0A,0xC0,0x2F, -0x20,0x2F,0x41,0x8B,0x91,0xDC,0x48,0x45,0xBC,0xF1,0xC6,0xDE,0xBA,0x76,0x6B,0x33, -0xC8,0x00,0x2D,0x31,0x46,0x4C,0xED,0xE7,0x9D,0xCF,0x88,0x94,0xFF,0x33,0xC0,0x56, -0xE8,0x24,0x86,0x26,0xB8,0xD8,0x38,0x38,0xDF,0x2A,0x6B,0xDD,0x12,0xCC,0xC7,0x3F, -0x47,0x17,0x4C,0xA2,0xC2,0x06,0x96,0x09,0xD6,0xDB,0xFE,0x3F,0x3C,0x46,0x41,0xDF, -0x58,0xE2,0x56,0x0F,0x3C,0x3B,0xC1,0x1C,0x93,0x35,0xD9,0x38,0x52,0xAC,0xEE,0xC8, -0xEC,0x2E,0x30,0x4E,0x94,0x35,0xB4,0x24,0x1F,0x4B,0x78,0x69,0xDA,0xF2,0x02,0x38, -0xCC,0x95,0x52,0x93,0xF0,0x70,0x25,0x59,0x9C,0x20,0x67,0xC4,0xEE,0xF9,0x8B,0x57, -0x61,0xF4,0x92,0x76,0x7D,0x3F,0x84,0x8D,0x55,0xB7,0xE8,0xE5,0xAC,0xD5,0xF1,0xF5, -0x19,0x56,0xA6,0x5A,0xFB,0x90,0x1C,0xAF,0x93,0xEB,0xE5,0x1C,0xD4,0x67,0x97,0x5D, -0x04,0x0E,0xBE,0x0B,0x83,0xA6,0x17,0x83,0xB9,0x30,0x12,0xA0,0xC5,0x33,0x15,0x05, -0xB9,0x0D,0xFB,0xC7,0x05,0x76,0xE3,0xD8,0x4A,0x8D,0xFC,0x34,0x17,0xA3,0xC6,0x21, -0x28,0xBE,0x30,0x45,0x31,0x1E,0xC7,0x78,0xBE,0x58,0x61,0x38,0xAC,0x3B,0xE2,0x01, -0x65, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root CA */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root CA */ - - -const unsigned char DigiCert_Global_Root_CA_certificate[947]={ -0x30,0x82,0x03,0xAF,0x30,0x82,0x02,0x97,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x08, -0x3B,0xE0,0x56,0x90,0x42,0x46,0xB1,0xA1,0x75,0x6A,0xC9,0x59,0x91,0xC7,0x4A,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x61, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43, -0x41,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30, -0x30,0x5A,0x17,0x0D,0x33,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30, -0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53, -0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43, -0x65,0x72,0x74,0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B, -0x13,0x10,0x77,0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63, -0x6F,0x6D,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x44,0x69,0x67, -0x69,0x43,0x65,0x72,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F, -0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A, -0x02,0x82,0x01,0x01,0x00,0xE2,0x3B,0xE1,0x11,0x72,0xDE,0xA8,0xA4,0xD3,0xA3,0x57, -0xAA,0x50,0xA2,0x8F,0x0B,0x77,0x90,0xC9,0xA2,0xA5,0xEE,0x12,0xCE,0x96,0x5B,0x01, -0x09,0x20,0xCC,0x01,0x93,0xA7,0x4E,0x30,0xB7,0x53,0xF7,0x43,0xC4,0x69,0x00,0x57, -0x9D,0xE2,0x8D,0x22,0xDD,0x87,0x06,0x40,0x00,0x81,0x09,0xCE,0xCE,0x1B,0x83,0xBF, -0xDF,0xCD,0x3B,0x71,0x46,0xE2,0xD6,0x66,0xC7,0x05,0xB3,0x76,0x27,0x16,0x8F,0x7B, -0x9E,0x1E,0x95,0x7D,0xEE,0xB7,0x48,0xA3,0x08,0xDA,0xD6,0xAF,0x7A,0x0C,0x39,0x06, -0x65,0x7F,0x4A,0x5D,0x1F,0xBC,0x17,0xF8,0xAB,0xBE,0xEE,0x28,0xD7,0x74,0x7F,0x7A, -0x78,0x99,0x59,0x85,0x68,0x6E,0x5C,0x23,0x32,0x4B,0xBF,0x4E,0xC0,0xE8,0x5A,0x6D, -0xE3,0x70,0xBF,0x77,0x10,0xBF,0xFC,0x01,0xF6,0x85,0xD9,0xA8,0x44,0x10,0x58,0x32, -0xA9,0x75,0x18,0xD5,0xD1,0xA2,0xBE,0x47,0xE2,0x27,0x6A,0xF4,0x9A,0x33,0xF8,0x49, -0x08,0x60,0x8B,0xD4,0x5F,0xB4,0x3A,0x84,0xBF,0xA1,0xAA,0x4A,0x4C,0x7D,0x3E,0xCF, -0x4F,0x5F,0x6C,0x76,0x5E,0xA0,0x4B,0x37,0x91,0x9E,0xDC,0x22,0xE6,0x6D,0xCE,0x14, -0x1A,0x8E,0x6A,0xCB,0xFE,0xCD,0xB3,0x14,0x64,0x17,0xC7,0x5B,0x29,0x9E,0x32,0xBF, -0xF2,0xEE,0xFA,0xD3,0x0B,0x42,0xD4,0xAB,0xB7,0x41,0x32,0xDA,0x0C,0xD4,0xEF,0xF8, -0x81,0xD5,0xBB,0x8D,0x58,0x3F,0xB5,0x1B,0xE8,0x49,0x28,0xA2,0x70,0xDA,0x31,0x04, -0xDD,0xF7,0xB2,0x16,0xF2,0x4C,0x0A,0x4E,0x07,0xA8,0xED,0x4A,0x3D,0x5E,0xB5,0x7F, -0xA3,0x90,0xC3,0xAF,0x27,0x02,0x03,0x01,0x00,0x01,0xA3,0x63,0x30,0x61,0x30,0x0E, -0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x0F, -0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30, -0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x03,0xDE,0x50,0x35,0x56,0xD1, -0x4C,0xBB,0x66,0xF0,0xA3,0xE2,0x1B,0x1B,0xC3,0x97,0xB2,0x3D,0xD1,0x55,0x30,0x1F, -0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x03,0xDE,0x50,0x35,0x56, -0xD1,0x4C,0xBB,0x66,0xF0,0xA3,0xE2,0x1B,0x1B,0xC3,0x97,0xB2,0x3D,0xD1,0x55,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82, -0x01,0x01,0x00,0xCB,0x9C,0x37,0xAA,0x48,0x13,0x12,0x0A,0xFA,0xDD,0x44,0x9C,0x4F, -0x52,0xB0,0xF4,0xDF,0xAE,0x04,0xF5,0x79,0x79,0x08,0xA3,0x24,0x18,0xFC,0x4B,0x2B, -0x84,0xC0,0x2D,0xB9,0xD5,0xC7,0xFE,0xF4,0xC1,0x1F,0x58,0xCB,0xB8,0x6D,0x9C,0x7A, -0x74,0xE7,0x98,0x29,0xAB,0x11,0xB5,0xE3,0x70,0xA0,0xA1,0xCD,0x4C,0x88,0x99,0x93, -0x8C,0x91,0x70,0xE2,0xAB,0x0F,0x1C,0xBE,0x93,0xA9,0xFF,0x63,0xD5,0xE4,0x07,0x60, -0xD3,0xA3,0xBF,0x9D,0x5B,0x09,0xF1,0xD5,0x8E,0xE3,0x53,0xF4,0x8E,0x63,0xFA,0x3F, -0xA7,0xDB,0xB4,0x66,0xDF,0x62,0x66,0xD6,0xD1,0x6E,0x41,0x8D,0xF2,0x2D,0xB5,0xEA, -0x77,0x4A,0x9F,0x9D,0x58,0xE2,0x2B,0x59,0xC0,0x40,0x23,0xED,0x2D,0x28,0x82,0x45, -0x3E,0x79,0x54,0x92,0x26,0x98,0xE0,0x80,0x48,0xA8,0x37,0xEF,0xF0,0xD6,0x79,0x60, -0x16,0xDE,0xAC,0xE8,0x0E,0xCD,0x6E,0xAC,0x44,0x17,0x38,0x2F,0x49,0xDA,0xE1,0x45, -0x3E,0x2A,0xB9,0x36,0x53,0xCF,0x3A,0x50,0x06,0xF7,0x2E,0xE8,0xC4,0x57,0x49,0x6C, -0x61,0x21,0x18,0xD5,0x04,0xAD,0x78,0x3C,0x2C,0x3A,0x80,0x6B,0xA7,0xEB,0xAF,0x15, -0x14,0xE9,0xD8,0x89,0xC1,0xB9,0x38,0x6C,0xE2,0x91,0x6C,0x8A,0xFF,0x64,0xB9,0x77, -0x25,0x57,0x30,0xC0,0x1B,0x24,0xA3,0xE1,0xDC,0xE9,0xDF,0x47,0x7C,0xB5,0xB4,0x24, -0x08,0x05,0x30,0xEC,0x2D,0xBD,0x0B,0xBF,0x45,0xBF,0x50,0xB9,0xA9,0xF3,0xEB,0x98, -0x01,0x12,0xAD,0xC8,0x88,0xC6,0x98,0x34,0x5F,0x8D,0x0A,0x3C,0xC6,0xE9,0xD5,0x95, -0x95,0x6D,0xDE, -}; - - -/* subject:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services */ -/* issuer :/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services */ - - -const unsigned char Comodo_AAA_Services_root_certificate[1078]={ -0x30,0x82,0x04,0x32,0x30,0x82,0x03,0x1A,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x7B,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x0C,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72, -0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06, -0x03,0x55,0x04,0x07,0x0C,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30, -0x18,0x06,0x03,0x55,0x04,0x0A,0x0C,0x11,0x43,0x6F,0x6D,0x6F,0x64,0x6F,0x20,0x43, -0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x21,0x30,0x1F,0x06,0x03,0x55, -0x04,0x03,0x0C,0x18,0x41,0x41,0x41,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x65,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x1E,0x17,0x0D, -0x30,0x34,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32, -0x38,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x7B,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B,0x30,0x19,0x06, -0x03,0x55,0x04,0x08,0x0C,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72,0x20,0x4D,0x61, -0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04, -0x07,0x0C,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30,0x18,0x06,0x03, -0x55,0x04,0x0A,0x0C,0x11,0x43,0x6F,0x6D,0x6F,0x64,0x6F,0x20,0x43,0x41,0x20,0x4C, -0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x03,0x0C, -0x18,0x41,0x41,0x41,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65, -0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x82,0x01,0x22,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F, -0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xBE,0x40,0x9D,0xF4,0x6E,0xE1, -0xEA,0x76,0x87,0x1C,0x4D,0x45,0x44,0x8E,0xBE,0x46,0xC8,0x83,0x06,0x9D,0xC1,0x2A, -0xFE,0x18,0x1F,0x8E,0xE4,0x02,0xFA,0xF3,0xAB,0x5D,0x50,0x8A,0x16,0x31,0x0B,0x9A, -0x06,0xD0,0xC5,0x70,0x22,0xCD,0x49,0x2D,0x54,0x63,0xCC,0xB6,0x6E,0x68,0x46,0x0B, -0x53,0xEA,0xCB,0x4C,0x24,0xC0,0xBC,0x72,0x4E,0xEA,0xF1,0x15,0xAE,0xF4,0x54,0x9A, -0x12,0x0A,0xC3,0x7A,0xB2,0x33,0x60,0xE2,0xDA,0x89,0x55,0xF3,0x22,0x58,0xF3,0xDE, -0xDC,0xCF,0xEF,0x83,0x86,0xA2,0x8C,0x94,0x4F,0x9F,0x68,0xF2,0x98,0x90,0x46,0x84, -0x27,0xC7,0x76,0xBF,0xE3,0xCC,0x35,0x2C,0x8B,0x5E,0x07,0x64,0x65,0x82,0xC0,0x48, -0xB0,0xA8,0x91,0xF9,0x61,0x9F,0x76,0x20,0x50,0xA8,0x91,0xC7,0x66,0xB5,0xEB,0x78, -0x62,0x03,0x56,0xF0,0x8A,0x1A,0x13,0xEA,0x31,0xA3,0x1E,0xA0,0x99,0xFD,0x38,0xF6, -0xF6,0x27,0x32,0x58,0x6F,0x07,0xF5,0x6B,0xB8,0xFB,0x14,0x2B,0xAF,0xB7,0xAA,0xCC, -0xD6,0x63,0x5F,0x73,0x8C,0xDA,0x05,0x99,0xA8,0x38,0xA8,0xCB,0x17,0x78,0x36,0x51, -0xAC,0xE9,0x9E,0xF4,0x78,0x3A,0x8D,0xCF,0x0F,0xD9,0x42,0xE2,0x98,0x0C,0xAB,0x2F, -0x9F,0x0E,0x01,0xDE,0xEF,0x9F,0x99,0x49,0xF1,0x2D,0xDF,0xAC,0x74,0x4D,0x1B,0x98, -0xB5,0x47,0xC5,0xE5,0x29,0xD1,0xF9,0x90,0x18,0xC7,0x62,0x9C,0xBE,0x83,0xC7,0x26, -0x7B,0x3E,0x8A,0x25,0xC7,0xC0,0xDD,0x9D,0xE6,0x35,0x68,0x10,0x20,0x9D,0x8F,0xD8, -0xDE,0xD2,0xC3,0x84,0x9C,0x0D,0x5E,0xE8,0x2F,0xC9,0x02,0x03,0x01,0x00,0x01,0xA3, -0x81,0xC0,0x30,0x81,0xBD,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14, -0xA0,0x11,0x0A,0x23,0x3E,0x96,0xF1,0x07,0xEC,0xE2,0xAF,0x29,0xEF,0x82,0xA5,0x7F, -0xD0,0x30,0xA4,0xB4,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04, -0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05, -0x30,0x03,0x01,0x01,0xFF,0x30,0x7B,0x06,0x03,0x55,0x1D,0x1F,0x04,0x74,0x30,0x72, -0x30,0x38,0xA0,0x36,0xA0,0x34,0x86,0x32,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63, -0x72,0x6C,0x2E,0x63,0x6F,0x6D,0x6F,0x64,0x6F,0x63,0x61,0x2E,0x63,0x6F,0x6D,0x2F, -0x41,0x41,0x41,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x53,0x65, -0x72,0x76,0x69,0x63,0x65,0x73,0x2E,0x63,0x72,0x6C,0x30,0x36,0xA0,0x34,0xA0,0x32, -0x86,0x30,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x63,0x6F,0x6D, -0x6F,0x64,0x6F,0x2E,0x6E,0x65,0x74,0x2F,0x41,0x41,0x41,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x65,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x2E,0x63, -0x72,0x6C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05, -0x00,0x03,0x82,0x01,0x01,0x00,0x08,0x56,0xFC,0x02,0xF0,0x9B,0xE8,0xFF,0xA4,0xFA, -0xD6,0x7B,0xC6,0x44,0x80,0xCE,0x4F,0xC4,0xC5,0xF6,0x00,0x58,0xCC,0xA6,0xB6,0xBC, -0x14,0x49,0x68,0x04,0x76,0xE8,0xE6,0xEE,0x5D,0xEC,0x02,0x0F,0x60,0xD6,0x8D,0x50, -0x18,0x4F,0x26,0x4E,0x01,0xE3,0xE6,0xB0,0xA5,0xEE,0xBF,0xBC,0x74,0x54,0x41,0xBF, -0xFD,0xFC,0x12,0xB8,0xC7,0x4F,0x5A,0xF4,0x89,0x60,0x05,0x7F,0x60,0xB7,0x05,0x4A, -0xF3,0xF6,0xF1,0xC2,0xBF,0xC4,0xB9,0x74,0x86,0xB6,0x2D,0x7D,0x6B,0xCC,0xD2,0xF3, -0x46,0xDD,0x2F,0xC6,0xE0,0x6A,0xC3,0xC3,0x34,0x03,0x2C,0x7D,0x96,0xDD,0x5A,0xC2, -0x0E,0xA7,0x0A,0x99,0xC1,0x05,0x8B,0xAB,0x0C,0x2F,0xF3,0x5C,0x3A,0xCF,0x6C,0x37, -0x55,0x09,0x87,0xDE,0x53,0x40,0x6C,0x58,0xEF,0xFC,0xB6,0xAB,0x65,0x6E,0x04,0xF6, -0x1B,0xDC,0x3C,0xE0,0x5A,0x15,0xC6,0x9E,0xD9,0xF1,0x59,0x48,0x30,0x21,0x65,0x03, -0x6C,0xEC,0xE9,0x21,0x73,0xEC,0x9B,0x03,0xA1,0xE0,0x37,0xAD,0xA0,0x15,0x18,0x8F, -0xFA,0xBA,0x02,0xCE,0xA7,0x2C,0xA9,0x10,0x13,0x2C,0xD4,0xE5,0x08,0x26,0xAB,0x22, -0x97,0x60,0xF8,0x90,0x5E,0x74,0xD4,0xA2,0x9A,0x53,0xBD,0xF2,0xA9,0x68,0xE0,0xA2, -0x6E,0xC2,0xD7,0x6C,0xB1,0xA3,0x0F,0x9E,0xBF,0xEB,0x68,0xE7,0x56,0xF2,0xAE,0xF2, -0xE3,0x2B,0x38,0x3A,0x09,0x81,0xB5,0x6B,0x85,0xD7,0xBE,0x2D,0xED,0x3F,0x1A,0xB7, -0xB2,0x63,0xE2,0xF5,0x62,0x2C,0x82,0xD4,0x6A,0x00,0x41,0x50,0xF1,0x39,0x83,0x9F, -0x95,0xE9,0x36,0x96,0x98,0x6E, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA */ - - -const unsigned char DigiCert_High_Assurance_EV_Root_CA_certificate[969]={ -0x30,0x82,0x03,0xC5,0x30,0x82,0x02,0xAD,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x02, -0xAC,0x5C,0x26,0x6A,0x0B,0x40,0x9B,0x8F,0x0B,0x79,0xF2,0xAE,0x46,0x25,0x77,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x6C, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x03,0x13,0x22,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x48,0x69,0x67,0x68,0x20,0x41,0x73,0x73,0x75,0x72,0x61,0x6E,0x63, -0x65,0x20,0x45,0x56,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D, -0x30,0x36,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33, -0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x6C,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49, -0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77,0x77,0x77, -0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x2B,0x30, -0x29,0x06,0x03,0x55,0x04,0x03,0x13,0x22,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x48,0x69,0x67,0x68,0x20,0x41,0x73,0x73,0x75,0x72,0x61,0x6E,0x63,0x65,0x20, -0x45,0x56,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01, -0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xC6,0xCC,0xE5,0x73,0xE6, -0xFB,0xD4,0xBB,0xE5,0x2D,0x2D,0x32,0xA6,0xDF,0xE5,0x81,0x3F,0xC9,0xCD,0x25,0x49, -0xB6,0x71,0x2A,0xC3,0xD5,0x94,0x34,0x67,0xA2,0x0A,0x1C,0xB0,0x5F,0x69,0xA6,0x40, -0xB1,0xC4,0xB7,0xB2,0x8F,0xD0,0x98,0xA4,0xA9,0x41,0x59,0x3A,0xD3,0xDC,0x94,0xD6, -0x3C,0xDB,0x74,0x38,0xA4,0x4A,0xCC,0x4D,0x25,0x82,0xF7,0x4A,0xA5,0x53,0x12,0x38, -0xEE,0xF3,0x49,0x6D,0x71,0x91,0x7E,0x63,0xB6,0xAB,0xA6,0x5F,0xC3,0xA4,0x84,0xF8, -0x4F,0x62,0x51,0xBE,0xF8,0xC5,0xEC,0xDB,0x38,0x92,0xE3,0x06,0xE5,0x08,0x91,0x0C, -0xC4,0x28,0x41,0x55,0xFB,0xCB,0x5A,0x89,0x15,0x7E,0x71,0xE8,0x35,0xBF,0x4D,0x72, -0x09,0x3D,0xBE,0x3A,0x38,0x50,0x5B,0x77,0x31,0x1B,0x8D,0xB3,0xC7,0x24,0x45,0x9A, -0xA7,0xAC,0x6D,0x00,0x14,0x5A,0x04,0xB7,0xBA,0x13,0xEB,0x51,0x0A,0x98,0x41,0x41, -0x22,0x4E,0x65,0x61,0x87,0x81,0x41,0x50,0xA6,0x79,0x5C,0x89,0xDE,0x19,0x4A,0x57, -0xD5,0x2E,0xE6,0x5D,0x1C,0x53,0x2C,0x7E,0x98,0xCD,0x1A,0x06,0x16,0xA4,0x68,0x73, -0xD0,0x34,0x04,0x13,0x5C,0xA1,0x71,0xD3,0x5A,0x7C,0x55,0xDB,0x5E,0x64,0xE1,0x37, -0x87,0x30,0x56,0x04,0xE5,0x11,0xB4,0x29,0x80,0x12,0xF1,0x79,0x39,0x88,0xA2,0x02, -0x11,0x7C,0x27,0x66,0xB7,0x88,0xB7,0x78,0xF2,0xCA,0x0A,0xA8,0x38,0xAB,0x0A,0x64, -0xC2,0xBF,0x66,0x5D,0x95,0x84,0xC1,0xA1,0x25,0x1E,0x87,0x5D,0x1A,0x50,0x0B,0x20, -0x12,0xCC,0x41,0xBB,0x6E,0x0B,0x51,0x38,0xB8,0x4B,0xCB,0x02,0x03,0x01,0x00,0x01, -0xA3,0x63,0x30,0x61,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04, -0x03,0x02,0x01,0x86,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05, -0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14, -0xB1,0x3E,0xC3,0x69,0x03,0xF8,0xBF,0x47,0x01,0xD4,0x98,0x26,0x1A,0x08,0x02,0xEF, -0x63,0x64,0x2B,0xC3,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80, -0x14,0xB1,0x3E,0xC3,0x69,0x03,0xF8,0xBF,0x47,0x01,0xD4,0x98,0x26,0x1A,0x08,0x02, -0xEF,0x63,0x64,0x2B,0xC3,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x1C,0x1A,0x06,0x97,0xDC,0xD7,0x9C, -0x9F,0x3C,0x88,0x66,0x06,0x08,0x57,0x21,0xDB,0x21,0x47,0xF8,0x2A,0x67,0xAA,0xBF, -0x18,0x32,0x76,0x40,0x10,0x57,0xC1,0x8A,0xF3,0x7A,0xD9,0x11,0x65,0x8E,0x35,0xFA, -0x9E,0xFC,0x45,0xB5,0x9E,0xD9,0x4C,0x31,0x4B,0xB8,0x91,0xE8,0x43,0x2C,0x8E,0xB3, -0x78,0xCE,0xDB,0xE3,0x53,0x79,0x71,0xD6,0xE5,0x21,0x94,0x01,0xDA,0x55,0x87,0x9A, -0x24,0x64,0xF6,0x8A,0x66,0xCC,0xDE,0x9C,0x37,0xCD,0xA8,0x34,0xB1,0x69,0x9B,0x23, -0xC8,0x9E,0x78,0x22,0x2B,0x70,0x43,0xE3,0x55,0x47,0x31,0x61,0x19,0xEF,0x58,0xC5, -0x85,0x2F,0x4E,0x30,0xF6,0xA0,0x31,0x16,0x23,0xC8,0xE7,0xE2,0x65,0x16,0x33,0xCB, -0xBF,0x1A,0x1B,0xA0,0x3D,0xF8,0xCA,0x5E,0x8B,0x31,0x8B,0x60,0x08,0x89,0x2D,0x0C, -0x06,0x5C,0x52,0xB7,0xC4,0xF9,0x0A,0x98,0xD1,0x15,0x5F,0x9F,0x12,0xBE,0x7C,0x36, -0x63,0x38,0xBD,0x44,0xA4,0x7F,0xE4,0x26,0x2B,0x0A,0xC4,0x97,0x69,0x0D,0xE9,0x8C, -0xE2,0xC0,0x10,0x57,0xB8,0xC8,0x76,0x12,0x91,0x55,0xF2,0x48,0x69,0xD8,0xBC,0x2A, -0x02,0x5B,0x0F,0x44,0xD4,0x20,0x31,0xDB,0xF4,0xBA,0x70,0x26,0x5D,0x90,0x60,0x9E, -0xBC,0x4B,0x17,0x09,0x2F,0xB4,0xCB,0x1E,0x43,0x68,0xC9,0x07,0x27,0xC1,0xD2,0x5C, -0xF7,0xEA,0x21,0xB9,0x68,0x12,0x9C,0x3C,0x9C,0xBF,0x9E,0xFC,0x80,0x5C,0x9B,0x63, -0xCD,0xEC,0x47,0xAA,0x25,0x27,0x67,0xA0,0x37,0xF3,0x00,0x82,0x7D,0x54,0xD7,0xA9, -0xF8,0xE9,0x2E,0x13,0xA3,0x77,0xE8,0x1F,0x4A, -}; - - -/* subject:/C=US/O=GeoTrust Inc./CN=GeoTrust Universal CA */ -/* issuer :/C=US/O=GeoTrust Inc./CN=GeoTrust Universal CA */ - - -const unsigned char GeoTrust_Universal_CA_certificate[1388]={ -0x30,0x82,0x05,0x68,0x30,0x82,0x03,0x50,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16, -0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73, -0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x03,0x13, -0x15,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x55,0x6E,0x69,0x76,0x65,0x72, -0x73,0x61,0x6C,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x34,0x30,0x33,0x30,0x34, -0x30,0x35,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x39,0x30,0x33,0x30,0x34,0x30, -0x35,0x30,0x30,0x30,0x30,0x5A,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D, -0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1E,0x30, -0x1C,0x06,0x03,0x55,0x04,0x03,0x13,0x15,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74, -0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73,0x61,0x6C,0x20,0x43,0x41,0x30,0x82,0x02, -0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00, -0x03,0x82,0x02,0x0F,0x00,0x30,0x82,0x02,0x0A,0x02,0x82,0x02,0x01,0x00,0xA6,0x15, -0x55,0xA0,0xA3,0xC6,0xE0,0x1F,0x8C,0x9D,0x21,0x50,0xD7,0xC1,0xBE,0x2B,0x5B,0xB5, -0xA4,0x9E,0xA1,0xD9,0x72,0x58,0xBD,0x00,0x1B,0x4C,0xBF,0x61,0xC9,0x14,0x1D,0x45, -0x82,0xAB,0xC6,0x1D,0x80,0xD6,0x3D,0xEB,0x10,0x9C,0x3A,0xAF,0x6D,0x24,0xF8,0xBC, -0x71,0x01,0x9E,0x06,0xF5,0x7C,0x5F,0x1E,0xC1,0x0E,0x55,0xCA,0x83,0x9A,0x59,0x30, -0xAE,0x19,0xCB,0x30,0x48,0x95,0xED,0x22,0x37,0x8D,0xF4,0x4A,0x9A,0x72,0x66,0x3E, -0xAD,0x95,0xC0,0xE0,0x16,0x00,0xE0,0x10,0x1F,0x2B,0x31,0x0E,0xD7,0x94,0x54,0xD3, -0x42,0x33,0xA0,0x34,0x1D,0x1E,0x45,0x76,0xDD,0x4F,0xCA,0x18,0x37,0xEC,0x85,0x15, -0x7A,0x19,0x08,0xFC,0xD5,0xC7,0x9C,0xF0,0xF2,0xA9,0x2E,0x10,0xA9,0x92,0xE6,0x3D, -0x58,0x3D,0xA9,0x16,0x68,0x3C,0x2F,0x75,0x21,0x18,0x7F,0x28,0x77,0xA5,0xE1,0x61, -0x17,0xB7,0xA6,0xE9,0xF8,0x1E,0x99,0xDB,0x73,0x6E,0xF4,0x0A,0xA2,0x21,0x6C,0xEE, -0xDA,0xAA,0x85,0x92,0x66,0xAF,0xF6,0x7A,0x6B,0x82,0xDA,0xBA,0x22,0x08,0x35,0x0F, -0xCF,0x42,0xF1,0x35,0xFA,0x6A,0xEE,0x7E,0x2B,0x25,0xCC,0x3A,0x11,0xE4,0x6D,0xAF, -0x73,0xB2,0x76,0x1D,0xAD,0xD0,0xB2,0x78,0x67,0x1A,0xA4,0x39,0x1C,0x51,0x0B,0x67, -0x56,0x83,0xFD,0x38,0x5D,0x0D,0xCE,0xDD,0xF0,0xBB,0x2B,0x96,0x1F,0xDE,0x7B,0x32, -0x52,0xFD,0x1D,0xBB,0xB5,0x06,0xA1,0xB2,0x21,0x5E,0xA5,0xD6,0x95,0x68,0x7F,0xF0, -0x99,0x9E,0xDC,0x45,0x08,0x3E,0xE7,0xD2,0x09,0x0D,0x35,0x94,0xDD,0x80,0x4E,0x53, -0x97,0xD7,0xB5,0x09,0x44,0x20,0x64,0x16,0x17,0x03,0x02,0x4C,0x53,0x0D,0x68,0xDE, -0xD5,0xAA,0x72,0x4D,0x93,0x6D,0x82,0x0E,0xDB,0x9C,0xBD,0xCF,0xB4,0xF3,0x5C,0x5D, -0x54,0x7A,0x69,0x09,0x96,0xD6,0xDB,0x11,0xC1,0x8D,0x75,0xA8,0xB4,0xCF,0x39,0xC8, -0xCE,0x3C,0xBC,0x24,0x7C,0xE6,0x62,0xCA,0xE1,0xBD,0x7D,0xA7,0xBD,0x57,0x65,0x0B, -0xE4,0xFE,0x25,0xED,0xB6,0x69,0x10,0xDC,0x28,0x1A,0x46,0xBD,0x01,0x1D,0xD0,0x97, -0xB5,0xE1,0x98,0x3B,0xC0,0x37,0x64,0xD6,0x3D,0x94,0xEE,0x0B,0xE1,0xF5,0x28,0xAE, -0x0B,0x56,0xBF,0x71,0x8B,0x23,0x29,0x41,0x8E,0x86,0xC5,0x4B,0x52,0x7B,0xD8,0x71, -0xAB,0x1F,0x8A,0x15,0xA6,0x3B,0x83,0x5A,0xD7,0x58,0x01,0x51,0xC6,0x4C,0x41,0xD9, -0x7F,0xD8,0x41,0x67,0x72,0xA2,0x28,0xDF,0x60,0x83,0xA9,0x9E,0xC8,0x7B,0xFC,0x53, -0x73,0x72,0x59,0xF5,0x93,0x7A,0x17,0x76,0x0E,0xCE,0xF7,0xE5,0x5C,0xD9,0x0B,0x55, -0x34,0xA2,0xAA,0x5B,0xB5,0x6A,0x54,0xE7,0x13,0xCA,0x57,0xEC,0x97,0x6D,0xF4,0x5E, -0x06,0x2F,0x45,0x8B,0x58,0xD4,0x23,0x16,0x92,0xE4,0x16,0x6E,0x28,0x63,0x59,0x30, -0xDF,0x50,0x01,0x9C,0x63,0x89,0x1A,0x9F,0xDB,0x17,0x94,0x82,0x70,0x37,0xC3,0x24, -0x9E,0x9A,0x47,0xD6,0x5A,0xCA,0x4E,0xA8,0x69,0x89,0x72,0x1F,0x91,0x6C,0xDB,0x7E, -0x9E,0x1B,0xAD,0xC7,0x1F,0x73,0xDD,0x2C,0x4F,0x19,0x65,0xFD,0x7F,0x93,0x40,0x10, -0x2E,0xD2,0xF0,0xED,0x3C,0x9E,0x2E,0x28,0x3E,0x69,0x26,0x33,0xC5,0x7B,0x02,0x03, -0x01,0x00,0x01,0xA3,0x63,0x30,0x61,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01, -0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04, -0x16,0x04,0x14,0xDA,0xBB,0x2E,0xAA,0xB0,0x0C,0xB8,0x88,0x26,0x51,0x74,0x5C,0x6D, -0x03,0xD3,0xC0,0xD8,0x8F,0x7A,0xD6,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18, -0x30,0x16,0x80,0x14,0xDA,0xBB,0x2E,0xAA,0xB0,0x0C,0xB8,0x88,0x26,0x51,0x74,0x5C, -0x6D,0x03,0xD3,0xC0,0xD8,0x8F,0x7A,0xD6,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01, -0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x02,0x01,0x00,0x31,0x78,0xE6,0xC7, -0xB5,0xDF,0xB8,0x94,0x40,0xC9,0x71,0xC4,0xA8,0x35,0xEC,0x46,0x1D,0xC2,0x85,0xF3, -0x28,0x58,0x86,0xB0,0x0B,0xFC,0x8E,0xB2,0x39,0x8F,0x44,0x55,0xAB,0x64,0x84,0x5C, -0x69,0xA9,0xD0,0x9A,0x38,0x3C,0xFA,0xE5,0x1F,0x35,0xE5,0x44,0xE3,0x80,0x79,0x94, -0x68,0xA4,0xBB,0xC4,0x9F,0x3D,0xE1,0x34,0xCD,0x30,0x46,0x8B,0x54,0x2B,0x95,0xA5, -0xEF,0xF7,0x3F,0x99,0x84,0xFD,0x35,0xE6,0xCF,0x31,0xC6,0xDC,0x6A,0xBF,0xA7,0xD7, -0x23,0x08,0xE1,0x98,0x5E,0xC3,0x5A,0x08,0x76,0xA9,0xA6,0xAF,0x77,0x2F,0xB7,0x60, -0xBD,0x44,0x46,0x6A,0xEF,0x97,0xFF,0x73,0x95,0xC1,0x8E,0xE8,0x93,0xFB,0xFD,0x31, -0xB7,0xEC,0x57,0x11,0x11,0x45,0x9B,0x30,0xF1,0x1A,0x88,0x39,0xC1,0x4F,0x3C,0xA7, -0x00,0xD5,0xC7,0xFC,0xAB,0x6D,0x80,0x22,0x70,0xA5,0x0C,0xE0,0x5D,0x04,0x29,0x02, -0xFB,0xCB,0xA0,0x91,0xD1,0x7C,0xD6,0xC3,0x7E,0x50,0xD5,0x9D,0x58,0xBE,0x41,0x38, -0xEB,0xB9,0x75,0x3C,0x15,0xD9,0x9B,0xC9,0x4A,0x83,0x59,0xC0,0xDA,0x53,0xFD,0x33, -0xBB,0x36,0x18,0x9B,0x85,0x0F,0x15,0xDD,0xEE,0x2D,0xAC,0x76,0x93,0xB9,0xD9,0x01, -0x8D,0x48,0x10,0xA8,0xFB,0xF5,0x38,0x86,0xF1,0xDB,0x0A,0xC6,0xBD,0x84,0xA3,0x23, -0x41,0xDE,0xD6,0x77,0x6F,0x85,0xD4,0x85,0x1C,0x50,0xE0,0xAE,0x51,0x8A,0xBA,0x8D, -0x3E,0x76,0xE2,0xB9,0xCA,0x27,0xF2,0x5F,0x9F,0xEF,0x6E,0x59,0x0D,0x06,0xD8,0x2B, -0x17,0xA4,0xD2,0x7C,0x6B,0xBB,0x5F,0x14,0x1A,0x48,0x8F,0x1A,0x4C,0xE7,0xB3,0x47, -0x1C,0x8E,0x4C,0x45,0x2B,0x20,0xEE,0x48,0xDF,0xE7,0xDD,0x09,0x8E,0x18,0xA8,0xDA, -0x40,0x8D,0x92,0x26,0x11,0x53,0x61,0x73,0x5D,0xEB,0xBD,0xE7,0xC4,0x4D,0x29,0x37, -0x61,0xEB,0xAC,0x39,0x2D,0x67,0x2E,0x16,0xD6,0xF5,0x00,0x83,0x85,0xA1,0xCC,0x7F, -0x76,0xC4,0x7D,0xE4,0xB7,0x4B,0x66,0xEF,0x03,0x45,0x60,0x69,0xB6,0x0C,0x52,0x96, -0x92,0x84,0x5E,0xA6,0xA3,0xB5,0xA4,0x3E,0x2B,0xD9,0xCC,0xD8,0x1B,0x47,0xAA,0xF2, -0x44,0xDA,0x4F,0xF9,0x03,0xE8,0xF0,0x14,0xCB,0x3F,0xF3,0x83,0xDE,0xD0,0xC1,0x54, -0xE3,0xB7,0xE8,0x0A,0x37,0x4D,0x8B,0x20,0x59,0x03,0x30,0x19,0xA1,0x2C,0xC8,0xBD, -0x11,0x1F,0xDF,0xAE,0xC9,0x4A,0xC5,0xF3,0x27,0x66,0x66,0x86,0xAC,0x68,0x91,0xFF, -0xD9,0xE6,0x53,0x1C,0x0F,0x8B,0x5C,0x69,0x65,0x0A,0x26,0xC8,0x1E,0x34,0xC3,0x5D, -0x51,0x7B,0xD7,0xA9,0x9C,0x06,0xA1,0x36,0xDD,0xD5,0x89,0x94,0xBC,0xD9,0xE4,0x2D, -0x0C,0x5E,0x09,0x6C,0x08,0x97,0x7C,0xA3,0x3D,0x7C,0x93,0xFF,0x3F,0xA1,0x14,0xA7, -0xCF,0xB5,0x5D,0xEB,0xDB,0xDB,0x1C,0xC4,0x76,0xDF,0x88,0xB9,0xBD,0x45,0x05,0x95, -0x1B,0xAE,0xFC,0x46,0x6A,0x4C,0xAF,0x48,0xE3,0xCE,0xAE,0x0F,0xD2,0x7E,0xEB,0xE6, -0x6C,0x9C,0x4F,0x81,0x6A,0x7A,0x64,0xAC,0xBB,0x3E,0xD5,0xE7,0xCB,0x76,0x2E,0xC5, -0xA7,0x48,0xC1,0x5C,0x90,0x0F,0xCB,0xC8,0x3F,0xFA,0xE6,0x32,0xE1,0x8D,0x1B,0x6F, -0xA4,0xE6,0x8E,0xD8,0xF9,0x29,0x48,0x8A,0xCE,0x73,0xFE,0x2C, -}; - - -/* subject:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO ECC Certification Authority */ -/* issuer :/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO ECC Certification Authority */ - - -const unsigned char COMODO_ECC_Certification_Authority_certificate[653]={ -0x30,0x82,0x02,0x89,0x30,0x82,0x02,0x0F,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x1F, -0x47,0xAF,0xAA,0x62,0x00,0x70,0x50,0x54,0x4C,0x01,0x9E,0x9B,0x63,0x99,0x2A,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x81,0x85,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B,0x30,0x19,0x06, -0x03,0x55,0x04,0x08,0x13,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72,0x20,0x4D,0x61, -0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04, -0x07,0x13,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30,0x18,0x06,0x03, -0x55,0x04,0x0A,0x13,0x11,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x43,0x41,0x20,0x4C, -0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x03,0x13, -0x22,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x45,0x43,0x43,0x20,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72, -0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x38,0x30,0x33,0x30,0x36,0x30,0x30,0x30, -0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x38,0x32,0x33,0x35,0x39, -0x35,0x39,0x5A,0x30,0x81,0x85,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13, -0x02,0x47,0x42,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x13,0x12,0x47,0x72, -0x65,0x61,0x74,0x65,0x72,0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72, -0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x53,0x61,0x6C,0x66,0x6F, -0x72,0x64,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x43,0x4F,0x4D, -0x4F,0x44,0x4F,0x20,0x43,0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x2B, -0x30,0x29,0x06,0x03,0x55,0x04,0x03,0x13,0x22,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20, -0x45,0x43,0x43,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F, -0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x76,0x30,0x10,0x06, -0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05,0x2B,0x81,0x04,0x00,0x22,0x03, -0x62,0x00,0x04,0x03,0x47,0x7B,0x2F,0x75,0xC9,0x82,0x15,0x85,0xFB,0x75,0xE4,0x91, -0x16,0xD4,0xAB,0x62,0x99,0xF5,0x3E,0x52,0x0B,0x06,0xCE,0x41,0x00,0x7F,0x97,0xE1, -0x0A,0x24,0x3C,0x1D,0x01,0x04,0xEE,0x3D,0xD2,0x8D,0x09,0x97,0x0C,0xE0,0x75,0xE4, -0xFA,0xFB,0x77,0x8A,0x2A,0xF5,0x03,0x60,0x4B,0x36,0x8B,0x16,0x23,0x16,0xAD,0x09, -0x71,0xF4,0x4A,0xF4,0x28,0x50,0xB4,0xFE,0x88,0x1C,0x6E,0x3F,0x6C,0x2F,0x2F,0x09, -0x59,0x5B,0xA5,0x5B,0x0B,0x33,0x99,0xE2,0xC3,0x3D,0x89,0xF9,0x6A,0x2C,0xEF,0xB2, -0xD3,0x06,0xE9,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16, -0x04,0x14,0x75,0x71,0xA7,0x19,0x48,0x19,0xBC,0x9D,0x9D,0xEA,0x41,0x47,0xDF,0x94, -0xC4,0x48,0x77,0x99,0xD3,0x79,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF, -0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D, -0x04,0x03,0x03,0x03,0x68,0x00,0x30,0x65,0x02,0x31,0x00,0xEF,0x03,0x5B,0x7A,0xAC, -0xB7,0x78,0x0A,0x72,0xB7,0x88,0xDF,0xFF,0xB5,0x46,0x14,0x09,0x0A,0xFA,0xA0,0xE6, -0x7D,0x08,0xC6,0x1A,0x87,0xBD,0x18,0xA8,0x73,0xBD,0x26,0xCA,0x60,0x0C,0x9D,0xCE, -0x99,0x9F,0xCF,0x5C,0x0F,0x30,0xE1,0xBE,0x14,0x31,0xEA,0x02,0x30,0x14,0xF4,0x93, -0x3C,0x49,0xA7,0x33,0x7A,0x90,0x46,0x47,0xB3,0x63,0x7D,0x13,0x9B,0x4E,0xB7,0x6F, -0x18,0x37,0x80,0x53,0xFE,0xDD,0x20,0xE0,0x35,0x9A,0x36,0xD1,0xC7,0x01,0xB9,0xE6, -0xDC,0xDD,0xF3,0xFF,0x1D,0x2C,0x3A,0x16,0x57,0xD9,0x92,0x39,0xD6, -}; - - -/* subject:/C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2009 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - G2 */ -/* issuer :/C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2009 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - G2 */ - - -const unsigned char Entrust_Root_Certification_Authority___G2_certificate[1090]={ -0x30,0x82,0x04,0x3E,0x30,0x82,0x03,0x26,0xA0,0x03,0x02,0x01,0x02,0x02,0x04,0x4A, -0x53,0x8C,0x28,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B, -0x05,0x00,0x30,0x81,0xBE,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02, -0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x45,0x6E,0x74, -0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x03, -0x55,0x04,0x0B,0x13,0x1F,0x53,0x65,0x65,0x20,0x77,0x77,0x77,0x2E,0x65,0x6E,0x74, -0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x2F,0x6C,0x65,0x67,0x61,0x6C,0x2D,0x74, -0x65,0x72,0x6D,0x73,0x31,0x39,0x30,0x37,0x06,0x03,0x55,0x04,0x0B,0x13,0x30,0x28, -0x63,0x29,0x20,0x32,0x30,0x30,0x39,0x20,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2C, -0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x66,0x6F,0x72,0x20,0x61,0x75,0x74,0x68, -0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31, -0x32,0x30,0x30,0x06,0x03,0x55,0x04,0x03,0x13,0x29,0x45,0x6E,0x74,0x72,0x75,0x73, -0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, -0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D, -0x20,0x47,0x32,0x30,0x1E,0x17,0x0D,0x30,0x39,0x30,0x37,0x30,0x37,0x31,0x37,0x32, -0x35,0x35,0x34,0x5A,0x17,0x0D,0x33,0x30,0x31,0x32,0x30,0x37,0x31,0x37,0x35,0x35, -0x35,0x34,0x5A,0x30,0x81,0xBE,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13, -0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x45,0x6E, -0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06, -0x03,0x55,0x04,0x0B,0x13,0x1F,0x53,0x65,0x65,0x20,0x77,0x77,0x77,0x2E,0x65,0x6E, -0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x2F,0x6C,0x65,0x67,0x61,0x6C,0x2D, -0x74,0x65,0x72,0x6D,0x73,0x31,0x39,0x30,0x37,0x06,0x03,0x55,0x04,0x0B,0x13,0x30, -0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x39,0x20,0x45,0x6E,0x74,0x72,0x75,0x73,0x74, -0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x66,0x6F,0x72,0x20,0x61,0x75,0x74, -0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79, -0x31,0x32,0x30,0x30,0x06,0x03,0x55,0x04,0x03,0x13,0x29,0x45,0x6E,0x74,0x72,0x75, -0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20, -0x2D,0x20,0x47,0x32,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A, -0x02,0x82,0x01,0x01,0x00,0xBA,0x84,0xB6,0x72,0xDB,0x9E,0x0C,0x6B,0xE2,0x99,0xE9, -0x30,0x01,0xA7,0x76,0xEA,0x32,0xB8,0x95,0x41,0x1A,0xC9,0xDA,0x61,0x4E,0x58,0x72, -0xCF,0xFE,0xF6,0x82,0x79,0xBF,0x73,0x61,0x06,0x0A,0xA5,0x27,0xD8,0xB3,0x5F,0xD3, -0x45,0x4E,0x1C,0x72,0xD6,0x4E,0x32,0xF2,0x72,0x8A,0x0F,0xF7,0x83,0x19,0xD0,0x6A, -0x80,0x80,0x00,0x45,0x1E,0xB0,0xC7,0xE7,0x9A,0xBF,0x12,0x57,0x27,0x1C,0xA3,0x68, -0x2F,0x0A,0x87,0xBD,0x6A,0x6B,0x0E,0x5E,0x65,0xF3,0x1C,0x77,0xD5,0xD4,0x85,0x8D, -0x70,0x21,0xB4,0xB3,0x32,0xE7,0x8B,0xA2,0xD5,0x86,0x39,0x02,0xB1,0xB8,0xD2,0x47, -0xCE,0xE4,0xC9,0x49,0xC4,0x3B,0xA7,0xDE,0xFB,0x54,0x7D,0x57,0xBE,0xF0,0xE8,0x6E, -0xC2,0x79,0xB2,0x3A,0x0B,0x55,0xE2,0x50,0x98,0x16,0x32,0x13,0x5C,0x2F,0x78,0x56, -0xC1,0xC2,0x94,0xB3,0xF2,0x5A,0xE4,0x27,0x9A,0x9F,0x24,0xD7,0xC6,0xEC,0xD0,0x9B, -0x25,0x82,0xE3,0xCC,0xC2,0xC4,0x45,0xC5,0x8C,0x97,0x7A,0x06,0x6B,0x2A,0x11,0x9F, -0xA9,0x0A,0x6E,0x48,0x3B,0x6F,0xDB,0xD4,0x11,0x19,0x42,0xF7,0x8F,0x07,0xBF,0xF5, -0x53,0x5F,0x9C,0x3E,0xF4,0x17,0x2C,0xE6,0x69,0xAC,0x4E,0x32,0x4C,0x62,0x77,0xEA, -0xB7,0xE8,0xE5,0xBB,0x34,0xBC,0x19,0x8B,0xAE,0x9C,0x51,0xE7,0xB7,0x7E,0xB5,0x53, -0xB1,0x33,0x22,0xE5,0x6D,0xCF,0x70,0x3C,0x1A,0xFA,0xE2,0x9B,0x67,0xB6,0x83,0xF4, -0x8D,0xA5,0xAF,0x62,0x4C,0x4D,0xE0,0x58,0xAC,0x64,0x34,0x12,0x03,0xF8,0xB6,0x8D, -0x94,0x63,0x24,0xA4,0x71,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0E, -0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F, -0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30, -0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x6A,0x72,0x26,0x7A,0xD0,0x1E, -0xEF,0x7D,0xE7,0x3B,0x69,0x51,0xD4,0x6C,0x8D,0x9F,0x90,0x12,0x66,0xAB,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01, -0x01,0x00,0x79,0x9F,0x1D,0x96,0xC6,0xB6,0x79,0x3F,0x22,0x8D,0x87,0xD3,0x87,0x03, -0x04,0x60,0x6A,0x6B,0x9A,0x2E,0x59,0x89,0x73,0x11,0xAC,0x43,0xD1,0xF5,0x13,0xFF, -0x8D,0x39,0x2B,0xC0,0xF2,0xBD,0x4F,0x70,0x8C,0xA9,0x2F,0xEA,0x17,0xC4,0x0B,0x54, -0x9E,0xD4,0x1B,0x96,0x98,0x33,0x3C,0xA8,0xAD,0x62,0xA2,0x00,0x76,0xAB,0x59,0x69, -0x6E,0x06,0x1D,0x7E,0xC4,0xB9,0x44,0x8D,0x98,0xAF,0x12,0xD4,0x61,0xDB,0x0A,0x19, -0x46,0x47,0xF3,0xEB,0xF7,0x63,0xC1,0x40,0x05,0x40,0xA5,0xD2,0xB7,0xF4,0xB5,0x9A, -0x36,0xBF,0xA9,0x88,0x76,0x88,0x04,0x55,0x04,0x2B,0x9C,0x87,0x7F,0x1A,0x37,0x3C, -0x7E,0x2D,0xA5,0x1A,0xD8,0xD4,0x89,0x5E,0xCA,0xBD,0xAC,0x3D,0x6C,0xD8,0x6D,0xAF, -0xD5,0xF3,0x76,0x0F,0xCD,0x3B,0x88,0x38,0x22,0x9D,0x6C,0x93,0x9A,0xC4,0x3D,0xBF, -0x82,0x1B,0x65,0x3F,0xA6,0x0F,0x5D,0xAA,0xFC,0xE5,0xB2,0x15,0xCA,0xB5,0xAD,0xC6, -0xBC,0x3D,0xD0,0x84,0xE8,0xEA,0x06,0x72,0xB0,0x4D,0x39,0x32,0x78,0xBF,0x3E,0x11, -0x9C,0x0B,0xA4,0x9D,0x9A,0x21,0xF3,0xF0,0x9B,0x0B,0x30,0x78,0xDB,0xC1,0xDC,0x87, -0x43,0xFE,0xBC,0x63,0x9A,0xCA,0xC5,0xC2,0x1C,0xC9,0xC7,0x8D,0xFF,0x3B,0x12,0x58, -0x08,0xE6,0xB6,0x3D,0xEC,0x7A,0x2C,0x4E,0xFB,0x83,0x96,0xCE,0x0C,0x3C,0x69,0x87, -0x54,0x73,0xA4,0x73,0xC2,0x93,0xFF,0x51,0x10,0xAC,0x15,0x54,0x01,0xD8,0xFC,0x05, -0xB1,0x89,0xA1,0x7F,0x74,0x83,0x9A,0x49,0xD7,0xDC,0x4E,0x7B,0x8A,0x48,0x6F,0x8B, -0x45,0xF6, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root G2 */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root G2 */ - - -const unsigned char DigiCert_Assured_ID_Root_G2_certificate[922]={ -0x30,0x82,0x03,0x96,0x30,0x82,0x02,0x7E,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x0B, -0x93,0x1C,0x3A,0xD6,0x39,0x67,0xEA,0x67,0x23,0xBF,0xC3,0xAF,0x9A,0xF4,0x4B,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x65, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x20,0x49,0x44,0x20,0x52,0x6F, -0x6F,0x74,0x20,0x47,0x32,0x30,0x1E,0x17,0x0D,0x31,0x33,0x30,0x38,0x30,0x31,0x31, -0x32,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x35,0x31,0x32, -0x30,0x30,0x30,0x30,0x5A,0x30,0x65,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06, -0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44, -0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06, -0x03,0x55,0x04,0x0B,0x13,0x10,0x77,0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65, -0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13, -0x1B,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x41,0x73,0x73,0x75,0x72,0x65, -0x64,0x20,0x49,0x44,0x20,0x52,0x6F,0x6F,0x74,0x20,0x47,0x32,0x30,0x82,0x01,0x22, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03, -0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD9,0xE7,0x28, -0x2F,0x52,0x3F,0x36,0x72,0x49,0x88,0x93,0x34,0xF3,0xF8,0x6A,0x1E,0x31,0x54,0x80, -0x9F,0xAD,0x54,0x41,0xB5,0x47,0xDF,0x96,0xA8,0xD4,0xAF,0x80,0x2D,0xB9,0x0A,0xCF, -0x75,0xFD,0x89,0xA5,0x7D,0x24,0xFA,0xE3,0x22,0x0C,0x2B,0xBC,0x95,0x17,0x0B,0x33, -0xBF,0x19,0x4D,0x41,0x06,0x90,0x00,0xBD,0x0C,0x4D,0x10,0xFE,0x07,0xB5,0xE7,0x1C, -0x6E,0x22,0x55,0x31,0x65,0x97,0xBD,0xD3,0x17,0xD2,0x1E,0x62,0xF3,0xDB,0xEA,0x6C, -0x50,0x8C,0x3F,0x84,0x0C,0x96,0xCF,0xB7,0xCB,0x03,0xE0,0xCA,0x6D,0xA1,0x14,0x4C, -0x1B,0x89,0xDD,0xED,0x00,0xB0,0x52,0x7C,0xAF,0x91,0x6C,0xB1,0x38,0x13,0xD1,0xE9, -0x12,0x08,0xC0,0x00,0xB0,0x1C,0x2B,0x11,0xDA,0x77,0x70,0x36,0x9B,0xAE,0xCE,0x79, -0x87,0xDC,0x82,0x70,0xE6,0x09,0x74,0x70,0x55,0x69,0xAF,0xA3,0x68,0x9F,0xBF,0xDD, -0xB6,0x79,0xB3,0xF2,0x9D,0x70,0x29,0x55,0xF4,0xAB,0xFF,0x95,0x61,0xF3,0xC9,0x40, -0x6F,0x1D,0xD1,0xBE,0x93,0xBB,0xD3,0x88,0x2A,0xBB,0x9D,0xBF,0x72,0x5A,0x56,0x71, -0x3B,0x3F,0xD4,0xF3,0xD1,0x0A,0xFE,0x28,0xEF,0xA3,0xEE,0xD9,0x99,0xAF,0x03,0xD3, -0x8F,0x60,0xB7,0xF2,0x92,0xA1,0xB1,0xBD,0x89,0x89,0x1F,0x30,0xCD,0xC3,0xA6,0x2E, -0x62,0x33,0xAE,0x16,0x02,0x77,0x44,0x5A,0xE7,0x81,0x0A,0x3C,0xA7,0x44,0x2E,0x79, -0xB8,0x3F,0x04,0xBC,0x5C,0xA0,0x87,0xE1,0x1B,0xAF,0x51,0x8E,0xCD,0xEC,0x2C,0xFA, -0xF8,0xFE,0x6D,0xF0,0x3A,0x7C,0xAA,0x8B,0xE4,0x67,0x95,0x31,0x8D,0x02,0x03,0x01, -0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF, -0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01, -0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16, -0x04,0x14,0xCE,0xC3,0x4A,0xB9,0x99,0x55,0xF2,0xB8,0xDB,0x60,0xBF,0xA9,0x7E,0xBD, -0x56,0xB5,0x97,0x36,0xA7,0xD6,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0xCA,0xA5,0x55,0x8C,0xE3,0xC8, -0x41,0x6E,0x69,0x27,0xA7,0x75,0x11,0xEF,0x3C,0x86,0x36,0x6F,0xD2,0x9D,0xC6,0x78, -0x38,0x1D,0x69,0x96,0xA2,0x92,0x69,0x2E,0x38,0x6C,0x9B,0x7D,0x04,0xD4,0x89,0xA5, -0xB1,0x31,0x37,0x8A,0xC9,0x21,0xCC,0xAB,0x6C,0xCD,0x8B,0x1C,0x9A,0xD6,0xBF,0x48, -0xD2,0x32,0x66,0xC1,0x8A,0xC0,0xF3,0x2F,0x3A,0xEF,0xC0,0xE3,0xD4,0x91,0x86,0xD1, -0x50,0xE3,0x03,0xDB,0x73,0x77,0x6F,0x4A,0x39,0x53,0xED,0xDE,0x26,0xC7,0xB5,0x7D, -0xAF,0x2B,0x42,0xD1,0x75,0x62,0xE3,0x4A,0x2B,0x02,0xC7,0x50,0x4B,0xE0,0x69,0xE2, -0x96,0x6C,0x0E,0x44,0x66,0x10,0x44,0x8F,0xAD,0x05,0xEB,0xF8,0x79,0xAC,0xA6,0x1B, -0xE8,0x37,0x34,0x9D,0x53,0xC9,0x61,0xAA,0xA2,0x52,0xAF,0x4A,0x70,0x16,0x86,0xC2, -0x3A,0xC8,0xB1,0x13,0x70,0x36,0xD8,0xCF,0xEE,0xF4,0x0A,0x34,0xD5,0x5B,0x4C,0xFD, -0x07,0x9C,0xA2,0xBA,0xD9,0x01,0x72,0x5C,0xF3,0x4D,0xC1,0xDD,0x0E,0xB1,0x1C,0x0D, -0xC4,0x63,0xBE,0xAD,0xF4,0x14,0xFB,0x89,0xEC,0xA2,0x41,0x0E,0x4C,0xCC,0xC8,0x57, -0x40,0xD0,0x6E,0x03,0xAA,0xCD,0x0C,0x8E,0x89,0x99,0x99,0x6C,0xF0,0x3C,0x30,0xAF, -0x38,0xDF,0x6F,0xBC,0xA3,0xBE,0x29,0x20,0x27,0xAB,0x74,0xFF,0x13,0x22,0x78,0xDE, -0x97,0x52,0x55,0x1E,0x83,0xB5,0x54,0x20,0x03,0xEE,0xAE,0xC0,0x4F,0x56,0xDE,0x37, -0xCC,0xC3,0x7F,0xAA,0x04,0x27,0xBB,0xD3,0x77,0xB8,0x62,0xDB,0x17,0x7C,0x9C,0x28, -0x22,0x13,0x73,0x6C,0xCF,0x26,0xF5,0x8A,0x29,0xE7, -}; - - -/* subject:/C=US/O=AffirmTrust/CN=AffirmTrust Commercial */ -/* issuer :/C=US/O=AffirmTrust/CN=AffirmTrust Commercial */ - - -const unsigned char AffirmTrust_Commercial_certificate[848]={ -0x30,0x82,0x03,0x4C,0x30,0x82,0x02,0x34,0xA0,0x03,0x02,0x01,0x02,0x02,0x08,0x77, -0x77,0x06,0x27,0x26,0xA9,0xB1,0x7C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x44,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x0C,0x0B, -0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x31,0x1F,0x30,0x1D,0x06, -0x03,0x55,0x04,0x03,0x0C,0x16,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73, -0x74,0x20,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x69,0x61,0x6C,0x30,0x1E,0x17,0x0D, -0x31,0x30,0x30,0x31,0x32,0x39,0x31,0x34,0x30,0x36,0x30,0x36,0x5A,0x17,0x0D,0x33, -0x30,0x31,0x32,0x33,0x31,0x31,0x34,0x30,0x36,0x30,0x36,0x5A,0x30,0x44,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06, -0x03,0x55,0x04,0x0A,0x0C,0x0B,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73, -0x74,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x0C,0x16,0x41,0x66,0x66,0x69, -0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x20,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x69, -0x61,0x6C,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82, -0x01,0x01,0x00,0xF6,0x1B,0x4F,0x67,0x07,0x2B,0xA1,0x15,0xF5,0x06,0x22,0xCB,0x1F, -0x01,0xB2,0xE3,0x73,0x45,0x06,0x44,0x49,0x2C,0xBB,0x49,0x25,0x14,0xD6,0xCE,0xC3, -0xB7,0xAB,0x2C,0x4F,0xC6,0x41,0x32,0x94,0x57,0xFA,0x12,0xA7,0x5B,0x0E,0xE2,0x8F, -0x1F,0x1E,0x86,0x19,0xA7,0xAA,0xB5,0x2D,0xB9,0x5F,0x0D,0x8A,0xC2,0xAF,0x85,0x35, -0x79,0x32,0x2D,0xBB,0x1C,0x62,0x37,0xF2,0xB1,0x5B,0x4A,0x3D,0xCA,0xCD,0x71,0x5F, -0xE9,0x42,0xBE,0x94,0xE8,0xC8,0xDE,0xF9,0x22,0x48,0x64,0xC6,0xE5,0xAB,0xC6,0x2B, -0x6D,0xAD,0x05,0xF0,0xFA,0xD5,0x0B,0xCF,0x9A,0xE5,0xF0,0x50,0xA4,0x8B,0x3B,0x47, -0xA5,0x23,0x5B,0x7A,0x7A,0xF8,0x33,0x3F,0xB8,0xEF,0x99,0x97,0xE3,0x20,0xC1,0xD6, -0x28,0x89,0xCF,0x94,0xFB,0xB9,0x45,0xED,0xE3,0x40,0x17,0x11,0xD4,0x74,0xF0,0x0B, -0x31,0xE2,0x2B,0x26,0x6A,0x9B,0x4C,0x57,0xAE,0xAC,0x20,0x3E,0xBA,0x45,0x7A,0x05, -0xF3,0xBD,0x9B,0x69,0x15,0xAE,0x7D,0x4E,0x20,0x63,0xC4,0x35,0x76,0x3A,0x07,0x02, -0xC9,0x37,0xFD,0xC7,0x47,0xEE,0xE8,0xF1,0x76,0x1D,0x73,0x15,0xF2,0x97,0xA4,0xB5, -0xC8,0x7A,0x79,0xD9,0x42,0xAA,0x2B,0x7F,0x5C,0xFE,0xCE,0x26,0x4F,0xA3,0x66,0x81, -0x35,0xAF,0x44,0xBA,0x54,0x1E,0x1C,0x30,0x32,0x65,0x9D,0xE6,0x3C,0x93,0x5E,0x50, -0x4E,0x7A,0xE3,0x3A,0xD4,0x6E,0xCC,0x1A,0xFB,0xF9,0xD2,0x37,0xAE,0x24,0x2A,0xAB, -0x57,0x03,0x22,0x28,0x0D,0x49,0x75,0x7F,0xB7,0x28,0xDA,0x75,0xBF,0x8E,0xE3,0xDC, -0x0E,0x79,0x31,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06,0x03, -0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9D,0x93,0xC6,0x53,0x8B,0x5E,0xCA,0xAF,0x3F, -0x9F,0x1E,0x0F,0xE5,0x99,0x95,0xBC,0x24,0xF6,0x94,0x8F,0x30,0x0F,0x06,0x03,0x55, -0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03, -0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01,0x00, -0x58,0xAC,0xF4,0x04,0x0E,0xCD,0xC0,0x0D,0xFF,0x0A,0xFD,0xD4,0xBA,0x16,0x5F,0x29, -0xBD,0x7B,0x68,0x99,0x58,0x49,0xD2,0xB4,0x1D,0x37,0x4D,0x7F,0x27,0x7D,0x46,0x06, -0x5D,0x43,0xC6,0x86,0x2E,0x3E,0x73,0xB2,0x26,0x7D,0x4F,0x93,0xA9,0xB6,0xC4,0x2A, -0x9A,0xAB,0x21,0x97,0x14,0xB1,0xDE,0x8C,0xD3,0xAB,0x89,0x15,0xD8,0x6B,0x24,0xD4, -0xF1,0x16,0xAE,0xD8,0xA4,0x5C,0xD4,0x7F,0x51,0x8E,0xED,0x18,0x01,0xB1,0x93,0x63, -0xBD,0xBC,0xF8,0x61,0x80,0x9A,0x9E,0xB1,0xCE,0x42,0x70,0xE2,0xA9,0x7D,0x06,0x25, -0x7D,0x27,0xA1,0xFE,0x6F,0xEC,0xB3,0x1E,0x24,0xDA,0xE3,0x4B,0x55,0x1A,0x00,0x3B, -0x35,0xB4,0x3B,0xD9,0xD7,0x5D,0x30,0xFD,0x81,0x13,0x89,0xF2,0xC2,0x06,0x2B,0xED, -0x67,0xC4,0x8E,0xC9,0x43,0xB2,0x5C,0x6B,0x15,0x89,0x02,0xBC,0x62,0xFC,0x4E,0xF2, -0xB5,0x33,0xAA,0xB2,0x6F,0xD3,0x0A,0xA2,0x50,0xE3,0xF6,0x3B,0xE8,0x2E,0x44,0xC2, -0xDB,0x66,0x38,0xA9,0x33,0x56,0x48,0xF1,0x6D,0x1B,0x33,0x8D,0x0D,0x8C,0x3F,0x60, -0x37,0x9D,0xD3,0xCA,0x6D,0x7E,0x34,0x7E,0x0D,0x9F,0x72,0x76,0x8B,0x1B,0x9F,0x72, -0xFD,0x52,0x35,0x41,0x45,0x02,0x96,0x2F,0x1C,0xB2,0x9A,0x73,0x49,0x21,0xB1,0x49, -0x47,0x45,0x47,0xB4,0xEF,0x6A,0x34,0x11,0xC9,0x4D,0x9A,0xCC,0x59,0xB7,0xD6,0x02, -0x9E,0x5A,0x4E,0x65,0xB5,0x94,0xAE,0x1B,0xDF,0x29,0xB0,0x16,0xF1,0xBF,0x00,0x9E, -0x07,0x3A,0x17,0x64,0xB5,0x04,0xB5,0x23,0x21,0x99,0x0A,0x95,0x3B,0x97,0x7C,0xEF, -}; - - -/* subject:/C=US/O=AffirmTrust/CN=AffirmTrust Premium */ -/* issuer :/C=US/O=AffirmTrust/CN=AffirmTrust Premium */ - - -const unsigned char AffirmTrust_Premium_certificate[1354]={ -0x30,0x82,0x05,0x46,0x30,0x82,0x03,0x2E,0xA0,0x03,0x02,0x01,0x02,0x02,0x08,0x6D, -0x8C,0x14,0x46,0xB1,0xA6,0x0A,0xEE,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x0C,0x05,0x00,0x30,0x41,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0A,0x0C,0x0B, -0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x31,0x1C,0x30,0x1A,0x06, -0x03,0x55,0x04,0x03,0x0C,0x13,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73, -0x74,0x20,0x50,0x72,0x65,0x6D,0x69,0x75,0x6D,0x30,0x1E,0x17,0x0D,0x31,0x30,0x30, -0x31,0x32,0x39,0x31,0x34,0x31,0x30,0x33,0x36,0x5A,0x17,0x0D,0x34,0x30,0x31,0x32, -0x33,0x31,0x31,0x34,0x31,0x30,0x33,0x36,0x5A,0x30,0x41,0x31,0x0B,0x30,0x09,0x06, -0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04, -0x0A,0x0C,0x0B,0x41,0x66,0x66,0x69,0x72,0x6D,0x54,0x72,0x75,0x73,0x74,0x31,0x1C, -0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x0C,0x13,0x41,0x66,0x66,0x69,0x72,0x6D,0x54, -0x72,0x75,0x73,0x74,0x20,0x50,0x72,0x65,0x6D,0x69,0x75,0x6D,0x30,0x82,0x02,0x22, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03, -0x82,0x02,0x0F,0x00,0x30,0x82,0x02,0x0A,0x02,0x82,0x02,0x01,0x00,0xC4,0x12,0xDF, -0xA9,0x5F,0xFE,0x41,0xDD,0xDD,0xF5,0x9F,0x8A,0xE3,0xF6,0xAC,0xE1,0x3C,0x78,0x9A, -0xBC,0xD8,0xF0,0x7F,0x7A,0xA0,0x33,0x2A,0xDC,0x8D,0x20,0x5B,0xAE,0x2D,0x6F,0xE7, -0x93,0xD9,0x36,0x70,0x6A,0x68,0xCF,0x8E,0x51,0xA3,0x85,0x5B,0x67,0x04,0xA0,0x10, -0x24,0x6F,0x5D,0x28,0x82,0xC1,0x97,0x57,0xD8,0x48,0x29,0x13,0xB6,0xE1,0xBE,0x91, -0x4D,0xDF,0x85,0x0C,0x53,0x18,0x9A,0x1E,0x24,0xA2,0x4F,0x8F,0xF0,0xA2,0x85,0x0B, -0xCB,0xF4,0x29,0x7F,0xD2,0xA4,0x58,0xEE,0x26,0x4D,0xC9,0xAA,0xA8,0x7B,0x9A,0xD9, -0xFA,0x38,0xDE,0x44,0x57,0x15,0xE5,0xF8,0x8C,0xC8,0xD9,0x48,0xE2,0x0D,0x16,0x27, -0x1D,0x1E,0xC8,0x83,0x85,0x25,0xB7,0xBA,0xAA,0x55,0x41,0xCC,0x03,0x22,0x4B,0x2D, -0x91,0x8D,0x8B,0xE6,0x89,0xAF,0x66,0xC7,0xE9,0xFF,0x2B,0xE9,0x3C,0xAC,0xDA,0xD2, -0xB3,0xC3,0xE1,0x68,0x9C,0x89,0xF8,0x7A,0x00,0x56,0xDE,0xF4,0x55,0x95,0x6C,0xFB, -0xBA,0x64,0xDD,0x62,0x8B,0xDF,0x0B,0x77,0x32,0xEB,0x62,0xCC,0x26,0x9A,0x9B,0xBB, -0xAA,0x62,0x83,0x4C,0xB4,0x06,0x7A,0x30,0xC8,0x29,0xBF,0xED,0x06,0x4D,0x97,0xB9, -0x1C,0xC4,0x31,0x2B,0xD5,0x5F,0xBC,0x53,0x12,0x17,0x9C,0x99,0x57,0x29,0x66,0x77, -0x61,0x21,0x31,0x07,0x2E,0x25,0x49,0x9D,0x18,0xF2,0xEE,0xF3,0x2B,0x71,0x8C,0xB5, -0xBA,0x39,0x07,0x49,0x77,0xFC,0xEF,0x2E,0x92,0x90,0x05,0x8D,0x2D,0x2F,0x77,0x7B, -0xEF,0x43,0xBF,0x35,0xBB,0x9A,0xD8,0xF9,0x73,0xA7,0x2C,0xF2,0xD0,0x57,0xEE,0x28, -0x4E,0x26,0x5F,0x8F,0x90,0x68,0x09,0x2F,0xB8,0xF8,0xDC,0x06,0xE9,0x2E,0x9A,0x3E, -0x51,0xA7,0xD1,0x22,0xC4,0x0A,0xA7,0x38,0x48,0x6C,0xB3,0xF9,0xFF,0x7D,0xAB,0x86, -0x57,0xE3,0xBA,0xD6,0x85,0x78,0x77,0xBA,0x43,0xEA,0x48,0x7F,0xF6,0xD8,0xBE,0x23, -0x6D,0x1E,0xBF,0xD1,0x36,0x6C,0x58,0x5C,0xF1,0xEE,0xA4,0x19,0x54,0x1A,0xF5,0x03, -0xD2,0x76,0xE6,0xE1,0x8C,0xBD,0x3C,0xB3,0xD3,0x48,0x4B,0xE2,0xC8,0xF8,0x7F,0x92, -0xA8,0x76,0x46,0x9C,0x42,0x65,0x3E,0xA4,0x1E,0xC1,0x07,0x03,0x5A,0x46,0x2D,0xB8, -0x97,0xF3,0xB7,0xD5,0xB2,0x55,0x21,0xEF,0xBA,0xDC,0x4C,0x00,0x97,0xFB,0x14,0x95, -0x27,0x33,0xBF,0xE8,0x43,0x47,0x46,0xD2,0x08,0x99,0x16,0x60,0x3B,0x9A,0x7E,0xD2, -0xE6,0xED,0x38,0xEA,0xEC,0x01,0x1E,0x3C,0x48,0x56,0x49,0x09,0xC7,0x4C,0x37,0x00, -0x9E,0x88,0x0E,0xC0,0x73,0xE1,0x6F,0x66,0xE9,0x72,0x47,0x30,0x3E,0x10,0xE5,0x0B, -0x03,0xC9,0x9A,0x42,0x00,0x6C,0xC5,0x94,0x7E,0x61,0xC4,0x8A,0xDF,0x7F,0x82,0x1A, -0x0B,0x59,0xC4,0x59,0x32,0x77,0xB3,0xBC,0x60,0x69,0x56,0x39,0xFD,0xB4,0x06,0x7B, -0x2C,0xD6,0x64,0x36,0xD9,0xBD,0x48,0xED,0x84,0x1F,0x7E,0xA5,0x22,0x8F,0x2A,0xB8, -0x42,0xF4,0x82,0xB7,0xD4,0x53,0x90,0x78,0x4E,0x2D,0x1A,0xFD,0x81,0x6F,0x44,0xD7, -0x3B,0x01,0x74,0x96,0x42,0xE0,0x00,0xE2,0x2E,0x6B,0xEA,0xC5,0xEE,0x72,0xAC,0xBB, -0xBF,0xFE,0xEA,0xAA,0xA8,0xF8,0xDC,0xF6,0xB2,0x79,0x8A,0xB6,0x67,0x02,0x03,0x01, -0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04, -0x14,0x9D,0xC0,0x67,0xA6,0x0C,0x22,0xD9,0x26,0xF5,0x45,0xAB,0xA6,0x65,0x52,0x11, -0x27,0xD8,0x45,0xAC,0x63,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x0C,0x05,0x00,0x03,0x82,0x02,0x01,0x00,0xB3,0x57,0x4D,0x10,0x62,0x4E, -0x3A,0xE4,0xAC,0xEA,0xB8,0x1C,0xAF,0x32,0x23,0xC8,0xB3,0x49,0x5A,0x51,0x9C,0x76, -0x28,0x8D,0x79,0xAA,0x57,0x46,0x17,0xD5,0xF5,0x52,0xF6,0xB7,0x44,0xE8,0x08,0x44, -0xBF,0x18,0x84,0xD2,0x0B,0x80,0xCD,0xC5,0x12,0xFD,0x00,0x55,0x05,0x61,0x87,0x41, -0xDC,0xB5,0x24,0x9E,0x3C,0xC4,0xD8,0xC8,0xFB,0x70,0x9E,0x2F,0x78,0x96,0x83,0x20, -0x36,0xDE,0x7C,0x0F,0x69,0x13,0x88,0xA5,0x75,0x36,0x98,0x08,0xA6,0xC6,0xDF,0xAC, -0xCE,0xE3,0x58,0xD6,0xB7,0x3E,0xDE,0xBA,0xF3,0xEB,0x34,0x40,0xD8,0xA2,0x81,0xF5, -0x78,0x3F,0x2F,0xD5,0xA5,0xFC,0xD9,0xA2,0xD4,0x5E,0x04,0x0E,0x17,0xAD,0xFE,0x41, -0xF0,0xE5,0xB2,0x72,0xFA,0x44,0x82,0x33,0x42,0xE8,0x2D,0x58,0xF7,0x56,0x8C,0x62, -0x3F,0xBA,0x42,0xB0,0x9C,0x0C,0x5C,0x7E,0x2E,0x65,0x26,0x5C,0x53,0x4F,0x00,0xB2, -0x78,0x7E,0xA1,0x0D,0x99,0x2D,0x8D,0xB8,0x1D,0x8E,0xA2,0xC4,0xB0,0xFD,0x60,0xD0, -0x30,0xA4,0x8E,0xC8,0x04,0x62,0xA9,0xC4,0xED,0x35,0xDE,0x7A,0x97,0xED,0x0E,0x38, -0x5E,0x92,0x2F,0x93,0x70,0xA5,0xA9,0x9C,0x6F,0xA7,0x7D,0x13,0x1D,0x7E,0xC6,0x08, -0x48,0xB1,0x5E,0x67,0xEB,0x51,0x08,0x25,0xE9,0xE6,0x25,0x6B,0x52,0x29,0x91,0x9C, -0xD2,0x39,0x73,0x08,0x57,0xDE,0x99,0x06,0xB4,0x5B,0x9D,0x10,0x06,0xE1,0xC2,0x00, -0xA8,0xB8,0x1C,0x4A,0x02,0x0A,0x14,0xD0,0xC1,0x41,0xCA,0xFB,0x8C,0x35,0x21,0x7D, -0x82,0x38,0xF2,0xA9,0x54,0x91,0x19,0x35,0x93,0x94,0x6D,0x6A,0x3A,0xC5,0xB2,0xD0, -0xBB,0x89,0x86,0x93,0xE8,0x9B,0xC9,0x0F,0x3A,0xA7,0x7A,0xB8,0xA1,0xF0,0x78,0x46, -0xFA,0xFC,0x37,0x2F,0xE5,0x8A,0x84,0xF3,0xDF,0xFE,0x04,0xD9,0xA1,0x68,0xA0,0x2F, -0x24,0xE2,0x09,0x95,0x06,0xD5,0x95,0xCA,0xE1,0x24,0x96,0xEB,0x7C,0xF6,0x93,0x05, -0xBB,0xED,0x73,0xE9,0x2D,0xD1,0x75,0x39,0xD7,0xE7,0x24,0xDB,0xD8,0x4E,0x5F,0x43, -0x8F,0x9E,0xD0,0x14,0x39,0xBF,0x55,0x70,0x48,0x99,0x57,0x31,0xB4,0x9C,0xEE,0x4A, -0x98,0x03,0x96,0x30,0x1F,0x60,0x06,0xEE,0x1B,0x23,0xFE,0x81,0x60,0x23,0x1A,0x47, -0x62,0x85,0xA5,0xCC,0x19,0x34,0x80,0x6F,0xB3,0xAC,0x1A,0xE3,0x9F,0xF0,0x7B,0x48, -0xAD,0xD5,0x01,0xD9,0x67,0xB6,0xA9,0x72,0x93,0xEA,0x2D,0x66,0xB5,0xB2,0xB8,0xE4, -0x3D,0x3C,0xB2,0xEF,0x4C,0x8C,0xEA,0xEB,0x07,0xBF,0xAB,0x35,0x9A,0x55,0x86,0xBC, -0x18,0xA6,0xB5,0xA8,0x5E,0xB4,0x83,0x6C,0x6B,0x69,0x40,0xD3,0x9F,0xDC,0xF1,0xC3, -0x69,0x6B,0xB9,0xE1,0x6D,0x09,0xF4,0xF1,0xAA,0x50,0x76,0x0A,0x7A,0x7D,0x7A,0x17, -0xA1,0x55,0x96,0x42,0x99,0x31,0x09,0xDD,0x60,0x11,0x8D,0x05,0x30,0x7E,0xE6,0x8E, -0x46,0xD1,0x9D,0x14,0xDA,0xC7,0x17,0xE4,0x05,0x96,0x8C,0xC4,0x24,0xB5,0x1B,0xCF, -0x14,0x07,0xB2,0x40,0xF8,0xA3,0x9E,0x41,0x86,0xBC,0x04,0xD0,0x6B,0x96,0xC8,0x2A, -0x80,0x34,0xFD,0xBF,0xEF,0x06,0xA3,0xDD,0x58,0xC5,0x85,0x3D,0x3E,0x8F,0xFE,0x9E, -0x29,0xE0,0xB6,0xB8,0x09,0x68,0x19,0x1C,0x18,0x43, -}; - - -/* subject:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2 */ -/* issuer :/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2 */ - - -const unsigned char Go_Daddy_Root_Certificate_Authority___G2_certificate[969]={ -0x30,0x82,0x03,0xC5,0x30,0x82,0x02,0xAD,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x00, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30, -0x81,0x83,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31, -0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x08,0x13,0x07,0x41,0x72,0x69,0x7A,0x6F,0x6E, -0x61,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x07,0x13,0x0A,0x53,0x63,0x6F,0x74, -0x74,0x73,0x64,0x61,0x6C,0x65,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13, -0x11,0x47,0x6F,0x44,0x61,0x64,0x64,0x79,0x2E,0x63,0x6F,0x6D,0x2C,0x20,0x49,0x6E, -0x63,0x2E,0x31,0x31,0x30,0x2F,0x06,0x03,0x55,0x04,0x03,0x13,0x28,0x47,0x6F,0x20, -0x44,0x61,0x64,0x64,0x79,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79, -0x20,0x2D,0x20,0x47,0x32,0x30,0x1E,0x17,0x0D,0x30,0x39,0x30,0x39,0x30,0x31,0x30, -0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x37,0x31,0x32,0x33,0x31,0x32,0x33, -0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0x83,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x55,0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x08,0x13,0x07, -0x41,0x72,0x69,0x7A,0x6F,0x6E,0x61,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x07, -0x13,0x0A,0x53,0x63,0x6F,0x74,0x74,0x73,0x64,0x61,0x6C,0x65,0x31,0x1A,0x30,0x18, -0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x47,0x6F,0x44,0x61,0x64,0x64,0x79,0x2E,0x63, -0x6F,0x6D,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x31,0x30,0x2F,0x06,0x03,0x55,0x04, -0x03,0x13,0x28,0x47,0x6F,0x20,0x44,0x61,0x64,0x64,0x79,0x20,0x52,0x6F,0x6F,0x74, -0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74, -0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x47,0x32,0x30,0x82,0x01,0x22,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82, -0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xBF,0x71,0x62,0x08, -0xF1,0xFA,0x59,0x34,0xF7,0x1B,0xC9,0x18,0xA3,0xF7,0x80,0x49,0x58,0xE9,0x22,0x83, -0x13,0xA6,0xC5,0x20,0x43,0x01,0x3B,0x84,0xF1,0xE6,0x85,0x49,0x9F,0x27,0xEA,0xF6, -0x84,0x1B,0x4E,0xA0,0xB4,0xDB,0x70,0x98,0xC7,0x32,0x01,0xB1,0x05,0x3E,0x07,0x4E, -0xEE,0xF4,0xFA,0x4F,0x2F,0x59,0x30,0x22,0xE7,0xAB,0x19,0x56,0x6B,0xE2,0x80,0x07, -0xFC,0xF3,0x16,0x75,0x80,0x39,0x51,0x7B,0xE5,0xF9,0x35,0xB6,0x74,0x4E,0xA9,0x8D, -0x82,0x13,0xE4,0xB6,0x3F,0xA9,0x03,0x83,0xFA,0xA2,0xBE,0x8A,0x15,0x6A,0x7F,0xDE, -0x0B,0xC3,0xB6,0x19,0x14,0x05,0xCA,0xEA,0xC3,0xA8,0x04,0x94,0x3B,0x46,0x7C,0x32, -0x0D,0xF3,0x00,0x66,0x22,0xC8,0x8D,0x69,0x6D,0x36,0x8C,0x11,0x18,0xB7,0xD3,0xB2, -0x1C,0x60,0xB4,0x38,0xFA,0x02,0x8C,0xCE,0xD3,0xDD,0x46,0x07,0xDE,0x0A,0x3E,0xEB, -0x5D,0x7C,0xC8,0x7C,0xFB,0xB0,0x2B,0x53,0xA4,0x92,0x62,0x69,0x51,0x25,0x05,0x61, -0x1A,0x44,0x81,0x8C,0x2C,0xA9,0x43,0x96,0x23,0xDF,0xAC,0x3A,0x81,0x9A,0x0E,0x29, -0xC5,0x1C,0xA9,0xE9,0x5D,0x1E,0xB6,0x9E,0x9E,0x30,0x0A,0x39,0xCE,0xF1,0x88,0x80, -0xFB,0x4B,0x5D,0xCC,0x32,0xEC,0x85,0x62,0x43,0x25,0x34,0x02,0x56,0x27,0x01,0x91, -0xB4,0x3B,0x70,0x2A,0x3F,0x6E,0xB1,0xE8,0x9C,0x88,0x01,0x7D,0x9F,0xD4,0xF9,0xDB, -0x53,0x6D,0x60,0x9D,0xBF,0x2C,0xE7,0x58,0xAB,0xB8,0x5F,0x46,0xFC,0xCE,0xC4,0x1B, -0x03,0x3C,0x09,0xEB,0x49,0x31,0x5C,0x69,0x46,0xB3,0xE0,0x47,0x02,0x03,0x01,0x00, -0x01,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04, -0x14,0x3A,0x9A,0x85,0x07,0x10,0x67,0x28,0xB6,0xEF,0xF6,0xBD,0x05,0x41,0x6E,0x20, -0xC1,0x94,0xDA,0x0F,0xDE,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x99,0xDB,0x5D,0x79,0xD5,0xF9,0x97, -0x59,0x67,0x03,0x61,0xF1,0x7E,0x3B,0x06,0x31,0x75,0x2D,0xA1,0x20,0x8E,0x4F,0x65, -0x87,0xB4,0xF7,0xA6,0x9C,0xBC,0xD8,0xE9,0x2F,0xD0,0xDB,0x5A,0xEE,0xCF,0x74,0x8C, -0x73,0xB4,0x38,0x42,0xDA,0x05,0x7B,0xF8,0x02,0x75,0xB8,0xFD,0xA5,0xB1,0xD7,0xAE, -0xF6,0xD7,0xDE,0x13,0xCB,0x53,0x10,0x7E,0x8A,0x46,0xD1,0x97,0xFA,0xB7,0x2E,0x2B, -0x11,0xAB,0x90,0xB0,0x27,0x80,0xF9,0xE8,0x9F,0x5A,0xE9,0x37,0x9F,0xAB,0xE4,0xDF, -0x6C,0xB3,0x85,0x17,0x9D,0x3D,0xD9,0x24,0x4F,0x79,0x91,0x35,0xD6,0x5F,0x04,0xEB, -0x80,0x83,0xAB,0x9A,0x02,0x2D,0xB5,0x10,0xF4,0xD8,0x90,0xC7,0x04,0x73,0x40,0xED, -0x72,0x25,0xA0,0xA9,0x9F,0xEC,0x9E,0xAB,0x68,0x12,0x99,0x57,0xC6,0x8F,0x12,0x3A, -0x09,0xA4,0xBD,0x44,0xFD,0x06,0x15,0x37,0xC1,0x9B,0xE4,0x32,0xA3,0xED,0x38,0xE8, -0xD8,0x64,0xF3,0x2C,0x7E,0x14,0xFC,0x02,0xEA,0x9F,0xCD,0xFF,0x07,0x68,0x17,0xDB, -0x22,0x90,0x38,0x2D,0x7A,0x8D,0xD1,0x54,0xF1,0x69,0xE3,0x5F,0x33,0xCA,0x7A,0x3D, -0x7B,0x0A,0xE3,0xCA,0x7F,0x5F,0x39,0xE5,0xE2,0x75,0xBA,0xC5,0x76,0x18,0x33,0xCE, -0x2C,0xF0,0x2F,0x4C,0xAD,0xF7,0xB1,0xE7,0xCE,0x4F,0xA8,0xC4,0x9B,0x4A,0x54,0x06, -0xC5,0x7F,0x7D,0xD5,0x08,0x0F,0xE2,0x1C,0xFE,0x7E,0x17,0xB8,0xAC,0x5E,0xF6,0xD4, -0x16,0xB2,0x43,0x09,0x0C,0x4D,0xF6,0xA7,0x6B,0xB4,0x99,0x84,0x65,0xCA,0x7A,0x88, -0xE2,0xE2,0x44,0xBE,0x5C,0xF7,0xEA,0x1C,0xF5, -}; - - -/* subject:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=Secure Certificate Services */ -/* issuer :/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=Secure Certificate Services */ - - -const unsigned char Comodo_Secure_Services_root_certificate[1091]={ -0x30,0x82,0x04,0x3F,0x30,0x82,0x03,0x27,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x7E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x0C,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72, -0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06, -0x03,0x55,0x04,0x07,0x0C,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30, -0x18,0x06,0x03,0x55,0x04,0x0A,0x0C,0x11,0x43,0x6F,0x6D,0x6F,0x64,0x6F,0x20,0x43, -0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x24,0x30,0x22,0x06,0x03,0x55, -0x04,0x03,0x0C,0x1B,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30, -0x1E,0x17,0x0D,0x30,0x34,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A, -0x17,0x0D,0x32,0x38,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30, -0x7E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x0C,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72, -0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06, -0x03,0x55,0x04,0x07,0x0C,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30, -0x18,0x06,0x03,0x55,0x04,0x0A,0x0C,0x11,0x43,0x6F,0x6D,0x6F,0x64,0x6F,0x20,0x43, -0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x24,0x30,0x22,0x06,0x03,0x55, -0x04,0x03,0x0C,0x1B,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x43,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30, -0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01, -0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00, -0xC0,0x71,0x33,0x82,0x8A,0xD0,0x70,0xEB,0x73,0x87,0x82,0x40,0xD5,0x1D,0xE4,0xCB, -0xC9,0x0E,0x42,0x90,0xF9,0xDE,0x34,0xB9,0xA1,0xBA,0x11,0xF4,0x25,0x85,0xF3,0xCC, -0x72,0x6D,0xF2,0x7B,0x97,0x6B,0xB3,0x07,0xF1,0x77,0x24,0x91,0x5F,0x25,0x8F,0xF6, -0x74,0x3D,0xE4,0x80,0xC2,0xF8,0x3C,0x0D,0xF3,0xBF,0x40,0xEA,0xF7,0xC8,0x52,0xD1, -0x72,0x6F,0xEF,0xC8,0xAB,0x41,0xB8,0x6E,0x2E,0x17,0x2A,0x95,0x69,0x0C,0xCD,0xD2, -0x1E,0x94,0x7B,0x2D,0x94,0x1D,0xAA,0x75,0xD7,0xB3,0x98,0xCB,0xAC,0xBC,0x64,0x53, -0x40,0xBC,0x8F,0xAC,0xAC,0x36,0xCB,0x5C,0xAD,0xBB,0xDD,0xE0,0x94,0x17,0xEC,0xD1, -0x5C,0xD0,0xBF,0xEF,0xA5,0x95,0xC9,0x90,0xC5,0xB0,0xAC,0xFB,0x1B,0x43,0xDF,0x7A, -0x08,0x5D,0xB7,0xB8,0xF2,0x40,0x1B,0x2B,0x27,0x9E,0x50,0xCE,0x5E,0x65,0x82,0x88, -0x8C,0x5E,0xD3,0x4E,0x0C,0x7A,0xEA,0x08,0x91,0xB6,0x36,0xAA,0x2B,0x42,0xFB,0xEA, -0xC2,0xA3,0x39,0xE5,0xDB,0x26,0x38,0xAD,0x8B,0x0A,0xEE,0x19,0x63,0xC7,0x1C,0x24, -0xDF,0x03,0x78,0xDA,0xE6,0xEA,0xC1,0x47,0x1A,0x0B,0x0B,0x46,0x09,0xDD,0x02,0xFC, -0xDE,0xCB,0x87,0x5F,0xD7,0x30,0x63,0x68,0xA1,0xAE,0xDC,0x32,0xA1,0xBA,0xBE,0xFE, -0x44,0xAB,0x68,0xB6,0xA5,0x17,0x15,0xFD,0xBD,0xD5,0xA7,0xA7,0x9A,0xE4,0x44,0x33, -0xE9,0x88,0x8E,0xFC,0xED,0x51,0xEB,0x93,0x71,0x4E,0xAD,0x01,0xE7,0x44,0x8E,0xAB, -0x2D,0xCB,0xA8,0xFE,0x01,0x49,0x48,0xF0,0xC0,0xDD,0xC7,0x68,0xD8,0x92,0xFE,0x3D, -0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0xC7,0x30,0x81,0xC4,0x30,0x1D,0x06,0x03,0x55, -0x1D,0x0E,0x04,0x16,0x04,0x14,0x3C,0xD8,0x93,0x88,0xC2,0xC0,0x82,0x09,0xCC,0x01, -0x99,0x06,0x93,0x20,0xE9,0x9E,0x70,0x09,0x63,0x4F,0x30,0x0E,0x06,0x03,0x55,0x1D, -0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D, -0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x81,0x81,0x06,0x03, -0x55,0x1D,0x1F,0x04,0x7A,0x30,0x78,0x30,0x3B,0xA0,0x39,0xA0,0x37,0x86,0x35,0x68, -0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x63,0x6F,0x6D,0x6F,0x64,0x6F, -0x63,0x61,0x2E,0x63,0x6F,0x6D,0x2F,0x53,0x65,0x63,0x75,0x72,0x65,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73, -0x2E,0x63,0x72,0x6C,0x30,0x39,0xA0,0x37,0xA0,0x35,0x86,0x33,0x68,0x74,0x74,0x70, -0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x63,0x6F,0x6D,0x6F,0x64,0x6F,0x2E,0x6E,0x65, -0x74,0x2F,0x53,0x65,0x63,0x75,0x72,0x65,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63, -0x61,0x74,0x65,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x2E,0x63,0x72,0x6C,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82, -0x01,0x01,0x00,0x87,0x01,0x6D,0x23,0x1D,0x7E,0x5B,0x17,0x7D,0xC1,0x61,0x32,0xCF, -0x8F,0xE7,0xF3,0x8A,0x94,0x59,0x66,0xE0,0x9E,0x28,0xA8,0x5E,0xD3,0xB7,0xF4,0x34, -0xE6,0xAA,0x39,0xB2,0x97,0x16,0xC5,0x82,0x6F,0x32,0xA4,0xE9,0x8C,0xE7,0xAF,0xFD, -0xEF,0xC2,0xE8,0xB9,0x4B,0xAA,0xA3,0xF4,0xE6,0xDA,0x8D,0x65,0x21,0xFB,0xBA,0x80, -0xEB,0x26,0x28,0x85,0x1A,0xFE,0x39,0x8C,0xDE,0x5B,0x04,0x04,0xB4,0x54,0xF9,0xA3, -0x67,0x9E,0x41,0xFA,0x09,0x52,0xCC,0x05,0x48,0xA8,0xC9,0x3F,0x21,0x04,0x1E,0xCE, -0x48,0x6B,0xFC,0x85,0xE8,0xC2,0x7B,0xAF,0x7F,0xB7,0xCC,0xF8,0x5F,0x3A,0xFD,0x35, -0xC6,0x0D,0xEF,0x97,0xDC,0x4C,0xAB,0x11,0xE1,0x6B,0xCB,0x31,0xD1,0x6C,0xFB,0x48, -0x80,0xAB,0xDC,0x9C,0x37,0xB8,0x21,0x14,0x4B,0x0D,0x71,0x3D,0xEC,0x83,0x33,0x6E, -0xD1,0x6E,0x32,0x16,0xEC,0x98,0xC7,0x16,0x8B,0x59,0xA6,0x34,0xAB,0x05,0x57,0x2D, -0x93,0xF7,0xAA,0x13,0xCB,0xD2,0x13,0xE2,0xB7,0x2E,0x3B,0xCD,0x6B,0x50,0x17,0x09, -0x68,0x3E,0xB5,0x26,0x57,0xEE,0xB6,0xE0,0xB6,0xDD,0xB9,0x29,0x80,0x79,0x7D,0x8F, -0xA3,0xF0,0xA4,0x28,0xA4,0x15,0xC4,0x85,0xF4,0x27,0xD4,0x6B,0xBF,0xE5,0x5C,0xE4, -0x65,0x02,0x76,0x54,0xB4,0xE3,0x37,0x66,0x24,0xD3,0x19,0x61,0xC8,0x52,0x10,0xE5, -0x8B,0x37,0x9A,0xB9,0xA9,0xF9,0x1D,0xBF,0xEA,0x99,0x92,0x61,0x96,0xFF,0x01,0xCD, -0xA1,0x5F,0x0D,0xBC,0x71,0xBC,0x0E,0xAC,0x0B,0x1D,0x47,0x45,0x1D,0xC1,0xEC,0x7C, -0xEC,0xFD,0x29, -}; - - -/* subject:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Trusted Root G4 */ -/* issuer :/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Trusted Root G4 */ - - -const unsigned char DigiCert_Trusted_Root_G4_certificate[1428]={ -0x30,0x82,0x05,0x90,0x30,0x82,0x03,0x78,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x05, -0x9B,0x1B,0x57,0x9E,0x8E,0x21,0x32,0xE2,0x39,0x07,0xBD,0xA7,0x77,0x75,0x5C,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C,0x05,0x00,0x30,0x62, -0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30, -0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, -0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0B,0x13,0x10,0x77, -0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E,0x63,0x6F,0x6D,0x31, -0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x03,0x13,0x18,0x44,0x69,0x67,0x69,0x43,0x65, -0x72,0x74,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x52,0x6F,0x6F,0x74,0x20, -0x47,0x34,0x30,0x1E,0x17,0x0D,0x31,0x33,0x30,0x38,0x30,0x31,0x31,0x32,0x30,0x30, -0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x35,0x31,0x32,0x30,0x30,0x30, -0x30,0x5A,0x30,0x62,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55, -0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0A,0x13,0x0C,0x44,0x69,0x67,0x69, -0x43,0x65,0x72,0x74,0x20,0x49,0x6E,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04, -0x0B,0x13,0x10,0x77,0x77,0x77,0x2E,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2E, -0x63,0x6F,0x6D,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x03,0x13,0x18,0x44,0x69, -0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x52, -0x6F,0x6F,0x74,0x20,0x47,0x34,0x30,0x82,0x02,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x02,0x0F,0x00,0x30,0x82, -0x02,0x0A,0x02,0x82,0x02,0x01,0x00,0xBF,0xE6,0x90,0x73,0x68,0xDE,0xBB,0xE4,0x5D, -0x4A,0x3C,0x30,0x22,0x30,0x69,0x33,0xEC,0xC2,0xA7,0x25,0x2E,0xC9,0x21,0x3D,0xF2, -0x8A,0xD8,0x59,0xC2,0xE1,0x29,0xA7,0x3D,0x58,0xAB,0x76,0x9A,0xCD,0xAE,0x7B,0x1B, -0x84,0x0D,0xC4,0x30,0x1F,0xF3,0x1B,0xA4,0x38,0x16,0xEB,0x56,0xC6,0x97,0x6D,0x1D, -0xAB,0xB2,0x79,0xF2,0xCA,0x11,0xD2,0xE4,0x5F,0xD6,0x05,0x3C,0x52,0x0F,0x52,0x1F, -0xC6,0x9E,0x15,0xA5,0x7E,0xBE,0x9F,0xA9,0x57,0x16,0x59,0x55,0x72,0xAF,0x68,0x93, -0x70,0xC2,0xB2,0xBA,0x75,0x99,0x6A,0x73,0x32,0x94,0xD1,0x10,0x44,0x10,0x2E,0xDF, -0x82,0xF3,0x07,0x84,0xE6,0x74,0x3B,0x6D,0x71,0xE2,0x2D,0x0C,0x1B,0xEE,0x20,0xD5, -0xC9,0x20,0x1D,0x63,0x29,0x2D,0xCE,0xEC,0x5E,0x4E,0xC8,0x93,0xF8,0x21,0x61,0x9B, -0x34,0xEB,0x05,0xC6,0x5E,0xEC,0x5B,0x1A,0xBC,0xEB,0xC9,0xCF,0xCD,0xAC,0x34,0x40, -0x5F,0xB1,0x7A,0x66,0xEE,0x77,0xC8,0x48,0xA8,0x66,0x57,0x57,0x9F,0x54,0x58,0x8E, -0x0C,0x2B,0xB7,0x4F,0xA7,0x30,0xD9,0x56,0xEE,0xCA,0x7B,0x5D,0xE3,0xAD,0xC9,0x4F, -0x5E,0xE5,0x35,0xE7,0x31,0xCB,0xDA,0x93,0x5E,0xDC,0x8E,0x8F,0x80,0xDA,0xB6,0x91, -0x98,0x40,0x90,0x79,0xC3,0x78,0xC7,0xB6,0xB1,0xC4,0xB5,0x6A,0x18,0x38,0x03,0x10, -0x8D,0xD8,0xD4,0x37,0xA4,0x2E,0x05,0x7D,0x88,0xF5,0x82,0x3E,0x10,0x91,0x70,0xAB, -0x55,0x82,0x41,0x32,0xD7,0xDB,0x04,0x73,0x2A,0x6E,0x91,0x01,0x7C,0x21,0x4C,0xD4, -0xBC,0xAE,0x1B,0x03,0x75,0x5D,0x78,0x66,0xD9,0x3A,0x31,0x44,0x9A,0x33,0x40,0xBF, -0x08,0xD7,0x5A,0x49,0xA4,0xC2,0xE6,0xA9,0xA0,0x67,0xDD,0xA4,0x27,0xBC,0xA1,0x4F, -0x39,0xB5,0x11,0x58,0x17,0xF7,0x24,0x5C,0x46,0x8F,0x64,0xF7,0xC1,0x69,0x88,0x76, -0x98,0x76,0x3D,0x59,0x5D,0x42,0x76,0x87,0x89,0x97,0x69,0x7A,0x48,0xF0,0xE0,0xA2, -0x12,0x1B,0x66,0x9A,0x74,0xCA,0xDE,0x4B,0x1E,0xE7,0x0E,0x63,0xAE,0xE6,0xD4,0xEF, -0x92,0x92,0x3A,0x9E,0x3D,0xDC,0x00,0xE4,0x45,0x25,0x89,0xB6,0x9A,0x44,0x19,0x2B, -0x7E,0xC0,0x94,0xB4,0xD2,0x61,0x6D,0xEB,0x33,0xD9,0xC5,0xDF,0x4B,0x04,0x00,0xCC, -0x7D,0x1C,0x95,0xC3,0x8F,0xF7,0x21,0xB2,0xB2,0x11,0xB7,0xBB,0x7F,0xF2,0xD5,0x8C, -0x70,0x2C,0x41,0x60,0xAA,0xB1,0x63,0x18,0x44,0x95,0x1A,0x76,0x62,0x7E,0xF6,0x80, -0xB0,0xFB,0xE8,0x64,0xA6,0x33,0xD1,0x89,0x07,0xE1,0xBD,0xB7,0xE6,0x43,0xA4,0x18, -0xB8,0xA6,0x77,0x01,0xE1,0x0F,0x94,0x0C,0x21,0x1D,0xB2,0x54,0x29,0x25,0x89,0x6C, -0xE5,0x0E,0x52,0x51,0x47,0x74,0xBE,0x26,0xAC,0xB6,0x41,0x75,0xDE,0x7A,0xAC,0x5F, -0x8D,0x3F,0xC9,0xBC,0xD3,0x41,0x11,0x12,0x5B,0xE5,0x10,0x50,0xEB,0x31,0xC5,0xCA, -0x72,0x16,0x22,0x09,0xDF,0x7C,0x4C,0x75,0x3F,0x63,0xEC,0x21,0x5F,0xC4,0x20,0x51, -0x6B,0x6F,0xB1,0xAB,0x86,0x8B,0x4F,0xC2,0xD6,0x45,0x5F,0x9D,0x20,0xFC,0xA1,0x1E, -0xC5,0xC0,0x8F,0xA2,0xB1,0x7E,0x0A,0x26,0x99,0xF5,0xE4,0x69,0x2F,0x98,0x1D,0x2D, -0xF5,0xD9,0xA9,0xB2,0x1D,0xE5,0x1B,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40, -0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01, -0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01, -0x86,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xEC,0xD7,0xE3,0x82, -0xD2,0x71,0x5D,0x64,0x4C,0xDF,0x2E,0x67,0x3F,0xE7,0xBA,0x98,0xAE,0x1C,0x0F,0x4F, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C,0x05,0x00,0x03, -0x82,0x02,0x01,0x00,0xBB,0x61,0xD9,0x7D,0xA9,0x6C,0xBE,0x17,0xC4,0x91,0x1B,0xC3, -0xA1,0xA2,0x00,0x8D,0xE3,0x64,0x68,0x0F,0x56,0xCF,0x77,0xAE,0x70,0xF9,0xFD,0x9A, -0x4A,0x99,0xB9,0xC9,0x78,0x5C,0x0C,0x0C,0x5F,0xE4,0xE6,0x14,0x29,0x56,0x0B,0x36, -0x49,0x5D,0x44,0x63,0xE0,0xAD,0x9C,0x96,0x18,0x66,0x1B,0x23,0x0D,0x3D,0x79,0xE9, -0x6D,0x6B,0xD6,0x54,0xF8,0xD2,0x3C,0xC1,0x43,0x40,0xAE,0x1D,0x50,0xF5,0x52,0xFC, -0x90,0x3B,0xBB,0x98,0x99,0x69,0x6B,0xC7,0xC1,0xA7,0xA8,0x68,0xA4,0x27,0xDC,0x9D, -0xF9,0x27,0xAE,0x30,0x85,0xB9,0xF6,0x67,0x4D,0x3A,0x3E,0x8F,0x59,0x39,0x22,0x53, -0x44,0xEB,0xC8,0x5D,0x03,0xCA,0xED,0x50,0x7A,0x7D,0x62,0x21,0x0A,0x80,0xC8,0x73, -0x66,0xD1,0xA0,0x05,0x60,0x5F,0xE8,0xA5,0xB4,0xA7,0xAF,0xA8,0xF7,0x6D,0x35,0x9C, -0x7C,0x5A,0x8A,0xD6,0xA2,0x38,0x99,0xF3,0x78,0x8B,0xF4,0x4D,0xD2,0x20,0x0B,0xDE, -0x04,0xEE,0x8C,0x9B,0x47,0x81,0x72,0x0D,0xC0,0x14,0x32,0xEF,0x30,0x59,0x2E,0xAE, -0xE0,0x71,0xF2,0x56,0xE4,0x6A,0x97,0x6F,0x92,0x50,0x6D,0x96,0x8D,0x68,0x7A,0x9A, -0xB2,0x36,0x14,0x7A,0x06,0xF2,0x24,0xB9,0x09,0x11,0x50,0xD7,0x08,0xB1,0xB8,0x89, -0x7A,0x84,0x23,0x61,0x42,0x29,0xE5,0xA3,0xCD,0xA2,0x20,0x41,0xD7,0xD1,0x9C,0x64, -0xD9,0xEA,0x26,0xA1,0x8B,0x14,0xD7,0x4C,0x19,0xB2,0x50,0x41,0x71,0x3D,0x3F,0x4D, -0x70,0x23,0x86,0x0C,0x4A,0xDC,0x81,0xD2,0xCC,0x32,0x94,0x84,0x0D,0x08,0x09,0x97, -0x1C,0x4F,0xC0,0xEE,0x6B,0x20,0x74,0x30,0xD2,0xE0,0x39,0x34,0x10,0x85,0x21,0x15, -0x01,0x08,0xE8,0x55,0x32,0xDE,0x71,0x49,0xD9,0x28,0x17,0x50,0x4D,0xE6,0xBE,0x4D, -0xD1,0x75,0xAC,0xD0,0xCA,0xFB,0x41,0xB8,0x43,0xA5,0xAA,0xD3,0xC3,0x05,0x44,0x4F, -0x2C,0x36,0x9B,0xE2,0xFA,0xE2,0x45,0xB8,0x23,0x53,0x6C,0x06,0x6F,0x67,0x55,0x7F, -0x46,0xB5,0x4C,0x3F,0x6E,0x28,0x5A,0x79,0x26,0xD2,0xA4,0xA8,0x62,0x97,0xD2,0x1E, -0xE2,0xED,0x4A,0x8B,0xBC,0x1B,0xFD,0x47,0x4A,0x0D,0xDF,0x67,0x66,0x7E,0xB2,0x5B, -0x41,0xD0,0x3B,0xE4,0xF4,0x3B,0xF4,0x04,0x63,0xE9,0xEF,0xC2,0x54,0x00,0x51,0xA0, -0x8A,0x2A,0xC9,0xCE,0x78,0xCC,0xD5,0xEA,0x87,0x04,0x18,0xB3,0xCE,0xAF,0x49,0x88, -0xAF,0xF3,0x92,0x99,0xB6,0xB3,0xE6,0x61,0x0F,0xD2,0x85,0x00,0xE7,0x50,0x1A,0xE4, -0x1B,0x95,0x9D,0x19,0xA1,0xB9,0x9C,0xB1,0x9B,0xB1,0x00,0x1E,0xEF,0xD0,0x0F,0x4F, -0x42,0x6C,0xC9,0x0A,0xBC,0xEE,0x43,0xFA,0x3A,0x71,0xA5,0xC8,0x4D,0x26,0xA5,0x35, -0xFD,0x89,0x5D,0xBC,0x85,0x62,0x1D,0x32,0xD2,0xA0,0x2B,0x54,0xED,0x9A,0x57,0xC1, -0xDB,0xFA,0x10,0xCF,0x19,0xB7,0x8B,0x4A,0x1B,0x8F,0x01,0xB6,0x27,0x95,0x53,0xE8, -0xB6,0x89,0x6D,0x5B,0xBC,0x68,0xD4,0x23,0xE8,0x8B,0x51,0xA2,0x56,0xF9,0xF0,0xA6, -0x80,0xA0,0xD6,0x1E,0xB3,0xBC,0x0F,0x0F,0x53,0x75,0x29,0xAA,0xEA,0x13,0x77,0xE4, -0xDE,0x8C,0x81,0x21,0xAD,0x07,0x10,0x47,0x11,0xAD,0x87,0x3D,0x07,0xD1,0x75,0xBC, -0xCF,0xF3,0x66,0x7E, -}; - - -/* subject:/OU=GlobalSign ECC Root CA - R5/O=GlobalSign/CN=GlobalSign */ -/* issuer :/OU=GlobalSign ECC Root CA - R5/O=GlobalSign/CN=GlobalSign */ - - -const unsigned char GlobalSign_ECC_Root_CA___R5_certificate[546]={ -0x30,0x82,0x02,0x1E,0x30,0x82,0x01,0xA4,0xA0,0x03,0x02,0x01,0x02,0x02,0x11,0x60, -0x59,0x49,0xE0,0x26,0x2E,0xBB,0x55,0xF9,0x0A,0x77,0x8A,0x71,0xF9,0x4A,0xD8,0x6C, -0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x50,0x31,0x24, -0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53, -0x69,0x67,0x6E,0x20,0x45,0x43,0x43,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20, -0x2D,0x20,0x52,0x35,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x47, -0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x31,0x13,0x30,0x11,0x06,0x03,0x55, -0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x30,0x1E, -0x17,0x0D,0x31,0x32,0x31,0x31,0x31,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17, -0x0D,0x33,0x38,0x30,0x31,0x31,0x39,0x30,0x33,0x31,0x34,0x30,0x37,0x5A,0x30,0x50, -0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x47,0x6C,0x6F,0x62,0x61, -0x6C,0x53,0x69,0x67,0x6E,0x20,0x45,0x43,0x43,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43, -0x41,0x20,0x2D,0x20,0x52,0x35,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13, -0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x31,0x13,0x30,0x11,0x06, -0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E, -0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05,0x2B, -0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0x47,0x45,0x0E,0x96,0xFB,0x7D,0x5D,0xBF, -0xE9,0x39,0xD1,0x21,0xF8,0x9F,0x0B,0xB6,0xD5,0x7B,0x1E,0x92,0x3A,0x48,0x59,0x1C, -0xF0,0x62,0x31,0x2D,0xC0,0x7A,0x28,0xFE,0x1A,0xA7,0x5C,0xB3,0xB6,0xCC,0x97,0xE7, -0x45,0xD4,0x58,0xFA,0xD1,0x77,0x6D,0x43,0xA2,0xC0,0x87,0x65,0x34,0x0A,0x1F,0x7A, -0xDD,0xEB,0x3C,0x33,0xA1,0xC5,0x9D,0x4D,0xA4,0x6F,0x41,0x95,0x38,0x7F,0xC9,0x1E, -0x84,0xEB,0xD1,0x9E,0x49,0x92,0x87,0x94,0x87,0x0C,0x3A,0x85,0x4A,0x66,0x9F,0x9D, -0x59,0x93,0x4D,0x97,0x61,0x06,0x86,0x4A,0xA3,0x42,0x30,0x40,0x30,0x0E,0x06,0x03, -0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03, -0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x3D,0xE6,0x29,0x48,0x9B,0xEA,0x07,0xCA, -0x21,0x44,0x4A,0x26,0xDE,0x6E,0xDE,0xD2,0x83,0xD0,0x9F,0x59,0x30,0x0A,0x06,0x08, -0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x68,0x00,0x30,0x65,0x02,0x31,0x00, -0xE5,0x69,0x12,0xC9,0x6E,0xDB,0xC6,0x31,0xBA,0x09,0x41,0xE1,0x97,0xF8,0xFB,0xFD, -0x9A,0xE2,0x7D,0x12,0xC9,0xED,0x7C,0x64,0xD3,0xCB,0x05,0x25,0x8B,0x56,0xD9,0xA0, -0xE7,0x5E,0x5D,0x4E,0x0B,0x83,0x9C,0x5B,0x76,0x29,0xA0,0x09,0x26,0x21,0x6A,0x62, -0x02,0x30,0x71,0xD2,0xB5,0x8F,0x5C,0xEA,0x3B,0xE1,0x78,0x09,0x85,0xA8,0x75,0x92, -0x3B,0xC8,0x5C,0xFD,0x48,0xEF,0x0D,0x74,0x22,0xA8,0x08,0xE2,0x6E,0xC5,0x49,0xCE, -0xC7,0x0C,0xBC,0xA7,0x61,0x69,0xF1,0xF7,0x3B,0xE1,0x2A,0xCB,0xF9,0x2B,0xF3,0x66, -0x90,0x37, -}; - - -/* subject:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware */ -/* issuer :/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware */ - - -const unsigned char UTN_USERFirst_Hardware_Root_CA_certificate[1144]={ -0x30,0x82,0x04,0x74,0x30,0x82,0x03,0x5C,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x44, -0xBE,0x0C,0x8B,0x50,0x00,0x24,0xB4,0x11,0xD3,0x36,0x2A,0xFE,0x65,0x0A,0xFD,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81, -0x97,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x08,0x13,0x02,0x55,0x54,0x31,0x17,0x30,0x15,0x06, -0x03,0x55,0x04,0x07,0x13,0x0E,0x53,0x61,0x6C,0x74,0x20,0x4C,0x61,0x6B,0x65,0x20, -0x43,0x69,0x74,0x79,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0A,0x13,0x15,0x54, -0x68,0x65,0x20,0x55,0x53,0x45,0x52,0x54,0x52,0x55,0x53,0x54,0x20,0x4E,0x65,0x74, -0x77,0x6F,0x72,0x6B,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x0B,0x13,0x18,0x68, -0x74,0x74,0x70,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x75,0x73,0x65,0x72,0x74,0x72, -0x75,0x73,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03, -0x13,0x16,0x55,0x54,0x4E,0x2D,0x55,0x53,0x45,0x52,0x46,0x69,0x72,0x73,0x74,0x2D, -0x48,0x61,0x72,0x64,0x77,0x61,0x72,0x65,0x30,0x1E,0x17,0x0D,0x39,0x39,0x30,0x37, -0x30,0x39,0x31,0x38,0x31,0x30,0x34,0x32,0x5A,0x17,0x0D,0x31,0x39,0x30,0x37,0x30, -0x39,0x31,0x38,0x31,0x39,0x32,0x32,0x5A,0x30,0x81,0x97,0x31,0x0B,0x30,0x09,0x06, -0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x08,0x13,0x02,0x55,0x54,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x07,0x13,0x0E, -0x53,0x61,0x6C,0x74,0x20,0x4C,0x61,0x6B,0x65,0x20,0x43,0x69,0x74,0x79,0x31,0x1E, -0x30,0x1C,0x06,0x03,0x55,0x04,0x0A,0x13,0x15,0x54,0x68,0x65,0x20,0x55,0x53,0x45, -0x52,0x54,0x52,0x55,0x53,0x54,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x21, -0x30,0x1F,0x06,0x03,0x55,0x04,0x0B,0x13,0x18,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F, -0x77,0x77,0x77,0x2E,0x75,0x73,0x65,0x72,0x74,0x72,0x75,0x73,0x74,0x2E,0x63,0x6F, -0x6D,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x55,0x54,0x4E,0x2D, -0x55,0x53,0x45,0x52,0x46,0x69,0x72,0x73,0x74,0x2D,0x48,0x61,0x72,0x64,0x77,0x61, -0x72,0x65,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82, -0x01,0x01,0x00,0xB1,0xF7,0xC3,0x38,0x3F,0xB4,0xA8,0x7F,0xCF,0x39,0x82,0x51,0x67, -0xD0,0x6D,0x9F,0xD2,0xFF,0x58,0xF3,0xE7,0x9F,0x2B,0xEC,0x0D,0x89,0x54,0x99,0xB9, -0x38,0x99,0x16,0xF7,0xE0,0x21,0x79,0x48,0xC2,0xBB,0x61,0x74,0x12,0x96,0x1D,0x3C, -0x6A,0x72,0xD5,0x3C,0x10,0x67,0x3A,0x39,0xED,0x2B,0x13,0xCD,0x66,0xEB,0x95,0x09, -0x33,0xA4,0x6C,0x97,0xB1,0xE8,0xC6,0xEC,0xC1,0x75,0x79,0x9C,0x46,0x5E,0x8D,0xAB, -0xD0,0x6A,0xFD,0xB9,0x2A,0x55,0x17,0x10,0x54,0xB3,0x19,0xF0,0x9A,0xF6,0xF1,0xB1, -0x5D,0xB6,0xA7,0x6D,0xFB,0xE0,0x71,0x17,0x6B,0xA2,0x88,0xFB,0x00,0xDF,0xFE,0x1A, -0x31,0x77,0x0C,0x9A,0x01,0x7A,0xB1,0x32,0xE3,0x2B,0x01,0x07,0x38,0x6E,0xC3,0xA5, -0x5E,0x23,0xBC,0x45,0x9B,0x7B,0x50,0xC1,0xC9,0x30,0x8F,0xDB,0xE5,0x2B,0x7A,0xD3, -0x5B,0xFB,0x33,0x40,0x1E,0xA0,0xD5,0x98,0x17,0xBC,0x8B,0x87,0xC3,0x89,0xD3,0x5D, -0xA0,0x8E,0xB2,0xAA,0xAA,0xF6,0x8E,0x69,0x88,0x06,0xC5,0xFA,0x89,0x21,0xF3,0x08, -0x9D,0x69,0x2E,0x09,0x33,0x9B,0x29,0x0D,0x46,0x0F,0x8C,0xCC,0x49,0x34,0xB0,0x69, -0x51,0xBD,0xF9,0x06,0xCD,0x68,0xAD,0x66,0x4C,0xBC,0x3E,0xAC,0x61,0xBD,0x0A,0x88, -0x0E,0xC8,0xDF,0x3D,0xEE,0x7C,0x04,0x4C,0x9D,0x0A,0x5E,0x6B,0x91,0xD6,0xEE,0xC7, -0xED,0x28,0x8D,0xAB,0x4D,0x87,0x89,0x73,0xD0,0x6E,0xA4,0xD0,0x1E,0x16,0x8B,0x14, -0xE1,0x76,0x44,0x03,0x7F,0x63,0xAC,0xE4,0xCD,0x49,0x9C,0xC5,0x92,0xF4,0xAB,0x32, -0xA1,0x48,0x5B,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0xB9,0x30,0x81,0xB6,0x30,0x0B, -0x06,0x03,0x55,0x1D,0x0F,0x04,0x04,0x03,0x02,0x01,0xC6,0x30,0x0F,0x06,0x03,0x55, -0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03, -0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xA1,0x72,0x5F,0x26,0x1B,0x28,0x98,0x43,0x95, -0x5D,0x07,0x37,0xD5,0x85,0x96,0x9D,0x4B,0xD2,0xC3,0x45,0x30,0x44,0x06,0x03,0x55, -0x1D,0x1F,0x04,0x3D,0x30,0x3B,0x30,0x39,0xA0,0x37,0xA0,0x35,0x86,0x33,0x68,0x74, -0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x75,0x73,0x65,0x72,0x74,0x72,0x75, -0x73,0x74,0x2E,0x63,0x6F,0x6D,0x2F,0x55,0x54,0x4E,0x2D,0x55,0x53,0x45,0x52,0x46, -0x69,0x72,0x73,0x74,0x2D,0x48,0x61,0x72,0x64,0x77,0x61,0x72,0x65,0x2E,0x63,0x72, -0x6C,0x30,0x31,0x06,0x03,0x55,0x1D,0x25,0x04,0x2A,0x30,0x28,0x06,0x08,0x2B,0x06, -0x01,0x05,0x05,0x07,0x03,0x01,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x05, -0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x06,0x06,0x08,0x2B,0x06,0x01,0x05, -0x05,0x07,0x03,0x07,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01, -0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x47,0x19,0x0F,0xDE,0x74,0xC6,0x99,0x97, -0xAF,0xFC,0xAD,0x28,0x5E,0x75,0x8E,0xEB,0x2D,0x67,0xEE,0x4E,0x7B,0x2B,0xD7,0x0C, -0xFF,0xF6,0xDE,0xCB,0x55,0xA2,0x0A,0xE1,0x4C,0x54,0x65,0x93,0x60,0x6B,0x9F,0x12, -0x9C,0xAD,0x5E,0x83,0x2C,0xEB,0x5A,0xAE,0xC0,0xE4,0x2D,0xF4,0x00,0x63,0x1D,0xB8, -0xC0,0x6C,0xF2,0xCF,0x49,0xBB,0x4D,0x93,0x6F,0x06,0xA6,0x0A,0x22,0xB2,0x49,0x62, -0x08,0x4E,0xFF,0xC8,0xC8,0x14,0xB2,0x88,0x16,0x5D,0xE7,0x01,0xE4,0x12,0x95,0xE5, -0x45,0x34,0xB3,0x8B,0x69,0xBD,0xCF,0xB4,0x85,0x8F,0x75,0x51,0x9E,0x7D,0x3A,0x38, -0x3A,0x14,0x48,0x12,0xC6,0xFB,0xA7,0x3B,0x1A,0x8D,0x0D,0x82,0x40,0x07,0xE8,0x04, -0x08,0x90,0xA1,0x89,0xCB,0x19,0x50,0xDF,0xCA,0x1C,0x01,0xBC,0x1D,0x04,0x19,0x7B, -0x10,0x76,0x97,0x3B,0xEE,0x90,0x90,0xCA,0xC4,0x0E,0x1F,0x16,0x6E,0x75,0xEF,0x33, -0xF8,0xD3,0x6F,0x5B,0x1E,0x96,0xE3,0xE0,0x74,0x77,0x74,0x7B,0x8A,0xA2,0x6E,0x2D, -0xDD,0x76,0xD6,0x39,0x30,0x82,0xF0,0xAB,0x9C,0x52,0xF2,0x2A,0xC7,0xAF,0x49,0x5E, -0x7E,0xC7,0x68,0xE5,0x82,0x81,0xC8,0x6A,0x27,0xF9,0x27,0x88,0x2A,0xD5,0x58,0x50, -0x95,0x1F,0xF0,0x3B,0x1C,0x57,0xBB,0x7D,0x14,0x39,0x62,0x2B,0x9A,0xC9,0x94,0x92, -0x2A,0xA3,0x22,0x0C,0xFF,0x89,0x26,0x7D,0x5F,0x23,0x2B,0x47,0xD7,0x15,0x1D,0xA9, -0x6A,0x9E,0x51,0x0D,0x2A,0x51,0x9E,0x81,0xF9,0xD4,0x3B,0x5E,0x70,0x12,0x7F,0x10, -0x32,0x9C,0x1E,0xBB,0x9D,0xF8,0x66,0xA8, -}; - - -/* subject:/OU=GlobalSign ECC Root CA - R4/O=GlobalSign/CN=GlobalSign */ -/* issuer :/OU=GlobalSign ECC Root CA - R4/O=GlobalSign/CN=GlobalSign */ - - -const unsigned char GlobalSign_ECC_Root_CA___R4_certificate[485]={ -0x30,0x82,0x01,0xE1,0x30,0x82,0x01,0x87,0xA0,0x03,0x02,0x01,0x02,0x02,0x11,0x2A, -0x38,0xA4,0x1C,0x96,0x0A,0x04,0xDE,0x42,0xB2,0x28,0xA5,0x0B,0xE8,0x34,0x98,0x02, -0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x02,0x30,0x50,0x31,0x24, -0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53, -0x69,0x67,0x6E,0x20,0x45,0x43,0x43,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20, -0x2D,0x20,0x52,0x34,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x47, -0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x31,0x13,0x30,0x11,0x06,0x03,0x55, -0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x30,0x1E, -0x17,0x0D,0x31,0x32,0x31,0x31,0x31,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17, -0x0D,0x33,0x38,0x30,0x31,0x31,0x39,0x30,0x33,0x31,0x34,0x30,0x37,0x5A,0x30,0x50, -0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x47,0x6C,0x6F,0x62,0x61, -0x6C,0x53,0x69,0x67,0x6E,0x20,0x45,0x43,0x43,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43, -0x41,0x20,0x2D,0x20,0x52,0x34,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13, -0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x31,0x13,0x30,0x11,0x06, -0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E, -0x30,0x59,0x30,0x13,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x08,0x2A, -0x86,0x48,0xCE,0x3D,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0xB8,0xC6,0x79,0xD3,0x8F, -0x6C,0x25,0x0E,0x9F,0x2E,0x39,0x19,0x1C,0x03,0xA4,0xAE,0x9A,0xE5,0x39,0x07,0x09, -0x16,0xCA,0x63,0xB1,0xB9,0x86,0xF8,0x8A,0x57,0xC1,0x57,0xCE,0x42,0xFA,0x73,0xA1, -0xF7,0x65,0x42,0xFF,0x1E,0xC1,0x00,0xB2,0x6E,0x73,0x0E,0xFF,0xC7,0x21,0xE5,0x18, -0xA4,0xAA,0xD9,0x71,0x3F,0xA8,0xD4,0xB9,0xCE,0x8C,0x1D,0xA3,0x42,0x30,0x40,0x30, -0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30, -0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF, -0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x54,0xB0,0x7B,0xAD,0x45, -0xB8,0xE2,0x40,0x7F,0xFB,0x0A,0x6E,0xFB,0xBE,0x33,0xC9,0x3C,0xA3,0x84,0xD5,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x02,0x03,0x48,0x00,0x30,0x45, -0x02,0x21,0x00,0xDC,0x92,0xA1,0xA0,0x13,0xA6,0xCF,0x03,0xB0,0xE6,0xC4,0x21,0x97, -0x90,0xFA,0x14,0x57,0x2D,0x03,0xEC,0xEE,0x3C,0xD3,0x6E,0xCA,0xA8,0x6C,0x76,0xBC, -0xA2,0xDE,0xBB,0x02,0x20,0x27,0xA8,0x85,0x27,0x35,0x9B,0x56,0xC6,0xA3,0xF2,0x47, -0xD2,0xB7,0x6E,0x1B,0x02,0x00,0x17,0xAA,0x67,0xA6,0x15,0x91,0xDE,0xFA,0x94,0xEC, -0x7B,0x0B,0xF8,0x9F,0x84, -}; - - -/* subject:/C=DE/O=TC TrustCenter GmbH/OU=TC TrustCenter Universal CA/CN=TC TrustCenter Universal CA I */ -/* issuer :/C=DE/O=TC TrustCenter GmbH/OU=TC TrustCenter Universal CA/CN=TC TrustCenter Universal CA I */ - - -const unsigned char TC_TrustCenter_Universal_CA_I_certificate[993]={ -0x30,0x82,0x03,0xDD,0x30,0x82,0x02,0xC5,0xA0,0x03,0x02,0x01,0x02,0x02,0x0E,0x1D, -0xA2,0x00,0x01,0x00,0x02,0xEC,0xB7,0x60,0x80,0x78,0x8D,0xB6,0x06,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x79,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x44,0x45,0x31,0x1C,0x30,0x1A,0x06, -0x03,0x55,0x04,0x0A,0x13,0x13,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65, -0x6E,0x74,0x65,0x72,0x20,0x47,0x6D,0x62,0x48,0x31,0x24,0x30,0x22,0x06,0x03,0x55, -0x04,0x0B,0x13,0x1B,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74, -0x65,0x72,0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73,0x61,0x6C,0x20,0x43,0x41,0x31, -0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x03,0x13,0x1D,0x54,0x43,0x20,0x54,0x72,0x75, -0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73, -0x61,0x6C,0x20,0x43,0x41,0x20,0x49,0x30,0x1E,0x17,0x0D,0x30,0x36,0x30,0x33,0x32, -0x32,0x31,0x35,0x35,0x34,0x32,0x38,0x5A,0x17,0x0D,0x32,0x35,0x31,0x32,0x33,0x31, -0x32,0x32,0x35,0x39,0x35,0x39,0x5A,0x30,0x79,0x31,0x0B,0x30,0x09,0x06,0x03,0x55, -0x04,0x06,0x13,0x02,0x44,0x45,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x0A,0x13, -0x13,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x20, -0x47,0x6D,0x62,0x48,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x54, -0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x20,0x55,0x6E, -0x69,0x76,0x65,0x72,0x73,0x61,0x6C,0x20,0x43,0x41,0x31,0x26,0x30,0x24,0x06,0x03, -0x55,0x04,0x03,0x13,0x1D,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E, -0x74,0x65,0x72,0x20,0x55,0x6E,0x69,0x76,0x65,0x72,0x73,0x61,0x6C,0x20,0x43,0x41, -0x20,0x49,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82, -0x01,0x01,0x00,0xA4,0x77,0x23,0x96,0x44,0xAF,0x90,0xF4,0x31,0xA7,0x10,0xF4,0x26, -0x87,0x9C,0xF3,0x38,0xD9,0x0F,0x5E,0xDE,0xCF,0x41,0xE8,0x31,0xAD,0xC6,0x74,0x91, -0x24,0x96,0x78,0x1E,0x09,0xA0,0x9B,0x9A,0x95,0x4A,0x4A,0xF5,0x62,0x7C,0x02,0xA8, -0xCA,0xAC,0xFB,0x5A,0x04,0x76,0x39,0xDE,0x5F,0xF1,0xF9,0xB3,0xBF,0xF3,0x03,0x58, -0x55,0xD2,0xAA,0xB7,0xE3,0x04,0x22,0xD1,0xF8,0x94,0xDA,0x22,0x08,0x00,0x8D,0xD3, -0x7C,0x26,0x5D,0xCC,0x77,0x79,0xE7,0x2C,0x78,0x39,0xA8,0x26,0x73,0x0E,0xA2,0x5D, -0x25,0x69,0x85,0x4F,0x55,0x0E,0x9A,0xEF,0xC6,0xB9,0x44,0xE1,0x57,0x3D,0xDF,0x1F, -0x54,0x22,0xE5,0x6F,0x65,0xAA,0x33,0x84,0x3A,0xF3,0xCE,0x7A,0xBE,0x55,0x97,0xAE, -0x8D,0x12,0x0F,0x14,0x33,0xE2,0x50,0x70,0xC3,0x49,0x87,0x13,0xBC,0x51,0xDE,0xD7, -0x98,0x12,0x5A,0xEF,0x3A,0x83,0x33,0x92,0x06,0x75,0x8B,0x92,0x7C,0x12,0x68,0x7B, -0x70,0x6A,0x0F,0xB5,0x9B,0xB6,0x77,0x5B,0x48,0x59,0x9D,0xE4,0xEF,0x5A,0xAD,0xF3, -0xC1,0x9E,0xD4,0xD7,0x45,0x4E,0xCA,0x56,0x34,0x21,0xBC,0x3E,0x17,0x5B,0x6F,0x77, -0x0C,0x48,0x01,0x43,0x29,0xB0,0xDD,0x3F,0x96,0x6E,0xE6,0x95,0xAA,0x0C,0xC0,0x20, -0xB6,0xFD,0x3E,0x36,0x27,0x9C,0xE3,0x5C,0xCF,0x4E,0x81,0xDC,0x19,0xBB,0x91,0x90, -0x7D,0xEC,0xE6,0x97,0x04,0x1E,0x93,0xCC,0x22,0x49,0xD7,0x97,0x86,0xB6,0x13,0x0A, -0x3C,0x43,0x23,0x77,0x7E,0xF0,0xDC,0xE6,0xCD,0x24,0x1F,0x3B,0x83,0x9B,0x34,0x3A, -0x83,0x34,0xE3,0x02,0x03,0x01,0x00,0x01,0xA3,0x63,0x30,0x61,0x30,0x1F,0x06,0x03, -0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x92,0xA4,0x75,0x2C,0xA4,0x9E,0xBE, -0x81,0x44,0xEB,0x79,0xFC,0x8A,0xC5,0x95,0xA5,0xEB,0x10,0x75,0x73,0x30,0x0F,0x06, -0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E, -0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x1D, -0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x92,0xA4,0x75,0x2C,0xA4,0x9E,0xBE, -0x81,0x44,0xEB,0x79,0xFC,0x8A,0xC5,0x95,0xA5,0xEB,0x10,0x75,0x73,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01, -0x00,0x28,0xD2,0xE0,0x86,0xD5,0xE6,0xF8,0x7B,0xF0,0x97,0xDC,0x22,0x6B,0x3B,0x95, -0x14,0x56,0x0F,0x11,0x30,0xA5,0x9A,0x4F,0x3A,0xB0,0x3A,0xE0,0x06,0xCB,0x65,0xF5, -0xED,0xC6,0x97,0x27,0xFE,0x25,0xF2,0x57,0xE6,0x5E,0x95,0x8C,0x3E,0x64,0x60,0x15, -0x5A,0x7F,0x2F,0x0D,0x01,0xC5,0xB1,0x60,0xFD,0x45,0x35,0xCF,0xF0,0xB2,0xBF,0x06, -0xD9,0xEF,0x5A,0xBE,0xB3,0x62,0x21,0xB4,0xD7,0xAB,0x35,0x7C,0x53,0x3E,0xA6,0x27, -0xF1,0xA1,0x2D,0xDA,0x1A,0x23,0x9D,0xCC,0xDD,0xEC,0x3C,0x2D,0x9E,0x27,0x34,0x5D, -0x0F,0xC2,0x36,0x79,0xBC,0xC9,0x4A,0x62,0x2D,0xED,0x6B,0xD9,0x7D,0x41,0x43,0x7C, -0xB6,0xAA,0xCA,0xED,0x61,0xB1,0x37,0x82,0x15,0x09,0x1A,0x8A,0x16,0x30,0xD8,0xEC, -0xC9,0xD6,0x47,0x72,0x78,0x4B,0x10,0x46,0x14,0x8E,0x5F,0x0E,0xAF,0xEC,0xC7,0x2F, -0xAB,0x10,0xD7,0xB6,0xF1,0x6E,0xEC,0x86,0xB2,0xC2,0xE8,0x0D,0x92,0x73,0xDC,0xA2, -0xF4,0x0F,0x3A,0xBF,0x61,0x23,0x10,0x89,0x9C,0x48,0x40,0x6E,0x70,0x00,0xB3,0xD3, -0xBA,0x37,0x44,0x58,0x11,0x7A,0x02,0x6A,0x88,0xF0,0x37,0x34,0xF0,0x19,0xE9,0xAC, -0xD4,0x65,0x73,0xF6,0x69,0x8C,0x64,0x94,0x3A,0x79,0x85,0x29,0xB0,0x16,0x2B,0x0C, -0x82,0x3F,0x06,0x9C,0xC7,0xFD,0x10,0x2B,0x9E,0x0F,0x2C,0xB6,0x9E,0xE3,0x15,0xBF, -0xD9,0x36,0x1C,0xBA,0x25,0x1A,0x52,0x3D,0x1A,0xEC,0x22,0x0C,0x1C,0xE0,0xA4,0xA2, -0x3D,0xF0,0xE8,0x39,0xCF,0x81,0xC0,0x7B,0xED,0x5D,0x1F,0x6F,0xC5,0xD0,0x0B,0xD7, -0x98, -}; - - -/* subject:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=Trusted Certificate Services */ -/* issuer :/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=Trusted Certificate Services */ - - -const unsigned char Comodo_Trusted_Services_root_certificate[1095]={ -0x30,0x82,0x04,0x43,0x30,0x82,0x03,0x2B,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x7F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x0C,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72, -0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06, -0x03,0x55,0x04,0x07,0x0C,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30, -0x18,0x06,0x03,0x55,0x04,0x0A,0x0C,0x11,0x43,0x6F,0x6D,0x6F,0x64,0x6F,0x20,0x43, -0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x25,0x30,0x23,0x06,0x03,0x55, -0x04,0x03,0x0C,0x1C,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73, -0x30,0x1E,0x17,0x0D,0x30,0x34,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30, -0x5A,0x17,0x0D,0x32,0x38,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A, -0x30,0x7F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31, -0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x0C,0x12,0x47,0x72,0x65,0x61,0x74,0x65, -0x72,0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E, -0x06,0x03,0x55,0x04,0x07,0x0C,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A, -0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x0C,0x11,0x43,0x6F,0x6D,0x6F,0x64,0x6F,0x20, -0x43,0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x25,0x30,0x23,0x06,0x03, -0x55,0x04,0x03,0x0C,0x1C,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65, -0x73,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, -0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01, -0x01,0x00,0xDF,0x71,0x6F,0x36,0x58,0x53,0x5A,0xF2,0x36,0x54,0x57,0x80,0xC4,0x74, -0x08,0x20,0xED,0x18,0x7F,0x2A,0x1D,0xE6,0x35,0x9A,0x1E,0x25,0xAC,0x9C,0xE5,0x96, -0x7E,0x72,0x52,0xA0,0x15,0x42,0xDB,0x59,0xDD,0x64,0x7A,0x1A,0xD0,0xB8,0x7B,0xDD, -0x39,0x15,0xBC,0x55,0x48,0xC4,0xED,0x3A,0x00,0xEA,0x31,0x11,0xBA,0xF2,0x71,0x74, -0x1A,0x67,0xB8,0xCF,0x33,0xCC,0xA8,0x31,0xAF,0xA3,0xE3,0xD7,0x7F,0xBF,0x33,0x2D, -0x4C,0x6A,0x3C,0xEC,0x8B,0xC3,0x92,0xD2,0x53,0x77,0x24,0x74,0x9C,0x07,0x6E,0x70, -0xFC,0xBD,0x0B,0x5B,0x76,0xBA,0x5F,0xF2,0xFF,0xD7,0x37,0x4B,0x4A,0x60,0x78,0xF7, -0xF0,0xFA,0xCA,0x70,0xB4,0xEA,0x59,0xAA,0xA3,0xCE,0x48,0x2F,0xA9,0xC3,0xB2,0x0B, -0x7E,0x17,0x72,0x16,0x0C,0xA6,0x07,0x0C,0x1B,0x38,0xCF,0xC9,0x62,0xB7,0x3F,0xA0, -0x93,0xA5,0x87,0x41,0xF2,0xB7,0x70,0x40,0x77,0xD8,0xBE,0x14,0x7C,0xE3,0xA8,0xC0, -0x7A,0x8E,0xE9,0x63,0x6A,0xD1,0x0F,0x9A,0xC6,0xD2,0xF4,0x8B,0x3A,0x14,0x04,0x56, -0xD4,0xED,0xB8,0xCC,0x6E,0xF5,0xFB,0xE2,0x2C,0x58,0xBD,0x7F,0x4F,0x6B,0x2B,0xF7, -0x60,0x24,0x58,0x24,0xCE,0x26,0xEF,0x34,0x91,0x3A,0xD5,0xE3,0x81,0xD0,0xB2,0xF0, -0x04,0x02,0xD7,0x5B,0xB7,0x3E,0x92,0xAC,0x6B,0x12,0x8A,0xF9,0xE4,0x05,0xB0,0x3B, -0x91,0x49,0x5C,0xB2,0xEB,0x53,0xEA,0xF8,0x9F,0x47,0x86,0xEE,0xBF,0x95,0xC0,0xC0, -0x06,0x9F,0xD2,0x5B,0x5E,0x11,0x1B,0xF4,0xC7,0x04,0x35,0x29,0xD2,0x55,0x5C,0xE4, -0xED,0xEB,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0xC9,0x30,0x81,0xC6,0x30,0x1D,0x06, -0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xC5,0x7B,0x58,0xBD,0xED,0xDA,0x25,0x69, -0xD2,0xF7,0x59,0x16,0xA8,0xB3,0x32,0xC0,0x7B,0x27,0x5B,0xF4,0x30,0x0E,0x06,0x03, -0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03, -0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x81,0x83, -0x06,0x03,0x55,0x1D,0x1F,0x04,0x7C,0x30,0x7A,0x30,0x3C,0xA0,0x3A,0xA0,0x38,0x86, -0x36,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x63,0x6F,0x6D,0x6F, -0x64,0x6F,0x63,0x61,0x2E,0x63,0x6F,0x6D,0x2F,0x54,0x72,0x75,0x73,0x74,0x65,0x64, -0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x53,0x65,0x72,0x76,0x69, -0x63,0x65,0x73,0x2E,0x63,0x72,0x6C,0x30,0x3A,0xA0,0x38,0xA0,0x36,0x86,0x34,0x68, -0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x63,0x6F,0x6D,0x6F,0x64,0x6F, -0x2E,0x6E,0x65,0x74,0x2F,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x43,0x65,0x72,0x74, -0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x2E, -0x63,0x72,0x6C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, -0x05,0x00,0x03,0x82,0x01,0x01,0x00,0xC8,0x93,0x81,0x3B,0x89,0xB4,0xAF,0xB8,0x84, -0x12,0x4C,0x8D,0xD2,0xF0,0xDB,0x70,0xBA,0x57,0x86,0x15,0x34,0x10,0xB9,0x2F,0x7F, -0x1E,0xB0,0xA8,0x89,0x60,0xA1,0x8A,0xC2,0x77,0x0C,0x50,0x4A,0x9B,0x00,0x8B,0xD8, -0x8B,0xF4,0x41,0xE2,0xD0,0x83,0x8A,0x4A,0x1C,0x14,0x06,0xB0,0xA3,0x68,0x05,0x70, -0x31,0x30,0xA7,0x53,0x9B,0x0E,0xE9,0x4A,0xA0,0x58,0x69,0x67,0x0E,0xAE,0x9D,0xF6, -0xA5,0x2C,0x41,0xBF,0x3C,0x06,0x6B,0xE4,0x59,0xCC,0x6D,0x10,0xF1,0x96,0x6F,0x1F, -0xDF,0xF4,0x04,0x02,0xA4,0x9F,0x45,0x3E,0xC8,0xD8,0xFA,0x36,0x46,0x44,0x50,0x3F, -0x82,0x97,0x91,0x1F,0x28,0xDB,0x18,0x11,0x8C,0x2A,0xE4,0x65,0x83,0x57,0x12,0x12, -0x8C,0x17,0x3F,0x94,0x36,0xFE,0x5D,0xB0,0xC0,0x04,0x77,0x13,0xB8,0xF4,0x15,0xD5, -0x3F,0x38,0xCC,0x94,0x3A,0x55,0xD0,0xAC,0x98,0xF5,0xBA,0x00,0x5F,0xE0,0x86,0x19, -0x81,0x78,0x2F,0x28,0xC0,0x7E,0xD3,0xCC,0x42,0x0A,0xF5,0xAE,0x50,0xA0,0xD1,0x3E, -0xC6,0xA1,0x71,0xEC,0x3F,0xA0,0x20,0x8C,0x66,0x3A,0x89,0xB4,0x8E,0xD4,0xD8,0xB1, -0x4D,0x25,0x47,0xEE,0x2F,0x88,0xC8,0xB5,0xE1,0x05,0x45,0xC0,0xBE,0x14,0x71,0xDE, -0x7A,0xFD,0x8E,0x7B,0x7D,0x4D,0x08,0x96,0xA5,0x12,0x73,0xF0,0x2D,0xCA,0x37,0x27, -0x74,0x12,0x27,0x4C,0xCB,0xB6,0x97,0xE9,0xD9,0xAE,0x08,0x6D,0x5A,0x39,0x40,0xDD, -0x05,0x47,0x75,0x6A,0x5A,0x21,0xB3,0xA3,0x18,0xCF,0x4E,0xF7,0x2E,0x57,0xB7,0x98, -0x70,0x5E,0xC8,0xC4,0x78,0xB0,0x62, -}; - - -/* subject:/C=US/O=Entrust, Inc./OU=www.entrust.net/CPS is incorporated by reference/OU=(c) 2006 Entrust, Inc./CN=Entrust Root Certification Authority */ -/* issuer :/C=US/O=Entrust, Inc./OU=www.entrust.net/CPS is incorporated by reference/OU=(c) 2006 Entrust, Inc./CN=Entrust Root Certification Authority */ - - -const unsigned char Entrust_Root_Certification_Authority_certificate[1173]={ -0x30,0x82,0x04,0x91,0x30,0x82,0x03,0x79,0xA0,0x03,0x02,0x01,0x02,0x02,0x04,0x45, -0x6B,0x50,0x54,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, -0x05,0x00,0x30,0x81,0xB0,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02, -0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x45,0x6E,0x74, -0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x39,0x30,0x37,0x06,0x03, -0x55,0x04,0x0B,0x13,0x30,0x77,0x77,0x77,0x2E,0x65,0x6E,0x74,0x72,0x75,0x73,0x74, -0x2E,0x6E,0x65,0x74,0x2F,0x43,0x50,0x53,0x20,0x69,0x73,0x20,0x69,0x6E,0x63,0x6F, -0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65, -0x72,0x65,0x6E,0x63,0x65,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x0B,0x13,0x16, -0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x36,0x20,0x45,0x6E,0x74,0x72,0x75,0x73,0x74, -0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2D,0x30,0x2B,0x06,0x03,0x55,0x04,0x03,0x13, -0x24,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65, -0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68, -0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x31,0x32,0x37,0x32, -0x30,0x32,0x33,0x34,0x32,0x5A,0x17,0x0D,0x32,0x36,0x31,0x31,0x32,0x37,0x32,0x30, -0x35,0x33,0x34,0x32,0x5A,0x30,0x81,0xB0,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04, -0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D, -0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x39,0x30, -0x37,0x06,0x03,0x55,0x04,0x0B,0x13,0x30,0x77,0x77,0x77,0x2E,0x65,0x6E,0x74,0x72, -0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x2F,0x43,0x50,0x53,0x20,0x69,0x73,0x20,0x69, -0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x72, -0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04, -0x0B,0x13,0x16,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x36,0x20,0x45,0x6E,0x74,0x72, -0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2D,0x30,0x2B,0x06,0x03,0x55, -0x04,0x03,0x13,0x24,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74, -0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41, -0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09, -0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00, -0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xB6,0x95,0xB6,0x43,0x42,0xFA,0xC6, -0x6D,0x2A,0x6F,0x48,0xDF,0x94,0x4C,0x39,0x57,0x05,0xEE,0xC3,0x79,0x11,0x41,0x68, -0x36,0xED,0xEC,0xFE,0x9A,0x01,0x8F,0xA1,0x38,0x28,0xFC,0xF7,0x10,0x46,0x66,0x2E, -0x4D,0x1E,0x1A,0xB1,0x1A,0x4E,0xC6,0xD1,0xC0,0x95,0x88,0xB0,0xC9,0xFF,0x31,0x8B, -0x33,0x03,0xDB,0xB7,0x83,0x7B,0x3E,0x20,0x84,0x5E,0xED,0xB2,0x56,0x28,0xA7,0xF8, -0xE0,0xB9,0x40,0x71,0x37,0xC5,0xCB,0x47,0x0E,0x97,0x2A,0x68,0xC0,0x22,0x95,0x62, -0x15,0xDB,0x47,0xD9,0xF5,0xD0,0x2B,0xFF,0x82,0x4B,0xC9,0xAD,0x3E,0xDE,0x4C,0xDB, -0x90,0x80,0x50,0x3F,0x09,0x8A,0x84,0x00,0xEC,0x30,0x0A,0x3D,0x18,0xCD,0xFB,0xFD, -0x2A,0x59,0x9A,0x23,0x95,0x17,0x2C,0x45,0x9E,0x1F,0x6E,0x43,0x79,0x6D,0x0C,0x5C, -0x98,0xFE,0x48,0xA7,0xC5,0x23,0x47,0x5C,0x5E,0xFD,0x6E,0xE7,0x1E,0xB4,0xF6,0x68, -0x45,0xD1,0x86,0x83,0x5B,0xA2,0x8A,0x8D,0xB1,0xE3,0x29,0x80,0xFE,0x25,0x71,0x88, -0xAD,0xBE,0xBC,0x8F,0xAC,0x52,0x96,0x4B,0xAA,0x51,0x8D,0xE4,0x13,0x31,0x19,0xE8, -0x4E,0x4D,0x9F,0xDB,0xAC,0xB3,0x6A,0xD5,0xBC,0x39,0x54,0x71,0xCA,0x7A,0x7A,0x7F, -0x90,0xDD,0x7D,0x1D,0x80,0xD9,0x81,0xBB,0x59,0x26,0xC2,0x11,0xFE,0xE6,0x93,0xE2, -0xF7,0x80,0xE4,0x65,0xFB,0x34,0x37,0x0E,0x29,0x80,0x70,0x4D,0xAF,0x38,0x86,0x2E, -0x9E,0x7F,0x57,0xAF,0x9E,0x17,0xAE,0xEB,0x1C,0xCB,0x28,0x21,0x5F,0xB6,0x1C,0xD8, -0xE7,0xA2,0x04,0x22,0xF9,0xD3,0xDA,0xD8,0xCB,0x02,0x03,0x01,0x00,0x01,0xA3,0x81, -0xB0,0x30,0x81,0xAD,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04, -0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05, -0x30,0x03,0x01,0x01,0xFF,0x30,0x2B,0x06,0x03,0x55,0x1D,0x10,0x04,0x24,0x30,0x22, -0x80,0x0F,0x32,0x30,0x30,0x36,0x31,0x31,0x32,0x37,0x32,0x30,0x32,0x33,0x34,0x32, -0x5A,0x81,0x0F,0x32,0x30,0x32,0x36,0x31,0x31,0x32,0x37,0x32,0x30,0x35,0x33,0x34, -0x32,0x5A,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x68, -0x90,0xE4,0x67,0xA4,0xA6,0x53,0x80,0xC7,0x86,0x66,0xA4,0xF1,0xF7,0x4B,0x43,0xFB, -0x84,0xBD,0x6D,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x68,0x90, -0xE4,0x67,0xA4,0xA6,0x53,0x80,0xC7,0x86,0x66,0xA4,0xF1,0xF7,0x4B,0x43,0xFB,0x84, -0xBD,0x6D,0x30,0x1D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x41,0x00,0x04, -0x10,0x30,0x0E,0x1B,0x08,0x56,0x37,0x2E,0x31,0x3A,0x34,0x2E,0x30,0x03,0x02,0x04, -0x90,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00, -0x03,0x82,0x01,0x01,0x00,0x93,0xD4,0x30,0xB0,0xD7,0x03,0x20,0x2A,0xD0,0xF9,0x63, -0xE8,0x91,0x0C,0x05,0x20,0xA9,0x5F,0x19,0xCA,0x7B,0x72,0x4E,0xD4,0xB1,0xDB,0xD0, -0x96,0xFB,0x54,0x5A,0x19,0x2C,0x0C,0x08,0xF7,0xB2,0xBC,0x85,0xA8,0x9D,0x7F,0x6D, -0x3B,0x52,0xB3,0x2A,0xDB,0xE7,0xD4,0x84,0x8C,0x63,0xF6,0x0F,0xCB,0x26,0x01,0x91, -0x50,0x6C,0xF4,0x5F,0x14,0xE2,0x93,0x74,0xC0,0x13,0x9E,0x30,0x3A,0x50,0xE3,0xB4, -0x60,0xC5,0x1C,0xF0,0x22,0x44,0x8D,0x71,0x47,0xAC,0xC8,0x1A,0xC9,0xE9,0x9B,0x9A, -0x00,0x60,0x13,0xFF,0x70,0x7E,0x5F,0x11,0x4D,0x49,0x1B,0xB3,0x15,0x52,0x7B,0xC9, -0x54,0xDA,0xBF,0x9D,0x95,0xAF,0x6B,0x9A,0xD8,0x9E,0xE9,0xF1,0xE4,0x43,0x8D,0xE2, -0x11,0x44,0x3A,0xBF,0xAF,0xBD,0x83,0x42,0x73,0x52,0x8B,0xAA,0xBB,0xA7,0x29,0xCF, -0xF5,0x64,0x1C,0x0A,0x4D,0xD1,0xBC,0xAA,0xAC,0x9F,0x2A,0xD0,0xFF,0x7F,0x7F,0xDA, -0x7D,0xEA,0xB1,0xED,0x30,0x25,0xC1,0x84,0xDA,0x34,0xD2,0x5B,0x78,0x83,0x56,0xEC, -0x9C,0x36,0xC3,0x26,0xE2,0x11,0xF6,0x67,0x49,0x1D,0x92,0xAB,0x8C,0xFB,0xEB,0xFF, -0x7A,0xEE,0x85,0x4A,0xA7,0x50,0x80,0xF0,0xA7,0x5C,0x4A,0x94,0x2E,0x5F,0x05,0x99, -0x3C,0x52,0x41,0xE0,0xCD,0xB4,0x63,0xCF,0x01,0x43,0xBA,0x9C,0x83,0xDC,0x8F,0x60, -0x3B,0xF3,0x5A,0xB4,0xB4,0x7B,0xAE,0xDA,0x0B,0x90,0x38,0x75,0xEF,0x81,0x1D,0x66, -0xD2,0xF7,0x57,0x70,0x36,0xB3,0xBF,0xFC,0x28,0xAF,0x71,0x25,0x85,0x5B,0x13,0xFE, -0x1E,0x7F,0x5A,0xB4,0x3C, -}; - - -/* subject:/C=DE/O=TC TrustCenter GmbH/OU=TC TrustCenter Class 2 CA/CN=TC TrustCenter Class 2 CA II */ -/* issuer :/C=DE/O=TC TrustCenter GmbH/OU=TC TrustCenter Class 2 CA/CN=TC TrustCenter Class 2 CA II */ - - -const unsigned char TC_TrustCenter_Class_2_CA_II_certificate[1198]={ -0x30,0x82,0x04,0xAA,0x30,0x82,0x03,0x92,0xA0,0x03,0x02,0x01,0x02,0x02,0x0E,0x2E, -0x6A,0x00,0x01,0x00,0x02,0x1F,0xD7,0x52,0x21,0x2C,0x11,0x5C,0x3B,0x30,0x0D,0x06, -0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x76,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x44,0x45,0x31,0x1C,0x30,0x1A,0x06, -0x03,0x55,0x04,0x0A,0x13,0x13,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65, -0x6E,0x74,0x65,0x72,0x20,0x47,0x6D,0x62,0x48,0x31,0x22,0x30,0x20,0x06,0x03,0x55, -0x04,0x0B,0x13,0x19,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74, -0x65,0x72,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43,0x41,0x31,0x25,0x30, -0x23,0x06,0x03,0x55,0x04,0x03,0x13,0x1C,0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74, -0x43,0x65,0x6E,0x74,0x65,0x72,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43, -0x41,0x20,0x49,0x49,0x30,0x1E,0x17,0x0D,0x30,0x36,0x30,0x31,0x31,0x32,0x31,0x34, -0x33,0x38,0x34,0x33,0x5A,0x17,0x0D,0x32,0x35,0x31,0x32,0x33,0x31,0x32,0x32,0x35, -0x39,0x35,0x39,0x5A,0x30,0x76,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13, -0x02,0x44,0x45,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x0A,0x13,0x13,0x54,0x43, -0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x20,0x47,0x6D,0x62, -0x48,0x31,0x22,0x30,0x20,0x06,0x03,0x55,0x04,0x0B,0x13,0x19,0x54,0x43,0x20,0x54, -0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x20,0x43,0x6C,0x61,0x73,0x73, -0x20,0x32,0x20,0x43,0x41,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x03,0x13,0x1C, -0x54,0x43,0x20,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x20,0x43, -0x6C,0x61,0x73,0x73,0x20,0x32,0x20,0x43,0x41,0x20,0x49,0x49,0x30,0x82,0x01,0x22, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03, -0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAB,0x80,0x87, -0x9B,0x8E,0xF0,0xC3,0x7C,0x87,0xD7,0xE8,0x24,0x82,0x11,0xB3,0x3C,0xDD,0x43,0x62, -0xEE,0xF8,0xC3,0x45,0xDA,0xE8,0xE1,0xA0,0x5F,0xD1,0x2A,0xB2,0xEA,0x93,0x68,0xDF, -0xB4,0xC8,0xD6,0x43,0xE9,0xC4,0x75,0x59,0x7F,0xFC,0xE1,0x1D,0xF8,0x31,0x70,0x23, -0x1B,0x88,0x9E,0x27,0xB9,0x7B,0xFD,0x3A,0xD2,0xC9,0xA9,0xE9,0x14,0x2F,0x90,0xBE, -0x03,0x52,0xC1,0x49,0xCD,0xF6,0xFD,0xE4,0x08,0x66,0x0B,0x57,0x8A,0xA2,0x42,0xA0, -0xB8,0xD5,0x7F,0x69,0x5C,0x90,0x32,0xB2,0x97,0x0D,0xCA,0x4A,0xDC,0x46,0x3E,0x02, -0x55,0x89,0x53,0xE3,0x1A,0x5A,0xCB,0x36,0xC6,0x07,0x56,0xF7,0x8C,0xCF,0x11,0xF4, -0x4C,0xBB,0x30,0x70,0x04,0x95,0xA5,0xF6,0x39,0x8C,0xFD,0x73,0x81,0x08,0x7D,0x89, -0x5E,0x32,0x1E,0x22,0xA9,0x22,0x45,0x4B,0xB0,0x66,0x2E,0x30,0xCC,0x9F,0x65,0xFD, -0xFC,0xCB,0x81,0xA9,0xF1,0xE0,0x3B,0xAF,0xA3,0x86,0xD1,0x89,0xEA,0xC4,0x45,0x79, -0x50,0x5D,0xAE,0xE9,0x21,0x74,0x92,0x4D,0x8B,0x59,0x82,0x8F,0x94,0xE3,0xE9,0x4A, -0xF1,0xE7,0x49,0xB0,0x14,0xE3,0xF5,0x62,0xCB,0xD5,0x72,0xBD,0x1F,0xB9,0xD2,0x9F, -0xA0,0xCD,0xA8,0xFA,0x01,0xC8,0xD9,0x0D,0xDF,0xDA,0xFC,0x47,0x9D,0xB3,0xC8,0x54, -0xDF,0x49,0x4A,0xF1,0x21,0xA9,0xFE,0x18,0x4E,0xEE,0x48,0xD4,0x19,0xBB,0xEF,0x7D, -0xE4,0xE2,0x9D,0xCB,0x5B,0xB6,0x6E,0xFF,0xE3,0xCD,0x5A,0xE7,0x74,0x82,0x05,0xBA, -0x80,0x25,0x38,0xCB,0xE4,0x69,0x9E,0xAF,0x41,0xAA,0x1A,0x84,0xF5,0x02,0x03,0x01, -0x00,0x01,0xA3,0x82,0x01,0x34,0x30,0x82,0x01,0x30,0x30,0x0F,0x06,0x03,0x55,0x1D, -0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E,0x06,0x03,0x55, -0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D,0x06,0x03,0x55, -0x1D,0x0E,0x04,0x16,0x04,0x14,0xE3,0xAB,0x54,0x4C,0x80,0xA1,0xDB,0x56,0x43,0xB7, -0x91,0x4A,0xCB,0xF3,0x82,0x7A,0x13,0x5C,0x08,0xAB,0x30,0x81,0xED,0x06,0x03,0x55, -0x1D,0x1F,0x04,0x81,0xE5,0x30,0x81,0xE2,0x30,0x81,0xDF,0xA0,0x81,0xDC,0xA0,0x81, -0xD9,0x86,0x35,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x74,0x72, -0x75,0x73,0x74,0x63,0x65,0x6E,0x74,0x65,0x72,0x2E,0x64,0x65,0x2F,0x63,0x72,0x6C, -0x2F,0x76,0x32,0x2F,0x74,0x63,0x5F,0x63,0x6C,0x61,0x73,0x73,0x5F,0x32,0x5F,0x63, -0x61,0x5F,0x49,0x49,0x2E,0x63,0x72,0x6C,0x86,0x81,0x9F,0x6C,0x64,0x61,0x70,0x3A, -0x2F,0x2F,0x77,0x77,0x77,0x2E,0x74,0x72,0x75,0x73,0x74,0x63,0x65,0x6E,0x74,0x65, -0x72,0x2E,0x64,0x65,0x2F,0x43,0x4E,0x3D,0x54,0x43,0x25,0x32,0x30,0x54,0x72,0x75, -0x73,0x74,0x43,0x65,0x6E,0x74,0x65,0x72,0x25,0x32,0x30,0x43,0x6C,0x61,0x73,0x73, -0x25,0x32,0x30,0x32,0x25,0x32,0x30,0x43,0x41,0x25,0x32,0x30,0x49,0x49,0x2C,0x4F, -0x3D,0x54,0x43,0x25,0x32,0x30,0x54,0x72,0x75,0x73,0x74,0x43,0x65,0x6E,0x74,0x65, -0x72,0x25,0x32,0x30,0x47,0x6D,0x62,0x48,0x2C,0x4F,0x55,0x3D,0x72,0x6F,0x6F,0x74, -0x63,0x65,0x72,0x74,0x73,0x2C,0x44,0x43,0x3D,0x74,0x72,0x75,0x73,0x74,0x63,0x65, -0x6E,0x74,0x65,0x72,0x2C,0x44,0x43,0x3D,0x64,0x65,0x3F,0x63,0x65,0x72,0x74,0x69, -0x66,0x69,0x63,0x61,0x74,0x65,0x52,0x65,0x76,0x6F,0x63,0x61,0x74,0x69,0x6F,0x6E, -0x4C,0x69,0x73,0x74,0x3F,0x62,0x61,0x73,0x65,0x3F,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x8C,0xD7, -0xDF,0x7E,0xEE,0x1B,0x80,0x10,0xB3,0x83,0xF5,0xDB,0x11,0xEA,0x6B,0x4B,0xA8,0x92, -0x18,0xD9,0xF7,0x07,0x39,0xF5,0x2C,0xBE,0x06,0x75,0x7A,0x68,0x53,0x15,0x1C,0xEA, -0x4A,0xED,0x5E,0xFC,0x23,0xB2,0x13,0xA0,0xD3,0x09,0xFF,0xF6,0xF6,0x2E,0x6B,0x41, -0x71,0x79,0xCD,0xE2,0x6D,0xFD,0xAE,0x59,0x6B,0x85,0x1D,0xB8,0x4E,0x22,0x9A,0xED, -0x66,0x39,0x6E,0x4B,0x94,0xE6,0x55,0xFC,0x0B,0x1B,0x8B,0x77,0xC1,0x53,0x13,0x66, -0x89,0xD9,0x28,0xD6,0x8B,0xF3,0x45,0x4A,0x63,0xB7,0xFD,0x7B,0x0B,0x61,0x5D,0xB8, -0x6D,0xBE,0xC3,0xDC,0x5B,0x79,0xD2,0xED,0x86,0xE5,0xA2,0x4D,0xBE,0x5E,0x74,0x7C, -0x6A,0xED,0x16,0x38,0x1F,0x7F,0x58,0x81,0x5A,0x1A,0xEB,0x32,0x88,0x2D,0xB2,0xF3, -0x39,0x77,0x80,0xAF,0x5E,0xB6,0x61,0x75,0x29,0xDB,0x23,0x4D,0x88,0xCA,0x50,0x28, -0xCB,0x85,0xD2,0xD3,0x10,0xA2,0x59,0x6E,0xD3,0x93,0x54,0x00,0x7A,0xA2,0x46,0x95, -0x86,0x05,0x9C,0xA9,0x19,0x98,0xE5,0x31,0x72,0x0C,0x00,0xE2,0x67,0xD9,0x40,0xE0, -0x24,0x33,0x7B,0x6F,0x2C,0xB9,0x5C,0xAB,0x65,0x9D,0x2C,0xAC,0x76,0xEA,0x35,0x99, -0xF5,0x97,0xB9,0x0F,0x24,0xEC,0xC7,0x76,0x21,0x28,0x65,0xAE,0x57,0xE8,0x07,0x88, -0x75,0x4A,0x56,0xA0,0xD2,0x05,0x3A,0xA4,0xE6,0x8D,0x92,0x88,0x2C,0xF3,0xF2,0xE1, -0xC1,0xC6,0x61,0xDB,0x41,0xC5,0xC7,0x9B,0xF7,0x0E,0x1A,0x51,0x45,0xC2,0x61,0x6B, -0xDC,0x64,0x27,0x17,0x8C,0x5A,0xB7,0xDA,0x74,0x28,0xCD,0x97,0xE4,0xBD, -}; - - -/* subject:/O=Cybertrust, Inc/CN=Cybertrust Global Root */ -/* issuer :/O=Cybertrust, Inc/CN=Cybertrust Global Root */ - - -const unsigned char Cybertrust_Global_Root_certificate[933]={ -0x30,0x82,0x03,0xA1,0x30,0x82,0x02,0x89,0xA0,0x03,0x02,0x01,0x02,0x02,0x0B,0x04, -0x00,0x00,0x00,0x00,0x01,0x0F,0x85,0xAA,0x2D,0x48,0x30,0x0D,0x06,0x09,0x2A,0x86, -0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x3B,0x31,0x18,0x30,0x16,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x79,0x62,0x65,0x72,0x74,0x72,0x75,0x73,0x74, -0x2C,0x20,0x49,0x6E,0x63,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16, -0x43,0x79,0x62,0x65,0x72,0x74,0x72,0x75,0x73,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61, -0x6C,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x36,0x31,0x32,0x31,0x35, -0x30,0x38,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x31,0x31,0x32,0x31,0x35,0x30, -0x38,0x30,0x30,0x30,0x30,0x5A,0x30,0x3B,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04, -0x0A,0x13,0x0F,0x43,0x79,0x62,0x65,0x72,0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49, -0x6E,0x63,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x43,0x79,0x62, -0x65,0x72,0x74,0x72,0x75,0x73,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52, -0x6F,0x6F,0x74,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7, -0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02, -0x82,0x01,0x01,0x00,0xF8,0xC8,0xBC,0xBD,0x14,0x50,0x66,0x13,0xFF,0xF0,0xD3,0x79, -0xEC,0x23,0xF2,0xB7,0x1A,0xC7,0x8E,0x85,0xF1,0x12,0x73,0xA6,0x19,0xAA,0x10,0xDB, -0x9C,0xA2,0x65,0x74,0x5A,0x77,0x3E,0x51,0x7D,0x56,0xF6,0xDC,0x23,0xB6,0xD4,0xED, -0x5F,0x58,0xB1,0x37,0x4D,0xD5,0x49,0x0E,0x6E,0xF5,0x6A,0x87,0xD6,0xD2,0x8C,0xD2, -0x27,0xC6,0xE2,0xFF,0x36,0x9F,0x98,0x65,0xA0,0x13,0x4E,0xC6,0x2A,0x64,0x9B,0xD5, -0x90,0x12,0xCF,0x14,0x06,0xF4,0x3B,0xE3,0xD4,0x28,0xBE,0xE8,0x0E,0xF8,0xAB,0x4E, -0x48,0x94,0x6D,0x8E,0x95,0x31,0x10,0x5C,0xED,0xA2,0x2D,0xBD,0xD5,0x3A,0x6D,0xB2, -0x1C,0xBB,0x60,0xC0,0x46,0x4B,0x01,0xF5,0x49,0xAE,0x7E,0x46,0x8A,0xD0,0x74,0x8D, -0xA1,0x0C,0x02,0xCE,0xEE,0xFC,0xE7,0x8F,0xB8,0x6B,0x66,0xF3,0x7F,0x44,0x00,0xBF, -0x66,0x25,0x14,0x2B,0xDD,0x10,0x30,0x1D,0x07,0x96,0x3F,0x4D,0xF6,0x6B,0xB8,0x8F, -0xB7,0x7B,0x0C,0xA5,0x38,0xEB,0xDE,0x47,0xDB,0xD5,0x5D,0x39,0xFC,0x88,0xA7,0xF3, -0xD7,0x2A,0x74,0xF1,0xE8,0x5A,0xA2,0x3B,0x9F,0x50,0xBA,0xA6,0x8C,0x45,0x35,0xC2, -0x50,0x65,0x95,0xDC,0x63,0x82,0xEF,0xDD,0xBF,0x77,0x4D,0x9C,0x62,0xC9,0x63,0x73, -0x16,0xD0,0x29,0x0F,0x49,0xA9,0x48,0xF0,0xB3,0xAA,0xB7,0x6C,0xC5,0xA7,0x30,0x39, -0x40,0x5D,0xAE,0xC4,0xE2,0x5D,0x26,0x53,0xF0,0xCE,0x1C,0x23,0x08,0x61,0xA8,0x94, -0x19,0xBA,0x04,0x62,0x40,0xEC,0x1F,0x38,0x70,0x77,0x12,0x06,0x71,0xA7,0x30,0x18, -0x5D,0x25,0x27,0xA5,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0xA5,0x30,0x81,0xA2,0x30, -0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30, -0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF, -0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xB6,0x08,0x7B,0x0D,0x7A, -0xCC,0xAC,0x20,0x4C,0x86,0x56,0x32,0x5E,0xCF,0xAB,0x6E,0x85,0x2D,0x70,0x57,0x30, -0x3F,0x06,0x03,0x55,0x1D,0x1F,0x04,0x38,0x30,0x36,0x30,0x34,0xA0,0x32,0xA0,0x30, -0x86,0x2E,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x32,0x2E,0x70,0x75, -0x62,0x6C,0x69,0x63,0x2D,0x74,0x72,0x75,0x73,0x74,0x2E,0x63,0x6F,0x6D,0x2F,0x63, -0x72,0x6C,0x2F,0x63,0x74,0x2F,0x63,0x74,0x72,0x6F,0x6F,0x74,0x2E,0x63,0x72,0x6C, -0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0xB6,0x08,0x7B, -0x0D,0x7A,0xCC,0xAC,0x20,0x4C,0x86,0x56,0x32,0x5E,0xCF,0xAB,0x6E,0x85,0x2D,0x70, -0x57,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00, -0x03,0x82,0x01,0x01,0x00,0x56,0xEF,0x0A,0x23,0xA0,0x54,0x4E,0x95,0x97,0xC9,0xF8, -0x89,0xDA,0x45,0xC1,0xD4,0xA3,0x00,0x25,0xF4,0x1F,0x13,0xAB,0xB7,0xA3,0x85,0x58, -0x69,0xC2,0x30,0xAD,0xD8,0x15,0x8A,0x2D,0xE3,0xC9,0xCD,0x81,0x5A,0xF8,0x73,0x23, -0x5A,0xA7,0x7C,0x05,0xF3,0xFD,0x22,0x3B,0x0E,0xD1,0x06,0xC4,0xDB,0x36,0x4C,0x73, -0x04,0x8E,0xE5,0xB0,0x22,0xE4,0xC5,0xF3,0x2E,0xA5,0xD9,0x23,0xE3,0xB8,0x4E,0x4A, -0x20,0xA7,0x6E,0x02,0x24,0x9F,0x22,0x60,0x67,0x7B,0x8B,0x1D,0x72,0x09,0xC5,0x31, -0x5C,0xE9,0x79,0x9F,0x80,0x47,0x3D,0xAD,0xA1,0x0B,0x07,0x14,0x3D,0x47,0xFF,0x03, -0x69,0x1A,0x0C,0x0B,0x44,0xE7,0x63,0x25,0xA7,0x7F,0xB2,0xC9,0xB8,0x76,0x84,0xED, -0x23,0xF6,0x7D,0x07,0xAB,0x45,0x7E,0xD3,0xDF,0xB3,0xBF,0xE9,0x8A,0xB6,0xCD,0xA8, -0xA2,0x67,0x2B,0x52,0xD5,0xB7,0x65,0xF0,0x39,0x4C,0x63,0xA0,0x91,0x79,0x93,0x52, -0x0F,0x54,0xDD,0x83,0xBB,0x9F,0xD1,0x8F,0xA7,0x53,0x73,0xC3,0xCB,0xFF,0x30,0xEC, -0x7C,0x04,0xB8,0xD8,0x44,0x1F,0x93,0x5F,0x71,0x09,0x22,0xB7,0x6E,0x3E,0xEA,0x1C, -0x03,0x4E,0x9D,0x1A,0x20,0x61,0xFB,0x81,0x37,0xEC,0x5E,0xFC,0x0A,0x45,0xAB,0xD7, -0xE7,0x17,0x55,0xD0,0xA0,0xEA,0x60,0x9B,0xA6,0xF6,0xE3,0x8C,0x5B,0x29,0xC2,0x06, -0x60,0x14,0x9D,0x2D,0x97,0x4C,0xA9,0x93,0x15,0x9D,0x61,0xC4,0x01,0x5F,0x48,0xD6, -0x58,0xBD,0x56,0x31,0x12,0x4E,0x11,0xC8,0x21,0xE0,0xB3,0x11,0x91,0x65,0xDB,0xB4, -0xA6,0x88,0x38,0xCE,0x55, -}; - - -/* subject:/C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2012 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - EC1 */ -/* issuer :/C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2012 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - EC1 */ - - -const unsigned char Entrust_Root_Certification_Authority___EC1_certificate[765]={ -0x30,0x82,0x02,0xF9,0x30,0x82,0x02,0x80,0xA0,0x03,0x02,0x01,0x02,0x02,0x0D,0x00, -0xA6,0x8B,0x79,0x29,0x00,0x00,0x00,0x00,0x50,0xD0,0x91,0xF9,0x30,0x0A,0x06,0x08, -0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x81,0xBF,0x31,0x0B,0x30,0x09,0x06, -0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04, -0x0A,0x13,0x0D,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E, -0x31,0x28,0x30,0x26,0x06,0x03,0x55,0x04,0x0B,0x13,0x1F,0x53,0x65,0x65,0x20,0x77, -0x77,0x77,0x2E,0x65,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74,0x2F,0x6C, -0x65,0x67,0x61,0x6C,0x2D,0x74,0x65,0x72,0x6D,0x73,0x31,0x39,0x30,0x37,0x06,0x03, -0x55,0x04,0x0B,0x13,0x30,0x28,0x63,0x29,0x20,0x32,0x30,0x31,0x32,0x20,0x45,0x6E, -0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x66,0x6F, -0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65, -0x20,0x6F,0x6E,0x6C,0x79,0x31,0x33,0x30,0x31,0x06,0x03,0x55,0x04,0x03,0x13,0x2A, -0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72, -0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F, -0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x45,0x43,0x31,0x30,0x1E,0x17,0x0D,0x31,0x32, -0x31,0x32,0x31,0x38,0x31,0x35,0x32,0x35,0x33,0x36,0x5A,0x17,0x0D,0x33,0x37,0x31, -0x32,0x31,0x38,0x31,0x35,0x35,0x35,0x33,0x36,0x5A,0x30,0x81,0xBF,0x31,0x0B,0x30, -0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03, -0x55,0x04,0x0A,0x13,0x0D,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E, -0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x03,0x55,0x04,0x0B,0x13,0x1F,0x53,0x65,0x65, -0x20,0x77,0x77,0x77,0x2E,0x65,0x6E,0x74,0x72,0x75,0x73,0x74,0x2E,0x6E,0x65,0x74, -0x2F,0x6C,0x65,0x67,0x61,0x6C,0x2D,0x74,0x65,0x72,0x6D,0x73,0x31,0x39,0x30,0x37, -0x06,0x03,0x55,0x04,0x0B,0x13,0x30,0x28,0x63,0x29,0x20,0x32,0x30,0x31,0x32,0x20, -0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20, -0x66,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64,0x20,0x75, -0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x33,0x30,0x31,0x06,0x03,0x55,0x04,0x03, -0x13,0x2A,0x45,0x6E,0x74,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43, -0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74, -0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x45,0x43,0x31,0x30,0x76,0x30,0x10, -0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05,0x2B,0x81,0x04,0x00,0x22, -0x03,0x62,0x00,0x04,0x84,0x13,0xC9,0xD0,0xBA,0x6D,0x41,0x7B,0xE2,0x6C,0xD0,0xEB, -0x55,0x5F,0x66,0x02,0x1A,0x24,0xF4,0x5B,0x89,0x69,0x47,0xE3,0xB8,0xC2,0x7D,0xF1, -0xF2,0x02,0xC5,0x9F,0xA0,0xF6,0x5B,0xD5,0x8B,0x06,0x19,0x86,0x4F,0x53,0x10,0x6D, -0x07,0x24,0x27,0xA1,0xA0,0xF8,0xD5,0x47,0x19,0x61,0x4C,0x7D,0xCA,0x93,0x27,0xEA, -0x74,0x0C,0xEF,0x6F,0x96,0x09,0xFE,0x63,0xEC,0x70,0x5D,0x36,0xAD,0x67,0x77,0xAE, -0xC9,0x9D,0x7C,0x55,0x44,0x3A,0xA2,0x63,0x51,0x1F,0xF5,0xE3,0x62,0xD4,0xA9,0x47, -0x07,0x3E,0xCC,0x20,0xA3,0x42,0x30,0x40,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01, -0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01, -0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E, -0x04,0x16,0x04,0x14,0xB7,0x63,0xE7,0x1A,0xDD,0x8D,0xE9,0x08,0xA6,0x55,0x83,0xA4, -0xE0,0x6A,0x50,0x41,0x65,0x11,0x42,0x49,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE, -0x3D,0x04,0x03,0x03,0x03,0x67,0x00,0x30,0x64,0x02,0x30,0x61,0x79,0xD8,0xE5,0x42, -0x47,0xDF,0x1C,0xAE,0x53,0x99,0x17,0xB6,0x6F,0x1C,0x7D,0xE1,0xBF,0x11,0x94,0xD1, -0x03,0x88,0x75,0xE4,0x8D,0x89,0xA4,0x8A,0x77,0x46,0xDE,0x6D,0x61,0xEF,0x02,0xF5, -0xFB,0xB5,0xDF,0xCC,0xFE,0x4E,0xFF,0xFE,0xA9,0xE6,0xA7,0x02,0x30,0x5B,0x99,0xD7, -0x85,0x37,0x06,0xB5,0x7B,0x08,0xFD,0xEB,0x27,0x8B,0x4A,0x94,0xF9,0xE1,0xFA,0xA7, -0x8E,0x26,0x08,0xE8,0x7C,0x92,0x68,0x6D,0x73,0xD8,0x6F,0x26,0xAC,0x21,0x02,0xB8, -0x99,0xB7,0x26,0x41,0x5B,0x25,0x60,0xAE,0xD0,0x48,0x1A,0xEE,0x06, -}; - - -/* subject:/C=US/O=GeoTrust Inc./OU=(c) 2007 GeoTrust Inc. - For authorized use only/CN=GeoTrust Primary Certification Authority - G2 */ -/* issuer :/C=US/O=GeoTrust Inc./OU=(c) 2007 GeoTrust Inc. - For authorized use only/CN=GeoTrust Primary Certification Authority - G2 */ - - -const unsigned char GeoTrust_Primary_Certification_Authority___G2_certificate[690]={ -0x30,0x82,0x02,0xAE,0x30,0x82,0x02,0x35,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x3C, -0xB2,0xF4,0x48,0x0A,0x00,0xE2,0xFE,0xEB,0x24,0x3B,0x5E,0x60,0x3E,0xC3,0x6B,0x30, -0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x30,0x81,0x98,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06, -0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49, -0x6E,0x63,0x2E,0x31,0x39,0x30,0x37,0x06,0x03,0x55,0x04,0x0B,0x13,0x30,0x28,0x63, -0x29,0x20,0x32,0x30,0x30,0x37,0x20,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20, -0x49,0x6E,0x63,0x2E,0x20,0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F, -0x72,0x69,0x7A,0x65,0x64,0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x36, -0x30,0x34,0x06,0x03,0x55,0x04,0x03,0x13,0x2D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73, -0x74,0x20,0x50,0x72,0x69,0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66, -0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74, -0x79,0x20,0x2D,0x20,0x47,0x32,0x30,0x1E,0x17,0x0D,0x30,0x37,0x31,0x31,0x30,0x35, -0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x38,0x32, -0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0x98,0x31,0x0B,0x30,0x09,0x06,0x03,0x55, -0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13, -0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x39, -0x30,0x37,0x06,0x03,0x55,0x04,0x0B,0x13,0x30,0x28,0x63,0x29,0x20,0x32,0x30,0x30, -0x37,0x20,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x20, -0x2D,0x20,0x46,0x6F,0x72,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x7A,0x65,0x64, -0x20,0x75,0x73,0x65,0x20,0x6F,0x6E,0x6C,0x79,0x31,0x36,0x30,0x34,0x06,0x03,0x55, -0x04,0x03,0x13,0x2D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x50,0x72,0x69, -0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69, -0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x20,0x2D,0x20,0x47, -0x32,0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05, -0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0x15,0xB1,0xE8,0xFD,0x03,0x15,0x43, -0xE5,0xAC,0xEB,0x87,0x37,0x11,0x62,0xEF,0xD2,0x83,0x36,0x52,0x7D,0x45,0x57,0x0B, -0x4A,0x8D,0x7B,0x54,0x3B,0x3A,0x6E,0x5F,0x15,0x02,0xC0,0x50,0xA6,0xCF,0x25,0x2F, -0x7D,0xCA,0x48,0xB8,0xC7,0x50,0x63,0x1C,0x2A,0x21,0x08,0x7C,0x9A,0x36,0xD8,0x0B, -0xFE,0xD1,0x26,0xC5,0x58,0x31,0x30,0x28,0x25,0xF3,0x5D,0x5D,0xA3,0xB8,0xB6,0xA5, -0xB4,0x92,0xED,0x6C,0x2C,0x9F,0xEB,0xDD,0x43,0x89,0xA2,0x3C,0x4B,0x48,0x91,0x1D, -0x50,0xEC,0x26,0xDF,0xD6,0x60,0x2E,0xBD,0x21,0xA3,0x42,0x30,0x40,0x30,0x0F,0x06, -0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0E, -0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x1D, -0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x15,0x5F,0x35,0x57,0x51,0x55,0xFB, -0x25,0xB2,0xAD,0x03,0x69,0xFC,0x01,0xA3,0xFA,0xBE,0x11,0x55,0xD5,0x30,0x0A,0x06, -0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x67,0x00,0x30,0x64,0x02,0x30, -0x64,0x96,0x59,0xA6,0xE8,0x09,0xDE,0x8B,0xBA,0xFA,0x5A,0x88,0x88,0xF0,0x1F,0x91, -0xD3,0x46,0xA8,0xF2,0x4A,0x4C,0x02,0x63,0xFB,0x6C,0x5F,0x38,0xDB,0x2E,0x41,0x93, -0xA9,0x0E,0xE6,0x9D,0xDC,0x31,0x1C,0xB2,0xA0,0xA7,0x18,0x1C,0x79,0xE1,0xC7,0x36, -0x02,0x30,0x3A,0x56,0xAF,0x9A,0x74,0x6C,0xF6,0xFB,0x83,0xE0,0x33,0xD3,0x08,0x5F, -0xA1,0x9C,0xC2,0x5B,0x9F,0x46,0xD6,0xB6,0xCB,0x91,0x06,0x63,0xA2,0x06,0xE7,0x33, -0xAC,0x3E,0xA8,0x81,0x12,0xD0,0xCB,0xBA,0xD0,0x92,0x0B,0xB6,0x9E,0x96,0xAA,0x04, -0x0F,0x8A, -}; - - -/* subject:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA 2 */ -/* issuer :/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA 2 */ - - -const unsigned char GeoTrust_Global_CA_2_certificate[874]={ -0x30,0x82,0x03,0x66,0x30,0x82,0x02,0x4E,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01, -0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30, -0x44,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16, -0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47,0x65,0x6F,0x54,0x72,0x75,0x73, -0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x03,0x13, -0x14,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C, -0x20,0x43,0x41,0x20,0x32,0x30,0x1E,0x17,0x0D,0x30,0x34,0x30,0x33,0x30,0x34,0x30, -0x35,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x31,0x39,0x30,0x33,0x30,0x34,0x30,0x35, -0x30,0x30,0x30,0x30,0x5A,0x30,0x44,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06, -0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x0A,0x13,0x0D,0x47, -0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20,0x49,0x6E,0x63,0x2E,0x31,0x1D,0x30,0x1B, -0x06,0x03,0x55,0x04,0x03,0x13,0x14,0x47,0x65,0x6F,0x54,0x72,0x75,0x73,0x74,0x20, -0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x43,0x41,0x20,0x32,0x30,0x82,0x01,0x22,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82, -0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xEF,0x3C,0x4D,0x40, -0x3D,0x10,0xDF,0x3B,0x53,0x00,0xE1,0x67,0xFE,0x94,0x60,0x15,0x3E,0x85,0x88,0xF1, -0x89,0x0D,0x90,0xC8,0x28,0x23,0x99,0x05,0xE8,0x2B,0x20,0x9D,0xC6,0xF3,0x60,0x46, -0xD8,0xC1,0xB2,0xD5,0x8C,0x31,0xD9,0xDC,0x20,0x79,0x24,0x81,0xBF,0x35,0x32,0xFC, -0x63,0x69,0xDB,0xB1,0x2A,0x6B,0xEE,0x21,0x58,0xF2,0x08,0xE9,0x78,0xCB,0x6F,0xCB, -0xFC,0x16,0x52,0xC8,0x91,0xC4,0xFF,0x3D,0x73,0xDE,0xB1,0x3E,0xA7,0xC2,0x7D,0x66, -0xC1,0xF5,0x7E,0x52,0x24,0x1A,0xE2,0xD5,0x67,0x91,0xD0,0x82,0x10,0xD7,0x78,0x4B, -0x4F,0x2B,0x42,0x39,0xBD,0x64,0x2D,0x40,0xA0,0xB0,0x10,0xD3,0x38,0x48,0x46,0x88, -0xA1,0x0C,0xBB,0x3A,0x33,0x2A,0x62,0x98,0xFB,0x00,0x9D,0x13,0x59,0x7F,0x6F,0x3B, -0x72,0xAA,0xEE,0xA6,0x0F,0x86,0xF9,0x05,0x61,0xEA,0x67,0x7F,0x0C,0x37,0x96,0x8B, -0xE6,0x69,0x16,0x47,0x11,0xC2,0x27,0x59,0x03,0xB3,0xA6,0x60,0xC2,0x21,0x40,0x56, -0xFA,0xA0,0xC7,0x7D,0x3A,0x13,0xE3,0xEC,0x57,0xC7,0xB3,0xD6,0xAE,0x9D,0x89,0x80, -0xF7,0x01,0xE7,0x2C,0xF6,0x96,0x2B,0x13,0x0D,0x79,0x2C,0xD9,0xC0,0xE4,0x86,0x7B, -0x4B,0x8C,0x0C,0x72,0x82,0x8A,0xFB,0x17,0xCD,0x00,0x6C,0x3A,0x13,0x3C,0xB0,0x84, -0x87,0x4B,0x16,0x7A,0x29,0xB2,0x4F,0xDB,0x1D,0xD4,0x0B,0xF3,0x66,0x37,0xBD,0xD8, -0xF6,0x57,0xBB,0x5E,0x24,0x7A,0xB8,0x3C,0x8B,0xB9,0xFA,0x92,0x1A,0x1A,0x84,0x9E, -0xD8,0x74,0x8F,0xAA,0x1B,0x7F,0x5E,0xF4,0xFE,0x45,0x22,0x21,0x02,0x03,0x01,0x00, -0x01,0xA3,0x63,0x30,0x61,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04, -0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04, -0x14,0x71,0x38,0x36,0xF2,0x02,0x31,0x53,0x47,0x2B,0x6E,0xBA,0x65,0x46,0xA9,0x10, -0x15,0x58,0x20,0x05,0x09,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16, -0x80,0x14,0x71,0x38,0x36,0xF2,0x02,0x31,0x53,0x47,0x2B,0x6E,0xBA,0x65,0x46,0xA9, -0x10,0x15,0x58,0x20,0x05,0x09,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF, -0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D, -0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x03,0xF7,0xB5,0x2B,0xAB,0x5D, -0x10,0xFC,0x7B,0xB2,0xB2,0x5E,0xAC,0x9B,0x0E,0x7E,0x53,0x78,0x59,0x3E,0x42,0x04, -0xFE,0x75,0xA3,0xAD,0xAC,0x81,0x4E,0xD7,0x02,0x8B,0x5E,0xC4,0x2D,0xC8,0x52,0x76, -0xC7,0x2C,0x1F,0xFC,0x81,0x32,0x98,0xD1,0x4B,0xC6,0x92,0x93,0x33,0x35,0x31,0x2F, -0xFC,0xD8,0x1D,0x44,0xDD,0xE0,0x81,0x7F,0x9D,0xE9,0x8B,0xE1,0x64,0x91,0x62,0x0B, -0x39,0x08,0x8C,0xAC,0x74,0x9D,0x59,0xD9,0x7A,0x59,0x52,0x97,0x11,0xB9,0x16,0x7B, -0x6F,0x45,0xD3,0x96,0xD9,0x31,0x7D,0x02,0x36,0x0F,0x9C,0x3B,0x6E,0xCF,0x2C,0x0D, -0x03,0x46,0x45,0xEB,0xA0,0xF4,0x7F,0x48,0x44,0xC6,0x08,0x40,0xCC,0xDE,0x1B,0x70, -0xB5,0x29,0xAD,0xBA,0x8B,0x3B,0x34,0x65,0x75,0x1B,0x71,0x21,0x1D,0x2C,0x14,0x0A, -0xB0,0x96,0x95,0xB8,0xD6,0xEA,0xF2,0x65,0xFB,0x29,0xBA,0x4F,0xEA,0x91,0x93,0x74, -0x69,0xB6,0xF2,0xFF,0xE1,0x1A,0xD0,0x0C,0xD1,0x76,0x85,0xCB,0x8A,0x25,0xBD,0x97, -0x5E,0x2C,0x6F,0x15,0x99,0x26,0xE7,0xB6,0x29,0xFF,0x22,0xEC,0xC9,0x02,0xC7,0x56, -0x00,0xCD,0x49,0xB9,0xB3,0x6C,0x7B,0x53,0x04,0x1A,0xE2,0xA8,0xC9,0xAA,0x12,0x05, -0x23,0xC2,0xCE,0xE7,0xBB,0x04,0x02,0xCC,0xC0,0x47,0xA2,0xE4,0xC4,0x29,0x2F,0x5B, -0x45,0x57,0x89,0x51,0xEE,0x3C,0xEB,0x52,0x08,0xFF,0x07,0x35,0x1E,0x9F,0x35,0x6A, -0x47,0x4A,0x56,0x98,0xD1,0x5A,0x85,0x1F,0x8C,0xF5,0x22,0xBF,0xAB,0xCE,0x83,0xF3, -0xE2,0x22,0x29,0xAE,0x7D,0x83,0x40,0xA8,0xBA,0x6C, -}; - - -/* subject:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority */ -/* issuer :/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority */ - - -const unsigned char COMODO_RSA_Certification_Authority_certificate[1500]={ -0x30,0x82,0x05,0xD8,0x30,0x82,0x03,0xC0,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x4C, -0xAA,0xF9,0xCA,0xDB,0x63,0x6F,0xE0,0x1F,0xF7,0x4E,0xD8,0x5B,0x03,0x86,0x9D,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C,0x05,0x00,0x30,0x81, -0x85,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B, -0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x13,0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72, -0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73,0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06, -0x03,0x55,0x04,0x07,0x13,0x07,0x53,0x61,0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30, -0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x43, -0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65,0x64,0x31,0x2B,0x30,0x29,0x06,0x03,0x55, -0x04,0x03,0x13,0x22,0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x52,0x53,0x41,0x20,0x43, -0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74, -0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x31,0x30,0x30,0x31,0x31,0x39, -0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,0x38,0x30,0x31,0x31,0x38,0x32, -0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x81,0x85,0x31,0x0B,0x30,0x09,0x06,0x03,0x55, -0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x08,0x13, -0x12,0x47,0x72,0x65,0x61,0x74,0x65,0x72,0x20,0x4D,0x61,0x6E,0x63,0x68,0x65,0x73, -0x74,0x65,0x72,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x53,0x61, -0x6C,0x66,0x6F,0x72,0x64,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11, -0x43,0x4F,0x4D,0x4F,0x44,0x4F,0x20,0x43,0x41,0x20,0x4C,0x69,0x6D,0x69,0x74,0x65, -0x64,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x03,0x13,0x22,0x43,0x4F,0x4D,0x4F, -0x44,0x4F,0x20,0x52,0x53,0x41,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, -0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x82, -0x02,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05, -0x00,0x03,0x82,0x02,0x0F,0x00,0x30,0x82,0x02,0x0A,0x02,0x82,0x02,0x01,0x00,0x91, -0xE8,0x54,0x92,0xD2,0x0A,0x56,0xB1,0xAC,0x0D,0x24,0xDD,0xC5,0xCF,0x44,0x67,0x74, -0x99,0x2B,0x37,0xA3,0x7D,0x23,0x70,0x00,0x71,0xBC,0x53,0xDF,0xC4,0xFA,0x2A,0x12, -0x8F,0x4B,0x7F,0x10,0x56,0xBD,0x9F,0x70,0x72,0xB7,0x61,0x7F,0xC9,0x4B,0x0F,0x17, -0xA7,0x3D,0xE3,0xB0,0x04,0x61,0xEE,0xFF,0x11,0x97,0xC7,0xF4,0x86,0x3E,0x0A,0xFA, -0x3E,0x5C,0xF9,0x93,0xE6,0x34,0x7A,0xD9,0x14,0x6B,0xE7,0x9C,0xB3,0x85,0xA0,0x82, -0x7A,0x76,0xAF,0x71,0x90,0xD7,0xEC,0xFD,0x0D,0xFA,0x9C,0x6C,0xFA,0xDF,0xB0,0x82, -0xF4,0x14,0x7E,0xF9,0xBE,0xC4,0xA6,0x2F,0x4F,0x7F,0x99,0x7F,0xB5,0xFC,0x67,0x43, -0x72,0xBD,0x0C,0x00,0xD6,0x89,0xEB,0x6B,0x2C,0xD3,0xED,0x8F,0x98,0x1C,0x14,0xAB, -0x7E,0xE5,0xE3,0x6E,0xFC,0xD8,0xA8,0xE4,0x92,0x24,0xDA,0x43,0x6B,0x62,0xB8,0x55, -0xFD,0xEA,0xC1,0xBC,0x6C,0xB6,0x8B,0xF3,0x0E,0x8D,0x9A,0xE4,0x9B,0x6C,0x69,0x99, -0xF8,0x78,0x48,0x30,0x45,0xD5,0xAD,0xE1,0x0D,0x3C,0x45,0x60,0xFC,0x32,0x96,0x51, -0x27,0xBC,0x67,0xC3,0xCA,0x2E,0xB6,0x6B,0xEA,0x46,0xC7,0xC7,0x20,0xA0,0xB1,0x1F, -0x65,0xDE,0x48,0x08,0xBA,0xA4,0x4E,0xA9,0xF2,0x83,0x46,0x37,0x84,0xEB,0xE8,0xCC, -0x81,0x48,0x43,0x67,0x4E,0x72,0x2A,0x9B,0x5C,0xBD,0x4C,0x1B,0x28,0x8A,0x5C,0x22, -0x7B,0xB4,0xAB,0x98,0xD9,0xEE,0xE0,0x51,0x83,0xC3,0x09,0x46,0x4E,0x6D,0x3E,0x99, -0xFA,0x95,0x17,0xDA,0x7C,0x33,0x57,0x41,0x3C,0x8D,0x51,0xED,0x0B,0xB6,0x5C,0xAF, -0x2C,0x63,0x1A,0xDF,0x57,0xC8,0x3F,0xBC,0xE9,0x5D,0xC4,0x9B,0xAF,0x45,0x99,0xE2, -0xA3,0x5A,0x24,0xB4,0xBA,0xA9,0x56,0x3D,0xCF,0x6F,0xAA,0xFF,0x49,0x58,0xBE,0xF0, -0xA8,0xFF,0xF4,0xB8,0xAD,0xE9,0x37,0xFB,0xBA,0xB8,0xF4,0x0B,0x3A,0xF9,0xE8,0x43, -0x42,0x1E,0x89,0xD8,0x84,0xCB,0x13,0xF1,0xD9,0xBB,0xE1,0x89,0x60,0xB8,0x8C,0x28, -0x56,0xAC,0x14,0x1D,0x9C,0x0A,0xE7,0x71,0xEB,0xCF,0x0E,0xDD,0x3D,0xA9,0x96,0xA1, -0x48,0xBD,0x3C,0xF7,0xAF,0xB5,0x0D,0x22,0x4C,0xC0,0x11,0x81,0xEC,0x56,0x3B,0xF6, -0xD3,0xA2,0xE2,0x5B,0xB7,0xB2,0x04,0x22,0x52,0x95,0x80,0x93,0x69,0xE8,0x8E,0x4C, -0x65,0xF1,0x91,0x03,0x2D,0x70,0x74,0x02,0xEA,0x8B,0x67,0x15,0x29,0x69,0x52,0x02, -0xBB,0xD7,0xDF,0x50,0x6A,0x55,0x46,0xBF,0xA0,0xA3,0x28,0x61,0x7F,0x70,0xD0,0xC3, -0xA2,0xAA,0x2C,0x21,0xAA,0x47,0xCE,0x28,0x9C,0x06,0x45,0x76,0xBF,0x82,0x18,0x27, -0xB4,0xD5,0xAE,0xB4,0xCB,0x50,0xE6,0x6B,0xF4,0x4C,0x86,0x71,0x30,0xE9,0xA6,0xDF, -0x16,0x86,0xE0,0xD8,0xFF,0x40,0xDD,0xFB,0xD0,0x42,0x88,0x7F,0xA3,0x33,0x3A,0x2E, -0x5C,0x1E,0x41,0x11,0x81,0x63,0xCE,0x18,0x71,0x6B,0x2B,0xEC,0xA6,0x8A,0xB7,0x31, -0x5C,0x3A,0x6A,0x47,0xE0,0xC3,0x79,0x59,0xD6,0x20,0x1A,0xAF,0xF2,0x6A,0x98,0xAA, -0x72,0xBC,0x57,0x4A,0xD2,0x4B,0x9D,0xBB,0x10,0xFC,0xB0,0x4C,0x41,0xE5,0xED,0x1D, -0x3D,0x5E,0x28,0x9D,0x9C,0xCC,0xBF,0xB3,0x51,0xDA,0xA7,0x47,0xE5,0x84,0x53,0x02, -0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04, -0x16,0x04,0x14,0xBB,0xAF,0x7E,0x02,0x3D,0xFA,0xA6,0xF1,0x3C,0x84,0x8E,0xAD,0xEE, -0x38,0x98,0xEC,0xD9,0x32,0x32,0xD4,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01, -0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01, -0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86, -0xF7,0x0D,0x01,0x01,0x0C,0x05,0x00,0x03,0x82,0x02,0x01,0x00,0x0A,0xF1,0xD5,0x46, -0x84,0xB7,0xAE,0x51,0xBB,0x6C,0xB2,0x4D,0x41,0x14,0x00,0x93,0x4C,0x9C,0xCB,0xE5, -0xC0,0x54,0xCF,0xA0,0x25,0x8E,0x02,0xF9,0xFD,0xB0,0xA2,0x0D,0xF5,0x20,0x98,0x3C, -0x13,0x2D,0xAC,0x56,0xA2,0xB0,0xD6,0x7E,0x11,0x92,0xE9,0x2E,0xBA,0x9E,0x2E,0x9A, -0x72,0xB1,0xBD,0x19,0x44,0x6C,0x61,0x35,0xA2,0x9A,0xB4,0x16,0x12,0x69,0x5A,0x8C, -0xE1,0xD7,0x3E,0xA4,0x1A,0xE8,0x2F,0x03,0xF4,0xAE,0x61,0x1D,0x10,0x1B,0x2A,0xA4, -0x8B,0x7A,0xC5,0xFE,0x05,0xA6,0xE1,0xC0,0xD6,0xC8,0xFE,0x9E,0xAE,0x8F,0x2B,0xBA, -0x3D,0x99,0xF8,0xD8,0x73,0x09,0x58,0x46,0x6E,0xA6,0x9C,0xF4,0xD7,0x27,0xD3,0x95, -0xDA,0x37,0x83,0x72,0x1C,0xD3,0x73,0xE0,0xA2,0x47,0x99,0x03,0x38,0x5D,0xD5,0x49, -0x79,0x00,0x29,0x1C,0xC7,0xEC,0x9B,0x20,0x1C,0x07,0x24,0x69,0x57,0x78,0xB2,0x39, -0xFC,0x3A,0x84,0xA0,0xB5,0x9C,0x7C,0x8D,0xBF,0x2E,0x93,0x62,0x27,0xB7,0x39,0xDA, -0x17,0x18,0xAE,0xBD,0x3C,0x09,0x68,0xFF,0x84,0x9B,0x3C,0xD5,0xD6,0x0B,0x03,0xE3, -0x57,0x9E,0x14,0xF7,0xD1,0xEB,0x4F,0xC8,0xBD,0x87,0x23,0xB7,0xB6,0x49,0x43,0x79, -0x85,0x5C,0xBA,0xEB,0x92,0x0B,0xA1,0xC6,0xE8,0x68,0xA8,0x4C,0x16,0xB1,0x1A,0x99, -0x0A,0xE8,0x53,0x2C,0x92,0xBB,0xA1,0x09,0x18,0x75,0x0C,0x65,0xA8,0x7B,0xCB,0x23, -0xB7,0x1A,0xC2,0x28,0x85,0xC3,0x1B,0xFF,0xD0,0x2B,0x62,0xEF,0xA4,0x7B,0x09,0x91, -0x98,0x67,0x8C,0x14,0x01,0xCD,0x68,0x06,0x6A,0x63,0x21,0x75,0x03,0x80,0x88,0x8A, -0x6E,0x81,0xC6,0x85,0xF2,0xA9,0xA4,0x2D,0xE7,0xF4,0xA5,0x24,0x10,0x47,0x83,0xCA, -0xCD,0xF4,0x8D,0x79,0x58,0xB1,0x06,0x9B,0xE7,0x1A,0x2A,0xD9,0x9D,0x01,0xD7,0x94, -0x7D,0xED,0x03,0x4A,0xCA,0xF0,0xDB,0xE8,0xA9,0x01,0x3E,0xF5,0x56,0x99,0xC9,0x1E, -0x8E,0x49,0x3D,0xBB,0xE5,0x09,0xB9,0xE0,0x4F,0x49,0x92,0x3D,0x16,0x82,0x40,0xCC, -0xCC,0x59,0xC6,0xE6,0x3A,0xED,0x12,0x2E,0x69,0x3C,0x6C,0x95,0xB1,0xFD,0xAA,0x1D, -0x7B,0x7F,0x86,0xBE,0x1E,0x0E,0x32,0x46,0xFB,0xFB,0x13,0x8F,0x75,0x7F,0x4C,0x8B, -0x4B,0x46,0x63,0xFE,0x00,0x34,0x40,0x70,0xC1,0xC3,0xB9,0xA1,0xDD,0xA6,0x70,0xE2, -0x04,0xB3,0x41,0xBC,0xE9,0x80,0x91,0xEA,0x64,0x9C,0x7A,0xE1,0x22,0x03,0xA9,0x9C, -0x6E,0x6F,0x0E,0x65,0x4F,0x6C,0x87,0x87,0x5E,0xF3,0x6E,0xA0,0xF9,0x75,0xA5,0x9B, -0x40,0xE8,0x53,0xB2,0x27,0x9D,0x4A,0xB9,0xC0,0x77,0x21,0x8D,0xFF,0x87,0xF2,0xDE, -0xBC,0x8C,0xEF,0x17,0xDF,0xB7,0x49,0x0B,0xD1,0xF2,0x6E,0x30,0x0B,0x1A,0x0E,0x4E, -0x76,0xED,0x11,0xFC,0xF5,0xE9,0x56,0xB2,0x7D,0xBF,0xC7,0x6D,0x0A,0x93,0x8C,0xA5, -0xD0,0xC0,0xB6,0x1D,0xBE,0x3A,0x4E,0x94,0xA2,0xD7,0x6E,0x6C,0x0B,0xC2,0x8A,0x7C, -0xFA,0x20,0xF3,0xC4,0xE4,0xE5,0xCD,0x0D,0xA8,0xCB,0x91,0x92,0xB1,0x7C,0x85,0xEC, -0xB5,0x14,0x69,0x66,0x0E,0x82,0xE7,0xCD,0xCE,0xC8,0x2D,0xA6,0x51,0x7F,0x21,0xC1, -0x35,0x53,0x85,0x06,0x4A,0x5D,0x9F,0xAD,0xBB,0x1B,0x5F,0x74, -}; - - -/* subject:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC */ -/* issuer :/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC */ - - -const unsigned char UTN_DATACorp_SGC_Root_CA_certificate[1122]={ -0x30,0x82,0x04,0x5E,0x30,0x82,0x03,0x46,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x44, -0xBE,0x0C,0x8B,0x50,0x00,0x21,0xB4,0x11,0xD3,0x2A,0x68,0x06,0xA9,0xAD,0x69,0x30, -0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81, -0x93,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0B, -0x30,0x09,0x06,0x03,0x55,0x04,0x08,0x13,0x02,0x55,0x54,0x31,0x17,0x30,0x15,0x06, -0x03,0x55,0x04,0x07,0x13,0x0E,0x53,0x61,0x6C,0x74,0x20,0x4C,0x61,0x6B,0x65,0x20, -0x43,0x69,0x74,0x79,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0A,0x13,0x15,0x54, -0x68,0x65,0x20,0x55,0x53,0x45,0x52,0x54,0x52,0x55,0x53,0x54,0x20,0x4E,0x65,0x74, -0x77,0x6F,0x72,0x6B,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,0x04,0x0B,0x13,0x18,0x68, -0x74,0x74,0x70,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x75,0x73,0x65,0x72,0x74,0x72, -0x75,0x73,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x03, -0x13,0x12,0x55,0x54,0x4E,0x20,0x2D,0x20,0x44,0x41,0x54,0x41,0x43,0x6F,0x72,0x70, -0x20,0x53,0x47,0x43,0x30,0x1E,0x17,0x0D,0x39,0x39,0x30,0x36,0x32,0x34,0x31,0x38, -0x35,0x37,0x32,0x31,0x5A,0x17,0x0D,0x31,0x39,0x30,0x36,0x32,0x34,0x31,0x39,0x30, -0x36,0x33,0x30,0x5A,0x30,0x81,0x93,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06, -0x13,0x02,0x55,0x53,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x08,0x13,0x02,0x55, -0x54,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x07,0x13,0x0E,0x53,0x61,0x6C,0x74, -0x20,0x4C,0x61,0x6B,0x65,0x20,0x43,0x69,0x74,0x79,0x31,0x1E,0x30,0x1C,0x06,0x03, -0x55,0x04,0x0A,0x13,0x15,0x54,0x68,0x65,0x20,0x55,0x53,0x45,0x52,0x54,0x52,0x55, -0x53,0x54,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x21,0x30,0x1F,0x06,0x03, -0x55,0x04,0x0B,0x13,0x18,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E, -0x75,0x73,0x65,0x72,0x74,0x72,0x75,0x73,0x74,0x2E,0x63,0x6F,0x6D,0x31,0x1B,0x30, -0x19,0x06,0x03,0x55,0x04,0x03,0x13,0x12,0x55,0x54,0x4E,0x20,0x2D,0x20,0x44,0x41, -0x54,0x41,0x43,0x6F,0x72,0x70,0x20,0x53,0x47,0x43,0x30,0x82,0x01,0x22,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01, -0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xDF,0xEE,0x58,0x10,0xA2, -0x2B,0x6E,0x55,0xC4,0x8E,0xBF,0x2E,0x46,0x09,0xE7,0xE0,0x08,0x0F,0x2E,0x2B,0x7A, -0x13,0x94,0x1B,0xBD,0xF6,0xB6,0x80,0x8E,0x65,0x05,0x93,0x00,0x1E,0xBC,0xAF,0xE2, -0x0F,0x8E,0x19,0x0D,0x12,0x47,0xEC,0xAC,0xAD,0xA3,0xFA,0x2E,0x70,0xF8,0xDE,0x6E, -0xFB,0x56,0x42,0x15,0x9E,0x2E,0x5C,0xEF,0x23,0xDE,0x21,0xB9,0x05,0x76,0x27,0x19, -0x0F,0x4F,0xD6,0xC3,0x9C,0xB4,0xBE,0x94,0x19,0x63,0xF2,0xA6,0x11,0x0A,0xEB,0x53, -0x48,0x9C,0xBE,0xF2,0x29,0x3B,0x16,0xE8,0x1A,0xA0,0x4C,0xA6,0xC9,0xF4,0x18,0x59, -0x68,0xC0,0x70,0xF2,0x53,0x00,0xC0,0x5E,0x50,0x82,0xA5,0x56,0x6F,0x36,0xF9,0x4A, -0xE0,0x44,0x86,0xA0,0x4D,0x4E,0xD6,0x47,0x6E,0x49,0x4A,0xCB,0x67,0xD7,0xA6,0xC4, -0x05,0xB9,0x8E,0x1E,0xF4,0xFC,0xFF,0xCD,0xE7,0x36,0xE0,0x9C,0x05,0x6C,0xB2,0x33, -0x22,0x15,0xD0,0xB4,0xE0,0xCC,0x17,0xC0,0xB2,0xC0,0xF4,0xFE,0x32,0x3F,0x29,0x2A, -0x95,0x7B,0xD8,0xF2,0xA7,0x4E,0x0F,0x54,0x7C,0xA1,0x0D,0x80,0xB3,0x09,0x03,0xC1, -0xFF,0x5C,0xDD,0x5E,0x9A,0x3E,0xBC,0xAE,0xBC,0x47,0x8A,0x6A,0xAE,0x71,0xCA,0x1F, -0xB1,0x2A,0xB8,0x5F,0x42,0x05,0x0B,0xEC,0x46,0x30,0xD1,0x72,0x0B,0xCA,0xE9,0x56, -0x6D,0xF5,0xEF,0xDF,0x78,0xBE,0x61,0xBA,0xB2,0xA5,0xAE,0x04,0x4C,0xBC,0xA8,0xAC, -0x69,0x15,0x97,0xBD,0xEF,0xEB,0xB4,0x8C,0xBF,0x35,0xF8,0xD4,0xC3,0xD1,0x28,0x0E, -0x5C,0x3A,0x9F,0x70,0x18,0x33,0x20,0x77,0xC4,0xA2,0xAF,0x02,0x03,0x01,0x00,0x01, -0xA3,0x81,0xAB,0x30,0x81,0xA8,0x30,0x0B,0x06,0x03,0x55,0x1D,0x0F,0x04,0x04,0x03, -0x02,0x01,0xC6,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30, -0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x53, -0x32,0xD1,0xB3,0xCF,0x7F,0xFA,0xE0,0xF1,0xA0,0x5D,0x85,0x4E,0x92,0xD2,0x9E,0x45, -0x1D,0xB4,0x4F,0x30,0x3D,0x06,0x03,0x55,0x1D,0x1F,0x04,0x36,0x30,0x34,0x30,0x32, -0xA0,0x30,0xA0,0x2E,0x86,0x2C,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C, -0x2E,0x75,0x73,0x65,0x72,0x74,0x72,0x75,0x73,0x74,0x2E,0x63,0x6F,0x6D,0x2F,0x55, -0x54,0x4E,0x2D,0x44,0x41,0x54,0x41,0x43,0x6F,0x72,0x70,0x53,0x47,0x43,0x2E,0x63, -0x72,0x6C,0x30,0x2A,0x06,0x03,0x55,0x1D,0x25,0x04,0x23,0x30,0x21,0x06,0x08,0x2B, -0x06,0x01,0x05,0x05,0x07,0x03,0x01,0x06,0x0A,0x2B,0x06,0x01,0x04,0x01,0x82,0x37, -0x0A,0x03,0x03,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x04,0x01,0x30,0x0D, -0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01, -0x01,0x00,0x27,0x35,0x97,0x00,0x8A,0x8B,0x28,0xBD,0xC6,0x33,0x30,0x1E,0x29,0xFC, -0xE2,0xF7,0xD5,0x98,0xD4,0x40,0xBB,0x60,0xCA,0xBF,0xAB,0x17,0x2C,0x09,0x36,0x7F, -0x50,0xFA,0x41,0xDC,0xAE,0x96,0x3A,0x0A,0x23,0x3E,0x89,0x59,0xC9,0xA3,0x07,0xED, -0x1B,0x37,0xAD,0xFC,0x7C,0xBE,0x51,0x49,0x5A,0xDE,0x3A,0x0A,0x54,0x08,0x16,0x45, -0xC2,0x99,0xB1,0x87,0xCD,0x8C,0x68,0xE0,0x69,0x03,0xE9,0xC4,0x4E,0x98,0xB2,0x3B, -0x8C,0x16,0xB3,0x0E,0xA0,0x0C,0x98,0x50,0x9B,0x93,0xA9,0x70,0x09,0xC8,0x2C,0xA3, -0x8F,0xDF,0x02,0xE4,0xE0,0x71,0x3A,0xF1,0xB4,0x23,0x72,0xA0,0xAA,0x01,0xDF,0xDF, -0x98,0x3E,0x14,0x50,0xA0,0x31,0x26,0xBD,0x28,0xE9,0x5A,0x30,0x26,0x75,0xF9,0x7B, -0x60,0x1C,0x8D,0xF3,0xCD,0x50,0x26,0x6D,0x04,0x27,0x9A,0xDF,0xD5,0x0D,0x45,0x47, -0x29,0x6B,0x2C,0xE6,0x76,0xD9,0xA9,0x29,0x7D,0x32,0xDD,0xC9,0x36,0x3C,0xBD,0xAE, -0x35,0xF1,0x11,0x9E,0x1D,0xBB,0x90,0x3F,0x12,0x47,0x4E,0x8E,0xD7,0x7E,0x0F,0x62, -0x73,0x1D,0x52,0x26,0x38,0x1C,0x18,0x49,0xFD,0x30,0x74,0x9A,0xC4,0xE5,0x22,0x2F, -0xD8,0xC0,0x8D,0xED,0x91,0x7A,0x4C,0x00,0x8F,0x72,0x7F,0x5D,0xDA,0xDD,0x1B,0x8B, -0x45,0x6B,0xE7,0xDD,0x69,0x97,0xA8,0xC5,0x56,0x4C,0x0F,0x0C,0xF6,0x9F,0x7A,0x91, -0x37,0xF6,0x97,0x82,0xE0,0xDD,0x71,0x69,0xFF,0x76,0x3F,0x60,0x4D,0x3C,0xCF,0xF7, -0x99,0xF9,0xC6,0x57,0xF4,0xC9,0x55,0x39,0x78,0xBA,0x2C,0x79,0xC9,0xA6,0x88,0x2B, -0xF4,0x08, -}; - - -const unsigned char* kSSLCertCertificateList[] = { - GlobalSign_Root_CA_certificate, - USERTrust_RSA_Certification_Authority_certificate, - Starfield_Class_2_CA_certificate, - Verisign_Class_3_Public_Primary_Certification_Authority___G3_certificate, - USERTrust_ECC_Certification_Authority_certificate, - GeoTrust_Global_CA_certificate, - Starfield_Root_Certificate_Authority___G2_certificate, - DigiCert_Global_Root_G3_certificate, - thawte_Primary_Root_CA___G2_certificate, - VeriSign_Universal_Root_Certification_Authority_certificate, - VeriSign_Class_3_Public_Primary_Certification_Authority___G4_certificate, - DigiCert_Global_Root_G2_certificate, - AddTrust_Low_Value_Services_Root_certificate, - AffirmTrust_Premium_ECC_certificate, - Verisign_Class_4_Public_Primary_Certification_Authority___G3_certificate, - thawte_Primary_Root_CA_certificate, - AddTrust_Public_Services_Root_certificate, - AddTrust_Qualified_Certificates_Root_certificate, - GeoTrust_Primary_Certification_Authority___G3_certificate, - GeoTrust_Universal_CA_2_certificate, - Baltimore_CyberTrust_Root_certificate, - GlobalSign_Root_CA___R2_certificate, - GlobalSign_Root_CA___R3_certificate, - AffirmTrust_Networking_certificate, - AddTrust_External_Root_certificate, - thawte_Primary_Root_CA___G3_certificate, - DigiCert_Assured_ID_Root_CA_certificate, - Go_Daddy_Class_2_CA_certificate, - GeoTrust_Primary_Certification_Authority_certificate, - VeriSign_Class_3_Public_Primary_Certification_Authority___G5_certificate, - Equifax_Secure_CA_certificate, - Entrust_net_Premium_2048_Secure_Server_CA_certificate, - DigiCert_Assured_ID_Root_G3_certificate, - COMODO_Certification_Authority_certificate, - DigiCert_Global_Root_CA_certificate, - Comodo_AAA_Services_root_certificate, - DigiCert_High_Assurance_EV_Root_CA_certificate, - GeoTrust_Universal_CA_certificate, - COMODO_ECC_Certification_Authority_certificate, - Entrust_Root_Certification_Authority___G2_certificate, - DigiCert_Assured_ID_Root_G2_certificate, - AffirmTrust_Commercial_certificate, - AffirmTrust_Premium_certificate, - Go_Daddy_Root_Certificate_Authority___G2_certificate, - Comodo_Secure_Services_root_certificate, - DigiCert_Trusted_Root_G4_certificate, - GlobalSign_ECC_Root_CA___R5_certificate, - UTN_USERFirst_Hardware_Root_CA_certificate, - GlobalSign_ECC_Root_CA___R4_certificate, - TC_TrustCenter_Universal_CA_I_certificate, - Comodo_Trusted_Services_root_certificate, - Entrust_Root_Certification_Authority_certificate, - TC_TrustCenter_Class_2_CA_II_certificate, - Cybertrust_Global_Root_certificate, - Entrust_Root_Certification_Authority___EC1_certificate, - GeoTrust_Primary_Certification_Authority___G2_certificate, - GeoTrust_Global_CA_2_certificate, - COMODO_RSA_Certification_Authority_certificate, - UTN_DATACorp_SGC_Root_CA_certificate, -}; - -const size_t kSSLCertCertificateSizeList[] = { - 889, - 1506, - 1043, - 1054, - 659, - 856, - 993, - 579, - 652, - 1213, - 904, - 914, - 1052, - 514, - 1054, - 1060, - 1049, - 1058, - 1026, - 1392, - 891, - 958, - 867, - 848, - 1082, - 1070, - 955, - 1028, - 896, - 1239, - 804, - 1120, - 586, - 1057, - 947, - 1078, - 969, - 1388, - 653, - 1090, - 922, - 848, - 1354, - 969, - 1091, - 1428, - 546, - 1144, - 485, - 993, - 1095, - 1173, - 1198, - 933, - 765, - 690, - 874, - 1500, - 1122, -}; - diff --git a/include/webrtc/base/sslsocketfactory.h b/include/webrtc/base/sslsocketfactory.h deleted file mode 100644 index 792c15c..0000000 --- a/include/webrtc/base/sslsocketfactory.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2007 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SSLSOCKETFACTORY_H__ -#define WEBRTC_BASE_SSLSOCKETFACTORY_H__ - -#include "webrtc/base/proxyinfo.h" -#include "webrtc/base/socketserver.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// SslSocketFactory -/////////////////////////////////////////////////////////////////////////////// - -class SslSocketFactory : public SocketFactory { - public: - SslSocketFactory(SocketFactory* factory, const std::string& user_agent); - ~SslSocketFactory() override; - - void SetAutoDetectProxy() { - autodetect_proxy_ = true; - } - void SetForceConnect(bool force) { - force_connect_ = force; - } - void SetProxy(const ProxyInfo& proxy) { - autodetect_proxy_ = false; - proxy_ = proxy; - } - bool autodetect_proxy() const { return autodetect_proxy_; } - const ProxyInfo& proxy() const { return proxy_; } - - void UseSSL(const char* hostname) { hostname_ = hostname; } - void DisableSSL() { hostname_.clear(); } - void SetIgnoreBadCert(bool ignore) { ignore_bad_cert_ = ignore; } - bool ignore_bad_cert() const { return ignore_bad_cert_; } - - void SetLogging(LoggingSeverity level, const std::string& label, - bool binary_mode = false) { - logging_level_ = level; - logging_label_ = label; - binary_mode_ = binary_mode; - } - - // SocketFactory Interface - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - private: - friend class ProxySocketAdapter; - AsyncSocket* CreateProxySocket(const ProxyInfo& proxy, int family, int type); - - SocketFactory* factory_; - std::string agent_; - bool autodetect_proxy_, force_connect_; - ProxyInfo proxy_; - std::string hostname_, logging_label_; - LoggingSeverity logging_level_; - bool binary_mode_; - bool ignore_bad_cert_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_SSLSOCKETFACTORY_H__ diff --git a/include/webrtc/base/sslstreamadapter.h b/include/webrtc/base/sslstreamadapter.h deleted file mode 100644 index c57056b..0000000 --- a/include/webrtc/base/sslstreamadapter.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SSLSTREAMADAPTER_H_ -#define WEBRTC_BASE_SSLSTREAMADAPTER_H_ - -#include -#include - -#include "webrtc/base/stream.h" -#include "webrtc/base/sslidentity.h" - -namespace rtc { - -// Constants for SSL profile. -const int TLS_NULL_WITH_NULL_NULL = 0; - -// Constants for SRTP profiles. -const int SRTP_INVALID_CRYPTO_SUITE = 0; -const int SRTP_AES128_CM_SHA1_80 = 0x0001; -const int SRTP_AES128_CM_SHA1_32 = 0x0002; - -// Cipher suite to use for SRTP. Typically a 80-bit HMAC will be used, except -// in applications (voice) where the additional bandwidth may be significant. -// A 80-bit HMAC is always used for SRTCP. -// 128-bit AES with 80-bit SHA-1 HMAC. -extern const char CS_AES_CM_128_HMAC_SHA1_80[]; -// 128-bit AES with 32-bit SHA-1 HMAC. -extern const char CS_AES_CM_128_HMAC_SHA1_32[]; - -// Given the DTLS-SRTP protection profile ID, as defined in -// https://tools.ietf.org/html/rfc4568#section-6.2 , return the SRTP profile -// name, as defined in https://tools.ietf.org/html/rfc5764#section-4.1.2. -std::string SrtpCryptoSuiteToName(int crypto_suite); - -// The reverse of above conversion. -int SrtpCryptoSuiteFromName(const std::string& crypto_suite); - -// SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS. -// After SSL has been started, the stream will only open on successful -// SSL verification of certificates, and the communication is -// encrypted of course. -// -// This class was written with SSLAdapter as a starting point. It -// offers a similar interface, with two differences: there is no -// support for a restartable SSL connection, and this class has a -// peer-to-peer mode. -// -// The SSL library requires initialization and cleanup. Static method -// for doing this are in SSLAdapter. They should possibly be moved out -// to a neutral class. - - -enum SSLRole { SSL_CLIENT, SSL_SERVER }; -enum SSLMode { SSL_MODE_TLS, SSL_MODE_DTLS }; -enum SSLProtocolVersion { - SSL_PROTOCOL_TLS_10, - SSL_PROTOCOL_TLS_11, - SSL_PROTOCOL_TLS_12, - SSL_PROTOCOL_DTLS_10 = SSL_PROTOCOL_TLS_11, - SSL_PROTOCOL_DTLS_12 = SSL_PROTOCOL_TLS_12, -}; - -// Errors for Read -- in the high range so no conflict with OpenSSL. -enum { SSE_MSG_TRUNC = 0xff0001 }; - -class SSLStreamAdapter : public StreamAdapterInterface { - public: - // Instantiate an SSLStreamAdapter wrapping the given stream, - // (using the selected implementation for the platform). - // Caller is responsible for freeing the returned object. - static SSLStreamAdapter* Create(StreamInterface* stream); - - explicit SSLStreamAdapter(StreamInterface* stream) - : StreamAdapterInterface(stream), ignore_bad_cert_(false), - client_auth_enabled_(true) { } - - void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } - bool ignore_bad_cert() const { return ignore_bad_cert_; } - - void set_client_auth_enabled(bool enabled) { client_auth_enabled_ = enabled; } - bool client_auth_enabled() const { return client_auth_enabled_; } - - // Specify our SSL identity: key and certificate. Mostly this is - // only used in the peer-to-peer mode (unless we actually want to - // provide a client certificate to a server). - // SSLStream takes ownership of the SSLIdentity object and will - // free it when appropriate. Should be called no more than once on a - // given SSLStream instance. - virtual void SetIdentity(SSLIdentity* identity) = 0; - - // Call this to indicate that we are to play the server's role in - // the peer-to-peer mode. - // The default argument is for backward compatibility - // TODO(ekr@rtfm.com): rename this SetRole to reflect its new function - virtual void SetServerRole(SSLRole role = SSL_SERVER) = 0; - - // Do DTLS or TLS - virtual void SetMode(SSLMode mode) = 0; - - // Set maximum supported protocol version. The highest version supported by - // both ends will be used for the connection, i.e. if one party supports - // DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. - // If requested version is not supported by underlying crypto library, the - // next lower will be used. - virtual void SetMaxProtocolVersion(SSLProtocolVersion version) = 0; - - // The mode of operation is selected by calling either - // StartSSLWithServer or StartSSLWithPeer. - // Use of the stream prior to calling either of these functions will - // pass data in clear text. - // Calling one of these functions causes SSL negotiation to begin as - // soon as possible: right away if the underlying wrapped stream is - // already opened, or else as soon as it opens. - // - // These functions return a negative error code on failure. - // Returning 0 means success so far, but negotiation is probably not - // complete and will continue asynchronously. In that case, the - // exposed stream will open after successful negotiation and - // verification, or an SE_CLOSE event will be raised if negotiation - // fails. - - // StartSSLWithServer starts SSL negotiation with a server in - // traditional mode. server_name specifies the expected server name - // which the server's certificate needs to specify. - virtual int StartSSLWithServer(const char* server_name) = 0; - - // StartSSLWithPeer starts negotiation in the special peer-to-peer - // mode. - // Generally, SetIdentity() and possibly SetServerRole() should have - // been called before this. - // SetPeerCertificate() or SetPeerCertificateDigest() must also be called. - // It may be called after StartSSLWithPeer() but must be called before the - // underlying stream opens. - virtual int StartSSLWithPeer() = 0; - - // Specify the digest of the certificate that our peer is expected to use in - // peer-to-peer mode. Only this certificate will be accepted during - // SSL verification. The certificate is assumed to have been - // obtained through some other secure channel (such as the XMPP - // channel). Unlike SetPeerCertificate(), this must specify the - // terminal certificate, not just a CA. - // SSLStream makes a copy of the digest value. - virtual bool SetPeerCertificateDigest(const std::string& digest_alg, - const unsigned char* digest_val, - size_t digest_len) = 0; - - // Retrieves the peer's X.509 certificate, if a connection has been - // established. It returns the transmitted over SSL, including the entire - // chain. The returned certificate is owned by the caller. - virtual bool GetPeerCertificate(SSLCertificate** cert) const = 0; - - // Retrieves the IANA registration id of the cipher suite used for the - // connection (e.g. 0x2F for "TLS_RSA_WITH_AES_128_CBC_SHA"). - virtual bool GetSslCipherSuite(int* cipher_suite); - - // Key Exporter interface from RFC 5705 - // Arguments are: - // label -- the exporter label. - // part of the RFC defining each exporter - // usage (IN) - // context/context_len -- a context to bind to for this connection; - // optional, can be NULL, 0 (IN) - // use_context -- whether to use the context value - // (needed to distinguish no context from - // zero-length ones). - // result -- where to put the computed value - // result_len -- the length of the computed value - virtual bool ExportKeyingMaterial(const std::string& label, - const uint8_t* context, - size_t context_len, - bool use_context, - uint8_t* result, - size_t result_len); - - // DTLS-SRTP interface - virtual bool SetDtlsSrtpCryptoSuites(const std::vector& crypto_suites); - virtual bool GetDtlsSrtpCryptoSuite(int* crypto_suite); - - // Capabilities testing - static bool HaveDtls(); - static bool HaveDtlsSrtp(); - static bool HaveExporter(); - - // Returns the default Ssl cipher used between streams of this class - // for the given protocol version. This is used by the unit tests. - // TODO(guoweis): Move this away from a static class method. - static int GetDefaultSslCipherForTest(SSLProtocolVersion version, - KeyType key_type); - - // TODO(guoweis): Move this away from a static class method. Currently this is - // introduced such that any caller could depend on sslstreamadapter.h without - // depending on specific SSL implementation. - static std::string SslCipherSuiteToName(int cipher_suite); - - private: - // If true, the server certificate need not match the configured - // server_name, and in fact missing certificate authority and other - // verification errors are ignored. - bool ignore_bad_cert_; - - // If true (default), the client is required to provide a certificate during - // handshake. If no certificate is given, handshake fails. This applies to - // server mode only. - bool client_auth_enabled_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ diff --git a/include/webrtc/base/sslstreamadapterhelper.h b/include/webrtc/base/sslstreamadapterhelper.h deleted file mode 100644 index c6979ba..0000000 --- a/include/webrtc/base/sslstreamadapterhelper.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SSLSTREAMADAPTERHELPER_H_ -#define WEBRTC_BASE_SSLSTREAMADAPTERHELPER_H_ - -#include -#include - -#include "webrtc/base/buffer.h" -#include "webrtc/base/stream.h" -#include "webrtc/base/sslidentity.h" -#include "webrtc/base/sslstreamadapter.h" - -namespace rtc { - -// SSLStreamAdapterHelper : A stream adapter which implements much -// of the logic that is common between the known implementations -// (OpenSSL and previously NSS) -class SSLStreamAdapterHelper : public SSLStreamAdapter { - public: - explicit SSLStreamAdapterHelper(StreamInterface* stream); - ~SSLStreamAdapterHelper() override; - - // Overrides of SSLStreamAdapter - void SetIdentity(SSLIdentity* identity) override; - void SetServerRole(SSLRole role = SSL_SERVER) override; - void SetMode(SSLMode mode) override; - void SetMaxProtocolVersion(SSLProtocolVersion version) override; - - int StartSSLWithServer(const char* server_name) override; - int StartSSLWithPeer() override; - - bool SetPeerCertificateDigest(const std::string& digest_alg, - const unsigned char* digest_val, - size_t digest_len) override; - bool GetPeerCertificate(SSLCertificate** cert) const override; - StreamState GetState() const override; - void Close() override; - - protected: - // Internal helper methods - // The following method returns 0 on success and a negative - // error code on failure. The error code may be either -1 or - // from the impl on some other error cases, so it can't really be - // interpreted unfortunately. - - // Perform SSL negotiation steps. - int ContinueSSL(); - - // Error handler helper. signal is given as true for errors in - // asynchronous contexts (when an error code was not returned - // through some other method), and in that case an SE_CLOSE event is - // raised on the stream with the specified error. - // A 0 error means a graceful close, otherwise there is not really enough - // context to interpret the error code. - virtual void Error(const char* context, int err, bool signal); - - // Must be implemented by descendents - virtual int BeginSSL() = 0; - virtual void Cleanup() = 0; - virtual bool GetDigestLength(const std::string& algorithm, - size_t* length) = 0; - - enum SSLState { - // Before calling one of the StartSSL methods, data flows - // in clear text. - SSL_NONE, - SSL_WAIT, // waiting for the stream to open to start SSL negotiation - SSL_CONNECTING, // SSL negotiation in progress - SSL_CONNECTED, // SSL stream successfully established - SSL_ERROR, // some SSL error occurred, stream is closed - SSL_CLOSED // Clean close - }; - - // MSG_MAX is the maximum generic stream message number. - enum { MSG_DTLS_TIMEOUT = MSG_MAX + 1 }; - - SSLState state_; - SSLRole role_; - int ssl_error_code_; // valid when state_ == SSL_ERROR - - // Our key and certificate, mostly useful in peer-to-peer mode. - scoped_ptr identity_; - // in traditional mode, the server name that the server's certificate - // must specify. Empty in peer-to-peer mode. - std::string ssl_server_name_; - // The peer's certificate. Only used for GetPeerCertificate. - scoped_ptr peer_certificate_; - - // The digest of the certificate that the peer must present. - Buffer peer_certificate_digest_value_; - std::string peer_certificate_digest_algorithm_; - - // Do DTLS or not - SSLMode ssl_mode_; - - // Maximum allowed protocol version. - SSLProtocolVersion ssl_max_version_; - - private: - // Go from state SSL_NONE to either SSL_CONNECTING or SSL_WAIT, - // depending on whether the underlying stream is already open or - // not. Returns 0 on success and a negative value on error. - int StartSSL(); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SSLSTREAMADAPTERHELPER_H_ diff --git a/include/webrtc/base/stream.h b/include/webrtc/base/stream.h deleted file mode 100644 index c57daae..0000000 --- a/include/webrtc/base/stream.h +++ /dev/null @@ -1,703 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_STREAM_H_ -#define WEBRTC_BASE_STREAM_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/messagehandler.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// StreamInterface is a generic asynchronous stream interface, supporting read, -// write, and close operations, and asynchronous signalling of state changes. -// The interface is designed with file, memory, and socket implementations in -// mind. Some implementations offer extended operations, such as seeking. -/////////////////////////////////////////////////////////////////////////////// - -// The following enumerations are declared outside of the StreamInterface -// class for brevity in use. - -// The SS_OPENING state indicates that the stream will signal open or closed -// in the future. -enum StreamState { SS_CLOSED, SS_OPENING, SS_OPEN }; - -// Stream read/write methods return this value to indicate various success -// and failure conditions described below. -enum StreamResult { SR_ERROR, SR_SUCCESS, SR_BLOCK, SR_EOS }; - -// StreamEvents are used to asynchronously signal state transitionss. The flags -// may be combined. -// SE_OPEN: The stream has transitioned to the SS_OPEN state -// SE_CLOSE: The stream has transitioned to the SS_CLOSED state -// SE_READ: Data is available, so Read is likely to not return SR_BLOCK -// SE_WRITE: Data can be written, so Write is likely to not return SR_BLOCK -enum StreamEvent { SE_OPEN = 1, SE_READ = 2, SE_WRITE = 4, SE_CLOSE = 8 }; - -class Thread; - -struct StreamEventData : public MessageData { - int events, error; - StreamEventData(int ev, int er) : events(ev), error(er) { } -}; - -class StreamInterface : public MessageHandler { - public: - enum { - MSG_POST_EVENT = 0xF1F1, MSG_MAX = MSG_POST_EVENT - }; - - ~StreamInterface() override; - - virtual StreamState GetState() const = 0; - - // Read attempts to fill buffer of size buffer_len. Write attempts to send - // data_len bytes stored in data. The variables read and write are set only - // on SR_SUCCESS (see below). Likewise, error is only set on SR_ERROR. - // Read and Write return a value indicating: - // SR_ERROR: an error occurred, which is returned in a non-null error - // argument. Interpretation of the error requires knowledge of the - // stream's concrete type, which limits its usefulness. - // SR_SUCCESS: some number of bytes were successfully written, which is - // returned in a non-null read/write argument. - // SR_BLOCK: the stream is in non-blocking mode, and the operation would - // block, or the stream is in SS_OPENING state. - // SR_EOS: the end-of-stream has been reached, or the stream is in the - // SS_CLOSED state. - virtual StreamResult Read(void* buffer, size_t buffer_len, - size_t* read, int* error) = 0; - virtual StreamResult Write(const void* data, size_t data_len, - size_t* written, int* error) = 0; - // Attempt to transition to the SS_CLOSED state. SE_CLOSE will not be - // signalled as a result of this call. - virtual void Close() = 0; - - // Streams may signal one or more StreamEvents to indicate state changes. - // The first argument identifies the stream on which the state change occured. - // The second argument is a bit-wise combination of StreamEvents. - // If SE_CLOSE is signalled, then the third argument is the associated error - // code. Otherwise, the value is undefined. - // Note: Not all streams will support asynchronous event signalling. However, - // SS_OPENING and SR_BLOCK returned from stream member functions imply that - // certain events will be raised in the future. - sigslot::signal3 SignalEvent; - - // Like calling SignalEvent, but posts a message to the specified thread, - // which will call SignalEvent. This helps unroll the stack and prevent - // re-entrancy. - void PostEvent(Thread* t, int events, int err); - // Like the aforementioned method, but posts to the current thread. - void PostEvent(int events, int err); - - // - // OPTIONAL OPERATIONS - // - // Not all implementations will support the following operations. In general, - // a stream will only support an operation if it reasonably efficient to do - // so. For example, while a socket could buffer incoming data to support - // seeking, it will not do so. Instead, a buffering stream adapter should - // be used. - // - // Even though several of these operations are related, you should - // always use whichever operation is most relevant. For example, you may - // be tempted to use GetSize() and GetPosition() to deduce the result of - // GetAvailable(). However, a stream which is read-once may support the - // latter operation but not the former. - // - - // The following four methods are used to avoid copying data multiple times. - - // GetReadData returns a pointer to a buffer which is owned by the stream. - // The buffer contains data_len bytes. NULL is returned if no data is - // available, or if the method fails. If the caller processes the data, it - // must call ConsumeReadData with the number of processed bytes. GetReadData - // does not require a matching call to ConsumeReadData if the data is not - // processed. Read and ConsumeReadData invalidate the buffer returned by - // GetReadData. - virtual const void* GetReadData(size_t* data_len); - virtual void ConsumeReadData(size_t used) {} - - // GetWriteBuffer returns a pointer to a buffer which is owned by the stream. - // The buffer has a capacity of buf_len bytes. NULL is returned if there is - // no buffer available, or if the method fails. The call may write data to - // the buffer, and then call ConsumeWriteBuffer with the number of bytes - // written. GetWriteBuffer does not require a matching call to - // ConsumeWriteData if no data is written. Write, ForceWrite, and - // ConsumeWriteData invalidate the buffer returned by GetWriteBuffer. - // TODO: Allow the caller to specify a minimum buffer size. If the specified - // amount of buffer is not yet available, return NULL and Signal SE_WRITE - // when it is available. If the requested amount is too large, return an - // error. - virtual void* GetWriteBuffer(size_t* buf_len); - virtual void ConsumeWriteBuffer(size_t used) {} - - // Write data_len bytes found in data, circumventing any throttling which - // would could cause SR_BLOCK to be returned. Returns true if all the data - // was written. Otherwise, the method is unsupported, or an unrecoverable - // error occurred, and the error value is set. This method should be used - // sparingly to write critical data which should not be throttled. A stream - // which cannot circumvent its blocking constraints should not implement this - // method. - // NOTE: This interface is being considered experimentally at the moment. It - // would be used by JUDP and BandwidthStream as a way to circumvent certain - // soft limits in writing. - //virtual bool ForceWrite(const void* data, size_t data_len, int* error) { - // if (error) *error = -1; - // return false; - //} - - // Seek to a byte offset from the beginning of the stream. Returns false if - // the stream does not support seeking, or cannot seek to the specified - // position. - virtual bool SetPosition(size_t position); - - // Get the byte offset of the current position from the start of the stream. - // Returns false if the position is not known. - virtual bool GetPosition(size_t* position) const; - - // Get the byte length of the entire stream. Returns false if the length - // is not known. - virtual bool GetSize(size_t* size) const; - - // Return the number of Read()-able bytes remaining before end-of-stream. - // Returns false if not known. - virtual bool GetAvailable(size_t* size) const; - - // Return the number of Write()-able bytes remaining before end-of-stream. - // Returns false if not known. - virtual bool GetWriteRemaining(size_t* size) const; - - // Return true if flush is successful. - virtual bool Flush(); - - // Communicates the amount of data which will be written to the stream. The - // stream may choose to preallocate memory to accomodate this data. The - // stream may return false to indicate that there is not enough room (ie, - // Write will return SR_EOS/SR_ERROR at some point). Note that calling this - // function should not affect the existing state of data in the stream. - virtual bool ReserveSize(size_t size); - - // - // CONVENIENCE METHODS - // - // These methods are implemented in terms of other methods, for convenience. - // - - // Seek to the start of the stream. - inline bool Rewind() { return SetPosition(0); } - - // WriteAll is a helper function which repeatedly calls Write until all the - // data is written, or something other than SR_SUCCESS is returned. Note that - // unlike Write, the argument 'written' is always set, and may be non-zero - // on results other than SR_SUCCESS. The remaining arguments have the - // same semantics as Write. - StreamResult WriteAll(const void* data, size_t data_len, - size_t* written, int* error); - - // Similar to ReadAll. Calls Read until buffer_len bytes have been read, or - // until a non-SR_SUCCESS result is returned. 'read' is always set. - StreamResult ReadAll(void* buffer, size_t buffer_len, - size_t* read, int* error); - - // ReadLine is a helper function which repeatedly calls Read until it hits - // the end-of-line character, or something other than SR_SUCCESS. - // TODO: this is too inefficient to keep here. Break this out into a buffered - // readline object or adapter - StreamResult ReadLine(std::string* line); - - protected: - StreamInterface(); - - // MessageHandler Interface - void OnMessage(Message* msg) override; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterface); -}; - -/////////////////////////////////////////////////////////////////////////////// -// StreamAdapterInterface is a convenient base-class for adapting a stream. -// By default, all operations are pass-through. Override the methods that you -// require adaptation. Streams should really be upgraded to reference-counted. -// In the meantime, use the owned flag to indicate whether the adapter should -// own the adapted stream. -/////////////////////////////////////////////////////////////////////////////// - -class StreamAdapterInterface : public StreamInterface, - public sigslot::has_slots<> { - public: - explicit StreamAdapterInterface(StreamInterface* stream, bool owned = true); - - // Core Stream Interface - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - - // Optional Stream Interface - /* Note: Many stream adapters were implemented prior to this Read/Write - interface. Therefore, a simple pass through of data in those cases may - be broken. At a later time, we should do a once-over pass of all - adapters, and make them compliant with these interfaces, after which this - code can be uncommented. - virtual const void* GetReadData(size_t* data_len) { - return stream_->GetReadData(data_len); - } - virtual void ConsumeReadData(size_t used) { - stream_->ConsumeReadData(used); - } - - virtual void* GetWriteBuffer(size_t* buf_len) { - return stream_->GetWriteBuffer(buf_len); - } - virtual void ConsumeWriteBuffer(size_t used) { - stream_->ConsumeWriteBuffer(used); - } - */ - - /* Note: This interface is currently undergoing evaluation. - virtual bool ForceWrite(const void* data, size_t data_len, int* error) { - return stream_->ForceWrite(data, data_len, error); - } - */ - - bool SetPosition(size_t position) override; - bool GetPosition(size_t* position) const override; - bool GetSize(size_t* size) const override; - bool GetAvailable(size_t* size) const override; - bool GetWriteRemaining(size_t* size) const override; - bool ReserveSize(size_t size) override; - bool Flush() override; - - void Attach(StreamInterface* stream, bool owned = true); - StreamInterface* Detach(); - - protected: - ~StreamAdapterInterface() override; - - // Note that the adapter presents itself as the origin of the stream events, - // since users of the adapter may not recognize the adapted object. - virtual void OnEvent(StreamInterface* stream, int events, int err); - StreamInterface* stream() { return stream_; } - - private: - StreamInterface* stream_; - bool owned_; - RTC_DISALLOW_COPY_AND_ASSIGN(StreamAdapterInterface); -}; - -/////////////////////////////////////////////////////////////////////////////// -// StreamTap is a non-modifying, pass-through adapter, which copies all data -// in either direction to the tap. Note that errors or blocking on writing to -// the tap will prevent further tap writes from occurring. -/////////////////////////////////////////////////////////////////////////////// - -class StreamTap : public StreamAdapterInterface { - public: - explicit StreamTap(StreamInterface* stream, StreamInterface* tap); - ~StreamTap() override; - - void AttachTap(StreamInterface* tap); - StreamInterface* DetachTap(); - StreamResult GetTapResult(int* error); - - // StreamAdapterInterface Interface - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - - private: - scoped_ptr tap_; - StreamResult tap_result_; - int tap_error_; - RTC_DISALLOW_COPY_AND_ASSIGN(StreamTap); -}; - -/////////////////////////////////////////////////////////////////////////////// -// NullStream gives errors on read, and silently discards all written data. -/////////////////////////////////////////////////////////////////////////////// - -class NullStream : public StreamInterface { - public: - NullStream(); - ~NullStream() override; - - // StreamInterface Interface - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; -}; - -/////////////////////////////////////////////////////////////////////////////// -// FileStream is a simple implementation of a StreamInterface, which does not -// support asynchronous notification. -/////////////////////////////////////////////////////////////////////////////// - -class FileStream : public StreamInterface { - public: - FileStream(); - ~FileStream() override; - - // The semantics of filename and mode are the same as stdio's fopen - virtual bool Open(const std::string& filename, const char* mode, int* error); - virtual bool OpenShare(const std::string& filename, const char* mode, - int shflag, int* error); - - // By default, reads and writes are buffered for efficiency. Disabling - // buffering causes writes to block until the bytes on disk are updated. - virtual bool DisableBuffering(); - - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - bool SetPosition(size_t position) override; - bool GetPosition(size_t* position) const override; - bool GetSize(size_t* size) const override; - bool GetAvailable(size_t* size) const override; - bool ReserveSize(size_t size) override; - - bool Flush() override; - -#if defined(WEBRTC_POSIX) && !defined(__native_client__) - // Tries to aquire an exclusive lock on the file. - // Use OpenShare(...) on win32 to get similar functionality. - bool TryLock(); - bool Unlock(); -#endif - - // Note: Deprecated in favor of Filesystem::GetFileSize(). - static bool GetSize(const std::string& filename, size_t* size); - - protected: - virtual void DoClose(); - - FILE* file_; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(FileStream); -}; - -/////////////////////////////////////////////////////////////////////////////// -// MemoryStream is a simple implementation of a StreamInterface over in-memory -// data. Data is read and written at the current seek position. Reads return -// end-of-stream when they reach the end of data. Writes actually extend the -// end of data mark. -/////////////////////////////////////////////////////////////////////////////// - -class MemoryStreamBase : public StreamInterface { - public: - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t bytes, - size_t* bytes_read, - int* error) override; - StreamResult Write(const void* buffer, - size_t bytes, - size_t* bytes_written, - int* error) override; - void Close() override; - bool SetPosition(size_t position) override; - bool GetPosition(size_t* position) const override; - bool GetSize(size_t* size) const override; - bool GetAvailable(size_t* size) const override; - bool ReserveSize(size_t size) override; - - char* GetBuffer() { return buffer_; } - const char* GetBuffer() const { return buffer_; } - - protected: - MemoryStreamBase(); - - virtual StreamResult DoReserve(size_t size, int* error); - - // Invariant: 0 <= seek_position <= data_length_ <= buffer_length_ - char* buffer_; - size_t buffer_length_; - size_t data_length_; - size_t seek_position_; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(MemoryStreamBase); -}; - -// MemoryStream dynamically resizes to accomodate written data. - -class MemoryStream : public MemoryStreamBase { - public: - MemoryStream(); - explicit MemoryStream(const char* data); // Calls SetData(data, strlen(data)) - MemoryStream(const void* data, size_t length); // Calls SetData(data, length) - ~MemoryStream() override; - - void SetData(const void* data, size_t length); - - protected: - StreamResult DoReserve(size_t size, int* error) override; - // Memory Streams are aligned for efficiency. - static const int kAlignment = 16; - char* buffer_alloc_; -}; - -// ExternalMemoryStream adapts an external memory buffer, so writes which would -// extend past the end of the buffer will return end-of-stream. - -class ExternalMemoryStream : public MemoryStreamBase { - public: - ExternalMemoryStream(); - ExternalMemoryStream(void* data, size_t length); - ~ExternalMemoryStream() override; - - void SetData(void* data, size_t length); -}; - -// FifoBuffer allows for efficient, thread-safe buffering of data between -// writer and reader. As the data can wrap around the end of the buffer, -// MemoryStreamBase can't help us here. - -class FifoBuffer : public StreamInterface { - public: - // Creates a FIFO buffer with the specified capacity. - explicit FifoBuffer(size_t length); - // Creates a FIFO buffer with the specified capacity and owner - FifoBuffer(size_t length, Thread* owner); - ~FifoBuffer() override; - // Gets the amount of data currently readable from the buffer. - bool GetBuffered(size_t* data_len) const; - // Resizes the buffer to the specified capacity. Fails if data_length_ > size - bool SetCapacity(size_t length); - - // Read into |buffer| with an offset from the current read position, offset - // is specified in number of bytes. - // This method doesn't adjust read position nor the number of available - // bytes, user has to call ConsumeReadData() to do this. - StreamResult ReadOffset(void* buffer, size_t bytes, size_t offset, - size_t* bytes_read); - - // Write |buffer| with an offset from the current write position, offset is - // specified in number of bytes. - // This method doesn't adjust the number of buffered bytes, user has to call - // ConsumeWriteBuffer() to do this. - StreamResult WriteOffset(const void* buffer, size_t bytes, size_t offset, - size_t* bytes_written); - - // StreamInterface methods - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t bytes, - size_t* bytes_read, - int* error) override; - StreamResult Write(const void* buffer, - size_t bytes, - size_t* bytes_written, - int* error) override; - void Close() override; - const void* GetReadData(size_t* data_len) override; - void ConsumeReadData(size_t used) override; - void* GetWriteBuffer(size_t* buf_len) override; - void ConsumeWriteBuffer(size_t used) override; - bool GetWriteRemaining(size_t* size) const override; - - private: - // Helper method that implements ReadOffset. Caller must acquire a lock - // when calling this method. - StreamResult ReadOffsetLocked(void* buffer, size_t bytes, size_t offset, - size_t* bytes_read); - - // Helper method that implements WriteOffset. Caller must acquire a lock - // when calling this method. - StreamResult WriteOffsetLocked(const void* buffer, size_t bytes, - size_t offset, size_t* bytes_written); - - StreamState state_; // keeps the opened/closed state of the stream - scoped_ptr buffer_; // the allocated buffer - size_t buffer_length_; // size of the allocated buffer - size_t data_length_; // amount of readable data in the buffer - size_t read_position_; // offset to the readable data - Thread* owner_; // stream callbacks are dispatched on this thread - mutable CriticalSection crit_; // object lock - RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer); -}; - -/////////////////////////////////////////////////////////////////////////////// - -class LoggingAdapter : public StreamAdapterInterface { - public: - LoggingAdapter(StreamInterface* stream, LoggingSeverity level, - const std::string& label, bool hex_mode = false); - - void set_label(const std::string& label); - - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - - protected: - void OnEvent(StreamInterface* stream, int events, int err) override; - - private: - LoggingSeverity level_; - std::string label_; - bool hex_mode_; - LogMultilineState lms_; - - RTC_DISALLOW_COPY_AND_ASSIGN(LoggingAdapter); -}; - -/////////////////////////////////////////////////////////////////////////////// -// StringStream - Reads/Writes to an external std::string -/////////////////////////////////////////////////////////////////////////////// - -class StringStream : public StreamInterface { - public: - explicit StringStream(std::string* str); - explicit StringStream(const std::string& str); - - StreamState GetState() const override; - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - bool SetPosition(size_t position) override; - bool GetPosition(size_t* position) const override; - bool GetSize(size_t* size) const override; - bool GetAvailable(size_t* size) const override; - bool ReserveSize(size_t size) override; - - private: - std::string& str_; - size_t read_pos_; - bool read_only_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// StreamReference - A reference counting stream adapter -/////////////////////////////////////////////////////////////////////////////// - -// Keep in mind that the streams and adapters defined in this file are -// not thread-safe, so this has limited uses. - -// A StreamRefCount holds the reference count and a pointer to the -// wrapped stream. It deletes the wrapped stream when there are no -// more references. We can then have multiple StreamReference -// instances pointing to one StreamRefCount, all wrapping the same -// stream. - -class StreamReference : public StreamAdapterInterface { - class StreamRefCount; - public: - // Constructor for the first reference to a stream - // Note: get more references through NewReference(). Use this - // constructor only once on a given stream. - explicit StreamReference(StreamInterface* stream); - StreamInterface* GetStream() { return stream(); } - StreamInterface* NewReference(); - ~StreamReference() override; - - private: - class StreamRefCount { - public: - explicit StreamRefCount(StreamInterface* stream) - : stream_(stream), ref_count_(1) { - } - void AddReference() { - CritScope lock(&cs_); - ++ref_count_; - } - void Release() { - int ref_count; - { // Atomic ops would have been a better fit here. - CritScope lock(&cs_); - ref_count = --ref_count_; - } - if (ref_count == 0) { - delete stream_; - delete this; - } - } - private: - StreamInterface* stream_; - int ref_count_; - CriticalSection cs_; - RTC_DISALLOW_COPY_AND_ASSIGN(StreamRefCount); - }; - - // Constructor for adding references - explicit StreamReference(StreamRefCount* stream_ref_count, - StreamInterface* stream); - - StreamRefCount* stream_ref_count_; - RTC_DISALLOW_COPY_AND_ASSIGN(StreamReference); -}; - -/////////////////////////////////////////////////////////////////////////////// - -// Flow attempts to move bytes from source to sink via buffer of size -// buffer_len. The function returns SR_SUCCESS when source reaches -// end-of-stream (returns SR_EOS), and all the data has been written successful -// to sink. Alternately, if source returns SR_BLOCK or SR_ERROR, or if sink -// returns SR_BLOCK, SR_ERROR, or SR_EOS, then the function immediately returns -// with the unexpected StreamResult value. -// data_len is the length of the valid data in buffer. in case of error -// this is the data that read from source but can't move to destination. -// as a pass in parameter, it indicates data in buffer that should move to sink -StreamResult Flow(StreamInterface* source, - char* buffer, size_t buffer_len, - StreamInterface* sink, size_t* data_len = NULL); - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_STREAM_H_ diff --git a/include/webrtc/base/stringencode.h b/include/webrtc/base/stringencode.h deleted file mode 100644 index 8f78ad1..0000000 --- a/include/webrtc/base/stringencode.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_STRINGENCODE_H_ -#define WEBRTC_BASE_STRINGENCODE_H_ - -#include -#include -#include - -#include "webrtc/base/checks.h" - -namespace rtc { - -////////////////////////////////////////////////////////////////////// -// String Encoding Utilities -////////////////////////////////////////////////////////////////////// - -// Convert an unsigned value to it's utf8 representation. Returns the length -// of the encoded string, or 0 if the encoding is longer than buflen - 1. -size_t utf8_encode(char* buffer, size_t buflen, unsigned long value); -// Decode the utf8 encoded value pointed to by source. Returns the number of -// bytes used by the encoding, or 0 if the encoding is invalid. -size_t utf8_decode(const char* source, size_t srclen, unsigned long* value); - -// Escaping prefixes illegal characters with the escape character. Compact, but -// illegal characters still appear in the string. -size_t escape(char * buffer, size_t buflen, - const char * source, size_t srclen, - const char * illegal, char escape); -// Note: in-place unescaping (buffer == source) is allowed. -size_t unescape(char * buffer, size_t buflen, - const char * source, size_t srclen, - char escape); - -// Encoding replaces illegal characters with the escape character and 2 hex -// chars, so it's a little less compact than escape, but completely removes -// illegal characters. note that hex digits should not be used as illegal -// characters. -size_t encode(char * buffer, size_t buflen, - const char * source, size_t srclen, - const char * illegal, char escape); -// Note: in-place decoding (buffer == source) is allowed. -size_t decode(char * buffer, size_t buflen, - const char * source, size_t srclen, - char escape); - -// Returns a list of characters that may be unsafe for use in the name of a -// file, suitable for passing to the 'illegal' member of escape or encode. -const char* unsafe_filename_characters(); - -// url_encode is an encode operation with a predefined set of illegal characters -// and escape character (for use in URLs, obviously). -size_t url_encode(char * buffer, size_t buflen, - const char * source, size_t srclen); -// Note: in-place decoding (buffer == source) is allowed. -size_t url_decode(char * buffer, size_t buflen, - const char * source, size_t srclen); - -// html_encode prevents data embedded in html from containing markup. -size_t html_encode(char * buffer, size_t buflen, - const char * source, size_t srclen); -// Note: in-place decoding (buffer == source) is allowed. -size_t html_decode(char * buffer, size_t buflen, - const char * source, size_t srclen); - -// xml_encode makes data suitable for inside xml attributes and values. -size_t xml_encode(char * buffer, size_t buflen, - const char * source, size_t srclen); -// Note: in-place decoding (buffer == source) is allowed. -size_t xml_decode(char * buffer, size_t buflen, - const char * source, size_t srclen); - -// Convert an unsigned value from 0 to 15 to the hex character equivalent... -char hex_encode(unsigned char val); -// ...and vice-versa. -bool hex_decode(char ch, unsigned char* val); - -// hex_encode shows the hex representation of binary data in ascii. -size_t hex_encode(char* buffer, size_t buflen, - const char* source, size_t srclen); - -// hex_encode, but separate each byte representation with a delimiter. -// |delimiter| == 0 means no delimiter -// If the buffer is too short, we return 0 -size_t hex_encode_with_delimiter(char* buffer, size_t buflen, - const char* source, size_t srclen, - char delimiter); - -// Helper functions for hex_encode. -std::string hex_encode(const std::string& str); -std::string hex_encode(const char* source, size_t srclen); -std::string hex_encode_with_delimiter(const char* source, size_t srclen, - char delimiter); - -// hex_decode converts ascii hex to binary. -size_t hex_decode(char* buffer, size_t buflen, - const char* source, size_t srclen); - -// hex_decode, assuming that there is a delimiter between every byte -// pair. -// |delimiter| == 0 means no delimiter -// If the buffer is too short or the data is invalid, we return 0. -size_t hex_decode_with_delimiter(char* buffer, size_t buflen, - const char* source, size_t srclen, - char delimiter); - -// Helper functions for hex_decode. -size_t hex_decode(char* buffer, size_t buflen, const std::string& source); -size_t hex_decode_with_delimiter(char* buffer, size_t buflen, - const std::string& source, char delimiter); - -// Apply any suitable string transform (including the ones above) to an STL -// string. Stack-allocated temporary space is used for the transformation, -// so value and source may refer to the same string. -typedef size_t (*Transform)(char * buffer, size_t buflen, - const char * source, size_t srclen); -size_t transform(std::string& value, size_t maxlen, const std::string& source, - Transform t); - -// Return the result of applying transform t to source. -std::string s_transform(const std::string& source, Transform t); - -// Convenience wrappers. -inline std::string s_url_encode(const std::string& source) { - return s_transform(source, url_encode); -} -inline std::string s_url_decode(const std::string& source) { - return s_transform(source, url_decode); -} - -// Splits the source string into multiple fields separated by delimiter, -// with duplicates of delimiter creating empty fields. -size_t split(const std::string& source, char delimiter, - std::vector* fields); - -// Splits the source string into multiple fields separated by delimiter, -// with duplicates of delimiter ignored. Trailing delimiter ignored. -size_t tokenize(const std::string& source, char delimiter, - std::vector* fields); - -// Tokenize, including the empty tokens. -size_t tokenize_with_empty_tokens(const std::string& source, - char delimiter, - std::vector* fields); - -// Tokenize and append the tokens to fields. Return the new size of fields. -size_t tokenize_append(const std::string& source, char delimiter, - std::vector* fields); - -// Splits the source string into multiple fields separated by delimiter, with -// duplicates of delimiter ignored. Trailing delimiter ignored. A substring in -// between the start_mark and the end_mark is treated as a single field. Return -// the size of fields. For example, if source is "filename -// \"/Library/Application Support/media content.txt\"", delimiter is ' ', and -// the start_mark and end_mark are '"', this method returns two fields: -// "filename" and "/Library/Application Support/media content.txt". -size_t tokenize(const std::string& source, char delimiter, char start_mark, - char end_mark, std::vector* fields); - -// Extract the first token from source as separated by delimiter, with -// duplicates of delimiter ignored. Return false if the delimiter could not be -// found, otherwise return true. -bool tokenize_first(const std::string& source, - const char delimiter, - std::string* token, - std::string* rest); - -// Safe sprintf to std::string -//void sprintf(std::string& value, size_t maxlen, const char * format, ...) -// PRINTF_FORMAT(3); - -// Convert arbitrary values to/from a string. - -template -static bool ToString(const T &t, std::string* s) { - RTC_DCHECK(s); - std::ostringstream oss; - oss << std::boolalpha << t; - *s = oss.str(); - return !oss.fail(); -} - -template -static bool FromString(const std::string& s, T* t) { - RTC_DCHECK(t); - std::istringstream iss(s); - iss >> std::boolalpha >> *t; - return !iss.fail(); -} - -// Inline versions of the string conversion routines. - -template -static inline std::string ToString(const T& val) { - std::string str; ToString(val, &str); return str; -} - -template -static inline T FromString(const std::string& str) { - T val; FromString(str, &val); return val; -} - -template -static inline T FromString(const T& defaultValue, const std::string& str) { - T val(defaultValue); FromString(str, &val); return val; -} - -// simple function to strip out characters which shouldn't be -// used in filenames -char make_char_safe_for_filename(char c); - -////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_STRINGENCODE_H__ diff --git a/include/webrtc/base/stringutils.h b/include/webrtc/base/stringutils.h deleted file mode 100644 index 5a6f42a..0000000 --- a/include/webrtc/base/stringutils.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_STRINGUTILS_H__ -#define WEBRTC_BASE_STRINGUTILS_H__ - -#include -#include -#include -#include - -#if defined(WEBRTC_WIN) -#include -#include -#define alloca _alloca -#endif // WEBRTC_WIN - -#if defined(WEBRTC_POSIX) -#ifdef BSD -#include -#else // BSD -#include -#endif // !BSD -#endif // WEBRTC_POSIX - -#include - -#include "webrtc/base/basictypes.h" - -/////////////////////////////////////////////////////////////////////////////// -// Generic string/memory utilities -/////////////////////////////////////////////////////////////////////////////// - -#define STACK_ARRAY(TYPE, LEN) static_cast(::alloca((LEN)*sizeof(TYPE))) - -namespace rtc { - -// Complement to memset. Verifies memory consists of count bytes of value c. -bool memory_check(const void* memory, int c, size_t count); - -// Determines whether the simple wildcard pattern matches target. -// Alpha characters in pattern match case-insensitively. -// Asterisks in pattern match 0 or more characters. -// Ex: string_match("www.TEST.GOOGLE.COM", "www.*.com") -> true -bool string_match(const char* target, const char* pattern); - -} // namespace rtc - -/////////////////////////////////////////////////////////////////////////////// -// Rename a bunch of common string functions so they are consistent across -// platforms and between char and wchar_t variants. -// Here is the full list of functions that are unified: -// strlen, strcmp, stricmp, strncmp, strnicmp -// strchr, vsnprintf, strtoul, tolowercase -// tolowercase is like tolower, but not compatible with end-of-file value -// -// It's not clear if we will ever use wchar_t strings on unix. In theory, -// all strings should be Utf8 all the time, except when interfacing with Win32 -// APIs that require Utf16. -/////////////////////////////////////////////////////////////////////////////// - -inline char tolowercase(char c) { - return static_cast(tolower(c)); -} - -#if defined(WEBRTC_WIN) - -inline size_t strlen(const wchar_t* s) { - return wcslen(s); -} -inline int strcmp(const wchar_t* s1, const wchar_t* s2) { - return wcscmp(s1, s2); -} -inline int stricmp(const wchar_t* s1, const wchar_t* s2) { - return _wcsicmp(s1, s2); -} -inline int strncmp(const wchar_t* s1, const wchar_t* s2, size_t n) { - return wcsncmp(s1, s2, n); -} -inline int strnicmp(const wchar_t* s1, const wchar_t* s2, size_t n) { - return _wcsnicmp(s1, s2, n); -} -inline const wchar_t* strchr(const wchar_t* s, wchar_t c) { - return wcschr(s, c); -} -inline const wchar_t* strstr(const wchar_t* haystack, const wchar_t* needle) { - return wcsstr(haystack, needle); -} -#ifndef vsnprintf -inline int vsnprintf(wchar_t* buf, size_t n, const wchar_t* fmt, va_list args) { - return _vsnwprintf(buf, n, fmt, args); -} -#endif // !vsnprintf -inline unsigned long strtoul(const wchar_t* snum, wchar_t** end, int base) { - return wcstoul(snum, end, base); -} -inline wchar_t tolowercase(wchar_t c) { - return static_cast(towlower(c)); -} - -#endif // WEBRTC_WIN - -#if defined(WEBRTC_POSIX) - -inline int _stricmp(const char* s1, const char* s2) { - return strcasecmp(s1, s2); -} -inline int _strnicmp(const char* s1, const char* s2, size_t n) { - return strncasecmp(s1, s2, n); -} - -#endif // WEBRTC_POSIX - -/////////////////////////////////////////////////////////////////////////////// -// Traits simplifies porting string functions to be CTYPE-agnostic -/////////////////////////////////////////////////////////////////////////////// - -namespace rtc { - -const size_t SIZE_UNKNOWN = static_cast(-1); - -template -struct Traits { - // STL string type - //typedef XXX string; - // Null-terminated string - //inline static const CTYPE* empty_str(); -}; - -/////////////////////////////////////////////////////////////////////////////// -// String utilities which work with char or wchar_t -/////////////////////////////////////////////////////////////////////////////// - -template -inline const CTYPE* nonnull(const CTYPE* str, const CTYPE* def_str = NULL) { - return str ? str : (def_str ? def_str : Traits::empty_str()); -} - -template -const CTYPE* strchr(const CTYPE* str, const CTYPE* chs) { - for (size_t i=0; str[i]; ++i) { - for (size_t j=0; chs[j]; ++j) { - if (str[i] == chs[j]) { - return str + i; - } - } - } - return 0; -} - -template -const CTYPE* strchrn(const CTYPE* str, size_t slen, CTYPE ch) { - for (size_t i=0; i -size_t strlenn(const CTYPE* buffer, size_t buflen) { - size_t bufpos = 0; - while (buffer[bufpos] && (bufpos < buflen)) { - ++bufpos; - } - return bufpos; -} - -// Safe versions of strncpy, strncat, snprintf and vsnprintf that always -// null-terminate. - -template -size_t strcpyn(CTYPE* buffer, size_t buflen, - const CTYPE* source, size_t srclen = SIZE_UNKNOWN) { - if (buflen <= 0) - return 0; - - if (srclen == SIZE_UNKNOWN) { - srclen = strlenn(source, buflen - 1); - } else if (srclen >= buflen) { - srclen = buflen - 1; - } - memcpy(buffer, source, srclen * sizeof(CTYPE)); - buffer[srclen] = 0; - return srclen; -} - -template -size_t strcatn(CTYPE* buffer, size_t buflen, - const CTYPE* source, size_t srclen = SIZE_UNKNOWN) { - if (buflen <= 0) - return 0; - - size_t bufpos = strlenn(buffer, buflen - 1); - return bufpos + strcpyn(buffer + bufpos, buflen - bufpos, source, srclen); -} - -// Some compilers (clang specifically) require vsprintfn be defined before -// sprintfn. -template -size_t vsprintfn(CTYPE* buffer, size_t buflen, const CTYPE* format, - va_list args) { - int len = vsnprintf(buffer, buflen, format, args); - if ((len < 0) || (static_cast(len) >= buflen)) { - len = static_cast(buflen - 1); - buffer[len] = 0; - } - return len; -} - -template -size_t sprintfn(CTYPE* buffer, size_t buflen, const CTYPE* format, ...); -template -size_t sprintfn(CTYPE* buffer, size_t buflen, const CTYPE* format, ...) { - va_list args; - va_start(args, format); - size_t len = vsprintfn(buffer, buflen, format, args); - va_end(args); - return len; -} - -/////////////////////////////////////////////////////////////////////////////// -// Allow safe comparing and copying ascii (not UTF-8) with both wide and -// non-wide character strings. -/////////////////////////////////////////////////////////////////////////////// - -inline int asccmp(const char* s1, const char* s2) { - return strcmp(s1, s2); -} -inline int ascicmp(const char* s1, const char* s2) { - return _stricmp(s1, s2); -} -inline int ascncmp(const char* s1, const char* s2, size_t n) { - return strncmp(s1, s2, n); -} -inline int ascnicmp(const char* s1, const char* s2, size_t n) { - return _strnicmp(s1, s2, n); -} -inline size_t asccpyn(char* buffer, size_t buflen, - const char* source, size_t srclen = SIZE_UNKNOWN) { - return strcpyn(buffer, buflen, source, srclen); -} - -#if defined(WEBRTC_WIN) - -typedef wchar_t(*CharacterTransformation)(wchar_t); -inline wchar_t identity(wchar_t c) { return c; } -int ascii_string_compare(const wchar_t* s1, const char* s2, size_t n, - CharacterTransformation transformation); - -inline int asccmp(const wchar_t* s1, const char* s2) { - return ascii_string_compare(s1, s2, static_cast(-1), identity); -} -inline int ascicmp(const wchar_t* s1, const char* s2) { - return ascii_string_compare(s1, s2, static_cast(-1), tolowercase); -} -inline int ascncmp(const wchar_t* s1, const char* s2, size_t n) { - return ascii_string_compare(s1, s2, n, identity); -} -inline int ascnicmp(const wchar_t* s1, const char* s2, size_t n) { - return ascii_string_compare(s1, s2, n, tolowercase); -} -size_t asccpyn(wchar_t* buffer, size_t buflen, - const char* source, size_t srclen = SIZE_UNKNOWN); - -#endif // WEBRTC_WIN - -/////////////////////////////////////////////////////////////////////////////// -// Traits specializations -/////////////////////////////////////////////////////////////////////////////// - -template<> -struct Traits { - typedef std::string string; - inline static const char* empty_str() { return ""; } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Traits specializations (Windows only, currently) -/////////////////////////////////////////////////////////////////////////////// - -#if defined(WEBRTC_WIN) - -template<> -struct Traits { - typedef std::wstring string; - inline static const wchar_t* empty_str() { return L""; } -}; - -#endif // WEBRTC_WIN - -// Replaces all occurrences of "search" with "replace". -void replace_substrs(const char *search, - size_t search_len, - const char *replace, - size_t replace_len, - std::string *s); - -// True iff s1 starts with s2. -bool starts_with(const char *s1, const char *s2); - -// True iff s1 ends with s2. -bool ends_with(const char *s1, const char *s2); - -// Remove leading and trailing whitespaces. -std::string string_trim(const std::string& s); - -} // namespace rtc - -#endif // WEBRTC_BASE_STRINGUTILS_H__ diff --git a/include/webrtc/base/systeminfo.h b/include/webrtc/base/systeminfo.h deleted file mode 100644 index 99d18b2..0000000 --- a/include/webrtc/base/systeminfo.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_SYSTEMINFO_H__ -#define WEBRTC_BASE_SYSTEMINFO_H__ - -#include - -#include "webrtc/base/basictypes.h" - -namespace rtc { - -class SystemInfo { - public: - enum Architecture { - SI_ARCH_UNKNOWN = -1, - SI_ARCH_X86 = 0, - SI_ARCH_X64 = 1, - SI_ARCH_ARM = 2 - }; - - SystemInfo(); - - // The number of CPU Threads in the system. - static int GetMaxCpus(); - // The number of CPU Threads currently available to this process. - static int GetCurCpus(); - // Identity of the CPUs. - Architecture GetCpuArchitecture(); - std::string GetCpuVendor(); - // Total amount of physical memory, in bytes. - int64_t GetMemorySize(); - // The model name of the machine, e.g. "MacBookAir1,1" - std::string GetMachineModel(); - - private: - static int logical_cpus_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_SYSTEMINFO_H__ diff --git a/include/webrtc/base/task.h b/include/webrtc/base/task.h deleted file mode 100644 index 28702e4..0000000 --- a/include/webrtc/base/task.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TASK_H__ -#define WEBRTC_BASE_TASK_H__ - -#include -#include "webrtc/base/basictypes.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/taskparent.h" - -///////////////////////////////////////////////////////////////////// -// -// TASK -// -///////////////////////////////////////////////////////////////////// -// -// Task is a state machine infrastructure. States are pushed forward by -// pushing forwards a TaskRunner that holds on to all Tasks. The purpose -// of Task is threefold: -// -// (1) It manages ongoing work on the UI thread. Multitasking without -// threads, keeping it easy, keeping it real. :-) It does this by -// organizing a set of states for each task. When you return from your -// Process*() function, you return an integer for the next state. You do -// not go onto the next state yourself. Every time you enter a state, -// you check to see if you can do anything yet. If not, you return -// STATE_BLOCKED. If you _could_ do anything, do not return -// STATE_BLOCKED - even if you end up in the same state, return -// STATE_mysamestate. When you are done, return STATE_DONE and then the -// task will self-delete sometime afterwards. -// -// (2) It helps you avoid all those reentrancy problems when you chain -// too many triggers on one thread. Basically if you want to tell a task -// to process something for you, you feed your task some information and -// then you Wake() it. Don't tell it to process it right away. If it -// might be working on something as you send it information, you may want -// to have a queue in the task. -// -// (3) Finally it helps manage parent tasks and children. If a parent -// task gets aborted, all the children tasks are too. The nice thing -// about this, for example, is if you have one parent task that -// represents, say, and Xmpp connection, then you can spawn a whole bunch -// of infinite lifetime child tasks and now worry about cleaning them up. -// When the parent task goes to STATE_DONE, the task engine will make -// sure all those children are aborted and get deleted. -// -// Notice that Task has a few built-in states, e.g., -// -// STATE_INIT - the task isn't running yet -// STATE_START - the task is in its first state -// STATE_RESPONSE - the task is in its second state -// STATE_DONE - the task is done -// -// STATE_ERROR - indicates an error - we should audit the error code in -// light of any usage of it to see if it should be improved. When I -// first put down the task stuff I didn't have a good sense of what was -// needed for Abort and Error, and now the subclasses of Task will ground -// the design in a stronger way. -// -// STATE_NEXT - the first undefined state number. (like WM_USER) - you -// can start defining more task states there. -// -// When you define more task states, just override Process(int state) and -// add your own switch statement. If you want to delegate to -// Task::Process, you can effectively delegate to its switch statement. -// No fancy method pointers or such - this is all just pretty low tech, -// easy to debug, and fast. -// -// Also notice that Task has some primitive built-in timeout functionality. -// -// A timeout is defined as "the task stays in STATE_BLOCKED longer than -// timeout_seconds_." -// -// Descendant classes can override this behavior by calling the -// various protected methods to change the timeout behavior. For -// instance, a descendand might call SuspendTimeout() when it knows -// that it isn't waiting for anything that might timeout, but isn't -// yet in the STATE_DONE state. -// - -namespace rtc { - -// Executes a sequence of steps -class Task : public TaskParent { - public: - Task(TaskParent *parent); - ~Task() override; - - int32_t unique_id() { return unique_id_; } - - void Start(); - void Step(); - int GetState() const { return state_; } - bool HasError() const { return (GetState() == STATE_ERROR); } - bool Blocked() const { return blocked_; } - bool IsDone() const { return done_; } - int64_t ElapsedTime(); - - // Called from outside to stop task without any more callbacks - void Abort(bool nowake = false); - - bool TimedOut(); - - int64_t timeout_time() const { return timeout_time_; } - int timeout_seconds() const { return timeout_seconds_; } - void set_timeout_seconds(int timeout_seconds); - - sigslot::signal0<> SignalTimeout; - - // Called inside the task to signal that the task may be unblocked - void Wake(); - - protected: - - enum { - STATE_BLOCKED = -1, - STATE_INIT = 0, - STATE_START = 1, - STATE_DONE = 2, - STATE_ERROR = 3, - STATE_RESPONSE = 4, - STATE_NEXT = 5, // Subclasses which need more states start here and higher - }; - - // Called inside to advise that the task should wake and signal an error - void Error(); - - int64_t CurrentTime(); - - virtual std::string GetStateName(int state) const; - virtual int Process(int state); - virtual void Stop(); - virtual int ProcessStart() = 0; - virtual int ProcessResponse(); - - void ResetTimeout(); - void ClearTimeout(); - - void SuspendTimeout(); - void ResumeTimeout(); - - protected: - virtual int OnTimeout(); - - private: - void Done(); - - int state_; - bool blocked_; - bool done_; - bool aborted_; - bool busy_; - bool error_; - int64_t start_time_; - int64_t timeout_time_; - int timeout_seconds_; - bool timeout_suspended_; - int32_t unique_id_; - - static int32_t unique_id_seed_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_TASK_H__ diff --git a/include/webrtc/base/taskparent.h b/include/webrtc/base/taskparent.h deleted file mode 100644 index 41008fa..0000000 --- a/include/webrtc/base/taskparent.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TASKPARENT_H__ -#define WEBRTC_BASE_TASKPARENT_H__ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { - -class Task; -class TaskRunner; - -class TaskParent { - public: - TaskParent(Task *derived_instance, TaskParent *parent); - explicit TaskParent(TaskRunner *derived_instance); - virtual ~TaskParent(); - - TaskParent *GetParent() { return parent_; } - TaskRunner *GetRunner() { return runner_; } - - bool AllChildrenDone(); - bool AnyChildError(); -#if !defined(NDEBUG) - bool IsChildTask(Task *task); -#endif - - protected: - void OnStopped(Task *task); - void AbortAllChildren(); - TaskParent *parent() { - return parent_; - } - - private: - void Initialize(); - void OnChildStopped(Task *child); - void AddChild(Task *child); - - TaskParent *parent_; - TaskRunner *runner_; - bool child_error_; - typedef std::set ChildSet; - scoped_ptr children_; - RTC_DISALLOW_COPY_AND_ASSIGN(TaskParent); -}; - - -} // namespace rtc - -#endif // WEBRTC_BASE_TASKPARENT_H__ diff --git a/include/webrtc/base/taskrunner.h b/include/webrtc/base/taskrunner.h deleted file mode 100644 index e0cf175..0000000 --- a/include/webrtc/base/taskrunner.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TASKRUNNER_H__ -#define WEBRTC_BASE_TASKRUNNER_H__ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/taskparent.h" - -namespace rtc { -class Task; - -const int64_t kSecToMsec = 1000; -const int64_t kMsecTo100ns = 10000; -const int64_t kSecTo100ns = kSecToMsec * kMsecTo100ns; - -class TaskRunner : public TaskParent, public sigslot::has_slots<> { - public: - TaskRunner(); - ~TaskRunner() override; - - virtual void WakeTasks() = 0; - - // Returns the current time in 100ns units. It is used for - // determining timeouts. The origin is not important, only - // the units and that rollover while the computer is running. - // - // On Windows, GetSystemTimeAsFileTime is the typical implementation. - virtual int64_t CurrentTime() = 0; - - void StartTask(Task *task); - void RunTasks(); - void PollTasks(); - - void UpdateTaskTimeout(Task* task, int64_t previous_task_timeout_time); - -#if !defined(NDEBUG) - bool is_ok_to_delete(Task* task) { - return task == deleting_task_; - } - - void IncrementAbortCount() { - ++abort_count_; - } - - void DecrementAbortCount() { - --abort_count_; - } -#endif - - // Returns the next absolute time when a task times out - // OR "0" if there is no next timeout. - int64_t next_task_timeout() const; - - protected: - // The primary usage of this method is to know if - // a callback timer needs to be set-up or adjusted. - // This method will be called - // * when the next_task_timeout() becomes a smaller value OR - // * when next_task_timeout() has changed values and the previous - // value is in the past. - // - // If the next_task_timeout moves to the future, this method will *not* - // get called (because it subclass should check next_task_timeout() - // when its timer goes off up to see if it needs to set-up a new timer). - // - // Note that this maybe called conservatively. In that it may be - // called when no time change has happened. - virtual void OnTimeoutChange() { - // by default, do nothing. - } - - private: - void InternalRunTasks(bool in_destructor); - void CheckForTimeoutChange(int64_t previous_timeout_time); - - std::vector tasks_; - Task *next_timeout_task_; - bool tasks_running_; -#if !defined(NDEBUG) - int abort_count_; - Task* deleting_task_; -#endif - - void RecalcNextTimeout(Task *exclude_task); -}; - -} // namespace rtc - -#endif // TASK_BASE_TASKRUNNER_H__ diff --git a/include/webrtc/base/template_util.h b/include/webrtc/base/template_util.h deleted file mode 100644 index 31464cf..0000000 --- a/include/webrtc/base/template_util.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/template_util.h. - -#ifndef WEBRTC_BASE_TEMPLATE_UTIL_H_ -#define WEBRTC_BASE_TEMPLATE_UTIL_H_ - -#include // For size_t. - -namespace rtc { - -// Template definitions from tr1. - -template -struct integral_constant { - static const T value = v; - typedef T value_type; - typedef integral_constant type; -}; - -template const T integral_constant::value; - -typedef integral_constant true_type; -typedef integral_constant false_type; - -template struct is_pointer : false_type {}; -template struct is_pointer : true_type {}; - -template struct is_same : public false_type {}; -template struct is_same : true_type {}; - -template struct is_array : public false_type {}; -template struct is_array : public true_type {}; -template struct is_array : public true_type {}; - -template struct is_non_const_reference : false_type {}; -template struct is_non_const_reference : true_type {}; -template struct is_non_const_reference : false_type {}; - -template struct is_void : false_type {}; -template <> struct is_void : true_type {}; - -template -struct remove_reference { - typedef T type; -}; -template -struct remove_reference { - typedef T type; -}; -template -struct remove_reference { - typedef T type; -}; - -namespace internal { - -// Types YesType and NoType are guaranteed such that sizeof(YesType) < -// sizeof(NoType). -typedef char YesType; - -struct NoType { - YesType dummy[2]; -}; - -// This class is an implementation detail for is_convertible, and you -// don't need to know how it works to use is_convertible. For those -// who care: we declare two different functions, one whose argument is -// of type To and one with a variadic argument list. We give them -// return types of different size, so we can use sizeof to trick the -// compiler into telling us which function it would have chosen if we -// had called it with an argument of type From. See Alexandrescu's -// _Modern C++ Design_ for more details on this sort of trick. - -struct ConvertHelper { - template - static YesType Test(To); - - template - static NoType Test(...); - - template - static From& Create(); -}; - -// Used to determine if a type is a struct/union/class. Inspired by Boost's -// is_class type_trait implementation. -struct IsClassHelper { - template - static YesType Test(void(C::*)(void)); - - template - static NoType Test(...); -}; - -} // namespace internal - -// Inherits from true_type if From is convertible to To, false_type otherwise. -// -// Note that if the type is convertible, this will be a true_type REGARDLESS -// of whether or not the conversion would emit a warning. -template -struct is_convertible - : integral_constant( - internal::ConvertHelper::Create())) == - sizeof(internal::YesType)> { -}; - -template -struct is_class - : integral_constant(0)) == - sizeof(internal::YesType)> { -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_TEMPLATE_UTIL_H_ diff --git a/include/webrtc/base/testbase64.h b/include/webrtc/base/testbase64.h deleted file mode 100644 index 39dd00c..0000000 --- a/include/webrtc/base/testbase64.h +++ /dev/null @@ -1,5 +0,0 @@ -/* This file was generated by googleclient/talk/binary2header.sh */ - -static unsigned char testbase64[] = { -0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x02, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xe1, 0x0d, 0x07, 0x45, 0x78, 0x69, 0x66, 0x00, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x01, 0x0e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x9e, 0x01, 0x0f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xbe, 0x01, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xc3, 0x01, 0x12, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x1a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xcc, 0x01, 0x1b, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x01, 0x28, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x31, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x32, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x3c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x04, 0x02, 0x13, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x87, 0x69, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x02, 0xc4, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x53, 0x4f, 0x4e, 0x59, 0x00, 0x44, 0x53, 0x43, 0x2d, 0x50, 0x32, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x20, 0x37, 0x2e, 0x30, 0x00, 0x32, 0x30, 0x30, 0x37, 0x3a, 0x30, 0x31, 0x3a, 0x33, 0x30, 0x20, 0x32, 0x33, 0x3a, 0x31, 0x30, 0x3a, 0x30, 0x34, 0x00, 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58, 0x20, 0x31, 0x30, 0x2e, 0x34, 0x2e, 0x38, 0x00, 0x00, 0x1c, 0x82, 0x9a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x6a, 0x82, 0x9d, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x72, 0x88, 0x22, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x88, 0x27, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, 0x00, 0x90, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x32, 0x32, 0x30, 0x90, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x02, 0x7a, 0x90, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x02, 0x8e, 0x91, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x03, 0x00, 0x91, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0xa2, 0x92, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0xaa, 0x92, 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0xb2, 0x92, 0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x92, 0x08, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x92, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x00, 0x00, 0x92, 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0xba, 0xa0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x31, 0x30, 0x30, 0xa0, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0xa0, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0xa3, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0xa3, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x08, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x0a, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0a, 0x32, 0x30, 0x30, 0x37, 0x3a, 0x30, 0x31, 0x3a, 0x32, 0x30, 0x20, 0x32, 0x33, 0x3a, 0x30, 0x35, 0x3a, 0x35, 0x32, 0x00, 0x32, 0x30, 0x30, 0x37, 0x3a, 0x30, 0x31, 0x3a, 0x32, 0x30, 0x20, 0x32, 0x33, 0x3a, 0x30, 0x35, 0x3a, 0x35, 0x32, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00, 0x01, 0x1a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x12, 0x01, 0x1b, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x1a, 0x01, 0x28, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x22, 0x02, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x02, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xed, 0x00, 0x0c, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x5f, 0x43, 0x4d, 0x00, 0x02, 0xff, 0xee, 0x00, 0x0e, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x00, 0x64, 0x80, 0x00, 0x00, 0x00, 0x01, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0c, 0x08, 0x08, 0x08, 0x09, 0x08, 0x0c, 0x09, 0x09, 0x0c, 0x11, 0x0b, 0x0a, 0x0b, 0x11, 0x15, 0x0f, 0x0c, 0x0c, 0x0f, 0x15, 0x18, 0x13, 0x13, 0x15, 0x13, 0x13, 0x18, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x01, 0x0d, 0x0b, 0x0b, 0x0d, 0x0e, 0x0d, 0x10, 0x0e, 0x0e, 0x10, 0x14, 0x0e, 0x0e, 0x0e, 0x14, 0x14, 0x0e, 0x0e, 0x0e, 0x0e, 0x14, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x64, 0x00, 0x64, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xdd, 0x00, 0x04, 0x00, 0x07, 0xff, 0xc4, 0x01, 0x3f, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x01, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x10, 0x00, 0x01, 0x04, 0x01, 0x03, 0x02, 0x04, 0x02, 0x05, 0x07, 0x06, 0x08, 0x05, 0x03, 0x0c, 0x33, 0x01, 0x00, 0x02, 0x11, 0x03, 0x04, 0x21, 0x12, 0x31, 0x05, 0x41, 0x51, 0x61, 0x13, 0x22, 0x71, 0x81, 0x32, 0x06, 0x14, 0x91, 0xa1, 0xb1, 0x42, 0x23, 0x24, 0x15, 0x52, 0xc1, 0x62, 0x33, 0x34, 0x72, 0x82, 0xd1, 0x43, 0x07, 0x25, 0x92, 0x53, 0xf0, 0xe1, 0xf1, 0x63, 0x73, 0x35, 0x16, 0xa2, 0xb2, 0x83, 0x26, 0x44, 0x93, 0x54, 0x64, 0x45, 0xc2, 0xa3, 0x74, 0x36, 0x17, 0xd2, 0x55, 0xe2, 0x65, 0xf2, 0xb3, 0x84, 0xc3, 0xd3, 0x75, 0xe3, 0xf3, 0x46, 0x27, 0x94, 0xa4, 0x85, 0xb4, 0x95, 0xc4, 0xd4, 0xe4, 0xf4, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x37, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, 0x11, 0x00, 0x02, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x05, 0x06, 0x07, 0x07, 0x06, 0x05, 0x35, 0x01, 0x00, 0x02, 0x11, 0x03, 0x21, 0x31, 0x12, 0x04, 0x41, 0x51, 0x61, 0x71, 0x22, 0x13, 0x05, 0x32, 0x81, 0x91, 0x14, 0xa1, 0xb1, 0x42, 0x23, 0xc1, 0x52, 0xd1, 0xf0, 0x33, 0x24, 0x62, 0xe1, 0x72, 0x82, 0x92, 0x43, 0x53, 0x15, 0x63, 0x73, 0x34, 0xf1, 0x25, 0x06, 0x16, 0xa2, 0xb2, 0x83, 0x07, 0x26, 0x35, 0xc2, 0xd2, 0x44, 0x93, 0x54, 0xa3, 0x17, 0x64, 0x45, 0x55, 0x36, 0x74, 0x65, 0xe2, 0xf2, 0xb3, 0x84, 0xc3, 0xd3, 0x75, 0xe3, 0xf3, 0x46, 0x94, 0xa4, 0x85, 0xb4, 0x95, 0xc4, 0xd4, 0xe4, 0xf4, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, 0xf2, 0xed, 0xb2, 0x8d, 0x4d, 0x45, 0xcd, 0x2f, 0x3f, 0x44, 0x68, 0x93, 0xc3, 0x58, 0xc8, 0xf1, 0x1f, 0x8a, 0x33, 0x86, 0xda, 0x58, 0xc1, 0xa0, 0x02, 0x4f, 0xc4, 0xa1, 0x69, 0xa5, 0x9b, 0x5b, 0x4b, 0x84, 0x73, 0xdf, 0xc9, 0x15, 0xf8, 0xe3, 0xd1, 0x0e, 0x07, 0x93, 0xf3, 0xd1, 0x0f, 0x1c, 0x17, 0xef, 0x2e, 0x3b, 0x5b, 0xdc, 0xff, 0x00, 0xdf, 0x42, 0xbf, 0x8f, 0x8e, 0xdc, 0x82, 0xca, 0xd8, 0x37, 0x11, 0xa9, 0x3d, 0x82, 0x69, 0x2b, 0xc4, 0x6d, 0xc9, 0x75, 0x25, 0xbc, 0xf7, 0xec, 0xa1, 0xb5, 0x74, 0x19, 0x5d, 0x2e, 0x8a, 0x9a, 0x4b, 0x89, 0x7d, 0xc4, 0x68, 0xc6, 0xf6, 0xfe, 0xb2, 0xa0, 0x30, 0x1d, 0x60, 0x86, 0x88, 0x8d, 0x49, 0x3e, 0x01, 0x11, 0x20, 0xa3, 0x8c, 0xb9, 0xb1, 0xaa, 0x62, 0xad, 0xbf, 0x18, 0x97, 0x43, 0x47, 0x1d, 0xd2, 0xaf, 0x04, 0xd9, 0xb8, 0xc8, 0x0d, 0x68, 0xe4, 0xf7, 0x3e, 0x48, 0xf1, 0x05, 0xbc, 0x25, 0xaa, 0x07, 0x71, 0xd9, 0x14, 0x78, 0xf6, 0x49, 0xb5, 0x90, 0xfd, 0xa7, 0xc6, 0x14, 0xfd, 0x1b, 0x1c, 0xff, 0x00, 0x4d, 0x8d, 0x2e, 0x73, 0x8c, 0x35, 0xa3, 0x52, 0x4f, 0x92, 0x48, 0xa6, 0x1a, 0x24, 0xb6, 0x2a, 0xfa, 0xa5, 0x9e, 0x60, 0x64, 0x39, 0x94, 0x13, 0xcb, 0x27, 0x73, 0x80, 0xf3, 0x0c, 0xf6, 0xff, 0x00, 0xd2, 0x5a, 0x78, 0xbf, 0x53, 0x71, 0xf6, 0x01, 0x75, 0xb6, 0x97, 0x6a, 0x25, 0xa1, 0xad, 0x1f, 0xf4, 0xb7, 0x23, 0x48, 0xb7, 0x94, 0x84, 0x97, 0x5b, 0xff, 0x00, 0x32, 0xa9, 0xdd, 0xfc, 0xed, 0x9b, 0x7e, 0x0d, 0x9e, 0x52, 0x4a, 0x95, 0x61, 0xff, 0xd0, 0xf3, 0x3b, 0xa7, 0x70, 0xee, 0x01, 0x8f, 0xb9, 0x59, 0xfa, 0x7e, 0xdf, 0xe4, 0xc8, 0xf9, 0x2a, 0xc2, 0x5c, 0x63, 0xc3, 0x54, 0x67, 0x87, 0x6e, 0x10, 0x35, 0x68, 0xd4, 0x79, 0x1e, 0x53, 0x4a, 0xe0, 0xdc, 0xe9, 0xb8, 0x1f, 0x6a, 0xda, 0x6c, 0x25, 0x94, 0x37, 0xb0, 0xd0, 0xb8, 0xad, 0x67, 0xe4, 0x55, 0x8a, 0x5b, 0x8b, 0x82, 0xc0, 0x6f, 0x76, 0x80, 0x34, 0x49, 0x05, 0x2e, 0x9e, 0xc6, 0x1c, 0x66, 0x31, 0xba, 0x10, 0x23, 0xe0, 0xaf, 0xe1, 0x61, 0x53, 0x43, 0x8d, 0x81, 0xb3, 0x67, 0xef, 0x9e, 0x49, 0x2a, 0x12, 0x6c, 0xb6, 0x63, 0x1a, 0x0c, 0x31, 0xba, 0x55, 0xcd, 0xac, 0xfa, 0x8e, 0xdf, 0x91, 0x6e, 0x91, 0xd9, 0xb3, 0xc9, 0x73, 0x90, 0x7a, 0xab, 0x6a, 0xc2, 0xa4, 0x60, 0xe2, 0x8f, 0xd2, 0x38, 0x03, 0x7d, 0x9e, 0x0d, 0xff, 0x00, 0xcc, 0xd6, 0xd3, 0x6b, 0x71, 0x67, 0xd2, 0x3e, 0x64, 0x72, 0xab, 0xdb, 0x8d, 0x54, 0x39, 0xc5, 0x83, 0x6b, 0x3d, 0xee, 0x2e, 0xd4, 0x92, 0x3c, 0x4a, 0x56, 0xba, 0xb4, 0x79, 0x5c, 0xf7, 0xb2, 0x96, 0x6c, 0x8d, 0xaf, 0x80, 0x48, 0x3c, 0xf0, 0xb2, 0x1f, 0x63, 0x9c, 0xe9, 0x3f, 0x24, 0x5c, 0xdb, 0xdd, 0x76, 0x43, 0xde, 0xfd, 0x5c, 0xe3, 0x24, 0xfc, 0x50, 0x00, 0x93, 0x0a, 0x78, 0x8a, 0x0d, 0x49, 0xca, 0xcf, 0x93, 0x63, 0x1b, 0x7d, 0xd7, 0x57, 0x50, 0xd5, 0xef, 0x70, 0x6b, 0x4f, 0xc7, 0x45, 0xdb, 0x74, 0x9e, 0x8d, 0x5e, 0x33, 0x83, 0xd8, 0x37, 0xdd, 0xc3, 0xac, 0x3d, 0xbf, 0x92, 0xc5, 0x5b, 0xea, 0xbf, 0xd5, 0x62, 0xc0, 0xdc, 0xbc, 0xbd, 0x2d, 0x22, 0x5a, 0xcf, 0xdd, 0x69, 0xff, 0x00, 0xd1, 0x8e, 0x5d, 0xa5, 0x38, 0xb5, 0xb0, 0x00, 0xc6, 0xc4, 0x24, 0x4a, 0xd6, 0x8d, 0x18, 0x04, 0x49, 0x88, 0x9e, 0x55, 0xd6, 0x61, 0xb0, 0xc1, 0x70, 0x32, 0xdd, 0x3c, 0x95, 0xda, 0xf1, 0xfe, 0xf5, 0x62, 0xbc, 0x76, 0x8e, 0x75, 0x28, 0x02, 0xa2, 0xe7, 0x7d, 0x92, 0xb9, 0x84, 0x96, 0x96, 0xda, 0xf7, 0x70, 0x12, 0x4e, 0x5a, 0xff, 0x00, 0xff, 0xd1, 0xf3, 0x7a, 0x21, 0xaf, 0xde, 0xef, 0xa2, 0x22, 0x55, 0xfc, 0x5a, 0xbd, 0x42, 0xfb, 0x08, 0xfa, 0x67, 0x4f, 0x82, 0xcd, 0x6d, 0x85, 0xc0, 0x56, 0x3b, 0x90, 0xb7, 0xf0, 0x2a, 0x0e, 0x63, 0x58, 0x3b, 0xf2, 0xa3, 0x9e, 0x8c, 0xb8, 0x86, 0xbe, 0x49, 0xf1, 0x2c, 0x0c, 0x86, 0xb4, 0x4c, 0x69, 0xe4, 0xaf, 0x6e, 0xcc, 0x6b, 0x7d, 0x46, 0xb3, 0x70, 0xec, 0x38, 0x51, 0x7d, 0x02, 0x8a, 0xc7, 0xa6, 0xd9, 0x20, 0x68, 0x0f, 0x8f, 0x8a, 0xcf, 0xc9, 0xc2, 0xea, 0x59, 0x5b, 0x48, 0xb0, 0x91, 0xae, 0xe6, 0xc9, 0x03, 0xc9, 0x30, 0x51, 0x66, 0xd4, 0x0d, 0xad, 0xbd, 0x5f, 0x53, 0xcc, 0x6b, 0xb6, 0x90, 0x5a, 0x3b, 0x83, 0x0b, 0x43, 0x17, 0x31, 0xd6, 0xc3, 0x6e, 0x12, 0x3b, 0x79, 0xac, 0xc1, 0x89, 0x47, 0xd9, 0xe8, 0x63, 0x98, 0x45, 0xed, 0x6c, 0x5a, 0xf1, 0xa0, 0x27, 0xc5, 0x5b, 0xc3, 0x6f, 0xa6, 0xe0, 0x1c, 0x7d, 0xb3, 0xa2, 0x69, 0x34, 0x7b, 0xae, 0x1a, 0x8d, 0x45, 0x17, 0x9d, 0xeb, 0xfd, 0x21, 0xd8, 0xb9, 0xae, 0xb5, 0x80, 0xbb, 0x1e, 0xd2, 0x5c, 0xd7, 0x78, 0x13, 0xf9, 0xae, 0x4b, 0xea, 0xc7, 0x4a, 0x39, 0xbd, 0x55, 0xb3, 0xed, 0x66, 0x38, 0xf5, 0x09, 0x22, 0x41, 0x23, 0xe8, 0x37, 0xfb, 0x4b, 0xa1, 0xeb, 0xd6, 0xfe, 0x88, 0x31, 0xbf, 0x41, 0xc0, 0xee, 0xd2, 0x74, 0x02, 0x78, 0x53, 0xfa, 0x97, 0x43, 0x19, 0x85, 0x65, 0xff, 0x00, 0x9d, 0x71, 0x33, 0xe4, 0x1a, 0x7d, 0x8d, 0x53, 0x42, 0x56, 0x35, 0x6b, 0xe5, 0x80, 0x06, 0xc7, 0x57, 0xa7, 0xc4, 0xa9, 0xdb, 0xb6, 0x81, 0x1f, 0xeb, 0xd9, 0x69, 0x56, 0xc2, 0xd0, 0x00, 0xe5, 0x55, 0xc0, 0x12, 0xc2, 0xd7, 0x4e, 0xa2, 0x5a, 0x7c, 0x0a, 0xd0, 0x63, 0x9a, 0xd1, 0xaf, 0xd2, 0xe2, 0x3c, 0x12, 0x62, 0x66, 0xc6, 0x42, 0x23, 0x5a, 0x49, 0x8f, 0x10, 0xa2, 0xd2, 0x3e, 0x28, 0x9d, 0xc4, 0x88, 0x09, 0x29, 0x16, 0xc3, 0x3c, 0x24, 0x8d, 0xe6, 0x92, 0x72, 0x1f, 0xff, 0xd2, 0xf3, 0xbb, 0xb0, 0xfe, 0xcb, 0x99, 0xe9, 0xce, 0xf6, 0x88, 0x2d, 0x77, 0x91, 0x5b, 0x3d, 0x3d, 0xd0, 0xe6, 0x90, 0xa9, 0x65, 0x57, 0x38, 0x95, 0xdd, 0xcb, 0x9a, 0x7d, 0xce, 0xf2, 0x3f, 0x44, 0x23, 0x60, 0x58, 0x76, 0xe9, 0xca, 0x8c, 0xea, 0x1b, 0x31, 0x02, 0x32, 0x23, 0xea, 0xee, 0xb1, 0xcd, 0xb0, 0xc7, 0x87, 0x74, 0x7a, 0xeb, 0x70, 0x1a, 0x71, 0xe1, 0xfe, 0xe4, 0x1c, 0x1d, 0xae, 0xe5, 0x69, 0xd8, 0xfa, 0x99, 0x50, 0x0d, 0x1a, 0xf7, 0x2a, 0x3a, 0x0c, 0xf4, 0x1a, 0x8e, 0xc7, 0x27, 0x5d, 0xbf, 0x18, 0x41, 0xdc, 0xc2, 0xf0, 0x7f, 0x74, 0xf6, 0x3a, 0x22, 0x66, 0xdb, 0x68, 0xc6, 0x80, 0x48, 0x6b, 0x88, 0x06, 0x39, 0x0d, 0xee, 0xaa, 0x1f, 0xb3, 0xd5, 0x1b, 0x83, 0xd8, 0x3b, 0x38, 0x8f, 0x69, 0xfe, 0xdf, 0xd1, 0x4d, 0x29, 0xa1, 0x4c, 0x7a, 0xf4, 0xbf, 0xa7, 0x92, 0xcf, 0xa5, 0x20, 0x08, 0xf3, 0xf6, 0xff, 0x00, 0x15, 0xbb, 0xd1, 0x31, 0xd9, 0x5e, 0x3d, 0x75, 0x56, 0x36, 0x88, 0x00, 0x81, 0xe0, 0x16, 0x5e, 0x55, 0x74, 0x3f, 0x00, 0x9d, 0xe0, 0xcc, 0x69, 0xe7, 0x3a, 0x2d, 0xbe, 0x90, 0x00, 0xa9, 0xae, 0xef, 0x1f, 0x95, 0x4b, 0x0d, 0x9a, 0xdc, 0xc7, 0x45, 0xfe, 0xb1, 0x7d, 0x60, 0xa7, 0xa1, 0xe0, 0x1f, 0x4e, 0x1d, 0x99, 0x69, 0x02, 0x9a, 0xcf, 0x1f, 0xca, 0x7b, 0xbf, 0x90, 0xc5, 0xc2, 0xb3, 0xeb, 0x57, 0xd6, 0x03, 0x6b, 0xae, 0x39, 0xb6, 0x82, 0xe3, 0x31, 0xa1, 0x68, 0xf2, 0x6b, 0x5c, 0x12, 0xfa, 0xe1, 0x91, 0x66, 0x47, 0x5d, 0xb8, 0x3b, 0x4f, 0x44, 0x36, 0xb6, 0x8f, 0x28, 0xdd, 0xff, 0x00, 0x7e, 0x46, 0xab, 0x12, 0x2b, 0x65, 0x55, 0x32, 0xa7, 0x62, 0xb6, 0xbd, 0xf7, 0x64, 0x10, 0xdb, 0x03, 0x9f, 0x1b, 0x9e, 0xc7, 0xd9, 0xb8, 0x3b, 0x1f, 0x67, 0xf3, 0x6c, 0x52, 0x80, 0xd7, 0x7d, 0x0f, 0xea, 0x7f, 0x5d, 0x1d, 0x67, 0xa6, 0x0b, 0x1e, 0x47, 0xda, 0x69, 0x3b, 0x2e, 0x03, 0xc7, 0xf3, 0x5f, 0x1f, 0xf0, 0x8b, 0xa1, 0x02, 0x46, 0xba, 0x79, 0xaf, 0x32, 0xff, 0x00, 0x16, 0xad, 0xca, 0x1d, 0x57, 0x2a, 0xdc, 0x79, 0x18, 0x41, 0xb0, 0xf6, 0x9e, 0xe4, 0x9f, 0xd0, 0x8f, 0xeb, 0x31, 0xab, 0xd2, 0x83, 0xa4, 0xcb, 0x8c, 0xb8, 0xa0, 0x42, 0x12, 0x7b, 0x67, 0x9f, 0x2f, 0xf5, 0x09, 0x26, 0x96, 0xc4, 0xce, 0xa9, 0x20, 0xa7, 0xff, 0xd3, 0xf3, 0x2f, 0xb4, 0x5d, 0xe9, 0x0a, 0xb7, 0x9f, 0x4c, 0x19, 0xdb, 0x3a, 0x2d, 0x5e, 0x94, 0xfd, 0xc4, 0xb7, 0xc5, 0x62, 0xf9, 0x2b, 0xfd, 0x2e, 0xe3, 0x5d, 0xe0, 0x7c, 0x13, 0x48, 0xd1, 0x92, 0x12, 0xa9, 0x0b, 0x7a, 0xbc, 0x2d, 0xc2, 0x7f, 0x92, 0x60, 0xab, 0x4e, 0x79, 0x2e, 0x00, 0xf0, 0xaa, 0xe1, 0xda, 0x3d, 0x43, 0xfc, 0xad, 0x55, 0xbb, 0x80, 0x79, 0x81, 0xa0, 0xe6, 0x54, 0x32, 0x6d, 0x02, 0xbe, 0xf3, 0x61, 0x81, 0xa8, 0x44, 0x14, 0x03, 0x59, 0x0e, 0x1c, 0xf6, 0x1f, 0xdc, 0xb2, 0xec, 0xa3, 0x23, 0x77, 0xe8, 0x6e, 0x70, 0xf2, 0x25, 0x1f, 0x1f, 0x17, 0xa9, 0x6d, 0x71, 0x36, 0x97, 0x47, 0x00, 0xa4, 0x02, 0xe0, 0x2c, 0x7c, 0xc1, 0xab, 0xd5, 0x31, 0x85, 0x35, 0xd4, 0xe6, 0x13, 0x02, 0xd6, 0x4b, 0x67, 0x48, 0x2b, 0xa9, 0xe9, 0x2e, 0x02, 0xb6, 0x4f, 0x82, 0xe5, 0x7a, 0x95, 0x19, 0xc6, 0x87, 0x3d, 0xfb, 0xa2, 0xb8, 0x79, 0x1e, 0x4d, 0x3b, 0x96, 0xcf, 0x4f, 0xbd, 0xcd, 0xa2, 0xa2, 0x1f, 0xa0, 0x82, 0xd3, 0xfc, 0x97, 0x05, 0x24, 0x36, 0x6b, 0xf3, 0x31, 0xa2, 0x35, 0x79, 0xef, 0xad, 0xf8, 0xae, 0xaf, 0xaf, 0xd8, 0xf2, 0xd8, 0x6d, 0xed, 0x6b, 0xda, 0x7b, 0x18, 0x1b, 0x5d, 0xff, 0x00, 0x52, 0xb1, 0x6d, 0xf0, 0x81, 0x31, 0xca, 0xf4, 0x6e, 0xb1, 0x80, 0xce, 0xb1, 0x84, 0xc0, 0x21, 0xb7, 0xd6, 0x77, 0x31, 0xd1, 0x27, 0xc1, 0xcd, 0xfe, 0xd2, 0xe3, 0xec, 0xe8, 0x1d, 0x45, 0x96, 0xb0, 0x9a, 0xb7, 0x87, 0x3f, 0x68, 0x2d, 0xf7, 0x01, 0x1f, 0xbe, 0xd1, 0xf4, 0x7f, 0xb4, 0xa4, 0x0d, 0x77, 0xbb, 0xfa, 0x8f, 0x80, 0x3a, 0x7f, 0x43, 0xaa, 0xe2, 0xdf, 0xd2, 0x65, 0x7e, 0x95, 0xe4, 0x0f, 0x1f, 0xa1, 0xfe, 0x6b, 0x16, 0x9f, 0x52, 0xfa, 0xc1, 0xd3, 0xba, 0x6d, 0x26, 0xdc, 0xac, 0x86, 0xd4, 0xd9, 0x0d, 0x31, 0x2e, 0x74, 0x9e, 0xdb, 0x59, 0x2e, 0x55, 0xe8, 0xc9, 0xb2, 0x96, 0xd5, 0x4b, 0x9f, 0xb8, 0x6d, 0xda, 0x1c, 0x04, 0x09, 0x03, 0xfe, 0x8a, 0xc6, 0xfa, 0xd3, 0xf5, 0x6a, 0xbe, 0xbb, 0x5b, 0x2e, 0xc6, 0xb5, 0x94, 0xe6, 0xd5, 0x20, 0x97, 0x7d, 0x1b, 0x1b, 0xf9, 0xad, 0x7c, 0x7d, 0x17, 0xb7, 0xf3, 0x1e, 0x92, 0x1b, 0x7f, 0xf8, 0xe0, 0x7d, 0x59, 0xdd, 0xfd, 0x32, 0xd8, 0x8f, 0xa5, 0xe8, 0x3a, 0x12, 0x5c, 0x3f, 0xfc, 0xc4, 0xfa, 0xc3, 0xb3, 0x77, 0xa7, 0x56, 0xed, 0xdb, 0x76, 0x7a, 0x8d, 0xdd, 0x1f, 0xbf, 0xfd, 0x44, 0x92, 0x56, 0x8f, 0xff, 0xd4, 0xf2, 0xe8, 0x86, 0x17, 0x1e, 0xfa, 0x04, 0x56, 0x4b, 0x43, 0x6c, 0x6f, 0x2d, 0xe5, 0x46, 0x01, 0x64, 0x2b, 0x14, 0x32, 0x5b, 0xb4, 0xa0, 0x52, 0x1d, 0xde, 0x9b, 0x94, 0xdb, 0xab, 0x6b, 0x81, 0xf7, 0x05, 0xb0, 0xd7, 0x07, 0xb2, 0x27, 0x55, 0xc6, 0x57, 0x65, 0xd8, 0x76, 0x6e, 0x64, 0xed, 0xee, 0x16, 0xce, 0x27, 0x57, 0x63, 0xda, 0x0c, 0xc2, 0x8e, 0x51, 0x67, 0x84, 0xfa, 0x1d, 0xdd, 0x62, 0xc7, 0x07, 0xe9, 0xf7, 0xa3, 0xd6, 0x6c, 0x02, 0x41, 0x55, 0x31, 0xf3, 0x2b, 0xb3, 0xba, 0x2b, 0x2e, 0x68, 0x24, 0x1d, 0x47, 0x64, 0xca, 0xa6, 0x50, 0x41, 0x65, 0x90, 0x6c, 0xb1, 0xa5, 0xae, 0x33, 0x23, 0x51, 0xe4, 0xab, 0x7d, 0x5d, 0xcb, 0xb6, 0xcc, 0x37, 0xd0, 0x40, 0x73, 0x71, 0xde, 0x58, 0x09, 0xe7, 0x6f, 0x2c, 0x44, 0xc9, 0xc9, 0xae, 0xba, 0x9d, 0x63, 0x88, 0x01, 0xa0, 0x95, 0x9d, 0xf5, 0x3f, 0x2a, 0xe6, 0x67, 0xdb, 0x50, 0x83, 0x55, 0xad, 0x36, 0x3e, 0x78, 0x10, 0x74, 0x77, 0xfd, 0x2d, 0xaa, 0x4c, 0x7d, 0x58, 0x73, 0x91, 0xa0, 0x0f, 0x51, 0x45, 0xb7, 0x33, 0xdd, 0x58, 0x69, 0x1d, 0xd8, 0x0c, 0x9f, 0x96, 0x88, 0x19, 0x99, 0x19, 0xac, 0xcf, 0xa3, 0xd2, 0xad, 0xb5, 0xdb, 0x76, 0x8f, 0xad, 0xc4, 0xea, 0xcf, 0xdf, 0x7e, 0xdf, 0xdd, 0xfc, 0xd5, 0xa3, 0x5e, 0x43, 0x2b, 0x6b, 0xb2, 0xad, 0x3b, 0x6a, 0xa4, 0x13, 0xa7, 0x04, 0xac, 0x7a, 0x6f, 0xb3, 0x23, 0x26, 0xcc, 0xfb, 0xb4, 0x75, 0x8e, 0x01, 0x83, 0xf7, 0x58, 0x3e, 0x8b, 0x53, 0xa7, 0x2a, 0x1a, 0x31, 0x42, 0x36, 0x5d, 0x4c, 0x9a, 0xf2, 0xdc, 0xc6, 0xfe, 0x98, 0xb4, 0x34, 0xcb, 0x48, 0x0a, 0x8f, 0xdb, 0xb2, 0xeb, 0x76, 0xd6, 0x07, 0x5c, 0x59, 0xc9, 0x64, 0x8f, 0x93, 0xa7, 0x73, 0x16, 0x83, 0xaf, 0x0e, 0xa4, 0x33, 0xef, 0x50, 0xc5, 0x0c, 0xda, 0x59, 0x10, 0x06, 0x8a, 0x2e, 0x29, 0x0e, 0xac, 0xc2, 0x31, 0x3d, 0x36, 0x69, 0x7e, 0xd6, 0xcc, 0xf5, 0x3d, 0x6f, 0xb3, 0xeb, 0x1b, 0x76, 0xef, 0x3b, 0xa3, 0xfa, 0xc9, 0x2b, 0x5f, 0x66, 0x6f, 0xa9, 0x1e, 0x73, 0xf2, 0x49, 0x2e, 0x39, 0xf7, 0x4f, 0xb7, 0x8d, 0xff, 0xd5, 0xf3, 0x26, 0xfe, 0x0a, 0xc5, 0x1b, 0xa7, 0xcb, 0xb2, 0xcf, 0x49, 0x03, 0xb2, 0x46, 0xee, 0xd9, 0xd9, 0xb3, 0xf4, 0x9f, 0x25, 0x4a, 0xdf, 0x4b, 0x77, 0xe8, 0x27, 0xd4, 0xef, 0x1c, 0x2a, 0x29, 0x26, 0xc5, 0x7c, 0x9d, 0x6c, 0x7f, 0xb7, 0x6e, 0x1b, 0x26, 0x7f, 0x05, 0xa3, 0xfe, 0x53, 0x8d, 0x62, 0x57, 0x30, 0x92, 0x12, 0xfa, 0x2f, 0x86, 0xdf, 0xa4, 0xec, 0x67, 0xfe, 0xd0, 0xf4, 0xff, 0x00, 0x4d, 0xfc, 0xdf, 0x78, 0xe1, 0x68, 0x7d, 0x54, 0x99, 0xbf, 0x6f, 0xf3, 0xbe, 0xdf, 0x8e, 0xdd, 0x7f, 0xef, 0xeb, 0x97, 0x49, 0x3e, 0x3b, 0x7f, 0x06, 0x2c, 0x9f, 0x37, 0x5f, 0xf0, 0x9f, 0x4c, 0xeb, 0x7b, 0xbf, 0x67, 0x55, 0xe8, 0xff, 0x00, 0x31, 0xbc, 0x7a, 0x9e, 0x31, 0xdb, 0xfe, 0x92, 0xae, 0x37, 0x7a, 0x4d, 0xdb, 0xe2, 0x17, 0x9d, 0xa4, 0xa3, 0xc9, 0xba, 0xfc, 0x7b, 0x7d, 0x5f, 0x52, 0xa7, 0x7e, 0xd1, 0x28, 0xf8, 0xf3, 0xb0, 0xc7, 0x32, 0xbc, 0x99, 0x24, 0xc5, 0xe3, 0xab, 0xeb, 0x1f, 0xa4, 0xf5, 0xfc, 0xe1, 0x25, 0xe4, 0xe9, 0x24, 0x97, 0xff, 0xd9, 0xff, 0xed, 0x2e, 0x1c, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x20, 0x33, 0x2e, 0x30, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x02, 0x1c, 0x02, 0x78, 0x00, 0x1f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xfb, 0x09, 0xa6, 0xbd, 0x07, 0x4c, 0x2a, 0x36, 0x9d, 0x8f, 0xe2, 0xcc, 0x57, 0xa9, 0xac, 0x85, 0x38, 0x42, 0x49, 0x4d, 0x03, 0xea, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xb0, 0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3d, 0x22, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x22, 0x3f, 0x3e, 0x0a, 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x2f, 0x44, 0x54, 0x44, 0x20, 0x50, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x31, 0x2e, 0x30, 0x2f, 0x2f, 0x45, 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x54, 0x44, 0x73, 0x2f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x2d, 0x31, 0x2e, 0x30, 0x2e, 0x64, 0x74, 0x64, 0x22, 0x3e, 0x0a, 0x3c, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x3e, 0x0a, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x48, 0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x48, 0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x37, 0x32, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x31, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x53, 0x63, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x53, 0x63, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x31, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x37, 0x32, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x31, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x73, 0x75, 0x62, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x61, 0x70, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x30, 0x2e, 0x30, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x30, 0x2e, 0x30, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x37, 0x33, 0x34, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x35, 0x37, 0x36, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x70, 0x65, 0x72, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x4d, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x70, 0x65, 0x72, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x2d, 0x31, 0x38, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x2d, 0x31, 0x38, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x37, 0x37, 0x34, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x35, 0x39, 0x34, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x4d, 0x50, 0x61, 0x70, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x4d, 0x50, 0x61, 0x70, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x6e, 0x61, 0x2d, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x54, 0x31, 0x37, 0x3a, 0x34, 0x39, 0x3a, 0x33, 0x36, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x31, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x4d, 0x55, 0x6e, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x4d, 0x55, 0x6e, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x30, 0x2e, 0x30, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x30, 0x2e, 0x30, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x37, 0x33, 0x34, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x35, 0x37, 0x36, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x4d, 0x55, 0x6e, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x70, 0x65, 0x72, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x4d, 0x55, 0x6e, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x70, 0x65, 0x72, 0x52, 0x65, 0x63, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x2d, 0x31, 0x38, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x2d, 0x31, 0x38, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x37, 0x37, 0x34, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x35, 0x39, 0x34, 0x3c, 0x2f, 0x72, 0x65, 0x61, 0x6c, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x33, 0x30, 0x54, 0x32, 0x32, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x30, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x70, 0x64, 0x2e, 0x50, 0x4d, 0x50, 0x61, 0x70, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x70, 0x64, 0x2e, 0x50, 0x4d, 0x50, 0x61, 0x70, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x55, 0x53, 0x20, 0x4c, 0x65, 0x74, 0x74, 0x65, 0x72, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x44, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x30, 0x37, 0x2d, 0x30, 0x31, 0x54, 0x31, 0x37, 0x3a, 0x34, 0x39, 0x3a, 0x33, 0x36, 0x5a, 0x3c, 0x2f, 0x64, 0x61, 0x74, 0x65, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x31, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x2f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x41, 0x50, 0x49, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x30, 0x30, 0x2e, 0x32, 0x30, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2f, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x41, 0x50, 0x49, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x30, 0x30, 0x2e, 0x32, 0x30, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2f, 0x3e, 0x0a, 0x09, 0x3c, 0x6b, 0x65, 0x79, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x3c, 0x2f, 0x6b, 0x65, 0x79, 0x3e, 0x0a, 0x09, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x3c, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x3c, 0x2f, 0x64, 0x69, 0x63, 0x74, 0x3e, 0x0a, 0x3c, 0x2f, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x3e, 0x0a, 0x38, 0x42, 0x49, 0x4d, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x00, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x02, 0xde, 0x02, 0x40, 0xff, 0xee, 0xff, 0xee, 0x03, 0x06, 0x02, 0x52, 0x03, 0x67, 0x05, 0x28, 0x03, 0xfc, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd8, 0x02, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x7f, 0xff, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x08, 0x00, 0x19, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x03, 0xed, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x38, 0x42, 0x49, 0x4d, 0x03, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x38, 0x42, 0x49, 0x4d, 0x03, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x2f, 0x66, 0x66, 0x00, 0x01, 0x00, 0x6c, 0x66, 0x66, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x2f, 0x66, 0x66, 0x00, 0x01, 0x00, 0xa1, 0x99, 0x9a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x35, 0x00, 0x00, 0x00, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x38, 0x42, 0x49, 0x4d, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe8, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x03, 0x45, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x44, 0x00, 0x53, 0x00, 0x43, 0x00, 0x30, 0x00, 0x32, 0x00, 0x33, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x75, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x4f, 0x62, 0x6a, 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x63, 0x74, 0x31, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x54, 0x6f, 0x70, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x65, 0x66, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x74, 0x6f, 0x6d, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x52, 0x67, 0x68, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x06, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x56, 0x6c, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x01, 0x4f, 0x62, 0x6a, 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x49, 0x44, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x65, 0x6e, 0x75, 0x6d, 0x00, 0x00, 0x00, 0x0c, 0x45, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x6f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x54, 0x79, 0x70, 0x65, 0x65, 0x6e, 0x75, 0x6d, 0x00, 0x00, 0x00, 0x0a, 0x45, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x00, 0x49, 0x6d, 0x67, 0x20, 0x00, 0x00, 0x00, 0x06, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x4f, 0x62, 0x6a, 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x63, 0x74, 0x31, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x54, 0x6f, 0x70, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x65, 0x66, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x74, 0x6f, 0x6d, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x52, 0x67, 0x68, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, 0x6c, 0x54, 0x45, 0x58, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x75, 0x6c, 0x6c, 0x54, 0x45, 0x58, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x73, 0x67, 0x65, 0x54, 0x45, 0x58, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x61, 0x6c, 0x74, 0x54, 0x61, 0x67, 0x54, 0x45, 0x58, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x63, 0x65, 0x6c, 0x6c, 0x54, 0x65, 0x78, 0x74, 0x49, 0x73, 0x48, 0x54, 0x4d, 0x4c, 0x62, 0x6f, 0x6f, 0x6c, 0x01, 0x00, 0x00, 0x00, 0x08, 0x63, 0x65, 0x6c, 0x6c, 0x54, 0x65, 0x78, 0x74, 0x54, 0x45, 0x58, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x68, 0x6f, 0x72, 0x7a, 0x41, 0x6c, 0x69, 0x67, 0x6e, 0x65, 0x6e, 0x75, 0x6d, 0x00, 0x00, 0x00, 0x0f, 0x45, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x48, 0x6f, 0x72, 0x7a, 0x41, 0x6c, 0x69, 0x67, 0x6e, 0x00, 0x00, 0x00, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, 0x00, 0x00, 0x09, 0x76, 0x65, 0x72, 0x74, 0x41, 0x6c, 0x69, 0x67, 0x6e, 0x65, 0x6e, 0x75, 0x6d, 0x00, 0x00, 0x00, 0x0f, 0x45, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x56, 0x65, 0x72, 0x74, 0x41, 0x6c, 0x69, 0x67, 0x6e, 0x00, 0x00, 0x00, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, 0x00, 0x00, 0x0b, 0x62, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x65, 0x6e, 0x75, 0x6d, 0x00, 0x00, 0x00, 0x11, 0x45, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x42, 0x47, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x09, 0x74, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x73, 0x65, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6c, 0x65, 0x66, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x65, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x75, 0x74, 0x73, 0x65, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x72, 0x69, 0x67, 0x68, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x65, 0x74, 0x6c, 0x6f, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x09, 0xf9, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0x09, 0xdd, 0x00, 0x18, 0x00, 0x01, 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x02, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xed, 0x00, 0x0c, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x5f, 0x43, 0x4d, 0x00, 0x02, 0xff, 0xee, 0x00, 0x0e, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x00, 0x64, 0x80, 0x00, 0x00, 0x00, 0x01, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0c, 0x08, 0x08, 0x08, 0x09, 0x08, 0x0c, 0x09, 0x09, 0x0c, 0x11, 0x0b, 0x0a, 0x0b, 0x11, 0x15, 0x0f, 0x0c, 0x0c, 0x0f, 0x15, 0x18, 0x13, 0x13, 0x15, 0x13, 0x13, 0x18, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x01, 0x0d, 0x0b, 0x0b, 0x0d, 0x0e, 0x0d, 0x10, 0x0e, 0x0e, 0x10, 0x14, 0x0e, 0x0e, 0x0e, 0x14, 0x14, 0x0e, 0x0e, 0x0e, 0x0e, 0x14, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x64, 0x00, 0x64, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xdd, 0x00, 0x04, 0x00, 0x07, 0xff, 0xc4, 0x01, 0x3f, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x01, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x10, 0x00, 0x01, 0x04, 0x01, 0x03, 0x02, 0x04, 0x02, 0x05, 0x07, 0x06, 0x08, 0x05, 0x03, 0x0c, 0x33, 0x01, 0x00, 0x02, 0x11, 0x03, 0x04, 0x21, 0x12, 0x31, 0x05, 0x41, 0x51, 0x61, 0x13, 0x22, 0x71, 0x81, 0x32, 0x06, 0x14, 0x91, 0xa1, 0xb1, 0x42, 0x23, 0x24, 0x15, 0x52, 0xc1, 0x62, 0x33, 0x34, 0x72, 0x82, 0xd1, 0x43, 0x07, 0x25, 0x92, 0x53, 0xf0, 0xe1, 0xf1, 0x63, 0x73, 0x35, 0x16, 0xa2, 0xb2, 0x83, 0x26, 0x44, 0x93, 0x54, 0x64, 0x45, 0xc2, 0xa3, 0x74, 0x36, 0x17, 0xd2, 0x55, 0xe2, 0x65, 0xf2, 0xb3, 0x84, 0xc3, 0xd3, 0x75, 0xe3, 0xf3, 0x46, 0x27, 0x94, 0xa4, 0x85, 0xb4, 0x95, 0xc4, 0xd4, 0xe4, 0xf4, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x37, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, 0x11, 0x00, 0x02, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x05, 0x06, 0x07, 0x07, 0x06, 0x05, 0x35, 0x01, 0x00, 0x02, 0x11, 0x03, 0x21, 0x31, 0x12, 0x04, 0x41, 0x51, 0x61, 0x71, 0x22, 0x13, 0x05, 0x32, 0x81, 0x91, 0x14, 0xa1, 0xb1, 0x42, 0x23, 0xc1, 0x52, 0xd1, 0xf0, 0x33, 0x24, 0x62, 0xe1, 0x72, 0x82, 0x92, 0x43, 0x53, 0x15, 0x63, 0x73, 0x34, 0xf1, 0x25, 0x06, 0x16, 0xa2, 0xb2, 0x83, 0x07, 0x26, 0x35, 0xc2, 0xd2, 0x44, 0x93, 0x54, 0xa3, 0x17, 0x64, 0x45, 0x55, 0x36, 0x74, 0x65, 0xe2, 0xf2, 0xb3, 0x84, 0xc3, 0xd3, 0x75, 0xe3, 0xf3, 0x46, 0x94, 0xa4, 0x85, 0xb4, 0x95, 0xc4, 0xd4, 0xe4, 0xf4, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, 0xf2, 0xed, 0xb2, 0x8d, 0x4d, 0x45, 0xcd, 0x2f, 0x3f, 0x44, 0x68, 0x93, 0xc3, 0x58, 0xc8, 0xf1, 0x1f, 0x8a, 0x33, 0x86, 0xda, 0x58, 0xc1, 0xa0, 0x02, 0x4f, 0xc4, 0xa1, 0x69, 0xa5, 0x9b, 0x5b, 0x4b, 0x84, 0x73, 0xdf, 0xc9, 0x15, 0xf8, 0xe3, 0xd1, 0x0e, 0x07, 0x93, 0xf3, 0xd1, 0x0f, 0x1c, 0x17, 0xef, 0x2e, 0x3b, 0x5b, 0xdc, 0xff, 0x00, 0xdf, 0x42, 0xbf, 0x8f, 0x8e, 0xdc, 0x82, 0xca, 0xd8, 0x37, 0x11, 0xa9, 0x3d, 0x82, 0x69, 0x2b, 0xc4, 0x6d, 0xc9, 0x75, 0x25, 0xbc, 0xf7, 0xec, 0xa1, 0xb5, 0x74, 0x19, 0x5d, 0x2e, 0x8a, 0x9a, 0x4b, 0x89, 0x7d, 0xc4, 0x68, 0xc6, 0xf6, 0xfe, 0xb2, 0xa0, 0x30, 0x1d, 0x60, 0x86, 0x88, 0x8d, 0x49, 0x3e, 0x01, 0x11, 0x20, 0xa3, 0x8c, 0xb9, 0xb1, 0xaa, 0x62, 0xad, 0xbf, 0x18, 0x97, 0x43, 0x47, 0x1d, 0xd2, 0xaf, 0x04, 0xd9, 0xb8, 0xc8, 0x0d, 0x68, 0xe4, 0xf7, 0x3e, 0x48, 0xf1, 0x05, 0xbc, 0x25, 0xaa, 0x07, 0x71, 0xd9, 0x14, 0x78, 0xf6, 0x49, 0xb5, 0x90, 0xfd, 0xa7, 0xc6, 0x14, 0xfd, 0x1b, 0x1c, 0xff, 0x00, 0x4d, 0x8d, 0x2e, 0x73, 0x8c, 0x35, 0xa3, 0x52, 0x4f, 0x92, 0x48, 0xa6, 0x1a, 0x24, 0xb6, 0x2a, 0xfa, 0xa5, 0x9e, 0x60, 0x64, 0x39, 0x94, 0x13, 0xcb, 0x27, 0x73, 0x80, 0xf3, 0x0c, 0xf6, 0xff, 0x00, 0xd2, 0x5a, 0x78, 0xbf, 0x53, 0x71, 0xf6, 0x01, 0x75, 0xb6, 0x97, 0x6a, 0x25, 0xa1, 0xad, 0x1f, 0xf4, 0xb7, 0x23, 0x48, 0xb7, 0x94, 0x84, 0x97, 0x5b, 0xff, 0x00, 0x32, 0xa9, 0xdd, 0xfc, 0xed, 0x9b, 0x7e, 0x0d, 0x9e, 0x52, 0x4a, 0x95, 0x61, 0xff, 0xd0, 0xf3, 0x3b, 0xa7, 0x70, 0xee, 0x01, 0x8f, 0xb9, 0x59, 0xfa, 0x7e, 0xdf, 0xe4, 0xc8, 0xf9, 0x2a, 0xc2, 0x5c, 0x63, 0xc3, 0x54, 0x67, 0x87, 0x6e, 0x10, 0x35, 0x68, 0xd4, 0x79, 0x1e, 0x53, 0x4a, 0xe0, 0xdc, 0xe9, 0xb8, 0x1f, 0x6a, 0xda, 0x6c, 0x25, 0x94, 0x37, 0xb0, 0xd0, 0xb8, 0xad, 0x67, 0xe4, 0x55, 0x8a, 0x5b, 0x8b, 0x82, 0xc0, 0x6f, 0x76, 0x80, 0x34, 0x49, 0x05, 0x2e, 0x9e, 0xc6, 0x1c, 0x66, 0x31, 0xba, 0x10, 0x23, 0xe0, 0xaf, 0xe1, 0x61, 0x53, 0x43, 0x8d, 0x81, 0xb3, 0x67, 0xef, 0x9e, 0x49, 0x2a, 0x12, 0x6c, 0xb6, 0x63, 0x1a, 0x0c, 0x31, 0xba, 0x55, 0xcd, 0xac, 0xfa, 0x8e, 0xdf, 0x91, 0x6e, 0x91, 0xd9, 0xb3, 0xc9, 0x73, 0x90, 0x7a, 0xab, 0x6a, 0xc2, 0xa4, 0x60, 0xe2, 0x8f, 0xd2, 0x38, 0x03, 0x7d, 0x9e, 0x0d, 0xff, 0x00, 0xcc, 0xd6, 0xd3, 0x6b, 0x71, 0x67, 0xd2, 0x3e, 0x64, 0x72, 0xab, 0xdb, 0x8d, 0x54, 0x39, 0xc5, 0x83, 0x6b, 0x3d, 0xee, 0x2e, 0xd4, 0x92, 0x3c, 0x4a, 0x56, 0xba, 0xb4, 0x79, 0x5c, 0xf7, 0xb2, 0x96, 0x6c, 0x8d, 0xaf, 0x80, 0x48, 0x3c, 0xf0, 0xb2, 0x1f, 0x63, 0x9c, 0xe9, 0x3f, 0x24, 0x5c, 0xdb, 0xdd, 0x76, 0x43, 0xde, 0xfd, 0x5c, 0xe3, 0x24, 0xfc, 0x50, 0x00, 0x93, 0x0a, 0x78, 0x8a, 0x0d, 0x49, 0xca, 0xcf, 0x93, 0x63, 0x1b, 0x7d, 0xd7, 0x57, 0x50, 0xd5, 0xef, 0x70, 0x6b, 0x4f, 0xc7, 0x45, 0xdb, 0x74, 0x9e, 0x8d, 0x5e, 0x33, 0x83, 0xd8, 0x37, 0xdd, 0xc3, 0xac, 0x3d, 0xbf, 0x92, 0xc5, 0x5b, 0xea, 0xbf, 0xd5, 0x62, 0xc0, 0xdc, 0xbc, 0xbd, 0x2d, 0x22, 0x5a, 0xcf, 0xdd, 0x69, 0xff, 0x00, 0xd1, 0x8e, 0x5d, 0xa5, 0x38, 0xb5, 0xb0, 0x00, 0xc6, 0xc4, 0x24, 0x4a, 0xd6, 0x8d, 0x18, 0x04, 0x49, 0x88, 0x9e, 0x55, 0xd6, 0x61, 0xb0, 0xc1, 0x70, 0x32, 0xdd, 0x3c, 0x95, 0xda, 0xf1, 0xfe, 0xf5, 0x62, 0xbc, 0x76, 0x8e, 0x75, 0x28, 0x02, 0xa2, 0xe7, 0x7d, 0x92, 0xb9, 0x84, 0x96, 0x96, 0xda, 0xf7, 0x70, 0x12, 0x4e, 0x5a, 0xff, 0x00, 0xff, 0xd1, 0xf3, 0x7a, 0x21, 0xaf, 0xde, 0xef, 0xa2, 0x22, 0x55, 0xfc, 0x5a, 0xbd, 0x42, 0xfb, 0x08, 0xfa, 0x67, 0x4f, 0x82, 0xcd, 0x6d, 0x85, 0xc0, 0x56, 0x3b, 0x90, 0xb7, 0xf0, 0x2a, 0x0e, 0x63, 0x58, 0x3b, 0xf2, 0xa3, 0x9e, 0x8c, 0xb8, 0x86, 0xbe, 0x49, 0xf1, 0x2c, 0x0c, 0x86, 0xb4, 0x4c, 0x69, 0xe4, 0xaf, 0x6e, 0xcc, 0x6b, 0x7d, 0x46, 0xb3, 0x70, 0xec, 0x38, 0x51, 0x7d, 0x02, 0x8a, 0xc7, 0xa6, 0xd9, 0x20, 0x68, 0x0f, 0x8f, 0x8a, 0xcf, 0xc9, 0xc2, 0xea, 0x59, 0x5b, 0x48, 0xb0, 0x91, 0xae, 0xe6, 0xc9, 0x03, 0xc9, 0x30, 0x51, 0x66, 0xd4, 0x0d, 0xad, 0xbd, 0x5f, 0x53, 0xcc, 0x6b, 0xb6, 0x90, 0x5a, 0x3b, 0x83, 0x0b, 0x43, 0x17, 0x31, 0xd6, 0xc3, 0x6e, 0x12, 0x3b, 0x79, 0xac, 0xc1, 0x89, 0x47, 0xd9, 0xe8, 0x63, 0x98, 0x45, 0xed, 0x6c, 0x5a, 0xf1, 0xa0, 0x27, 0xc5, 0x5b, 0xc3, 0x6f, 0xa6, 0xe0, 0x1c, 0x7d, 0xb3, 0xa2, 0x69, 0x34, 0x7b, 0xae, 0x1a, 0x8d, 0x45, 0x17, 0x9d, 0xeb, 0xfd, 0x21, 0xd8, 0xb9, 0xae, 0xb5, 0x80, 0xbb, 0x1e, 0xd2, 0x5c, 0xd7, 0x78, 0x13, 0xf9, 0xae, 0x4b, 0xea, 0xc7, 0x4a, 0x39, 0xbd, 0x55, 0xb3, 0xed, 0x66, 0x38, 0xf5, 0x09, 0x22, 0x41, 0x23, 0xe8, 0x37, 0xfb, 0x4b, 0xa1, 0xeb, 0xd6, 0xfe, 0x88, 0x31, 0xbf, 0x41, 0xc0, 0xee, 0xd2, 0x74, 0x02, 0x78, 0x53, 0xfa, 0x97, 0x43, 0x19, 0x85, 0x65, 0xff, 0x00, 0x9d, 0x71, 0x33, 0xe4, 0x1a, 0x7d, 0x8d, 0x53, 0x42, 0x56, 0x35, 0x6b, 0xe5, 0x80, 0x06, 0xc7, 0x57, 0xa7, 0xc4, 0xa9, 0xdb, 0xb6, 0x81, 0x1f, 0xeb, 0xd9, 0x69, 0x56, 0xc2, 0xd0, 0x00, 0xe5, 0x55, 0xc0, 0x12, 0xc2, 0xd7, 0x4e, 0xa2, 0x5a, 0x7c, 0x0a, 0xd0, 0x63, 0x9a, 0xd1, 0xaf, 0xd2, 0xe2, 0x3c, 0x12, 0x62, 0x66, 0xc6, 0x42, 0x23, 0x5a, 0x49, 0x8f, 0x10, 0xa2, 0xd2, 0x3e, 0x28, 0x9d, 0xc4, 0x88, 0x09, 0x29, 0x16, 0xc3, 0x3c, 0x24, 0x8d, 0xe6, 0x92, 0x72, 0x1f, 0xff, 0xd2, 0xf3, 0xbb, 0xb0, 0xfe, 0xcb, 0x99, 0xe9, 0xce, 0xf6, 0x88, 0x2d, 0x77, 0x91, 0x5b, 0x3d, 0x3d, 0xd0, 0xe6, 0x90, 0xa9, 0x65, 0x57, 0x38, 0x95, 0xdd, 0xcb, 0x9a, 0x7d, 0xce, 0xf2, 0x3f, 0x44, 0x23, 0x60, 0x58, 0x76, 0xe9, 0xca, 0x8c, 0xea, 0x1b, 0x31, 0x02, 0x32, 0x23, 0xea, 0xee, 0xb1, 0xcd, 0xb0, 0xc7, 0x87, 0x74, 0x7a, 0xeb, 0x70, 0x1a, 0x71, 0xe1, 0xfe, 0xe4, 0x1c, 0x1d, 0xae, 0xe5, 0x69, 0xd8, 0xfa, 0x99, 0x50, 0x0d, 0x1a, 0xf7, 0x2a, 0x3a, 0x0c, 0xf4, 0x1a, 0x8e, 0xc7, 0x27, 0x5d, 0xbf, 0x18, 0x41, 0xdc, 0xc2, 0xf0, 0x7f, 0x74, 0xf6, 0x3a, 0x22, 0x66, 0xdb, 0x68, 0xc6, 0x80, 0x48, 0x6b, 0x88, 0x06, 0x39, 0x0d, 0xee, 0xaa, 0x1f, 0xb3, 0xd5, 0x1b, 0x83, 0xd8, 0x3b, 0x38, 0x8f, 0x69, 0xfe, 0xdf, 0xd1, 0x4d, 0x29, 0xa1, 0x4c, 0x7a, 0xf4, 0xbf, 0xa7, 0x92, 0xcf, 0xa5, 0x20, 0x08, 0xf3, 0xf6, 0xff, 0x00, 0x15, 0xbb, 0xd1, 0x31, 0xd9, 0x5e, 0x3d, 0x75, 0x56, 0x36, 0x88, 0x00, 0x81, 0xe0, 0x16, 0x5e, 0x55, 0x74, 0x3f, 0x00, 0x9d, 0xe0, 0xcc, 0x69, 0xe7, 0x3a, 0x2d, 0xbe, 0x90, 0x00, 0xa9, 0xae, 0xef, 0x1f, 0x95, 0x4b, 0x0d, 0x9a, 0xdc, 0xc7, 0x45, 0xfe, 0xb1, 0x7d, 0x60, 0xa7, 0xa1, 0xe0, 0x1f, 0x4e, 0x1d, 0x99, 0x69, 0x02, 0x9a, 0xcf, 0x1f, 0xca, 0x7b, 0xbf, 0x90, 0xc5, 0xc2, 0xb3, 0xeb, 0x57, 0xd6, 0x03, 0x6b, 0xae, 0x39, 0xb6, 0x82, 0xe3, 0x31, 0xa1, 0x68, 0xf2, 0x6b, 0x5c, 0x12, 0xfa, 0xe1, 0x91, 0x66, 0x47, 0x5d, 0xb8, 0x3b, 0x4f, 0x44, 0x36, 0xb6, 0x8f, 0x28, 0xdd, 0xff, 0x00, 0x7e, 0x46, 0xab, 0x12, 0x2b, 0x65, 0x55, 0x32, 0xa7, 0x62, 0xb6, 0xbd, 0xf7, 0x64, 0x10, 0xdb, 0x03, 0x9f, 0x1b, 0x9e, 0xc7, 0xd9, 0xb8, 0x3b, 0x1f, 0x67, 0xf3, 0x6c, 0x52, 0x80, 0xd7, 0x7d, 0x0f, 0xea, 0x7f, 0x5d, 0x1d, 0x67, 0xa6, 0x0b, 0x1e, 0x47, 0xda, 0x69, 0x3b, 0x2e, 0x03, 0xc7, 0xf3, 0x5f, 0x1f, 0xf0, 0x8b, 0xa1, 0x02, 0x46, 0xba, 0x79, 0xaf, 0x32, 0xff, 0x00, 0x16, 0xad, 0xca, 0x1d, 0x57, 0x2a, 0xdc, 0x79, 0x18, 0x41, 0xb0, 0xf6, 0x9e, 0xe4, 0x9f, 0xd0, 0x8f, 0xeb, 0x31, 0xab, 0xd2, 0x83, 0xa4, 0xcb, 0x8c, 0xb8, 0xa0, 0x42, 0x12, 0x7b, 0x67, 0x9f, 0x2f, 0xf5, 0x09, 0x26, 0x96, 0xc4, 0xce, 0xa9, 0x20, 0xa7, 0xff, 0xd3, 0xf3, 0x2f, 0xb4, 0x5d, 0xe9, 0x0a, 0xb7, 0x9f, 0x4c, 0x19, 0xdb, 0x3a, 0x2d, 0x5e, 0x94, 0xfd, 0xc4, 0xb7, 0xc5, 0x62, 0xf9, 0x2b, 0xfd, 0x2e, 0xe3, 0x5d, 0xe0, 0x7c, 0x13, 0x48, 0xd1, 0x92, 0x12, 0xa9, 0x0b, 0x7a, 0xbc, 0x2d, 0xc2, 0x7f, 0x92, 0x60, 0xab, 0x4e, 0x79, 0x2e, 0x00, 0xf0, 0xaa, 0xe1, 0xda, 0x3d, 0x43, 0xfc, 0xad, 0x55, 0xbb, 0x80, 0x79, 0x81, 0xa0, 0xe6, 0x54, 0x32, 0x6d, 0x02, 0xbe, 0xf3, 0x61, 0x81, 0xa8, 0x44, 0x14, 0x03, 0x59, 0x0e, 0x1c, 0xf6, 0x1f, 0xdc, 0xb2, 0xec, 0xa3, 0x23, 0x77, 0xe8, 0x6e, 0x70, 0xf2, 0x25, 0x1f, 0x1f, 0x17, 0xa9, 0x6d, 0x71, 0x36, 0x97, 0x47, 0x00, 0xa4, 0x02, 0xe0, 0x2c, 0x7c, 0xc1, 0xab, 0xd5, 0x31, 0x85, 0x35, 0xd4, 0xe6, 0x13, 0x02, 0xd6, 0x4b, 0x67, 0x48, 0x2b, 0xa9, 0xe9, 0x2e, 0x02, 0xb6, 0x4f, 0x82, 0xe5, 0x7a, 0x95, 0x19, 0xc6, 0x87, 0x3d, 0xfb, 0xa2, 0xb8, 0x79, 0x1e, 0x4d, 0x3b, 0x96, 0xcf, 0x4f, 0xbd, 0xcd, 0xa2, 0xa2, 0x1f, 0xa0, 0x82, 0xd3, 0xfc, 0x97, 0x05, 0x24, 0x36, 0x6b, 0xf3, 0x31, 0xa2, 0x35, 0x79, 0xef, 0xad, 0xf8, 0xae, 0xaf, 0xaf, 0xd8, 0xf2, 0xd8, 0x6d, 0xed, 0x6b, 0xda, 0x7b, 0x18, 0x1b, 0x5d, 0xff, 0x00, 0x52, 0xb1, 0x6d, 0xf0, 0x81, 0x31, 0xca, 0xf4, 0x6e, 0xb1, 0x80, 0xce, 0xb1, 0x84, 0xc0, 0x21, 0xb7, 0xd6, 0x77, 0x31, 0xd1, 0x27, 0xc1, 0xcd, 0xfe, 0xd2, 0xe3, 0xec, 0xe8, 0x1d, 0x45, 0x96, 0xb0, 0x9a, 0xb7, 0x87, 0x3f, 0x68, 0x2d, 0xf7, 0x01, 0x1f, 0xbe, 0xd1, 0xf4, 0x7f, 0xb4, 0xa4, 0x0d, 0x77, 0xbb, 0xfa, 0x8f, 0x80, 0x3a, 0x7f, 0x43, 0xaa, 0xe2, 0xdf, 0xd2, 0x65, 0x7e, 0x95, 0xe4, 0x0f, 0x1f, 0xa1, 0xfe, 0x6b, 0x16, 0x9f, 0x52, 0xfa, 0xc1, 0xd3, 0xba, 0x6d, 0x26, 0xdc, 0xac, 0x86, 0xd4, 0xd9, 0x0d, 0x31, 0x2e, 0x74, 0x9e, 0xdb, 0x59, 0x2e, 0x55, 0xe8, 0xc9, 0xb2, 0x96, 0xd5, 0x4b, 0x9f, 0xb8, 0x6d, 0xda, 0x1c, 0x04, 0x09, 0x03, 0xfe, 0x8a, 0xc6, 0xfa, 0xd3, 0xf5, 0x6a, 0xbe, 0xbb, 0x5b, 0x2e, 0xc6, 0xb5, 0x94, 0xe6, 0xd5, 0x20, 0x97, 0x7d, 0x1b, 0x1b, 0xf9, 0xad, 0x7c, 0x7d, 0x17, 0xb7, 0xf3, 0x1e, 0x92, 0x1b, 0x7f, 0xf8, 0xe0, 0x7d, 0x59, 0xdd, 0xfd, 0x32, 0xd8, 0x8f, 0xa5, 0xe8, 0x3a, 0x12, 0x5c, 0x3f, 0xfc, 0xc4, 0xfa, 0xc3, 0xb3, 0x77, 0xa7, 0x56, 0xed, 0xdb, 0x76, 0x7a, 0x8d, 0xdd, 0x1f, 0xbf, 0xfd, 0x44, 0x92, 0x56, 0x8f, 0xff, 0xd4, 0xf2, 0xe8, 0x86, 0x17, 0x1e, 0xfa, 0x04, 0x56, 0x4b, 0x43, 0x6c, 0x6f, 0x2d, 0xe5, 0x46, 0x01, 0x64, 0x2b, 0x14, 0x32, 0x5b, 0xb4, 0xa0, 0x52, 0x1d, 0xde, 0x9b, 0x94, 0xdb, 0xab, 0x6b, 0x81, 0xf7, 0x05, 0xb0, 0xd7, 0x07, 0xb2, 0x27, 0x55, 0xc6, 0x57, 0x65, 0xd8, 0x76, 0x6e, 0x64, 0xed, 0xee, 0x16, 0xce, 0x27, 0x57, 0x63, 0xda, 0x0c, 0xc2, 0x8e, 0x51, 0x67, 0x84, 0xfa, 0x1d, 0xdd, 0x62, 0xc7, 0x07, 0xe9, 0xf7, 0xa3, 0xd6, 0x6c, 0x02, 0x41, 0x55, 0x31, 0xf3, 0x2b, 0xb3, 0xba, 0x2b, 0x2e, 0x68, 0x24, 0x1d, 0x47, 0x64, 0xca, 0xa6, 0x50, 0x41, 0x65, 0x90, 0x6c, 0xb1, 0xa5, 0xae, 0x33, 0x23, 0x51, 0xe4, 0xab, 0x7d, 0x5d, 0xcb, 0xb6, 0xcc, 0x37, 0xd0, 0x40, 0x73, 0x71, 0xde, 0x58, 0x09, 0xe7, 0x6f, 0x2c, 0x44, 0xc9, 0xc9, 0xae, 0xba, 0x9d, 0x63, 0x88, 0x01, 0xa0, 0x95, 0x9d, 0xf5, 0x3f, 0x2a, 0xe6, 0x67, 0xdb, 0x50, 0x83, 0x55, 0xad, 0x36, 0x3e, 0x78, 0x10, 0x74, 0x77, 0xfd, 0x2d, 0xaa, 0x4c, 0x7d, 0x58, 0x73, 0x91, 0xa0, 0x0f, 0x51, 0x45, 0xb7, 0x33, 0xdd, 0x58, 0x69, 0x1d, 0xd8, 0x0c, 0x9f, 0x96, 0x88, 0x19, 0x99, 0x19, 0xac, 0xcf, 0xa3, 0xd2, 0xad, 0xb5, 0xdb, 0x76, 0x8f, 0xad, 0xc4, 0xea, 0xcf, 0xdf, 0x7e, 0xdf, 0xdd, 0xfc, 0xd5, 0xa3, 0x5e, 0x43, 0x2b, 0x6b, 0xb2, 0xad, 0x3b, 0x6a, 0xa4, 0x13, 0xa7, 0x04, 0xac, 0x7a, 0x6f, 0xb3, 0x23, 0x26, 0xcc, 0xfb, 0xb4, 0x75, 0x8e, 0x01, 0x83, 0xf7, 0x58, 0x3e, 0x8b, 0x53, 0xa7, 0x2a, 0x1a, 0x31, 0x42, 0x36, 0x5d, 0x4c, 0x9a, 0xf2, 0xdc, 0xc6, 0xfe, 0x98, 0xb4, 0x34, 0xcb, 0x48, 0x0a, 0x8f, 0xdb, 0xb2, 0xeb, 0x76, 0xd6, 0x07, 0x5c, 0x59, 0xc9, 0x64, 0x8f, 0x93, 0xa7, 0x73, 0x16, 0x83, 0xaf, 0x0e, 0xa4, 0x33, 0xef, 0x50, 0xc5, 0x0c, 0xda, 0x59, 0x10, 0x06, 0x8a, 0x2e, 0x29, 0x0e, 0xac, 0xc2, 0x31, 0x3d, 0x36, 0x69, 0x7e, 0xd6, 0xcc, 0xf5, 0x3d, 0x6f, 0xb3, 0xeb, 0x1b, 0x76, 0xef, 0x3b, 0xa3, 0xfa, 0xc9, 0x2b, 0x5f, 0x66, 0x6f, 0xa9, 0x1e, 0x73, 0xf2, 0x49, 0x2e, 0x39, 0xf7, 0x4f, 0xb7, 0x8d, 0xff, 0xd5, 0xf3, 0x26, 0xfe, 0x0a, 0xc5, 0x1b, 0xa7, 0xcb, 0xb2, 0xcf, 0x49, 0x03, 0xb2, 0x46, 0xee, 0xd9, 0xd9, 0xb3, 0xf4, 0x9f, 0x25, 0x4a, 0xdf, 0x4b, 0x77, 0xe8, 0x27, 0xd4, 0xef, 0x1c, 0x2a, 0x29, 0x26, 0xc5, 0x7c, 0x9d, 0x6c, 0x7f, 0xb7, 0x6e, 0x1b, 0x26, 0x7f, 0x05, 0xa3, 0xfe, 0x53, 0x8d, 0x62, 0x57, 0x30, 0x92, 0x12, 0xfa, 0x2f, 0x86, 0xdf, 0xa4, 0xec, 0x67, 0xfe, 0xd0, 0xf4, 0xff, 0x00, 0x4d, 0xfc, 0xdf, 0x78, 0xe1, 0x68, 0x7d, 0x54, 0x99, 0xbf, 0x6f, 0xf3, 0xbe, 0xdf, 0x8e, 0xdd, 0x7f, 0xef, 0xeb, 0x97, 0x49, 0x3e, 0x3b, 0x7f, 0x06, 0x2c, 0x9f, 0x37, 0x5f, 0xf0, 0x9f, 0x4c, 0xeb, 0x7b, 0xbf, 0x67, 0x55, 0xe8, 0xff, 0x00, 0x31, 0xbc, 0x7a, 0x9e, 0x31, 0xdb, 0xfe, 0x92, 0xae, 0x37, 0x7a, 0x4d, 0xdb, 0xe2, 0x17, 0x9d, 0xa4, 0xa3, 0xc9, 0xba, 0xfc, 0x7b, 0x7d, 0x5f, 0x52, 0xa7, 0x7e, 0xd1, 0x28, 0xf8, 0xf3, 0xb0, 0xc7, 0x32, 0xbc, 0x99, 0x24, 0xc5, 0xe3, 0xab, 0xeb, 0x1f, 0xa4, 0xf5, 0xfc, 0xe1, 0x25, 0xe4, 0xe9, 0x24, 0x97, 0xff, 0xd9, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x41, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x65, 0x00, 0x20, 0x00, 0x50, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x00, 0x00, 0x13, 0x00, 0x41, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x65, 0x00, 0x20, 0x00, 0x50, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x20, 0x00, 0x37, 0x00, 0x2e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0xff, 0xe1, 0x15, 0x67, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x00, 0x3c, 0x3f, 0x78, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x3d, 0x27, 0xef, 0xbb, 0xbf, 0x27, 0x20, 0x69, 0x64, 0x3d, 0x27, 0x57, 0x35, 0x4d, 0x30, 0x4d, 0x70, 0x43, 0x65, 0x68, 0x69, 0x48, 0x7a, 0x72, 0x65, 0x53, 0x7a, 0x4e, 0x54, 0x63, 0x7a, 0x6b, 0x63, 0x39, 0x64, 0x27, 0x3f, 0x3e, 0x0a, 0x3c, 0x3f, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2d, 0x78, 0x61, 0x70, 0x2d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x20, 0x65, 0x73, 0x63, 0x3d, 0x22, 0x43, 0x52, 0x22, 0x3f, 0x3e, 0x0a, 0x3c, 0x78, 0x3a, 0x78, 0x61, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x3d, 0x27, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x3a, 0x6e, 0x73, 0x3a, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x27, 0x20, 0x78, 0x3a, 0x78, 0x61, 0x70, 0x74, 0x6b, 0x3d, 0x27, 0x58, 0x4d, 0x50, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x20, 0x32, 0x2e, 0x38, 0x2e, 0x32, 0x2d, 0x33, 0x33, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x31, 0x2e, 0x35, 0x27, 0x3e, 0x0a, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x72, 0x64, 0x66, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x31, 0x39, 0x39, 0x39, 0x2f, 0x30, 0x32, 0x2f, 0x32, 0x32, 0x2d, 0x72, 0x64, 0x66, 0x2d, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2d, 0x6e, 0x73, 0x23, 0x27, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x69, 0x58, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x58, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x27, 0x3e, 0x0a, 0x0a, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x3d, 0x27, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x32, 0x32, 0x64, 0x30, 0x32, 0x62, 0x30, 0x61, 0x2d, 0x62, 0x32, 0x34, 0x39, 0x2d, 0x31, 0x31, 0x64, 0x62, 0x2d, 0x38, 0x61, 0x66, 0x38, 0x2d, 0x39, 0x31, 0x64, 0x35, 0x34, 0x30, 0x33, 0x66, 0x39, 0x32, 0x66, 0x39, 0x27, 0x0a, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x70, 0x64, 0x66, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x64, 0x66, 0x2f, 0x31, 0x2e, 0x33, 0x2f, 0x27, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x21, 0x2d, 0x2d, 0x20, 0x70, 0x64, 0x66, 0x3a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x2d, 0x2d, 0x3e, 0x0a, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x0a, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x3d, 0x27, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x32, 0x32, 0x64, 0x30, 0x32, 0x62, 0x30, 0x61, 0x2d, 0x62, 0x32, 0x34, 0x39, 0x2d, 0x31, 0x31, 0x64, 0x62, 0x2d, 0x38, 0x61, 0x66, 0x38, 0x2d, 0x39, 0x31, 0x64, 0x35, 0x34, 0x30, 0x33, 0x66, 0x39, 0x32, 0x66, 0x39, 0x27, 0x0a, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x27, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x21, 0x2d, 0x2d, 0x20, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x3a, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x2d, 0x2d, 0x3e, 0x0a, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x0a, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x3d, 0x27, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x32, 0x32, 0x64, 0x30, 0x32, 0x62, 0x30, 0x61, 0x2d, 0x62, 0x32, 0x34, 0x39, 0x2d, 0x31, 0x31, 0x64, 0x62, 0x2d, 0x38, 0x61, 0x66, 0x38, 0x2d, 0x39, 0x31, 0x64, 0x35, 0x34, 0x30, 0x33, 0x66, 0x39, 0x32, 0x66, 0x39, 0x27, 0x0a, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x61, 0x70, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x27, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x21, 0x2d, 0x2d, 0x20, 0x78, 0x61, 0x70, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x2d, 0x2d, 0x3e, 0x0a, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x0a, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x3d, 0x27, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x32, 0x32, 0x64, 0x30, 0x32, 0x62, 0x30, 0x61, 0x2d, 0x62, 0x32, 0x34, 0x39, 0x2d, 0x31, 0x31, 0x64, 0x62, 0x2d, 0x38, 0x61, 0x66, 0x38, 0x2d, 0x39, 0x31, 0x64, 0x35, 0x34, 0x30, 0x33, 0x66, 0x39, 0x32, 0x66, 0x39, 0x27, 0x0a, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x61, 0x70, 0x4d, 0x4d, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x6d, 0x6d, 0x2f, 0x27, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x78, 0x61, 0x70, 0x4d, 0x4d, 0x3a, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x3e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x3a, 0x64, 0x6f, 0x63, 0x69, 0x64, 0x3a, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x3a, 0x32, 0x32, 0x64, 0x30, 0x32, 0x62, 0x30, 0x36, 0x2d, 0x62, 0x32, 0x34, 0x39, 0x2d, 0x31, 0x31, 0x64, 0x62, 0x2d, 0x38, 0x61, 0x66, 0x38, 0x2d, 0x39, 0x31, 0x64, 0x35, 0x34, 0x30, 0x33, 0x66, 0x39, 0x32, 0x66, 0x39, 0x3c, 0x2f, 0x78, 0x61, 0x70, 0x4d, 0x4d, 0x3a, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x3e, 0x0a, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x0a, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x3d, 0x27, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x32, 0x32, 0x64, 0x30, 0x32, 0x62, 0x30, 0x61, 0x2d, 0x62, 0x32, 0x34, 0x39, 0x2d, 0x31, 0x31, 0x64, 0x62, 0x2d, 0x38, 0x61, 0x66, 0x38, 0x2d, 0x39, 0x31, 0x64, 0x35, 0x34, 0x30, 0x33, 0x66, 0x39, 0x32, 0x66, 0x39, 0x27, 0x0a, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x64, 0x63, 0x3d, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x75, 0x72, 0x6c, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x64, 0x63, 0x2f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x31, 0x2e, 0x31, 0x2f, 0x27, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x64, 0x63, 0x3a, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x41, 0x6c, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x6c, 0x69, 0x20, 0x78, 0x6d, 0x6c, 0x3a, 0x6c, 0x61, 0x6e, 0x67, 0x3d, 0x27, 0x78, 0x2d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x27, 0x3e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x6c, 0x69, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x41, 0x6c, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x63, 0x3a, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x0a, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x3e, 0x0a, 0x3c, 0x2f, 0x78, 0x3a, 0x78, 0x61, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x3c, 0x3f, 0x78, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x65, 0x6e, 0x64, 0x3d, 0x27, 0x77, 0x27, 0x3f, 0x3e, 0xff, 0xee, 0x00, 0x0e, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x00, 0x64, 0x40, 0x00, 0x00, 0x00, 0x01, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03, 0x04, 0x06, 0x04, 0x03, 0x04, 0x06, 0x07, 0x05, 0x04, 0x04, 0x05, 0x07, 0x08, 0x06, 0x06, 0x07, 0x06, 0x06, 0x08, 0x0a, 0x08, 0x09, 0x09, 0x09, 0x09, 0x08, 0x0a, 0x0a, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0a, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x01, 0x04, 0x05, 0x05, 0x08, 0x07, 0x08, 0x0f, 0x0a, 0x0a, 0x0f, 0x14, 0x0e, 0x0e, 0x0e, 0x14, 0x14, 0x0e, 0x0e, 0x0e, 0x0e, 0x14, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x11, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x64, 0x00, 0x64, 0x03, 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xdd, 0x00, 0x04, 0x00, 0x0d, 0xff, 0xc4, 0x01, 0xa2, 0x00, 0x00, 0x00, 0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x03, 0x02, 0x06, 0x01, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x01, 0x00, 0x02, 0x02, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x02, 0x06, 0x07, 0x03, 0x04, 0x02, 0x06, 0x02, 0x73, 0x01, 0x02, 0x03, 0x11, 0x04, 0x00, 0x05, 0x21, 0x12, 0x31, 0x41, 0x51, 0x06, 0x13, 0x61, 0x22, 0x71, 0x81, 0x14, 0x32, 0x91, 0xa1, 0x07, 0x15, 0xb1, 0x42, 0x23, 0xc1, 0x52, 0xd1, 0xe1, 0x33, 0x16, 0x62, 0xf0, 0x24, 0x72, 0x82, 0xf1, 0x25, 0x43, 0x34, 0x53, 0x92, 0xa2, 0xb2, 0x63, 0x73, 0xc2, 0x35, 0x44, 0x27, 0x93, 0xa3, 0xb3, 0x36, 0x17, 0x54, 0x64, 0x74, 0xc3, 0xd2, 0xe2, 0x08, 0x26, 0x83, 0x09, 0x0a, 0x18, 0x19, 0x84, 0x94, 0x45, 0x46, 0xa4, 0xb4, 0x56, 0xd3, 0x55, 0x28, 0x1a, 0xf2, 0xe3, 0xf3, 0xc4, 0xd4, 0xe4, 0xf4, 0x65, 0x75, 0x85, 0x95, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x37, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, 0x38, 0x48, 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, 0xe8, 0xf8, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xd9, 0xe9, 0xf9, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, 0x8a, 0x9a, 0xaa, 0xba, 0xca, 0xda, 0xea, 0xfa, 0x11, 0x00, 0x02, 0x02, 0x01, 0x02, 0x03, 0x05, 0x05, 0x04, 0x05, 0x06, 0x04, 0x08, 0x03, 0x03, 0x6d, 0x01, 0x00, 0x02, 0x11, 0x03, 0x04, 0x21, 0x12, 0x31, 0x41, 0x05, 0x51, 0x13, 0x61, 0x22, 0x06, 0x71, 0x81, 0x91, 0x32, 0xa1, 0xb1, 0xf0, 0x14, 0xc1, 0xd1, 0xe1, 0x23, 0x42, 0x15, 0x52, 0x62, 0x72, 0xf1, 0x33, 0x24, 0x34, 0x43, 0x82, 0x16, 0x92, 0x53, 0x25, 0xa2, 0x63, 0xb2, 0xc2, 0x07, 0x73, 0xd2, 0x35, 0xe2, 0x44, 0x83, 0x17, 0x54, 0x93, 0x08, 0x09, 0x0a, 0x18, 0x19, 0x26, 0x36, 0x45, 0x1a, 0x27, 0x64, 0x74, 0x55, 0x37, 0xf2, 0xa3, 0xb3, 0xc3, 0x28, 0x29, 0xd3, 0xe3, 0xf3, 0x84, 0x94, 0xa4, 0xb4, 0xc4, 0xd4, 0xe4, 0xf4, 0x65, 0x75, 0x85, 0x95, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x46, 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, 0x38, 0x48, 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, 0xe8, 0xf8, 0x39, 0x49, 0x59, 0x69, 0x79, 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xd9, 0xe9, 0xf9, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, 0x8a, 0x9a, 0xaa, 0xba, 0xca, 0xda, 0xea, 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, 0xf0, 0x67, 0xa6, 0x5c, 0x0f, 0x01, 0xd4, 0x7e, 0x18, 0x12, 0x98, 0xe9, 0xd6, 0x2d, 0x34, 0x6d, 0x70, 0xdf, 0xdc, 0xa1, 0xe3, 0xec, 0x5b, 0xfb, 0x32, 0x24, 0xb2, 0x01, 0x1f, 0x15, 0xa4, 0x52, 0x4a, 0x82, 0x31, 0xf1, 0xfe, 0xd1, 0x3d, 0x14, 0x64, 0x49, 0x64, 0x22, 0x98, 0xcf, 0xa5, 0x46, 0x6c, 0x16, 0x55, 0x71, 0x56, 0x62, 0x28, 0x07, 0xc5, 0x45, 0x15, 0xa0, 0xc8, 0x89, 0x33, 0xe1, 0x63, 0xd2, 0xd8, 0x34, 0x44, 0x17, 0xa0, 0x2c, 0x4d, 0x16, 0xbb, 0xed, 0xdc, 0xf8, 0x64, 0xc1, 0x6b, 0x31, 0x42, 0x18, 0x8e, 0xc7, 0xb5, 0x2a, 0x7d, 0xb2, 0x56, 0xc5, 0x61, 0x8c, 0xf2, 0xa0, 0x1b, 0x1e, 0x83, 0x0d, 0xa1, 0x63, 0x50, 0x1f, 0x97, 0x7c, 0x2a, 0xa9, 0x1a, 0x9a, 0x86, 0x4f, 0xb4, 0xb4, 0x38, 0x0a, 0xa6, 0x0b, 0xb8, 0x0c, 0x05, 0x14, 0xf8, 0x76, 0x3e, 0x19, 0x14, 0xb6, 0x78, 0xf8, 0x8c, 0x2a, 0xd5, 0x01, 0xdc, 0x6f, 0x8a, 0x1a, 0xe3, 0x8d, 0xab, 0xff, 0xd0, 0xf0, 0xec, 0xe9, 0x15, 0xb5, 0xb9, 0x5a, 0x7c, 0x4c, 0xa2, 0x9e, 0x24, 0xf5, 0xca, 0xc6, 0xe5, 0x99, 0xd9, 0x34, 0x99, 0x04, 0x3a, 0x7d, 0xb5, 0xba, 0xd5, 0x51, 0x63, 0x0e, 0xc7, 0xc5, 0x9b, 0x73, 0xf8, 0xe4, 0x6f, 0x76, 0xca, 0xd9, 0xda, 0x54, 0x6d, 0x72, 0x2e, 0x1a, 0x57, 0x11, 0x44, 0x40, 0x0d, 0x27, 0x7a, 0x0f, 0xd9, 0x5f, 0x12, 0x69, 0x4c, 0x84, 0xcd, 0x36, 0xe3, 0x85, 0xb2, 0xcd, 0x2f, 0x4a, 0x8b, 0x58, 0x36, 0xf6, 0x76, 0xa8, 0x64, 0x64, 0x3c, 0xa4, 0x93, 0xaa, 0x25, 0x3c, 0x49, 0xda, 0xa4, 0xe5, 0x26, 0x54, 0xe4, 0x8c, 0x7c, 0x5c, 0x93, 0x4d, 0x67, 0xc9, 0x3a, 0x6e, 0x9f, 0x13, 0xb4, 0xce, 0xf7, 0x3a, 0x9b, 0xad, 0x52, 0xd6, 0x2a, 0xd1, 0x49, 0xee, 0xc7, 0xf8, 0x64, 0x46, 0x42, 0x4e, 0xcd, 0x92, 0xc2, 0x00, 0xdd, 0x8a, 0x47, 0xe5, 0x69, 0x6e, 0xd4, 0xa4, 0x08, 0x16, 0x83, 0x9c, 0x8c, 0xdd, 0x95, 0x6b, 0xb9, 0xf6, 0xef, 0x97, 0x78, 0x94, 0xe3, 0x78, 0x04, 0xa4, 0xf3, 0xe8, 0xee, 0x64, 0xe1, 0x12, 0x10, 0x05, 0x6a, 0xc7, 0xc0, 0x6f, 0x53, 0xf3, 0xc9, 0x89, 0xb4, 0x9c, 0x4e, 0xb4, 0xf2, 0xd3, 0xde, 0x7a, 0xd2, 0x19, 0x16, 0x38, 0x61, 0x5d, 0xd9, 0x88, 0x05, 0x9c, 0xf4, 0x0a, 0x0f, 0x5f, 0x73, 0x84, 0xe4, 0xa4, 0xc7, 0x0d, 0xa5, 0xf1, 0x59, 0xba, 0x5c, 0x08, 0x98, 0x6f, 0xc8, 0x20, 0xfa, 0x4e, 0x4e, 0xf6, 0x69, 0xe1, 0xa2, 0x89, 0xfd, 0x1f, 0x77, 0x2c, 0xe6, 0xce, 0xd6, 0x17, 0x9a, 0x69, 0xdb, 0xd3, 0x86, 0x18, 0xc1, 0x67, 0x77, 0x26, 0x80, 0x28, 0x1b, 0x93, 0x88, 0x41, 0x0f, 0x40, 0xb0, 0xfc, 0x87, 0xf3, 0x43, 0x98, 0xd7, 0x58, 0x96, 0xdb, 0x4d, 0x91, 0x88, 0xe5, 0x6c, 0x58, 0xdc, 0x5c, 0x2a, 0xf7, 0x2c, 0xb1, 0xfc, 0x20, 0x8f, 0x02, 0xd9, 0x65, 0x06, 0xbe, 0x26, 0x6f, 0xa2, 0x7f, 0xce, 0x3d, 0x69, 0x26, 0xdd, 0x13, 0x52, 0xbf, 0xbd, 0x92, 0x62, 0x59, 0x4c, 0x90, 0xac, 0x50, 0x45, 0x5e, 0xbb, 0x09, 0x03, 0x12, 0x29, 0x84, 0x00, 0xc4, 0xc9, 0x11, 0xff, 0x00, 0x42, 0xe7, 0xa7, 0x7a, 0xd4, 0xfd, 0x21, 0x79, 0xe9, 0x78, 0x71, 0x8b, 0x95, 0x39, 0x75, 0xaf, 0x4e, 0x98, 0x78, 0x42, 0x38, 0xdf, 0xff, 0xd1, 0xf0, 0xe6, 0xa0, 0x58, 0xc8, 0x84, 0x9a, 0xaa, 0x30, 0x55, 0xf9, 0x0a, 0x6f, 0x90, 0x0c, 0xca, 0x72, 0x48, 0xb8, 0x1e, 0x89, 0xa7, 0x23, 0x17, 0x24, 0xff, 0x00, 0x61, 0xb6, 0x54, 0x76, 0x6e, 0x1b, 0xa7, 0xbe, 0x50, 0xf2, 0xc1, 0xd7, 0x4c, 0x52, 0x5e, 0x33, 0x5b, 0xe9, 0x10, 0xf4, 0x54, 0x3c, 0x5e, 0x77, 0xee, 0x49, 0xec, 0x2b, 0xb6, 0x63, 0xe4, 0xc9, 0xc3, 0xef, 0x73, 0xf0, 0xe1, 0x32, 0x1b, 0xf2, 0x7a, 0x05, 0xce, 0xad, 0x65, 0xa1, 0x98, 0xb4, 0x0f, 0x2a, 0x5b, 0x23, 0xeb, 0x12, 0x00, 0x88, 0xb0, 0xa8, 0x66, 0x46, 0x3d, 0xea, 0x7b, 0xfb, 0x9e, 0x99, 0x89, 0xbc, 0x8d, 0x97, 0x3a, 0x34, 0x05, 0x32, 0x5d, 0x1f, 0xc9, 0x1a, 0x8c, 0x36, 0x8c, 0x6f, 0x66, 0xfa, 0xc6, 0xb7, 0x7d, 0xf0, 0x94, 0x04, 0xf0, 0x88, 0xc9, 0xd5, 0x9d, 0x8d, 0x4b, 0x11, 0xd4, 0x9f, 0xbb, 0x25, 0xc5, 0xdc, 0xa2, 0x03, 0x99, 0x4b, 0xbc, 0xf3, 0x0d, 0x97, 0x96, 0x74, 0xe5, 0xf2, 0xb6, 0x80, 0x95, 0xbd, 0x99, 0x15, 0xf5, 0x4b, 0xd2, 0x37, 0x58, 0x46, 0xd4, 0x27, 0xc5, 0xce, 0xc1, 0x7c, 0x30, 0x8e, 0x68, 0x94, 0x7b, 0x9e, 0x6d, 0xe6, 0x7b, 0x9b, 0x5d, 0x3a, 0xd8, 0xdb, 0x32, 0xfa, 0x77, 0x65, 0x15, 0xe4, 0x57, 0xa7, 0x21, 0x55, 0x04, 0x57, 0xef, 0xd8, 0x66, 0x56, 0x38, 0x19, 0x1b, 0xe8, 0xe0, 0x67, 0x98, 0xc7, 0x1a, 0x1c, 0xde, 0x71, 0x71, 0x79, 0x2c, 0xf2, 0xfa, 0x8c, 0x48, 0xec, 0xb5, 0x24, 0x9a, 0x0c, 0xce, 0x75, 0x29, 0xae, 0x8c, 0x67, 0xd4, 0xb5, 0x0b, 0x4b, 0x04, 0x05, 0xef, 0x2e, 0x66, 0x8e, 0x18, 0x08, 0x15, 0xdd, 0x8f, 0x11, 0xb0, 0xeb, 0x4c, 0x04, 0x5b, 0x21, 0x2a, 0x7d, 0x41, 0xe4, 0x4f, 0xcb, 0xcb, 0x5d, 0x12, 0x45, 0xb8, 0xb7, 0x53, 0x71, 0xaa, 0x9f, 0x86, 0x5b, 0xd6, 0x50, 0x4a, 0xed, 0xba, 0x46, 0x77, 0x00, 0x13, 0xd4, 0x8c, 0x85, 0xd3, 0x12, 0x6d, 0xeb, 0x1a, 0x67, 0x95, 0xd9, 0x39, 0x39, 0x50, 0xac, 0xff, 0x00, 0x6f, 0xc4, 0xff, 0x00, 0x1c, 0x81, 0x92, 0xb2, 0x6b, 0x6d, 0x02, 0xdd, 0xbd, 0x36, 0x92, 0x36, 0x2d, 0x1f, 0xc0, 0x2a, 0x0b, 0x28, 0x1b, 0x91, 0x41, 0xf4, 0x9c, 0xb6, 0x25, 0x81, 0x46, 0xfe, 0x81, 0xb5, 0xad, 0x3d, 0xba, 0x57, 0xb7, 0xf9, 0xf6, 0xc9, 0xb0, 0x7f, 0xff, 0xd2, 0xf0, 0xe2, 0x86, 0x95, 0xc4, 0x67, 0x7e, 0x3f, 0x11, 0xf7, 0xa8, 0x19, 0x06, 0x69, 0x8d, 0xca, 0xca, 0x24, 0x8f, 0xd3, 0x52, 0x24, 0x89, 0x47, 0x25, 0x1f, 0xcb, 0x20, 0xf8, 0xb2, 0xb2, 0x76, 0x6e, 0x88, 0x36, 0xf6, 0x6f, 0x2a, 0xc1, 0x6e, 0xfa, 0x45, 0xad, 0xbc, 0x3f, 0x0b, 0x46, 0x81, 0x4d, 0x46, 0xea, 0x7a, 0x9a, 0x83, 0x9a, 0xa9, 0xdd, 0xbb, 0xec, 0x7b, 0x06, 0x5b, 0xe5, 0xcf, 0x2e, 0x69, 0xfa, 0x5c, 0xcd, 0x7b, 0x14, 0x5e, 0xa5, 0xee, 0xf5, 0xb8, 0x7d, 0xdd, 0x99, 0xba, 0xef, 0x91, 0x16, 0x5b, 0x36, 0xb6, 0x65, 0x0d, 0xac, 0xb2, 0x5b, 0xed, 0x34, 0x81, 0x7a, 0xbb, 0x46, 0x40, 0x6a, 0x9e, 0xb4, 0x39, 0x31, 0x13, 0x49, 0xda, 0xd2, 0x9b, 0xed, 0x1e, 0xc4, 0x24, 0xb3, 0x35, 0xb2, 0x88, 0x60, 0x06, 0xe6, 0x56, 0x98, 0x96, 0x79, 0x1e, 0x31, 0x51, 0xc9, 0x8f, 0xcb, 0x00, 0xe6, 0xb3, 0xe4, 0xf9, 0x2b, 0xcc, 0x7a, 0x94, 0xda, 0x96, 0xa9, 0x71, 0x77, 0x70, 0x79, 0xcd, 0x33, 0x97, 0x76, 0x3f, 0xcc, 0xc6, 0xa6, 0x9f, 0x2e, 0x99, 0xb9, 0xc6, 0x2a, 0x21, 0xe6, 0x73, 0xca, 0xe6, 0x4a, 0x51, 0x1a, 0x99, 0x1c, 0x28, 0x04, 0x93, 0xd0, 0x0e, 0xa4, 0xe4, 0xda, 0x5f, 0x50, 0xfe, 0x4a, 0xfe, 0x48, 0xb5, 0xb2, 0xc1, 0xe6, 0x1f, 0x31, 0x7e, 0xef, 0x52, 0x91, 0x43, 0xc3, 0x6e, 0x77, 0xf4, 0x22, 0x6d, 0xbf, 0xe4, 0x63, 0x0e, 0xbf, 0xca, 0x36, 0xeb, 0x5c, 0x84, 0xa5, 0x48, 0x7d, 0x3b, 0x61, 0xa1, 0xdb, 0x5b, 0x2c, 0x71, 0xda, 0x45, 0xc4, 0x28, 0x00, 0x81, 0xdb, 0x31, 0xc9, 0xb4, 0xb2, 0x3b, 0x5d, 0x27, 0xa5, 0x05, 0x1b, 0xc7, 0xdb, 0x10, 0xa9, 0xbd, 0xa6, 0x93, 0x0c, 0x75, 0xe4, 0x39, 0x35, 0x41, 0x3d, 0xc5, 0x06, 0xdb, 0x8e, 0xfd, 0x46, 0x5b, 0x1d, 0x98, 0x95, 0x4f, 0x46, 0xdb, 0xd5, 0xfb, 0x29, 0x5e, 0x9d, 0x0d, 0x32, 0xeb, 0x61, 0x4f, 0xff, 0xd3, 0xf1, 0x46, 0x9a, 0x16, 0x1b, 0x91, 0x71, 0x28, 0xac, 0x4a, 0x14, 0x30, 0x3e, 0x19, 0x54, 0xb9, 0x36, 0xc7, 0x9b, 0x2d, 0xd1, 0x6c, 0x45, 0xe3, 0xdc, 0xde, 0xc8, 0x95, 0x5b, 0x87, 0xf8, 0x41, 0x1d, 0x10, 0x54, 0x01, 0x98, 0x79, 0x25, 0xd1, 0xda, 0xe9, 0xe1, 0xb5, 0x9e, 0xac, 0xeb, 0x42, 0xba, 0x8e, 0xdf, 0x8c, 0x31, 0x21, 0x70, 0xb4, 0x5d, 0xbe, 0xc5, 0x7c, 0x2b, 0xed, 0xe1, 0x94, 0x18, 0xb9, 0x51, 0x3d, 0x03, 0x2c, 0x13, 0x6b, 0xf1, 0x42, 0x6e, 0xe2, 0xb7, 0x12, 0xa0, 0xdd, 0x50, 0x9f, 0x4f, 0x6f, 0xa7, 0x6f, 0xc7, 0x03, 0x61, 0xa0, 0x83, 0xb5, 0xf3, 0x97, 0x98, 0x20, 0x9c, 0x44, 0xea, 0xd0, 0xad, 0x48, 0x64, 0x90, 0x21, 0xd8, 0x9f, 0xa7, 0xa6, 0x44, 0xca, 0x99, 0xc6, 0x36, 0xcb, 0x74, 0x5d, 0x7e, 0x5b, 0xfe, 0x31, 0x6a, 0x31, 0xf3, 0x8c, 0xd0, 0xad, 0x40, 0xa3, 0x1f, 0x7c, 0x44, 0xd6, 0x51, 0xd9, 0xe0, 0x5f, 0x9a, 0x7e, 0x41, 0x9f, 0x40, 0xf3, 0x14, 0xba, 0x85, 0xba, 0x34, 0xba, 0x2d, 0xfb, 0x34, 0xd0, 0xcf, 0x4f, 0xb0, 0xce, 0x6a, 0x51, 0xe9, 0xb0, 0x20, 0xf4, 0xf1, 0x19, 0xb2, 0xc3, 0x90, 0x11, 0x4e, 0x97, 0x55, 0x80, 0x83, 0xc4, 0x17, 0x7e, 0x4c, 0x79, 0x19, 0xfc, 0xd1, 0xe7, 0x78, 0x4b, 0x91, 0x1d, 0xae, 0x92, 0xa6, 0xf6, 0x46, 0x75, 0xe4, 0xad, 0x22, 0x1f, 0xdd, 0xa1, 0x07, 0xb3, 0x1e, 0xfe, 0xd9, 0x92, 0xeb, 0x4b, 0xed, 0xfd, 0x0a, 0xc2, 0x63, 0x27, 0xa4, 0x88, 0x17, 0x60, 0x49, 0x35, 0xdc, 0x8e, 0xa5, 0x7d, 0xab, 0xd3, 0x28, 0x90, 0x50, 0xcd, 0xed, 0x2d, 0xda, 0x15, 0x55, 0x51, 0xf1, 0x1a, 0x0a, 0xf7, 0x39, 0x5d, 0xaa, 0x77, 0x6f, 0x01, 0x8e, 0xa7, 0x7d, 0xfa, 0xff, 0x00, 0x66, 0x10, 0xa8, 0xb8, 0x63, 0x76, 0x90, 0xa8, 0x20, 0x06, 0x56, 0xdb, 0x61, 0xda, 0xbd, 0x4f, 0xcb, 0x24, 0x15, 0x0f, 0xf5, 0x66, 0xe5, 0x5f, 0x4c, 0x53, 0xc3, 0xb7, 0xce, 0x99, 0x6b, 0x17, 0xff, 0xd4, 0xf0, 0xec, 0x57, 0x6f, 0x32, 0xa5, 0xa4, 0x43, 0x76, 0x75, 0xa9, 0xf1, 0x03, 0xfa, 0x64, 0x08, 0x6c, 0x8e, 0xfb, 0x3d, 0x7f, 0xcb, 0x16, 0x2b, 0x3d, 0xbc, 0x16, 0xa3, 0x66, 0x6d, 0x98, 0xfb, 0x1e, 0xb9, 0xac, 0xc8, 0x77, 0xb7, 0x7d, 0x01, 0xb3, 0x37, 0xb8, 0xd3, 0x46, 0x95, 0x68, 0x86, 0xd2, 0x2e, 0x4e, 0xab, 0xf0, 0x23, 0x11, 0x4e, 0x5f, 0xcd, 0x98, 0xe7, 0x25, 0x96, 0x71, 0x83, 0x0f, 0xd6, 0x3c, 0xb9, 0xe7, 0x0d, 0x7c, 0x41, 0x22, 0x5e, 0xb3, 0x20, 0x0c, 0x65, 0x80, 0xc8, 0x63, 0x8e, 0xbb, 0x95, 0xa5, 0x07, 0xeb, 0xcc, 0xac, 0x73, 0x83, 0x4e, 0x5c, 0x59, 0x09, 0xd8, 0xec, 0xc8, 0x57, 0x41, 0xd3, 0x4e, 0x95, 0xa5, 0x5b, 0x4b, 0x6a, 0xcb, 0xab, 0x43, 0x10, 0x4b, 0xeb, 0x85, 0xa2, 0x2c, 0x8e, 0x3f, 0x68, 0x54, 0xf5, 0x00, 0xd3, 0x97, 0x7a, 0x65, 0x79, 0xa6, 0x24, 0x76, 0x6f, 0xd3, 0x62, 0x96, 0x30, 0x78, 0xcb, 0x21, 0xf2, 0xf4, 0x22, 0xce, 0x54, 0x8e, 0x46, 0x26, 0x10, 0x7e, 0x0a, 0xf5, 0xd8, 0xf5, 0x1f, 0x31, 0x98, 0x83, 0x73, 0xb3, 0x91, 0xcd, 0x67, 0xe6, 0x7d, 0xe8, 0x16, 0x69, 0x6f, 0x10, 0x1f, 0x54, 0x9a, 0x37, 0xf5, 0x41, 0x5e, 0x7f, 0x0a, 0x29, 0x62, 0x02, 0xf8, 0x9c, 0xc8, 0x8c, 0x77, 0x6a, 0x99, 0xa0, 0x89, 0xff, 0x00, 0x9c, 0x74, 0xd2, 0xed, 0xed, 0xfc, 0xbb, 0x7b, 0xaa, 0x9a, 0x7d, 0x62, 0xfe, 0x46, 0x2d, 0xfe, 0x4c, 0x51, 0x31, 0x11, 0xa9, 0xf6, 0xef, 0x9b, 0x30, 0x5e, 0x7b, 0x38, 0xdd, 0xf4, 0x7f, 0x95, 0x94, 0xbc, 0x12, 0x43, 0x30, 0x6a, 0xb2, 0xf3, 0x86, 0x40, 0x3e, 0xcb, 0xd7, 0x6a, 0xd7, 0xb1, 0xe9, 0x8f, 0x37, 0x19, 0x97, 0x41, 0x2c, 0x71, 0x20, 0xf5, 0x36, 0x9c, 0x55, 0x78, 0x1d, 0x8a, 0x91, 0xd7, 0x11, 0x14, 0x5a, 0x3e, 0x19, 0x03, 0x10, 0x6b, 0xca, 0xbd, 0x86, 0xf8, 0x9d, 0x95, 0x18, 0x36, 0x65, 0x2e, 0xbc, 0x54, 0x1f, 0xa2, 0x99, 0x00, 0x59, 0x2a, 0x6f, 0x5e, 0x55, 0x15, 0xe9, 0x5f, 0xc3, 0x2f, 0xb6, 0x14, 0xff, 0x00, 0xff, 0xd5, 0xf1, 0x95, 0xfe, 0x80, 0x74, 0x0d, 0x7c, 0xd9, 0x89, 0x3d, 0x78, 0x57, 0x8b, 0xc5, 0x28, 0xe8, 0x55, 0xf7, 0x1f, 0x48, 0xca, 0x38, 0xb8, 0x83, 0x9f, 0x93, 0x07, 0x85, 0x3a, 0x7a, 0x6f, 0x95, 0x66, 0x2b, 0x2c, 0x4c, 0x0d, 0x14, 0x00, 0x3e, 0x9c, 0xc3, 0x98, 0x76, 0xb8, 0x45, 0xbd, 0x02, 0xde, 0x48, 0xee, 0xdc, 0xa0, 0x15, 0xe2, 0x2b, 0xc8, 0x8a, 0x8a, 0xfd, 0x3b, 0x66, 0x3f, 0x00, 0x73, 0x84, 0x2d, 0x36, 0xb5, 0xb5, 0x9e, 0x35, 0x1c, 0x29, 0xc4, 0xfe, 0xc8, 0x04, 0x7f, 0xc4, 0x69, 0x91, 0xe1, 0x67, 0x2c, 0x4a, 0xd2, 0xe9, 0x4e, 0xe3, 0xd4, 0xf4, 0x81, 0x5a, 0x12, 0xc5, 0x41, 0x3f, 0x79, 0x38, 0x9b, 0x60, 0x20, 0x07, 0x34, 0xb0, 0xc9, 0x03, 0x5c, 0x23, 0x03, 0x53, 0x13, 0x56, 0x88, 0xdf, 0x09, 0xda, 0x9b, 0xd3, 0xb6, 0x52, 0x0e, 0xec, 0xe4, 0x29, 0x24, 0xfc, 0xd0, 0xe7, 0x75, 0xe5, 0x57, 0x6b, 0x61, 0xfb, 0xf0, 0xca, 0xaa, 0x57, 0xa8, 0xe6, 0x78, 0x1a, 0x7d, 0xf9, 0x95, 0x8a, 0x5e, 0xa0, 0xe3, 0x67, 0x8f, 0xa0, 0xbd, 0x5b, 0xf2, 0xdf, 0x4a, 0x82, 0xcb, 0x4a, 0xb3, 0xb0, 0xb4, 0x41, 0x0a, 0x70, 0x48, 0xd9, 0x57, 0x60, 0x51, 0x3a, 0x8f, 0xbc, 0xe6, 0x7b, 0xcb, 0xe4, 0x3b, 0xa7, 0x3f, 0x9b, 0x9f, 0x9a, 0xba, 0x77, 0xe5, 0x5f, 0x95, 0x9c, 0x59, 0x94, 0x9f, 0xcd, 0x37, 0x8c, 0xa9, 0xa6, 0xd9, 0x39, 0xaa, 0xd0, 0x7d, 0xa9, 0x1c, 0x03, 0x5e, 0x09, 0xff, 0x00, 0x0c, 0x76, 0xcb, 0x62, 0x2d, 0xa5, 0xf2, 0x85, 0xbf, 0xe7, 0x87, 0xe6, 0xa3, 0x5e, 0x4d, 0xa8, 0xc9, 0xe6, 0x8b, 0xd5, 0x69, 0x5c, 0xb0, 0x4a, 0xab, 0xc4, 0xb5, 0x35, 0x0a, 0xaa, 0xea, 0x40, 0x03, 0xa0, 0xf6, 0xcb, 0x40, 0x4d, 0x3e, 0xdb, 0xff, 0x00, 0x9c, 0x7f, 0xfc, 0xce, 0x4f, 0xcc, 0xbf, 0x26, 0x25, 0xe5, 0xd3, 0x2f, 0xe9, 0xdd, 0x3d, 0xfe, 0xab, 0xa9, 0xaa, 0xd2, 0xa6, 0x40, 0x2a, 0xb2, 0x71, 0x00, 0x01, 0xea, 0x0d, 0xe8, 0x3a, 0x64, 0x25, 0x16, 0x1c, 0x8b, 0xd9, 0x51, 0x39, 0x28, 0x12, 0x51, 0x41, 0xfd, 0xa3, 0xd2, 0xb9, 0x4f, 0x0d, 0x33, 0xb5, 0xf4, 0x87, 0x9d, 0x79, 0x0e, 0xb4, 0xaf, 0x6a, 0xf8, 0xf1, 0xf0, 0xc9, 0xda, 0xbf, 0xff, 0xd6, 0xf2, 0xc6, 0xb5, 0x68, 0x64, 0xd0, 0x6d, 0x35, 0x20, 0x39, 0xcd, 0x13, 0x0f, 0x5e, 0x61, 0xfc, 0x8f, 0x40, 0x8b, 0x5e, 0xe0, 0x66, 0x1c, 0x4f, 0xaa, 0x9d, 0xe6, 0xa6, 0x1e, 0x91, 0x2e, 0xa9, 0x87, 0x95, 0xee, 0x9c, 0xc5, 0x55, 0x34, 0x60, 0x40, 0xae, 0x57, 0x30, 0xd9, 0xa7, 0x95, 0xbd, 0x6f, 0xcb, 0x26, 0x39, 0x40, 0x0d, 0x4e, 0xc0, 0x9f, 0x9e, 0x50, 0x5d, 0xac, 0x79, 0x33, 0x8b, 0xbb, 0x9b, 0x3b, 0x6b, 0x35, 0x48, 0x54, 0x09, 0x29, 0x56, 0x7f, 0xe1, 0x86, 0x72, 0x00, 0x2c, 0x6e, 0xf7, 0x63, 0x3e, 0x63, 0xbd, 0xbd, 0x5d, 0x20, 0x2a, 0xb3, 0xa4, 0x33, 0x48, 0xab, 0x21, 0x43, 0xf1, 0x2c, 0x47, 0xed, 0x1d, 0xbc, 0x73, 0x18, 0x9b, 0x64, 0x28, 0x96, 0x3a, 0xc7, 0x49, 0xb0, 0xf4, 0xcc, 0xe9, 0x73, 0x6c, 0xb4, 0xf8, 0x67, 0x92, 0x32, 0x21, 0x70, 0x7b, 0x89, 0x05, 0x57, 0xef, 0x38, 0x28, 0x94, 0x4a, 0x7d, 0x13, 0x7d, 0x6a, 0xd3, 0x4c, 0xb8, 0xf2, 0xc3, 0xc8, 0x2e, 0x03, 0xf3, 0xe2, 0x7d, 0x33, 0xb7, 0xc5, 0xcc, 0x71, 0x03, 0xc6, 0xb9, 0x64, 0x06, 0xe2, 0x9a, 0xf2, 0x4f, 0xd2, 0x6d, 0xe9, 0xfe, 0x41, 0x45, 0x5b, 0x18, 0x66, 0xa5, 0x64, 0x09, 0xf4, 0xd5, 0xb7, 0xcd, 0x93, 0xc7, 0xcf, 0x9b, 0xe5, 0x6f, 0xf9, 0xc8, 0x0d, 0x56, 0xeb, 0x59, 0xfc, 0xce, 0xd5, 0x12, 0x61, 0xc4, 0x69, 0xe9, 0x0d, 0xa4, 0x4b, 0xfe, 0x48, 0x40, 0xd5, 0x3e, 0xe4, 0xb6, 0x64, 0x8e, 0x4c, 0x02, 0x61, 0x65, 0xa0, 0x14, 0xb4, 0xb6, 0xb0, 0xb1, 0xb6, 0xb2, 0x97, 0xcb, 0xf1, 0x5a, 0x2d, 0xc6, 0xa5, 0xac, 0xb4, 0x70, 0x5d, 0xc7, 0x3d, 0xc1, 0x51, 0x24, 0x91, 0xc9, 0x31, 0x75, 0x6b, 0x70, 0x9f, 0x14, 0x68, 0x01, 0x46, 0xe4, 0xb5, 0xa3, 0x17, 0xcb, 0x40, 0x61, 0x6f, 0x47, 0xff, 0x00, 0x9c, 0x3a, 0x8f, 0x5b, 0x4f, 0x3c, 0x6b, 0xb7, 0xfa, 0x30, 0x91, 0x3c, 0xa4, 0xb1, 0x95, 0xb9, 0x82, 0x42, 0x0a, 0xbc, 0x8e, 0xe4, 0xdb, 0xa9, 0xef, 0xc9, 0x17, 0x91, 0x24, 0x7c, 0xb2, 0x05, 0x64, 0xfb, 0x75, 0x64, 0x32, 0x39, 0x69, 0x5b, 0x9c, 0xad, 0xb9, 0xdb, 0xa7, 0xb5, 0x3b, 0x53, 0x2a, 0x21, 0x41, 0x44, 0xf3, 0x8b, 0x8f, 0x2e, 0x43, 0x9d, 0x2b, 0xd4, 0x57, 0x23, 0x41, 0x36, 0xff, 0x00, 0xff, 0xd7, 0xf0, 0xc0, 0xd5, 0xb5, 0x11, 0x64, 0xb6, 0x3f, 0x59, 0x90, 0xd9, 0xab, 0x06, 0xf4, 0x79, 0x7c, 0x3b, 0x74, 0xc8, 0x08, 0x8b, 0xb6, 0xe3, 0x96, 0x55, 0x57, 0xb3, 0x3e, 0xf2, 0x35, 0xc7, 0xd6, 0x0b, 0x45, 0x5d, 0xdc, 0x8a, 0x7d, 0xd9, 0x8d, 0x94, 0x3b, 0x3d, 0x1c, 0x9e, 0xc3, 0xe5, 0xc3, 0x2c, 0x7c, 0xc5, 0x0f, 0xee, 0xdb, 0x8b, 0x0c, 0xc4, 0x26, 0x9d, 0xa0, 0x9a, 0x7d, 0x2c, 0xe5, 0xe4, 0x55, 0x7f, 0xee, 0xc1, 0x15, 0x04, 0xd0, 0x12, 0x3c, 0x72, 0x89, 0x1b, 0x2c, 0xcc, 0xa8, 0x2a, 0x8b, 0x87, 0xbb, 0x63, 0x1a, 0x28, 0x65, 0xf0, 0xed, 0xf2, 0xc3, 0xc2, 0x0a, 0x06, 0x4a, 0x46, 0xc7, 0xa5, 0xa3, 0x59, 0xc8, 0xb2, 0xc7, 0x45, 0x22, 0x9c, 0x14, 0x54, 0x10, 0x46, 0xf5, 0x1d, 0x32, 0x5c, 0x14, 0x14, 0xe4, 0x32, 0x2f, 0x3a, 0xf3, 0xb6, 0x90, 0x9a, 0x6d, 0xae, 0x9f, 0x3d, 0xab, 0xb8, 0x8a, 0x3b, 0xf8, 0x39, 0x44, 0x58, 0xf0, 0x08, 0xd5, 0x14, 0xa5, 0x7b, 0x65, 0x98, 0x8e, 0xfb, 0xb5, 0x67, 0x87, 0xa5, 0xef, 0x5e, 0x44, 0x96, 0x35, 0xb5, 0xb6, 0x59, 0x36, 0xfd, 0xd8, 0xa0, 0xf1, 0x20, 0x53, 0x33, 0xc0, 0x79, 0x59, 0x73, 0x7c, 0xd7, 0xf9, 0xfb, 0xa2, 0xcd, 0x67, 0xf9, 0xa7, 0x7b, 0x72, 0xf1, 0x71, 0x83, 0x53, 0x86, 0x0b, 0x98, 0x24, 0x22, 0x8a, 0xcc, 0x88, 0x23, 0x7f, 0xb8, 0xae, 0xf9, 0x7c, 0x50, 0x1e, 0x5f, 0x7c, 0x48, 0x21, 0x44, 0x6b, 0xce, 0x9b, 0xb0, 0x1b, 0x9e, 0xf5, 0xaf, 0x8e, 0x4d, 0x5f, 0x7a, 0x7f, 0xce, 0x34, 0xf9, 0x5d, 0x3c, 0xa3, 0xf9, 0x69, 0x63, 0xa9, 0x3c, 0x27, 0xeb, 0xda, 0xe1, 0x37, 0xd7, 0x2e, 0xaa, 0xdb, 0x06, 0xda, 0x30, 0x49, 0xfe, 0x54, 0x03, 0x03, 0x49, 0xdc, 0xb3, 0xaf, 0x38, 0xfe, 0x6a, 0xf9, 0x47, 0xc9, 0x3a, 0x74, 0x97, 0xfa, 0xf6, 0xaf, 0x15, 0x85, 0xb8, 0x75, 0x89, 0xb8, 0x87, 0x9a, 0x72, 0xee, 0x2a, 0x14, 0x24, 0x60, 0xb1, 0xa8, 0xdf, 0x07, 0x0b, 0x2d, 0xcb, 0xcf, 0x7f, 0xe8, 0x6a, 0xff, 0x00, 0x26, 0xbd, 0x6a, 0x7f, 0x89, 0x2f, 0xf8, 0x52, 0x9e, 0xb7, 0xe8, 0xb9, 0xb8, 0x57, 0xc2, 0x95, 0xe9, 0x8f, 0x08, 0x5a, 0x2f, 0xff, 0xd0, 0xf0, 0x4d, 0x40, 0xaa, 0xd7, 0x00, 0x64, 0xcb, 0x3c, 0x97, 0xa8, 0xb5, 0x9e, 0xa3, 0x1a, 0xd6, 0x84, 0x95, 0x3f, 0x45, 0x72, 0x9c, 0xa2, 0xc3, 0x99, 0xa5, 0x9d, 0x49, 0xf4, 0x17, 0x97, 0xaf, 0x63, 0x17, 0x52, 0x6f, 0xf0, 0xc8, 0x43, 0x6f, 0x9a, 0xe9, 0x07, 0x70, 0x0e, 0xec, 0x83, 0x51, 0x44, 0xb8, 0x61, 0x1a, 0x9e, 0x11, 0xd3, 0x91, 0x60, 0x68, 0x6b, 0xd3, 0x31, 0x4f, 0x36, 0xd3, 0x4c, 0x52, 0xef, 0x4c, 0xd5, 0x0c, 0xc4, 0x69, 0xda, 0x94, 0xc8, 0x3a, 0xf0, 0x66, 0x07, 0x73, 0xe0, 0x40, 0xfd, 0x79, 0x93, 0x12, 0x1c, 0x9c, 0x32, 0xc7, 0xfc, 0x41, 0x33, 0xd2, 0xb4, 0x6f, 0x38, 0x98, 0x65, 0x76, 0xbf, 0x69, 0x42, 0xd0, 0xaa, 0xc9, 0xde, 0x95, 0xad, 0x28, 0x46, 0x4e, 0xac, 0x39, 0x77, 0x80, 0x11, 0xbf, 0xd8, 0xc7, 0x7c, 0xe1, 0xa5, 0xf9, 0x92, 0x4d, 0x32, 0x5b, 0x8b, 0x93, 0x27, 0xa7, 0x68, 0x56, 0xe2, 0x45, 0xda, 0x85, 0x61, 0x6e, 0x67, 0xad, 0x6b, 0xb0, 0x38, 0xc2, 0x81, 0xe4, 0xc7, 0x52, 0x31, 0x1c, 0x67, 0x86, 0x5b, 0xbd, 0x37, 0xca, 0x7a, 0x94, 0xb1, 0x69, 0xb6, 0x2e, 0xb7, 0x15, 0x48, 0xc2, 0xb4, 0x52, 0x53, 0xac, 0x32, 0xaf, 0xb1, 0xed, 0x9b, 0x10, 0x36, 0x78, 0x5c, 0x9f, 0x51, 0x64, 0x1f, 0x98, 0x3e, 0x58, 0xb6, 0xfc, 0xc8, 0xf2, 0xe5, 0xbc, 0x68, 0x52, 0x2d, 0x5a, 0xd1, 0x84, 0xb6, 0xf3, 0x95, 0x0e, 0xc0, 0x85, 0xe2, 0xcb, 0xd8, 0xd1, 0xbb, 0xe4, 0xc1, 0xa6, 0x97, 0xce, 0x17, 0x5f, 0x95, 0xde, 0x6d, 0xb6, 0xbe, 0xb7, 0x69, 0x34, 0xf3, 0x3c, 0x72, 0xcf, 0xe8, 0xa3, 0x45, 0x49, 0x95, 0x4a, 0x90, 0x3e, 0x35, 0x5a, 0x95, 0x1d, 0xfe, 0x21, 0x93, 0x4d, 0xbe, 0xd2, 0xd2, 0xf5, 0x8b, 0xbd, 0x32, 0x2d, 0x3f, 0x4c, 0x9a, 0xe4, 0xca, 0x9e, 0x90, 0x85, 0x65, 0x55, 0x08, 0x85, 0x91, 0x01, 0x3b, 0x0a, 0x05, 0xe9, 0xb0, 0xc0, 0x5a, 0xc3, 0xcd, 0x3f, 0x3b, 0x7f, 0x26, 0xec, 0xff, 0x00, 0x35, 0x6d, 0x6d, 0xb5, 0x3d, 0x16, 0xfe, 0x0d, 0x3b, 0xcd, 0x96, 0x01, 0x92, 0x46, 0x9e, 0xa2, 0x0b, 0xc8, 0xb7, 0x28, 0x92, 0x71, 0xfb, 0x2e, 0xa7, 0xec, 0x3d, 0x0f, 0xc2, 0x68, 0x71, 0x05, 0x95, 0xd3, 0xe7, 0x9f, 0xfa, 0x16, 0x2f, 0xcd, 0x7f, 0x43, 0xd6, 0xfa, 0xa5, 0x97, 0xab, 0xeb, 0x7a, 0x5f, 0x55, 0xfa, 0xec, 0x5e, 0xaf, 0x0f, 0xf7, 0xed, 0x2b, 0x4e, 0x15, 0xff, 0x00, 0x65, 0xdf, 0x8e, 0x14, 0xf1, 0xbf, 0xff, 0xd1, 0xf0, 0x5a, 0xa7, 0x18, 0x5e, 0x56, 0x1f, 0x68, 0x71, 0x5f, 0xa7, 0xbe, 0x2a, 0x98, 0xdb, 0xfa, 0x90, 0x24, 0x37, 0xb0, 0xfd, 0xb8, 0xa8, 0x58, 0x78, 0xae, 0x43, 0xc9, 0xb4, 0x6d, 0xbb, 0xda, 0x3c, 0xa1, 0xad, 0x43, 0xa8, 0xda, 0xc5, 0x2a, 0x3d, 0x26, 0x5a, 0x02, 0x2b, 0xbe, 0x60, 0x64, 0x8d, 0x17, 0x6f, 0x8b, 0x20, 0x90, 0x7a, 0x3c, 0x32, 0x8b, 0xa8, 0x02, 0xf3, 0xfd, 0xe0, 0x1b, 0x11, 0x98, 0x66, 0x3b, 0xb9, 0x62, 0x54, 0x83, 0x36, 0xf2, 0xa4, 0xe4, 0x29, 0x34, 0xeb, 0xc8, 0x74, 0xae, 0x0d, 0xc3, 0x65, 0x82, 0x13, 0x6b, 0x57, 0xba, 0x54, 0xe4, 0x8c, 0x41, 0x1b, 0x75, 0xa7, 0xe0, 0x72, 0x5c, 0x4c, 0x84, 0x50, 0x5a, 0xb3, 0xdd, 0xdd, 0xc3, 0x24, 0x33, 0xb1, 0x60, 0xe0, 0x86, 0x52, 0x45, 0x38, 0xd2, 0x87, 0x24, 0x26, 0x6d, 0x8c, 0xe1, 0x41, 0x25, 0xfc, 0xa3, 0xd7, 0x2f, 0x6f, 0x3c, 0xbf, 0x73, 0xa5, 0xb2, 0x2c, 0xd1, 0x69, 0x17, 0x2f, 0x6b, 0x14, 0x8c, 0x0f, 0x21, 0x0d, 0x79, 0x46, 0x09, 0x15, 0xed, 0xb7, 0x4e, 0xd9, 0xb9, 0x8b, 0xcb, 0xe4, 0xa2, 0x5e, 0xa3, 0xa6, 0xdf, 0x6a, 0x36, 0xe4, 0xcd, 0x69, 0x1c, 0x4e, 0x84, 0x7c, 0x76, 0xab, 0x21, 0x67, 0xa8, 0xa7, 0xd9, 0xf8, 0x4d, 0x2b, 0xf3, 0xc3, 0x4d, 0x49, 0x57, 0x98, 0x75, 0x6f, 0x31, 0xda, 0xf9, 0xa3, 0x4b, 0xfd, 0x1f, 0x69, 0x1d, 0xae, 0xa1, 0xa9, 0x7e, 0xee, 0xe6, 0xd2, 0x79, 0x18, 0xf3, 0xb5, 0x1f, 0xee, 0xd9, 0x0a, 0x01, 0x4e, 0x3f, 0xb3, 0x4d, 0xf2, 0x9c, 0xb9, 0x04, 0x05, 0xb7, 0xe2, 0x87, 0x1e, 0xdd, 0x19, 0x3e, 0xaf, 0x6b, 0xae, 0xcb, 0x6d, 0x13, 0x0d, 0x45, 0xa2, 0x8e, 0x06, 0xe5, 0x13, 0x2a, 0x02, 0x01, 0x5e, 0x82, 0xb5, 0x04, 0xe6, 0x11, 0xd4, 0xcd, 0xda, 0x43, 0x49, 0x8e, 0xb7, 0xdc, 0xb1, 0x51, 0xe6, 0x4d, 0x76, 0xd2, 0x61, 0x15, 0xaa, 0x4b, 0xa8, 0xc9, 0x6e, 0x49, 0x79, 0x20, 0xe6, 0x8c, 0x49, 0xad, 0x43, 0x16, 0xe4, 0xa7, 0xaf, 0x43, 0xd3, 0x26, 0x35, 0x75, 0xcd, 0xa8, 0xe8, 0x87, 0x46, 0xbf, 0xc7, 0x9a, 0xff, 0x00, 0xd6, 0xbf, 0x48, 0xfe, 0x88, 0xfd, 0xe7, 0x0f, 0xab, 0xfa, 0x3f, 0x58, 0x7f, 0x5f, 0x8d, 0x3f, 0x9f, 0xa7, 0x5e, 0xd4, 0xc3, 0xf9, 0xd1, 0x7c, 0xb6, 0x47, 0xe4, 0x3a, 0x5b, 0xff, 0xd2, 0xf0, 0xb7, 0xa6, 0x1e, 0xdf, 0xd3, 0xf6, 0xa5, 0x71, 0x54, 0xdb, 0x4b, 0x80, 0x3c, 0x42, 0x26, 0xee, 0x29, 0xbe, 0x51, 0x23, 0x4e, 0x44, 0x05, 0x84, 0x45, 0xa5, 0xd5, 0xf7, 0x97, 0x2e, 0xfd, 0x6b, 0x6a, 0x98, 0x09, 0xab, 0xc7, 0xfc, 0x46, 0x3b, 0x4c, 0x26, 0x32, 0x30, 0x3e, 0x4f, 0x49, 0xd0, 0xfc, 0xfb, 0x05, 0xd4, 0x4a, 0x7d, 0x40, 0xac, 0x3a, 0x8e, 0x84, 0x1c, 0xc5, 0x96, 0x2a, 0x73, 0xe1, 0x9c, 0x16, 0x6d, 0xa5, 0x79, 0x86, 0xd6, 0xec, 0x80, 0x5a, 0xa0, 0xf5, 0xca, 0xcc, 0x5c, 0xa1, 0x2b, 0x1b, 0x26, 0x30, 0x6a, 0x31, 0x46, 0xcf, 0x1c, 0x87, 0x94, 0x64, 0x9e, 0x3d, 0xb6, 0xf0, 0xca, 0xa8, 0x39, 0x51, 0x99, 0x42, 0x6b, 0x1a, 0xc5, 0xa5, 0xa5, 0x94, 0xf7, 0x92, 0xc8, 0xaa, 0xb1, 0x23, 0x30, 0x04, 0xf8, 0x0e, 0x9f, 0x4e, 0x4a, 0x11, 0xb2, 0xd5, 0x9b, 0x25, 0x06, 0x1b, 0xff, 0x00, 0x38, 0xfd, 0xad, 0xdf, 0xda, 0xf9, 0xa2, 0xfe, 0xc5, 0x42, 0xbe, 0x9b, 0x7f, 0x0b, 0xdd, 0xdd, 0x07, 0xaf, 0x14, 0x68, 0xd8, 0x71, 0x6d, 0xbb, 0x90, 0xfc, 0x73, 0x6e, 0xf2, 0xf2, 0xdd, 0xf4, 0xad, 0xa6, 0xab, 0x6d, 0x69, 0x14, 0xfa, 0xee, 0xa0, 0xe2, 0x0b, 0x0d, 0x39, 0x19, 0xfe, 0x11, 0xc5, 0x1a, 0x4a, 0x1d, 0x8f, 0x73, 0x4f, 0xf8, 0x96, 0x0b, 0x40, 0x8d, 0xec, 0xf3, 0x6d, 0x3f, 0x52, 0xba, 0xd6, 0x35, 0x8b, 0xbf, 0x36, 0x6a, 0x5f, 0x0d, 0xc5, 0xdc, 0xa8, 0xb6, 0xa8, 0x7a, 0xc5, 0x6c, 0x9b, 0x22, 0x0f, 0xa3, 0x73, 0x9a, 0xbc, 0xb3, 0xe2, 0x36, 0xed, 0xb1, 0x43, 0x80, 0x53, 0xd0, 0xa7, 0xd4, 0x44, 0xfa, 0x7a, 0xda, 0x83, 0xbd, 0x3e, 0x2f, 0xa7, 0x2b, 0xad, 0x9b, 0xb8, 0x8d, 0xa8, 0xe8, 0x91, 0xdb, 0xfa, 0x2d, 0x6f, 0xc3, 0x8a, 0x2d, 0x56, 0xa3, 0xad, 0x4f, 0x5c, 0xa4, 0x0d, 0xdc, 0xa3, 0xca, 0xd0, 0xbf, 0xa1, 0xe3, 0xfa, 0xe7, 0x0f, 0xf2, 0xb9, 0x57, 0xbf, 0x1a, 0xe4, 0xb8, 0x57, 0xc5, 0xdd, 0xff, 0xd3, 0xf0, 0xcc, 0x5d, 0x7b, 0x70, 0xc5, 0x53, 0x6d, 0x2f, 0xd5, 0xe4, 0x69, 0xfd, 0xdf, 0xec, 0xd7, 0xad, 0x7d, 0xb2, 0x8c, 0x8d, 0xd8, 0xed, 0x91, 0x9f, 0x43, 0xea, 0xe7, 0xeb, 0x94, 0xad, 0x3e, 0x1e, 0x95, 0xfc, 0x72, 0x81, 0x7d, 0x1c, 0x9d, 0xba, 0xb1, 0x7b, 0xdf, 0xa9, 0x7a, 0xdf, 0xee, 0x2f, 0xd4, 0xfa, 0xe7, 0xed, 0x7a, 0x7f, 0xdd, 0xff, 0x00, 0xb2, 0xae, 0x64, 0x0b, 0xea, 0xe3, 0x9a, 0xbf, 0x4a, 0x6f, 0xa4, 0xff, 0x00, 0x89, 0xbd, 0x45, 0xfa, 0xb5, 0x79, 0xf7, 0xeb, 0xc7, 0xe9, 0xae, 0x57, 0x2e, 0x17, 0x23, 0x1f, 0x89, 0xd1, 0x99, 0x8f, 0xf1, 0xa7, 0x11, 0xcf, 0xd3, 0xf5, 0x29, 0xb5, 0x6b, 0xd3, 0xe8, 0xcc, 0x7f, 0x45, 0xb9, 0xa3, 0xc5, 0x62, 0xbe, 0x68, 0xff, 0x00, 0x15, 0xfd, 0x4c, 0xfe, 0x90, 0xaf, 0xd4, 0xab, 0xf1, 0x7a, 0x7f, 0x62, 0x9d, 0xab, 0xdf, 0x32, 0xb1, 0x70, 0x5e, 0xdc, 0xdc, 0x2d, 0x47, 0x8b, 0x5e, 0xae, 0x4c, 0xbf, 0xf2, 0x37, 0x9f, 0x3d, 0x5b, 0xd2, 0xff, 0x00, 0x8e, 0x87, 0xee, 0x29, 0x5a, 0xf2, 0xf4, 0xaa, 0xd4, 0xa5, 0x36, 0xa7, 0x3a, 0x57, 0xfd, 0x8e, 0x64, 0x3a, 0xf2, 0xf6, 0xbf, 0xcc, 0x7f, 0x5b, 0xfc, 0x23, 0xa7, 0xfe, 0x8e, 0xff, 0x00, 0x8e, 0x37, 0xd6, 0x63, 0xfa, 0xe5, 0x2b, 0xcb, 0x87, 0xec, 0xd6, 0xbd, 0xb9, 0x7d, 0xac, 0xc7, 0xcd, 0x7c, 0x2d, 0xf8, 0x2b, 0x89, 0x26, 0x8f, 0xd4, 0xfa, 0x94, 0x3e, 0x85, 0x29, 0xc9, 0x69, 0xfc, 0x33, 0x58, 0x5d, 0x9c, 0x79, 0xb2, 0xbb, 0x0f, 0xac, 0x7a, 0x2b, 0xea, 0x75, 0xef, 0x92, 0x0c, 0x53, 0x3d, 0x2f, 0xd4, 0xfa, 0xbb, 0xfa, 0x74, 0xf5, 0x39, 0x9a, 0xd7, 0xe7, 0x80, 0x53, 0x79, 0xba, 0x5b, 0xfe, 0x97, 0xfa, 0x4b, 0xfc, 0xba, 0x7f, 0xb1, 0xc7, 0xab, 0x1e, 0x8f, 0xff, 0xd9 -}; diff --git a/include/webrtc/base/testclient.h b/include/webrtc/base/testclient.h deleted file mode 100644 index 5d8ee98..0000000 --- a/include/webrtc/base/testclient.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TESTCLIENT_H_ -#define WEBRTC_BASE_TESTCLIENT_H_ - -#include -#include "webrtc/base/asyncudpsocket.h" -#include "webrtc/base/criticalsection.h" - -namespace rtc { - -// A simple client that can send TCP or UDP data and check that it receives -// what it expects to receive. Useful for testing server functionality. -class TestClient : public sigslot::has_slots<> { - public: - // Records the contents of a packet that was received. - struct Packet { - Packet(const SocketAddress& a, const char* b, size_t s); - Packet(const Packet& p); - virtual ~Packet(); - - SocketAddress addr; - char* buf; - size_t size; - }; - - // Default timeout for NextPacket reads. - static const int kTimeoutMs = 5000; - - // Creates a client that will send and receive with the given socket and - // will post itself messages with the given thread. - explicit TestClient(AsyncPacketSocket* socket); - ~TestClient() override; - - SocketAddress address() const { return socket_->GetLocalAddress(); } - SocketAddress remote_address() const { return socket_->GetRemoteAddress(); } - - // Checks that the socket moves to the specified connect state. - bool CheckConnState(AsyncPacketSocket::State state); - - // Checks that the socket is connected to the remote side. - bool CheckConnected() { - return CheckConnState(AsyncPacketSocket::STATE_CONNECTED); - } - - // Sends using the clients socket. - int Send(const char* buf, size_t size); - - // Sends using the clients socket to the given destination. - int SendTo(const char* buf, size_t size, const SocketAddress& dest); - - // Returns the next packet received by the client or 0 if none is received - // within the specified timeout. The caller must delete the packet - // when done with it. - Packet* NextPacket(int timeout_ms); - - // Checks that the next packet has the given contents. Returns the remote - // address that the packet was sent from. - bool CheckNextPacket(const char* buf, size_t len, SocketAddress* addr); - - // Checks that no packets have arrived or will arrive in the next second. - bool CheckNoPacket(); - - int GetError(); - int SetOption(Socket::Option opt, int value); - - bool ready_to_send() const; - - private: - // Timeout for reads when no packet is expected. - static const int kNoPacketTimeoutMs = 1000; - // Workaround for the fact that AsyncPacketSocket::GetConnState doesn't exist. - Socket::ConnState GetState(); - // Slot for packets read on the socket. - void OnPacket(AsyncPacketSocket* socket, const char* buf, size_t len, - const SocketAddress& remote_addr, - const PacketTime& packet_time); - void OnReadyToSend(AsyncPacketSocket* socket); - - CriticalSection crit_; - AsyncPacketSocket* socket_; - std::vector* packets_; - bool ready_to_send_; - RTC_DISALLOW_COPY_AND_ASSIGN(TestClient); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_TESTCLIENT_H_ diff --git a/include/webrtc/base/testechoserver.h b/include/webrtc/base/testechoserver.h deleted file mode 100644 index 51d7d53..0000000 --- a/include/webrtc/base/testechoserver.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TESTECHOSERVER_H_ -#define WEBRTC_BASE_TESTECHOSERVER_H_ - -#include -#include "webrtc/base/asynctcpsocket.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" - -namespace rtc { - -// A test echo server, echoes back any packets sent to it. -// Useful for unit tests. -class TestEchoServer : public sigslot::has_slots<> { - public: - TestEchoServer(Thread* thread, const SocketAddress& addr) - : server_socket_(thread->socketserver()->CreateAsyncSocket(addr.family(), - SOCK_STREAM)) { - server_socket_->Bind(addr); - server_socket_->Listen(5); - server_socket_->SignalReadEvent.connect(this, &TestEchoServer::OnAccept); - } - ~TestEchoServer() { - for (ClientList::iterator it = client_sockets_.begin(); - it != client_sockets_.end(); ++it) { - delete *it; - } - } - - SocketAddress address() const { return server_socket_->GetLocalAddress(); } - - private: - void OnAccept(AsyncSocket* socket) { - AsyncSocket* raw_socket = socket->Accept(NULL); - if (raw_socket) { - AsyncTCPSocket* packet_socket = new AsyncTCPSocket(raw_socket, false); - packet_socket->SignalReadPacket.connect(this, &TestEchoServer::OnPacket); - packet_socket->SignalClose.connect(this, &TestEchoServer::OnClose); - client_sockets_.push_back(packet_socket); - } - } - void OnPacket(AsyncPacketSocket* socket, const char* buf, size_t size, - const SocketAddress& remote_addr, - const PacketTime& packet_time) { - rtc::PacketOptions options; - socket->Send(buf, size, options); - } - void OnClose(AsyncPacketSocket* socket, int err) { - ClientList::iterator it = - std::find(client_sockets_.begin(), client_sockets_.end(), socket); - client_sockets_.erase(it); - Thread::Current()->Dispose(socket); - } - - typedef std::list ClientList; - scoped_ptr server_socket_; - ClientList client_sockets_; - RTC_DISALLOW_COPY_AND_ASSIGN(TestEchoServer); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_TESTECHOSERVER_H_ diff --git a/include/webrtc/base/testutils.h b/include/webrtc/base/testutils.h deleted file mode 100644 index 6e7e22a..0000000 --- a/include/webrtc/base/testutils.h +++ /dev/null @@ -1,635 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TESTUTILS_H__ -#define WEBRTC_BASE_TESTUTILS_H__ - -// Utilities for testing rtc infrastructure in unittests - -#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) -#include -#include - -// X defines a few macros that stomp on types that gunit.h uses. -#undef None -#undef Bool -#endif - -#include -#include -#include -#include "webrtc/base/arraysize.h" -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/common.h" -#include "webrtc/base/gunit.h" -#include "webrtc/base/nethelpers.h" -#include "webrtc/base/pathutils.h" -#include "webrtc/base/stream.h" -#include "webrtc/base/stringencode.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/base/thread.h" - -namespace testing { - -using namespace rtc; - -/////////////////////////////////////////////////////////////////////////////// -// StreamSink - Monitor asynchronously signalled events from StreamInterface -// or AsyncSocket (which should probably be a StreamInterface. -/////////////////////////////////////////////////////////////////////////////// - -// Note: Any event that is an error is treaded as SSE_ERROR instead of that -// event. - -enum StreamSinkEvent { - SSE_OPEN = SE_OPEN, - SSE_READ = SE_READ, - SSE_WRITE = SE_WRITE, - SSE_CLOSE = SE_CLOSE, - SSE_ERROR = 16 -}; - -class StreamSink : public sigslot::has_slots<> { - public: - void Monitor(StreamInterface* stream) { - stream->SignalEvent.connect(this, &StreamSink::OnEvent); - events_.erase(stream); - } - void Unmonitor(StreamInterface* stream) { - stream->SignalEvent.disconnect(this); - // In case you forgot to unmonitor a previous object with this address - events_.erase(stream); - } - bool Check(StreamInterface* stream, StreamSinkEvent event, bool reset = true) { - return DoCheck(stream, event, reset); - } - int Events(StreamInterface* stream, bool reset = true) { - return DoEvents(stream, reset); - } - - void Monitor(AsyncSocket* socket) { - socket->SignalConnectEvent.connect(this, &StreamSink::OnConnectEvent); - socket->SignalReadEvent.connect(this, &StreamSink::OnReadEvent); - socket->SignalWriteEvent.connect(this, &StreamSink::OnWriteEvent); - socket->SignalCloseEvent.connect(this, &StreamSink::OnCloseEvent); - // In case you forgot to unmonitor a previous object with this address - events_.erase(socket); - } - void Unmonitor(AsyncSocket* socket) { - socket->SignalConnectEvent.disconnect(this); - socket->SignalReadEvent.disconnect(this); - socket->SignalWriteEvent.disconnect(this); - socket->SignalCloseEvent.disconnect(this); - events_.erase(socket); - } - bool Check(AsyncSocket* socket, StreamSinkEvent event, bool reset = true) { - return DoCheck(socket, event, reset); - } - int Events(AsyncSocket* socket, bool reset = true) { - return DoEvents(socket, reset); - } - - private: - typedef std::map EventMap; - - void OnEvent(StreamInterface* stream, int events, int error) { - if (error) { - events = SSE_ERROR; - } - AddEvents(stream, events); - } - void OnConnectEvent(AsyncSocket* socket) { - AddEvents(socket, SSE_OPEN); - } - void OnReadEvent(AsyncSocket* socket) { - AddEvents(socket, SSE_READ); - } - void OnWriteEvent(AsyncSocket* socket) { - AddEvents(socket, SSE_WRITE); - } - void OnCloseEvent(AsyncSocket* socket, int error) { - AddEvents(socket, (0 == error) ? SSE_CLOSE : SSE_ERROR); - } - - void AddEvents(void* obj, int events) { - EventMap::iterator it = events_.find(obj); - if (events_.end() == it) { - events_.insert(EventMap::value_type(obj, events)); - } else { - it->second |= events; - } - } - bool DoCheck(void* obj, StreamSinkEvent event, bool reset) { - EventMap::iterator it = events_.find(obj); - if ((events_.end() == it) || (0 == (it->second & event))) { - return false; - } - if (reset) { - it->second &= ~event; - } - return true; - } - int DoEvents(void* obj, bool reset) { - EventMap::iterator it = events_.find(obj); - if (events_.end() == it) - return 0; - int events = it->second; - if (reset) { - it->second = 0; - } - return events; - } - - EventMap events_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// StreamSource - Implements stream interface and simulates asynchronous -// events on the stream, without a network. Also buffers written data. -/////////////////////////////////////////////////////////////////////////////// - -class StreamSource : public StreamInterface { -public: - StreamSource() { - Clear(); - } - - void Clear() { - readable_data_.clear(); - written_data_.clear(); - state_ = SS_CLOSED; - read_block_ = 0; - write_block_ = SIZE_UNKNOWN; - } - void QueueString(const char* data) { - QueueData(data, strlen(data)); - } - void QueueStringF(const char* format, ...) { - va_list args; - va_start(args, format); - char buffer[1024]; - size_t len = vsprintfn(buffer, sizeof(buffer), format, args); - ASSERT(len < sizeof(buffer) - 1); - va_end(args); - QueueData(buffer, len); - } - void QueueData(const char* data, size_t len) { - readable_data_.insert(readable_data_.end(), data, data + len); - if ((SS_OPEN == state_) && (readable_data_.size() == len)) { - SignalEvent(this, SE_READ, 0); - } - } - std::string ReadData() { - std::string data; - // avoid accessing written_data_[0] if it is undefined - if (written_data_.size() > 0) { - data.insert(0, &written_data_[0], written_data_.size()); - } - written_data_.clear(); - return data; - } - void SetState(StreamState state) { - int events = 0; - if ((SS_OPENING == state_) && (SS_OPEN == state)) { - events |= SE_OPEN; - if (!readable_data_.empty()) { - events |= SE_READ; - } - } else if ((SS_CLOSED != state_) && (SS_CLOSED == state)) { - events |= SE_CLOSE; - } - state_ = state; - if (events) { - SignalEvent(this, events, 0); - } - } - // Will cause Read to block when there are pos bytes in the read queue. - void SetReadBlock(size_t pos) { read_block_ = pos; } - // Will cause Write to block when there are pos bytes in the write queue. - void SetWriteBlock(size_t pos) { write_block_ = pos; } - - virtual StreamState GetState() const { return state_; } - virtual StreamResult Read(void* buffer, size_t buffer_len, - size_t* read, int* error) { - if (SS_CLOSED == state_) { - if (error) *error = -1; - return SR_ERROR; - } - if ((SS_OPENING == state_) || (readable_data_.size() <= read_block_)) { - return SR_BLOCK; - } - size_t count = std::min(buffer_len, readable_data_.size() - read_block_); - memcpy(buffer, &readable_data_[0], count); - size_t new_size = readable_data_.size() - count; - // Avoid undefined access beyond the last element of the vector. - // This only happens when new_size is 0. - if (count < readable_data_.size()) { - memmove(&readable_data_[0], &readable_data_[count], new_size); - } - readable_data_.resize(new_size); - if (read) *read = count; - return SR_SUCCESS; - } - virtual StreamResult Write(const void* data, size_t data_len, - size_t* written, int* error) { - if (SS_CLOSED == state_) { - if (error) *error = -1; - return SR_ERROR; - } - if (SS_OPENING == state_) { - return SR_BLOCK; - } - if (SIZE_UNKNOWN != write_block_) { - if (written_data_.size() >= write_block_) { - return SR_BLOCK; - } - if (data_len > (write_block_ - written_data_.size())) { - data_len = write_block_ - written_data_.size(); - } - } - if (written) *written = data_len; - const char* cdata = static_cast(data); - written_data_.insert(written_data_.end(), cdata, cdata + data_len); - return SR_SUCCESS; - } - virtual void Close() { state_ = SS_CLOSED; } - -private: - typedef std::vector Buffer; - Buffer readable_data_, written_data_; - StreamState state_; - size_t read_block_, write_block_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// SocketTestClient -// Creates a simulated client for testing. Works on real and virtual networks. -/////////////////////////////////////////////////////////////////////////////// - -class SocketTestClient : public sigslot::has_slots<> { -public: - SocketTestClient() { - Init(NULL, AF_INET); - } - SocketTestClient(AsyncSocket* socket) { - Init(socket, socket->GetLocalAddress().family()); - } - SocketTestClient(const SocketAddress& address) { - Init(NULL, address.family()); - socket_->Connect(address); - } - - AsyncSocket* socket() { return socket_.get(); } - - void QueueString(const char* data) { - QueueData(data, strlen(data)); - } - void QueueStringF(const char* format, ...) { - va_list args; - va_start(args, format); - char buffer[1024]; - size_t len = vsprintfn(buffer, sizeof(buffer), format, args); - ASSERT(len < sizeof(buffer) - 1); - va_end(args); - QueueData(buffer, len); - } - void QueueData(const char* data, size_t len) { - send_buffer_.insert(send_buffer_.end(), data, data + len); - if (Socket::CS_CONNECTED == socket_->GetState()) { - Flush(); - } - } - std::string ReadData() { - std::string data(&recv_buffer_[0], recv_buffer_.size()); - recv_buffer_.clear(); - return data; - } - - bool IsConnected() const { - return (Socket::CS_CONNECTED == socket_->GetState()); - } - bool IsClosed() const { - return (Socket::CS_CLOSED == socket_->GetState()); - } - -private: - typedef std::vector Buffer; - - void Init(AsyncSocket* socket, int family) { - if (!socket) { - socket = Thread::Current()->socketserver() - ->CreateAsyncSocket(family, SOCK_STREAM); - } - socket_.reset(socket); - socket_->SignalConnectEvent.connect(this, - &SocketTestClient::OnConnectEvent); - socket_->SignalReadEvent.connect(this, &SocketTestClient::OnReadEvent); - socket_->SignalWriteEvent.connect(this, &SocketTestClient::OnWriteEvent); - socket_->SignalCloseEvent.connect(this, &SocketTestClient::OnCloseEvent); - } - - void Flush() { - size_t sent = 0; - while (sent < send_buffer_.size()) { - int result = socket_->Send(&send_buffer_[sent], - send_buffer_.size() - sent); - if (result > 0) { - sent += result; - } else { - break; - } - } - size_t new_size = send_buffer_.size() - sent; - memmove(&send_buffer_[0], &send_buffer_[sent], new_size); - send_buffer_.resize(new_size); - } - - void OnConnectEvent(AsyncSocket* socket) { - if (!send_buffer_.empty()) { - Flush(); - } - } - void OnReadEvent(AsyncSocket* socket) { - char data[64 * 1024]; - int result = socket_->Recv(data, arraysize(data)); - if (result > 0) { - recv_buffer_.insert(recv_buffer_.end(), data, data + result); - } - } - void OnWriteEvent(AsyncSocket* socket) { - if (!send_buffer_.empty()) { - Flush(); - } - } - void OnCloseEvent(AsyncSocket* socket, int error) { - } - - scoped_ptr socket_; - Buffer send_buffer_, recv_buffer_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// SocketTestServer -// Creates a simulated server for testing. Works on real and virtual networks. -/////////////////////////////////////////////////////////////////////////////// - -class SocketTestServer : public sigslot::has_slots<> { - public: - SocketTestServer(const SocketAddress& address) - : socket_(Thread::Current()->socketserver() - ->CreateAsyncSocket(address.family(), SOCK_STREAM)) - { - socket_->SignalReadEvent.connect(this, &SocketTestServer::OnReadEvent); - socket_->Bind(address); - socket_->Listen(5); - } - virtual ~SocketTestServer() { - clear(); - } - - size_t size() const { return clients_.size(); } - SocketTestClient* client(size_t index) const { return clients_[index]; } - SocketTestClient* operator[](size_t index) const { return client(index); } - - void clear() { - for (size_t i=0; i(socket_->Accept(NULL)); - if (!accepted) - return; - clients_.push_back(new SocketTestClient(accepted)); - } - - scoped_ptr socket_; - std::vector clients_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// Generic Utilities -/////////////////////////////////////////////////////////////////////////////// - -inline bool ReadFile(const char* filename, std::string* contents) { - FILE* fp = fopen(filename, "rb"); - if (!fp) - return false; - char buffer[1024*64]; - size_t read; - contents->clear(); - while ((read = fread(buffer, 1, sizeof(buffer), fp))) { - contents->append(buffer, read); - } - bool success = (0 != feof(fp)); - fclose(fp); - return success; -} - -// Look in parent dir for parallel directory. -inline rtc::Pathname GetSiblingDirectory( - const std::string& parallel_dir) { - rtc::Pathname path = rtc::Filesystem::GetCurrentDirectory(); - while (!path.empty()) { - rtc::Pathname potential_parallel_dir = path; - potential_parallel_dir.AppendFolder(parallel_dir); - if (rtc::Filesystem::IsFolder(potential_parallel_dir)) { - return potential_parallel_dir; - } - - path.SetFolder(path.parent_folder()); - } - return path; -} - -inline rtc::Pathname GetGoogle3Directory() { - return GetSiblingDirectory("google3"); -} - -inline rtc::Pathname GetTalkDirectory() { - return GetSiblingDirectory("talk"); -} - -/////////////////////////////////////////////////////////////////////////////// -// Unittest predicates which are similar to STREQ, but for raw memory -/////////////////////////////////////////////////////////////////////////////// - -inline AssertionResult CmpHelperMemEq(const char* expected_expression, - const char* expected_length_expression, - const char* actual_expression, - const char* actual_length_expression, - const void* expected, - size_t expected_length, - const void* actual, - size_t actual_length) -{ - if ((expected_length == actual_length) - && (0 == memcmp(expected, actual, expected_length))) { - return AssertionSuccess(); - } - - Message msg; - msg << "Value of: " << actual_expression - << " [" << actual_length_expression << "]"; - if (true) { //!actual_value.Equals(actual_expression)) { - size_t buffer_size = actual_length * 2 + 1; - char* buffer = STACK_ARRAY(char, buffer_size); - hex_encode(buffer, buffer_size, - reinterpret_cast(actual), actual_length); - msg << "\n Actual: " << buffer << " [" << actual_length << "]"; - } - - msg << "\nExpected: " << expected_expression - << " [" << expected_length_expression << "]"; - if (true) { //!expected_value.Equals(expected_expression)) { - size_t buffer_size = expected_length * 2 + 1; - char* buffer = STACK_ARRAY(char, buffer_size); - hex_encode(buffer, buffer_size, - reinterpret_cast(expected), expected_length); - msg << "\nWhich is: " << buffer << " [" << expected_length << "]"; - } - - return AssertionFailure(msg); -} - -inline AssertionResult CmpHelperFileEq(const char* expected_expression, - const char* expected_length_expression, - const char* actual_filename, - const void* expected, - size_t expected_length, - const char* filename) -{ - std::string contents; - if (!ReadFile(filename, &contents)) { - Message msg; - msg << "File '" << filename << "' could not be read."; - return AssertionFailure(msg); - } - return CmpHelperMemEq(expected_expression, expected_length_expression, - actual_filename, "", - expected, expected_length, - contents.c_str(), contents.size()); -} - -#define EXPECT_MEMEQ(expected, expected_length, actual, actual_length) \ - EXPECT_PRED_FORMAT4(::testing::CmpHelperMemEq, expected, expected_length, \ - actual, actual_length) - -#define ASSERT_MEMEQ(expected, expected_length, actual, actual_length) \ - ASSERT_PRED_FORMAT4(::testing::CmpHelperMemEq, expected, expected_length, \ - actual, actual_length) - -#define EXPECT_FILEEQ(expected, expected_length, filename) \ - EXPECT_PRED_FORMAT3(::testing::CmpHelperFileEq, expected, expected_length, \ - filename) - -#define ASSERT_FILEEQ(expected, expected_length, filename) \ - ASSERT_PRED_FORMAT3(::testing::CmpHelperFileEq, expected, expected_length, \ - filename) - -/////////////////////////////////////////////////////////////////////////////// -// Helpers for initializing constant memory with integers in a particular byte -// order -/////////////////////////////////////////////////////////////////////////////// - -#define BYTE_CAST(x) static_cast((x)&0xFF) - -// Declare a N-bit integer as a little-endian sequence of bytes -#define LE16(x) BYTE_CAST(((uint16_t)x) >> 0), BYTE_CAST(((uint16_t)x) >> 8) - -#define LE32(x) \ - BYTE_CAST(((uint32_t)x) >> 0), BYTE_CAST(((uint32_t)x) >> 8), \ - BYTE_CAST(((uint32_t)x) >> 16), BYTE_CAST(((uint32_t)x) >> 24) - -#define LE64(x) \ - BYTE_CAST(((uint64_t)x) >> 0), BYTE_CAST(((uint64_t)x) >> 8), \ - BYTE_CAST(((uint64_t)x) >> 16), BYTE_CAST(((uint64_t)x) >> 24), \ - BYTE_CAST(((uint64_t)x) >> 32), BYTE_CAST(((uint64_t)x) >> 40), \ - BYTE_CAST(((uint64_t)x) >> 48), BYTE_CAST(((uint64_t)x) >> 56) - -// Declare a N-bit integer as a big-endian (Internet) sequence of bytes -#define BE16(x) BYTE_CAST(((uint16_t)x) >> 8), BYTE_CAST(((uint16_t)x) >> 0) - -#define BE32(x) \ - BYTE_CAST(((uint32_t)x) >> 24), BYTE_CAST(((uint32_t)x) >> 16), \ - BYTE_CAST(((uint32_t)x) >> 8), BYTE_CAST(((uint32_t)x) >> 0) - -#define BE64(x) \ - BYTE_CAST(((uint64_t)x) >> 56), BYTE_CAST(((uint64_t)x) >> 48), \ - BYTE_CAST(((uint64_t)x) >> 40), BYTE_CAST(((uint64_t)x) >> 32), \ - BYTE_CAST(((uint64_t)x) >> 24), BYTE_CAST(((uint64_t)x) >> 16), \ - BYTE_CAST(((uint64_t)x) >> 8), BYTE_CAST(((uint64_t)x) >> 0) - -// Declare a N-bit integer as a this-endian (local machine) sequence of bytes -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 1 -#endif // BIG_ENDIAN - -#if BIG_ENDIAN -#define TE16 BE16 -#define TE32 BE32 -#define TE64 BE64 -#else // !BIG_ENDIAN -#define TE16 LE16 -#define TE32 LE32 -#define TE64 LE64 -#endif // !BIG_ENDIAN - -/////////////////////////////////////////////////////////////////////////////// - -// Helpers for determining if X/screencasting is available (on linux). - -#define MAYBE_SKIP_SCREENCAST_TEST() \ - if (!testing::IsScreencastingAvailable()) { \ - LOG(LS_WARNING) << "Skipping test, since it doesn't have the requisite " \ - << "X environment for screen capture."; \ - return; \ - } \ - -#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) -struct XDisplay { - XDisplay() : display_(XOpenDisplay(NULL)) { } - ~XDisplay() { if (display_) XCloseDisplay(display_); } - bool IsValid() const { return display_ != NULL; } - operator Display*() { return display_; } - private: - Display* display_; -}; -#endif - -// Returns true if screencasting is available. When false, anything that uses -// screencasting features may fail. -inline bool IsScreencastingAvailable() { -#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) - XDisplay display; - if (!display.IsValid()) { - LOG(LS_WARNING) << "No X Display available."; - return false; - } - int ignored_int, major_version, minor_version; - if (!XRRQueryExtension(display, &ignored_int, &ignored_int) || - !XRRQueryVersion(display, &major_version, &minor_version) || - major_version < 1 || - (major_version < 2 && minor_version < 3)) { - LOG(LS_WARNING) << "XRandr version: " << major_version << "." - << minor_version; - LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3)."; - return false; - } -#endif - return true; -} -} // namespace testing - -#endif // WEBRTC_BASE_TESTUTILS_H__ diff --git a/include/webrtc/base/thread.h b/include/webrtc/base/thread.h deleted file mode 100644 index f91aa56..0000000 --- a/include/webrtc/base/thread.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_THREAD_H_ -#define WEBRTC_BASE_THREAD_H_ - -#include -#include -#include -#include - -#if defined(WEBRTC_POSIX) -#include -#endif -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/event.h" -#include "webrtc/base/messagequeue.h" - -#if defined(WEBRTC_WIN) -#include "webrtc/base/win32.h" -#endif - -namespace rtc { - -class Thread; - -class ThreadManager { - public: - static const int kForever = -1; - - ThreadManager(); - ~ThreadManager(); - - static ThreadManager* Instance(); - - Thread* CurrentThread(); - void SetCurrentThread(Thread* thread); - - // Returns a thread object with its thread_ ivar set - // to whatever the OS uses to represent the thread. - // If there already *is* a Thread object corresponding to this thread, - // this method will return that. Otherwise it creates a new Thread - // object whose wrapped() method will return true, and whose - // handle will, on Win32, be opened with only synchronization privileges - - // if you need more privilegs, rather than changing this method, please - // write additional code to adjust the privileges, or call a different - // factory method of your own devising, because this one gets used in - // unexpected contexts (like inside browser plugins) and it would be a - // shame to break it. It is also conceivable on Win32 that we won't even - // be able to get synchronization privileges, in which case the result - // will have a NULL handle. - Thread *WrapCurrentThread(); - void UnwrapCurrentThread(); - - private: -#if defined(WEBRTC_POSIX) - pthread_key_t key_; -#endif - -#if defined(WEBRTC_WIN) - DWORD key_; -#endif - - RTC_DISALLOW_COPY_AND_ASSIGN(ThreadManager); -}; - -struct _SendMessage { - _SendMessage() {} - Thread *thread; - Message msg; - bool *ready; -}; - -class Runnable { - public: - virtual ~Runnable() {} - virtual void Run(Thread* thread) = 0; - - protected: - Runnable() {} - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(Runnable); -}; - -// WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread(). - -class Thread : public MessageQueue { - public: - explicit Thread(SocketServer* ss = NULL); - // NOTE: ALL SUBCLASSES OF Thread MUST CALL Stop() IN THEIR DESTRUCTORS (or - // guarantee Stop() is explicitly called before the subclass is destroyed). - // This is required to avoid a data race between the destructor modifying the - // vtable, and the Thread::PreRun calling the virtual method Run(). - ~Thread() override; - - static Thread* Current(); - - // Used to catch performance regressions. Use this to disallow blocking calls - // (Invoke) for a given scope. If a synchronous call is made while this is in - // effect, an assert will be triggered. - // Note that this is a single threaded class. - class ScopedDisallowBlockingCalls { - public: - ScopedDisallowBlockingCalls(); - ~ScopedDisallowBlockingCalls(); - private: - Thread* const thread_; - const bool previous_state_; - }; - - bool IsCurrent() const { - return Current() == this; - } - - // Sleeps the calling thread for the specified number of milliseconds, during - // which time no processing is performed. Returns false if sleeping was - // interrupted by a signal (POSIX only). - static bool SleepMs(int millis); - - // Sets the thread's name, for debugging. Must be called before Start(). - // If |obj| is non-NULL, its value is appended to |name|. - const std::string& name() const { return name_; } - bool SetName(const std::string& name, const void* obj); - - // Starts the execution of the thread. - bool Start(Runnable* runnable = NULL); - - // Tells the thread to stop and waits until it is joined. - // Never call Stop on the current thread. Instead use the inherited Quit - // function which will exit the base MessageQueue without terminating the - // underlying OS thread. - virtual void Stop(); - - // By default, Thread::Run() calls ProcessMessages(kForever). To do other - // work, override Run(). To receive and dispatch messages, call - // ProcessMessages occasionally. - virtual void Run(); - - virtual void Send(MessageHandler* phandler, - uint32_t id = 0, - MessageData* pdata = NULL); - - // Convenience method to invoke a functor on another thread. Caller must - // provide the |ReturnT| template argument, which cannot (easily) be deduced. - // Uses Send() internally, which blocks the current thread until execution - // is complete. - // Ex: bool result = thread.Invoke(&MyFunctionReturningBool); - // NOTE: This function can only be called when synchronous calls are allowed. - // See ScopedDisallowBlockingCalls for details. - template - ReturnT Invoke(const FunctorT& functor) { - InvokeBegin(); - FunctorMessageHandler handler(functor); - Send(&handler); - InvokeEnd(); - return handler.result(); - } - - // From MessageQueue - void Clear(MessageHandler* phandler, - uint32_t id = MQID_ANY, - MessageList* removed = NULL) override; - void ReceiveSends() override; - - // ProcessMessages will process I/O and dispatch messages until: - // 1) cms milliseconds have elapsed (returns true) - // 2) Stop() is called (returns false) - bool ProcessMessages(int cms); - - // Returns true if this is a thread that we created using the standard - // constructor, false if it was created by a call to - // ThreadManager::WrapCurrentThread(). The main thread of an application - // is generally not owned, since the OS representation of the thread - // obviously exists before we can get to it. - // You cannot call Start on non-owned threads. - bool IsOwned(); - -#if defined(WEBRTC_WIN) - HANDLE GetHandle() const { - return thread_; - } - DWORD GetId() const { - return thread_id_; - } -#elif defined(WEBRTC_POSIX) - pthread_t GetPThread() { - return thread_; - } -#endif - - // Expose private method running() for tests. - // - // DANGER: this is a terrible public API. Most callers that might want to - // call this likely do not have enough control/knowledge of the Thread in - // question to guarantee that the returned value remains true for the duration - // of whatever code is conditionally executing because of the return value! - bool RunningForTest() { return running(); } - - // Sets the per-thread allow-blocking-calls flag and returns the previous - // value. Must be called on this thread. - bool SetAllowBlockingCalls(bool allow); - - // These functions are public to avoid injecting test hooks. Don't call them - // outside of tests. - // This method should be called when thread is created using non standard - // method, like derived implementation of rtc::Thread and it can not be - // started by calling Start(). This will set started flag to true and - // owned to false. This must be called from the current thread. - bool WrapCurrent(); - void UnwrapCurrent(); - - protected: - // Same as WrapCurrent except that it never fails as it does not try to - // acquire the synchronization access of the thread. The caller should never - // call Stop() or Join() on this thread. - void SafeWrapCurrent(); - - // Blocks the calling thread until this thread has terminated. - void Join(); - - static void AssertBlockingIsAllowedOnCurrentThread(); - - friend class ScopedDisallowBlockingCalls; - - private: - static void *PreRun(void *pv); - - // ThreadManager calls this instead WrapCurrent() because - // ThreadManager::Instance() cannot be used while ThreadManager is - // being created. - // The method tries to get synchronization rights of the thread on Windows if - // |need_synchronize_access| is true. - bool WrapCurrentWithThreadManager(ThreadManager* thread_manager, - bool need_synchronize_access); - - // Return true if the thread was started and hasn't yet stopped. - bool running() { return running_.Wait(0); } - - // Processes received "Send" requests. If |source| is not NULL, only requests - // from |source| are processed, otherwise, all requests are processed. - void ReceiveSendsFromThread(const Thread* source); - - // If |source| is not NULL, pops the first "Send" message from |source| in - // |sendlist_|, otherwise, pops the first "Send" message of |sendlist_|. - // The caller must lock |crit_| before calling. - // Returns true if there is such a message. - bool PopSendMessageFromThread(const Thread* source, _SendMessage* msg); - - // Used for tracking performance of Invoke calls. - void InvokeBegin(); - void InvokeEnd(); - - std::list<_SendMessage> sendlist_; - std::string name_; - Event running_; // Signalled means running. - -#if defined(WEBRTC_POSIX) - pthread_t thread_; -#endif - -#if defined(WEBRTC_WIN) - HANDLE thread_; - DWORD thread_id_; -#endif - - bool owned_; - bool blocking_calls_allowed_; // By default set to |true|. - - friend class ThreadManager; - - RTC_DISALLOW_COPY_AND_ASSIGN(Thread); -}; - -// AutoThread automatically installs itself at construction -// uninstalls at destruction, if a Thread object is -// _not already_ associated with the current OS thread. - -class AutoThread : public Thread { - public: - explicit AutoThread(SocketServer* ss = 0); - ~AutoThread() override; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread); -}; - -// Win32 extension for threads that need to use COM -#if defined(WEBRTC_WIN) -class ComThread : public Thread { - public: - ComThread() {} - virtual ~ComThread() { Stop(); } - - protected: - virtual void Run(); - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(ComThread); -}; -#endif - -// Provides an easy way to install/uninstall a socketserver on a thread. -class SocketServerScope { - public: - explicit SocketServerScope(SocketServer* ss) { - old_ss_ = Thread::Current()->socketserver(); - Thread::Current()->set_socketserver(ss); - } - ~SocketServerScope() { - Thread::Current()->set_socketserver(old_ss_); - } - - private: - SocketServer* old_ss_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_THREAD_H_ diff --git a/include/webrtc/base/thread_annotations.h b/include/webrtc/base/thread_annotations.h deleted file mode 100644 index 612242d..0000000 --- a/include/webrtc/base/thread_annotations.h +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// -// Borrowed from -// https://code.google.com/p/gperftools/source/browse/src/base/thread_annotations.h -// but adapted for clang attributes instead of the gcc. -// -// This header file contains the macro definitions for thread safety -// annotations that allow the developers to document the locking policies -// of their multi-threaded code. The annotations can also help program -// analysis tools to identify potential thread safety issues. - -#ifndef BASE_THREAD_ANNOTATIONS_H_ -#define BASE_THREAD_ANNOTATIONS_H_ - -#if defined(__clang__) && (!defined(SWIG)) -#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) -#else -#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op -#endif - -// Document if a shared variable/field needs to be protected by a lock. -// GUARDED_BY allows the user to specify a particular lock that should be -// held when accessing the annotated variable, while GUARDED_VAR only -// indicates a shared variable should be guarded (by any lock). GUARDED_VAR -// is primarily used when the client cannot express the name of the lock. -#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) -#define GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(guarded) - -// Document if the memory location pointed to by a pointer should be guarded -// by a lock when dereferencing the pointer. Similar to GUARDED_VAR, -// PT_GUARDED_VAR is primarily used when the client cannot express the name -// of the lock. Note that a pointer variable to a shared memory location -// could itself be a shared variable. For example, if a shared global pointer -// q, which is guarded by mu1, points to a shared memory location that is -// guarded by mu2, q should be annotated as follows: -// int *q GUARDED_BY(mu1) PT_GUARDED_BY(mu2); -#define PT_GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(point_to_guarded_by(x)) -#define PT_GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(point_to_guarded) - -// Document the acquisition order between locks that can be held -// simultaneously by a thread. For any two locks that need to be annotated -// to establish an acquisition order, only one of them needs the annotation. -// (i.e. You don't have to annotate both locks with both ACQUIRED_AFTER -// and ACQUIRED_BEFORE.) -#define ACQUIRED_AFTER(x) THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(x)) -#define ACQUIRED_BEFORE(x) THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(x)) - -// The following three annotations document the lock requirements for -// functions/methods. - -// Document if a function expects certain locks to be held before it is called -#define EXCLUSIVE_LOCKS_REQUIRED(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) - -#define SHARED_LOCKS_REQUIRED(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__)) - -// Document the locks acquired in the body of the function. These locks -// cannot be held when calling this function (as google3's Mutex locks are -// non-reentrant). -#define LOCKS_EXCLUDED(x) THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x)) - -// Document the lock the annotated function returns without acquiring it. -#define LOCK_RETURNED(x) THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) - -// Document if a class/type is a lockable type (such as the Mutex class). -#define LOCKABLE THREAD_ANNOTATION_ATTRIBUTE__(lockable) - -// Document if a class is a scoped lockable type (such as the MutexLock class). -#define SCOPED_LOCKABLE THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) - -// The following annotations specify lock and unlock primitives. -#define EXCLUSIVE_LOCK_FUNCTION(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) - -#define SHARED_LOCK_FUNCTION(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) - -#define EXCLUSIVE_TRYLOCK_FUNCTION(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) - -#define SHARED_TRYLOCK_FUNCTION(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) - -#define UNLOCK_FUNCTION(...) \ - THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) - -// An escape hatch for thread safety analysis to ignore the annotated function. -#define NO_THREAD_SAFETY_ANALYSIS \ - THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) - -#endif // BASE_THREAD_ANNOTATIONS_H_ diff --git a/include/webrtc/base/thread_checker.h b/include/webrtc/base/thread_checker.h deleted file mode 100644 index 6cd7d7b..0000000 --- a/include/webrtc/base/thread_checker.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/threading/thread_checker.h. - -#ifndef WEBRTC_BASE_THREAD_CHECKER_H_ -#define WEBRTC_BASE_THREAD_CHECKER_H_ - -// Apart from debug builds, we also enable the thread checker in -// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots -// with this define will get the same level of thread checking as -// debug bots. -// -// Note that this does not perfectly match situations where RTC_DCHECK is -// enabled. For example a non-official release build may have -// DCHECK_ALWAYS_ON undefined (and therefore ThreadChecker would be -// disabled) but have RTC_DCHECKs enabled at runtime. -#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) -#define ENABLE_THREAD_CHECKER 1 -#else -#define ENABLE_THREAD_CHECKER 0 -#endif - -#include "webrtc/base/thread_checker_impl.h" - -namespace rtc { - -// Do nothing implementation, for use in release mode. -// -// Note: You should almost always use the ThreadChecker class to get the -// right version for your build configuration. -class ThreadCheckerDoNothing { - public: - bool CalledOnValidThread() const { - return true; - } - - void DetachFromThread() {} -}; - -// ThreadChecker is a helper class used to help verify that some methods of a -// class are called from the same thread. It provides identical functionality to -// base::NonThreadSafe, but it is meant to be held as a member variable, rather -// than inherited from base::NonThreadSafe. -// -// While inheriting from base::NonThreadSafe may give a clear indication about -// the thread-safety of a class, it may also lead to violations of the style -// guide with regard to multiple inheritance. The choice between having a -// ThreadChecker member and inheriting from base::NonThreadSafe should be based -// on whether: -// - Derived classes need to know the thread they belong to, as opposed to -// having that functionality fully encapsulated in the base class. -// - Derived classes should be able to reassign the base class to another -// thread, via DetachFromThread. -// -// If neither of these are true, then having a ThreadChecker member and calling -// CalledOnValidThread is the preferable solution. -// -// Example: -// class MyClass { -// public: -// void Foo() { -// RTC_DCHECK(thread_checker_.CalledOnValidThread()); -// ... (do stuff) ... -// } -// -// private: -// ThreadChecker thread_checker_; -// } -// -// In Release mode, CalledOnValidThread will always return true. -#if ENABLE_THREAD_CHECKER -class ThreadChecker : public ThreadCheckerImpl { -}; -#else -class ThreadChecker : public ThreadCheckerDoNothing { -}; -#endif // ENABLE_THREAD_CHECKER - -#undef ENABLE_THREAD_CHECKER - -} // namespace rtc - -#endif // WEBRTC_BASE_THREAD_CHECKER_H_ diff --git a/include/webrtc/base/thread_checker_impl.h b/include/webrtc/base/thread_checker_impl.h deleted file mode 100644 index 0455835..0000000 --- a/include/webrtc/base/thread_checker_impl.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/threading/thread_checker_impl.h. - -#ifndef WEBRTC_BASE_THREAD_CHECKER_IMPL_H_ -#define WEBRTC_BASE_THREAD_CHECKER_IMPL_H_ - -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/platform_thread_types.h" - -namespace rtc { - -// Real implementation of ThreadChecker, for use in debug mode, or -// for temporary use in release mode (e.g. to RTC_CHECK on a threading issue -// seen only in the wild). -// -// Note: You should almost always use the ThreadChecker class to get the -// right version for your build configuration. -class ThreadCheckerImpl { - public: - ThreadCheckerImpl(); - ~ThreadCheckerImpl(); - - bool CalledOnValidThread() const; - - // Changes the thread that is checked for in CalledOnValidThread. This may - // be useful when an object may be created on one thread and then used - // exclusively on another thread. - void DetachFromThread(); - - private: - mutable CriticalSection lock_; - // This is mutable so that CalledOnValidThread can set it. - // It's guarded by |lock_|. - mutable PlatformThreadRef valid_thread_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_THREAD_CHECKER_IMPL_H_ diff --git a/include/webrtc/base/timeutils.h b/include/webrtc/base/timeutils.h deleted file mode 100644 index 3ade430..0000000 --- a/include/webrtc/base/timeutils.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2005 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TIMEUTILS_H_ -#define WEBRTC_BASE_TIMEUTILS_H_ - -#include -#include - -#include "webrtc/base/basictypes.h" - -namespace rtc { - -static const int64_t kNumMillisecsPerSec = INT64_C(1000); -static const int64_t kNumMicrosecsPerSec = INT64_C(1000000); -static const int64_t kNumNanosecsPerSec = INT64_C(1000000000); - -static const int64_t kNumMicrosecsPerMillisec = - kNumMicrosecsPerSec / kNumMillisecsPerSec; -static const int64_t kNumNanosecsPerMillisec = - kNumNanosecsPerSec / kNumMillisecsPerSec; -static const int64_t kNumNanosecsPerMicrosec = - kNumNanosecsPerSec / kNumMicrosecsPerSec; - -// January 1970, in NTP milliseconds. -static const int64_t kJan1970AsNtpMillisecs = INT64_C(2208988800000); - -typedef uint32_t TimeStamp; - -// Returns the current time in milliseconds. -uint32_t Time(); -// Returns the current time in microseconds. -uint64_t TimeMicros(); -// Returns the current time in nanoseconds. -uint64_t TimeNanos(); - -// Stores current time in *tm and microseconds in *microseconds. -void CurrentTmTime(struct tm *tm, int *microseconds); - -// Returns a future timestamp, 'elapsed' milliseconds from now. -uint32_t TimeAfter(int32_t elapsed); - -// Comparisons between time values, which can wrap around. -bool TimeIsBetween(uint32_t earlier, - uint32_t middle, - uint32_t later); // Inclusive -bool TimeIsLaterOrEqual(uint32_t earlier, uint32_t later); // Inclusive -bool TimeIsLater(uint32_t earlier, uint32_t later); // Exclusive - -// Returns the later of two timestamps. -inline uint32_t TimeMax(uint32_t ts1, uint32_t ts2) { - return TimeIsLaterOrEqual(ts1, ts2) ? ts2 : ts1; -} - -// Returns the earlier of two timestamps. -inline uint32_t TimeMin(uint32_t ts1, uint32_t ts2) { - return TimeIsLaterOrEqual(ts1, ts2) ? ts1 : ts2; -} - -// Number of milliseconds that would elapse between 'earlier' and 'later' -// timestamps. The value is negative if 'later' occurs before 'earlier'. -int32_t TimeDiff(uint32_t later, uint32_t earlier); - -// The number of milliseconds that have elapsed since 'earlier'. -inline int32_t TimeSince(uint32_t earlier) { - return TimeDiff(Time(), earlier); -} - -// The number of milliseconds that will elapse between now and 'later'. -inline int32_t TimeUntil(uint32_t later) { - return TimeDiff(later, Time()); -} - -// Converts a unix timestamp in nanoseconds to an NTP timestamp in ms. -inline int64_t UnixTimestampNanosecsToNtpMillisecs(int64_t unix_ts_ns) { - return unix_ts_ns / kNumNanosecsPerMillisec + kJan1970AsNtpMillisecs; -} - -class TimestampWrapAroundHandler { - public: - TimestampWrapAroundHandler(); - - int64_t Unwrap(uint32_t ts); - - private: - uint32_t last_ts_; - int64_t num_wrap_; -}; - -// Convert from std::tm, which is relative to 1900-01-01 00:00 to number of -// seconds from 1970-01-01 00:00 ("epoch"). Don't return time_t since that -// is still 32 bits on many systems. -int64_t TmToSeconds(const std::tm& tm); - -} // namespace rtc - -#endif // WEBRTC_BASE_TIMEUTILS_H_ diff --git a/include/webrtc/base/timing.h b/include/webrtc/base/timing.h deleted file mode 100644 index 1dee607..0000000 --- a/include/webrtc/base/timing.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TIMING_H_ -#define WEBRTC_BASE_TIMING_H_ - -#if defined(WEBRTC_WIN) -#include "webrtc/base/win32.h" -#endif - -namespace rtc { - -class Timing { - public: - Timing(); - virtual ~Timing(); - - // WallTimeNow() returns the current wall-clock time in seconds, - // within 10 milliseconds resolution. - // WallTimeNow is static and does not require a timer_handle_ on Windows. - static double WallTimeNow(); - - // TimerNow() is like WallTimeNow(), but is monotonically - // increasing. It returns seconds in resolution of 10 microseconds - // or better. Although timer and wall-clock time have the same - // timing unit, they do not necessarily correlate because wall-clock - // time may be adjusted backwards, hence not monotonic. - // Made virtual so we can make a fake one. - virtual double TimerNow(); - - // BusyWait() exhausts CPU as long as the time elapsed is less than - // the specified interval in seconds. Returns the actual waiting - // time based on TimerNow() measurement. - double BusyWait(double period); - - // IdleWait() relinquishes control of CPU for specified period in - // seconds. It uses highest resolution sleep mechanism as possible, - // but does not otherwise guarantee the accuracy. Returns the - // actual waiting time based on TimerNow() measurement. - // - // This function is not re-entrant for an object. Create a fresh - // Timing object for each thread. - double IdleWait(double period); - - private: -#if defined(WEBRTC_WIN) - HANDLE timer_handle_; -#endif -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_TIMING_H_ diff --git a/include/webrtc/base/trace_event.h b/include/webrtc/base/trace_event.h deleted file mode 100644 index 3916af4..0000000 --- a/include/webrtc/base/trace_event.h +++ /dev/null @@ -1,916 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file under third_party_mods/chromium or at: -// http://src.chromium.org/svn/trunk/src/LICENSE - -#ifndef WEBRTC_BASE_TRACE_EVENT_H_ -#define WEBRTC_BASE_TRACE_EVENT_H_ - -#include - -#include "webrtc/base/event_tracer.h" - -#if defined(TRACE_EVENT0) -#error "Another copy of trace_event.h has already been included." -#endif - -// Extracted from Chromium's src/base/debug/trace_event.h. - -// This header is designed to give you trace_event macros without specifying -// how the events actually get collected and stored. If you need to expose trace -// event to some other universe, you can copy-and-paste this file, -// implement the TRACE_EVENT_API macros, and do any other necessary fixup for -// the target platform. The end result is that multiple libraries can funnel -// events through to a shared trace event collector. - -// Trace events are for tracking application performance and resource usage. -// Macros are provided to track: -// Begin and end of function calls -// Counters -// -// Events are issued against categories. Whereas LOG's -// categories are statically defined, TRACE categories are created -// implicitly with a string. For example: -// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent") -// -// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope: -// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly") -// doSomethingCostly() -// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly") -// Note: our tools can't always determine the correct BEGIN/END pairs unless -// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you -// need them to be in separate scopes. -// -// A common use case is to trace entire function scopes. This -// issues a trace BEGIN and END automatically: -// void doSomethingCostly() { -// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly"); -// ... -// } -// -// Additional parameters can be associated with an event: -// void doSomethingCostly2(int howMuch) { -// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly", -// "howMuch", howMuch); -// ... -// } -// -// The trace system will automatically add to this information the -// current process id, thread id, and a timestamp in microseconds. -// -// To trace an asynchronous procedure such as an IPC send/receive, use -// ASYNC_BEGIN and ASYNC_END: -// [single threaded sender code] -// static int send_count = 0; -// ++send_count; -// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count); -// Send(new MyMessage(send_count)); -// [receive code] -// void OnMyMessage(send_count) { -// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count); -// } -// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs. -// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process. -// Pointers can be used for the ID parameter, and they will be mangled -// internally so that the same pointer on two different processes will not -// match. For example: -// class MyTracedClass { -// public: -// MyTracedClass() { -// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this); -// } -// ~MyTracedClass() { -// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this); -// } -// } -// -// Trace event also supports counters, which is a way to track a quantity -// as it varies over time. Counters are created with the following macro: -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue); -// -// Counters are process-specific. The macro itself can be issued from any -// thread, however. -// -// Sometimes, you want to track two counters at once. You can do this with two -// counter macros: -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]); -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]); -// Or you can do it with a combined macro: -// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter", -// "bytesPinned", g_myCounterValue[0], -// "bytesAllocated", g_myCounterValue[1]); -// This indicates to the tracing UI that these counters should be displayed -// in a single graph, as a summed area chart. -// -// Since counters are in a global namespace, you may want to disembiguate with a -// unique ID, by using the TRACE_COUNTER_ID* variations. -// -// By default, trace collection is compiled in, but turned off at runtime. -// Collecting trace data is the responsibility of the embedding -// application. In Chrome's case, navigating to about:tracing will turn on -// tracing and display data collected across all active processes. -// -// -// Memory scoping note: -// Tracing copies the pointers, not the string content, of the strings passed -// in for category, name, and arg_names. Thus, the following code will -// cause problems: -// char* str = strdup("impprtantName"); -// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD! -// free(str); // Trace system now has dangling pointer -// -// To avoid this issue with the |name| and |arg_name| parameters, use the -// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime overhead. -// Notes: The category must always be in a long-lived char* (i.e. static const). -// The |arg_values|, when used, are always deep copied with the _COPY -// macros. -// -// When are string argument values copied: -// const char* arg_values are only referenced by default: -// TRACE_EVENT1("category", "name", -// "arg1", "literal string is only referenced"); -// Use TRACE_STR_COPY to force copying of a const char*: -// TRACE_EVENT1("category", "name", -// "arg1", TRACE_STR_COPY("string will be copied")); -// std::string arg_values are always copied: -// TRACE_EVENT1("category", "name", -// "arg1", std::string("string will be copied")); -// -// -// Thread Safety: -// Thread safety is provided by methods defined in event_tracer.h. See the file -// for details. - - -// By default, const char* argument values are assumed to have long-lived scope -// and will not be copied. Use this macro to force a const char* to be copied. -#define TRACE_STR_COPY(str) \ - webrtc::trace_event_internal::TraceStringWithCopy(str) - -// This will mark the trace event as disabled by default. The user will need -// to explicitly enable the event. -#define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name - -// By default, uint64 ID argument values are not mangled with the Process ID in -// TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. -#define TRACE_ID_MANGLE(id) \ - webrtc::trace_event_internal::TraceID::ForceMangle(id) - -// Records a pair of begin and end events called "name" for the current -// scope, with 0, 1 or 2 associated arguments. If the category is not -// enabled, then this does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT0(category, name) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name) -#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val) -#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Same as TRACE_EVENT except that they are not included in official builds. -#ifdef OFFICIAL_BUILD -#define UNSHIPPED_TRACE_EVENT0(category, name) (void)0 -#define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) (void)0 -#define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) (void)0 -#define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name) (void)0 -#define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \ - (void)0 -#define UNSHIPPED_TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) (void)0 -#else -#define UNSHIPPED_TRACE_EVENT0(category, name) \ - TRACE_EVENT0(category, name) -#define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) \ - TRACE_EVENT1(category, name, arg1_name, arg1_val) -#define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) -#define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name) \ - TRACE_EVENT_INSTANT0(category, name) -#define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \ - TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) -#define UNSHIPPED_TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#endif - -// Records a single event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_INSTANT0(category, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \ - category, name, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \ - category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \ - category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_INSTANT0(category, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \ - category, name, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \ - category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \ - category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Records a single BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_BEGIN0(category, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \ - category, name, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \ - category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \ - category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_BEGIN0(category, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \ - category, name, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \ - category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \ - category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Records a single END event for "name" immediately. If the category -// is not enabled, then this does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_END0(category, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ - category, name, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ - category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ - category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_END0(category, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ - category, name, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ - category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ - category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Records the value of a counter called "name" immediately. Value -// must be representable as a 32 bit integer. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_COUNTER1(category, name, value) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \ - category, name, TRACE_EVENT_FLAG_NONE, \ - "value", static_cast(value)) -#define TRACE_COPY_COUNTER1(category, name, value) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \ - category, name, TRACE_EVENT_FLAG_COPY, \ - "value", static_cast(value)) - -// Records the values of a multi-parted counter called "name" immediately. -// The UI will treat value1 and value2 as parts of a whole, displaying their -// values as a stacked-bar chart. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_COUNTER2(category, name, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \ - category, name, TRACE_EVENT_FLAG_NONE, \ - value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) -#define TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \ - category, name, TRACE_EVENT_FLAG_COPY, \ - value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) - -// Records the value of a counter called "name" immediately. Value -// must be representable as a 32 bit integer. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either -// be a pointer or an integer value up to 64 bits. If it's a pointer, the bits -// will be xored with a hash of the process ID so that the same pointer on -// two different processes will not collide. -#define TRACE_COUNTER_ID1(category, name, id, value) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ - category, name, id, TRACE_EVENT_FLAG_NONE, \ - "value", static_cast(value)) -#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - "value", static_cast(value)) - -// Records the values of a multi-parted counter called "name" immediately. -// The UI will treat value1 and value2 as parts of a whole, displaying their -// values as a stacked-bar chart. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either -// be a pointer or an integer value up to 64 bits. If it's a pointer, the bits -// will be xored with a hash of the process ID so that the same pointer on -// two different processes will not collide. -#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ - category, name, id, TRACE_EVENT_FLAG_NONE, \ - value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) -#define TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) - - -// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC -// events are considered to match if their category, name and id values all -// match. |id| must either be a pointer or an integer value up to 64 bits. If -// it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -// An asynchronous operation can consist of multiple phases. The first phase is -// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the -// ASYNC_STEP macros. When the operation completes, call ASYNC_END. -// An ASYNC trace typically occur on a single thread (if not, they will only be -// drawn on the thread defined in the ASYNC_BEGIN event), but all events in that -// operation must use the same |name| and |id|. Each event can have its own -// args. -#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val) -#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val, arg2_name, arg2_val) - -// Records a single ASYNC_STEP event for |step| immediately. If the category -// is not enabled, then this does nothing. The |name| and |id| must match the -// ASYNC_BEGIN event above. The |step| param identifies this step within the -// async event. This should be called at the beginning of the next phase of an -// asynchronous operation. -#define TRACE_EVENT_ASYNC_STEP0(category, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \ - category, name, id, TRACE_EVENT_FLAG_NONE, "step", step) -#define TRACE_EVENT_ASYNC_STEP1(category, name, id, step, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \ - category, name, id, TRACE_EVENT_FLAG_NONE, "step", step, \ - arg1_name, arg1_val) -#define TRACE_EVENT_COPY_ASYNC_STEP0(category, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \ - category, name, id, TRACE_EVENT_FLAG_COPY, "step", step) -#define TRACE_EVENT_COPY_ASYNC_STEP1(category, name, id, step, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \ - category, name, id, TRACE_EVENT_FLAG_COPY, "step", step, \ - arg1_name, arg1_val) - -// Records a single ASYNC_END event for "name" immediately. If the category -// is not enabled, then this does nothing. -#define TRACE_EVENT_ASYNC_END0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category, name, id, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category, name, id, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category, name, id, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val) -#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val, arg2_name, arg2_val) - - -// Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW -// events are considered to match if their category, name and id values all -// match. |id| must either be a pointer or an integer value up to 64 bits. If -// it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -// FLOW events are different from ASYNC events in how they are drawn by the -// tracing UI. A FLOW defines asynchronous data flow, such as posting a task -// (FLOW_BEGIN) and later executing that task (FLOW_END). Expect FLOWs to be -// drawn as lines or arrows from FLOW_BEGIN scopes to FLOW_END scopes. Similar -// to ASYNC, a FLOW can consist of multiple phases. The first phase is defined -// by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP -// macros. When the operation completes, call FLOW_END. An async operation can -// span threads and processes, but all events in that operation must use the -// same |name| and |id|. Each event can have its own args. -#define TRACE_EVENT_FLOW_BEGIN0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_FLOW_BEGIN1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_FLOW_BEGIN2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_FLOW_BEGIN0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_FLOW_BEGIN1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_BEGIN2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val, arg2_name, arg2_val) - -// Records a single FLOW_STEP event for |step| immediately. If the category -// is not enabled, then this does nothing. The |name| and |id| must match the -// FLOW_BEGIN event above. The |step| param identifies this step within the -// async event. This should be called at the beginning of the next phase of an -// asynchronous operation. -#define TRACE_EVENT_FLOW_STEP0(category, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category, name, id, TRACE_EVENT_FLAG_NONE, "step", step) -#define TRACE_EVENT_FLOW_STEP1(category, name, id, step, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category, name, id, TRACE_EVENT_FLAG_NONE, "step", step, \ - arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_STEP0(category, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category, name, id, TRACE_EVENT_FLAG_COPY, "step", step) -#define TRACE_EVENT_COPY_FLOW_STEP1(category, name, id, step, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category, name, id, TRACE_EVENT_FLAG_COPY, "step", step, \ - arg1_name, arg1_val) - -// Records a single FLOW_END event for "name" immediately. If the category -// is not enabled, then this does nothing. -#define TRACE_EVENT_FLOW_END0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ - category, name, id, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_FLOW_END1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_FLOW_END2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ - category, name, id, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_FLOW_END0(category, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ - category, name, id, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_FLOW_END1(category, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_END2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ - category, name, id, TRACE_EVENT_FLAG_COPY, \ - arg1_name, arg1_val, arg2_name, arg2_val) - - -//////////////////////////////////////////////////////////////////////////////// -// Implementation specific tracing API definitions. - -// Get a pointer to the enabled state of the given trace category. Only -// long-lived literal strings should be given as the category name. The returned -// pointer can be held permanently in a local static for example. If the -// unsigned char is non-zero, tracing is enabled. If tracing is enabled, -// TRACE_EVENT_API_ADD_TRACE_EVENT can be called. It's OK if tracing is disabled -// between the load of the tracing state and the call to -// TRACE_EVENT_API_ADD_TRACE_EVENT, because this flag only provides an early out -// for best performance when tracing is disabled. -// const unsigned char* -// TRACE_EVENT_API_GET_CATEGORY_ENABLED(const char* category_name) -#define TRACE_EVENT_API_GET_CATEGORY_ENABLED \ - webrtc::EventTracer::GetCategoryEnabled - -// Add a trace event to the platform tracing system. -// void TRACE_EVENT_API_ADD_TRACE_EVENT( -// char phase, -// const unsigned char* category_enabled, -// const char* name, -// unsigned long long id, -// int num_args, -// const char** arg_names, -// const unsigned char* arg_types, -// const unsigned long long* arg_values, -// unsigned char flags) -#define TRACE_EVENT_API_ADD_TRACE_EVENT webrtc::EventTracer::AddTraceEvent - -//////////////////////////////////////////////////////////////////////////////// - -// Implementation detail: trace event macros create temporary variables -// to keep instrumentation overhead low. These macros give each temporary -// variable a unique name based on the line number to prevent name collissions. -#define INTERNAL_TRACE_EVENT_UID3(a,b) \ - trace_event_unique_##a##b -#define INTERNAL_TRACE_EVENT_UID2(a,b) \ - INTERNAL_TRACE_EVENT_UID3(a,b) -#define INTERNAL_TRACE_EVENT_UID(name_prefix) \ - INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__) - -// Implementation detail: internal macro to create static category. -#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category) \ - static const unsigned char* INTERNAL_TRACE_EVENT_UID(catstatic) = 0; \ - if (!INTERNAL_TRACE_EVENT_UID(catstatic)) { \ - INTERNAL_TRACE_EVENT_UID(catstatic) = \ - TRACE_EVENT_API_GET_CATEGORY_ENABLED(category); \ - } - -// Implementation detail: internal macro to create static category and add -// event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD(phase, category, name, flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ - if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ - webrtc::trace_event_internal::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(catstatic), name, \ - webrtc::trace_event_internal::kNoEventId, flags, ##__VA_ARGS__); \ - } \ - } while (0) - -// Implementation detail: internal macro to create static category and add begin -// event if the category is enabled. Also adds the end event when the scope -// ends. -#define INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, ...) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ - webrtc::trace_event_internal::TraceEndOnScopeClose \ - INTERNAL_TRACE_EVENT_UID(profileScope); \ - if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ - webrtc::trace_event_internal::AddTraceEvent( \ - TRACE_EVENT_PHASE_BEGIN, \ - INTERNAL_TRACE_EVENT_UID(catstatic), \ - name, webrtc::trace_event_internal::kNoEventId, \ - TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \ - INTERNAL_TRACE_EVENT_UID(profileScope).Initialize( \ - INTERNAL_TRACE_EVENT_UID(catstatic), name); \ - } - -// Implementation detail: internal macro to create static category and add -// event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category, name, id, flags, \ - ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ - if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ - unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ - webrtc::trace_event_internal::TraceID trace_event_trace_id( \ - id, &trace_event_flags); \ - webrtc::trace_event_internal::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(catstatic), \ - name, trace_event_trace_id.data(), trace_event_flags, \ - ##__VA_ARGS__); \ - } \ - } while (0) - -// Notes regarding the following definitions: -// New values can be added and propagated to third party libraries, but existing -// definitions must never be changed, because third party libraries may use old -// definitions. - -// Phase indicates the nature of an event entry. E.g. part of a begin/end pair. -#define TRACE_EVENT_PHASE_BEGIN ('B') -#define TRACE_EVENT_PHASE_END ('E') -#define TRACE_EVENT_PHASE_INSTANT ('I') -#define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') -#define TRACE_EVENT_PHASE_ASYNC_STEP ('T') -#define TRACE_EVENT_PHASE_ASYNC_END ('F') -#define TRACE_EVENT_PHASE_FLOW_BEGIN ('s') -#define TRACE_EVENT_PHASE_FLOW_STEP ('t') -#define TRACE_EVENT_PHASE_FLOW_END ('f') -#define TRACE_EVENT_PHASE_METADATA ('M') -#define TRACE_EVENT_PHASE_COUNTER ('C') - -// Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. -#define TRACE_EVENT_FLAG_NONE (static_cast(0)) -#define TRACE_EVENT_FLAG_COPY (static_cast(1 << 0)) -#define TRACE_EVENT_FLAG_HAS_ID (static_cast(1 << 1)) -#define TRACE_EVENT_FLAG_MANGLE_ID (static_cast(1 << 2)) - -// Type values for identifying types in the TraceValue union. -#define TRACE_VALUE_TYPE_BOOL (static_cast(1)) -#define TRACE_VALUE_TYPE_UINT (static_cast(2)) -#define TRACE_VALUE_TYPE_INT (static_cast(3)) -#define TRACE_VALUE_TYPE_DOUBLE (static_cast(4)) -#define TRACE_VALUE_TYPE_POINTER (static_cast(5)) -#define TRACE_VALUE_TYPE_STRING (static_cast(6)) -#define TRACE_VALUE_TYPE_COPY_STRING (static_cast(7)) - -namespace webrtc { -namespace trace_event_internal { - -// Specify these values when the corresponding argument of AddTraceEvent is not -// used. -const int kZeroNumArgs = 0; -const unsigned long long kNoEventId = 0; - -// TraceID encapsulates an ID that can either be an integer or pointer. Pointers -// are mangled with the Process ID so that they are unlikely to collide when the -// same pointer is used on different processes. -class TraceID { - public: - class ForceMangle { - public: - explicit ForceMangle(unsigned long long id) : data_(id) {} - explicit ForceMangle(unsigned long id) : data_(id) {} - explicit ForceMangle(unsigned int id) : data_(id) {} - explicit ForceMangle(unsigned short id) : data_(id) {} - explicit ForceMangle(unsigned char id) : data_(id) {} - explicit ForceMangle(long long id) - : data_(static_cast(id)) {} - explicit ForceMangle(long id) - : data_(static_cast(id)) {} - explicit ForceMangle(int id) - : data_(static_cast(id)) {} - explicit ForceMangle(short id) - : data_(static_cast(id)) {} - explicit ForceMangle(signed char id) - : data_(static_cast(id)) {} - - unsigned long long data() const { return data_; } - - private: - unsigned long long data_; - }; - - explicit TraceID(const void* id, unsigned char* flags) - : data_(static_cast( - reinterpret_cast(id))) { - *flags |= TRACE_EVENT_FLAG_MANGLE_ID; - } - explicit TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) { - *flags |= TRACE_EVENT_FLAG_MANGLE_ID; - } - explicit TraceID(unsigned long long id, unsigned char* flags) - : data_(id) { (void)flags; } - explicit TraceID(unsigned long id, unsigned char* flags) - : data_(id) { (void)flags; } - explicit TraceID(unsigned int id, unsigned char* flags) - : data_(id) { (void)flags; } - explicit TraceID(unsigned short id, unsigned char* flags) - : data_(id) { (void)flags; } - explicit TraceID(unsigned char id, unsigned char* flags) - : data_(id) { (void)flags; } - explicit TraceID(long long id, unsigned char* flags) - : data_(static_cast(id)) { (void)flags; } - explicit TraceID(long id, unsigned char* flags) - : data_(static_cast(id)) { (void)flags; } - explicit TraceID(int id, unsigned char* flags) - : data_(static_cast(id)) { (void)flags; } - explicit TraceID(short id, unsigned char* flags) - : data_(static_cast(id)) { (void)flags; } - explicit TraceID(signed char id, unsigned char* flags) - : data_(static_cast(id)) { (void)flags; } - - unsigned long long data() const { return data_; } - - private: - unsigned long long data_; -}; - -// Simple union to store various types as unsigned long long. -union TraceValueUnion { - bool as_bool; - unsigned long long as_uint; - long long as_int; - double as_double; - const void* as_pointer; - const char* as_string; -}; - -// Simple container for const char* that should be copied instead of retained. -class TraceStringWithCopy { - public: - explicit TraceStringWithCopy(const char* str) : str_(str) {} - operator const char* () const { return str_; } - private: - const char* str_; -}; - -// Define SetTraceValue for each allowed type. It stores the type and -// value in the return arguments. This allows this API to avoid declaring any -// structures so that it is portable to third_party libraries. -#define INTERNAL_DECLARE_SET_TRACE_VALUE(actual_type, \ - union_member, \ - value_type_id) \ - static inline void SetTraceValue(actual_type arg, \ - unsigned char* type, \ - unsigned long long* value) { \ - TraceValueUnion type_value; \ - type_value.union_member = arg; \ - *type = value_type_id; \ - *value = type_value.as_uint; \ - } -// Simpler form for int types that can be safely casted. -#define INTERNAL_DECLARE_SET_TRACE_VALUE_INT(actual_type, \ - value_type_id) \ - static inline void SetTraceValue(actual_type arg, \ - unsigned char* type, \ - unsigned long long* value) { \ - *type = value_type_id; \ - *value = static_cast(arg); \ - } - -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned long long, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned long, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned int, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned short, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned char, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(long long, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(long, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(int, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(short, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(signed char, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE(bool, as_bool, TRACE_VALUE_TYPE_BOOL) -INTERNAL_DECLARE_SET_TRACE_VALUE(double, as_double, TRACE_VALUE_TYPE_DOUBLE) -INTERNAL_DECLARE_SET_TRACE_VALUE(const void*, as_pointer, - TRACE_VALUE_TYPE_POINTER) -INTERNAL_DECLARE_SET_TRACE_VALUE(const char*, as_string, - TRACE_VALUE_TYPE_STRING) -INTERNAL_DECLARE_SET_TRACE_VALUE(const TraceStringWithCopy&, as_string, - TRACE_VALUE_TYPE_COPY_STRING) - -#undef INTERNAL_DECLARE_SET_TRACE_VALUE -#undef INTERNAL_DECLARE_SET_TRACE_VALUE_INT - -// std::string version of SetTraceValue so that trace arguments can be strings. -static inline void SetTraceValue(const std::string& arg, - unsigned char* type, - unsigned long long* value) { - TraceValueUnion type_value; - type_value.as_string = arg.c_str(); - *type = TRACE_VALUE_TYPE_COPY_STRING; - *value = type_value.as_uint; -} - -// These AddTraceEvent template functions are defined here instead of in the -// macro, because the arg_values could be temporary objects, such as -// std::string. In order to store pointers to the internal c_str and pass -// through to the tracing API, the arg_values must live throughout -// these procedures. - -static inline void AddTraceEvent(char phase, - const unsigned char* category_enabled, - const char* name, - unsigned long long id, - unsigned char flags) { - TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_enabled, name, id, - kZeroNumArgs, NULL, NULL, NULL, - flags); -} - -template -static inline void AddTraceEvent(char phase, - const unsigned char* category_enabled, - const char* name, - unsigned long long id, - unsigned char flags, - const char* arg1_name, - const ARG1_TYPE& arg1_val) { - const int num_args = 1; - unsigned char arg_types[1]; - unsigned long long arg_values[1]; - SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); - TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_enabled, name, id, - num_args, &arg1_name, arg_types, arg_values, - flags); -} - -template -static inline void AddTraceEvent(char phase, - const unsigned char* category_enabled, - const char* name, - unsigned long long id, - unsigned char flags, - const char* arg1_name, - const ARG1_TYPE& arg1_val, - const char* arg2_name, - const ARG2_TYPE& arg2_val) { - const int num_args = 2; - const char* arg_names[2] = { arg1_name, arg2_name }; - unsigned char arg_types[2]; - unsigned long long arg_values[2]; - SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); - SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); - TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_enabled, name, id, - num_args, arg_names, arg_types, arg_values, - flags); -} - -// Used by TRACE_EVENTx macro. Do not use directly. -class TraceEndOnScopeClose { - public: - // Note: members of data_ intentionally left uninitialized. See Initialize. - TraceEndOnScopeClose() : p_data_(NULL) {} - ~TraceEndOnScopeClose() { - if (p_data_) - AddEventIfEnabled(); - } - - void Initialize(const unsigned char* category_enabled, - const char* name) { - data_.category_enabled = category_enabled; - data_.name = name; - p_data_ = &data_; - } - - private: - // Add the end event if the category is still enabled. - void AddEventIfEnabled() { - // Only called when p_data_ is non-null. - if (*p_data_->category_enabled) { - TRACE_EVENT_API_ADD_TRACE_EVENT( - TRACE_EVENT_PHASE_END, - p_data_->category_enabled, - p_data_->name, kNoEventId, - kZeroNumArgs, NULL, NULL, NULL, - TRACE_EVENT_FLAG_NONE); - } - } - - // This Data struct workaround is to avoid initializing all the members - // in Data during construction of this object, since this object is always - // constructed, even when tracing is disabled. If the members of Data were - // members of this class instead, compiler warnings occur about potential - // uninitialized accesses. - struct Data { - const unsigned char* category_enabled; - const char* name; - }; - Data* p_data_; - Data data_; -}; - -} // namespace trace_event_internal -} // namespace webrtc - -#endif // WEBRTC_BASE_TRACE_EVENT_H_ diff --git a/include/webrtc/base/transformadapter.h b/include/webrtc/base/transformadapter.h deleted file mode 100644 index 290d560..0000000 --- a/include/webrtc/base/transformadapter.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_TRANSFORMADAPTER_H__ -#define WEBRTC_BASE_TRANSFORMADAPTER_H__ - -#include "webrtc/base/stream.h" - -namespace rtc { -/////////////////////////////////////////////////////////////////////////////// - -class TransformInterface { -public: - virtual ~TransformInterface() { } - - // Transform should convert the in_len bytes of input into the out_len-sized - // output buffer. If flush is true, there will be no more data following - // input. - // After the transformation, in_len contains the number of bytes consumed, and - // out_len contains the number of bytes ready in output. - // Note: Transform should not return SR_BLOCK, as there is no asynchronous - // notification available. - virtual StreamResult Transform(const void * input, size_t * in_len, - void * output, size_t * out_len, - bool flush) = 0; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// TransformAdapter causes all data passed through to be transformed by the -// supplied TransformInterface object, which may apply compression, encryption, -// etc. - -class TransformAdapter : public StreamAdapterInterface { -public: - // Note that the transformation is unidirectional, in the direction specified - // by the constructor. Operations in the opposite direction result in SR_EOS. - TransformAdapter(StreamInterface * stream, - TransformInterface * transform, - bool direction_read); - ~TransformAdapter() override; - - StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - void Close() override; - - // Apriori, we can't tell what the transformation does to the stream length. - bool GetAvailable(size_t* size) const override; - bool ReserveSize(size_t size) override; - - // Transformations might not be restartable - virtual bool Rewind(); - -private: - enum State { ST_PROCESSING, ST_FLUSHING, ST_COMPLETE, ST_ERROR }; - enum { BUFFER_SIZE = 1024 }; - - TransformInterface * transform_; - bool direction_read_; - State state_; - int error_; - - char buffer_[BUFFER_SIZE]; - size_t len_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_TRANSFORMADAPTER_H__ diff --git a/include/webrtc/base/unixfilesystem.h b/include/webrtc/base/unixfilesystem.h deleted file mode 100644 index dbfbaf0..0000000 --- a/include/webrtc/base/unixfilesystem.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_UNIXFILESYSTEM_H_ -#define WEBRTC_BASE_UNIXFILESYSTEM_H_ - -#include - -#include "webrtc/base/fileutils.h" - -namespace rtc { - -class UnixFilesystem : public FilesystemInterface { - public: - UnixFilesystem(); - ~UnixFilesystem() override; - -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) - // Android does not have a native code API to fetch the app data or temp - // folders. That needs to be passed into this class from Java. Similarly, iOS - // only supports an Objective-C API for fetching the folder locations, so that - // needs to be passed in here from Objective-C. Or at least that used to be - // the case; now the ctor will do the work if necessary and possible. - // TODO(fischman): add an Android version that uses JNI and drop the - // SetApp*Folder() APIs once external users stop using them. - static void SetAppDataFolder(const std::string& folder); - static void SetAppTempFolder(const std::string& folder); -#endif - - // Opens a file. Returns an open StreamInterface if function succeeds. - // Otherwise, returns NULL. - FileStream* OpenFile(const Pathname& filename, - const std::string& mode) override; - - // Atomically creates an empty file accessible only to the current user if one - // does not already exist at the given path, otherwise fails. - bool CreatePrivateFile(const Pathname& filename) override; - - // This will attempt to delete the file located at filename. - // It will fail with VERIY if you pass it a non-existant file, or a directory. - bool DeleteFile(const Pathname& filename) override; - - // This will attempt to delete the folder located at 'folder' - // It ASSERTs and returns false if you pass it a non-existant folder or a - // plain file. - bool DeleteEmptyFolder(const Pathname& folder) override; - - // Creates a directory. This will call itself recursively to create /foo/bar - // even if /foo does not exist. All created directories are created with the - // given mode. - // Returns TRUE if function succeeds - virtual bool CreateFolder(const Pathname &pathname, mode_t mode); - - // As above, with mode = 0755. - bool CreateFolder(const Pathname& pathname) override; - - // This moves a file from old_path to new_path, where "file" can be a plain - // file or directory, which will be moved recursively. - // Returns true if function succeeds. - bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; - bool MoveFolder(const Pathname& old_path, const Pathname& new_path) override; - - // This copies a file from old_path to _new_path where "file" can be a plain - // file or directory, which will be copied recursively. - // Returns true if function succeeds - bool CopyFile(const Pathname& old_path, const Pathname& new_path) override; - - // Returns true if a pathname is a directory - bool IsFolder(const Pathname& pathname) override; - - // Returns true if pathname represents a temporary location on the system. - bool IsTemporaryPath(const Pathname& pathname) override; - - // Returns true of pathname represents an existing file - bool IsFile(const Pathname& pathname) override; - - // Returns true if pathname refers to no filesystem object, every parent - // directory either exists, or is also absent. - bool IsAbsent(const Pathname& pathname) override; - - std::string TempFilename(const Pathname& dir, - const std::string& prefix) override; - - // A folder appropriate for storing temporary files (Contents are - // automatically deleted when the program exists) - bool GetTemporaryFolder(Pathname& path, - bool create, - const std::string* append) override; - - bool GetFileSize(const Pathname& path, size_t* size) override; - bool GetFileTime(const Pathname& path, - FileTimeType which, - time_t* time) override; - - // Returns the path to the running application. - bool GetAppPathname(Pathname* path) override; - - bool GetAppDataFolder(Pathname* path, bool per_user) override; - - // Get a temporary folder that is unique to the current user and application. - bool GetAppTempFolder(Pathname* path) override; - - bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) override; - - // Returns the absolute path of the current directory. - Pathname GetCurrentDirectory() override; - - private: -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) - static char* provided_app_data_folder_; - static char* provided_app_temp_folder_; -#else - static char* app_temp_path_; -#endif - - static char* CopyString(const std::string& str); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_UNIXFILESYSTEM_H_ diff --git a/include/webrtc/base/urlencode.h b/include/webrtc/base/urlencode.h deleted file mode 100644 index fc10f38..0000000 --- a/include/webrtc/base/urlencode.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef _URLENCODE_H_ -#define _URLENCODE_H_ - -#include - -namespace rtc { - -// Decode all encoded characters. Also decode + as space. -int UrlDecode(const char *source, char *dest); - -// Decode all encoded characters. -int UrlDecodeWithoutEncodingSpaceAsPlus(const char *source, char *dest); - -// Encode all characters except alphas, numbers, and -_.!~*'() -// Also encode space as +. -int UrlEncode(const char *source, char *dest, unsigned max); - -// Encode all characters except alphas, numbers, and -_.!~*'() -int UrlEncodeWithoutEncodingSpaceAsPlus(const char *source, char *dest, - unsigned max); - -// Encode only unsafe chars, including \ "^&`<>[]{} -// Also encode space as %20, instead of + -int UrlEncodeOnlyUnsafeChars(const char *source, char *dest, unsigned max); - -std::string UrlDecodeString(const std::string & encoded); -std::string UrlDecodeStringWithoutEncodingSpaceAsPlus( - const std::string & encoded); -std::string UrlEncodeString(const std::string & decoded); -std::string UrlEncodeStringWithoutEncodingSpaceAsPlus( - const std::string & decoded); -std::string UrlEncodeStringForOnlyUnsafeChars(const std::string & decoded); - -#endif - -} // namespace rtc diff --git a/include/webrtc/base/versionparsing.h b/include/webrtc/base/versionparsing.h deleted file mode 100644 index be2d332..0000000 --- a/include/webrtc/base/versionparsing.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_VERSIONPARSING_H_ -#define WEBRTC_BASE_VERSIONPARSING_H_ - -#include - -namespace rtc { - -// Parses a version string into an array. "num_expected_segments" must be the -// number of numerical segments that the version is expected to have (e.g., -// "1.1.2.0" has 4). "version" must be an array of that length to hold the -// parsed numbers. -// Returns "true" iff successful. -bool ParseVersionString(const std::string& version_str, - int num_expected_segments, - int version[]); - -// Computes the lexicographical order of two versions. The return value -// indicates the order in the standard way (e.g., see strcmp()). -int CompareVersions(const int version1[], - const int version2[], - int num_segments); - -} // namespace rtc - -#endif // WEBRTC_BASE_VERSIONPARSING_H_ diff --git a/include/webrtc/base/virtualsocketserver.h b/include/webrtc/base/virtualsocketserver.h deleted file mode 100644 index daf0145..0000000 --- a/include/webrtc/base/virtualsocketserver.h +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ -#define WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ - -#include - -#include -#include - -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/socketserver.h" - -namespace rtc { - -class Packet; -class VirtualSocket; -class SocketAddressPair; - -// Simulates a network in the same manner as a loopback interface. The -// interface can create as many addresses as you want. All of the sockets -// created by this network will be able to communicate with one another, unless -// they are bound to addresses from incompatible families. -class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> { - public: - // TODO: Add "owned" parameter. - // If "owned" is set, the supplied socketserver will be deleted later. - explicit VirtualSocketServer(SocketServer* ss); - ~VirtualSocketServer() override; - - SocketServer* socketserver() { return server_; } - - // The default route indicates which local address to use when a socket is - // bound to the 'any' address, e.g. 0.0.0.0. - IPAddress GetDefaultRoute(int family); - void SetDefaultRoute(const IPAddress& from_addr); - - // Limits the network bandwidth (maximum bytes per second). Zero means that - // all sends occur instantly. Defaults to 0. - uint32_t bandwidth() const { return bandwidth_; } - void set_bandwidth(uint32_t bandwidth) { bandwidth_ = bandwidth; } - - // Limits the amount of data which can be in flight on the network without - // packet loss (on a per sender basis). Defaults to 64 KB. - uint32_t network_capacity() const { return network_capacity_; } - void set_network_capacity(uint32_t capacity) { network_capacity_ = capacity; } - - // The amount of data which can be buffered by tcp on the sender's side - uint32_t send_buffer_capacity() const { return send_buffer_capacity_; } - void set_send_buffer_capacity(uint32_t capacity) { - send_buffer_capacity_ = capacity; - } - - // The amount of data which can be buffered by tcp on the receiver's side - uint32_t recv_buffer_capacity() const { return recv_buffer_capacity_; } - void set_recv_buffer_capacity(uint32_t capacity) { - recv_buffer_capacity_ = capacity; - } - - // Controls the (transit) delay for packets sent in the network. This does - // not inclue the time required to sit in the send queue. Both of these - // values are measured in milliseconds. Defaults to no delay. - uint32_t delay_mean() const { return delay_mean_; } - uint32_t delay_stddev() const { return delay_stddev_; } - uint32_t delay_samples() const { return delay_samples_; } - void set_delay_mean(uint32_t delay_mean) { delay_mean_ = delay_mean; } - void set_delay_stddev(uint32_t delay_stddev) { delay_stddev_ = delay_stddev; } - void set_delay_samples(uint32_t delay_samples) { - delay_samples_ = delay_samples; - } - - // If the (transit) delay parameters are modified, this method should be - // called to recompute the new distribution. - void UpdateDelayDistribution(); - - // Controls the (uniform) probability that any sent packet is dropped. This - // is separate from calculations to drop based on queue size. - double drop_probability() { return drop_prob_; } - void set_drop_probability(double drop_prob) { - assert((0 <= drop_prob) && (drop_prob <= 1)); - drop_prob_ = drop_prob; - } - - // SocketFactory: - Socket* CreateSocket(int type) override; - Socket* CreateSocket(int family, int type) override; - - AsyncSocket* CreateAsyncSocket(int type) override; - AsyncSocket* CreateAsyncSocket(int family, int type) override; - - // SocketServer: - void SetMessageQueue(MessageQueue* queue) override; - bool Wait(int cms, bool process_io) override; - void WakeUp() override; - - typedef std::pair Point; - typedef std::vector Function; - - static Function* CreateDistribution(uint32_t mean, - uint32_t stddev, - uint32_t samples); - - // Similar to Thread::ProcessMessages, but it only processes messages until - // there are no immediate messages or pending network traffic. Returns false - // if Thread::Stop() was called. - bool ProcessMessagesUntilIdle(); - - // Sets the next port number to use for testing. - void SetNextPortForTesting(uint16_t port); - - // Close a pair of Tcp connections by addresses. Both connections will have - // its own OnClose invoked. - bool CloseTcpConnections(const SocketAddress& addr_local, - const SocketAddress& addr_remote); - - protected: - // Returns a new IP not used before in this network. - IPAddress GetNextIP(int family); - uint16_t GetNextPort(); - - VirtualSocket* CreateSocketInternal(int family, int type); - - // Binds the given socket to addr, assigning and IP and Port if necessary - int Bind(VirtualSocket* socket, SocketAddress* addr); - - // Binds the given socket to the given (fully-defined) address. - int Bind(VirtualSocket* socket, const SocketAddress& addr); - - // Find the socket bound to the given address - VirtualSocket* LookupBinding(const SocketAddress& addr); - - int Unbind(const SocketAddress& addr, VirtualSocket* socket); - - // Adds a mapping between this socket pair and the socket. - void AddConnection(const SocketAddress& client, - const SocketAddress& server, - VirtualSocket* socket); - - // Find the socket pair corresponding to this server address. - VirtualSocket* LookupConnection(const SocketAddress& client, - const SocketAddress& server); - - void RemoveConnection(const SocketAddress& client, - const SocketAddress& server); - - // Connects the given socket to the socket at the given address - int Connect(VirtualSocket* socket, const SocketAddress& remote_addr, - bool use_delay); - - // Sends a disconnect message to the socket at the given address - bool Disconnect(VirtualSocket* socket); - - // Sends the given packet to the socket at the given address (if one exists). - int SendUdp(VirtualSocket* socket, const char* data, size_t data_size, - const SocketAddress& remote_addr); - - // Moves as much data as possible from the sender's buffer to the network - void SendTcp(VirtualSocket* socket); - - // Places a packet on the network. - void AddPacketToNetwork(VirtualSocket* socket, - VirtualSocket* recipient, - uint32_t cur_time, - const char* data, - size_t data_size, - size_t header_size, - bool ordered); - - // Removes stale packets from the network - void PurgeNetworkPackets(VirtualSocket* socket, uint32_t cur_time); - - // Computes the number of milliseconds required to send a packet of this size. - uint32_t SendDelay(uint32_t size); - - // Returns a random transit delay chosen from the appropriate distribution. - uint32_t GetRandomTransitDelay(); - - // Basic operations on functions. Those that return a function also take - // ownership of the function given (and hence, may modify or delete it). - static Function* Accumulate(Function* f); - static Function* Invert(Function* f); - static Function* Resample(Function* f, - double x1, - double x2, - uint32_t samples); - static double Evaluate(Function* f, double x); - - // NULL out our message queue if it goes away. Necessary in the case where - // our lifetime is greater than that of the thread we are using, since we - // try to send Close messages for all connected sockets when we shutdown. - void OnMessageQueueDestroyed() { msg_queue_ = NULL; } - - // Determine if two sockets should be able to communicate. - // We don't (currently) specify an address family for sockets; instead, - // the currently bound address is used to infer the address family. - // Any socket that is not explicitly bound to an IPv4 address is assumed to be - // dual-stack capable. - // This function tests if two addresses can communicate, as well as the - // sockets to which they may be bound (the addresses may or may not yet be - // bound to the sockets). - // First the addresses are tested (after normalization): - // If both have the same family, then communication is OK. - // If only one is IPv4 then false, unless the other is bound to ::. - // This applies even if the IPv4 address is 0.0.0.0. - // The socket arguments are optional; the sockets are checked to see if they - // were explicitly bound to IPv6-any ('::'), and if so communication is - // permitted. - // NB: This scheme doesn't permit non-dualstack IPv6 sockets. - static bool CanInteractWith(VirtualSocket* local, VirtualSocket* remote); - - private: - friend class VirtualSocket; - - typedef std::map AddressMap; - typedef std::map ConnectionMap; - - SocketServer* server_; - bool server_owned_; - MessageQueue* msg_queue_; - bool stop_on_idle_; - uint32_t network_delay_; - in_addr next_ipv4_; - in6_addr next_ipv6_; - uint16_t next_port_; - AddressMap* bindings_; - ConnectionMap* connections_; - - IPAddress default_route_v4_; - IPAddress default_route_v6_; - - uint32_t bandwidth_; - uint32_t network_capacity_; - uint32_t send_buffer_capacity_; - uint32_t recv_buffer_capacity_; - uint32_t delay_mean_; - uint32_t delay_stddev_; - uint32_t delay_samples_; - Function* delay_dist_; - CriticalSection delay_crit_; - - double drop_prob_; - RTC_DISALLOW_COPY_AND_ASSIGN(VirtualSocketServer); -}; - -// Implements the socket interface using the virtual network. Packets are -// passed as messages using the message queue of the socket server. -class VirtualSocket : public AsyncSocket, public MessageHandler { - public: - VirtualSocket(VirtualSocketServer* server, int family, int type, bool async); - ~VirtualSocket() override; - - SocketAddress GetLocalAddress() const override; - SocketAddress GetRemoteAddress() const override; - - // Used by TurnPortTest to mimic a case where proxy returns local host address - // instead of the original one TurnPort was bound against. Please see WebRTC - // issue 3927 for more detail. - void SetAlternativeLocalAddress(const SocketAddress& addr); - - int Bind(const SocketAddress& addr) override; - int Connect(const SocketAddress& addr) override; - int Close() override; - int Send(const void* pv, size_t cb) override; - int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override; - int Recv(void* pv, size_t cb) override; - int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override; - int Listen(int backlog) override; - VirtualSocket* Accept(SocketAddress* paddr) override; - - int GetError() const override; - void SetError(int error) override; - ConnState GetState() const override; - int GetOption(Option opt, int* value) override; - int SetOption(Option opt, int value) override; - int EstimateMTU(uint16_t* mtu) override; - void OnMessage(Message* pmsg) override; - - bool was_any() { return was_any_; } - void set_was_any(bool was_any) { was_any_ = was_any; } - - // For testing purpose only. Fired when client socket is bound to an address. - sigslot::signal2 SignalAddressReady; - - private: - struct NetworkEntry { - size_t size; - uint32_t done_time; - }; - - typedef std::deque ListenQueue; - typedef std::deque NetworkQueue; - typedef std::vector SendBuffer; - typedef std::list RecvBuffer; - typedef std::map OptionsMap; - - int InitiateConnect(const SocketAddress& addr, bool use_delay); - void CompleteConnect(const SocketAddress& addr, bool notify); - int SendUdp(const void* pv, size_t cb, const SocketAddress& addr); - int SendTcp(const void* pv, size_t cb); - - // Used by server sockets to set the local address without binding. - void SetLocalAddress(const SocketAddress& addr); - - VirtualSocketServer* server_; - int type_; - bool async_; - ConnState state_; - int error_; - SocketAddress local_addr_; - SocketAddress alternative_local_addr_; - SocketAddress remote_addr_; - - // Pending sockets which can be Accepted - ListenQueue* listen_queue_; - - // Data which tcp has buffered for sending - SendBuffer send_buffer_; - bool write_enabled_; - - // Critical section to protect the recv_buffer and queue_ - CriticalSection crit_; - - // Network model that enforces bandwidth and capacity constraints - NetworkQueue network_; - size_t network_size_; - - // Data which has been received from the network - RecvBuffer recv_buffer_; - // The amount of data which is in flight or in recv_buffer_ - size_t recv_buffer_size_; - - // Is this socket bound? - bool bound_; - - // When we bind a socket to Any, VSS's Bind gives it another address. For - // dual-stack sockets, we want to distinguish between sockets that were - // explicitly given a particular address and sockets that had one picked - // for them by VSS. - bool was_any_; - - // Store the options that are set - OptionsMap options_map_; - - friend class VirtualSocketServer; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ diff --git a/include/webrtc/base/win32.h b/include/webrtc/base/win32.h deleted file mode 100644 index dba9b77..0000000 --- a/include/webrtc/base/win32.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WIN32_H_ -#define WEBRTC_BASE_WIN32_H_ - -#if defined(WEBRTC_WIN) - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -// Make sure we don't get min/max macros -#ifndef NOMINMAX -#define NOMINMAX -#endif - -#include -#include - -#ifndef SECURITY_MANDATORY_LABEL_AUTHORITY -// Add defines that we use if we are compiling against older sdks -#define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L) -#define TokenIntegrityLevel static_cast(0x19) -typedef struct _TOKEN_MANDATORY_LABEL { - SID_AND_ATTRIBUTES Label; -} TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL; -#endif // SECURITY_MANDATORY_LABEL_AUTHORITY - -#undef SetPort - -#include - -#include "webrtc/base/stringutils.h" -#include "webrtc/base/basictypes.h" - -namespace rtc { - -const char* win32_inet_ntop(int af, const void *src, char* dst, socklen_t size); -int win32_inet_pton(int af, const char* src, void *dst); - -inline std::wstring ToUtf16(const char* utf8, size_t len) { - int len16 = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast(len), - NULL, 0); - wchar_t* ws = STACK_ARRAY(wchar_t, len16); - ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast(len), ws, len16); - return std::wstring(ws, len16); -} - -inline std::wstring ToUtf16(const std::string& str) { - return ToUtf16(str.data(), str.length()); -} - -inline std::string ToUtf8(const wchar_t* wide, size_t len) { - int len8 = ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast(len), - NULL, 0, NULL, NULL); - char* ns = STACK_ARRAY(char, len8); - ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast(len), ns, len8, - NULL, NULL); - return std::string(ns, len8); -} - -inline std::string ToUtf8(const wchar_t* wide) { - return ToUtf8(wide, wcslen(wide)); -} - -inline std::string ToUtf8(const std::wstring& wstr) { - return ToUtf8(wstr.data(), wstr.length()); -} - -// Convert FILETIME to time_t -void FileTimeToUnixTime(const FILETIME& ft, time_t* ut); - -// Convert time_t to FILETIME -void UnixTimeToFileTime(const time_t& ut, FILETIME * ft); - -// Convert a Utf8 path representation to a non-length-limited Unicode pathname. -bool Utf8ToWindowsFilename(const std::string& utf8, std::wstring* filename); - -// Convert a FILETIME to a UInt64 -inline uint64_t ToUInt64(const FILETIME& ft) { - ULARGE_INTEGER r = {{ft.dwLowDateTime, ft.dwHighDateTime}}; - return r.QuadPart; -} - -enum WindowsMajorVersions { - kWindows2000 = 5, - kWindowsVista = 6, -}; -bool GetOsVersion(int* major, int* minor, int* build); - -inline bool IsWindowsVistaOrLater() { - int major; - return (GetOsVersion(&major, NULL, NULL) && major >= kWindowsVista); -} - -inline bool IsWindowsXpOrLater() { - int major, minor; - return (GetOsVersion(&major, &minor, NULL) && - (major >= kWindowsVista || - (major == kWindows2000 && minor >= 1))); -} - -inline bool IsWindows8OrLater() { - int major, minor; - return (GetOsVersion(&major, &minor, NULL) && - (major > kWindowsVista || - (major == kWindowsVista && minor >= 2))); -} - -// Determine the current integrity level of the process. -bool GetCurrentProcessIntegrityLevel(int* level); - -inline bool IsCurrentProcessLowIntegrity() { - int level; - return (GetCurrentProcessIntegrityLevel(&level) && - level < SECURITY_MANDATORY_MEDIUM_RID); -} - -bool AdjustCurrentProcessPrivilege(const TCHAR* privilege, bool to_enable); - -} // namespace rtc - -#endif // WEBRTC_WIN -#endif // WEBRTC_BASE_WIN32_H_ diff --git a/include/webrtc/base/win32filesystem.h b/include/webrtc/base/win32filesystem.h deleted file mode 100644 index 439b2c6..0000000 --- a/include/webrtc/base/win32filesystem.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef _WEBRTC_BASE_WIN32FILESYSTEM_H__ -#define _WEBRTC_BASE_WIN32FILESYSTEM_H__ - -#include "fileutils.h" - -namespace rtc { - -class Win32Filesystem : public FilesystemInterface { - public: - // Opens a file. Returns an open StreamInterface if function succeeds. Otherwise, - // returns NULL. - virtual FileStream *OpenFile(const Pathname &filename, - const std::string &mode); - - // Atomically creates an empty file accessible only to the current user if one - // does not already exist at the given path, otherwise fails. - virtual bool CreatePrivateFile(const Pathname &filename); - - // This will attempt to delete the path located at filename. - // If the path points to a folder, it will fail with VERIFY - virtual bool DeleteFile(const Pathname &filename); - - // This will attempt to delete an empty folder. If the path does not point to - // a folder, it fails with VERIFY. If the folder is not empty, it fails normally - virtual bool DeleteEmptyFolder(const Pathname &folder); - - // Creates a directory. This will call itself recursively to create /foo/bar even if - // /foo does not exist. - // Returns TRUE if function succeeds - virtual bool CreateFolder(const Pathname &pathname); - - // This moves a file from old_path to new_path. If the new path is on a - // different volume than the old, it will attempt to copy and then delete - // the folder - // Returns true if the file is successfully moved - virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path); - - // Moves a folder from old_path to new_path. If the new path is on a different - // volume from the old, it will attempt to Copy and then Delete the folder - // Returns true if the folder is successfully moved - virtual bool MoveFolder(const Pathname &old_path, const Pathname &new_path); - - // This copies a file from old_path to _new_path - // Returns true if function succeeds - virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path); - - // Returns true if a pathname is a directory - virtual bool IsFolder(const Pathname& pathname); - - // Returns true if a file exists at path - virtual bool IsFile(const Pathname &path); - - // Returns true if pathname refers to no filesystem object, every parent - // directory either exists, or is also absent. - virtual bool IsAbsent(const Pathname& pathname); - - // Returns true if pathname represents a temporary location on the system. - virtual bool IsTemporaryPath(const Pathname& pathname); - - // All of the following functions set pathname and return true if successful. - // Returned paths always include a trailing backslash. - // If create is true, the path will be recursively created. - // If append is non-NULL, it will be appended (and possibly created). - - virtual std::string TempFilename(const Pathname &dir, const std::string &prefix); - - virtual bool GetFileSize(const Pathname& path, size_t* size); - virtual bool GetFileTime(const Pathname& path, FileTimeType which, - time_t* time); - - // A folder appropriate for storing temporary files (Contents are - // automatically deleted when the program exists) - virtual bool GetTemporaryFolder(Pathname &path, bool create, - const std::string *append); - - // Returns the path to the running application. - virtual bool GetAppPathname(Pathname* path); - - virtual bool GetAppDataFolder(Pathname* path, bool per_user); - - // Get a temporary folder that is unique to the current user and application. - virtual bool GetAppTempFolder(Pathname* path); - - virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* free_bytes); - - virtual Pathname GetCurrentDirectory(); -}; - -} // namespace rtc - -#endif // WEBRTC_WINFILESYSTEM_H__ diff --git a/include/webrtc/base/win32regkey.h b/include/webrtc/base/win32regkey.h deleted file mode 100644 index d5c51b9..0000000 --- a/include/webrtc/base/win32regkey.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2003 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Registry configuration wrappers class -// -// Offers static functions for convenient -// fast access for individual values -// -// Also provides a wrapper class for efficient -// batch operations on values of a given registry key. -// - -#ifndef WEBRTC_BASE_WIN32REGKEY_H_ -#define WEBRTC_BASE_WIN32REGKEY_H_ - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/win32.h" - -namespace rtc { - -// maximum sizes registry key and value names -const int kMaxKeyNameChars = 255 + 1; -const int kMaxValueNameChars = 16383 + 1; - -class RegKey { - public: - // constructor - RegKey(); - - // destructor - ~RegKey(); - - // create a reg key - HRESULT Create(HKEY parent_key, const wchar_t* key_name); - - HRESULT Create(HKEY parent_key, - const wchar_t* key_name, - wchar_t* reg_class, - DWORD options, - REGSAM sam_desired, - LPSECURITY_ATTRIBUTES lp_sec_attr, - LPDWORD lp_disposition); - - // open an existing reg key - HRESULT Open(HKEY parent_key, const wchar_t* key_name); - - HRESULT Open(HKEY parent_key, const wchar_t* key_name, REGSAM sam_desired); - - // close this reg key - HRESULT Close(); - - // check if the key has a specified value - bool HasValue(const wchar_t* value_name) const; - - // get the number of values for this key - uint32_t GetValueCount(); - - // Called to get the value name for the given value name index - // Use GetValueCount() to get the total value_name count for this key - // Returns failure if no key at the specified index - // If you modify the key while enumerating, the indexes will be out of order. - // Since the index order is not guaranteed, you need to reset your counting - // loop. - // 'type' refers to REG_DWORD, REG_QWORD, etc.. - // 'type' can be NULL if not interested in the value type - HRESULT GetValueNameAt(int index, std::wstring* value_name, DWORD* type); - - // check if the current key has the specified subkey - bool HasSubkey(const wchar_t* key_name) const; - - // get the number of subkeys for this key - uint32_t GetSubkeyCount(); - - // Called to get the key name for the given key index - // Use GetSubkeyCount() to get the total count for this key - // Returns failure if no key at the specified index - // If you modify the key while enumerating, the indexes will be out of order. - // Since the index order is not guaranteed, you need to reset your counting - // loop. - HRESULT GetSubkeyNameAt(int index, std::wstring* key_name); - - // SETTERS - - // set an int32_t value - use when reading multiple values from a key - HRESULT SetValue(const wchar_t* value_name, DWORD value) const; - - // set an int64_t value - HRESULT SetValue(const wchar_t* value_name, DWORD64 value) const; - - // set a string value - HRESULT SetValue(const wchar_t* value_name, const wchar_t* value) const; - - // set binary data - HRESULT SetValue(const wchar_t* value_name, - const uint8_t* value, - DWORD byte_count) const; - - // set raw data, including type - HRESULT SetValue(const wchar_t* value_name, - const uint8_t* value, - DWORD byte_count, - DWORD type) const; - - // GETTERS - - // get an int32_t value - HRESULT GetValue(const wchar_t* value_name, DWORD* value) const; - - // get an int64_t value - HRESULT GetValue(const wchar_t* value_name, DWORD64* value) const; - - // get a string value - the caller must free the return buffer - HRESULT GetValue(const wchar_t* value_name, wchar_t** value) const; - - // get a string value - HRESULT GetValue(const wchar_t* value_name, std::wstring* value) const; - - // get a std::vector value from REG_MULTI_SZ type - HRESULT GetValue(const wchar_t* value_name, - std::vector* value) const; - - // get binary data - the caller must free the return buffer - HRESULT GetValue(const wchar_t* value_name, - uint8_t** value, - DWORD* byte_count) const; - - // get raw data, including type - the caller must free the return buffer - HRESULT GetValue(const wchar_t* value_name, - uint8_t** value, - DWORD* byte_count, - DWORD* type) const; - - // STATIC VERSIONS - - // flush - static HRESULT FlushKey(const wchar_t* full_key_name); - - // check if a key exists - static bool HasKey(const wchar_t* full_key_name); - - // check if the key has a specified value - static bool HasValue(const wchar_t* full_key_name, const wchar_t* value_name); - - // SETTERS - - // STATIC int32_t set - static HRESULT SetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD value); - - // STATIC int64_t set - static HRESULT SetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD64 value); - - // STATIC float set - static HRESULT SetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - float value); - - // STATIC double set - static HRESULT SetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - double value); - - // STATIC string set - static HRESULT SetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - const wchar_t* value); - - // STATIC binary data set - static HRESULT SetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - const uint8_t* value, - DWORD byte_count); - - // STATIC multi-string set - static HRESULT SetValueMultiSZ(const wchar_t* full_key_name, - const TCHAR* value_name, - const uint8_t* value, - DWORD byte_count); - - // GETTERS - - // STATIC int32_t get - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD* value); - - // STATIC int64_t get - // - // Note: if you are using time64 you should - // likely use GetLimitedTimeValue (util.h) instead of this method. - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD64* value); - - // STATIC float get - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - float* value); - - // STATIC double get - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - double* value); - - // STATIC string get - // Note: the caller must free the return buffer for wchar_t* version - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - wchar_t** value); - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - std::wstring* value); - - // STATIC REG_MULTI_SZ get - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - std::vector* value); - - // STATIC get binary data - the caller must free the return buffer - static HRESULT GetValue(const wchar_t* full_key_name, - const wchar_t* value_name, - uint8_t** value, - DWORD* byte_count); - - // Get type of a registry value - static HRESULT GetValueType(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD* value_type); - - // delete a subkey of the current key (with no subkeys) - HRESULT DeleteSubKey(const wchar_t* key_name); - - // recursively delete a sub key of the current key (and all its subkeys) - HRESULT RecurseDeleteSubKey(const wchar_t* key_name); - - // STATIC version of delete key - handles nested keys also - // delete a key and all its sub-keys recursively - // Returns S_FALSE if key didn't exist, S_OK if deletion was successful, - // and failure otherwise. - static HRESULT DeleteKey(const wchar_t* full_key_name); - - // STATIC version of delete key - // delete a key recursively or non-recursively - // Returns S_FALSE if key didn't exist, S_OK if deletion was successful, - // and failure otherwise. - static HRESULT DeleteKey(const wchar_t* full_key_name, bool recursive); - - // delete the specified value - HRESULT DeleteValue(const wchar_t* value_name); - - // STATIC version of delete value - // Returns S_FALSE if key didn't exist, S_OK if deletion was successful, - // and failure otherwise. - static HRESULT DeleteValue(const wchar_t* full_key_name, - const wchar_t* value_name); - - // Peek inside (use a RegKey as a smart wrapper around a registry handle) - HKEY key() { return h_key_; } - - // helper function to get the HKEY and the root key from a string - // modifies the argument in place and returns the key name - // e.g. HKLM\\Software\\Google\... returns HKLM, "Software\\Google\..." - // Necessary for the static versions that use the full name of the reg key - static HKEY GetRootKeyInfo(std::wstring* full_key_name); - - // Returns true if this key name is 'safe' for deletion (doesn't specify a key - // root) - static bool SafeKeyNameForDeletion(const wchar_t* key_name); - - // save the key and all of its subkeys and values to a file - static HRESULT Save(const wchar_t* full_key_name, const wchar_t* file_name); - - // restore the key and all of its subkeys and values which are saved into a - // file - static HRESULT Restore(const wchar_t* full_key_name, - const wchar_t* file_name); - - // Is the key empty: having no sub-keys and values - static bool IsKeyEmpty(const wchar_t* full_key_name); - - private: - - // helper function to get any value from the registry - // used when the size of the data is unknown - HRESULT GetValueHelper(const wchar_t* value_name, - DWORD* type, - uint8_t** value, - DWORD* byte_count) const; - - // helper function to get the parent key name and the subkey from a string - // modifies the argument in place and returns the key name - // Necessary for the static versions that use the full name of the reg key - static std::wstring GetParentKeyInfo(std::wstring* key_name); - - // common SET Helper for the static case - static HRESULT SetValueStaticHelper(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD type, - LPVOID value, - DWORD byte_count = 0); - - // common GET Helper for the static case - static HRESULT GetValueStaticHelper(const wchar_t* full_key_name, - const wchar_t* value_name, - DWORD type, - LPVOID value, - DWORD* byte_count = NULL); - - // convert REG_MULTI_SZ bytes to string array - static HRESULT MultiSZBytesToStringArray(const uint8_t* buffer, - DWORD byte_count, - std::vector* value); - - // the HKEY for the current key - HKEY h_key_; - - // for unittest - friend void RegKeyHelperFunctionsTest(); - - RTC_DISALLOW_COPY_AND_ASSIGN(RegKey); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_WIN32REGKEY_H_ diff --git a/include/webrtc/base/win32socketinit.h b/include/webrtc/base/win32socketinit.h deleted file mode 100644 index 46d27cb..0000000 --- a/include/webrtc/base/win32socketinit.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2009 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WIN32SOCKETINIT_H_ -#define WEBRTC_BASE_WIN32SOCKETINIT_H_ - -namespace rtc { - -void EnsureWinsockInit(); - -} // namespace rtc - -#endif // WEBRTC_BASE_WIN32SOCKETINIT_H_ diff --git a/include/webrtc/base/win32socketserver.h b/include/webrtc/base/win32socketserver.h deleted file mode 100644 index b468cfd..0000000 --- a/include/webrtc/base/win32socketserver.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WIN32SOCKETSERVER_H_ -#define WEBRTC_BASE_WIN32SOCKETSERVER_H_ - -#if defined(WEBRTC_WIN) -#include "webrtc/base/asyncsocket.h" -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/socketserver.h" -#include "webrtc/base/socketfactory.h" -#include "webrtc/base/socket.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/win32window.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// Win32Socket -/////////////////////////////////////////////////////////////////////////////// - -class Win32Socket : public AsyncSocket { - public: - Win32Socket(); - virtual ~Win32Socket(); - - bool CreateT(int family, int type); - - int Attach(SOCKET s); - void SetTimeout(int ms); - - // AsyncSocket Interface - virtual SocketAddress GetLocalAddress() const; - virtual SocketAddress GetRemoteAddress() const; - virtual int Bind(const SocketAddress& addr); - virtual int Connect(const SocketAddress& addr); - virtual int Send(const void *buffer, size_t length); - virtual int SendTo(const void *buffer, size_t length, const SocketAddress& addr); - virtual int Recv(void *buffer, size_t length); - virtual int RecvFrom(void *buffer, size_t length, SocketAddress *out_addr); - virtual int Listen(int backlog); - virtual Win32Socket *Accept(SocketAddress *out_addr); - virtual int Close(); - virtual int GetError() const; - virtual void SetError(int error); - virtual ConnState GetState() const; - virtual int EstimateMTU(uint16_t* mtu); - virtual int GetOption(Option opt, int* value); - virtual int SetOption(Option opt, int value); - - private: - void CreateSink(); - bool SetAsync(int events); - int DoConnect(const SocketAddress& addr); - bool HandleClosed(int close_error); - void PostClosed(); - void UpdateLastError(); - static int TranslateOption(Option opt, int* slevel, int* sopt); - - void OnSocketNotify(SOCKET socket, int event, int error); - void OnDnsNotify(HANDLE task, int error); - - SOCKET socket_; - int error_; - ConnState state_; - SocketAddress addr_; // address that we connected to (see DoConnect) - uint32_t connect_time_; - bool closing_; - int close_error_; - - class EventSink; - friend class EventSink; - EventSink * sink_; - - struct DnsLookup; - DnsLookup * dns_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// Win32SocketServer -/////////////////////////////////////////////////////////////////////////////// - -class Win32SocketServer : public SocketServer { - public: - explicit Win32SocketServer(MessageQueue* message_queue); - virtual ~Win32SocketServer(); - - void set_modeless_dialog(HWND hdlg) { - hdlg_ = hdlg; - } - - // SocketServer Interface - virtual Socket* CreateSocket(int type); - virtual Socket* CreateSocket(int family, int type); - - virtual AsyncSocket* CreateAsyncSocket(int type); - virtual AsyncSocket* CreateAsyncSocket(int family, int type); - - virtual void SetMessageQueue(MessageQueue* queue); - virtual bool Wait(int cms, bool process_io); - virtual void WakeUp(); - - void Pump(); - - HWND handle() { return wnd_.handle(); } - - private: - class MessageWindow : public Win32Window { - public: - explicit MessageWindow(Win32SocketServer* ss) : ss_(ss) {} - private: - virtual bool OnMessage(UINT msg, WPARAM wp, LPARAM lp, LRESULT& result); - Win32SocketServer* ss_; - }; - - static const TCHAR kWindowName[]; - MessageQueue *message_queue_; - MessageWindow wnd_; - CriticalSection cs_; - bool posted_; - HWND hdlg_; -}; - -/////////////////////////////////////////////////////////////////////////////// -// Win32Thread. Automatically pumps Windows messages. -/////////////////////////////////////////////////////////////////////////////// - -class Win32Thread : public Thread { - public: - Win32Thread() : ss_(this), id_(0) { - set_socketserver(&ss_); - } - virtual ~Win32Thread() { - Stop(); - set_socketserver(NULL); - } - virtual void Run() { - id_ = GetCurrentThreadId(); - Thread::Run(); - id_ = 0; - } - virtual void Quit() { - PostThreadMessage(id_, WM_QUIT, 0, 0); - } - private: - Win32SocketServer ss_; - DWORD id_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_WIN - -#endif // WEBRTC_BASE_WIN32SOCKETSERVER_H_ diff --git a/include/webrtc/base/win32window.h b/include/webrtc/base/win32window.h deleted file mode 100644 index c0ba6b2..0000000 --- a/include/webrtc/base/win32window.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WIN32WINDOW_H_ -#define WEBRTC_BASE_WIN32WINDOW_H_ - -#if defined(WEBRTC_WIN) - -#include "webrtc/base/win32.h" - -namespace rtc { - -/////////////////////////////////////////////////////////////////////////////// -// Win32Window -/////////////////////////////////////////////////////////////////////////////// - -class Win32Window { - public: - Win32Window(); - virtual ~Win32Window(); - - HWND handle() const { return wnd_; } - - bool Create(HWND parent, const wchar_t* title, DWORD style, DWORD exstyle, - int x, int y, int cx, int cy); - void Destroy(); - - // Call this when your DLL unloads. - static void Shutdown(); - - protected: - virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, - LRESULT& result); - - virtual bool OnClose() { return true; } - virtual void OnNcDestroy() { } - - private: - static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, - LPARAM lParam); - - HWND wnd_; - static HINSTANCE instance_; - static ATOM window_class_; -}; - -/////////////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_WIN - -#endif // WEBRTC_BASE_WIN32WINDOW_H_ diff --git a/include/webrtc/base/win32windowpicker.h b/include/webrtc/base/win32windowpicker.h deleted file mode 100644 index 9c84bfd..0000000 --- a/include/webrtc/base/win32windowpicker.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_BASE_WIN32WINDOWPICKER_H_ -#define WEBRTC_BASE_WIN32WINDOWPICKER_H_ - -#include "webrtc/base/win32.h" -#include "webrtc/base/windowpicker.h" - -namespace rtc { - -class Win32WindowPicker : public WindowPicker { - public: - Win32WindowPicker(); - virtual bool Init(); - virtual bool IsVisible(const WindowId& id); - virtual bool MoveToFront(const WindowId& id); - virtual bool GetWindowList(WindowDescriptionList* descriptions); - virtual bool GetDesktopList(DesktopDescriptionList* descriptions); - virtual bool GetDesktopDimensions(const DesktopId& id, int* width, - int* height); - - protected: - static BOOL CALLBACK EnumProc(HWND hwnd, LPARAM l_param); - static BOOL CALLBACK MonitorEnumProc(HMONITOR h_monitor, - HDC hdc_monitor, - LPRECT lprc_monitor, - LPARAM l_param); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_WIN32WINDOWPICKER_H_ diff --git a/include/webrtc/base/window.h b/include/webrtc/base/window.h deleted file mode 100644 index b1f1724..0000000 --- a/include/webrtc/base/window.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WINDOW_H_ -#define WEBRTC_BASE_WINDOW_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/stringencode.h" - -// Define platform specific window types. -#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) -typedef unsigned long Window; // Avoid include . -#elif defined(WEBRTC_WIN) -// We commonly include win32.h in webrtc/base so just include it here. -#include "webrtc/base/win32.h" // Include HWND, HMONITOR. -#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -typedef unsigned int CGWindowID; -typedef unsigned int CGDirectDisplayID; -#endif - -namespace rtc { - -class WindowId { - public: - // Define WindowT for each platform. -#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) - typedef Window WindowT; -#elif defined(WEBRTC_WIN) - typedef HWND WindowT; -#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) - typedef CGWindowID WindowT; -#else - typedef unsigned int WindowT; -#endif - - static WindowId Cast(uint64_t id) { -#if defined(WEBRTC_WIN) - return WindowId(reinterpret_cast(id)); -#else - return WindowId(static_cast(id)); -#endif - } - - static uint64_t Format(const WindowT& id) { -#if defined(WEBRTC_WIN) - return static_cast(reinterpret_cast(id)); -#else - return static_cast(id); -#endif - } - - WindowId() : id_(0) {} - WindowId(const WindowT& id) : id_(id) {} // NOLINT - const WindowT& id() const { return id_; } - bool IsValid() const { return id_ != 0; } - bool Equals(const WindowId& other) const { - return id_ == other.id(); - } - - private: - WindowT id_; -}; - -class DesktopId { - public: - // Define DesktopT for each platform. -#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) - typedef Window DesktopT; -#elif defined(WEBRTC_WIN) - typedef HMONITOR DesktopT; -#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) - typedef CGDirectDisplayID DesktopT; -#else - typedef unsigned int DesktopT; -#endif - - static DesktopId Cast(int id, int index) { -#if defined(WEBRTC_WIN) - return DesktopId(reinterpret_cast(id), index); -#else - return DesktopId(static_cast(id), index); -#endif - } - - DesktopId() : id_(0), index_(-1) {} - DesktopId(const DesktopT& id, int index) // NOLINT - : id_(id), index_(index) { - } - const DesktopT& id() const { return id_; } - int index() const { return index_; } - bool IsValid() const { return index_ != -1; } - bool Equals(const DesktopId& other) const { - return id_ == other.id() && index_ == other.index(); - } - - private: - // Id is the platform specific desktop identifier. - DesktopT id_; - // Index is the desktop index as enumerated by each platform. - // Desktop capturer typically takes the index instead of id. - int index_; -}; - -// Window event types. -enum WindowEvent { - WE_RESIZE = 0, - WE_CLOSE = 1, - WE_MINIMIZE = 2, - WE_RESTORE = 3, -}; - -inline std::string ToString(const WindowId& window) { - return ToString(window.id()); -} - -} // namespace rtc - -#endif // WEBRTC_BASE_WINDOW_H_ diff --git a/include/webrtc/base/windowpicker.h b/include/webrtc/base/windowpicker.h deleted file mode 100644 index 3ae7b0e..0000000 --- a/include/webrtc/base/windowpicker.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WINDOWPICKER_H_ -#define WEBRTC_BASE_WINDOWPICKER_H_ - -#include -#include - -#include "webrtc/base/window.h" - -namespace rtc { - -class WindowDescription { - public: - WindowDescription() : id_() {} - WindowDescription(const WindowId& id, const std::string& title) - : id_(id), title_(title) { - } - const WindowId& id() const { return id_; } - void set_id(const WindowId& id) { id_ = id; } - const std::string& title() const { return title_; } - void set_title(const std::string& title) { title_ = title; } - - private: - WindowId id_; - std::string title_; -}; - -class DesktopDescription { - public: - DesktopDescription() : id_() {} - DesktopDescription(const DesktopId& id, const std::string& title) - : id_(id), title_(title), primary_(false) { - } - const DesktopId& id() const { return id_; } - void set_id(const DesktopId& id) { id_ = id; } - const std::string& title() const { return title_; } - void set_title(const std::string& title) { title_ = title; } - // Indicates whether it is the primary desktop in the system. - bool primary() const { return primary_; } - void set_primary(bool primary) { primary_ = primary; } - - private: - DesktopId id_; - std::string title_; - bool primary_; -}; - -typedef std::vector WindowDescriptionList; -typedef std::vector DesktopDescriptionList; - -class WindowPicker { - public: - virtual ~WindowPicker() {} - virtual bool Init() = 0; - - // TODO: Move this two methods to window.h when we no longer need to load - // CoreGraphics dynamically. - virtual bool IsVisible(const WindowId& id) = 0; - virtual bool MoveToFront(const WindowId& id) = 0; - - // Gets a list of window description and appends to descriptions. - // Returns true if successful. - virtual bool GetWindowList(WindowDescriptionList* descriptions) = 0; - // Gets a list of desktop descriptions and appends to descriptions. - // Returns true if successful. - virtual bool GetDesktopList(DesktopDescriptionList* descriptions) = 0; - // Gets the width and height of a desktop. - // Returns true if successful. - virtual bool GetDesktopDimensions(const DesktopId& id, int* width, - int* height) = 0; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_WINDOWPICKER_H_ diff --git a/include/webrtc/base/windowpickerfactory.h b/include/webrtc/base/windowpickerfactory.h deleted file mode 100644 index dec3a33..0000000 --- a/include/webrtc/base/windowpickerfactory.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WINDOWPICKERFACTORY_H_ -#define WEBRTC_BASE_WINDOWPICKERFACTORY_H_ - -#if defined(WEBRTC_WIN) -#include "webrtc/base/win32windowpicker.h" -#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -#include "webrtc/base/macutils.h" -#include "webrtc/base/macwindowpicker.h" -#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && defined(HAVE_X11) -#include "webrtc/base/x11windowpicker.h" -#endif - -#include "webrtc/base/windowpicker.h" - -namespace rtc { - -class WindowPickerFactory { - public: - virtual ~WindowPickerFactory() {} - - // Instance method for dependency injection. - virtual WindowPicker* Create() { - return CreateWindowPicker(); - } - - static WindowPicker* CreateWindowPicker() { -#if defined(WEBRTC_WIN) - return new Win32WindowPicker(); -#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) - return new MacWindowPicker(); -#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && defined(HAVE_X11) - return new X11WindowPicker(); -#else - return NULL; -#endif - } - - static bool IsSupported() { -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) - return GetOSVersionName() >= kMacOSLeopard; -#else - return true; -#endif - } -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_WINDOWPICKERFACTORY_H_ diff --git a/include/webrtc/base/winfirewall.h b/include/webrtc/base/winfirewall.h deleted file mode 100644 index a74631b..0000000 --- a/include/webrtc/base/winfirewall.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WINFIREWALL_H_ -#define WEBRTC_BASE_WINFIREWALL_H_ - -#ifndef _HRESULT_DEFINED -#define _HRESULT_DEFINED -typedef long HRESULT; // Can't forward declare typedef, but don't need all win -#endif // !_HRESULT_DEFINED - -struct INetFwMgr; -struct INetFwPolicy; -struct INetFwProfile; - -namespace rtc { - -////////////////////////////////////////////////////////////////////// -// WinFirewall -////////////////////////////////////////////////////////////////////// - -class WinFirewall { - public: - WinFirewall(); - ~WinFirewall(); - - bool Initialize(HRESULT* result); - void Shutdown(); - - bool Enabled() const; - bool QueryAuthorized(const char* filename, bool* authorized) const; - bool QueryAuthorizedW(const wchar_t* filename, bool* authorized) const; - - bool AddApplication(const char* filename, const char* friendly_name, - bool authorized, HRESULT* result); - bool AddApplicationW(const wchar_t* filename, const wchar_t* friendly_name, - bool authorized, HRESULT* result); - - private: - INetFwMgr* mgr_; - INetFwPolicy* policy_; - INetFwProfile* profile_; -}; - -////////////////////////////////////////////////////////////////////// - -} // namespace rtc - -#endif // WEBRTC_BASE_WINFIREWALL_H_ diff --git a/include/webrtc/base/winping.h b/include/webrtc/base/winping.h deleted file mode 100644 index ddaefc5..0000000 --- a/include/webrtc/base/winping.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WINPING_H__ -#define WEBRTC_BASE_WINPING_H__ - -#if defined(WEBRTC_WIN) - -#include "webrtc/base/win32.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/IPAddress.h" - -namespace rtc { - -// This class wraps a Win32 API for doing ICMP pinging. This API, unlike the -// the normal socket APIs (as implemented on Win9x), will return an error if -// an ICMP packet with the dont-fragment bit set is too large. This means this -// class can be used to detect the MTU to a given address. - -typedef struct ip_option_information { - UCHAR Ttl; // Time To Live - UCHAR Tos; // Type Of Service - UCHAR Flags; // IP header flags - UCHAR OptionsSize; // Size in bytes of options data - PUCHAR OptionsData; // Pointer to options data -} IP_OPTION_INFORMATION, * PIP_OPTION_INFORMATION; - -typedef HANDLE (WINAPI *PIcmpCreateFile)(); - -typedef BOOL (WINAPI *PIcmpCloseHandle)(HANDLE icmp_handle); - -typedef HANDLE (WINAPI *PIcmp6CreateFile)(); - -typedef BOOL (WINAPI *PIcmp6CloseHandle)(HANDLE icmp_handle); - -typedef DWORD (WINAPI *PIcmpSendEcho)( - HANDLE IcmpHandle, - ULONG DestinationAddress, - LPVOID RequestData, - WORD RequestSize, - PIP_OPTION_INFORMATION RequestOptions, - LPVOID ReplyBuffer, - DWORD ReplySize, - DWORD Timeout); - -typedef DWORD (WINAPI *PIcmp6SendEcho2)( - HANDLE IcmpHandle, - HANDLE Event, - FARPROC ApcRoutine, - PVOID ApcContext, - struct sockaddr_in6 *SourceAddress, - struct sockaddr_in6 *DestinationAddress, - LPVOID RequestData, - WORD RequestSize, - PIP_OPTION_INFORMATION RequestOptions, - LPVOID ReplyBuffer, - DWORD ReplySize, - DWORD Timeout -); - -class WinPing { -public: - WinPing(); - ~WinPing(); - - // Determines whether the class was initialized correctly. - bool IsValid() { return valid_; } - - // Attempts to send a ping with the given parameters. - enum PingResult { PING_FAIL, PING_INVALID_PARAMS, - PING_TOO_LARGE, PING_TIMEOUT, PING_SUCCESS }; - PingResult Ping(IPAddress ip, - uint32_t data_size, - uint32_t timeout_millis, - uint8_t ttl, - bool allow_fragments); - -private: - HMODULE dll_; - HANDLE hping_; - HANDLE hping6_; - PIcmpCreateFile create_; - PIcmpCloseHandle close_; - PIcmpSendEcho send_; - PIcmp6CreateFile create6_; - PIcmp6SendEcho2 send6_; - char* data_; - uint32_t dlen_; - char* reply_; - uint32_t rlen_; - bool valid_; -}; - -} // namespace rtc - -#endif // WEBRTC_WIN - -#endif // WEBRTC_BASE_WINPING_H__ diff --git a/include/webrtc/base/worker.h b/include/webrtc/base/worker.h deleted file mode 100644 index 17ae8cf..0000000 --- a/include/webrtc/base/worker.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_WORKER_H_ -#define WEBRTC_BASE_WORKER_H_ - -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/messagehandler.h" - -namespace rtc { - -class Thread; - -// A worker is an object that performs some specific long-lived task in an -// event-driven manner. -// The only method that should be considered thread-safe is HaveWork(), which -// allows you to signal the availability of work from any thread. All other -// methods are thread-hostile. Specifically: -// StartWork()/StopWork() should not be called concurrently with themselves or -// each other, and it is an error to call them while the worker is running on -// a different thread. -// The destructor may not be called if the worker is currently running -// (regardless of the thread), but you can call StopWork() in a subclass's -// destructor. -class Worker : private MessageHandler { - public: - Worker(); - - // Destroys this Worker, but it must have already been stopped via StopWork(). - ~Worker() override; - - // Attaches the worker to the current thread and begins processing work if not - // already doing so. - bool StartWork(); - // Stops processing work if currently doing so and detaches from the current - // thread. - bool StopWork(); - - protected: - // Signal that work is available to be done. May only be called within the - // lifetime of a OnStart()/OnStop() pair. - void HaveWork(); - - // These must be implemented by a subclass. - // Called on the worker thread to start working. - virtual void OnStart() = 0; - // Called on the worker thread when work has been signalled via HaveWork(). - virtual void OnHaveWork() = 0; - // Called on the worker thread to stop working. Upon return, any pending - // OnHaveWork() calls are cancelled. - virtual void OnStop() = 0; - - private: - // Inherited from MessageHandler. - void OnMessage(Message* msg) override; - - // The thread that is currently doing the work. - Thread *worker_thread_; - - RTC_DISALLOW_COPY_AND_ASSIGN(Worker); -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_WORKER_H_ diff --git a/include/webrtc/base/x11windowpicker.h b/include/webrtc/base/x11windowpicker.h deleted file mode 100644 index 501adf5..0000000 --- a/include/webrtc/base/x11windowpicker.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_LINUXWINDOWPICKER_H_ -#define WEBRTC_BASE_LINUXWINDOWPICKER_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/windowpicker.h" - -// Avoid include . -struct _XDisplay; -typedef unsigned long Window; - -namespace rtc { - -class XWindowEnumerator; - -class X11WindowPicker : public WindowPicker { - public: - X11WindowPicker(); - ~X11WindowPicker() override; - - static bool IsDesktopElement(_XDisplay* display, Window window); - - bool Init() override; - bool IsVisible(const WindowId& id) override; - bool MoveToFront(const WindowId& id) override; - bool GetWindowList(WindowDescriptionList* descriptions) override; - bool GetDesktopList(DesktopDescriptionList* descriptions) override; - bool GetDesktopDimensions(const DesktopId& id, - int* width, - int* height) override; - uint8_t* GetWindowIcon(const WindowId& id, int* width, int* height); - uint8_t* GetWindowThumbnail(const WindowId& id, int width, int height); - int GetNumDesktops(); - uint8_t* GetDesktopThumbnail(const DesktopId& id, int width, int height); - - private: - scoped_ptr enumerator_; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_LINUXWINDOWPICKER_H_ diff --git a/include/webrtc/call.h b/include/webrtc/call.h deleted file mode 100644 index 313c5e5..0000000 --- a/include/webrtc/call.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_CALL_H_ -#define WEBRTC_CALL_H_ - -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/audio_receive_stream.h" -#include "webrtc/audio_send_stream.h" -#include "webrtc/audio_state.h" -#include "webrtc/base/socket.h" -#include "webrtc/video_receive_stream.h" -#include "webrtc/video_send_stream.h" - -namespace webrtc { - -class AudioProcessing; - -const char* Version(); - -enum class MediaType { - ANY, - AUDIO, - VIDEO, - DATA -}; - -class PacketReceiver { - public: - enum DeliveryStatus { - DELIVERY_OK, - DELIVERY_UNKNOWN_SSRC, - DELIVERY_PACKET_ERROR, - }; - - virtual DeliveryStatus DeliverPacket(MediaType media_type, - const uint8_t* packet, - size_t length, - const PacketTime& packet_time) = 0; - - protected: - virtual ~PacketReceiver() {} -}; - -// Callback interface for reporting when a system overuse is detected. -class LoadObserver { - public: - enum Load { kOveruse, kUnderuse }; - - // Triggered when overuse is detected or when we believe the system can take - // more load. - virtual void OnLoadUpdate(Load load) = 0; - - protected: - virtual ~LoadObserver() {} -}; - -// A Call instance can contain several send and/or receive streams. All streams -// are assumed to have the same remote endpoint and will share bitrate estimates -// etc. -class Call { - public: - struct Config { - static const int kDefaultStartBitrateBps; - - // Bitrate config used until valid bitrate estimates are calculated. Also - // used to cap total bitrate used. - struct BitrateConfig { - int min_bitrate_bps = 0; - int start_bitrate_bps = kDefaultStartBitrateBps; - int max_bitrate_bps = -1; - } bitrate_config; - - // AudioState which is possibly shared between multiple calls. - // TODO(solenberg): Change this to a shared_ptr once we can use C++11. - rtc::scoped_refptr audio_state; - - // Audio Processing Module to be used in this call. - // TODO(solenberg): Change this to a shared_ptr once we can use C++11. - AudioProcessing* audio_processing = nullptr; - }; - - struct Stats { - int send_bandwidth_bps = 0; - int recv_bandwidth_bps = 0; - int64_t pacer_delay_ms = 0; - int64_t rtt_ms = -1; - }; - - static Call* Create(const Call::Config& config); - - virtual AudioSendStream* CreateAudioSendStream( - const AudioSendStream::Config& config) = 0; - virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0; - - virtual AudioReceiveStream* CreateAudioReceiveStream( - const AudioReceiveStream::Config& config) = 0; - virtual void DestroyAudioReceiveStream( - AudioReceiveStream* receive_stream) = 0; - - virtual VideoSendStream* CreateVideoSendStream( - const VideoSendStream::Config& config, - const VideoEncoderConfig& encoder_config) = 0; - virtual void DestroyVideoSendStream(VideoSendStream* send_stream) = 0; - - virtual VideoReceiveStream* CreateVideoReceiveStream( - const VideoReceiveStream::Config& config) = 0; - virtual void DestroyVideoReceiveStream( - VideoReceiveStream* receive_stream) = 0; - - // All received RTP and RTCP packets for the call should be inserted to this - // PacketReceiver. The PacketReceiver pointer is valid as long as the - // Call instance exists. - virtual PacketReceiver* Receiver() = 0; - - // Returns the call statistics, such as estimated send and receive bandwidth, - // pacing delay, etc. - virtual Stats GetStats() const = 0; - - // TODO(pbos): Like BitrateConfig above this is currently per-stream instead - // of maximum for entire Call. This should be fixed along with the above. - // Specifying a start bitrate (>0) will currently reset the current bitrate - // estimate. This is due to how the 'x-google-start-bitrate' flag is currently - // implemented. - virtual void SetBitrateConfig( - const Config::BitrateConfig& bitrate_config) = 0; - virtual void SignalNetworkState(NetworkState state) = 0; - - virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; - - virtual ~Call() {} -}; - -} // namespace webrtc - -#endif // WEBRTC_CALL_H_ diff --git a/include/webrtc/common.h b/include/webrtc/common.h deleted file mode 100644 index dda045e..0000000 --- a/include/webrtc/common.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_H_ -#define WEBRTC_COMMON_H_ - -#include - -#include "webrtc/base/basictypes.h" - -namespace webrtc { - -// Class Config is designed to ease passing a set of options across webrtc code. -// Options are identified by typename in order to avoid incorrect casts. -// -// Usage: -// * declaring an option: -// struct Algo1_CostFunction { -// virtual float cost(int x) const { return x; } -// virtual ~Algo1_CostFunction() {} -// }; -// -// * accessing an option: -// config.Get().cost(value); -// -// * setting an option: -// struct SqrCost : Algo1_CostFunction { -// virtual float cost(int x) const { return x*x; } -// }; -// config.Set(new SqrCost()); -// -// Note: This class is thread-compatible (like STL containers). -class Config { - public: - // Returns the option if set or a default constructed one. - // Callers that access options too often are encouraged to cache the result. - // Returned references are owned by this. - // - // Requires std::is_default_constructible - template const T& Get() const; - - // Set the option, deleting any previous instance of the same. - // This instance gets ownership of the newly set value. - template void Set(T* value); - - Config() {} - ~Config() { - // Note: this method is inline so webrtc public API depends only - // on the headers. - for (OptionMap::iterator it = options_.begin(); - it != options_.end(); ++it) { - delete it->second; - } - } - - private: - typedef void* OptionIdentifier; - - struct BaseOption { - virtual ~BaseOption() {} - }; - - template - struct Option : BaseOption { - explicit Option(T* v): value(v) {} - ~Option() { - delete value; - } - T* value; - }; - - // Own implementation of rtti-subset to avoid depending on rtti and its costs. - template - static OptionIdentifier identifier() { - static char id_placeholder; - return &id_placeholder; - } - - // Used to instantiate a default constructed object that doesn't needs to be - // owned. This allows Get to be implemented without requiring explicitly - // locks. - template - static const T& default_value() { - RTC_DEFINE_STATIC_LOCAL(const T, def, ()); - return def; - } - - typedef std::map OptionMap; - OptionMap options_; - - // RTC_DISALLOW_COPY_AND_ASSIGN - Config(const Config&); - void operator=(const Config&); -}; - -template -const T& Config::Get() const { - OptionMap::const_iterator it = options_.find(identifier()); - if (it != options_.end()) { - const T* t = static_cast*>(it->second)->value; - if (t) { - return *t; - } - } - return default_value(); -} - -template -void Config::Set(T* value) { - BaseOption*& it = options_[identifier()]; - delete it; - it = new Option(value); -} - -} // namespace webrtc - -#endif // WEBRTC_COMMON_H_ diff --git a/include/webrtc/common_types.h b/include/webrtc/common_types.h deleted file mode 100644 index 048485f..0000000 --- a/include/webrtc/common_types.h +++ /dev/null @@ -1,911 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_TYPES_H_ -#define WEBRTC_COMMON_TYPES_H_ - -#include -#include - -#include -#include - -#include "webrtc/typedefs.h" - -#if defined(_MSC_VER) -// Disable "new behavior: elements of array will be default initialized" -// warning. Affects OverUseDetectorOptions. -#pragma warning(disable:4351) -#endif - -#ifdef WEBRTC_EXPORT -#define WEBRTC_DLLEXPORT _declspec(dllexport) -#elif WEBRTC_DLL -#define WEBRTC_DLLEXPORT _declspec(dllimport) -#else -#define WEBRTC_DLLEXPORT -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#define RTP_PAYLOAD_NAME_SIZE 32 - -#if defined(WEBRTC_WIN) || defined(WIN32) -// Compares two strings without regard to case. -#define STR_CASE_CMP(s1, s2) ::_stricmp(s1, s2) -// Compares characters of two strings without regard to case. -#define STR_NCASE_CMP(s1, s2, n) ::_strnicmp(s1, s2, n) -#else -#define STR_CASE_CMP(s1, s2) ::strcasecmp(s1, s2) -#define STR_NCASE_CMP(s1, s2, n) ::strncasecmp(s1, s2, n) -#endif - -namespace webrtc { - -class Config; - -class InStream -{ -public: - // Reads |length| bytes from file to |buf|. Returns the number of bytes read - // or -1 on error. - virtual int Read(void *buf, size_t len) = 0; - virtual int Rewind(); - virtual ~InStream() {} -protected: - InStream() {} -}; - -class OutStream -{ -public: - // Writes |length| bytes from |buf| to file. The actual writing may happen - // some time later. Call Flush() to force a write. - virtual bool Write(const void *buf, size_t len) = 0; - virtual int Rewind(); - virtual ~OutStream() {} -protected: - OutStream() {} -}; - -enum TraceModule -{ - kTraceUndefined = 0, - // not a module, triggered from the engine code - kTraceVoice = 0x0001, - // not a module, triggered from the engine code - kTraceVideo = 0x0002, - // not a module, triggered from the utility code - kTraceUtility = 0x0003, - kTraceRtpRtcp = 0x0004, - kTraceTransport = 0x0005, - kTraceSrtp = 0x0006, - kTraceAudioCoding = 0x0007, - kTraceAudioMixerServer = 0x0008, - kTraceAudioMixerClient = 0x0009, - kTraceFile = 0x000a, - kTraceAudioProcessing = 0x000b, - kTraceVideoCoding = 0x0010, - kTraceVideoMixer = 0x0011, - kTraceAudioDevice = 0x0012, - kTraceVideoRenderer = 0x0014, - kTraceVideoCapture = 0x0015, - kTraceRemoteBitrateEstimator = 0x0017, -}; - -enum TraceLevel -{ - kTraceNone = 0x0000, // no trace - kTraceStateInfo = 0x0001, - kTraceWarning = 0x0002, - kTraceError = 0x0004, - kTraceCritical = 0x0008, - kTraceApiCall = 0x0010, - kTraceDefault = 0x00ff, - - kTraceModuleCall = 0x0020, - kTraceMemory = 0x0100, // memory info - kTraceTimer = 0x0200, // timing info - kTraceStream = 0x0400, // "continuous" stream of data - - // used for debug purposes - kTraceDebug = 0x0800, // debug - kTraceInfo = 0x1000, // debug info - - // Non-verbose level used by LS_INFO of logging.h. Do not use directly. - kTraceTerseInfo = 0x2000, - - kTraceAll = 0xffff -}; - -// External Trace API -class TraceCallback { - public: - virtual void Print(TraceLevel level, const char* message, int length) = 0; - - protected: - virtual ~TraceCallback() {} - TraceCallback() {} -}; - -enum FileFormats -{ - kFileFormatWavFile = 1, - kFileFormatCompressedFile = 2, - kFileFormatPreencodedFile = 4, - kFileFormatPcm16kHzFile = 7, - kFileFormatPcm8kHzFile = 8, - kFileFormatPcm32kHzFile = 9 -}; - -enum ProcessingTypes -{ - kPlaybackPerChannel = 0, - kPlaybackAllChannelsMixed, - kRecordingPerChannel, - kRecordingAllChannelsMixed, - kRecordingPreprocessing -}; - -enum FrameType { - kEmptyFrame = 0, - kAudioFrameSpeech = 1, - kAudioFrameCN = 2, - kVideoFrameKey = 3, - kVideoFrameDelta = 4, -}; - -// Statistics for an RTCP channel -struct RtcpStatistics { - RtcpStatistics() - : fraction_lost(0), - cumulative_lost(0), - extended_max_sequence_number(0), - jitter(0) {} - - uint8_t fraction_lost; - uint32_t cumulative_lost; - uint32_t extended_max_sequence_number; - uint32_t jitter; -}; - -class RtcpStatisticsCallback { - public: - virtual ~RtcpStatisticsCallback() {} - - virtual void StatisticsUpdated(const RtcpStatistics& statistics, - uint32_t ssrc) = 0; - virtual void CNameChanged(const char* cname, uint32_t ssrc) = 0; -}; - -// Statistics for RTCP packet types. -struct RtcpPacketTypeCounter { - RtcpPacketTypeCounter() - : first_packet_time_ms(-1), - nack_packets(0), - fir_packets(0), - pli_packets(0), - nack_requests(0), - unique_nack_requests(0) {} - - void Add(const RtcpPacketTypeCounter& other) { - nack_packets += other.nack_packets; - fir_packets += other.fir_packets; - pli_packets += other.pli_packets; - nack_requests += other.nack_requests; - unique_nack_requests += other.unique_nack_requests; - if (other.first_packet_time_ms != -1 && - (other.first_packet_time_ms < first_packet_time_ms || - first_packet_time_ms == -1)) { - // Use oldest time. - first_packet_time_ms = other.first_packet_time_ms; - } - } - - int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { - return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); - } - - int UniqueNackRequestsInPercent() const { - if (nack_requests == 0) { - return 0; - } - return static_cast( - (unique_nack_requests * 100.0f / nack_requests) + 0.5f); - } - - int64_t first_packet_time_ms; // Time when first packet is sent/received. - uint32_t nack_packets; // Number of RTCP NACK packets. - uint32_t fir_packets; // Number of RTCP FIR packets. - uint32_t pli_packets; // Number of RTCP PLI packets. - uint32_t nack_requests; // Number of NACKed RTP packets. - uint32_t unique_nack_requests; // Number of unique NACKed RTP packets. -}; - -class RtcpPacketTypeCounterObserver { - public: - virtual ~RtcpPacketTypeCounterObserver() {} - virtual void RtcpPacketTypesCounterUpdated( - uint32_t ssrc, - const RtcpPacketTypeCounter& packet_counter) = 0; -}; - -// Rate statistics for a stream. -struct BitrateStatistics { - BitrateStatistics() : bitrate_bps(0), packet_rate(0), timestamp_ms(0) {} - - uint32_t bitrate_bps; // Bitrate in bits per second. - uint32_t packet_rate; // Packet rate in packets per second. - uint64_t timestamp_ms; // Ntp timestamp in ms at time of rate estimation. -}; - -// Callback, used to notify an observer whenever new rates have been estimated. -class BitrateStatisticsObserver { - public: - virtual ~BitrateStatisticsObserver() {} - - virtual void Notify(const BitrateStatistics& total_stats, - const BitrateStatistics& retransmit_stats, - uint32_t ssrc) = 0; -}; - -struct FrameCounts { - FrameCounts() : key_frames(0), delta_frames(0) {} - int key_frames; - int delta_frames; -}; - -// Callback, used to notify an observer whenever frame counts have been updated. -class FrameCountObserver { - public: - virtual ~FrameCountObserver() {} - virtual void FrameCountUpdated(const FrameCounts& frame_counts, - uint32_t ssrc) = 0; -}; - -// Callback, used to notify an observer whenever the send-side delay is updated. -class SendSideDelayObserver { - public: - virtual ~SendSideDelayObserver() {} - virtual void SendSideDelayUpdated(int avg_delay_ms, - int max_delay_ms, - uint32_t ssrc) = 0; -}; - -// ================================================================== -// Voice specific types -// ================================================================== - -// Each codec supported can be described by this structure. -struct CodecInst { - int pltype; - char plname[RTP_PAYLOAD_NAME_SIZE]; - int plfreq; - int pacsize; - int channels; - int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file! - - bool operator==(const CodecInst& other) const { - return pltype == other.pltype && - (STR_CASE_CMP(plname, other.plname) == 0) && - plfreq == other.plfreq && - pacsize == other.pacsize && - channels == other.channels && - rate == other.rate; - } - - bool operator!=(const CodecInst& other) const { - return !(*this == other); - } -}; - -// RTP -enum {kRtpCsrcSize = 15}; // RFC 3550 page 13 - -enum RTPDirections -{ - kRtpIncoming = 0, - kRtpOutgoing -}; - -enum PayloadFrequencies -{ - kFreq8000Hz = 8000, - kFreq16000Hz = 16000, - kFreq32000Hz = 32000 -}; - -enum VadModes // degree of bandwidth reduction -{ - kVadConventional = 0, // lowest reduction - kVadAggressiveLow, - kVadAggressiveMid, - kVadAggressiveHigh // highest reduction -}; - -struct NetworkStatistics // NETEQ statistics -{ - // current jitter buffer size in ms - uint16_t currentBufferSize; - // preferred (optimal) buffer size in ms - uint16_t preferredBufferSize; - // adding extra delay due to "peaky jitter" - bool jitterPeaksFound; - // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. - uint16_t currentPacketLossRate; - // Late loss rate; fraction between 0 and 1, scaled to Q14. - uint16_t currentDiscardRate; - // fraction (of original stream) of synthesized audio inserted through - // expansion (in Q14) - uint16_t currentExpandRate; - // fraction (of original stream) of synthesized speech inserted through - // expansion (in Q14) - uint16_t currentSpeechExpandRate; - // fraction of synthesized speech inserted through pre-emptive expansion - // (in Q14) - uint16_t currentPreemptiveRate; - // fraction of data removed through acceleration (in Q14) - uint16_t currentAccelerateRate; - // fraction of data coming from secondary decoding (in Q14) - uint16_t currentSecondaryDecodedRate; - // clock-drift in parts-per-million (negative or positive) - int32_t clockDriftPPM; - // average packet waiting time in the jitter buffer (ms) - int meanWaitingTimeMs; - // median packet waiting time in the jitter buffer (ms) - int medianWaitingTimeMs; - // min packet waiting time in the jitter buffer (ms) - int minWaitingTimeMs; - // max packet waiting time in the jitter buffer (ms) - int maxWaitingTimeMs; - // added samples in off mode due to packet loss - size_t addedSamples; -}; - -// Statistics for calls to AudioCodingModule::PlayoutData10Ms(). -struct AudioDecodingCallStats { - AudioDecodingCallStats() - : calls_to_silence_generator(0), - calls_to_neteq(0), - decoded_normal(0), - decoded_plc(0), - decoded_cng(0), - decoded_plc_cng(0) {} - - int calls_to_silence_generator; // Number of calls where silence generated, - // and NetEq was disengaged from decoding. - int calls_to_neteq; // Number of calls to NetEq. - int decoded_normal; // Number of calls where audio RTP packet decoded. - int decoded_plc; // Number of calls resulted in PLC. - int decoded_cng; // Number of calls where comfort noise generated due to DTX. - int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. -}; - -typedef struct -{ - int min; // minumum - int max; // maximum - int average; // average -} StatVal; - -typedef struct // All levels are reported in dBm0 -{ - StatVal speech_rx; // long-term speech levels on receiving side - StatVal speech_tx; // long-term speech levels on transmitting side - StatVal noise_rx; // long-term noise/silence levels on receiving side - StatVal noise_tx; // long-term noise/silence levels on transmitting side -} LevelStatistics; - -typedef struct // All levels are reported in dB -{ - StatVal erl; // Echo Return Loss - StatVal erle; // Echo Return Loss Enhancement - StatVal rerl; // RERL = ERL + ERLE - // Echo suppression inside EC at the point just before its NLP - StatVal a_nlp; -} EchoStatistics; - -enum NsModes // type of Noise Suppression -{ - kNsUnchanged = 0, // previously set mode - kNsDefault, // platform default - kNsConference, // conferencing default - kNsLowSuppression, // lowest suppression - kNsModerateSuppression, - kNsHighSuppression, - kNsVeryHighSuppression, // highest suppression -}; - -enum AgcModes // type of Automatic Gain Control -{ - kAgcUnchanged = 0, // previously set mode - kAgcDefault, // platform default - // adaptive mode for use when analog volume control exists (e.g. for - // PC softphone) - kAgcAdaptiveAnalog, - // scaling takes place in the digital domain (e.g. for conference servers - // and embedded devices) - kAgcAdaptiveDigital, - // can be used on embedded devices where the capture signal level - // is predictable - kAgcFixedDigital -}; - -// EC modes -enum EcModes // type of Echo Control -{ - kEcUnchanged = 0, // previously set mode - kEcDefault, // platform default - kEcConference, // conferencing default (aggressive AEC) - kEcAec, // Acoustic Echo Cancellation - kEcAecm, // AEC mobile -}; - -// AECM modes -enum AecmModes // mode of AECM -{ - kAecmQuietEarpieceOrHeadset = 0, - // Quiet earpiece or headset use - kAecmEarpiece, // most earpiece use - kAecmLoudEarpiece, // Loud earpiece or quiet speakerphone use - kAecmSpeakerphone, // most speakerphone use (default) - kAecmLoudSpeakerphone // Loud speakerphone -}; - -// AGC configuration -typedef struct -{ - unsigned short targetLeveldBOv; - unsigned short digitalCompressionGaindB; - bool limiterEnable; -} AgcConfig; // AGC configuration parameters - -enum StereoChannel -{ - kStereoLeft = 0, - kStereoRight, - kStereoBoth -}; - -// Audio device layers -enum AudioLayers -{ - kAudioPlatformDefault = 0, - kAudioWindowsWave = 1, - kAudioWindowsCore = 2, - kAudioLinuxAlsa = 3, - kAudioLinuxPulse = 4 -}; - -// TODO(henrika): to be removed. -enum NetEqModes // NetEQ playout configurations -{ - // Optimized trade-off between low delay and jitter robustness for two-way - // communication. - kNetEqDefault = 0, - // Improved jitter robustness at the cost of increased delay. Can be - // used in one-way communication. - kNetEqStreaming = 1, - // Optimzed for decodability of fax signals rather than for perceived audio - // quality. - kNetEqFax = 2, - // Minimal buffer management. Inserts zeros for lost packets and during - // buffer increases. - kNetEqOff = 3, -}; - -// TODO(henrika): to be removed. -enum OnHoldModes // On Hold direction -{ - kHoldSendAndPlay = 0, // Put both sending and playing in on-hold state. - kHoldSendOnly, // Put only sending in on-hold state. - kHoldPlayOnly // Put only playing in on-hold state. -}; - -// TODO(henrika): to be removed. -enum AmrMode -{ - kRfc3267BwEfficient = 0, - kRfc3267OctetAligned = 1, - kRfc3267FileStorage = 2, -}; - -// ================================================================== -// Video specific types -// ================================================================== - -// Raw video types -enum RawVideoType -{ - kVideoI420 = 0, - kVideoYV12 = 1, - kVideoYUY2 = 2, - kVideoUYVY = 3, - kVideoIYUV = 4, - kVideoARGB = 5, - kVideoRGB24 = 6, - kVideoRGB565 = 7, - kVideoARGB4444 = 8, - kVideoARGB1555 = 9, - kVideoMJPEG = 10, - kVideoNV12 = 11, - kVideoNV21 = 12, - kVideoBGRA = 13, - kVideoUnknown = 99 -}; - -// Video codec -enum { kConfigParameterSize = 128}; -enum { kPayloadNameSize = 32}; -enum { kMaxSimulcastStreams = 4}; -enum { kMaxSpatialLayers = 5 }; -enum { kMaxTemporalStreams = 4}; - -enum VideoCodecComplexity -{ - kComplexityNormal = 0, - kComplexityHigh = 1, - kComplexityHigher = 2, - kComplexityMax = 3 -}; - -enum VideoCodecProfile -{ - kProfileBase = 0x00, - kProfileMain = 0x01 -}; - -enum VP8ResilienceMode { - kResilienceOff, // The stream produced by the encoder requires a - // recovery frame (typically a key frame) to be - // decodable after a packet loss. - kResilientStream, // A stream produced by the encoder is resilient to - // packet losses, but packets within a frame subsequent - // to a loss can't be decoded. - kResilientFrames // Same as kResilientStream but with added resilience - // within a frame. -}; - -// VP8 specific -struct VideoCodecVP8 { - bool pictureLossIndicationOn; - bool feedbackModeOn; - VideoCodecComplexity complexity; - VP8ResilienceMode resilience; - unsigned char numberOfTemporalLayers; - bool denoisingOn; - bool errorConcealmentOn; - bool automaticResizeOn; - bool frameDroppingOn; - int keyFrameInterval; - - bool operator==(const VideoCodecVP8& other) const { - return pictureLossIndicationOn == other.pictureLossIndicationOn && - feedbackModeOn == other.feedbackModeOn && - complexity == other.complexity && - resilience == other.resilience && - numberOfTemporalLayers == other.numberOfTemporalLayers && - denoisingOn == other.denoisingOn && - errorConcealmentOn == other.errorConcealmentOn && - automaticResizeOn == other.automaticResizeOn && - frameDroppingOn == other.frameDroppingOn && - keyFrameInterval == other.keyFrameInterval; - } - - bool operator!=(const VideoCodecVP8& other) const { - return !(*this == other); - } -}; - -// VP9 specific. -struct VideoCodecVP9 { - VideoCodecComplexity complexity; - int resilience; - unsigned char numberOfTemporalLayers; - bool denoisingOn; - bool frameDroppingOn; - int keyFrameInterval; - bool adaptiveQpMode; - bool automaticResizeOn; - unsigned char numberOfSpatialLayers; - bool flexibleMode; -}; - -// H264 specific. -struct VideoCodecH264 { - VideoCodecProfile profile; - bool frameDroppingOn; - int keyFrameInterval; - // These are NULL/0 if not externally negotiated. - const uint8_t* spsData; - size_t spsLen; - const uint8_t* ppsData; - size_t ppsLen; -}; - -// Video codec types -enum VideoCodecType { - kVideoCodecVP8, - kVideoCodecVP9, - kVideoCodecH264, - kVideoCodecI420, - kVideoCodecRED, - kVideoCodecULPFEC, - kVideoCodecGeneric, - kVideoCodecUnknown -}; - -union VideoCodecUnion { - VideoCodecVP8 VP8; - VideoCodecVP9 VP9; - VideoCodecH264 H264; -}; - - -// Simulcast is when the same stream is encoded multiple times with different -// settings such as resolution. -struct SimulcastStream { - unsigned short width; - unsigned short height; - unsigned char numberOfTemporalLayers; - unsigned int maxBitrate; // kilobits/sec. - unsigned int targetBitrate; // kilobits/sec. - unsigned int minBitrate; // kilobits/sec. - unsigned int qpMax; // minimum quality - - bool operator==(const SimulcastStream& other) const { - return width == other.width && - height == other.height && - numberOfTemporalLayers == other.numberOfTemporalLayers && - maxBitrate == other.maxBitrate && - targetBitrate == other.targetBitrate && - minBitrate == other.minBitrate && - qpMax == other.qpMax; - } - - bool operator!=(const SimulcastStream& other) const { - return !(*this == other); - } -}; - -struct SpatialLayer { - int scaling_factor_num; - int scaling_factor_den; - int target_bitrate_bps; - // TODO(ivica): Add max_quantizer and min_quantizer? -}; - -enum VideoCodecMode { - kRealtimeVideo, - kScreensharing -}; - -// Common video codec properties -struct VideoCodec { - VideoCodecType codecType; - char plName[kPayloadNameSize]; - unsigned char plType; - - unsigned short width; - unsigned short height; - - unsigned int startBitrate; // kilobits/sec. - unsigned int maxBitrate; // kilobits/sec. - unsigned int minBitrate; // kilobits/sec. - unsigned int targetBitrate; // kilobits/sec. - - unsigned char maxFramerate; - - VideoCodecUnion codecSpecific; - - unsigned int qpMax; - unsigned char numberOfSimulcastStreams; - SimulcastStream simulcastStream[kMaxSimulcastStreams]; - SpatialLayer spatialLayers[kMaxSpatialLayers]; - - VideoCodecMode mode; - - // When using an external encoder/decoder this allows to pass - // extra options without requiring webrtc to be aware of them. - Config* extra_options; - - bool operator==(const VideoCodec& other) const { - bool ret = codecType == other.codecType && - (STR_CASE_CMP(plName, other.plName) == 0) && - plType == other.plType && - width == other.width && - height == other.height && - startBitrate == other.startBitrate && - maxBitrate == other.maxBitrate && - minBitrate == other.minBitrate && - targetBitrate == other.targetBitrate && - maxFramerate == other.maxFramerate && - qpMax == other.qpMax && - numberOfSimulcastStreams == other.numberOfSimulcastStreams && - mode == other.mode; - if (ret && codecType == kVideoCodecVP8) { - ret &= (codecSpecific.VP8 == other.codecSpecific.VP8); - } - - for (unsigned char i = 0; i < other.numberOfSimulcastStreams && ret; ++i) { - ret &= (simulcastStream[i] == other.simulcastStream[i]); - } - return ret; - } - - bool operator!=(const VideoCodec& other) const { - return !(*this == other); - } -}; - -// Bandwidth over-use detector options. These are used to drive -// experimentation with bandwidth estimation parameters. -// See modules/remote_bitrate_estimator/overuse_detector.h -struct OverUseDetectorOptions { - OverUseDetectorOptions() - : initial_slope(8.0/512.0), - initial_offset(0), - initial_e(), - initial_process_noise(), - initial_avg_noise(0.0), - initial_var_noise(50) { - initial_e[0][0] = 100; - initial_e[1][1] = 1e-1; - initial_e[0][1] = initial_e[1][0] = 0; - initial_process_noise[0] = 1e-13; - initial_process_noise[1] = 1e-2; - } - double initial_slope; - double initial_offset; - double initial_e[2][2]; - double initial_process_noise[2]; - double initial_avg_noise; - double initial_var_noise; -}; - -// This structure will have the information about when packet is actually -// received by socket. -struct PacketTime { - PacketTime() : timestamp(-1), not_before(-1) {} - PacketTime(int64_t timestamp, int64_t not_before) - : timestamp(timestamp), not_before(not_before) { - } - - int64_t timestamp; // Receive time after socket delivers the data. - int64_t not_before; // Earliest possible time the data could have arrived, - // indicating the potential error in the |timestamp| - // value,in case the system is busy. - // For example, the time of the last select() call. - // If unknown, this value will be set to zero. -}; - -struct RTPHeaderExtension { - RTPHeaderExtension(); - - bool hasTransmissionTimeOffset; - int32_t transmissionTimeOffset; - bool hasAbsoluteSendTime; - uint32_t absoluteSendTime; - bool hasTransportSequenceNumber; - uint16_t transportSequenceNumber; - - // Audio Level includes both level in dBov and voiced/unvoiced bit. See: - // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ - bool hasAudioLevel; - bool voiceActivity; - uint8_t audioLevel; - - // For Coordination of Video Orientation. See - // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ - // ts_126114v120700p.pdf - bool hasVideoRotation; - uint8_t videoRotation; -}; - -struct RTPHeader { - RTPHeader(); - - bool markerBit; - uint8_t payloadType; - uint16_t sequenceNumber; - uint32_t timestamp; - uint32_t ssrc; - uint8_t numCSRCs; - uint32_t arrOfCSRCs[kRtpCsrcSize]; - size_t paddingLength; - size_t headerLength; - int payload_type_frequency; - RTPHeaderExtension extension; -}; - -struct RtpPacketCounter { - RtpPacketCounter() - : header_bytes(0), - payload_bytes(0), - padding_bytes(0), - packets(0) {} - - void Add(const RtpPacketCounter& other) { - header_bytes += other.header_bytes; - payload_bytes += other.payload_bytes; - padding_bytes += other.padding_bytes; - packets += other.packets; - } - - void AddPacket(size_t packet_length, const RTPHeader& header) { - ++packets; - header_bytes += header.headerLength; - padding_bytes += header.paddingLength; - payload_bytes += - packet_length - (header.headerLength + header.paddingLength); - } - - size_t TotalBytes() const { - return header_bytes + payload_bytes + padding_bytes; - } - - size_t header_bytes; // Number of bytes used by RTP headers. - size_t payload_bytes; // Payload bytes, excluding RTP headers and padding. - size_t padding_bytes; // Number of padding bytes. - uint32_t packets; // Number of packets. -}; - -// Data usage statistics for a (rtp) stream. -struct StreamDataCounters { - StreamDataCounters(); - - void Add(const StreamDataCounters& other) { - transmitted.Add(other.transmitted); - retransmitted.Add(other.retransmitted); - fec.Add(other.fec); - if (other.first_packet_time_ms != -1 && - (other.first_packet_time_ms < first_packet_time_ms || - first_packet_time_ms == -1)) { - // Use oldest time. - first_packet_time_ms = other.first_packet_time_ms; - } - } - - int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { - return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); - } - - // Returns the number of bytes corresponding to the actual media payload (i.e. - // RTP headers, padding, retransmissions and fec packets are excluded). - // Note this function does not have meaning for an RTX stream. - size_t MediaPayloadBytes() const { - return transmitted.payload_bytes - retransmitted.payload_bytes - - fec.payload_bytes; - } - - int64_t first_packet_time_ms; // Time when first packet is sent/received. - RtpPacketCounter transmitted; // Number of transmitted packets/bytes. - RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes. - RtpPacketCounter fec; // Number of redundancy packets/bytes. -}; - -// Callback, called whenever byte/packet counts have been updated. -class StreamDataCountersCallback { - public: - virtual ~StreamDataCountersCallback() {} - - virtual void DataCountersUpdated(const StreamDataCounters& counters, - uint32_t ssrc) = 0; -}; - -// RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size -// RTCP mode is described by RFC 5506. -enum class RtcpMode { kOff, kCompound, kReducedSize }; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_TYPES_H_ diff --git a/include/webrtc/common_video/include/i420_buffer_pool.h b/include/webrtc/common_video/include/i420_buffer_pool.h deleted file mode 100644 index 5ab1510..0000000 --- a/include/webrtc/common_video/include/i420_buffer_pool.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ - -#include - -#include "webrtc/base/thread_checker.h" -#include "webrtc/common_video/include/video_frame_buffer.h" - -namespace webrtc { - -// Simple buffer pool to avoid unnecessary allocations of I420Buffer objects. -// The pool manages the memory of the I420Buffer returned from CreateBuffer. -// When the I420Buffer is destructed, the memory is returned to the pool for use -// by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer -// changes, old buffers will be purged from the pool. -class I420BufferPool { - public: - I420BufferPool(); - // Returns a buffer from the pool, or creates a new buffer if no suitable - // buffer exists in the pool. - rtc::scoped_refptr CreateBuffer(int width, int height); - // Clears buffers_ and detaches the thread checker so that it can be reused - // later from another thread. - void Release(); - - private: - rtc::ThreadChecker thread_checker_; - std::list> buffers_; -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ diff --git a/include/webrtc/common_video/include/incoming_video_stream.h b/include/webrtc/common_video/include/incoming_video_stream.h deleted file mode 100644 index e3147eb..0000000 --- a/include/webrtc/common_video/include/incoming_video_stream.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ - -#include "webrtc/base/platform_thread.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/thread_annotations.h" -#include "webrtc/common_video/video_render_frames.h" - -namespace webrtc { -class CriticalSectionWrapper; -class EventTimerWrapper; - -class VideoRenderCallback { - public: - virtual int32_t RenderFrame(const uint32_t streamId, - const VideoFrame& videoFrame) = 0; - - protected: - virtual ~VideoRenderCallback() {} -}; - -class IncomingVideoStream : public VideoRenderCallback { - public: - IncomingVideoStream(uint32_t stream_id, bool disable_prerenderer_smoothing); - ~IncomingVideoStream(); - - // Get callback to deliver frames to the module. - VideoRenderCallback* ModuleCallback(); - virtual int32_t RenderFrame(const uint32_t stream_id, - const VideoFrame& video_frame); - - // Set callback to the platform dependent code. - void SetRenderCallback(VideoRenderCallback* render_callback); - - // Callback for file recording, snapshot, ... - void SetExternalCallback(VideoRenderCallback* render_object); - - // Start/Stop. - int32_t Start(); - int32_t Stop(); - - // Clear all buffers. - int32_t Reset(); - - // Properties. - uint32_t StreamId() const; - uint32_t IncomingRate() const; - - int32_t SetStartImage(const VideoFrame& video_frame); - - int32_t SetTimeoutImage(const VideoFrame& video_frame, - const uint32_t timeout); - - int32_t SetExpectedRenderDelay(int32_t delay_ms); - - protected: - static bool IncomingVideoStreamThreadFun(void* obj); - bool IncomingVideoStreamProcess(); - - private: - enum { kEventStartupTimeMs = 10 }; - enum { kEventMaxWaitTimeMs = 100 }; - enum { kFrameRatePeriodMs = 1000 }; - - void DeliverFrame(const VideoFrame& video_frame); - - uint32_t const stream_id_; - const bool disable_prerenderer_smoothing_; - // Critsects in allowed to enter order. - const rtc::scoped_ptr stream_critsect_; - const rtc::scoped_ptr thread_critsect_; - const rtc::scoped_ptr buffer_critsect_; - // TODO(pbos): Make plain member and stop resetting this thread, just - // start/stoping it is enough. - rtc::scoped_ptr incoming_render_thread_ - GUARDED_BY(thread_critsect_); - rtc::scoped_ptr deliver_buffer_event_; - - bool running_ GUARDED_BY(stream_critsect_); - VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); - VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); - const rtc::scoped_ptr render_buffers_ - GUARDED_BY(buffer_critsect_); - - uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); - int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); - uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); - int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); - VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); - VideoFrame start_image_ GUARDED_BY(thread_critsect_); - VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); - uint32_t timeout_time_ GUARDED_BY(thread_critsect_); -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ diff --git a/include/webrtc/common_video/include/video_frame_buffer.h b/include/webrtc/common_video/include/video_frame_buffer.h deleted file mode 100644 index 710d286..0000000 --- a/include/webrtc/common_video/include/video_frame_buffer.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ - -#include "webrtc/base/callback.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/system_wrappers/include/aligned_malloc.h" - -namespace webrtc { - -enum PlaneType { - kYPlane = 0, - kUPlane = 1, - kVPlane = 2, - kNumOfPlanes = 3, -}; - -// Interface of a simple frame buffer containing pixel data. This interface does -// not contain any frame metadata such as rotation, timestamp, pixel_width, etc. -class VideoFrameBuffer : public rtc::RefCountInterface { - public: - // Returns true if this buffer has a single exclusive owner. - virtual bool HasOneRef() const = 0; - - // The resolution of the frame in pixels. For formats where some planes are - // subsampled, this is the highest-resolution plane. - virtual int width() const = 0; - virtual int height() const = 0; - - // Returns pointer to the pixel data for a given plane. The memory is owned by - // the VideoFrameBuffer object and must not be freed by the caller. - virtual const uint8_t* data(PlaneType type) const = 0; - - // Non-const data access is disallowed by default. You need to make sure you - // have exclusive access and a writable buffer before calling this function. - virtual uint8_t* MutableData(PlaneType type); - - // Returns the number of bytes between successive rows for a given plane. - virtual int stride(PlaneType type) const = 0; - - // Return the handle of the underlying video frame. This is used when the - // frame is backed by a texture. - virtual void* native_handle() const = 0; - - // Returns a new memory-backed frame buffer converted from this buffer's - // native handle. - virtual rtc::scoped_refptr NativeToI420Buffer() = 0; - - protected: - virtual ~VideoFrameBuffer(); -}; - -// Plain I420 buffer in standard memory. -class I420Buffer : public VideoFrameBuffer { - public: - I420Buffer(int width, int height); - I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); - - int width() const override; - int height() const override; - const uint8_t* data(PlaneType type) const override; - // Non-const data access is only allowed if HasOneRef() is true to protect - // against unexpected overwrites. - uint8_t* MutableData(PlaneType type) override; - int stride(PlaneType type) const override; - void* native_handle() const override; - rtc::scoped_refptr NativeToI420Buffer() override; - - protected: - ~I420Buffer() override; - - private: - const int width_; - const int height_; - const int stride_y_; - const int stride_u_; - const int stride_v_; - const rtc::scoped_ptr data_; -}; - -// Base class for native-handle buffer is a wrapper around a |native_handle|. -// This is used for convenience as most native-handle implementations can share -// many VideoFrame implementations, but need to implement a few others (such -// as their own destructors or conversion methods back to software I420). -class NativeHandleBuffer : public VideoFrameBuffer { - public: - NativeHandleBuffer(void* native_handle, int width, int height); - - int width() const override; - int height() const override; - const uint8_t* data(PlaneType type) const override; - int stride(PlaneType type) const override; - void* native_handle() const override; - - protected: - void* native_handle_; - const int width_; - const int height_; -}; - -class WrappedI420Buffer : public webrtc::VideoFrameBuffer { - public: - WrappedI420Buffer(int width, - int height, - const uint8_t* y_plane, - int y_stride, - const uint8_t* u_plane, - int u_stride, - const uint8_t* v_plane, - int v_stride, - const rtc::Callback0& no_longer_used); - int width() const override; - int height() const override; - - const uint8_t* data(PlaneType type) const override; - - int stride(PlaneType type) const override; - void* native_handle() const override; - - rtc::scoped_refptr NativeToI420Buffer() override; - - private: - friend class rtc::RefCountedObject; - ~WrappedI420Buffer() override; - - const int width_; - const int height_; - const uint8_t* const y_plane_; - const uint8_t* const u_plane_; - const uint8_t* const v_plane_; - const int y_stride_; - const int u_stride_; - const int v_stride_; - rtc::Callback0 no_longer_used_cb_; -}; - -// Helper function to crop |buffer| without making a deep copy. May only be used -// for non-native frames. -rtc::scoped_refptr ShallowCenterCrop( - const rtc::scoped_refptr& buffer, - int cropped_width, - int cropped_height); - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ diff --git a/include/webrtc/common_video/include/video_image.h b/include/webrtc/common_video/include/video_image.h deleted file mode 100644 index 4a6e451..0000000 --- a/include/webrtc/common_video/include/video_image.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_IMAGE_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_IMAGE_H_ - -// TODO(pbos): Remove this file and include webrtc/video_frame.h instead. -#include "webrtc/video_frame.h" - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_IMAGE_H_ diff --git a/include/webrtc/common_video/libyuv/include/scaler.h b/include/webrtc/common_video/libyuv/include/scaler.h deleted file mode 100644 index 2b92f81..0000000 --- a/include/webrtc/common_video/libyuv/include/scaler.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -/* - * Interface to the LibYuv scaling functionality - */ - -#ifndef WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_SCALER_H_ -#define WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_SCALER_H_ - -#include "webrtc/common_video/include/i420_buffer_pool.h" -#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { - -// Supported scaling types -enum ScaleMethod { - kScalePoint, // no interpolation - kScaleBilinear, - kScaleBox -}; - -class Scaler { - public: - Scaler(); - ~Scaler(); - - // Set interpolation properties: - // - // Return value: 0 - OK - // -1 - parameter error - int Set(int src_width, int src_height, - int dst_width, int dst_height, - VideoType src_video_type, VideoType dst_video_type, - ScaleMethod method); - - // Scale frame - // Memory is allocated by this object and recycled using |buffer_pool_|. - // Return value: 0 - OK, - // -1 - parameter error - // -2 - scaler not set - int Scale(const VideoFrame& src_frame, VideoFrame* dst_frame); - - private: - // Determine if the VideoTypes are currently supported. - bool SupportedVideoType(VideoType src_video_type, - VideoType dst_video_type); - - ScaleMethod method_; - int src_width_; - int src_height_; - int dst_width_; - int dst_height_; - bool set_; - I420BufferPool buffer_pool_; -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_SCALER_H_ diff --git a/include/webrtc/common_video/libyuv/include/webrtc_libyuv.h b/include/webrtc/common_video/libyuv/include/webrtc_libyuv.h deleted file mode 100644 index d66736f..0000000 --- a/include/webrtc/common_video/libyuv/include/webrtc_libyuv.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -/* - * WebRTC's wrapper to libyuv. - */ - -#ifndef WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ -#define WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ - -#include - -#include "webrtc/common_types.h" // RawVideoTypes. -#include "webrtc/common_video/rotation.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { - -// Supported video types. -enum VideoType { - kUnknown, - kI420, - kIYUV, - kRGB24, - kABGR, - kARGB, - kARGB4444, - kRGB565, - kARGB1555, - kYUY2, - kYV12, - kUYVY, - kMJPG, - kNV21, - kNV12, - kBGRA, -}; - -// This is the max PSNR value our algorithms can return. -const double kPerfectPSNR = 48.0f; - -// Conversion between the RawVideoType and the LibYuv videoType. -// TODO(wu): Consolidate types into one type throughout WebRtc. -VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type); - -// Align integer values. -// Input: -// - value : Input value to be aligned. -// - alignment : Alignment basis (power of 2). -// Return value: An aligned form of the input value. -int AlignInt(int value, int alignment); - -// Align stride values for I420 Video frames. -// Input: -// - width : Image width. -// - stride_y : Pointer to the stride of the y plane. -// - stride_uv: Pointer to the stride of the u and v planes (setting identical -// values for both). -// Setting 16 byte alignment. -void Calc16ByteAlignedStride(int width, int* stride_y, int* stride_uv); - -// Calculate the required buffer size. -// Input: -// - type :The type of the designated video frame. -// - width :frame width in pixels. -// - height :frame height in pixels. -// Return value: :The required size in bytes to accommodate the specified -// video frame. -size_t CalcBufferSize(VideoType type, int width, int height); - -// TODO(mikhal): Add unit test for these two functions and determine location. -// Print VideoFrame to file -// Input: -// - frame : Reference to video frame. -// - file : pointer to file object. It is assumed that the file is -// already open for writing. -// Return value: 0 if OK, < 0 otherwise. -int PrintVideoFrame(const VideoFrame& frame, FILE* file); - -// Extract buffer from VideoFrame (consecutive planes, no stride) -// Input: -// - frame : Reference to video frame. -// - size : pointer to the size of the allocated buffer. If size is -// insufficient, an error will be returned. -// - buffer : Pointer to buffer -// Return value: length of buffer if OK, < 0 otherwise. -int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer); -// Convert To I420 -// Input: -// - src_video_type : Type of input video. -// - src_frame : Pointer to a source frame. -// - crop_x/crop_y : Starting positions for cropping (0 for no crop). -// - src_width : src width in pixels. -// - src_height : src height in pixels. -// - sample_size : Required only for the parsing of MJPG (set to 0 else). -// - rotate : Rotation mode of output image. -// Output: -// - dst_frame : Reference to a destination frame. -// Return value: 0 if OK, < 0 otherwise. - -int ConvertToI420(VideoType src_video_type, - const uint8_t* src_frame, - int crop_x, - int crop_y, - int src_width, - int src_height, - size_t sample_size, - VideoRotation rotation, - VideoFrame* dst_frame); - -// Convert From I420 -// Input: -// - src_frame : Reference to a source frame. -// - dst_video_type : Type of output video. -// - dst_sample_size : Required only for the parsing of MJPG. -// - dst_frame : Pointer to a destination frame. -// Return value: 0 if OK, < 0 otherwise. -// It is assumed that source and destination have equal height. -int ConvertFromI420(const VideoFrame& src_frame, - VideoType dst_video_type, - int dst_sample_size, - uint8_t* dst_frame); -// ConvertFrom YV12. -// Interface - same as above. -int ConvertFromYV12(const VideoFrame& src_frame, - VideoType dst_video_type, - int dst_sample_size, - uint8_t* dst_frame); - -// The following list describes designated conversion functions which -// are not covered by the previous general functions. -// Input and output descriptions mostly match the above descriptions, and are -// therefore omitted. -int ConvertRGB24ToARGB(const uint8_t* src_frame, - uint8_t* dst_frame, - int width, int height, - int dst_stride); -int ConvertNV12ToRGB565(const uint8_t* src_frame, - uint8_t* dst_frame, - int width, int height); - -// Compute PSNR for an I420 frame (all planes). -// Returns the PSNR in decibel, to a maximum of kInfinitePSNR. -double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); -// Compute SSIM for an I420 frame (all planes). -double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ diff --git a/include/webrtc/common_video/rotation.h b/include/webrtc/common_video/rotation.h deleted file mode 100644 index 46a9ecc..0000000 --- a/include/webrtc/common_video/rotation.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_ROTATION_H_ -#define WEBRTC_COMMON_VIDEO_ROTATION_H_ - -namespace webrtc { - -// enum for clockwise rotation. -enum VideoRotation { - kVideoRotation_0 = 0, - kVideoRotation_90 = 90, - kVideoRotation_180 = 180, - kVideoRotation_270 = 270 -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_ROTATION_H_ diff --git a/include/webrtc/common_video/video_render_frames.h b/include/webrtc/common_video/video_render_frames.h deleted file mode 100644 index 450c1f2..0000000 --- a/include/webrtc/common_video/video_render_frames.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_VIDEO_RENDER_FRAMES_H_ -#define WEBRTC_COMMON_VIDEO_VIDEO_RENDER_FRAMES_H_ - -#include - -#include - -#include "webrtc/video_frame.h" - -namespace webrtc { - -// Class definitions -class VideoRenderFrames { - public: - VideoRenderFrames(); - - // Add a frame to the render queue - int32_t AddFrame(const VideoFrame& new_frame); - - // Get a frame for rendering, or a zero-size frame if it's not time to render. - VideoFrame FrameToRender(); - - // Releases all frames - int32_t ReleaseAllFrames(); - - // Returns the number of ms to next frame to render - uint32_t TimeToNextFrameRelease(); - - // Sets estimates delay in renderer - int32_t SetRenderDelay(const uint32_t render_delay); - - private: - // 10 seconds for 30 fps. - enum { KMaxNumberOfFrames = 300 }; - // Don't render frames with timestamp older than 500ms from now. - enum { KOldRenderTimestampMS = 500 }; - // Don't render frames with timestamp more than 10s into the future. - enum { KFutureRenderTimestampMS = 10000 }; - - // Sorted list with framed to be rendered, oldest first. - std::list incoming_frames_; - - // Estimated delay from a frame is released until it's rendered. - uint32_t render_delay_ms_; -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_VIDEO_RENDER_FRAMES_H_ diff --git a/include/webrtc/config.h b/include/webrtc/config.h deleted file mode 100644 index 45a2ece..0000000 --- a/include/webrtc/config.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// TODO(pbos): Move Config from common.h to here. - -#ifndef WEBRTC_CONFIG_H_ -#define WEBRTC_CONFIG_H_ - -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -// Settings for NACK, see RFC 4585 for details. -struct NackConfig { - NackConfig() : rtp_history_ms(0) {} - // Send side: the time RTP packets are stored for retransmissions. - // Receive side: the time the receiver is prepared to wait for - // retransmissions. - // Set to '0' to disable. - int rtp_history_ms; -}; - -// Settings for forward error correction, see RFC 5109 for details. Set the -// payload types to '-1' to disable. -struct FecConfig { - FecConfig() - : ulpfec_payload_type(-1), - red_payload_type(-1), - red_rtx_payload_type(-1) {} - std::string ToString() const; - // Payload type used for ULPFEC packets. - int ulpfec_payload_type; - - // Payload type used for RED packets. - int red_payload_type; - - // RTX payload type for RED payload. - int red_rtx_payload_type; -}; - -// RTP header extension, see RFC 5285. -struct RtpExtension { - RtpExtension(const std::string& name, int id) : name(name), id(id) {} - std::string ToString() const; - bool operator==(const RtpExtension& rhs) const { - return name == rhs.name && id == rhs.id; - } - static bool IsSupportedForAudio(const std::string& name); - static bool IsSupportedForVideo(const std::string& name); - - static const char* kTOffset; - static const char* kAbsSendTime; - static const char* kVideoRotation; - static const char* kAudioLevel; - static const char* kTransportSequenceNumber; - std::string name; - int id; -}; - -struct VideoStream { - VideoStream(); - ~VideoStream(); - std::string ToString() const; - - size_t width; - size_t height; - int max_framerate; - - int min_bitrate_bps; - int target_bitrate_bps; - int max_bitrate_bps; - - int max_qp; - - // Bitrate thresholds for enabling additional temporal layers. Since these are - // thresholds in between layers, we have one additional layer. One threshold - // gives two temporal layers, one below the threshold and one above, two give - // three, and so on. - // The VideoEncoder may redistribute bitrates over the temporal layers so a - // bitrate threshold of 100k and an estimate of 105k does not imply that we - // get 100k in one temporal layer and 5k in the other, just that the bitrate - // in the first temporal layer should not exceed 100k. - // TODO(pbos): Apart from a special case for two-layer screencast these - // thresholds are not propagated to the VideoEncoder. To be implemented. - std::vector temporal_layer_thresholds_bps; -}; - -struct VideoEncoderConfig { - enum class ContentType { - kRealtimeVideo, - kScreen, - }; - - VideoEncoderConfig(); - ~VideoEncoderConfig(); - std::string ToString() const; - - std::vector streams; - std::vector spatial_layers; - ContentType content_type; - void* encoder_specific_settings; - - // Padding will be used up to this bitrate regardless of the bitrate produced - // by the encoder. Padding above what's actually produced by the encoder helps - // maintaining a higher bitrate estimate. Padding will however not be sent - // unless the estimated bandwidth indicates that the link can handle it. - int min_transmit_bitrate_bps; -}; - -// Controls the capacity of the packet buffer in NetEq. The capacity is the -// maximum number of packets that the buffer can contain. If the limit is -// exceeded, the buffer will be flushed. The capacity does not affect the actual -// audio delay in the general case, since this is governed by the target buffer -// level (calculated from the jitter profile). It is only in the rare case of -// severe network freezes that a higher capacity will lead to a (transient) -// increase in audio delay. -struct NetEqCapacityConfig { - NetEqCapacityConfig() : enabled(false), capacity(0) {} - explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {} - bool enabled; - int capacity; -}; - -struct NetEqFastAccelerate { - NetEqFastAccelerate() : enabled(false) {} - explicit NetEqFastAccelerate(bool value) : enabled(value) {} - bool enabled; -}; - -struct VoicePacing { - VoicePacing() : enabled(false) {} - explicit VoicePacing(bool value) : enabled(value) {} - bool enabled; -}; - -} // namespace webrtc - -#endif // WEBRTC_CONFIG_H_ diff --git a/include/webrtc/engine_configurations.h b/include/webrtc/engine_configurations.h deleted file mode 100644 index 42b1816..0000000 --- a/include/webrtc/engine_configurations.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_ENGINE_CONFIGURATIONS_H_ -#define WEBRTC_ENGINE_CONFIGURATIONS_H_ - -#include "webrtc/typedefs.h" - -// ============================================================================ -// VoiceEngine -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Settings for VoiceEngine -// ---------------------------------------------------------------------------- - -#define WEBRTC_VOICE_ENGINE_AGC // Near-end AGC -#define WEBRTC_VOICE_ENGINE_ECHO // Near-end AEC -#define WEBRTC_VOICE_ENGINE_NR // Near-end NS - -#if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) -#define WEBRTC_VOICE_ENGINE_TYPING_DETECTION // Typing detection -#endif - -// ---------------------------------------------------------------------------- -// VoiceEngine sub-APIs -// ---------------------------------------------------------------------------- - -#define WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API -#define WEBRTC_VOICE_ENGINE_CODEC_API -#define WEBRTC_VOICE_ENGINE_DTMF_API -#define WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API -#define WEBRTC_VOICE_ENGINE_FILE_API -#define WEBRTC_VOICE_ENGINE_HARDWARE_API -#define WEBRTC_VOICE_ENGINE_NETEQ_STATS_API -#define WEBRTC_VOICE_ENGINE_RTP_RTCP_API -#define WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API -#define WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API - -// ============================================================================ -// Platform specific configurations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// VideoEngine Windows -// ---------------------------------------------------------------------------- - -#if defined(_WIN32) -#define DIRECT3D9_RENDERING // Requires DirectX 9. -#endif - -// ---------------------------------------------------------------------------- -// VideoEngine MAC -// ---------------------------------------------------------------------------- - -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -// #define CARBON_RENDERING -#define COCOA_RENDERING -#endif - -// ---------------------------------------------------------------------------- -// VideoEngine Mobile iPhone -// ---------------------------------------------------------------------------- - -#if defined(WEBRTC_IOS) -#define EAGL_RENDERING -#endif - -#endif // WEBRTC_ENGINE_CONFIGURATIONS_H_ diff --git a/include/webrtc/frame_callback.h b/include/webrtc/frame_callback.h deleted file mode 100644 index b7f2210..0000000 --- a/include/webrtc/frame_callback.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_FRAME_CALLBACK_H_ -#define WEBRTC_FRAME_CALLBACK_H_ - -#include - -#include "webrtc/common_types.h" - -namespace webrtc { - -class VideoFrame; - -struct EncodedFrame { - public: - EncodedFrame() : data_(NULL), length_(0), frame_type_(kEmptyFrame) {} - EncodedFrame(const uint8_t* data, size_t length, FrameType frame_type) - : data_(data), length_(length), frame_type_(frame_type) {} - - const uint8_t* data_; - const size_t length_; - const FrameType frame_type_; -}; - -class I420FrameCallback { - public: - // This function is called with a I420 frame allowing the user to modify the - // frame content. - virtual void FrameCallback(VideoFrame* video_frame) = 0; - - protected: - virtual ~I420FrameCallback() {} -}; - -class EncodedFrameObserver { - public: - virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0; - - protected: - virtual ~EncodedFrameObserver() {} -}; - -} // namespace webrtc - -#endif // WEBRTC_FRAME_CALLBACK_H_ diff --git a/include/webrtc/modules/audio_device/include/audio_device.h b/include/webrtc/modules/audio_device/include/audio_device.h deleted file mode 100644 index 15e0873..0000000 --- a/include/webrtc/modules/audio_device/include/audio_device.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_ -#define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_ - -#include "webrtc/modules/audio_device/include/audio_device_defines.h" -#include "webrtc/modules/include/module.h" - -namespace webrtc { - -class AudioDeviceModule : public RefCountedModule { - public: - enum ErrorCode { - kAdmErrNone = 0, - kAdmErrArgument = 1 - }; - - enum AudioLayer { - kPlatformDefaultAudio = 0, - kWindowsWaveAudio = 1, - kWindowsCoreAudio = 2, - kLinuxAlsaAudio = 3, - kLinuxPulseAudio = 4, - kAndroidJavaAudio = 5, - kAndroidJavaInputAndOpenSLESOutputAudio = 6, - kDummyAudio = 8 - }; - - enum WindowsDeviceType { - kDefaultCommunicationDevice = -1, - kDefaultDevice = -2 - }; - - enum BufferType { - kFixedBufferSize = 0, - kAdaptiveBufferSize = 1 - }; - - enum ChannelType { - kChannelLeft = 0, - kChannelRight = 1, - kChannelBoth = 2 - }; - - public: - // Retrieve the currently utilized audio layer - virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const = 0; - - // Error handling - virtual ErrorCode LastError() const = 0; - virtual int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) = 0; - - // Full-duplex transportation of PCM audio - virtual int32_t RegisterAudioCallback(AudioTransport* audioCallback) = 0; - - // Main initialization and termination - virtual int32_t Init() = 0; - virtual int32_t Terminate() = 0; - virtual bool Initialized() const = 0; - - // Device enumeration - virtual int16_t PlayoutDevices() = 0; - virtual int16_t RecordingDevices() = 0; - virtual int32_t PlayoutDeviceName(uint16_t index, - char name[kAdmMaxDeviceNameSize], - char guid[kAdmMaxGuidSize]) = 0; - virtual int32_t RecordingDeviceName(uint16_t index, - char name[kAdmMaxDeviceNameSize], - char guid[kAdmMaxGuidSize]) = 0; - - // Device selection - virtual int32_t SetPlayoutDevice(uint16_t index) = 0; - virtual int32_t SetPlayoutDevice(WindowsDeviceType device) = 0; - virtual int32_t SetRecordingDevice(uint16_t index) = 0; - virtual int32_t SetRecordingDevice(WindowsDeviceType device) = 0; - - // Audio transport initialization - virtual int32_t PlayoutIsAvailable(bool* available) = 0; - virtual int32_t InitPlayout() = 0; - virtual bool PlayoutIsInitialized() const = 0; - virtual int32_t RecordingIsAvailable(bool* available) = 0; - virtual int32_t InitRecording() = 0; - virtual bool RecordingIsInitialized() const = 0; - - // Audio transport control - virtual int32_t StartPlayout() = 0; - virtual int32_t StopPlayout() = 0; - virtual bool Playing() const = 0; - virtual int32_t StartRecording() = 0; - virtual int32_t StopRecording() = 0; - virtual bool Recording() const = 0; - - // Microphone Automatic Gain Control (AGC) - virtual int32_t SetAGC(bool enable) = 0; - virtual bool AGC() const = 0; - - // Volume control based on the Windows Wave API (Windows only) - virtual int32_t SetWaveOutVolume(uint16_t volumeLeft, - uint16_t volumeRight) = 0; - virtual int32_t WaveOutVolume(uint16_t* volumeLeft, - uint16_t* volumeRight) const = 0; - - // Audio mixer initialization - virtual int32_t InitSpeaker() = 0; - virtual bool SpeakerIsInitialized() const = 0; - virtual int32_t InitMicrophone() = 0; - virtual bool MicrophoneIsInitialized() const = 0; - - // Speaker volume controls - virtual int32_t SpeakerVolumeIsAvailable(bool* available) = 0; - virtual int32_t SetSpeakerVolume(uint32_t volume) = 0; - virtual int32_t SpeakerVolume(uint32_t* volume) const = 0; - virtual int32_t MaxSpeakerVolume(uint32_t* maxVolume) const = 0; - virtual int32_t MinSpeakerVolume(uint32_t* minVolume) const = 0; - virtual int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const = 0; - - // Microphone volume controls - virtual int32_t MicrophoneVolumeIsAvailable(bool* available) = 0; - virtual int32_t SetMicrophoneVolume(uint32_t volume) = 0; - virtual int32_t MicrophoneVolume(uint32_t* volume) const = 0; - virtual int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const = 0; - virtual int32_t MinMicrophoneVolume(uint32_t* minVolume) const = 0; - virtual int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const = 0; - - // Speaker mute control - virtual int32_t SpeakerMuteIsAvailable(bool* available) = 0; - virtual int32_t SetSpeakerMute(bool enable) = 0; - virtual int32_t SpeakerMute(bool* enabled) const = 0; - - // Microphone mute control - virtual int32_t MicrophoneMuteIsAvailable(bool* available) = 0; - virtual int32_t SetMicrophoneMute(bool enable) = 0; - virtual int32_t MicrophoneMute(bool* enabled) const = 0; - - // Microphone boost control - virtual int32_t MicrophoneBoostIsAvailable(bool* available) = 0; - virtual int32_t SetMicrophoneBoost(bool enable) = 0; - virtual int32_t MicrophoneBoost(bool* enabled) const = 0; - - // Stereo support - virtual int32_t StereoPlayoutIsAvailable(bool* available) const = 0; - virtual int32_t SetStereoPlayout(bool enable) = 0; - virtual int32_t StereoPlayout(bool* enabled) const = 0; - virtual int32_t StereoRecordingIsAvailable(bool* available) const = 0; - virtual int32_t SetStereoRecording(bool enable) = 0; - virtual int32_t StereoRecording(bool* enabled) const = 0; - virtual int32_t SetRecordingChannel(const ChannelType channel) = 0; - virtual int32_t RecordingChannel(ChannelType* channel) const = 0; - - // Delay information and control - virtual int32_t SetPlayoutBuffer(const BufferType type, - uint16_t sizeMS = 0) = 0; - virtual int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const = 0; - virtual int32_t PlayoutDelay(uint16_t* delayMS) const = 0; - virtual int32_t RecordingDelay(uint16_t* delayMS) const = 0; - - // CPU load - virtual int32_t CPULoad(uint16_t* load) const = 0; - - // Recording of raw PCM data - virtual int32_t StartRawOutputFileRecording( - const char pcmFileNameUTF8[kAdmMaxFileNameSize]) = 0; - virtual int32_t StopRawOutputFileRecording() = 0; - virtual int32_t StartRawInputFileRecording( - const char pcmFileNameUTF8[kAdmMaxFileNameSize]) = 0; - virtual int32_t StopRawInputFileRecording() = 0; - - // Native sample rate controls (samples/sec) - virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) = 0; - virtual int32_t RecordingSampleRate(uint32_t* samplesPerSec) const = 0; - virtual int32_t SetPlayoutSampleRate(const uint32_t samplesPerSec) = 0; - virtual int32_t PlayoutSampleRate(uint32_t* samplesPerSec) const = 0; - - // Mobile device specific functions - virtual int32_t ResetAudioDevice() = 0; - virtual int32_t SetLoudspeakerStatus(bool enable) = 0; - virtual int32_t GetLoudspeakerStatus(bool* enabled) const = 0; - - // Only supported on Android. - // TODO(henrika): Make pure virtual after updating Chromium. - virtual bool BuiltInAECIsAvailable() const { return false; } - virtual bool BuiltInAGCIsAvailable() const { return false; } - virtual bool BuiltInNSIsAvailable() const { return false; } - - // Enables the built-in audio effects. Only supported on Android. - // TODO(henrika): Make pure virtual after updating Chromium. - virtual int32_t EnableBuiltInAEC(bool enable) { return -1; } - virtual int32_t EnableBuiltInAGC(bool enable) { return -1; } - virtual int32_t EnableBuiltInNS(bool enable) { return -1; } - // Don't use. - virtual bool BuiltInAECIsEnabled() const { return false; } - - // Only supported on iOS. - // TODO(henrika): Make pure virtual after updating Chromium. - virtual int GetPlayoutAudioParameters(AudioParameters* params) const { - return -1; - } - virtual int GetRecordAudioParameters(AudioParameters* params) const { - return -1; - } - - protected: - virtual ~AudioDeviceModule() {} -}; - -AudioDeviceModule* CreateAudioDeviceModule( - int32_t id, AudioDeviceModule::AudioLayer audioLayer); - -} // namespace webrtc - -#endif // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_ diff --git a/include/webrtc/modules/audio_device/include/audio_device_defines.h b/include/webrtc/modules/audio_device/include/audio_device_defines.h deleted file mode 100644 index 3ebbd23..0000000 --- a/include/webrtc/modules/audio_device/include/audio_device_defines.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFINES_H_ -#define WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFINES_H_ - -#include - -#include "webrtc/typedefs.h" - -namespace webrtc { - -static const int kAdmMaxDeviceNameSize = 128; -static const int kAdmMaxFileNameSize = 512; -static const int kAdmMaxGuidSize = 128; - -static const int kAdmMinPlayoutBufferSizeMs = 10; -static const int kAdmMaxPlayoutBufferSizeMs = 250; - -// ---------------------------------------------------------------------------- -// AudioDeviceObserver -// ---------------------------------------------------------------------------- - -class AudioDeviceObserver { - public: - enum ErrorCode { kRecordingError = 0, kPlayoutError = 1 }; - enum WarningCode { kRecordingWarning = 0, kPlayoutWarning = 1 }; - - virtual void OnErrorIsReported(const ErrorCode error) = 0; - virtual void OnWarningIsReported(const WarningCode warning) = 0; - - protected: - virtual ~AudioDeviceObserver() {} -}; - -// ---------------------------------------------------------------------------- -// AudioTransport -// ---------------------------------------------------------------------------- - -class AudioTransport { - public: - virtual int32_t RecordedDataIsAvailable(const void* audioSamples, - const size_t nSamples, - const size_t nBytesPerSample, - const uint8_t nChannels, - const uint32_t samplesPerSec, - const uint32_t totalDelayMS, - const int32_t clockDrift, - const uint32_t currentMicLevel, - const bool keyPressed, - uint32_t& newMicLevel) = 0; - - virtual int32_t NeedMorePlayData(const size_t nSamples, - const size_t nBytesPerSample, - const uint8_t nChannels, - const uint32_t samplesPerSec, - void* audioSamples, - size_t& nSamplesOut, - int64_t* elapsed_time_ms, - int64_t* ntp_time_ms) = 0; - - // Method to pass captured data directly and unmixed to network channels. - // |channel_ids| contains a list of VoE channels which are the - // sinks to the capture data. |audio_delay_milliseconds| is the sum of - // recording delay and playout delay of the hardware. |current_volume| is - // in the range of [0, 255], representing the current microphone analog - // volume. |key_pressed| is used by the typing detection. - // |need_audio_processing| specify if the data needs to be processed by APM. - // Currently WebRtc supports only one APM, and Chrome will make sure only - // one stream goes through APM. When |need_audio_processing| is false, the - // values of |audio_delay_milliseconds|, |current_volume| and |key_pressed| - // will be ignored. - // The return value is the new microphone volume, in the range of |0, 255]. - // When the volume does not need to be updated, it returns 0. - // TODO(xians): Remove this interface after Chrome and Libjingle switches - // to OnData(). - virtual int OnDataAvailable(const int voe_channels[], - int number_of_voe_channels, - const int16_t* audio_data, - int sample_rate, - int number_of_channels, - size_t number_of_frames, - int audio_delay_milliseconds, - int current_volume, - bool key_pressed, - bool need_audio_processing) { - return 0; - } - - // Method to pass the captured audio data to the specific VoE channel. - // |voe_channel| is the id of the VoE channel which is the sink to the - // capture data. - // TODO(xians): Remove this interface after Libjingle switches to - // PushCaptureData(). - virtual void OnData(int voe_channel, - const void* audio_data, - int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames) {} - - // Method to push the captured audio data to the specific VoE channel. - // The data will not undergo audio processing. - // |voe_channel| is the id of the VoE channel which is the sink to the - // capture data. - // TODO(xians): Make the interface pure virtual after Libjingle - // has its implementation. - virtual void PushCaptureData(int voe_channel, - const void* audio_data, - int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames) {} - - // Method to pull mixed render audio data from all active VoE channels. - // The data will not be passed as reference for audio processing internally. - // TODO(xians): Support getting the unmixed render data from specific VoE - // channel. - virtual void PullRenderData(int bits_per_sample, - int sample_rate, - int number_of_channels, - size_t number_of_frames, - void* audio_data, - int64_t* elapsed_time_ms, - int64_t* ntp_time_ms) {} - - protected: - virtual ~AudioTransport() {} -}; - -// Helper class for storage of fundamental audio parameters such as sample rate, -// number of channels, native buffer size etc. -// Note that one audio frame can contain more than one channel sample and each -// sample is assumed to be a 16-bit PCM sample. Hence, one audio frame in -// stereo contains 2 * (16/8) = 4 bytes of data. -class AudioParameters { - public: - // This implementation does only support 16-bit PCM samples. - static const size_t kBitsPerSample = 16; - AudioParameters() - : sample_rate_(0), - channels_(0), - frames_per_buffer_(0), - frames_per_10ms_buffer_(0) {} - AudioParameters(int sample_rate, int channels, size_t frames_per_buffer) - : sample_rate_(sample_rate), - channels_(channels), - frames_per_buffer_(frames_per_buffer), - frames_per_10ms_buffer_(static_cast(sample_rate / 100)) {} - void reset(int sample_rate, int channels, size_t frames_per_buffer) { - sample_rate_ = sample_rate; - channels_ = channels; - frames_per_buffer_ = frames_per_buffer; - frames_per_10ms_buffer_ = static_cast(sample_rate / 100); - } - size_t bits_per_sample() const { return kBitsPerSample; } - void reset(int sample_rate, int channels, double ms_per_buffer) { - reset(sample_rate, channels, - static_cast(sample_rate * ms_per_buffer + 0.5)); - } - void reset(int sample_rate, int channels) { - reset(sample_rate, channels, static_cast(0)); - } - int sample_rate() const { return sample_rate_; } - int channels() const { return channels_; } - size_t frames_per_buffer() const { return frames_per_buffer_; } - size_t frames_per_10ms_buffer() const { return frames_per_10ms_buffer_; } - size_t GetBytesPerFrame() const { return channels_ * kBitsPerSample / 8; } - size_t GetBytesPerBuffer() const { - return frames_per_buffer_ * GetBytesPerFrame(); - } - // The WebRTC audio device buffer (ADB) only requires that the sample rate - // and number of channels are configured. Hence, to be "valid", only these - // two attributes must be set. - bool is_valid() const { return ((sample_rate_ > 0) && (channels_ > 0)); } - // Most platforms also require that a native buffer size is defined. - // An audio parameter instance is considered to be "complete" if it is both - // "valid" (can be used by the ADB) and also has a native frame size. - bool is_complete() const { return (is_valid() && (frames_per_buffer_ > 0)); } - size_t GetBytesPer10msBuffer() const { - return frames_per_10ms_buffer_ * GetBytesPerFrame(); - } - double GetBufferSizeInMilliseconds() const { - if (sample_rate_ == 0) - return 0.0; - return frames_per_buffer_ / (sample_rate_ / 1000.0); - } - double GetBufferSizeInSeconds() const { - if (sample_rate_ == 0) - return 0.0; - return static_cast(frames_per_buffer_) / (sample_rate_); - } - - private: - int sample_rate_; - int channels_; - size_t frames_per_buffer_; - size_t frames_per_10ms_buffer_; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFINES_H_ diff --git a/include/webrtc/modules/include/module.h b/include/webrtc/modules/include/module.h deleted file mode 100644 index d02aa95..0000000 --- a/include/webrtc/modules/include/module.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_INCLUDE_MODULE_H_ -#define WEBRTC_MODULES_INCLUDE_MODULE_H_ - -#include "webrtc/typedefs.h" - -namespace webrtc { - -class ProcessThread; - -class Module { - public: - // Returns the number of milliseconds until the module wants a worker - // thread to call Process. - // This method is called on the same worker thread as Process will - // be called on. - // TODO(tommi): Almost all implementations of this function, need to know - // the current tick count. Consider passing it as an argument. It could - // also improve the accuracy of when the next callback occurs since the - // thread that calls Process() will also have it's tick count reference - // which might not match with what the implementations use. - virtual int64_t TimeUntilNextProcess() = 0; - - // Process any pending tasks such as timeouts. - // Called on a worker thread. - virtual int32_t Process() = 0; - - // This method is called when the module is attached to a *running* process - // thread or detached from one. In the case of detaching, |process_thread| - // will be nullptr. - // - // This method will be called in the following cases: - // - // * Non-null process_thread: - // * ProcessThread::RegisterModule() is called while the thread is running. - // * ProcessThread::Start() is called and RegisterModule has previously - // been called. The thread will be started immediately after notifying - // all modules. - // - // * Null process_thread: - // * ProcessThread::DeRegisterModule() is called while the thread is - // running. - // * ProcessThread::Stop() was called and the thread has been stopped. - // - // NOTE: This method is not called from the worker thread itself, but from - // the thread that registers/deregisters the module or calls Start/Stop. - virtual void ProcessThreadAttached(ProcessThread* process_thread) {} - - protected: - virtual ~Module() {} -}; - -// Reference counted version of the Module interface. -class RefCountedModule : public Module { - public: - // Increase the reference count by one. - // Returns the incremented reference count. - virtual int32_t AddRef() const = 0; - - // Decrease the reference count by one. - // Returns the decreased reference count. - // Returns 0 if the last reference was just released. - // When the reference count reaches 0 the object will self-destruct. - virtual int32_t Release() const = 0; - - protected: - ~RefCountedModule() override = default; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_INCLUDE_MODULE_H_ diff --git a/include/webrtc/p2p/base/asyncstuntcpsocket.h b/include/webrtc/p2p/base/asyncstuntcpsocket.h deleted file mode 100644 index 3a15d4a..0000000 --- a/include/webrtc/p2p/base/asyncstuntcpsocket.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_ASYNCSTUNTCPSOCKET_H_ -#define WEBRTC_P2P_BASE_ASYNCSTUNTCPSOCKET_H_ - -#include "webrtc/base/asynctcpsocket.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/socketfactory.h" - -namespace cricket { - -class AsyncStunTCPSocket : public rtc::AsyncTCPSocketBase { - public: - // Binds and connects |socket| and creates AsyncTCPSocket for - // it. Takes ownership of |socket|. Returns NULL if bind() or - // connect() fail (|socket| is destroyed in that case). - static AsyncStunTCPSocket* Create( - rtc::AsyncSocket* socket, - const rtc::SocketAddress& bind_address, - const rtc::SocketAddress& remote_address); - - AsyncStunTCPSocket(rtc::AsyncSocket* socket, bool listen); - virtual ~AsyncStunTCPSocket() {} - - virtual int Send(const void* pv, size_t cb, - const rtc::PacketOptions& options); - virtual void ProcessInput(char* data, size_t* len); - virtual void HandleIncomingConnection(rtc::AsyncSocket* socket); - - private: - // This method returns the message hdr + length written in the header. - // This method also returns the number of padding bytes needed/added to the - // turn message. |pad_bytes| should be used only when |is_turn| is true. - size_t GetExpectedLength(const void* data, size_t len, - int* pad_bytes); - - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncStunTCPSocket); -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_ASYNCSTUNTCPSOCKET_H_ diff --git a/include/webrtc/p2p/base/basicpacketsocketfactory.h b/include/webrtc/p2p/base/basicpacketsocketfactory.h deleted file mode 100644 index 5046e0f..0000000 --- a/include/webrtc/p2p/base/basicpacketsocketfactory.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_ -#define WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_ - -#include "webrtc/p2p/base/packetsocketfactory.h" - -namespace rtc { - -class AsyncSocket; -class SocketFactory; -class Thread; - -class BasicPacketSocketFactory : public PacketSocketFactory { - public: - BasicPacketSocketFactory(); - explicit BasicPacketSocketFactory(Thread* thread); - explicit BasicPacketSocketFactory(SocketFactory* socket_factory); - ~BasicPacketSocketFactory() override; - - AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address, - uint16_t min_port, - uint16_t max_port) override; - AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address, - uint16_t min_port, - uint16_t max_port, - int opts) override; - AsyncPacketSocket* CreateClientTcpSocket(const SocketAddress& local_address, - const SocketAddress& remote_address, - const ProxyInfo& proxy_info, - const std::string& user_agent, - int opts) override; - - AsyncResolverInterface* CreateAsyncResolver() override; - - private: - int BindSocket(AsyncSocket* socket, - const SocketAddress& local_address, - uint16_t min_port, - uint16_t max_port); - - SocketFactory* socket_factory(); - - Thread* thread_; - SocketFactory* socket_factory_; -}; - -} // namespace rtc - -#endif // WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_ diff --git a/include/webrtc/p2p/base/candidate.h b/include/webrtc/p2p/base/candidate.h deleted file mode 100644 index 3f0ea43..0000000 --- a/include/webrtc/p2p/base/candidate.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_CANDIDATE_H_ -#define WEBRTC_P2P_BASE_CANDIDATE_H_ - -#include -#include - -#include -#include -#include -#include - -#include "webrtc/p2p/base/constants.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/helpers.h" -#include "webrtc/base/network.h" -#include "webrtc/base/socketaddress.h" - -namespace cricket { - -// Candidate for ICE based connection discovery. - -class Candidate { - public: - // TODO: Match the ordering and param list as per RFC 5245 - // candidate-attribute syntax. http://tools.ietf.org/html/rfc5245#section-15.1 - Candidate() - : id_(rtc::CreateRandomString(8)), - component_(0), - priority_(0), - network_type_(rtc::ADAPTER_TYPE_UNKNOWN), - generation_(0) {} - - Candidate(int component, - const std::string& protocol, - const rtc::SocketAddress& address, - uint32_t priority, - const std::string& username, - const std::string& password, - const std::string& type, - uint32_t generation, - const std::string& foundation) - : id_(rtc::CreateRandomString(8)), - component_(component), - protocol_(protocol), - address_(address), - priority_(priority), - username_(username), - password_(password), - type_(type), - network_type_(rtc::ADAPTER_TYPE_UNKNOWN), - generation_(generation), - foundation_(foundation) {} - - const std::string & id() const { return id_; } - void set_id(const std::string & id) { id_ = id; } - - int component() const { return component_; } - void set_component(int component) { component_ = component; } - - const std::string & protocol() const { return protocol_; } - void set_protocol(const std::string & protocol) { protocol_ = protocol; } - - // The protocol used to talk to relay. - const std::string& relay_protocol() const { return relay_protocol_; } - void set_relay_protocol(const std::string& protocol) { - relay_protocol_ = protocol; - } - - const rtc::SocketAddress & address() const { return address_; } - void set_address(const rtc::SocketAddress & address) { - address_ = address; - } - - uint32_t priority() const { return priority_; } - void set_priority(const uint32_t priority) { priority_ = priority; } - - // TODO(pthatcher): Remove once Chromium's jingle/glue/utils.cc - // doesn't use it. - // Maps old preference (which was 0.0-1.0) to match priority (which - // is 0-2^32-1) to to match RFC 5245, section 4.1.2.1. Also see - // https://docs.google.com/a/google.com/document/d/ - // 1iNQDiwDKMh0NQOrCqbj3DKKRT0Dn5_5UJYhmZO-t7Uc/edit - float preference() const { - // The preference value is clamped to two decimal precision. - return static_cast(((priority_ >> 24) * 100 / 127) / 100.0); - } - - // TODO(pthatcher): Remove once Chromium's jingle/glue/utils.cc - // doesn't use it. - void set_preference(float preference) { - // Limiting priority to UINT_MAX when value exceeds uint32_t max. - // This can happen for e.g. when preference = 3. - uint64_t prio_val = static_cast(preference * 127) << 24; - priority_ = static_cast( - std::min(prio_val, static_cast(UINT_MAX))); - } - - const std::string & username() const { return username_; } - void set_username(const std::string & username) { username_ = username; } - - const std::string & password() const { return password_; } - void set_password(const std::string & password) { password_ = password; } - - const std::string & type() const { return type_; } - void set_type(const std::string & type) { type_ = type; } - - const std::string & network_name() const { return network_name_; } - void set_network_name(const std::string & network_name) { - network_name_ = network_name; - } - - rtc::AdapterType network_type() const { return network_type_; } - void set_network_type(rtc::AdapterType network_type) { - network_type_ = network_type; - } - - // Candidates in a new generation replace those in the old generation. - uint32_t generation() const { return generation_; } - void set_generation(uint32_t generation) { generation_ = generation; } - const std::string generation_str() const { - std::ostringstream ost; - ost << generation_; - return ost.str(); - } - void set_generation_str(const std::string& str) { - std::istringstream ist(str); - ist >> generation_; - } - - const std::string& foundation() const { - return foundation_; - } - - void set_foundation(const std::string& foundation) { - foundation_ = foundation; - } - - const rtc::SocketAddress & related_address() const { - return related_address_; - } - void set_related_address( - const rtc::SocketAddress & related_address) { - related_address_ = related_address; - } - const std::string& tcptype() const { return tcptype_; } - void set_tcptype(const std::string& tcptype){ - tcptype_ = tcptype; - } - - // Determines whether this candidate is equivalent to the given one. - bool IsEquivalent(const Candidate& c) const { - // We ignore the network name, since that is just debug information, and - // the priority, since that should be the same if the rest is (and it's - // a float so equality checking is always worrisome). - return (component_ == c.component_) && (protocol_ == c.protocol_) && - (address_ == c.address_) && (username_ == c.username_) && - (password_ == c.password_) && (type_ == c.type_) && - (generation_ == c.generation_) && (foundation_ == c.foundation_) && - (related_address_ == c.related_address_); - } - - std::string ToString() const { - return ToStringInternal(false); - } - - std::string ToSensitiveString() const { - return ToStringInternal(true); - } - - uint32_t GetPriority(uint32_t type_preference, - int network_adapter_preference, - int relay_preference) const { - // RFC 5245 - 4.1.2.1. - // priority = (2^24)*(type preference) + - // (2^8)*(local preference) + - // (2^0)*(256 - component ID) - - // |local_preference| length is 2 bytes, 0-65535 inclusive. - // In our implemenation we will partion local_preference into - // 0 1 - // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | NIC Pref | Addr Pref | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // NIC Type - Type of the network adapter e.g. 3G/Wifi/Wired. - // Addr Pref - Address preference value as per RFC 3484. - // local preference = (NIC Type << 8 | Addr_Pref) - relay preference. - - int addr_pref = IPAddressPrecedence(address_.ipaddr()); - int local_preference = ((network_adapter_preference << 8) | addr_pref) + - relay_preference; - - return (type_preference << 24) | - (local_preference << 8) | - (256 - component_); - } - - private: - std::string ToStringInternal(bool sensitive) const { - std::ostringstream ost; - std::string address = sensitive ? address_.ToSensitiveString() : - address_.ToString(); - ost << "Cand[" << foundation_ << ":" << component_ << ":" - << protocol_ << ":" << priority_ << ":" - << address << ":" << type_ << ":" << related_address_ << ":" - << username_ << ":" << password_ << "]"; - return ost.str(); - } - - std::string id_; - int component_; - std::string protocol_; - std::string relay_protocol_; - rtc::SocketAddress address_; - uint32_t priority_; - std::string username_; - std::string password_; - std::string type_; - std::string network_name_; - rtc::AdapterType network_type_; - uint32_t generation_; - std::string foundation_; - rtc::SocketAddress related_address_; - std::string tcptype_; -}; - -// Used during parsing and writing to map component to channel name -// and back. This is primarily for converting old G-ICE candidate -// signalling to new ICE candidate classes. -class CandidateTranslator { - public: - virtual ~CandidateTranslator() {} - virtual bool GetChannelNameFromComponent( - int component, std::string* channel_name) const = 0; - virtual bool GetComponentFromChannelName( - const std::string& channel_name, int* component) const = 0; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_CANDIDATE_H_ diff --git a/include/webrtc/p2p/base/common.h b/include/webrtc/p2p/base/common.h deleted file mode 100644 index 8a3178c..0000000 --- a/include/webrtc/p2p/base/common.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_COMMON_H_ -#define WEBRTC_P2P_BASE_COMMON_H_ - -#include "webrtc/base/logging.h" - -// Common log description format for jingle messages -#define LOG_J(sev, obj) LOG(sev) << "Jingle:" << obj->ToString() << ": " -#define LOG_JV(sev, obj) LOG_V(sev) << "Jingle:" << obj->ToString() << ": " - -#endif // WEBRTC_P2P_BASE_COMMON_H_ diff --git a/include/webrtc/p2p/base/constants.h b/include/webrtc/p2p/base/constants.h deleted file mode 100644 index c3e1b78..0000000 --- a/include/webrtc/p2p/base/constants.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_CONSTANTS_H_ -#define WEBRTC_P2P_BASE_CONSTANTS_H_ - -#include - -namespace cricket { - -// CN_ == "content name". When we initiate a session, we choose the -// name, and when we receive a Gingle session, we provide default -// names (since Gingle has no content names). But when we receive a -// Jingle call, the content name can be anything, so don't rely on -// these values being the same as the ones received. -extern const char CN_AUDIO[]; -extern const char CN_VIDEO[]; -extern const char CN_DATA[]; -extern const char CN_OTHER[]; - -// GN stands for group name -extern const char GROUP_TYPE_BUNDLE[]; - -extern const int ICE_UFRAG_LENGTH; -extern const int ICE_PWD_LENGTH; -extern const size_t ICE_UFRAG_MIN_LENGTH; -extern const size_t ICE_PWD_MIN_LENGTH; -extern const size_t ICE_UFRAG_MAX_LENGTH; -extern const size_t ICE_PWD_MAX_LENGTH; - -extern const int ICE_CANDIDATE_COMPONENT_RTP; -extern const int ICE_CANDIDATE_COMPONENT_RTCP; -extern const int ICE_CANDIDATE_COMPONENT_DEFAULT; - -extern const char NS_JINGLE_RTP[]; -extern const char NS_JINGLE_DRAFT_SCTP[]; - -// RFC 4145, SDP setup attribute values. -extern const char CONNECTIONROLE_ACTIVE_STR[]; -extern const char CONNECTIONROLE_PASSIVE_STR[]; -extern const char CONNECTIONROLE_ACTPASS_STR[]; -extern const char CONNECTIONROLE_HOLDCONN_STR[]; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_CONSTANTS_H_ diff --git a/include/webrtc/p2p/base/dtlstransport.h b/include/webrtc/p2p/base/dtlstransport.h deleted file mode 100644 index e9a1ae2..0000000 --- a/include/webrtc/p2p/base/dtlstransport.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORT_H_ -#define WEBRTC_P2P_BASE_DTLSTRANSPORT_H_ - -#include "webrtc/p2p/base/dtlstransportchannel.h" -#include "webrtc/p2p/base/transport.h" - -namespace rtc { -class SSLIdentity; -} - -namespace cricket { - -class PortAllocator; - -// Base should be a descendant of cricket::Transport and have a constructor -// that takes a transport name and PortAllocator. -// -// Everything in this class should be called on the worker thread. -template -class DtlsTransport : public Base { - public: - DtlsTransport(const std::string& name, - PortAllocator* allocator, - const rtc::scoped_refptr& certificate) - : Base(name, allocator), - certificate_(certificate), - secure_role_(rtc::SSL_CLIENT), - ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) {} - - ~DtlsTransport() { - Base::DestroyAllChannels(); - } - - void SetLocalCertificate( - const rtc::scoped_refptr& certificate) override { - certificate_ = certificate; - } - bool GetLocalCertificate( - rtc::scoped_refptr* certificate) override { - if (!certificate_) - return false; - - *certificate = certificate_; - return true; - } - - bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) override { - ssl_max_version_ = version; - return true; - } - - bool ApplyLocalTransportDescription(TransportChannelImpl* channel, - std::string* error_desc) override { - rtc::SSLFingerprint* local_fp = - Base::local_description()->identity_fingerprint.get(); - - if (local_fp) { - // Sanity check local fingerprint. - if (certificate_) { - rtc::scoped_ptr local_fp_tmp( - rtc::SSLFingerprint::Create(local_fp->algorithm, - certificate_->identity())); - ASSERT(local_fp_tmp.get() != NULL); - if (!(*local_fp_tmp == *local_fp)) { - std::ostringstream desc; - desc << "Local fingerprint does not match identity. Expected: "; - desc << local_fp_tmp->ToString(); - desc << " Got: " << local_fp->ToString(); - return BadTransportDescription(desc.str(), error_desc); - } - } else { - return BadTransportDescription( - "Local fingerprint provided but no identity available.", - error_desc); - } - } else { - certificate_ = nullptr; - } - - if (!channel->SetLocalCertificate(certificate_)) { - return BadTransportDescription("Failed to set local identity.", - error_desc); - } - - // Apply the description in the base class. - return Base::ApplyLocalTransportDescription(channel, error_desc); - } - - bool NegotiateTransportDescription(ContentAction local_role, - std::string* error_desc) override { - if (!Base::local_description() || !Base::remote_description()) { - const std::string msg = "Local and Remote description must be set before " - "transport descriptions are negotiated"; - return BadTransportDescription(msg, error_desc); - } - - rtc::SSLFingerprint* local_fp = - Base::local_description()->identity_fingerprint.get(); - rtc::SSLFingerprint* remote_fp = - Base::remote_description()->identity_fingerprint.get(); - - if (remote_fp && local_fp) { - remote_fingerprint_.reset(new rtc::SSLFingerprint(*remote_fp)); - - // From RFC 4145, section-4.1, The following are the values that the - // 'setup' attribute can take in an offer/answer exchange: - // Offer Answer - // ________________ - // active passive / holdconn - // passive active / holdconn - // actpass active / passive / holdconn - // holdconn holdconn - // - // Set the role that is most conformant with RFC 5763, Section 5, bullet 1 - // The endpoint MUST use the setup attribute defined in [RFC4145]. - // The endpoint that is the offerer MUST use the setup attribute - // value of setup:actpass and be prepared to receive a client_hello - // before it receives the answer. The answerer MUST use either a - // setup attribute value of setup:active or setup:passive. Note that - // if the answerer uses setup:passive, then the DTLS handshake will - // not begin until the answerer is received, which adds additional - // latency. setup:active allows the answer and the DTLS handshake to - // occur in parallel. Thus, setup:active is RECOMMENDED. Whichever - // party is active MUST initiate a DTLS handshake by sending a - // ClientHello over each flow (host/port quartet). - // IOW - actpass and passive modes should be treated as server and - // active as client. - ConnectionRole local_connection_role = - Base::local_description()->connection_role; - ConnectionRole remote_connection_role = - Base::remote_description()->connection_role; - - bool is_remote_server = false; - if (local_role == CA_OFFER) { - if (local_connection_role != CONNECTIONROLE_ACTPASS) { - return BadTransportDescription( - "Offerer must use actpass value for setup attribute.", - error_desc); - } - - if (remote_connection_role == CONNECTIONROLE_ACTIVE || - remote_connection_role == CONNECTIONROLE_PASSIVE || - remote_connection_role == CONNECTIONROLE_NONE) { - is_remote_server = (remote_connection_role == CONNECTIONROLE_PASSIVE); - } else { - const std::string msg = - "Answerer must use either active or passive value " - "for setup attribute."; - return BadTransportDescription(msg, error_desc); - } - // If remote is NONE or ACTIVE it will act as client. - } else { - if (remote_connection_role != CONNECTIONROLE_ACTPASS && - remote_connection_role != CONNECTIONROLE_NONE) { - return BadTransportDescription( - "Offerer must use actpass value for setup attribute.", - error_desc); - } - - if (local_connection_role == CONNECTIONROLE_ACTIVE || - local_connection_role == CONNECTIONROLE_PASSIVE) { - is_remote_server = (local_connection_role == CONNECTIONROLE_ACTIVE); - } else { - const std::string msg = - "Answerer must use either active or passive value " - "for setup attribute."; - return BadTransportDescription(msg, error_desc); - } - - // If local is passive, local will act as server. - } - - secure_role_ = is_remote_server ? rtc::SSL_CLIENT : - rtc::SSL_SERVER; - - } else if (local_fp && (local_role == CA_ANSWER)) { - return BadTransportDescription( - "Local fingerprint supplied when caller didn't offer DTLS.", - error_desc); - } else { - // We are not doing DTLS - remote_fingerprint_.reset(new rtc::SSLFingerprint( - "", NULL, 0)); - } - - // Now run the negotiation for the base class. - return Base::NegotiateTransportDescription(local_role, error_desc); - } - - DtlsTransportChannelWrapper* CreateTransportChannel(int component) override { - DtlsTransportChannelWrapper* channel = new DtlsTransportChannelWrapper( - this, Base::CreateTransportChannel(component)); - channel->SetSslMaxProtocolVersion(ssl_max_version_); - return channel; - } - - void DestroyTransportChannel(TransportChannelImpl* channel) override { - // Kind of ugly, but this lets us do the exact inverse of the create. - DtlsTransportChannelWrapper* dtls_channel = - static_cast(channel); - TransportChannelImpl* base_channel = dtls_channel->channel(); - delete dtls_channel; - Base::DestroyTransportChannel(base_channel); - } - - bool GetSslRole(rtc::SSLRole* ssl_role) const override { - ASSERT(ssl_role != NULL); - *ssl_role = secure_role_; - return true; - } - - private: - bool ApplyNegotiatedTransportDescription(TransportChannelImpl* channel, - std::string* error_desc) override { - // Set ssl role. Role must be set before fingerprint is applied, which - // initiates DTLS setup. - if (!channel->SetSslRole(secure_role_)) { - return BadTransportDescription("Failed to set ssl role for the channel.", - error_desc); - } - // Apply remote fingerprint. - if (!channel->SetRemoteFingerprint(remote_fingerprint_->algorithm, - reinterpret_cast( - remote_fingerprint_->digest.data()), - remote_fingerprint_->digest.size())) { - return BadTransportDescription("Failed to apply remote fingerprint.", - error_desc); - } - return Base::ApplyNegotiatedTransportDescription(channel, error_desc); - } - - rtc::scoped_refptr certificate_; - rtc::SSLRole secure_role_; - rtc::SSLProtocolVersion ssl_max_version_; - rtc::scoped_ptr remote_fingerprint_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_DTLSTRANSPORT_H_ diff --git a/include/webrtc/p2p/base/dtlstransportchannel.h b/include/webrtc/p2p/base/dtlstransportchannel.h deleted file mode 100644 index 955b963..0000000 --- a/include/webrtc/p2p/base/dtlstransportchannel.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ -#define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ - -#include -#include - -#include "webrtc/p2p/base/transportchannelimpl.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/bufferqueue.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sslstreamadapter.h" -#include "webrtc/base/stream.h" - -namespace cricket { - -// A bridge between a packet-oriented/channel-type interface on -// the bottom and a StreamInterface on the top. -class StreamInterfaceChannel : public rtc::StreamInterface { - public: - explicit StreamInterfaceChannel(TransportChannel* channel); - - // Push in a packet; this gets pulled out from Read(). - bool OnPacketReceived(const char* data, size_t size); - - // Implementations of StreamInterface - rtc::StreamState GetState() const override { return state_; } - void Close() override { state_ = rtc::SS_CLOSED; } - rtc::StreamResult Read(void* buffer, - size_t buffer_len, - size_t* read, - int* error) override; - rtc::StreamResult Write(const void* data, - size_t data_len, - size_t* written, - int* error) override; - - private: - TransportChannel* channel_; // owned by DtlsTransportChannelWrapper - rtc::StreamState state_; - rtc::BufferQueue packets_; - - RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterfaceChannel); -}; - - -// This class provides a DTLS SSLStreamAdapter inside a TransportChannel-style -// packet-based interface, wrapping an existing TransportChannel instance -// (e.g a P2PTransportChannel) -// Here's the way this works: -// -// DtlsTransportChannelWrapper { -// SSLStreamAdapter* dtls_ { -// StreamInterfaceChannel downward_ { -// TransportChannelImpl* channel_; -// } -// } -// } -// -// - Data which comes into DtlsTransportChannelWrapper from the underlying -// channel_ via OnReadPacket() is checked for whether it is DTLS -// or not, and if it is, is passed to DtlsTransportChannelWrapper:: -// HandleDtlsPacket, which pushes it into to downward_. -// dtls_ is listening for events on downward_, so it immediately calls -// downward_->Read(). -// -// - Data written to DtlsTransportChannelWrapper is passed either to -// downward_ or directly to channel_, depending on whether DTLS is -// negotiated and whether the flags include PF_SRTP_BYPASS -// -// - The SSLStreamAdapter writes to downward_->Write() -// which translates it into packet writes on channel_. -class DtlsTransportChannelWrapper : public TransportChannelImpl { - public: - // The parameters here are: - // transport -- the DtlsTransport that created us - // channel -- the TransportChannel we are wrapping - DtlsTransportChannelWrapper(Transport* transport, - TransportChannelImpl* channel); - ~DtlsTransportChannelWrapper() override; - - void SetIceRole(IceRole role) override { channel_->SetIceRole(role); } - IceRole GetIceRole() const override { return channel_->GetIceRole(); } - bool SetLocalCertificate( - const rtc::scoped_refptr& certificate) override; - rtc::scoped_refptr GetLocalCertificate() const override; - - bool SetRemoteFingerprint(const std::string& digest_alg, - const uint8_t* digest, - size_t digest_len) override; - - // Returns false if no local certificate was set, or if the peer doesn't - // support DTLS. - bool IsDtlsActive() const override { return dtls_active_; } - - // Called to send a packet (via DTLS, if turned on). - int SendPacket(const char* data, - size_t size, - const rtc::PacketOptions& options, - int flags) override; - - // TransportChannel calls that we forward to the wrapped transport. - int SetOption(rtc::Socket::Option opt, int value) override { - return channel_->SetOption(opt, value); - } - bool GetOption(rtc::Socket::Option opt, int* value) override { - return channel_->GetOption(opt, value); - } - int GetError() override { return channel_->GetError(); } - bool GetStats(ConnectionInfos* infos) override { - return channel_->GetStats(infos); - } - const std::string SessionId() const override { return channel_->SessionId(); } - - virtual bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version); - - // Set up the ciphers to use for DTLS-SRTP. If this method is not called - // before DTLS starts, or |ciphers| is empty, SRTP keys won't be negotiated. - // This method should be called before SetupDtls. - bool SetSrtpCryptoSuites(const std::vector& ciphers) override; - - // Find out which DTLS-SRTP cipher was negotiated - bool GetSrtpCryptoSuite(int* cipher) override; - - bool GetSslRole(rtc::SSLRole* role) const override; - bool SetSslRole(rtc::SSLRole role) override; - - // Find out which DTLS cipher was negotiated - bool GetSslCipherSuite(int* cipher) override; - - // Once DTLS has been established, this method retrieves the certificate in - // use by the remote peer, for use in external identity verification. - bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override; - - // Once DTLS has established (i.e., this channel is writable), this method - // extracts the keys negotiated during the DTLS handshake, for use in external - // encryption. DTLS-SRTP uses this to extract the needed SRTP keys. - // See the SSLStreamAdapter documentation for info on the specific parameters. - bool ExportKeyingMaterial(const std::string& label, - const uint8_t* context, - size_t context_len, - bool use_context, - uint8_t* result, - size_t result_len) override { - return (dtls_.get()) ? dtls_->ExportKeyingMaterial(label, context, - context_len, - use_context, - result, result_len) - : false; - } - - // TransportChannelImpl calls. - Transport* GetTransport() override { return transport_; } - - TransportChannelState GetState() const override { - return channel_->GetState(); - } - void SetIceTiebreaker(uint64_t tiebreaker) override { - channel_->SetIceTiebreaker(tiebreaker); - } - void SetIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) override { - channel_->SetIceCredentials(ice_ufrag, ice_pwd); - } - void SetRemoteIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) override { - channel_->SetRemoteIceCredentials(ice_ufrag, ice_pwd); - } - void SetRemoteIceMode(IceMode mode) override { - channel_->SetRemoteIceMode(mode); - } - - void Connect() override; - - void MaybeStartGathering() override { channel_->MaybeStartGathering(); } - - IceGatheringState gathering_state() const override { - return channel_->gathering_state(); - } - - void AddRemoteCandidate(const Candidate& candidate) override { - channel_->AddRemoteCandidate(candidate); - } - - void SetIceConfig(const IceConfig& config) override { - channel_->SetIceConfig(config); - } - - // Needed by DtlsTransport. - TransportChannelImpl* channel() { return channel_; } - - private: - void OnReadableState(TransportChannel* channel); - void OnWritableState(TransportChannel* channel); - void OnReadPacket(TransportChannel* channel, const char* data, size_t size, - const rtc::PacketTime& packet_time, int flags); - void OnSentPacket(TransportChannel* channel, - const rtc::SentPacket& sent_packet); - void OnReadyToSend(TransportChannel* channel); - void OnReceivingState(TransportChannel* channel); - void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err); - bool SetupDtls(); - bool MaybeStartDtls(); - bool HandleDtlsPacket(const char* data, size_t size); - void OnGatheringState(TransportChannelImpl* channel); - void OnCandidateGathered(TransportChannelImpl* channel, const Candidate& c); - void OnRoleConflict(TransportChannelImpl* channel); - void OnRouteChange(TransportChannel* channel, const Candidate& candidate); - void OnConnectionRemoved(TransportChannelImpl* channel); - void Reconnect(); - - Transport* transport_; // The transport_ that created us. - rtc::Thread* worker_thread_; // Everything should occur on this thread. - // Underlying channel, owned by transport_. - TransportChannelImpl* const channel_; - rtc::scoped_ptr dtls_; // The DTLS stream - StreamInterfaceChannel* downward_; // Wrapper for channel_, owned by dtls_. - std::vector srtp_ciphers_; // SRTP ciphers to use with DTLS. - bool dtls_active_ = false; - rtc::scoped_refptr local_certificate_; - rtc::SSLRole ssl_role_; - rtc::SSLProtocolVersion ssl_max_version_; - rtc::Buffer remote_fingerprint_value_; - std::string remote_fingerprint_algorithm_; - - RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper); -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ diff --git a/include/webrtc/p2p/base/faketransportcontroller.h b/include/webrtc/p2p/base/faketransportcontroller.h deleted file mode 100644 index 251a0c6..0000000 --- a/include/webrtc/p2p/base/faketransportcontroller.h +++ /dev/null @@ -1,543 +0,0 @@ -/* - * Copyright 2009 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ -#define WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ - -#include -#include -#include - -#include "webrtc/p2p/base/transport.h" -#include "webrtc/p2p/base/transportchannel.h" -#include "webrtc/p2p/base/transportcontroller.h" -#include "webrtc/p2p/base/transportchannelimpl.h" -#include "webrtc/base/bind.h" -#include "webrtc/base/buffer.h" -#include "webrtc/base/fakesslidentity.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/sslfingerprint.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -class FakeTransport; - -namespace { -struct PacketMessageData : public rtc::MessageData { - PacketMessageData(const char* data, size_t len) : packet(data, len) {} - rtc::Buffer packet; -}; -} // namespace - -// Fake transport channel class, which can be passed to anything that needs a -// transport channel. Can be informed of another FakeTransportChannel via -// SetDestination. -// TODO(hbos): Move implementation to .cc file, this and other classes in file. -class FakeTransportChannel : public TransportChannelImpl, - public rtc::MessageHandler { - public: - explicit FakeTransportChannel(Transport* transport, - const std::string& name, - int component) - : TransportChannelImpl(name, component), - transport_(transport), - dtls_fingerprint_("", nullptr, 0) {} - ~FakeTransportChannel() { Reset(); } - - uint64_t IceTiebreaker() const { return tiebreaker_; } - IceMode remote_ice_mode() const { return remote_ice_mode_; } - const std::string& ice_ufrag() const { return ice_ufrag_; } - const std::string& ice_pwd() const { return ice_pwd_; } - const std::string& remote_ice_ufrag() const { return remote_ice_ufrag_; } - const std::string& remote_ice_pwd() const { return remote_ice_pwd_; } - const rtc::SSLFingerprint& dtls_fingerprint() const { - return dtls_fingerprint_; - } - - // If async, will send packets by "Post"-ing to message queue instead of - // synchronously "Send"-ing. - void SetAsync(bool async) { async_ = async; } - - Transport* GetTransport() override { return transport_; } - - TransportChannelState GetState() const override { - if (connection_count_ == 0) { - return had_connection_ ? TransportChannelState::STATE_FAILED - : TransportChannelState::STATE_INIT; - } - - if (connection_count_ == 1) { - return TransportChannelState::STATE_COMPLETED; - } - - return TransportChannelState::STATE_CONNECTING; - } - - void SetIceRole(IceRole role) override { role_ = role; } - IceRole GetIceRole() const override { return role_; } - void SetIceTiebreaker(uint64_t tiebreaker) override { - tiebreaker_ = tiebreaker; - } - void SetIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) override { - ice_ufrag_ = ice_ufrag; - ice_pwd_ = ice_pwd; - } - void SetRemoteIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) override { - remote_ice_ufrag_ = ice_ufrag; - remote_ice_pwd_ = ice_pwd; - } - - void SetRemoteIceMode(IceMode mode) override { remote_ice_mode_ = mode; } - bool SetRemoteFingerprint(const std::string& alg, - const uint8_t* digest, - size_t digest_len) override { - dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len); - return true; - } - bool SetSslRole(rtc::SSLRole role) override { - ssl_role_ = role; - return true; - } - bool GetSslRole(rtc::SSLRole* role) const override { - *role = ssl_role_; - return true; - } - - void Connect() override { - if (state_ == STATE_INIT) { - state_ = STATE_CONNECTING; - } - } - - void MaybeStartGathering() override { - if (gathering_state_ == kIceGatheringNew) { - gathering_state_ = kIceGatheringGathering; - SignalGatheringState(this); - } - } - - IceGatheringState gathering_state() const override { - return gathering_state_; - } - - void Reset() { - if (state_ != STATE_INIT) { - state_ = STATE_INIT; - if (dest_) { - dest_->state_ = STATE_INIT; - dest_->dest_ = nullptr; - dest_ = nullptr; - } - } - } - - void SetWritable(bool writable) { set_writable(writable); } - - void SetDestination(FakeTransportChannel* dest) { - if (state_ == STATE_CONNECTING && dest) { - // This simulates the delivery of candidates. - dest_ = dest; - dest_->dest_ = this; - if (local_cert_ && dest_->local_cert_) { - do_dtls_ = true; - dest_->do_dtls_ = true; - NegotiateSrtpCiphers(); - } - state_ = STATE_CONNECTED; - dest_->state_ = STATE_CONNECTED; - set_writable(true); - dest_->set_writable(true); - } else if (state_ == STATE_CONNECTED && !dest) { - // Simulates loss of connectivity, by asymmetrically forgetting dest_. - dest_ = nullptr; - state_ = STATE_CONNECTING; - set_writable(false); - } - } - - void SetConnectionCount(size_t connection_count) { - size_t old_connection_count = connection_count_; - connection_count_ = connection_count; - if (connection_count) - had_connection_ = true; - if (connection_count_ < old_connection_count) - SignalConnectionRemoved(this); - } - - void SetCandidatesGatheringComplete() { - if (gathering_state_ != kIceGatheringComplete) { - gathering_state_ = kIceGatheringComplete; - SignalGatheringState(this); - } - } - - void SetReceiving(bool receiving) { set_receiving(receiving); } - - void SetIceConfig(const IceConfig& config) override { - receiving_timeout_ = config.receiving_timeout_ms; - gather_continually_ = config.gather_continually; - } - - int receiving_timeout() const { return receiving_timeout_; } - bool gather_continually() const { return gather_continually_; } - - int SendPacket(const char* data, - size_t len, - const rtc::PacketOptions& options, - int flags) override { - if (state_ != STATE_CONNECTED) { - return -1; - } - - if (flags != PF_SRTP_BYPASS && flags != 0) { - return -1; - } - - PacketMessageData* packet = new PacketMessageData(data, len); - if (async_) { - rtc::Thread::Current()->Post(this, 0, packet); - } else { - rtc::Thread::Current()->Send(this, 0, packet); - } - rtc::SentPacket sent_packet(options.packet_id, rtc::Time()); - SignalSentPacket(this, sent_packet); - return static_cast(len); - } - int SetOption(rtc::Socket::Option opt, int value) override { return true; } - bool GetOption(rtc::Socket::Option opt, int* value) override { return true; } - int GetError() override { return 0; } - - void AddRemoteCandidate(const Candidate& candidate) override { - remote_candidates_.push_back(candidate); - } - const Candidates& remote_candidates() const { return remote_candidates_; } - - void OnMessage(rtc::Message* msg) override { - PacketMessageData* data = static_cast(msg->pdata); - dest_->SignalReadPacket(dest_, data->packet.data(), - data->packet.size(), rtc::CreatePacketTime(0), 0); - delete data; - } - - bool SetLocalCertificate( - const rtc::scoped_refptr& certificate) { - local_cert_ = certificate; - return true; - } - - void SetRemoteSSLCertificate(rtc::FakeSSLCertificate* cert) { - remote_cert_ = cert; - } - - bool IsDtlsActive() const override { return do_dtls_; } - - bool SetSrtpCryptoSuites(const std::vector& ciphers) override { - srtp_ciphers_ = ciphers; - return true; - } - - bool GetSrtpCryptoSuite(int* crypto_suite) override { - if (chosen_crypto_suite_ != rtc::SRTP_INVALID_CRYPTO_SUITE) { - *crypto_suite = chosen_crypto_suite_; - return true; - } - return false; - } - - bool GetSslCipherSuite(int* cipher_suite) override { return false; } - - rtc::scoped_refptr GetLocalCertificate() const { - return local_cert_; - } - - bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override { - if (!remote_cert_) - return false; - - *cert = remote_cert_->GetReference(); - return true; - } - - bool ExportKeyingMaterial(const std::string& label, - const uint8_t* context, - size_t context_len, - bool use_context, - uint8_t* result, - size_t result_len) override { - if (chosen_crypto_suite_ != rtc::SRTP_INVALID_CRYPTO_SUITE) { - memset(result, 0xff, result_len); - return true; - } - - return false; - } - - void NegotiateSrtpCiphers() { - for (std::vector::const_iterator it1 = srtp_ciphers_.begin(); - it1 != srtp_ciphers_.end(); ++it1) { - for (std::vector::const_iterator it2 = dest_->srtp_ciphers_.begin(); - it2 != dest_->srtp_ciphers_.end(); ++it2) { - if (*it1 == *it2) { - chosen_crypto_suite_ = *it1; - dest_->chosen_crypto_suite_ = *it2; - return; - } - } - } - } - - bool GetStats(ConnectionInfos* infos) override { - ConnectionInfo info; - infos->clear(); - infos->push_back(info); - return true; - } - - void set_ssl_max_protocol_version(rtc::SSLProtocolVersion version) { - ssl_max_version_ = version; - } - rtc::SSLProtocolVersion ssl_max_protocol_version() const { - return ssl_max_version_; - } - - private: - enum State { STATE_INIT, STATE_CONNECTING, STATE_CONNECTED }; - Transport* transport_; - FakeTransportChannel* dest_ = nullptr; - State state_ = STATE_INIT; - bool async_ = false; - Candidates remote_candidates_; - rtc::scoped_refptr local_cert_; - rtc::FakeSSLCertificate* remote_cert_ = nullptr; - bool do_dtls_ = false; - std::vector srtp_ciphers_; - int chosen_crypto_suite_ = rtc::SRTP_INVALID_CRYPTO_SUITE; - int receiving_timeout_ = -1; - bool gather_continually_ = false; - IceRole role_ = ICEROLE_UNKNOWN; - uint64_t tiebreaker_ = 0; - std::string ice_ufrag_; - std::string ice_pwd_; - std::string remote_ice_ufrag_; - std::string remote_ice_pwd_; - IceMode remote_ice_mode_ = ICEMODE_FULL; - rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10; - rtc::SSLFingerprint dtls_fingerprint_; - rtc::SSLRole ssl_role_ = rtc::SSL_CLIENT; - size_t connection_count_ = 0; - IceGatheringState gathering_state_ = kIceGatheringNew; - bool had_connection_ = false; -}; - -// Fake transport class, which can be passed to anything that needs a Transport. -// Can be informed of another FakeTransport via SetDestination (low-tech way -// of doing candidates) -class FakeTransport : public Transport { - public: - typedef std::map ChannelMap; - - explicit FakeTransport(const std::string& name) : Transport(name, nullptr) {} - - // Note that we only have a constructor with the allocator parameter so it can - // be wrapped by a DtlsTransport. - FakeTransport(const std::string& name, PortAllocator* allocator) - : Transport(name, nullptr) {} - - ~FakeTransport() { DestroyAllChannels(); } - - const ChannelMap& channels() const { return channels_; } - - // If async, will send packets by "Post"-ing to message queue instead of - // synchronously "Send"-ing. - void SetAsync(bool async) { async_ = async; } - void SetDestination(FakeTransport* dest) { - dest_ = dest; - for (const auto& kv : channels_) { - kv.second->SetLocalCertificate(certificate_); - SetChannelDestination(kv.first, kv.second); - } - } - - void SetWritable(bool writable) { - for (const auto& kv : channels_) { - kv.second->SetWritable(writable); - } - } - - void SetLocalCertificate( - const rtc::scoped_refptr& certificate) override { - certificate_ = certificate; - } - bool GetLocalCertificate( - rtc::scoped_refptr* certificate) override { - if (!certificate_) - return false; - - *certificate = certificate_; - return true; - } - - bool GetSslRole(rtc::SSLRole* role) const override { - if (channels_.empty()) { - return false; - } - return channels_.begin()->second->GetSslRole(role); - } - - bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) override { - ssl_max_version_ = version; - for (const auto& kv : channels_) { - kv.second->set_ssl_max_protocol_version(ssl_max_version_); - } - return true; - } - rtc::SSLProtocolVersion ssl_max_protocol_version() const { - return ssl_max_version_; - } - - using Transport::local_description; - using Transport::remote_description; - - protected: - TransportChannelImpl* CreateTransportChannel(int component) override { - if (channels_.find(component) != channels_.end()) { - return nullptr; - } - FakeTransportChannel* channel = - new FakeTransportChannel(this, name(), component); - channel->set_ssl_max_protocol_version(ssl_max_version_); - channel->SetAsync(async_); - SetChannelDestination(component, channel); - channels_[component] = channel; - return channel; - } - - void DestroyTransportChannel(TransportChannelImpl* channel) override { - channels_.erase(channel->component()); - delete channel; - } - - private: - FakeTransportChannel* GetFakeChannel(int component) { - auto it = channels_.find(component); - return (it != channels_.end()) ? it->second : nullptr; - } - - void SetChannelDestination(int component, FakeTransportChannel* channel) { - FakeTransportChannel* dest_channel = nullptr; - if (dest_) { - dest_channel = dest_->GetFakeChannel(component); - if (dest_channel) { - dest_channel->SetLocalCertificate(dest_->certificate_); - } - } - channel->SetDestination(dest_channel); - } - - // Note, this is distinct from the Channel map owned by Transport. - // This map just tracks the FakeTransportChannels created by this class. - // It's mainly needed so that we can access a FakeTransportChannel directly, - // even if wrapped by a DtlsTransportChannelWrapper. - ChannelMap channels_; - FakeTransport* dest_ = nullptr; - bool async_ = false; - rtc::scoped_refptr certificate_; - rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10; -}; - -// Fake TransportController class, which can be passed into a BaseChannel object -// for test purposes. Can be connected to other FakeTransportControllers via -// Connect(). -// -// This fake is unusual in that for the most part, it's implemented with the -// real TransportController code, but with fake TransportChannels underneath. -class FakeTransportController : public TransportController { - public: - FakeTransportController() - : TransportController(rtc::Thread::Current(), - rtc::Thread::Current(), - nullptr), - fail_create_channel_(false) {} - - explicit FakeTransportController(IceRole role) - : TransportController(rtc::Thread::Current(), - rtc::Thread::Current(), - nullptr), - fail_create_channel_(false) { - SetIceRole(role); - } - - explicit FakeTransportController(rtc::Thread* worker_thread) - : TransportController(rtc::Thread::Current(), worker_thread, nullptr), - fail_create_channel_(false) {} - - FakeTransportController(rtc::Thread* worker_thread, IceRole role) - : TransportController(rtc::Thread::Current(), worker_thread, nullptr), - fail_create_channel_(false) { - SetIceRole(role); - } - - FakeTransport* GetTransport_w(const std::string& transport_name) { - return static_cast( - TransportController::GetTransport_w(transport_name)); - } - - void Connect(FakeTransportController* dest) { - worker_thread()->Invoke( - rtc::Bind(&FakeTransportController::Connect_w, this, dest)); - } - - TransportChannel* CreateTransportChannel_w(const std::string& transport_name, - int component) override { - if (fail_create_channel_) { - return nullptr; - } - return TransportController::CreateTransportChannel_w(transport_name, - component); - } - - void set_fail_channel_creation(bool fail_channel_creation) { - fail_create_channel_ = fail_channel_creation; - } - - protected: - Transport* CreateTransport_w(const std::string& transport_name) override { - return new FakeTransport(transport_name); - } - - void Connect_w(FakeTransportController* dest) { - // Simulate the exchange of candidates. - ConnectChannels_w(); - dest->ConnectChannels_w(); - for (auto& kv : transports()) { - FakeTransport* transport = static_cast(kv.second); - transport->SetDestination(dest->GetTransport_w(kv.first)); - } - } - - void ConnectChannels_w() { - for (auto& kv : transports()) { - FakeTransport* transport = static_cast(kv.second); - transport->ConnectChannels(); - transport->MaybeStartGathering(); - } - } - - private: - bool fail_create_channel_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ diff --git a/include/webrtc/p2p/base/p2ptransport.h b/include/webrtc/p2p/base/p2ptransport.h deleted file mode 100644 index 0f965b4..0000000 --- a/include/webrtc/p2p/base/p2ptransport.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_P2PTRANSPORT_H_ -#define WEBRTC_P2P_BASE_P2PTRANSPORT_H_ - -#include -#include "webrtc/p2p/base/transport.h" - -namespace cricket { - -// Everything in this class should be called on the worker thread. -class P2PTransport : public Transport { - public: - P2PTransport(const std::string& name, PortAllocator* allocator); - virtual ~P2PTransport(); - - protected: - // Creates and destroys P2PTransportChannel. - virtual TransportChannelImpl* CreateTransportChannel(int component); - virtual void DestroyTransportChannel(TransportChannelImpl* channel); - - friend class P2PTransportChannel; - - RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransport); -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_P2PTRANSPORT_H_ diff --git a/include/webrtc/p2p/base/p2ptransportchannel.h b/include/webrtc/p2p/base/p2ptransportchannel.h deleted file mode 100644 index 92c0534..0000000 --- a/include/webrtc/p2p/base/p2ptransportchannel.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// P2PTransportChannel wraps up the state management of the connection between -// two P2P clients. Clients have candidate ports for connecting, and -// connections which are combinations of candidates from each end (Alice and -// Bob each have candidates, one candidate from Alice and one candidate from -// Bob are used to make a connection, repeat to make many connections). -// -// When all of the available connections become invalid (non-writable), we -// kick off a process of determining more candidates and more connections. -// -#ifndef WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ -#define WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ - -#include -#include -#include -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/p2ptransport.h" -#include "webrtc/p2p/base/portallocator.h" -#include "webrtc/p2p/base/portinterface.h" -#include "webrtc/p2p/base/transport.h" -#include "webrtc/p2p/base/transportchannelimpl.h" -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/sigslot.h" - -namespace cricket { - -extern const uint32_t WEAK_PING_DELAY; - -struct IceParameters { - std::string ufrag; - std::string pwd; - IceParameters(const std::string& ice_ufrag, const std::string& ice_pwd) - : ufrag(ice_ufrag), pwd(ice_pwd) {} - - bool operator==(const IceParameters& other) { - return ufrag == other.ufrag && pwd == other.pwd; - } - bool operator!=(const IceParameters& other) { return !(*this == other); } -}; - -// Adds the port on which the candidate originated. -class RemoteCandidate : public Candidate { - public: - RemoteCandidate(const Candidate& c, PortInterface* origin_port) - : Candidate(c), origin_port_(origin_port) {} - - PortInterface* origin_port() { return origin_port_; } - - private: - PortInterface* origin_port_; -}; - -// P2PTransportChannel manages the candidates and connection process to keep -// two P2P clients connected to each other. -class P2PTransportChannel : public TransportChannelImpl, - public rtc::MessageHandler { - public: - P2PTransportChannel(const std::string& transport_name, - int component, - P2PTransport* transport, - PortAllocator* allocator); - virtual ~P2PTransportChannel(); - - // From TransportChannelImpl: - Transport* GetTransport() override { return transport_; } - TransportChannelState GetState() const override; - void SetIceRole(IceRole role) override; - IceRole GetIceRole() const override { return ice_role_; } - void SetIceTiebreaker(uint64_t tiebreaker) override; - void SetIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) override; - void SetRemoteIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) override; - void SetRemoteIceMode(IceMode mode) override; - void Connect() override; - void MaybeStartGathering() override; - IceGatheringState gathering_state() const override { - return gathering_state_; - } - void AddRemoteCandidate(const Candidate& candidate) override; - // Sets the receiving timeout and gather_continually. - // This also sets the check_receiving_delay proportionally. - void SetIceConfig(const IceConfig& config) override; - - // From TransportChannel: - int SendPacket(const char* data, - size_t len, - const rtc::PacketOptions& options, - int flags) override; - int SetOption(rtc::Socket::Option opt, int value) override; - bool GetOption(rtc::Socket::Option opt, int* value) override; - int GetError() override { return error_; } - bool GetStats(std::vector* stats) override; - - const Connection* best_connection() const { return best_connection_; } - void set_incoming_only(bool value) { incoming_only_ = value; } - - // Note: This is only for testing purpose. - // |ports_| should not be changed from outside. - const std::vector& ports() { return ports_; } - - IceMode remote_ice_mode() const { return remote_ice_mode_; } - - // DTLS methods. - bool IsDtlsActive() const override { return false; } - - // Default implementation. - bool GetSslRole(rtc::SSLRole* role) const override { return false; } - - bool SetSslRole(rtc::SSLRole role) override { return false; } - - // Set up the ciphers to use for DTLS-SRTP. - bool SetSrtpCryptoSuites(const std::vector& ciphers) override { - return false; - } - - // Find out which DTLS-SRTP cipher was negotiated. - bool GetSrtpCryptoSuite(int* cipher) override { return false; } - - // Find out which DTLS cipher was negotiated. - bool GetSslCipherSuite(int* cipher) override { return false; } - - // Returns null because the channel is not encrypted by default. - rtc::scoped_refptr GetLocalCertificate() const override { - return nullptr; - } - - bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override { - return false; - } - - // Allows key material to be extracted for external encryption. - bool ExportKeyingMaterial(const std::string& label, - const uint8_t* context, - size_t context_len, - bool use_context, - uint8_t* result, - size_t result_len) override { - return false; - } - - bool SetLocalCertificate( - const rtc::scoped_refptr& certificate) override { - return false; - } - - // Set DTLS Remote fingerprint. Must be after local identity set. - bool SetRemoteFingerprint(const std::string& digest_alg, - const uint8_t* digest, - size_t digest_len) override { - return false; - } - - int receiving_timeout() const { return receiving_timeout_; } - int check_receiving_delay() const { return check_receiving_delay_; } - - // Helper method used only in unittest. - rtc::DiffServCodePoint DefaultDscpValue() const; - - // Public for unit tests. - Connection* FindNextPingableConnection(); - - // Public for unit tests. - const std::vector& connections() const { return connections_; } - - // Public for unit tests. - PortAllocatorSession* allocator_session() { - return allocator_sessions_.back(); - } - - private: - rtc::Thread* thread() { return worker_thread_; } - bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } - - // A transport channel is weak if the current best connection is either - // not receiving or not writable, or if there is no best connection at all. - bool weak() const; - void UpdateConnectionStates(); - void RequestSort(); - void SortConnections(); - void SwitchBestConnectionTo(Connection* conn); - void UpdateState(); - void HandleAllTimedOut(); - void MaybeStopPortAllocatorSessions(); - TransportChannelState ComputeState() const; - - Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; - bool CreateConnections(const Candidate& remote_candidate, - PortInterface* origin_port); - bool CreateConnection(PortInterface* port, - const Candidate& remote_candidate, - PortInterface* origin_port); - bool FindConnection(cricket::Connection* connection) const; - - uint32_t GetRemoteCandidateGeneration(const Candidate& candidate); - bool IsDuplicateRemoteCandidate(const Candidate& candidate); - void RememberRemoteCandidate(const Candidate& remote_candidate, - PortInterface* origin_port); - bool IsPingable(Connection* conn, uint32_t now); - void PingConnection(Connection* conn); - void AddAllocatorSession(PortAllocatorSession* session); - void AddConnection(Connection* connection); - - void OnPortReady(PortAllocatorSession *session, PortInterface* port); - void OnCandidatesReady(PortAllocatorSession *session, - const std::vector& candidates); - void OnCandidatesAllocationDone(PortAllocatorSession* session); - void OnUnknownAddress(PortInterface* port, - const rtc::SocketAddress& addr, - ProtocolType proto, - IceMessage* stun_msg, - const std::string& remote_username, - bool port_muxed); - void OnPortDestroyed(PortInterface* port); - void OnRoleConflict(PortInterface* port); - - void OnConnectionStateChange(Connection* connection); - void OnReadPacket(Connection *connection, const char *data, size_t len, - const rtc::PacketTime& packet_time); - void OnSentPacket(PortInterface* port, const rtc::SentPacket& sent_packet); - void OnReadyToSend(Connection* connection); - void OnConnectionDestroyed(Connection *connection); - - void OnNominated(Connection* conn); - - void OnMessage(rtc::Message* pmsg) override; - void OnSort(); - void OnCheckAndPing(); - - void PruneConnections(); - Connection* best_nominated_connection() const; - bool IsBackupConnection(Connection* conn) const; - - // Returns the latest remote ICE parameters or nullptr if there are no remote - // ICE parameters yet. - IceParameters* remote_ice() { - return remote_ice_parameters_.empty() ? nullptr - : &remote_ice_parameters_.back(); - } - // Returns the index of the latest remote ICE parameters, or 0 if no remote - // ICE parameters have been received. - uint32_t remote_ice_generation() { - return remote_ice_parameters_.empty() - ? 0 - : static_cast(remote_ice_parameters_.size() - 1); - } - - P2PTransport* transport_; - PortAllocator* allocator_; - rtc::Thread* worker_thread_; - bool incoming_only_; - int error_; - std::vector allocator_sessions_; - std::vector ports_; - std::vector connections_; - Connection* best_connection_; - // Connection selected by the controlling agent. This should be used only - // at controlled side when protocol type is RFC5245. - Connection* pending_best_connection_; - std::vector remote_candidates_; - bool sort_dirty_; // indicates whether another sort is needed right now - bool had_connection_ = false; // if connections_ has ever been nonempty - typedef std::map OptionMap; - OptionMap options_; - std::string ice_ufrag_; - std::string ice_pwd_; - std::vector remote_ice_parameters_; - IceMode remote_ice_mode_; - IceRole ice_role_; - uint64_t tiebreaker_; - IceGatheringState gathering_state_; - - int check_receiving_delay_; - int receiving_timeout_; - int backup_connection_ping_interval_; - uint32_t last_ping_sent_ms_ = 0; - bool gather_continually_ = false; - int weak_ping_delay_ = WEAK_PING_DELAY; - TransportChannelState state_ = TransportChannelState::STATE_INIT; - - RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ diff --git a/include/webrtc/p2p/base/packetsocketfactory.h b/include/webrtc/p2p/base/packetsocketfactory.h deleted file mode 100644 index 5403724..0000000 --- a/include/webrtc/p2p/base/packetsocketfactory.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ -#define WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ - -#include "webrtc/base/proxyinfo.h" - -namespace rtc { - -class AsyncPacketSocket; -class AsyncResolverInterface; - -class PacketSocketFactory { - public: - enum Options { - OPT_SSLTCP = 0x01, // Pseudo-TLS. - OPT_TLS = 0x02, - OPT_STUN = 0x04, - }; - - PacketSocketFactory() { } - virtual ~PacketSocketFactory() { } - - virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, - uint16_t min_port, - uint16_t max_port) = 0; - virtual AsyncPacketSocket* CreateServerTcpSocket( - const SocketAddress& local_address, - uint16_t min_port, - uint16_t max_port, - int opts) = 0; - - // TODO: |proxy_info| and |user_agent| should be set - // per-factory and not when socket is created. - virtual AsyncPacketSocket* CreateClientTcpSocket( - const SocketAddress& local_address, - const SocketAddress& remote_address, - const ProxyInfo& proxy_info, - const std::string& user_agent, - int opts) = 0; - - virtual AsyncResolverInterface* CreateAsyncResolver() = 0; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(PacketSocketFactory); -}; - -} // namespace rtc - -#endif // WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ diff --git a/include/webrtc/p2p/base/port.h b/include/webrtc/p2p/base/port.h deleted file mode 100644 index 57608b5..0000000 --- a/include/webrtc/p2p/base/port.h +++ /dev/null @@ -1,658 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_PORT_H_ -#define WEBRTC_P2P_BASE_PORT_H_ - -#include -#include -#include -#include - -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/packetsocketfactory.h" -#include "webrtc/p2p/base/portinterface.h" -#include "webrtc/p2p/base/stun.h" -#include "webrtc/p2p/base/stunrequest.h" -#include "webrtc/p2p/base/transport.h" -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/network.h" -#include "webrtc/base/proxyinfo.h" -#include "webrtc/base/ratetracker.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -class Connection; -class ConnectionRequest; - -extern const char LOCAL_PORT_TYPE[]; -extern const char STUN_PORT_TYPE[]; -extern const char PRFLX_PORT_TYPE[]; -extern const char RELAY_PORT_TYPE[]; - -extern const char UDP_PROTOCOL_NAME[]; -extern const char TCP_PROTOCOL_NAME[]; -extern const char SSLTCP_PROTOCOL_NAME[]; - -// RFC 6544, TCP candidate encoding rules. -extern const int DISCARD_PORT; -extern const char TCPTYPE_ACTIVE_STR[]; -extern const char TCPTYPE_PASSIVE_STR[]; -extern const char TCPTYPE_SIMOPEN_STR[]; - -// The minimum time we will wait before destroying a connection after creating -// it. -const uint32_t MIN_CONNECTION_LIFETIME = 10 * 1000; // 10 seconds. - -// A connection will be declared dead if it has not received anything for this -// long. -const uint32_t DEAD_CONNECTION_RECEIVE_TIMEOUT = 30 * 1000; // 30 seconds. - -// The timeout duration when a connection does not receive anything. -const uint32_t WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds - -// The length of time we wait before timing out writability on a connection. -const uint32_t CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds - -// The length of time we wait before we become unwritable. -const uint32_t CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds - -// The number of pings that must fail to respond before we become unwritable. -const uint32_t CONNECTION_WRITE_CONNECT_FAILURES = 5; - -// This is the length of time that we wait for a ping response to come back. -const int CONNECTION_RESPONSE_TIMEOUT = 5 * 1000; // 5 seconds - -enum RelayType { - RELAY_GTURN, // Legacy google relay service. - RELAY_TURN // Standard (TURN) relay service. -}; - -enum IcePriorityValue { - // The reason we are choosing Relay preference 2 is because, we can run - // Relay from client to server on UDP/TCP/TLS. To distinguish the transport - // protocol, we prefer UDP over TCP over TLS. - // For UDP ICE_TYPE_PREFERENCE_RELAY will be 2. - // For TCP ICE_TYPE_PREFERENCE_RELAY will be 1. - // For TLS ICE_TYPE_PREFERENCE_RELAY will be 0. - // Check turnport.cc for setting these values. - ICE_TYPE_PREFERENCE_RELAY = 2, - ICE_TYPE_PREFERENCE_HOST_TCP = 90, - ICE_TYPE_PREFERENCE_SRFLX = 100, - ICE_TYPE_PREFERENCE_PRFLX = 110, - ICE_TYPE_PREFERENCE_HOST = 126 -}; - -const char* ProtoToString(ProtocolType proto); -bool StringToProto(const char* value, ProtocolType* proto); - -struct ProtocolAddress { - rtc::SocketAddress address; - ProtocolType proto; - bool secure; - - ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) - : address(a), proto(p), secure(false) { } - ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec) - : address(a), proto(p), secure(sec) { } -}; - -typedef std::set ServerAddresses; - -// Represents a local communication mechanism that can be used to create -// connections to similar mechanisms of the other client. Subclasses of this -// one add support for specific mechanisms like local UDP ports. -class Port : public PortInterface, public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - Port(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - const std::string& username_fragment, - const std::string& password); - Port(rtc::Thread* thread, - const std::string& type, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username_fragment, - const std::string& password); - virtual ~Port(); - - virtual const std::string& Type() const { return type_; } - virtual rtc::Network* Network() const { return network_; } - - // Methods to set/get ICE role and tiebreaker values. - IceRole GetIceRole() const { return ice_role_; } - void SetIceRole(IceRole role) { ice_role_ = role; } - - void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; } - uint64_t IceTiebreaker() const { return tiebreaker_; } - - virtual bool SharedSocket() const { return shared_socket_; } - void ResetSharedSocket() { shared_socket_ = false; } - - // The thread on which this port performs its I/O. - rtc::Thread* thread() { return thread_; } - - // The factory used to create the sockets of this port. - rtc::PacketSocketFactory* socket_factory() const { return factory_; } - void set_socket_factory(rtc::PacketSocketFactory* factory) { - factory_ = factory; - } - - // For debugging purposes. - const std::string& content_name() const { return content_name_; } - void set_content_name(const std::string& content_name) { - content_name_ = content_name; - } - - int component() const { return component_; } - void set_component(int component) { component_ = component; } - - bool send_retransmit_count_attribute() const { - return send_retransmit_count_attribute_; - } - void set_send_retransmit_count_attribute(bool enable) { - send_retransmit_count_attribute_ = enable; - } - - // Identifies the generation that this port was created in. - uint32_t generation() { return generation_; } - void set_generation(uint32_t generation) { generation_ = generation; } - - // ICE requires a single username/password per content/media line. So the - // |ice_username_fragment_| of the ports that belongs to the same content will - // be the same. However this causes a small complication with our relay - // server, which expects different username for RTP and RTCP. - // - // To resolve this problem, we implemented the username_fragment(), - // which returns a different username (calculated from - // |ice_username_fragment_|) for RTCP in the case of ICEPROTO_GOOGLE. And the - // username_fragment() simply returns |ice_username_fragment_| when running - // in ICEPROTO_RFC5245. - // - // As a result the ICEPROTO_GOOGLE will use different usernames for RTP and - // RTCP. And the ICEPROTO_RFC5245 will use same username for both RTP and - // RTCP. - const std::string username_fragment() const; - const std::string& password() const { return password_; } - - // Fired when candidates are discovered by the port. When all candidates - // are discovered that belong to port SignalAddressReady is fired. - sigslot::signal2 SignalCandidateReady; - - // Provides all of the above information in one handy object. - virtual const std::vector& Candidates() const { - return candidates_; - } - - // SignalPortComplete is sent when port completes the task of candidates - // allocation. - sigslot::signal1 SignalPortComplete; - // This signal sent when port fails to allocate candidates and this port - // can't be used in establishing the connections. When port is in shared mode - // and port fails to allocate one of the candidates, port shouldn't send - // this signal as other candidates might be usefull in establishing the - // connection. - sigslot::signal1 SignalPortError; - - // Returns a map containing all of the connections of this port, keyed by the - // remote address. - typedef std::map AddressMap; - const AddressMap& connections() { return connections_; } - - // Returns the connection to the given address or NULL if none exists. - virtual Connection* GetConnection( - const rtc::SocketAddress& remote_addr); - - // Called each time a connection is created. - sigslot::signal2 SignalConnectionCreated; - - // In a shared socket mode each port which shares the socket will decide - // to accept the packet based on the |remote_addr|. Currently only UDP - // port implemented this method. - // TODO(mallinath) - Make it pure virtual. - virtual bool HandleIncomingPacket( - rtc::AsyncPacketSocket* socket, const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time) { - ASSERT(false); - return false; - } - - // Sends a response message (normal or error) to the given request. One of - // these methods should be called as a response to SignalUnknownAddress. - // NOTE: You MUST call CreateConnection BEFORE SendBindingResponse. - virtual void SendBindingResponse(StunMessage* request, - const rtc::SocketAddress& addr); - virtual void SendBindingErrorResponse( - StunMessage* request, const rtc::SocketAddress& addr, - int error_code, const std::string& reason); - - void set_proxy(const std::string& user_agent, - const rtc::ProxyInfo& proxy) { - user_agent_ = user_agent; - proxy_ = proxy; - } - const std::string& user_agent() { return user_agent_; } - const rtc::ProxyInfo& proxy() { return proxy_; } - - virtual void EnablePortPackets(); - - // Called if the port has no connections and is no longer useful. - void Destroy(); - - virtual void OnMessage(rtc::Message *pmsg); - - // Debugging description of this port - virtual std::string ToString() const; - const rtc::IPAddress& ip() const { return ip_; } - uint16_t min_port() { return min_port_; } - uint16_t max_port() { return max_port_; } - - // Timeout shortening function to speed up unit tests. - void set_timeout_delay(int delay) { timeout_delay_ = delay; } - - // This method will return local and remote username fragements from the - // stun username attribute if present. - bool ParseStunUsername(const StunMessage* stun_msg, - std::string* local_username, - std::string* remote_username) const; - void CreateStunUsername(const std::string& remote_username, - std::string* stun_username_attr_str) const; - - bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, - IceMessage* stun_msg, - const std::string& remote_ufrag); - - // Called when a packet has been sent to the socket. - void OnSentPacket(const rtc::SentPacket& sent_packet); - - // Called when the socket is currently able to send. - void OnReadyToSend(); - - // Called when the Connection discovers a local peer reflexive candidate. - // Returns the index of the new local candidate. - size_t AddPrflxCandidate(const Candidate& local); - - void set_candidate_filter(uint32_t candidate_filter) { - candidate_filter_ = candidate_filter; - } - - protected: - enum { - MSG_DEAD = 0, - MSG_FIRST_AVAILABLE - }; - - void set_type(const std::string& type) { type_ = type; } - - void AddAddress(const rtc::SocketAddress& address, - const rtc::SocketAddress& base_address, - const rtc::SocketAddress& related_address, - const std::string& protocol, - const std::string& relay_protocol, - const std::string& tcptype, - const std::string& type, - uint32_t type_preference, - uint32_t relay_preference, - bool final); - - // Adds the given connection to the list. (Deleting removes them.) - void AddConnection(Connection* conn); - - // Called when a packet is received from an unknown address that is not - // currently a connection. If this is an authenticated STUN binding request, - // then we will signal the client. - void OnReadPacket(const char* data, size_t size, - const rtc::SocketAddress& addr, - ProtocolType proto); - - // If the given data comprises a complete and correct STUN message then the - // return value is true, otherwise false. If the message username corresponds - // with this port's username fragment, msg will contain the parsed STUN - // message. Otherwise, the function may send a STUN response internally. - // remote_username contains the remote fragment of the STUN username. - bool GetStunMessage(const char* data, size_t size, - const rtc::SocketAddress& addr, - IceMessage** out_msg, std::string* out_username); - - // Checks if the address in addr is compatible with the port's ip. - bool IsCompatibleAddress(const rtc::SocketAddress& addr); - - // Returns default DSCP value. - rtc::DiffServCodePoint DefaultDscpValue() const { - // No change from what MediaChannel set. - return rtc::DSCP_NO_CHANGE; - } - - uint32_t candidate_filter() { return candidate_filter_; } - - private: - void Construct(); - // Called when one of our connections deletes itself. - void OnConnectionDestroyed(Connection* conn); - - // Whether this port is dead, and hence, should be destroyed on the controlled - // side. - bool dead() const { - return ice_role_ == ICEROLE_CONTROLLED && connections_.empty(); - } - - rtc::Thread* thread_; - rtc::PacketSocketFactory* factory_; - std::string type_; - bool send_retransmit_count_attribute_; - rtc::Network* network_; - rtc::IPAddress ip_; - uint16_t min_port_; - uint16_t max_port_; - std::string content_name_; - int component_; - uint32_t generation_; - // In order to establish a connection to this Port (so that real data can be - // sent through), the other side must send us a STUN binding request that is - // authenticated with this username_fragment and password. - // PortAllocatorSession will provide these username_fragment and password. - // - // Note: we should always use username_fragment() instead of using - // |ice_username_fragment_| directly. For the details see the comment on - // username_fragment(). - std::string ice_username_fragment_; - std::string password_; - std::vector candidates_; - AddressMap connections_; - int timeout_delay_; - bool enable_port_packets_; - IceRole ice_role_; - uint64_t tiebreaker_; - bool shared_socket_; - // Information to use when going through a proxy. - std::string user_agent_; - rtc::ProxyInfo proxy_; - - // Candidate filter is pushed down to Port such that each Port could - // make its own decision on how to create candidates. For example, - // when IceTransportsType is set to relay, both RelayPort and - // TurnPort will hide raddr to avoid local address leakage. - uint32_t candidate_filter_; - - friend class Connection; -}; - -// Represents a communication link between a port on the local client and a -// port on the remote client. -class Connection : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - struct SentPing { - SentPing(const std::string id, uint32_t sent_time) - : id(id), sent_time(sent_time) {} - - std::string id; - uint32_t sent_time; - }; - - // States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4 - enum State { - STATE_WAITING = 0, // Check has not been performed, Waiting pair on CL. - STATE_INPROGRESS, // Check has been sent, transaction is in progress. - STATE_SUCCEEDED, // Check already done, produced a successful result. - STATE_FAILED // Check for this connection failed. - }; - - virtual ~Connection(); - - // The local port where this connection sends and receives packets. - Port* port() { return port_; } - const Port* port() const { return port_; } - - // Returns the description of the local port - virtual const Candidate& local_candidate() const; - - // Returns the description of the remote port to which we communicate. - const Candidate& remote_candidate() const { return remote_candidate_; } - - // Returns the pair priority. - uint64_t priority() const; - - enum WriteState { - STATE_WRITABLE = 0, // we have received ping responses recently - STATE_WRITE_UNRELIABLE = 1, // we have had a few ping failures - STATE_WRITE_INIT = 2, // we have yet to receive a ping response - STATE_WRITE_TIMEOUT = 3, // we have had a large number of ping failures - }; - - WriteState write_state() const { return write_state_; } - bool writable() const { return write_state_ == STATE_WRITABLE; } - bool receiving() const { return receiving_; } - - // Determines whether the connection has finished connecting. This can only - // be false for TCP connections. - bool connected() const { return connected_; } - bool weak() const { return !(writable() && receiving() && connected()); } - bool active() const { - return write_state_ != STATE_WRITE_TIMEOUT; - } - // A connection is dead if it can be safely deleted. - bool dead(uint32_t now) const; - - // Estimate of the round-trip time over this connection. - uint32_t rtt() const { return rtt_; } - - size_t sent_total_bytes(); - size_t sent_bytes_second(); - // Used to track how many packets are discarded in the application socket due - // to errors. - size_t sent_discarded_packets(); - size_t sent_total_packets(); - size_t recv_total_bytes(); - size_t recv_bytes_second(); - sigslot::signal1 SignalStateChange; - - // Sent when the connection has decided that it is no longer of value. It - // will delete itself immediately after this call. - sigslot::signal1 SignalDestroyed; - - // The connection can send and receive packets asynchronously. This matches - // the interface of AsyncPacketSocket, which may use UDP or TCP under the - // covers. - virtual int Send(const void* data, size_t size, - const rtc::PacketOptions& options) = 0; - - // Error if Send() returns < 0 - virtual int GetError() = 0; - - sigslot::signal4 - SignalReadPacket; - - sigslot::signal1 SignalReadyToSend; - - // Called when a packet is received on this connection. - void OnReadPacket(const char* data, size_t size, - const rtc::PacketTime& packet_time); - - // Called when the socket is currently able to send. - void OnReadyToSend(); - - // Called when a connection is determined to be no longer useful to us. We - // still keep it around in case the other side wants to use it. But we can - // safely stop pinging on it and we can allow it to time out if the other - // side stops using it as well. - bool pruned() const { return pruned_; } - void Prune(); - - bool use_candidate_attr() const { return use_candidate_attr_; } - void set_use_candidate_attr(bool enable); - - bool nominated() const { return nominated_; } - void set_nominated(bool nominated) { nominated_ = nominated; } - - void set_remote_ice_mode(IceMode mode) { - remote_ice_mode_ = mode; - } - - void set_receiving_timeout(uint32_t receiving_timeout_ms) { - receiving_timeout_ = receiving_timeout_ms; - } - - // Makes the connection go away. - void Destroy(); - - // Makes the connection go away, in a failed state. - void FailAndDestroy(); - - // Checks that the state of this connection is up-to-date. The argument is - // the current time, which is compared against various timeouts. - void UpdateState(uint32_t now); - - // Called when this connection should try checking writability again. - uint32_t last_ping_sent() const { return last_ping_sent_; } - void Ping(uint32_t now); - void ReceivedPingResponse(); - uint32_t last_ping_response_received() const { - return last_ping_response_received_; - } - - // Called whenever a valid ping is received on this connection. This is - // public because the connection intercepts the first ping for us. - uint32_t last_ping_received() const { return last_ping_received_; } - void ReceivedPing(); - // Handles the binding request; sends a response if this is a valid request. - void HandleBindingRequest(IceMessage* msg); - - // Debugging description of this connection - std::string ToDebugId() const; - std::string ToString() const; - std::string ToSensitiveString() const; - // Prints pings_since_last_response_ into a string. - void PrintPingsSinceLastResponse(std::string* pings, size_t max); - - bool reported() const { return reported_; } - void set_reported(bool reported) { reported_ = reported;} - - // This signal will be fired if this connection is nominated by the - // controlling side. - sigslot::signal1 SignalNominated; - - // Invoked when Connection receives STUN error response with 487 code. - void HandleRoleConflictFromPeer(); - - State state() const { return state_; } - - IceMode remote_ice_mode() const { return remote_ice_mode_; } - - // Update the ICE password of the remote candidate if |ice_ufrag| matches - // the candidate's ufrag, and the candidate's passwrod has not been set. - void MaybeSetRemoteIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd); - - // If |remote_candidate_| is peer reflexive and is equivalent to - // |new_candidate| except the type, update |remote_candidate_| to - // |new_candidate|. - void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate); - - // Returns the last received time of any data, stun request, or stun - // response in milliseconds - uint32_t last_received() const; - - protected: - enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE }; - - // Constructs a new connection to the given remote port. - Connection(Port* port, size_t index, const Candidate& candidate); - - // Called back when StunRequestManager has a stun packet to send - void OnSendStunPacket(const void* data, size_t size, StunRequest* req); - - // Callbacks from ConnectionRequest - virtual void OnConnectionRequestResponse(ConnectionRequest* req, - StunMessage* response); - void OnConnectionRequestErrorResponse(ConnectionRequest* req, - StunMessage* response); - void OnConnectionRequestTimeout(ConnectionRequest* req); - void OnConnectionRequestSent(ConnectionRequest* req); - - // Changes the state and signals if necessary. - void set_write_state(WriteState value); - void set_receiving(bool value); - void set_state(State state); - void set_connected(bool value); - - void OnMessage(rtc::Message *pmsg); - - Port* port_; - size_t local_candidate_index_; - Candidate remote_candidate_; - WriteState write_state_; - bool receiving_; - bool connected_; - bool pruned_; - // By default |use_candidate_attr_| flag will be true, - // as we will be using aggressive nomination. - // But when peer is ice-lite, this flag "must" be initialized to false and - // turn on when connection becomes "best connection". - bool use_candidate_attr_; - // Whether this connection has been nominated by the controlling side via - // the use_candidate attribute. - bool nominated_; - IceMode remote_ice_mode_; - StunRequestManager requests_; - uint32_t rtt_; - uint32_t last_ping_sent_; // last time we sent a ping to the other side - uint32_t last_ping_received_; // last time we received a ping from the other - // side - uint32_t last_data_received_; - uint32_t last_ping_response_received_; - std::vector pings_since_last_response_; - - rtc::RateTracker recv_rate_tracker_; - rtc::RateTracker send_rate_tracker_; - uint32_t sent_packets_discarded_; - uint32_t sent_packets_total_; - - private: - void MaybeAddPrflxCandidate(ConnectionRequest* request, - StunMessage* response); - - bool reported_; - State state_; - // Time duration to switch from receiving to not receiving. - uint32_t receiving_timeout_; - uint32_t time_created_ms_; - - friend class Port; - friend class ConnectionRequest; -}; - -// ProxyConnection defers all the interesting work to the port. -class ProxyConnection : public Connection { - public: - ProxyConnection(Port* port, size_t index, const Candidate& remote_candidate); - - int Send(const void* data, - size_t size, - const rtc::PacketOptions& options) override; - int GetError() override { return error_; } - - private: - int error_ = 0; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_PORT_H_ diff --git a/include/webrtc/p2p/base/portallocator.h b/include/webrtc/p2p/base/portallocator.h deleted file mode 100644 index 723a000..0000000 --- a/include/webrtc/p2p/base/portallocator.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_ -#define WEBRTC_P2P_BASE_PORTALLOCATOR_H_ - -#include -#include - -#include "webrtc/p2p/base/port.h" -#include "webrtc/p2p/base/portinterface.h" -#include "webrtc/base/helpers.h" -#include "webrtc/base/proxyinfo.h" -#include "webrtc/base/sigslot.h" - -namespace cricket { - -// PortAllocator is responsible for allocating Port types for a given -// P2PSocket. It also handles port freeing. -// -// Clients can override this class to control port allocation, including -// what kinds of ports are allocated. - -enum { - // Disable local UDP ports. This doesn't impact how we connect to relay - // servers. - PORTALLOCATOR_DISABLE_UDP = 0x01, - PORTALLOCATOR_DISABLE_STUN = 0x02, - PORTALLOCATOR_DISABLE_RELAY = 0x04, - // Disable local TCP ports. This doesn't impact how we connect to relay - // servers. - PORTALLOCATOR_DISABLE_TCP = 0x08, - PORTALLOCATOR_ENABLE_SHAKER = 0x10, - PORTALLOCATOR_ENABLE_IPV6 = 0x40, - // TODO(pthatcher): Remove this once it's no longer used in: - // remoting/client/plugin/pepper_port_allocator.cc - // remoting/protocol/chromium_port_allocator.cc - // remoting/test/fake_port_allocator.cc - // It's a no-op and is no longer needed. - PORTALLOCATOR_ENABLE_SHARED_UFRAG = 0x80, - PORTALLOCATOR_ENABLE_SHARED_SOCKET = 0x100, - PORTALLOCATOR_ENABLE_STUN_RETRANSMIT_ATTRIBUTE = 0x200, - // When specified, we'll only allocate the STUN candidate for the public - // interface as seen by regular http traffic and the HOST candidate associated - // with the default local interface. - PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION = 0x400, - // When specified along with PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION, the - // default local candidate mentioned above will not be allocated. Only the - // STUN candidate will be. - PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE = 0x800, - // Disallow use of UDP when connecting to a relay server. Since proxy servers - // usually don't handle UDP, using UDP will leak the IP address. - PORTALLOCATOR_DISABLE_UDP_RELAY = 0x1000, -}; - -const uint32_t kDefaultPortAllocatorFlags = 0; - -const uint32_t kDefaultStepDelay = 1000; // 1 sec step delay. -// As per RFC 5245 Appendix B.1, STUN transactions need to be paced at certain -// internal. Less than 20ms is not acceptable. We choose 50ms as our default. -const uint32_t kMinimumStepDelay = 50; - -// CF = CANDIDATE FILTER -enum { - CF_NONE = 0x0, - CF_HOST = 0x1, - CF_REFLEXIVE = 0x2, - CF_RELAY = 0x4, - CF_ALL = 0x7, -}; - -// TODO(deadbeef): Rename to TurnCredentials (and username to ufrag). -struct RelayCredentials { - RelayCredentials() {} - RelayCredentials(const std::string& username, const std::string& password) - : username(username), password(password) {} - - std::string username; - std::string password; -}; - -typedef std::vector PortList; -// TODO(deadbeef): Rename to TurnServerConfig. -struct RelayServerConfig { - RelayServerConfig(RelayType type) : type(type), priority(0) {} - - RelayType type; - PortList ports; - RelayCredentials credentials; - int priority; -}; - -class PortAllocatorSession : public sigslot::has_slots<> { - public: - // Content name passed in mostly for logging and debugging. - PortAllocatorSession(const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd, - uint32_t flags); - - // Subclasses should clean up any ports created. - virtual ~PortAllocatorSession() {} - - uint32_t flags() const { return flags_; } - void set_flags(uint32_t flags) { flags_ = flags; } - std::string content_name() const { return content_name_; } - int component() const { return component_; } - - // Starts gathering STUN and Relay configurations. - virtual void StartGettingPorts() = 0; - virtual void StopGettingPorts() = 0; - // Only stop the existing gathering process but may start new ones if needed. - virtual void ClearGettingPorts() = 0; - // Whether the process of getting ports has been stopped. - virtual bool IsGettingPorts() = 0; - - sigslot::signal2 SignalPortReady; - sigslot::signal2&> SignalCandidatesReady; - sigslot::signal1 SignalCandidatesAllocationDone; - - virtual uint32_t generation() { return generation_; } - virtual void set_generation(uint32_t generation) { generation_ = generation; } - sigslot::signal1 SignalDestroyed; - - const std::string& ice_ufrag() const { return ice_ufrag_; } - const std::string& ice_pwd() const { return ice_pwd_; } - - protected: - // TODO(deadbeef): Get rid of these when everyone switches to ice_ufrag and - // ice_pwd. - const std::string& username() const { return ice_ufrag_; } - const std::string& password() const { return ice_pwd_; } - - std::string content_name_; - int component_; - - private: - uint32_t flags_; - uint32_t generation_; - std::string ice_ufrag_; - std::string ice_pwd_; -}; - -class PortAllocator : public sigslot::has_slots<> { - public: - PortAllocator() : - flags_(kDefaultPortAllocatorFlags), - min_port_(0), - max_port_(0), - step_delay_(kDefaultStepDelay), - allow_tcp_listen_(true), - candidate_filter_(CF_ALL) { - // This will allow us to have old behavior on non webrtc clients. - } - virtual ~PortAllocator() {} - - // Set STUN and TURN servers to be used in future sessions. - virtual void SetIceServers( - const ServerAddresses& stun_servers, - const std::vector& turn_servers) = 0; - - PortAllocatorSession* CreateSession( - const std::string& sid, - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd); - - uint32_t flags() const { return flags_; } - void set_flags(uint32_t flags) { flags_ = flags; } - - const std::string& user_agent() const { return agent_; } - const rtc::ProxyInfo& proxy() const { return proxy_; } - void set_proxy(const std::string& agent, const rtc::ProxyInfo& proxy) { - agent_ = agent; - proxy_ = proxy; - } - - // Gets/Sets the port range to use when choosing client ports. - int min_port() const { return min_port_; } - int max_port() const { return max_port_; } - bool SetPortRange(int min_port, int max_port) { - if (min_port > max_port) { - return false; - } - - min_port_ = min_port; - max_port_ = max_port; - return true; - } - - uint32_t step_delay() const { return step_delay_; } - void set_step_delay(uint32_t delay) { step_delay_ = delay; } - - bool allow_tcp_listen() const { return allow_tcp_listen_; } - void set_allow_tcp_listen(bool allow_tcp_listen) { - allow_tcp_listen_ = allow_tcp_listen; - } - - uint32_t candidate_filter() { return candidate_filter_; } - bool set_candidate_filter(uint32_t filter) { - // TODO(mallinath) - Do transition check? - candidate_filter_ = filter; - return true; - } - - // Gets/Sets the Origin value used for WebRTC STUN requests. - const std::string& origin() const { return origin_; } - void set_origin(const std::string& origin) { origin_ = origin; } - - protected: - virtual PortAllocatorSession* CreateSessionInternal( - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd) = 0; - - uint32_t flags_; - std::string agent_; - rtc::ProxyInfo proxy_; - int min_port_; - int max_port_; - uint32_t step_delay_; - bool allow_tcp_listen_; - uint32_t candidate_filter_; - std::string origin_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ diff --git a/include/webrtc/p2p/base/portinterface.h b/include/webrtc/p2p/base/portinterface.h deleted file mode 100644 index d1c371d..0000000 --- a/include/webrtc/p2p/base/portinterface.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_PORTINTERFACE_H_ -#define WEBRTC_P2P_BASE_PORTINTERFACE_H_ - -#include - -#include "webrtc/p2p/base/transport.h" -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/socketaddress.h" - -namespace rtc { -class Network; -struct PacketOptions; -} - -namespace cricket { -class Connection; -class IceMessage; -class StunMessage; - -enum ProtocolType { - PROTO_UDP, - PROTO_TCP, - PROTO_SSLTCP, - PROTO_LAST = PROTO_SSLTCP -}; - -// Defines the interface for a port, which represents a local communication -// mechanism that can be used to create connections to similar mechanisms of -// the other client. Various types of ports will implement this interface. -class PortInterface { - public: - virtual ~PortInterface() {} - - virtual const std::string& Type() const = 0; - virtual rtc::Network* Network() const = 0; - - // Methods to set/get ICE role and tiebreaker values. - virtual void SetIceRole(IceRole role) = 0; - virtual IceRole GetIceRole() const = 0; - - virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0; - virtual uint64_t IceTiebreaker() const = 0; - - virtual bool SharedSocket() const = 0; - - virtual bool SupportsProtocol(const std::string& protocol) const = 0; - - // PrepareAddress will attempt to get an address for this port that other - // clients can send to. It may take some time before the address is ready. - // Once it is ready, we will send SignalAddressReady. If errors are - // preventing the port from getting an address, it may send - // SignalAddressError. - virtual void PrepareAddress() = 0; - - // Returns the connection to the given address or NULL if none exists. - virtual Connection* GetConnection( - const rtc::SocketAddress& remote_addr) = 0; - - // Creates a new connection to the given address. - enum CandidateOrigin { ORIGIN_THIS_PORT, ORIGIN_OTHER_PORT, ORIGIN_MESSAGE }; - virtual Connection* CreateConnection( - const Candidate& remote_candidate, CandidateOrigin origin) = 0; - - // Functions on the underlying socket(s). - virtual int SetOption(rtc::Socket::Option opt, int value) = 0; - virtual int GetOption(rtc::Socket::Option opt, int* value) = 0; - virtual int GetError() = 0; - - virtual const std::vector& Candidates() const = 0; - - // Sends the given packet to the given address, provided that the address is - // that of a connection or an address that has sent to us already. - virtual int SendTo(const void* data, size_t size, - const rtc::SocketAddress& addr, - const rtc::PacketOptions& options, bool payload) = 0; - - // Indicates that we received a successful STUN binding request from an - // address that doesn't correspond to any current connection. To turn this - // into a real connection, call CreateConnection. - sigslot::signal6 SignalUnknownAddress; - - // Sends a response message (normal or error) to the given request. One of - // these methods should be called as a response to SignalUnknownAddress. - // NOTE: You MUST call CreateConnection BEFORE SendBindingResponse. - virtual void SendBindingResponse(StunMessage* request, - const rtc::SocketAddress& addr) = 0; - virtual void SendBindingErrorResponse( - StunMessage* request, const rtc::SocketAddress& addr, - int error_code, const std::string& reason) = 0; - - // Signaled when this port decides to delete itself because it no longer has - // any usefulness. - sigslot::signal1 SignalDestroyed; - - // Signaled when Port discovers ice role conflict with the peer. - sigslot::signal1 SignalRoleConflict; - - // Normally, packets arrive through a connection (or they result signaling of - // unknown address). Calling this method turns off delivery of packets - // through their respective connection and instead delivers every packet - // through this port. - virtual void EnablePortPackets() = 0; - sigslot::signal4 SignalReadPacket; - - // Emitted each time a packet is sent on this port. - sigslot::signal2 SignalSentPacket; - - virtual std::string ToString() const = 0; - - protected: - PortInterface() {} -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_PORTINTERFACE_H_ diff --git a/include/webrtc/p2p/base/pseudotcp.h b/include/webrtc/p2p/base/pseudotcp.h deleted file mode 100644 index 6d402da..0000000 --- a/include/webrtc/p2p/base/pseudotcp.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_PSEUDOTCP_H_ -#define WEBRTC_P2P_BASE_PSEUDOTCP_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/stream.h" - -namespace cricket { - -////////////////////////////////////////////////////////////////////// -// IPseudoTcpNotify -////////////////////////////////////////////////////////////////////// - -class PseudoTcp; - -class IPseudoTcpNotify { - public: - // Notification of tcp events - virtual void OnTcpOpen(PseudoTcp* tcp) = 0; - virtual void OnTcpReadable(PseudoTcp* tcp) = 0; - virtual void OnTcpWriteable(PseudoTcp* tcp) = 0; - virtual void OnTcpClosed(PseudoTcp* tcp, uint32_t error) = 0; - - // Write the packet onto the network - enum WriteResult { WR_SUCCESS, WR_TOO_LARGE, WR_FAIL }; - virtual WriteResult TcpWritePacket(PseudoTcp* tcp, - const char* buffer, size_t len) = 0; - - protected: - virtual ~IPseudoTcpNotify() {} -}; - -////////////////////////////////////////////////////////////////////// -// PseudoTcp -////////////////////////////////////////////////////////////////////// - -class PseudoTcp { - public: - static uint32_t Now(); - - PseudoTcp(IPseudoTcpNotify* notify, uint32_t conv); - virtual ~PseudoTcp(); - - int Connect(); - int Recv(char* buffer, size_t len); - int Send(const char* buffer, size_t len); - void Close(bool force); - int GetError(); - - enum TcpState { - TCP_LISTEN, TCP_SYN_SENT, TCP_SYN_RECEIVED, TCP_ESTABLISHED, TCP_CLOSED - }; - TcpState State() const { return m_state; } - - // Call this when the PMTU changes. - void NotifyMTU(uint16_t mtu); - - // Call this based on timeout value returned from GetNextClock. - // It's ok to call this too frequently. - void NotifyClock(uint32_t now); - - // Call this whenever a packet arrives. - // Returns true if the packet was processed successfully. - bool NotifyPacket(const char * buffer, size_t len); - - // Call this to determine the next time NotifyClock should be called. - // Returns false if the socket is ready to be destroyed. - bool GetNextClock(uint32_t now, long& timeout); - - // Call these to get/set option values to tailor this PseudoTcp - // instance's behaviour for the kind of data it will carry. - // If an unrecognized option is set or got, an assertion will fire. - // - // Setting options for OPT_RCVBUF or OPT_SNDBUF after Connect() is called - // will result in an assertion. - enum Option { - OPT_NODELAY, // Whether to enable Nagle's algorithm (0 == off) - OPT_ACKDELAY, // The Delayed ACK timeout (0 == off). - OPT_RCVBUF, // Set the receive buffer size, in bytes. - OPT_SNDBUF, // Set the send buffer size, in bytes. - }; - void GetOption(Option opt, int* value); - void SetOption(Option opt, int value); - - // Returns current congestion window in bytes. - uint32_t GetCongestionWindow() const; - - // Returns amount of data in bytes that has been sent, but haven't - // been acknowledged. - uint32_t GetBytesInFlight() const; - - // Returns number of bytes that were written in buffer and haven't - // been sent. - uint32_t GetBytesBufferedNotSent() const; - - // Returns current round-trip time estimate in milliseconds. - uint32_t GetRoundTripTimeEstimateMs() const; - - protected: - enum SendFlags { sfNone, sfDelayedAck, sfImmediateAck }; - - struct Segment { - uint32_t conv, seq, ack; - uint8_t flags; - uint16_t wnd; - const char * data; - uint32_t len; - uint32_t tsval, tsecr; - }; - - struct SSegment { - SSegment(uint32_t s, uint32_t l, bool c) - : seq(s), len(l), /*tstamp(0),*/ xmit(0), bCtrl(c) {} - uint32_t seq, len; - // uint32_t tstamp; - uint8_t xmit; - bool bCtrl; - }; - typedef std::list SList; - - struct RSegment { - uint32_t seq, len; - }; - - uint32_t queue(const char* data, uint32_t len, bool bCtrl); - - // Creates a packet and submits it to the network. This method can either - // send payload or just an ACK packet. - // - // |seq| is the sequence number of this packet. - // |flags| is the flags for sending this packet. - // |offset| is the offset to read from |m_sbuf|. - // |len| is the number of bytes to read from |m_sbuf| as payload. If this - // value is 0 then this is an ACK packet, otherwise this packet has payload. - IPseudoTcpNotify::WriteResult packet(uint32_t seq, - uint8_t flags, - uint32_t offset, - uint32_t len); - bool parse(const uint8_t* buffer, uint32_t size); - - void attemptSend(SendFlags sflags = sfNone); - - void closedown(uint32_t err = 0); - - bool clock_check(uint32_t now, long& nTimeout); - - bool process(Segment& seg); - bool transmit(const SList::iterator& seg, uint32_t now); - - void adjustMTU(); - - protected: - // This method is used in test only to query receive buffer state. - bool isReceiveBufferFull() const; - - // This method is only used in tests, to disable window scaling - // support for testing backward compatibility. - void disableWindowScale(); - - private: - // Queue the connect message with TCP options. - void queueConnectMessage(); - - // Parse TCP options in the header. - void parseOptions(const char* data, uint32_t len); - - // Apply a TCP option that has been read from the header. - void applyOption(char kind, const char* data, uint32_t len); - - // Apply window scale option. - void applyWindowScaleOption(uint8_t scale_factor); - - // Resize the send buffer with |new_size| in bytes. - void resizeSendBuffer(uint32_t new_size); - - // Resize the receive buffer with |new_size| in bytes. This call adjusts - // window scale factor |m_swnd_scale| accordingly. - void resizeReceiveBuffer(uint32_t new_size); - - IPseudoTcpNotify* m_notify; - enum Shutdown { SD_NONE, SD_GRACEFUL, SD_FORCEFUL } m_shutdown; - int m_error; - - // TCB data - TcpState m_state; - uint32_t m_conv; - bool m_bReadEnable, m_bWriteEnable, m_bOutgoing; - uint32_t m_lasttraffic; - - // Incoming data - typedef std::list RList; - RList m_rlist; - uint32_t m_rbuf_len, m_rcv_nxt, m_rcv_wnd, m_lastrecv; - uint8_t m_rwnd_scale; // Window scale factor. - rtc::FifoBuffer m_rbuf; - - // Outgoing data - SList m_slist; - uint32_t m_sbuf_len, m_snd_nxt, m_snd_wnd, m_lastsend, m_snd_una; - uint8_t m_swnd_scale; // Window scale factor. - rtc::FifoBuffer m_sbuf; - - // Maximum segment size, estimated protocol level, largest segment sent - uint32_t m_mss, m_msslevel, m_largest, m_mtu_advise; - // Retransmit timer - uint32_t m_rto_base; - - // Timestamp tracking - uint32_t m_ts_recent, m_ts_lastack; - - // Round-trip calculation - uint32_t m_rx_rttvar, m_rx_srtt, m_rx_rto; - - // Congestion avoidance, Fast retransmit/recovery, Delayed ACKs - uint32_t m_ssthresh, m_cwnd; - uint8_t m_dup_acks; - uint32_t m_recover; - uint32_t m_t_ack; - - // Configuration options - bool m_use_nagling; - uint32_t m_ack_delay; - - // This is used by unit tests to test backward compatibility of - // PseudoTcp implementations that don't support window scaling. - bool m_support_wnd_scale; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_PSEUDOTCP_H_ diff --git a/include/webrtc/p2p/base/rawtransport.h b/include/webrtc/p2p/base/rawtransport.h deleted file mode 100644 index cb700ae..0000000 --- a/include/webrtc/p2p/base/rawtransport.h +++ /dev/null @@ -1,2 +0,0 @@ -// TODO(pthatcher): Remove this file once Chrome's build files no -// longer refer to it. diff --git a/include/webrtc/p2p/base/rawtransportchannel.h b/include/webrtc/p2p/base/rawtransportchannel.h deleted file mode 100644 index cb700ae..0000000 --- a/include/webrtc/p2p/base/rawtransportchannel.h +++ /dev/null @@ -1,2 +0,0 @@ -// TODO(pthatcher): Remove this file once Chrome's build files no -// longer refer to it. diff --git a/include/webrtc/p2p/base/relayport.h b/include/webrtc/p2p/base/relayport.h deleted file mode 100644 index 4b74b91..0000000 --- a/include/webrtc/p2p/base/relayport.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_RELAYPORT_H_ -#define WEBRTC_P2P_BASE_RELAYPORT_H_ - -#include -#include -#include -#include - -#include "webrtc/p2p/base/port.h" -#include "webrtc/p2p/base/stunrequest.h" - -namespace cricket { - -class RelayEntry; -class RelayConnection; - -// Communicates using an allocated port on the relay server. For each -// remote candidate that we try to send data to a RelayEntry instance -// is created. The RelayEntry will try to reach the remote destination -// by connecting to all available server addresses in a pre defined -// order with a small delay in between. When a connection is -// successful all other connection attemts are aborted. -class RelayPort : public Port { - public: - typedef std::pair OptionValue; - - // RelayPort doesn't yet do anything fancy in the ctor. - static RelayPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password) { - return new RelayPort(thread, factory, network, ip, min_port, max_port, - username, password); - } - virtual ~RelayPort(); - - void AddServerAddress(const ProtocolAddress& addr); - void AddExternalAddress(const ProtocolAddress& addr); - - const std::vector& options() const { return options_; } - bool HasMagicCookie(const char* data, size_t size); - - virtual void PrepareAddress(); - virtual Connection* CreateConnection(const Candidate& address, - CandidateOrigin origin); - virtual int SetOption(rtc::Socket::Option opt, int value); - virtual int GetOption(rtc::Socket::Option opt, int* value); - virtual int GetError(); - virtual bool SupportsProtocol(const std::string& protocol) const { - // Relay port may create both TCP and UDP connections. - return true; - } - - const ProtocolAddress * ServerAddress(size_t index) const; - bool IsReady() { return ready_; } - - // Used for testing. - sigslot::signal1 SignalConnectFailure; - sigslot::signal1 SignalSoftTimeout; - - protected: - RelayPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network*, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password); - bool Init(); - - void SetReady(); - - virtual int SendTo(const void* data, size_t size, - const rtc::SocketAddress& addr, - const rtc::PacketOptions& options, - bool payload); - - // Dispatches the given packet to the port or connection as appropriate. - void OnReadPacket(const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - ProtocolType proto, - const rtc::PacketTime& packet_time); - - private: - friend class RelayEntry; - - std::deque server_addr_; - std::vector external_addr_; - bool ready_; - std::vector entries_; - std::vector options_; - int error_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_RELAYPORT_H_ diff --git a/include/webrtc/p2p/base/relayserver.h b/include/webrtc/p2p/base/relayserver.h deleted file mode 100644 index f1109f1..0000000 --- a/include/webrtc/p2p/base/relayserver.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_RELAYSERVER_H_ -#define WEBRTC_P2P_BASE_RELAYSERVER_H_ - -#include -#include -#include - -#include "webrtc/p2p/base/port.h" -#include "webrtc/p2p/base/stun.h" -#include "webrtc/base/asyncudpsocket.h" -#include "webrtc/base/socketaddresspair.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/timeutils.h" - -namespace cricket { - -class RelayServerBinding; -class RelayServerConnection; - -// Relays traffic between connections to the server that are "bound" together. -// All connections created with the same username/password are bound together. -class RelayServer : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - // Creates a server, which will use this thread to post messages to itself. - explicit RelayServer(rtc::Thread* thread); - ~RelayServer(); - - rtc::Thread* thread() { return thread_; } - - // Indicates whether we will print updates of the number of bindings. - bool log_bindings() const { return log_bindings_; } - void set_log_bindings(bool log_bindings) { log_bindings_ = log_bindings; } - - // Updates the set of sockets that the server uses to talk to "internal" - // clients. These are clients that do the "port allocations". - void AddInternalSocket(rtc::AsyncPacketSocket* socket); - void RemoveInternalSocket(rtc::AsyncPacketSocket* socket); - - // Updates the set of sockets that the server uses to talk to "external" - // clients. These are the clients that do not do allocations. They do not - // know that these addresses represent a relay server. - void AddExternalSocket(rtc::AsyncPacketSocket* socket); - void RemoveExternalSocket(rtc::AsyncPacketSocket* socket); - - // Starts listening for connections on this sockets. When someone - // tries to connect, the connection will be accepted and a new - // internal socket will be added. - void AddInternalServerSocket(rtc::AsyncSocket* socket, - cricket::ProtocolType proto); - - // Removes this server socket from the list. - void RemoveInternalServerSocket(rtc::AsyncSocket* socket); - - // Methods for testing and debuging. - int GetConnectionCount() const; - rtc::SocketAddressPair GetConnection(int connection) const; - bool HasConnection(const rtc::SocketAddress& address) const; - - private: - typedef std::vector SocketList; - typedef std::map ServerSocketMap; - typedef std::map BindingMap; - typedef std::map ConnectionMap; - - rtc::Thread* thread_; - bool log_bindings_; - SocketList internal_sockets_; - SocketList external_sockets_; - SocketList removed_sockets_; - ServerSocketMap server_sockets_; - BindingMap bindings_; - ConnectionMap connections_; - - // Called when a packet is received by the server on one of its sockets. - void OnInternalPacket(rtc::AsyncPacketSocket* socket, - const char* bytes, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - void OnExternalPacket(rtc::AsyncPacketSocket* socket, - const char* bytes, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - - void OnReadEvent(rtc::AsyncSocket* socket); - - // Processes the relevant STUN request types from the client. - bool HandleStun(const char* bytes, size_t size, - const rtc::SocketAddress& remote_addr, - rtc::AsyncPacketSocket* socket, - std::string* username, StunMessage* msg); - void HandleStunAllocate(const char* bytes, size_t size, - const rtc::SocketAddressPair& ap, - rtc::AsyncPacketSocket* socket); - void HandleStun(RelayServerConnection* int_conn, const char* bytes, - size_t size); - void HandleStunAllocate(RelayServerConnection* int_conn, - const StunMessage& msg); - void HandleStunSend(RelayServerConnection* int_conn, const StunMessage& msg); - - // Adds/Removes the a connection or binding. - void AddConnection(RelayServerConnection* conn); - void RemoveConnection(RelayServerConnection* conn); - void RemoveBinding(RelayServerBinding* binding); - - // Handle messages in our worker thread. - void OnMessage(rtc::Message *pmsg); - - // Called when the timer for checking lifetime times out. - void OnTimeout(RelayServerBinding* binding); - - // Accept connections on this server socket. - void AcceptConnection(rtc::AsyncSocket* server_socket); - - friend class RelayServerConnection; - friend class RelayServerBinding; -}; - -// Maintains information about a connection to the server. Each connection is -// part of one and only one binding. -class RelayServerConnection { - public: - RelayServerConnection(RelayServerBinding* binding, - const rtc::SocketAddressPair& addrs, - rtc::AsyncPacketSocket* socket); - ~RelayServerConnection(); - - RelayServerBinding* binding() { return binding_; } - rtc::AsyncPacketSocket* socket() { return socket_; } - - // Returns a pair where the source is the remote address and the destination - // is the local address. - const rtc::SocketAddressPair& addr_pair() { return addr_pair_; } - - // Sends a packet to the connected client. If an address is provided, then - // we make sure the internal client receives it, wrapping if necessary. - void Send(const char* data, size_t size); - void Send(const char* data, size_t size, - const rtc::SocketAddress& ext_addr); - - // Sends a STUN message to the connected client with no wrapping. - void SendStun(const StunMessage& msg); - void SendStunError(const StunMessage& request, int code, const char* desc); - - // A locked connection is one for which we know the intended destination of - // any raw packet received. - bool locked() const { return locked_; } - void Lock(); - void Unlock(); - - // Records the address that raw packets should be forwarded to (for internal - // packets only; for external, we already know where they go). - const rtc::SocketAddress& default_destination() const { - return default_dest_; - } - void set_default_destination(const rtc::SocketAddress& addr) { - default_dest_ = addr; - } - - private: - RelayServerBinding* binding_; - rtc::SocketAddressPair addr_pair_; - rtc::AsyncPacketSocket* socket_; - bool locked_; - rtc::SocketAddress default_dest_; -}; - -// Records a set of internal and external connections that we relay between, -// or in other words, that are "bound" together. -class RelayServerBinding : public rtc::MessageHandler { - public: - RelayServerBinding(RelayServer* server, - const std::string& username, - const std::string& password, - uint32_t lifetime); - virtual ~RelayServerBinding(); - - RelayServer* server() { return server_; } - uint32_t lifetime() { return lifetime_; } - const std::string& username() { return username_; } - const std::string& password() { return password_; } - const std::string& magic_cookie() { return magic_cookie_; } - - // Adds/Removes a connection into the binding. - void AddInternalConnection(RelayServerConnection* conn); - void AddExternalConnection(RelayServerConnection* conn); - - // We keep track of the use of each binding. If we detect that it was not - // used for longer than the lifetime, then we send a signal. - void NoteUsed(); - sigslot::signal1 SignalTimeout; - - // Determines whether the given packet has the magic cookie present (in the - // right place). - bool HasMagicCookie(const char* bytes, size_t size) const; - - // Determines the connection to use to send packets to or from the given - // external address. - RelayServerConnection* GetInternalConnection( - const rtc::SocketAddress& ext_addr); - RelayServerConnection* GetExternalConnection( - const rtc::SocketAddress& ext_addr); - - // MessageHandler: - void OnMessage(rtc::Message *pmsg); - - private: - RelayServer* server_; - - std::string username_; - std::string password_; - std::string magic_cookie_; - - std::vector internal_connections_; - std::vector external_connections_; - - uint32_t lifetime_; - uint32_t last_used_; - // TODO: bandwidth -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_RELAYSERVER_H_ diff --git a/include/webrtc/p2p/base/session.h b/include/webrtc/p2p/base/session.h deleted file mode 100644 index a98a5ef..0000000 --- a/include/webrtc/p2p/base/session.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// TODO(deadbeef): Remove this file when Chrome build files no longer reference -// it. -#error "DONT INCLUDE THIS" diff --git a/include/webrtc/p2p/base/sessiondescription.h b/include/webrtc/p2p/base/sessiondescription.h deleted file mode 100644 index 7880167..0000000 --- a/include/webrtc/p2p/base/sessiondescription.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_SESSIONDESCRIPTION_H_ -#define WEBRTC_P2P_BASE_SESSIONDESCRIPTION_H_ - -#include -#include - -#include "webrtc/p2p/base/transportinfo.h" -#include "webrtc/base/constructormagic.h" - -namespace cricket { - -// Describes a session content. Individual content types inherit from -// this class. Analagous to a or -// . -class ContentDescription { - public: - virtual ~ContentDescription() {} - virtual ContentDescription* Copy() const = 0; -}; - -// Analagous to a or . -// name = name of -// type = xmlns of -struct ContentInfo { - ContentInfo() : description(NULL) {} - ContentInfo(const std::string& name, - const std::string& type, - ContentDescription* description) : - name(name), type(type), rejected(false), description(description) {} - ContentInfo(const std::string& name, - const std::string& type, - bool rejected, - ContentDescription* description) : - name(name), type(type), rejected(rejected), description(description) {} - std::string name; - std::string type; - bool rejected; - ContentDescription* description; -}; - -typedef std::vector ContentNames; - -// This class provides a mechanism to aggregate different media contents into a -// group. This group can also be shared with the peers in a pre-defined format. -// GroupInfo should be populated only with the |content_name| of the -// MediaDescription. -class ContentGroup { - public: - explicit ContentGroup(const std::string& semantics) : - semantics_(semantics) {} - - const std::string& semantics() const { return semantics_; } - const ContentNames& content_names() const { return content_names_; } - - const std::string* FirstContentName() const; - bool HasContentName(const std::string& content_name) const; - void AddContentName(const std::string& content_name); - bool RemoveContentName(const std::string& content_name); - - private: - std::string semantics_; - ContentNames content_names_; -}; - -typedef std::vector ContentInfos; -typedef std::vector ContentGroups; - -const ContentInfo* FindContentInfoByName( - const ContentInfos& contents, const std::string& name); -const ContentInfo* FindContentInfoByType( - const ContentInfos& contents, const std::string& type); - -// Describes a collection of contents, each with its own name and -// type. Analogous to a or stanza. Assumes that -// contents are unique be name, but doesn't enforce that. -class SessionDescription { - public: - SessionDescription() {} - explicit SessionDescription(const ContentInfos& contents) : - contents_(contents) {} - SessionDescription(const ContentInfos& contents, - const ContentGroups& groups) : - contents_(contents), - content_groups_(groups) {} - SessionDescription(const ContentInfos& contents, - const TransportInfos& transports, - const ContentGroups& groups) : - contents_(contents), - transport_infos_(transports), - content_groups_(groups) {} - ~SessionDescription() { - for (ContentInfos::iterator content = contents_.begin(); - content != contents_.end(); ++content) { - delete content->description; - } - } - - SessionDescription* Copy() const; - - // Content accessors. - const ContentInfos& contents() const { return contents_; } - ContentInfos& contents() { return contents_; } - const ContentInfo* GetContentByName(const std::string& name) const; - ContentInfo* GetContentByName(const std::string& name); - const ContentDescription* GetContentDescriptionByName( - const std::string& name) const; - ContentDescription* GetContentDescriptionByName(const std::string& name); - const ContentInfo* FirstContentByType(const std::string& type) const; - const ContentInfo* FirstContent() const; - - // Content mutators. - // Adds a content to this description. Takes ownership of ContentDescription*. - void AddContent(const std::string& name, - const std::string& type, - ContentDescription* description); - void AddContent(const std::string& name, - const std::string& type, - bool rejected, - ContentDescription* description); - bool RemoveContentByName(const std::string& name); - - // Transport accessors. - const TransportInfos& transport_infos() const { return transport_infos_; } - TransportInfos& transport_infos() { return transport_infos_; } - const TransportInfo* GetTransportInfoByName( - const std::string& name) const; - TransportInfo* GetTransportInfoByName(const std::string& name); - const TransportDescription* GetTransportDescriptionByName( - const std::string& name) const { - const TransportInfo* tinfo = GetTransportInfoByName(name); - return tinfo ? &tinfo->description : NULL; - } - - // Transport mutators. - void set_transport_infos(const TransportInfos& transport_infos) { - transport_infos_ = transport_infos; - } - // Adds a TransportInfo to this description. - // Returns false if a TransportInfo with the same name already exists. - bool AddTransportInfo(const TransportInfo& transport_info); - bool RemoveTransportInfoByName(const std::string& name); - - // Group accessors. - const ContentGroups& groups() const { return content_groups_; } - const ContentGroup* GetGroupByName(const std::string& name) const; - bool HasGroup(const std::string& name) const; - - // Group mutators. - void AddGroup(const ContentGroup& group) { content_groups_.push_back(group); } - // Remove the first group with the same semantics specified by |name|. - void RemoveGroupByName(const std::string& name); - - // Global attributes. - void set_msid_supported(bool supported) { msid_supported_ = supported; } - bool msid_supported() const { return msid_supported_; } - - private: - ContentInfos contents_; - TransportInfos transport_infos_; - ContentGroups content_groups_; - bool msid_supported_ = true; -}; - -// Indicates whether a ContentDescription was an offer or an answer, as -// described in http://www.ietf.org/rfc/rfc3264.txt. CA_UPDATE -// indicates a jingle update message which contains a subset of a full -// session description -enum ContentAction { - CA_OFFER, CA_PRANSWER, CA_ANSWER, CA_UPDATE -}; - -// Indicates whether a ContentDescription was sent by the local client -// or received from the remote client. -enum ContentSource { - CS_LOCAL, CS_REMOTE -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_SESSIONDESCRIPTION_H_ diff --git a/include/webrtc/p2p/base/sessionid.h b/include/webrtc/p2p/base/sessionid.h deleted file mode 100644 index f695700..0000000 --- a/include/webrtc/p2p/base/sessionid.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_SESSIONID_H_ -#define WEBRTC_P2P_BASE_SESSIONID_H_ - -// TODO: Remove this file. - -namespace cricket { - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_SESSIONID_H_ diff --git a/include/webrtc/p2p/base/stun.h b/include/webrtc/p2p/base/stun.h deleted file mode 100644 index 75b89af..0000000 --- a/include/webrtc/p2p/base/stun.h +++ /dev/null @@ -1,634 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_STUN_H_ -#define WEBRTC_P2P_BASE_STUN_H_ - -// This file contains classes for dealing with the STUN protocol, as specified -// in RFC 5389, and its descendants. - -#include -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/base/bytebuffer.h" -#include "webrtc/base/socketaddress.h" - -namespace cricket { - -// These are the types of STUN messages defined in RFC 5389. -enum StunMessageType { - STUN_BINDING_REQUEST = 0x0001, - STUN_BINDING_INDICATION = 0x0011, - STUN_BINDING_RESPONSE = 0x0101, - STUN_BINDING_ERROR_RESPONSE = 0x0111, -}; - -// These are all known STUN attributes, defined in RFC 5389 and elsewhere. -// Next to each is the name of the class (T is StunTAttribute) that implements -// that type. -// RETRANSMIT_COUNT is the number of outstanding pings without a response at -// the time the packet is generated. -enum StunAttributeType { - STUN_ATTR_MAPPED_ADDRESS = 0x0001, // Address - STUN_ATTR_USERNAME = 0x0006, // ByteString - STUN_ATTR_MESSAGE_INTEGRITY = 0x0008, // ByteString, 20 bytes - STUN_ATTR_ERROR_CODE = 0x0009, // ErrorCode - STUN_ATTR_UNKNOWN_ATTRIBUTES = 0x000a, // UInt16List - STUN_ATTR_REALM = 0x0014, // ByteString - STUN_ATTR_NONCE = 0x0015, // ByteString - STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020, // XorAddress - STUN_ATTR_SOFTWARE = 0x8022, // ByteString - STUN_ATTR_ALTERNATE_SERVER = 0x8023, // Address - STUN_ATTR_FINGERPRINT = 0x8028, // UInt32 - STUN_ATTR_ORIGIN = 0x802F, // ByteString - STUN_ATTR_RETRANSMIT_COUNT = 0xFF00 // UInt32 -}; - -// These are the types of the values associated with the attributes above. -// This allows us to perform some basic validation when reading or adding -// attributes. Note that these values are for our own use, and not defined in -// RFC 5389. -enum StunAttributeValueType { - STUN_VALUE_UNKNOWN = 0, - STUN_VALUE_ADDRESS = 1, - STUN_VALUE_XOR_ADDRESS = 2, - STUN_VALUE_UINT32 = 3, - STUN_VALUE_UINT64 = 4, - STUN_VALUE_BYTE_STRING = 5, - STUN_VALUE_ERROR_CODE = 6, - STUN_VALUE_UINT16_LIST = 7 -}; - -// These are the types of STUN addresses defined in RFC 5389. -enum StunAddressFamily { - // NB: UNDEF is not part of the STUN spec. - STUN_ADDRESS_UNDEF = 0, - STUN_ADDRESS_IPV4 = 1, - STUN_ADDRESS_IPV6 = 2 -}; - -// These are the types of STUN error codes defined in RFC 5389. -enum StunErrorCode { - STUN_ERROR_TRY_ALTERNATE = 300, - STUN_ERROR_BAD_REQUEST = 400, - STUN_ERROR_UNAUTHORIZED = 401, - STUN_ERROR_UNKNOWN_ATTRIBUTE = 420, - STUN_ERROR_STALE_CREDENTIALS = 430, // GICE only - STUN_ERROR_STALE_NONCE = 438, - STUN_ERROR_SERVER_ERROR = 500, - STUN_ERROR_GLOBAL_FAILURE = 600 -}; - -// Strings for the error codes above. -extern const char STUN_ERROR_REASON_TRY_ALTERNATE_SERVER[]; -extern const char STUN_ERROR_REASON_BAD_REQUEST[]; -extern const char STUN_ERROR_REASON_UNAUTHORIZED[]; -extern const char STUN_ERROR_REASON_UNKNOWN_ATTRIBUTE[]; -extern const char STUN_ERROR_REASON_STALE_CREDENTIALS[]; -extern const char STUN_ERROR_REASON_STALE_NONCE[]; -extern const char STUN_ERROR_REASON_SERVER_ERROR[]; - -// The mask used to determine whether a STUN message is a request/response etc. -const uint32_t kStunTypeMask = 0x0110; - -// STUN Attribute header length. -const size_t kStunAttributeHeaderSize = 4; - -// Following values correspond to RFC5389. -const size_t kStunHeaderSize = 20; -const size_t kStunTransactionIdOffset = 8; -const size_t kStunTransactionIdLength = 12; -const uint32_t kStunMagicCookie = 0x2112A442; -const size_t kStunMagicCookieLength = sizeof(kStunMagicCookie); - -// Following value corresponds to an earlier version of STUN from -// RFC3489. -const size_t kStunLegacyTransactionIdLength = 16; - -// STUN Message Integrity HMAC length. -const size_t kStunMessageIntegritySize = 20; - -class StunAttribute; -class StunAddressAttribute; -class StunXorAddressAttribute; -class StunUInt32Attribute; -class StunUInt64Attribute; -class StunByteStringAttribute; -class StunErrorCodeAttribute; -class StunUInt16ListAttribute; - -// Records a complete STUN/TURN message. Each message consists of a type and -// any number of attributes. Each attribute is parsed into an instance of an -// appropriate class (see above). The Get* methods will return instances of -// that attribute class. -class StunMessage { - public: - StunMessage(); - virtual ~StunMessage(); - - int type() const { return type_; } - size_t length() const { return length_; } - const std::string& transaction_id() const { return transaction_id_; } - - // Returns true if the message confirms to RFC3489 rather than - // RFC5389. The main difference between two version of the STUN - // protocol is the presence of the magic cookie and different length - // of transaction ID. For outgoing packets version of the protocol - // is determined by the lengths of the transaction ID. - bool IsLegacy() const; - - void SetType(int type) { type_ = static_cast(type); } - bool SetTransactionID(const std::string& str); - - // Gets the desired attribute value, or NULL if no such attribute type exists. - const StunAddressAttribute* GetAddress(int type) const; - const StunUInt32Attribute* GetUInt32(int type) const; - const StunUInt64Attribute* GetUInt64(int type) const; - const StunByteStringAttribute* GetByteString(int type) const; - - // Gets these specific attribute values. - const StunErrorCodeAttribute* GetErrorCode() const; - const StunUInt16ListAttribute* GetUnknownAttributes() const; - - // Takes ownership of the specified attribute, verifies it is of the correct - // type, and adds it to the message. The return value indicates whether this - // was successful. - bool AddAttribute(StunAttribute* attr); - - // Validates that a raw STUN message has a correct MESSAGE-INTEGRITY value. - // This can't currently be done on a StunMessage, since it is affected by - // padding data (which we discard when reading a StunMessage). - static bool ValidateMessageIntegrity(const char* data, size_t size, - const std::string& password); - // Adds a MESSAGE-INTEGRITY attribute that is valid for the current message. - bool AddMessageIntegrity(const std::string& password); - bool AddMessageIntegrity(const char* key, size_t keylen); - - // Verifies that a given buffer is STUN by checking for a correct FINGERPRINT. - static bool ValidateFingerprint(const char* data, size_t size); - - // Adds a FINGERPRINT attribute that is valid for the current message. - bool AddFingerprint(); - - // Parses the STUN packet in the given buffer and records it here. The - // return value indicates whether this was successful. - bool Read(rtc::ByteBuffer* buf); - - // Writes this object into a STUN packet. The return value indicates whether - // this was successful. - bool Write(rtc::ByteBuffer* buf) const; - - // Creates an empty message. Overridable by derived classes. - virtual StunMessage* CreateNew() const { return new StunMessage(); } - - protected: - // Verifies that the given attribute is allowed for this message. - virtual StunAttributeValueType GetAttributeValueType(int type) const; - - private: - StunAttribute* CreateAttribute(int type, size_t length) /* const*/; - const StunAttribute* GetAttribute(int type) const; - static bool IsValidTransactionId(const std::string& transaction_id); - - uint16_t type_; - uint16_t length_; - std::string transaction_id_; - std::vector* attrs_; -}; - -// Base class for all STUN/TURN attributes. -class StunAttribute { - public: - virtual ~StunAttribute() { - } - - int type() const { return type_; } - size_t length() const { return length_; } - - // Return the type of this attribute. - virtual StunAttributeValueType value_type() const = 0; - - // Only XorAddressAttribute needs this so far. - virtual void SetOwner(StunMessage* owner) {} - - // Reads the body (not the type or length) for this type of attribute from - // the given buffer. Return value is true if successful. - virtual bool Read(rtc::ByteBuffer* buf) = 0; - - // Writes the body (not the type or length) to the given buffer. Return - // value is true if successful. - virtual bool Write(rtc::ByteBuffer* buf) const = 0; - - // Creates an attribute object with the given type and smallest length. - static StunAttribute* Create(StunAttributeValueType value_type, - uint16_t type, - uint16_t length, - StunMessage* owner); - // TODO: Allow these create functions to take parameters, to reduce - // the amount of work callers need to do to initialize attributes. - static StunAddressAttribute* CreateAddress(uint16_t type); - static StunXorAddressAttribute* CreateXorAddress(uint16_t type); - static StunUInt32Attribute* CreateUInt32(uint16_t type); - static StunUInt64Attribute* CreateUInt64(uint16_t type); - static StunByteStringAttribute* CreateByteString(uint16_t type); - static StunErrorCodeAttribute* CreateErrorCode(); - static StunUInt16ListAttribute* CreateUnknownAttributes(); - - protected: - StunAttribute(uint16_t type, uint16_t length); - void SetLength(uint16_t length) { length_ = length; } - void WritePadding(rtc::ByteBuffer* buf) const; - void ConsumePadding(rtc::ByteBuffer* buf) const; - - private: - uint16_t type_; - uint16_t length_; -}; - -// Implements STUN attributes that record an Internet address. -class StunAddressAttribute : public StunAttribute { - public: - static const uint16_t SIZE_UNDEF = 0; - static const uint16_t SIZE_IP4 = 8; - static const uint16_t SIZE_IP6 = 20; - StunAddressAttribute(uint16_t type, const rtc::SocketAddress& addr); - StunAddressAttribute(uint16_t type, uint16_t length); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_ADDRESS; - } - - StunAddressFamily family() const { - switch (address_.ipaddr().family()) { - case AF_INET: - return STUN_ADDRESS_IPV4; - case AF_INET6: - return STUN_ADDRESS_IPV6; - } - return STUN_ADDRESS_UNDEF; - } - - const rtc::SocketAddress& GetAddress() const { return address_; } - const rtc::IPAddress& ipaddr() const { return address_.ipaddr(); } - uint16_t port() const { return address_.port(); } - - void SetAddress(const rtc::SocketAddress& addr) { - address_ = addr; - EnsureAddressLength(); - } - void SetIP(const rtc::IPAddress& ip) { - address_.SetIP(ip); - EnsureAddressLength(); - } - void SetPort(uint16_t port) { address_.SetPort(port); } - - virtual bool Read(rtc::ByteBuffer* buf); - virtual bool Write(rtc::ByteBuffer* buf) const; - - private: - void EnsureAddressLength() { - switch (family()) { - case STUN_ADDRESS_IPV4: { - SetLength(SIZE_IP4); - break; - } - case STUN_ADDRESS_IPV6: { - SetLength(SIZE_IP6); - break; - } - default: { - SetLength(SIZE_UNDEF); - break; - } - } - } - rtc::SocketAddress address_; -}; - -// Implements STUN attributes that record an Internet address. When encoded -// in a STUN message, the address contained in this attribute is XORed with the -// transaction ID of the message. -class StunXorAddressAttribute : public StunAddressAttribute { - public: - StunXorAddressAttribute(uint16_t type, const rtc::SocketAddress& addr); - StunXorAddressAttribute(uint16_t type, uint16_t length, StunMessage* owner); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_XOR_ADDRESS; - } - virtual void SetOwner(StunMessage* owner) { - owner_ = owner; - } - virtual bool Read(rtc::ByteBuffer* buf); - virtual bool Write(rtc::ByteBuffer* buf) const; - - private: - rtc::IPAddress GetXoredIP() const; - StunMessage* owner_; -}; - -// Implements STUN attributes that record a 32-bit integer. -class StunUInt32Attribute : public StunAttribute { - public: - static const uint16_t SIZE = 4; - StunUInt32Attribute(uint16_t type, uint32_t value); - explicit StunUInt32Attribute(uint16_t type); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_UINT32; - } - - uint32_t value() const { return bits_; } - void SetValue(uint32_t bits) { bits_ = bits; } - - bool GetBit(size_t index) const; - void SetBit(size_t index, bool value); - - virtual bool Read(rtc::ByteBuffer* buf); - virtual bool Write(rtc::ByteBuffer* buf) const; - - private: - uint32_t bits_; -}; - -class StunUInt64Attribute : public StunAttribute { - public: - static const uint16_t SIZE = 8; - StunUInt64Attribute(uint16_t type, uint64_t value); - explicit StunUInt64Attribute(uint16_t type); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_UINT64; - } - - uint64_t value() const { return bits_; } - void SetValue(uint64_t bits) { bits_ = bits; } - - virtual bool Read(rtc::ByteBuffer* buf); - virtual bool Write(rtc::ByteBuffer* buf) const; - - private: - uint64_t bits_; -}; - -// Implements STUN attributes that record an arbitrary byte string. -class StunByteStringAttribute : public StunAttribute { - public: - explicit StunByteStringAttribute(uint16_t type); - StunByteStringAttribute(uint16_t type, const std::string& str); - StunByteStringAttribute(uint16_t type, const void* bytes, size_t length); - StunByteStringAttribute(uint16_t type, uint16_t length); - ~StunByteStringAttribute(); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_BYTE_STRING; - } - - const char* bytes() const { return bytes_; } - std::string GetString() const { return std::string(bytes_, length()); } - - void CopyBytes(const char* bytes); // uses strlen - void CopyBytes(const void* bytes, size_t length); - - uint8_t GetByte(size_t index) const; - void SetByte(size_t index, uint8_t value); - - virtual bool Read(rtc::ByteBuffer* buf); - virtual bool Write(rtc::ByteBuffer* buf) const; - - private: - void SetBytes(char* bytes, size_t length); - - char* bytes_; -}; - -// Implements STUN attributes that record an error code. -class StunErrorCodeAttribute : public StunAttribute { - public: - static const uint16_t MIN_SIZE = 4; - StunErrorCodeAttribute(uint16_t type, int code, const std::string& reason); - StunErrorCodeAttribute(uint16_t type, uint16_t length); - ~StunErrorCodeAttribute(); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_ERROR_CODE; - } - - // The combined error and class, e.g. 0x400. - int code() const; - void SetCode(int code); - - // The individual error components. - int eclass() const { return class_; } - int number() const { return number_; } - const std::string& reason() const { return reason_; } - void SetClass(uint8_t eclass) { class_ = eclass; } - void SetNumber(uint8_t number) { number_ = number; } - void SetReason(const std::string& reason); - - bool Read(rtc::ByteBuffer* buf); - bool Write(rtc::ByteBuffer* buf) const; - - private: - uint8_t class_; - uint8_t number_; - std::string reason_; -}; - -// Implements STUN attributes that record a list of attribute names. -class StunUInt16ListAttribute : public StunAttribute { - public: - StunUInt16ListAttribute(uint16_t type, uint16_t length); - ~StunUInt16ListAttribute(); - - virtual StunAttributeValueType value_type() const { - return STUN_VALUE_UINT16_LIST; - } - - size_t Size() const; - uint16_t GetType(int index) const; - void SetType(int index, uint16_t value); - void AddType(uint16_t value); - - bool Read(rtc::ByteBuffer* buf); - bool Write(rtc::ByteBuffer* buf) const; - - private: - std::vector* attr_types_; -}; - -// Returns the (successful) response type for the given request type. -// Returns -1 if |request_type| is not a valid request type. -int GetStunSuccessResponseType(int request_type); - -// Returns the error response type for the given request type. -// Returns -1 if |request_type| is not a valid request type. -int GetStunErrorResponseType(int request_type); - -// Returns whether a given message is a request type. -bool IsStunRequestType(int msg_type); - -// Returns whether a given message is an indication type. -bool IsStunIndicationType(int msg_type); - -// Returns whether a given response is a success type. -bool IsStunSuccessResponseType(int msg_type); - -// Returns whether a given response is an error type. -bool IsStunErrorResponseType(int msg_type); - -// Computes the STUN long-term credential hash. -bool ComputeStunCredentialHash(const std::string& username, - const std::string& realm, const std::string& password, std::string* hash); - -// TODO: Move the TURN/ICE stuff below out to separate files. -extern const char TURN_MAGIC_COOKIE_VALUE[4]; - -// "GTURN" STUN methods. -// TODO: Rename these methods to GTURN_ to make it clear they aren't -// part of standard STUN/TURN. -enum RelayMessageType { - // For now, using the same defs from TurnMessageType below. - // STUN_ALLOCATE_REQUEST = 0x0003, - // STUN_ALLOCATE_RESPONSE = 0x0103, - // STUN_ALLOCATE_ERROR_RESPONSE = 0x0113, - STUN_SEND_REQUEST = 0x0004, - STUN_SEND_RESPONSE = 0x0104, - STUN_SEND_ERROR_RESPONSE = 0x0114, - STUN_DATA_INDICATION = 0x0115, -}; - -// "GTURN"-specific STUN attributes. -// TODO: Rename these attributes to GTURN_ to avoid conflicts. -enum RelayAttributeType { - STUN_ATTR_LIFETIME = 0x000d, // UInt32 - STUN_ATTR_MAGIC_COOKIE = 0x000f, // ByteString, 4 bytes - STUN_ATTR_BANDWIDTH = 0x0010, // UInt32 - STUN_ATTR_DESTINATION_ADDRESS = 0x0011, // Address - STUN_ATTR_SOURCE_ADDRESS2 = 0x0012, // Address - STUN_ATTR_DATA = 0x0013, // ByteString - STUN_ATTR_OPTIONS = 0x8001, // UInt32 -}; - -// A "GTURN" STUN message. -class RelayMessage : public StunMessage { - protected: - virtual StunAttributeValueType GetAttributeValueType(int type) const { - switch (type) { - case STUN_ATTR_LIFETIME: return STUN_VALUE_UINT32; - case STUN_ATTR_MAGIC_COOKIE: return STUN_VALUE_BYTE_STRING; - case STUN_ATTR_BANDWIDTH: return STUN_VALUE_UINT32; - case STUN_ATTR_DESTINATION_ADDRESS: return STUN_VALUE_ADDRESS; - case STUN_ATTR_SOURCE_ADDRESS2: return STUN_VALUE_ADDRESS; - case STUN_ATTR_DATA: return STUN_VALUE_BYTE_STRING; - case STUN_ATTR_OPTIONS: return STUN_VALUE_UINT32; - default: return StunMessage::GetAttributeValueType(type); - } - } - virtual StunMessage* CreateNew() const { return new RelayMessage(); } -}; - -// Defined in TURN RFC 5766. -enum TurnMessageType { - STUN_ALLOCATE_REQUEST = 0x0003, - STUN_ALLOCATE_RESPONSE = 0x0103, - STUN_ALLOCATE_ERROR_RESPONSE = 0x0113, - TURN_REFRESH_REQUEST = 0x0004, - TURN_REFRESH_RESPONSE = 0x0104, - TURN_REFRESH_ERROR_RESPONSE = 0x0114, - TURN_SEND_INDICATION = 0x0016, - TURN_DATA_INDICATION = 0x0017, - TURN_CREATE_PERMISSION_REQUEST = 0x0008, - TURN_CREATE_PERMISSION_RESPONSE = 0x0108, - TURN_CREATE_PERMISSION_ERROR_RESPONSE = 0x0118, - TURN_CHANNEL_BIND_REQUEST = 0x0009, - TURN_CHANNEL_BIND_RESPONSE = 0x0109, - TURN_CHANNEL_BIND_ERROR_RESPONSE = 0x0119, -}; - -enum TurnAttributeType { - STUN_ATTR_CHANNEL_NUMBER = 0x000C, // UInt32 - STUN_ATTR_TURN_LIFETIME = 0x000d, // UInt32 - STUN_ATTR_XOR_PEER_ADDRESS = 0x0012, // XorAddress - // TODO(mallinath) - Uncomment after RelayAttributes are renamed. - // STUN_ATTR_DATA = 0x0013, // ByteString - STUN_ATTR_XOR_RELAYED_ADDRESS = 0x0016, // XorAddress - STUN_ATTR_EVEN_PORT = 0x0018, // ByteString, 1 byte. - STUN_ATTR_REQUESTED_TRANSPORT = 0x0019, // UInt32 - STUN_ATTR_DONT_FRAGMENT = 0x001A, // No content, Length = 0 - STUN_ATTR_RESERVATION_TOKEN = 0x0022, // ByteString, 8 bytes. - // TODO(mallinath) - Rename STUN_ATTR_TURN_LIFETIME to STUN_ATTR_LIFETIME and - // STUN_ATTR_TURN_DATA to STUN_ATTR_DATA. Also rename RelayMessage attributes - // by appending G to attribute name. -}; - -// RFC 5766-defined errors. -enum TurnErrorType { - STUN_ERROR_FORBIDDEN = 403, - STUN_ERROR_ALLOCATION_MISMATCH = 437, - STUN_ERROR_WRONG_CREDENTIALS = 441, - STUN_ERROR_UNSUPPORTED_PROTOCOL = 442 -}; -extern const char STUN_ERROR_REASON_FORBIDDEN[]; -extern const char STUN_ERROR_REASON_ALLOCATION_MISMATCH[]; -extern const char STUN_ERROR_REASON_WRONG_CREDENTIALS[]; -extern const char STUN_ERROR_REASON_UNSUPPORTED_PROTOCOL[]; -class TurnMessage : public StunMessage { - protected: - virtual StunAttributeValueType GetAttributeValueType(int type) const { - switch (type) { - case STUN_ATTR_CHANNEL_NUMBER: return STUN_VALUE_UINT32; - case STUN_ATTR_TURN_LIFETIME: return STUN_VALUE_UINT32; - case STUN_ATTR_XOR_PEER_ADDRESS: return STUN_VALUE_XOR_ADDRESS; - case STUN_ATTR_DATA: return STUN_VALUE_BYTE_STRING; - case STUN_ATTR_XOR_RELAYED_ADDRESS: return STUN_VALUE_XOR_ADDRESS; - case STUN_ATTR_EVEN_PORT: return STUN_VALUE_BYTE_STRING; - case STUN_ATTR_REQUESTED_TRANSPORT: return STUN_VALUE_UINT32; - case STUN_ATTR_DONT_FRAGMENT: return STUN_VALUE_BYTE_STRING; - case STUN_ATTR_RESERVATION_TOKEN: return STUN_VALUE_BYTE_STRING; - default: return StunMessage::GetAttributeValueType(type); - } - } - virtual StunMessage* CreateNew() const { return new TurnMessage(); } -}; - -// RFC 5245 ICE STUN attributes. -enum IceAttributeType { - STUN_ATTR_PRIORITY = 0x0024, // UInt32 - STUN_ATTR_USE_CANDIDATE = 0x0025, // No content, Length = 0 - STUN_ATTR_ICE_CONTROLLED = 0x8029, // UInt64 - STUN_ATTR_ICE_CONTROLLING = 0x802A // UInt64 -}; - -// RFC 5245-defined errors. -enum IceErrorCode { - STUN_ERROR_ROLE_CONFLICT = 487, -}; -extern const char STUN_ERROR_REASON_ROLE_CONFLICT[]; - -// A RFC 5245 ICE STUN message. -class IceMessage : public StunMessage { - protected: - virtual StunAttributeValueType GetAttributeValueType(int type) const { - switch (type) { - case STUN_ATTR_PRIORITY: return STUN_VALUE_UINT32; - case STUN_ATTR_USE_CANDIDATE: return STUN_VALUE_BYTE_STRING; - case STUN_ATTR_ICE_CONTROLLED: return STUN_VALUE_UINT64; - case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; - default: return StunMessage::GetAttributeValueType(type); - } - } - virtual StunMessage* CreateNew() const { return new IceMessage(); } -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_STUN_H_ diff --git a/include/webrtc/p2p/base/stunport.h b/include/webrtc/p2p/base/stunport.h deleted file mode 100644 index ecf61a7..0000000 --- a/include/webrtc/p2p/base/stunport.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_STUNPORT_H_ -#define WEBRTC_P2P_BASE_STUNPORT_H_ - -#include - -#include "webrtc/p2p/base/port.h" -#include "webrtc/p2p/base/stunrequest.h" -#include "webrtc/base/asyncpacketsocket.h" - -// TODO(mallinath) - Rename stunport.cc|h to udpport.cc|h. -namespace rtc { -class AsyncResolver; -class SignalThread; -} - -namespace cricket { - -// Communicates using the address on the outside of a NAT. -class UDPPort : public Port { - public: - static UDPPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - rtc::AsyncPacketSocket* socket, - const std::string& username, - const std::string& password, - const std::string& origin, - bool emit_local_for_anyaddress) { - UDPPort* port = new UDPPort(thread, factory, network, socket, username, - password, origin, emit_local_for_anyaddress); - if (!port->Init()) { - delete port; - port = NULL; - } - return port; - } - - static UDPPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const std::string& origin, - bool emit_local_for_anyaddress) { - UDPPort* port = - new UDPPort(thread, factory, network, ip, min_port, max_port, username, - password, origin, emit_local_for_anyaddress); - if (!port->Init()) { - delete port; - port = NULL; - } - return port; - } - - virtual ~UDPPort(); - - rtc::SocketAddress GetLocalAddress() const { - return socket_->GetLocalAddress(); - } - - const ServerAddresses& server_addresses() const { - return server_addresses_; - } - void - set_server_addresses(const ServerAddresses& addresses) { - server_addresses_ = addresses; - } - - virtual void PrepareAddress(); - - virtual Connection* CreateConnection(const Candidate& address, - CandidateOrigin origin); - virtual int SetOption(rtc::Socket::Option opt, int value); - virtual int GetOption(rtc::Socket::Option opt, int* value); - virtual int GetError(); - - virtual bool HandleIncomingPacket( - rtc::AsyncPacketSocket* socket, const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time) { - // All packets given to UDP port will be consumed. - OnReadPacket(socket, data, size, remote_addr, packet_time); - return true; - } - virtual bool SupportsProtocol(const std::string& protocol) const { - return protocol == UDP_PROTOCOL_NAME; - } - - void set_stun_keepalive_delay(int delay) { - stun_keepalive_delay_ = delay; - } - int stun_keepalive_delay() const { - return stun_keepalive_delay_; - } - - protected: - UDPPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const std::string& origin, - bool emit_local_for_anyaddress); - - UDPPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - rtc::AsyncPacketSocket* socket, - const std::string& username, - const std::string& password, - const std::string& origin, - bool emit_local_for_anyaddress); - - bool Init(); - - virtual int SendTo(const void* data, size_t size, - const rtc::SocketAddress& addr, - const rtc::PacketOptions& options, - bool payload); - - void OnLocalAddressReady(rtc::AsyncPacketSocket* socket, - const rtc::SocketAddress& address); - void OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - - void OnSentPacket(rtc::AsyncPacketSocket* socket, - const rtc::SentPacket& sent_packet); - - void OnReadyToSend(rtc::AsyncPacketSocket* socket); - - // This method will send STUN binding request if STUN server address is set. - void MaybePrepareStunCandidate(); - - void SendStunBindingRequests(); - - // Helper function which will set |addr|'s IP to the default local address if - // |addr| is the "any" address and |emit_local_for_anyaddress_| is true. When - // returning false, it indicates that the operation has failed and the - // address shouldn't be used by any candidate. - bool MaybeSetDefaultLocalAddress(rtc::SocketAddress* addr) const; - - private: - // A helper class which can be called repeatedly to resolve multiple - // addresses, as opposed to rtc::AsyncResolverInterface, which can only - // resolve one address per instance. - class AddressResolver : public sigslot::has_slots<> { - public: - explicit AddressResolver(rtc::PacketSocketFactory* factory); - ~AddressResolver(); - - void Resolve(const rtc::SocketAddress& address); - bool GetResolvedAddress(const rtc::SocketAddress& input, - int family, - rtc::SocketAddress* output) const; - - // The signal is sent when resolving the specified address is finished. The - // first argument is the input address, the second argument is the error - // or 0 if it succeeded. - sigslot::signal2 SignalDone; - - private: - typedef std::map ResolverMap; - - void OnResolveResult(rtc::AsyncResolverInterface* resolver); - - rtc::PacketSocketFactory* socket_factory_; - ResolverMap resolvers_; - }; - - // DNS resolution of the STUN server. - void ResolveStunAddress(const rtc::SocketAddress& stun_addr); - void OnResolveResult(const rtc::SocketAddress& input, int error); - - void SendStunBindingRequest(const rtc::SocketAddress& stun_addr); - - // Below methods handles binding request responses. - void OnStunBindingRequestSucceeded( - const rtc::SocketAddress& stun_server_addr, - const rtc::SocketAddress& stun_reflected_addr); - void OnStunBindingOrResolveRequestFailed( - const rtc::SocketAddress& stun_server_addr); - - // Sends STUN requests to the server. - void OnSendPacket(const void* data, size_t size, StunRequest* req); - - // TODO(mallinaht) - Move this up to cricket::Port when SignalAddressReady is - // changed to SignalPortReady. - void MaybeSetPortCompleteOrError(); - - bool HasCandidateWithAddress(const rtc::SocketAddress& addr) const; - - ServerAddresses server_addresses_; - ServerAddresses bind_request_succeeded_servers_; - ServerAddresses bind_request_failed_servers_; - StunRequestManager requests_; - rtc::AsyncPacketSocket* socket_; - int error_; - rtc::scoped_ptr resolver_; - bool ready_; - int stun_keepalive_delay_; - - // This is true by default and false when - // PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE is specified. - bool emit_local_for_anyaddress_; - - friend class StunBindingRequest; -}; - -class StunPort : public UDPPort { - public: - static StunPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const ServerAddresses& servers, - const std::string& origin) { - StunPort* port = new StunPort(thread, factory, network, - ip, min_port, max_port, - username, password, servers, - origin); - if (!port->Init()) { - delete port; - port = NULL; - } - return port; - } - - virtual ~StunPort() {} - - virtual void PrepareAddress() { - SendStunBindingRequests(); - } - - protected: - StunPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const ServerAddresses& servers, - const std::string& origin) - : UDPPort(thread, - factory, - network, - ip, - min_port, - max_port, - username, - password, - origin, - false) { - // UDPPort will set these to local udp, updating these to STUN. - set_type(STUN_PORT_TYPE); - set_server_addresses(servers); - } -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_STUNPORT_H_ diff --git a/include/webrtc/p2p/base/stunrequest.h b/include/webrtc/p2p/base/stunrequest.h deleted file mode 100644 index 15ea0c7..0000000 --- a/include/webrtc/p2p/base/stunrequest.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_STUNREQUEST_H_ -#define WEBRTC_P2P_BASE_STUNREQUEST_H_ - -#include -#include -#include "webrtc/p2p/base/stun.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -class StunRequest; - -// Manages a set of STUN requests, sending and resending until we receive a -// response or determine that the request has timed out. -class StunRequestManager { - public: - StunRequestManager(rtc::Thread* thread); - ~StunRequestManager(); - - // Starts sending the given request (perhaps after a delay). - void Send(StunRequest* request); - void SendDelayed(StunRequest* request, int delay); - - // Sends all pending requests right away. Only for testing. - void Flush(); - - // Removes a stun request that was added previously. This will happen - // automatically when a request succeeds, fails, or times out. - void Remove(StunRequest* request); - - // Removes all stun requests that were added previously. - void Clear(); - - // Determines whether the given message is a response to one of the - // outstanding requests, and if so, processes it appropriately. - bool CheckResponse(StunMessage* msg); - bool CheckResponse(const char* data, size_t size); - - bool empty() { return requests_.empty(); } - - // Set the Origin header for outgoing stun messages. - void set_origin(const std::string& origin) { origin_ = origin; } - - // Raised when there are bytes to be sent. - sigslot::signal3 SignalSendPacket; - - private: - typedef std::map RequestMap; - - rtc::Thread* thread_; - RequestMap requests_; - std::string origin_; - - friend class StunRequest; -}; - -// Represents an individual request to be sent. The STUN message can either be -// constructed beforehand or built on demand. -class StunRequest : public rtc::MessageHandler { - public: - StunRequest(); - StunRequest(StunMessage* request); - virtual ~StunRequest(); - - // Causes our wrapped StunMessage to be Prepared - void Construct(); - - // The manager handling this request (if it has been scheduled for sending). - StunRequestManager* manager() { return manager_; } - - // Returns the transaction ID of this request. - const std::string& id() { return msg_->transaction_id(); } - - // the origin value - const std::string& origin() const { return origin_; } - void set_origin(const std::string& origin) { origin_ = origin; } - - // Returns the STUN type of the request message. - int type(); - - // Returns a const pointer to |msg_|. - const StunMessage* msg() const; - - // Time elapsed since last send (in ms) - uint32_t Elapsed() const; - - protected: - int count_; - bool timeout_; - std::string origin_; - - // Fills in a request object to be sent. Note that request's transaction ID - // will already be set and cannot be changed. - virtual void Prepare(StunMessage* request) {} - - // Called when the message receives a response or times out. - virtual void OnResponse(StunMessage* response) {} - virtual void OnErrorResponse(StunMessage* response) {} - virtual void OnTimeout() {} - // Called when the message is sent. - virtual void OnSent(); - // Returns the next delay for resends. - virtual int resend_delay(); - - private: - void set_manager(StunRequestManager* manager); - - // Handles messages for sending and timeout. - void OnMessage(rtc::Message* pmsg); - - StunRequestManager* manager_; - StunMessage* msg_; - uint32_t tstamp_; - - friend class StunRequestManager; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_STUNREQUEST_H_ diff --git a/include/webrtc/p2p/base/stunserver.h b/include/webrtc/p2p/base/stunserver.h deleted file mode 100644 index a7eeab1..0000000 --- a/include/webrtc/p2p/base/stunserver.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_STUNSERVER_H_ -#define WEBRTC_P2P_BASE_STUNSERVER_H_ - -#include "webrtc/p2p/base/stun.h" -#include "webrtc/base/asyncudpsocket.h" -#include "webrtc/base/scoped_ptr.h" - -namespace cricket { - -const int STUN_SERVER_PORT = 3478; - -class StunServer : public sigslot::has_slots<> { - public: - // Creates a STUN server, which will listen on the given socket. - explicit StunServer(rtc::AsyncUDPSocket* socket); - // Removes the STUN server from the socket and deletes the socket. - ~StunServer(); - - protected: - // Slot for AsyncSocket.PacketRead: - void OnPacket( - rtc::AsyncPacketSocket* socket, const char* buf, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - - // Handlers for the different types of STUN/TURN requests: - virtual void OnBindingRequest(StunMessage* msg, - const rtc::SocketAddress& addr); - void OnAllocateRequest(StunMessage* msg, - const rtc::SocketAddress& addr); - void OnSharedSecretRequest(StunMessage* msg, - const rtc::SocketAddress& addr); - void OnSendRequest(StunMessage* msg, - const rtc::SocketAddress& addr); - - // Sends an error response to the given message back to the user. - void SendErrorResponse( - const StunMessage& msg, const rtc::SocketAddress& addr, - int error_code, const char* error_desc); - - // Sends the given message to the appropriate destination. - void SendResponse(const StunMessage& msg, - const rtc::SocketAddress& addr); - - // A helper method to compose a STUN binding response. - void GetStunBindReqponse(StunMessage* request, - const rtc::SocketAddress& remote_addr, - StunMessage* response) const; - - private: - rtc::scoped_ptr socket_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_STUNSERVER_H_ diff --git a/include/webrtc/p2p/base/tcpport.h b/include/webrtc/p2p/base/tcpport.h deleted file mode 100644 index 568dc65..0000000 --- a/include/webrtc/p2p/base/tcpport.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TCPPORT_H_ -#define WEBRTC_P2P_BASE_TCPPORT_H_ - -#include -#include -#include "webrtc/p2p/base/port.h" -#include "webrtc/base/asyncpacketsocket.h" - -namespace cricket { - -class TCPConnection; - -// Communicates using a local TCP port. -// -// This class is designed to allow subclasses to take advantage of the -// connection management provided by this class. A subclass should take of all -// packet sending and preparation, but when a packet is received, it should -// call this TCPPort::OnReadPacket (3 arg) to dispatch to a connection. -class TCPPort : public Port { - public: - static TCPPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - bool allow_listen) { - TCPPort* port = new TCPPort(thread, factory, network, ip, min_port, - max_port, username, password, allow_listen); - if (!port->Init()) { - delete port; - port = NULL; - } - return port; - } - virtual ~TCPPort(); - - virtual Connection* CreateConnection(const Candidate& address, - CandidateOrigin origin); - - virtual void PrepareAddress(); - - virtual int GetOption(rtc::Socket::Option opt, int* value); - virtual int SetOption(rtc::Socket::Option opt, int value); - virtual int GetError(); - virtual bool SupportsProtocol(const std::string& protocol) const { - return protocol == TCP_PROTOCOL_NAME || protocol == SSLTCP_PROTOCOL_NAME; - } - - protected: - TCPPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - bool allow_listen); - bool Init(); - - // Handles sending using the local TCP socket. - virtual int SendTo(const void* data, size_t size, - const rtc::SocketAddress& addr, - const rtc::PacketOptions& options, - bool payload); - - // Accepts incoming TCP connection. - void OnNewConnection(rtc::AsyncPacketSocket* socket, - rtc::AsyncPacketSocket* new_socket); - - private: - struct Incoming { - rtc::SocketAddress addr; - rtc::AsyncPacketSocket* socket; - }; - - rtc::AsyncPacketSocket* GetIncoming( - const rtc::SocketAddress& addr, bool remove = false); - - // Receives packet signal from the local TCP Socket. - void OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - - void OnReadyToSend(rtc::AsyncPacketSocket* socket); - - void OnAddressReady(rtc::AsyncPacketSocket* socket, - const rtc::SocketAddress& address); - - // TODO: Is this still needed? - bool incoming_only_; - bool allow_listen_; - rtc::AsyncPacketSocket* socket_; - int error_; - std::list incoming_; - - friend class TCPConnection; -}; - -class TCPConnection : public Connection { - public: - // Connection is outgoing unless socket is specified - TCPConnection(TCPPort* port, const Candidate& candidate, - rtc::AsyncPacketSocket* socket = 0); - virtual ~TCPConnection(); - - virtual int Send(const void* data, size_t size, - const rtc::PacketOptions& options); - virtual int GetError(); - - rtc::AsyncPacketSocket* socket() { return socket_.get(); } - - void OnMessage(rtc::Message* pmsg); - - // Allow test cases to overwrite the default timeout period. - int reconnection_timeout() const { return reconnection_timeout_; } - void set_reconnection_timeout(int timeout_in_ms) { - reconnection_timeout_ = timeout_in_ms; - } - - protected: - enum { - MSG_TCPCONNECTION_DELAYED_ONCLOSE = Connection::MSG_FIRST_AVAILABLE, - }; - - // Set waiting_for_stun_binding_complete_ to false to allow data packets in - // addition to what Port::OnConnectionRequestResponse does. - virtual void OnConnectionRequestResponse(ConnectionRequest* req, - StunMessage* response); - - private: - // Helper function to handle the case when Ping or Send fails with error - // related to socket close. - void MaybeReconnect(); - - void CreateOutgoingTcpSocket(); - - void ConnectSocketSignals(rtc::AsyncPacketSocket* socket); - - void OnConnect(rtc::AsyncPacketSocket* socket); - void OnClose(rtc::AsyncPacketSocket* socket, int error); - void OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - void OnReadyToSend(rtc::AsyncPacketSocket* socket); - - rtc::scoped_ptr socket_; - int error_; - bool outgoing_; - - // Guard against multiple outgoing tcp connection during a reconnect. - bool connection_pending_; - - // Guard against data packets sent when we reconnect a TCP connection. During - // reconnecting, when a new tcp connection has being made, we can't send data - // packets out until the STUN binding is completed (i.e. the write state is - // set to WRITABLE again by Connection::OnConnectionRequestResponse). IPC - // socket, when receiving data packets before that, will trigger OnError which - // will terminate the newly created connection. - bool pretending_to_be_writable_; - - // Allow test case to overwrite the default timeout period. - int reconnection_timeout_; - - friend class TCPPort; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TCPPORT_H_ diff --git a/include/webrtc/p2p/base/testrelayserver.h b/include/webrtc/p2p/base/testrelayserver.h deleted file mode 100644 index 87cb9e5..0000000 --- a/include/webrtc/p2p/base/testrelayserver.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TESTRELAYSERVER_H_ -#define WEBRTC_P2P_BASE_TESTRELAYSERVER_H_ - -#include "webrtc/p2p/base/relayserver.h" -#include "webrtc/base/asynctcpsocket.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketadapters.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -// A test relay server. Useful for unit tests. -class TestRelayServer : public sigslot::has_slots<> { - public: - TestRelayServer(rtc::Thread* thread, - const rtc::SocketAddress& udp_int_addr, - const rtc::SocketAddress& udp_ext_addr, - const rtc::SocketAddress& tcp_int_addr, - const rtc::SocketAddress& tcp_ext_addr, - const rtc::SocketAddress& ssl_int_addr, - const rtc::SocketAddress& ssl_ext_addr) - : server_(thread) { - server_.AddInternalSocket(rtc::AsyncUDPSocket::Create( - thread->socketserver(), udp_int_addr)); - server_.AddExternalSocket(rtc::AsyncUDPSocket::Create( - thread->socketserver(), udp_ext_addr)); - - tcp_int_socket_.reset(CreateListenSocket(thread, tcp_int_addr)); - tcp_ext_socket_.reset(CreateListenSocket(thread, tcp_ext_addr)); - ssl_int_socket_.reset(CreateListenSocket(thread, ssl_int_addr)); - ssl_ext_socket_.reset(CreateListenSocket(thread, ssl_ext_addr)); - } - int GetConnectionCount() const { - return server_.GetConnectionCount(); - } - rtc::SocketAddressPair GetConnection(int connection) const { - return server_.GetConnection(connection); - } - bool HasConnection(const rtc::SocketAddress& address) const { - return server_.HasConnection(address); - } - - private: - rtc::AsyncSocket* CreateListenSocket(rtc::Thread* thread, - const rtc::SocketAddress& addr) { - rtc::AsyncSocket* socket = - thread->socketserver()->CreateAsyncSocket(addr.family(), SOCK_STREAM); - socket->Bind(addr); - socket->Listen(5); - socket->SignalReadEvent.connect(this, &TestRelayServer::OnAccept); - return socket; - } - void OnAccept(rtc::AsyncSocket* socket) { - bool external = (socket == tcp_ext_socket_.get() || - socket == ssl_ext_socket_.get()); - bool ssl = (socket == ssl_int_socket_.get() || - socket == ssl_ext_socket_.get()); - rtc::AsyncSocket* raw_socket = socket->Accept(NULL); - if (raw_socket) { - rtc::AsyncTCPSocket* packet_socket = new rtc::AsyncTCPSocket( - (!ssl) ? raw_socket : - new rtc::AsyncSSLServerSocket(raw_socket), false); - if (!external) { - packet_socket->SignalClose.connect(this, - &TestRelayServer::OnInternalClose); - server_.AddInternalSocket(packet_socket); - } else { - packet_socket->SignalClose.connect(this, - &TestRelayServer::OnExternalClose); - server_.AddExternalSocket(packet_socket); - } - } - } - void OnInternalClose(rtc::AsyncPacketSocket* socket, int error) { - server_.RemoveInternalSocket(socket); - } - void OnExternalClose(rtc::AsyncPacketSocket* socket, int error) { - server_.RemoveExternalSocket(socket); - } - private: - cricket::RelayServer server_; - rtc::scoped_ptr tcp_int_socket_; - rtc::scoped_ptr tcp_ext_socket_; - rtc::scoped_ptr ssl_int_socket_; - rtc::scoped_ptr ssl_ext_socket_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TESTRELAYSERVER_H_ diff --git a/include/webrtc/p2p/base/teststunserver.h b/include/webrtc/p2p/base/teststunserver.h deleted file mode 100644 index 1911a0b..0000000 --- a/include/webrtc/p2p/base/teststunserver.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TESTSTUNSERVER_H_ -#define WEBRTC_P2P_BASE_TESTSTUNSERVER_H_ - -#include "webrtc/p2p/base/stunserver.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -// A test STUN server. Useful for unit tests. -class TestStunServer : StunServer { - public: - static TestStunServer* Create(rtc::Thread* thread, - const rtc::SocketAddress& addr) { - rtc::AsyncSocket* socket = - thread->socketserver()->CreateAsyncSocket(addr.family(), SOCK_DGRAM); - rtc::AsyncUDPSocket* udp_socket = - rtc::AsyncUDPSocket::Create(socket, addr); - - return new TestStunServer(udp_socket); - } - - // Set a fake STUN address to return to the client. - void set_fake_stun_addr(const rtc::SocketAddress& addr) { - fake_stun_addr_ = addr; - } - - private: - explicit TestStunServer(rtc::AsyncUDPSocket* socket) : StunServer(socket) {} - - void OnBindingRequest(StunMessage* msg, - const rtc::SocketAddress& remote_addr) override { - if (fake_stun_addr_.IsNil()) { - StunServer::OnBindingRequest(msg, remote_addr); - } else { - StunMessage response; - GetStunBindReqponse(msg, fake_stun_addr_, &response); - SendResponse(response, remote_addr); - } - } - - private: - rtc::SocketAddress fake_stun_addr_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TESTSTUNSERVER_H_ diff --git a/include/webrtc/p2p/base/testturnserver.h b/include/webrtc/p2p/base/testturnserver.h deleted file mode 100644 index 7be35e5..0000000 --- a/include/webrtc/p2p/base/testturnserver.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TESTTURNSERVER_H_ -#define WEBRTC_P2P_BASE_TESTTURNSERVER_H_ - -#include -#include - -#include "webrtc/p2p/base/basicpacketsocketfactory.h" -#include "webrtc/p2p/base/stun.h" -#include "webrtc/p2p/base/turnserver.h" -#include "webrtc/base/asyncudpsocket.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -static const char kTestRealm[] = "example.org"; -static const char kTestSoftware[] = "TestTurnServer"; - -class TestTurnRedirector : public TurnRedirectInterface { - public: - explicit TestTurnRedirector(const std::vector& addresses) - : alternate_server_addresses_(addresses), - iter_(alternate_server_addresses_.begin()) { - } - - virtual bool ShouldRedirect(const rtc::SocketAddress&, - rtc::SocketAddress* out) { - if (!out || iter_ == alternate_server_addresses_.end()) { - return false; - } - *out = *iter_++; - return true; - } - - private: - const std::vector& alternate_server_addresses_; - std::vector::const_iterator iter_; -}; - -class TestTurnServer : public TurnAuthInterface { - public: - TestTurnServer(rtc::Thread* thread, - const rtc::SocketAddress& udp_int_addr, - const rtc::SocketAddress& udp_ext_addr) - : server_(thread) { - AddInternalSocket(udp_int_addr, cricket::PROTO_UDP); - server_.SetExternalSocketFactory(new rtc::BasicPacketSocketFactory(), - udp_ext_addr); - server_.set_realm(kTestRealm); - server_.set_software(kTestSoftware); - server_.set_auth_hook(this); - } - - void set_enable_otu_nonce(bool enable) { - server_.set_enable_otu_nonce(enable); - } - - TurnServer* server() { return &server_; } - - void set_redirect_hook(TurnRedirectInterface* redirect_hook) { - server_.set_redirect_hook(redirect_hook); - } - - void AddInternalSocket(const rtc::SocketAddress& int_addr, - ProtocolType proto) { - rtc::Thread* thread = rtc::Thread::Current(); - if (proto == cricket::PROTO_UDP) { - server_.AddInternalSocket(rtc::AsyncUDPSocket::Create( - thread->socketserver(), int_addr), proto); - } else if (proto == cricket::PROTO_TCP) { - // For TCP we need to create a server socket which can listen for incoming - // new connections. - rtc::AsyncSocket* socket = - thread->socketserver()->CreateAsyncSocket(SOCK_STREAM); - socket->Bind(int_addr); - socket->Listen(5); - server_.AddInternalServerSocket(socket, proto); - } - } - - // Finds the first allocation in the server allocation map with a source - // ip and port matching the socket address provided. - TurnServerAllocation* FindAllocation(const rtc::SocketAddress& src) { - const TurnServer::AllocationMap& map = server_.allocations(); - for (TurnServer::AllocationMap::const_iterator it = map.begin(); - it != map.end(); ++it) { - if (src == it->first.src()) { - return it->second; - } - } - return NULL; - } - - private: - // For this test server, succeed if the password is the same as the username. - // Obviously, do not use this in a production environment. - virtual bool GetKey(const std::string& username, const std::string& realm, - std::string* key) { - return ComputeStunCredentialHash(username, realm, username, key); - } - - TurnServer server_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_ diff --git a/include/webrtc/p2p/base/transport.h b/include/webrtc/p2p/base/transport.h deleted file mode 100644 index 6b4b37d..0000000 --- a/include/webrtc/p2p/base/transport.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// A Transport manages a set of named channels of the same type. -// -// Subclasses choose the appropriate class to instantiate for each channel; -// however, this base class keeps track of the channels by name, watches their -// state changes (in order to update the manager's state), and forwards -// requests to begin connecting or to reset to each of the channels. -// -// On Threading: Transport performs work solely on the worker thread, and so -// its methods should only be called on the worker thread. -// -// Note: Subclasses must call DestroyChannels() in their own destructors. -// It is not possible to do so here because the subclass destructor will -// already have run. - -#ifndef WEBRTC_P2P_BASE_TRANSPORT_H_ -#define WEBRTC_P2P_BASE_TRANSPORT_H_ - -#include -#include -#include -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/constants.h" -#include "webrtc/p2p/base/sessiondescription.h" -#include "webrtc/p2p/base/transportinfo.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/rtccertificate.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/sslstreamadapter.h" - -namespace cricket { - -class PortAllocator; -class TransportChannel; -class TransportChannelImpl; - -typedef std::vector Candidates; - -// TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState -// once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming -// style. -enum IceConnectionState { - kIceConnectionConnecting = 0, - kIceConnectionFailed, - kIceConnectionConnected, // Writable, but still checking one or more - // connections - kIceConnectionCompleted, -}; - -enum DtlsTransportState { - // Haven't started negotiating. - DTLS_TRANSPORT_NEW = 0, - // Have started negotiating. - DTLS_TRANSPORT_CONNECTING, - // Negotiated, and has a secure connection. - DTLS_TRANSPORT_CONNECTED, - // Transport is closed. - DTLS_TRANSPORT_CLOSED, - // Failed due to some error in the handshake process. - DTLS_TRANSPORT_FAILED, -}; - -// TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState -// once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming -// style. -enum IceGatheringState { - kIceGatheringNew = 0, - kIceGatheringGathering, - kIceGatheringComplete, -}; - -// Stats that we can return about the connections for a transport channel. -// TODO(hta): Rename to ConnectionStats -struct ConnectionInfo { - ConnectionInfo() - : best_connection(false), - writable(false), - receiving(false), - timeout(false), - new_connection(false), - rtt(0), - sent_total_bytes(0), - sent_bytes_second(0), - sent_discarded_packets(0), - sent_total_packets(0), - recv_total_bytes(0), - recv_bytes_second(0), - key(NULL) {} - - bool best_connection; // Is this the best connection we have? - bool writable; // Has this connection received a STUN response? - bool receiving; // Has this connection received anything? - bool timeout; // Has this connection timed out? - bool new_connection; // Is this a newly created connection? - size_t rtt; // The STUN RTT for this connection. - size_t sent_total_bytes; // Total bytes sent on this connection. - size_t sent_bytes_second; // Bps over the last measurement interval. - size_t sent_discarded_packets; // Number of outgoing packets discarded due to - // socket errors. - size_t sent_total_packets; // Number of total outgoing packets attempted for - // sending. - - size_t recv_total_bytes; // Total bytes received on this connection. - size_t recv_bytes_second; // Bps over the last measurement interval. - Candidate local_candidate; // The local candidate for this connection. - Candidate remote_candidate; // The remote candidate for this connection. - void* key; // A static value that identifies this conn. -}; - -// Information about all the connections of a channel. -typedef std::vector ConnectionInfos; - -// Information about a specific channel -struct TransportChannelStats { - int component = 0; - ConnectionInfos connection_infos; - int srtp_crypto_suite = rtc::SRTP_INVALID_CRYPTO_SUITE; - int ssl_cipher_suite = rtc::TLS_NULL_WITH_NULL_NULL; -}; - -// Information about all the channels of a transport. -// TODO(hta): Consider if a simple vector is as good as a map. -typedef std::vector TransportChannelStatsList; - -// Information about the stats of a transport. -struct TransportStats { - std::string transport_name; - TransportChannelStatsList channel_stats; -}; - -// Information about ICE configuration. -struct IceConfig { - // The ICE connection receiving timeout value. - // TODO(honghaiz): Remove suffix _ms to be consistent. - int receiving_timeout_ms = -1; - // Time interval in milliseconds to ping a backup connection when the ICE - // channel is strongly connected. - int backup_connection_ping_interval = -1; - // If true, the most recent port allocator session will keep on running. - bool gather_continually = false; -}; - -bool BadTransportDescription(const std::string& desc, std::string* err_desc); - -bool IceCredentialsChanged(const std::string& old_ufrag, - const std::string& old_pwd, - const std::string& new_ufrag, - const std::string& new_pwd); - -class Transport : public sigslot::has_slots<> { - public: - Transport(const std::string& name, PortAllocator* allocator); - virtual ~Transport(); - - // Returns the name of this transport. - const std::string& name() const { return name_; } - - // Returns the port allocator object for this transport. - PortAllocator* port_allocator() { return allocator_; } - - bool ready_for_remote_candidates() const { - return local_description_set_ && remote_description_set_; - } - - // Returns whether the client has requested the channels to connect. - bool connect_requested() const { return connect_requested_; } - - void SetIceRole(IceRole role); - IceRole ice_role() const { return ice_role_; } - - void SetIceTiebreaker(uint64_t IceTiebreaker) { tiebreaker_ = IceTiebreaker; } - uint64_t IceTiebreaker() { return tiebreaker_; } - - void SetIceConfig(const IceConfig& config); - - // Must be called before applying local session description. - virtual void SetLocalCertificate( - const rtc::scoped_refptr& certificate) {} - - // Get a copy of the local certificate provided by SetLocalCertificate. - virtual bool GetLocalCertificate( - rtc::scoped_refptr* certificate) { - return false; - } - - // Get a copy of the remote certificate in use by the specified channel. - bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert); - - // Create, destroy, and lookup the channels of this type by their components. - TransportChannelImpl* CreateChannel(int component); - - TransportChannelImpl* GetChannel(int component); - - bool HasChannel(int component) { - return (NULL != GetChannel(component)); - } - bool HasChannels(); - - void DestroyChannel(int component); - - // Set the local TransportDescription to be used by TransportChannels. - bool SetLocalTransportDescription(const TransportDescription& description, - ContentAction action, - std::string* error_desc); - - // Set the remote TransportDescription to be used by TransportChannels. - bool SetRemoteTransportDescription(const TransportDescription& description, - ContentAction action, - std::string* error_desc); - - // Tells all current and future channels to start connecting. - void ConnectChannels(); - - // Tells channels to start gathering candidates if necessary. - // Should be called after ConnectChannels() has been called at least once, - // which will happen in SetLocalTransportDescription. - void MaybeStartGathering(); - - // Resets all of the channels back to their initial state. They are no - // longer connecting. - void ResetChannels(); - - // Destroys every channel created so far. - void DestroyAllChannels(); - - bool GetStats(TransportStats* stats); - - // Called when one or more candidates are ready from the remote peer. - bool AddRemoteCandidates(const std::vector& candidates, - std::string* error); - - // If candidate is not acceptable, returns false and sets error. - // Call this before calling OnRemoteCandidates. - virtual bool VerifyCandidate(const Candidate& candidate, - std::string* error); - - virtual bool GetSslRole(rtc::SSLRole* ssl_role) const { return false; } - - // Must be called before channel is starting to connect. - virtual bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) { - return false; - } - - protected: - // These are called by Create/DestroyChannel above in order to create or - // destroy the appropriate type of channel. - virtual TransportChannelImpl* CreateTransportChannel(int component) = 0; - virtual void DestroyTransportChannel(TransportChannelImpl* channel) = 0; - - // The current local transport description, for use by derived classes - // when performing transport description negotiation. - const TransportDescription* local_description() const { - return local_description_.get(); - } - - // The current remote transport description, for use by derived classes - // when performing transport description negotiation. - const TransportDescription* remote_description() const { - return remote_description_.get(); - } - - // Pushes down the transport parameters from the local description, such - // as the ICE ufrag and pwd. - // Derived classes can override, but must call the base as well. - virtual bool ApplyLocalTransportDescription(TransportChannelImpl* channel, - std::string* error_desc); - - // Pushes down remote ice credentials from the remote description to the - // transport channel. - virtual bool ApplyRemoteTransportDescription(TransportChannelImpl* ch, - std::string* error_desc); - - // Negotiates the transport parameters based on the current local and remote - // transport description, such as the ICE role to use, and whether DTLS - // should be activated. - // Derived classes can negotiate their specific parameters here, but must call - // the base as well. - virtual bool NegotiateTransportDescription(ContentAction local_role, - std::string* error_desc); - - // Pushes down the transport parameters obtained via negotiation. - // Derived classes can set their specific parameters here, but must call the - // base as well. - virtual bool ApplyNegotiatedTransportDescription( - TransportChannelImpl* channel, - std::string* error_desc); - - private: - // Candidate component => TransportChannelImpl* - typedef std::map ChannelMap; - - // Helper function that invokes the given function on every channel. - typedef void (TransportChannelImpl::* TransportChannelFunc)(); - void CallChannels(TransportChannelFunc func); - - const std::string name_; - PortAllocator* const allocator_; - bool channels_destroyed_ = false; - bool connect_requested_ = false; - IceRole ice_role_ = ICEROLE_UNKNOWN; - uint64_t tiebreaker_ = 0; - IceMode remote_ice_mode_ = ICEMODE_FULL; - IceConfig ice_config_; - rtc::scoped_ptr local_description_; - rtc::scoped_ptr remote_description_; - bool local_description_set_ = false; - bool remote_description_set_ = false; - - ChannelMap channels_; - - RTC_DISALLOW_COPY_AND_ASSIGN(Transport); -}; - - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORT_H_ diff --git a/include/webrtc/p2p/base/transportchannel.h b/include/webrtc/p2p/base/transportchannel.h deleted file mode 100644 index b91af13..0000000 --- a/include/webrtc/p2p/base/transportchannel.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ -#define WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ - -#include -#include - -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/transport.h" -#include "webrtc/p2p/base/transportdescription.h" -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/dscp.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socket.h" -#include "webrtc/base/sslidentity.h" -#include "webrtc/base/sslstreamadapter.h" - -namespace cricket { - -class Candidate; - -// Flags for SendPacket/SignalReadPacket. -enum PacketFlags { - PF_NORMAL = 0x00, // A normal packet. - PF_SRTP_BYPASS = 0x01, // An encrypted SRTP packet; bypass any additional - // crypto provided by the transport (e.g. DTLS) -}; - -// Used to indicate channel's connection state. -enum TransportChannelState { - STATE_INIT, - STATE_CONNECTING, // Will enter this state once a connection is created - STATE_COMPLETED, - STATE_FAILED -}; - -// A TransportChannel represents one logical stream of packets that are sent -// between the two sides of a session. -// TODO(deadbeef): This interface currently represents the unity of an ICE -// transport and a DTLS transport. They need to be separated apart. -class TransportChannel : public sigslot::has_slots<> { - public: - TransportChannel(const std::string& transport_name, int component) - : transport_name_(transport_name), - component_(component), - writable_(false), - receiving_(false) {} - virtual ~TransportChannel() {} - - // TODO(guoweis) - Make this pure virtual once all subclasses of - // TransportChannel have this defined. - virtual TransportChannelState GetState() const { - return TransportChannelState::STATE_CONNECTING; - } - - // TODO(mallinath) - Remove this API, as it's no longer useful. - // Returns the session id of this channel. - virtual const std::string SessionId() const { return std::string(); } - - const std::string& transport_name() const { return transport_name_; } - int component() const { return component_; } - - // Returns the states of this channel. Each time one of these states changes, - // a signal is raised. These states are aggregated by the TransportManager. - bool writable() const { return writable_; } - bool receiving() const { return receiving_; } - DtlsTransportState dtls_state() const { return dtls_state_; } - sigslot::signal1 SignalWritableState; - // Emitted when the TransportChannel's ability to send has changed. - sigslot::signal1 SignalReadyToSend; - sigslot::signal1 SignalReceivingState; - // Emitted whenever DTLS-SRTP is setup which will require setting up a new - // SRTP context. - sigslot::signal2 SignalDtlsState; - - // Attempts to send the given packet. The return value is < 0 on failure. - // TODO: Remove the default argument once channel code is updated. - virtual int SendPacket(const char* data, size_t len, - const rtc::PacketOptions& options, - int flags = 0) = 0; - - // Sets a socket option on this channel. Note that not all options are - // supported by all transport types. - virtual int SetOption(rtc::Socket::Option opt, int value) = 0; - // TODO(pthatcher): Once Chrome's MockTransportChannel implments - // this, remove the default implementation. - virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; } - - // Returns the most recent error that occurred on this channel. - virtual int GetError() = 0; - - // Returns the current stats for this connection. - virtual bool GetStats(ConnectionInfos* infos) = 0; - - // Is DTLS active? - virtual bool IsDtlsActive() const = 0; - - // Default implementation. - virtual bool GetSslRole(rtc::SSLRole* role) const = 0; - - // Sets up the ciphers to use for DTLS-SRTP. TODO(guoweis): Make this pure - // virtual once all dependencies have implementation. - virtual bool SetSrtpCryptoSuites(const std::vector& ciphers); - - // Keep the original one for backward compatibility until all dependencies - // move away. TODO(guoweis): Remove this function. - virtual bool SetSrtpCiphers(const std::vector& ciphers); - - // Finds out which DTLS-SRTP cipher was negotiated. - // TODO(guoweis): Remove this once all dependencies implement this. - virtual bool GetSrtpCryptoSuite(int* cipher) { return false; } - - // Finds out which DTLS cipher was negotiated. - // TODO(guoweis): Remove this once all dependencies implement this. - virtual bool GetSslCipherSuite(int* cipher) { return false; } - - // Gets the local RTCCertificate used for DTLS. - virtual rtc::scoped_refptr - GetLocalCertificate() const = 0; - - // Gets a copy of the remote side's SSL certificate, owned by the caller. - virtual bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const = 0; - - // Allows key material to be extracted for external encryption. - virtual bool ExportKeyingMaterial(const std::string& label, - const uint8_t* context, - size_t context_len, - bool use_context, - uint8_t* result, - size_t result_len) = 0; - - // Signalled each time a packet is received on this channel. - sigslot::signal5 SignalReadPacket; - - // Signalled each time a packet is sent on this channel. - sigslot::signal2 SignalSentPacket; - - // This signal occurs when there is a change in the way that packets are - // being routed, i.e. to a different remote location. The candidate - // indicates where and how we are currently sending media. - sigslot::signal2 SignalRouteChange; - - // Invoked when the channel is being destroyed. - sigslot::signal1 SignalDestroyed; - - // Debugging description of this transport channel. - std::string ToString() const; - - protected: - // Sets the writable state, signaling if necessary. - void set_writable(bool writable); - - // Sets the receiving state, signaling if necessary. - void set_receiving(bool receiving); - - // Sets the DTLS state, signaling if necessary. - void set_dtls_state(DtlsTransportState state); - - private: - // Used mostly for debugging. - std::string transport_name_; - int component_; - bool writable_; - bool receiving_; - DtlsTransportState dtls_state_ = DTLS_TRANSPORT_NEW; - - RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel); -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ diff --git a/include/webrtc/p2p/base/transportchannelimpl.h b/include/webrtc/p2p/base/transportchannelimpl.h deleted file mode 100644 index 8d4d4bb..0000000 --- a/include/webrtc/p2p/base/transportchannelimpl.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TRANSPORTCHANNELIMPL_H_ -#define WEBRTC_P2P_BASE_TRANSPORTCHANNELIMPL_H_ - -#include -#include "webrtc/p2p/base/transport.h" -#include "webrtc/p2p/base/transportchannel.h" - -namespace buzz { class XmlElement; } - -namespace cricket { - -class Candidate; - -// TODO(pthatcher): Remove this once it's no longer used in -// remoting/protocol/libjingle_transport_factory.cc -enum IceProtocolType { - ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. -}; - -// Base class for real implementations of TransportChannel. This includes some -// methods called only by Transport, which do not need to be exposed to the -// client. -class TransportChannelImpl : public TransportChannel { - public: - explicit TransportChannelImpl(const std::string& transport_name, - int component) - : TransportChannel(transport_name, component) {} - - // Returns the transport that created this channel. - virtual Transport* GetTransport() = 0; - - // For ICE channels. - virtual IceRole GetIceRole() const = 0; - virtual void SetIceRole(IceRole role) = 0; - virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0; - // TODO(pthatcher): Remove this once it's no longer called in - // remoting/protocol/libjingle_transport_factory.cc - virtual void SetIceProtocolType(IceProtocolType type) {} - // SetIceCredentials only need to be implemented by the ICE - // transport channels. Non-ICE transport channels can just ignore. - // The ufrag and pwd should be set before the Connect() is called. - virtual void SetIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) = 0; - // SetRemoteIceCredentials only need to be implemented by the ICE - // transport channels. Non-ICE transport channels can just ignore. - virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, - const std::string& ice_pwd) = 0; - - // SetRemoteIceMode must be implemented only by the ICE transport channels. - virtual void SetRemoteIceMode(IceMode mode) = 0; - - virtual void SetIceConfig(const IceConfig& config) = 0; - - // Begins the process of attempting to make a connection to the other client. - virtual void Connect() = 0; - - // Start gathering candidates if not already started, or if an ICE restart - // occurred. - virtual void MaybeStartGathering() = 0; - - sigslot::signal1 SignalGatheringState; - - // Handles sending and receiving of candidates. The Transport - // receives the candidates and may forward them to the relevant - // channel. - // - // Note: Since candidates are delivered asynchronously to the - // channel, they cannot return an error if the message is invalid. - // It is assumed that the Transport will have checked validity - // before forwarding. - sigslot::signal2 - SignalCandidateGathered; - virtual void AddRemoteCandidate(const Candidate& candidate) = 0; - - virtual IceGatheringState gathering_state() const = 0; - - // DTLS methods - virtual bool SetLocalCertificate( - const rtc::scoped_refptr& certificate) = 0; - - // Set DTLS Remote fingerprint. Must be after local identity set. - virtual bool SetRemoteFingerprint(const std::string& digest_alg, - const uint8_t* digest, - size_t digest_len) = 0; - - virtual bool SetSslRole(rtc::SSLRole role) = 0; - - // Invoked when there is conflict in the ICE role between local and remote - // agents. - sigslot::signal1 SignalRoleConflict; - - // Emitted whenever the number of connections available to the transport - // channel decreases. - sigslot::signal1 SignalConnectionRemoved; - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannelImpl); -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORTCHANNELIMPL_H_ diff --git a/include/webrtc/p2p/base/transportcontroller.h b/include/webrtc/p2p/base/transportcontroller.h deleted file mode 100644 index 8d57b46..0000000 --- a/include/webrtc/p2p/base/transportcontroller.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ -#define WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ - -#include -#include -#include - -#include "webrtc/base/sigslot.h" -#include "webrtc/base/sslstreamadapter.h" -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/transport.h" - -namespace rtc { -class Thread; -} - -namespace cricket { - -class TransportController : public sigslot::has_slots<>, - public rtc::MessageHandler { - public: - TransportController(rtc::Thread* signaling_thread, - rtc::Thread* worker_thread, - PortAllocator* port_allocator); - - virtual ~TransportController(); - - rtc::Thread* signaling_thread() const { return signaling_thread_; } - rtc::Thread* worker_thread() const { return worker_thread_; } - - PortAllocator* port_allocator() const { return port_allocator_; } - - // Can only be set before transports are created. - // TODO(deadbeef): Make this an argument to the constructor once BaseSession - // and WebRtcSession are combined - bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version); - - void SetIceConfig(const IceConfig& config); - void SetIceRole(IceRole ice_role); - - // TODO(deadbeef) - Return role of each transport, as role may differ from - // one another. - // In current implementaion we just return the role of the first transport - // alphabetically. - bool GetSslRole(rtc::SSLRole* role); - - // Specifies the identity to use in this session. - // Can only be called once. - bool SetLocalCertificate( - const rtc::scoped_refptr& certificate); - bool GetLocalCertificate( - const std::string& transport_name, - rtc::scoped_refptr* certificate); - // Caller owns returned certificate - bool GetRemoteSSLCertificate(const std::string& transport_name, - rtc::SSLCertificate** cert); - bool SetLocalTransportDescription(const std::string& transport_name, - const TransportDescription& tdesc, - ContentAction action, - std::string* err); - bool SetRemoteTransportDescription(const std::string& transport_name, - const TransportDescription& tdesc, - ContentAction action, - std::string* err); - // Start gathering candidates for any new transports, or transports doing an - // ICE restart. - void MaybeStartGathering(); - bool AddRemoteCandidates(const std::string& transport_name, - const Candidates& candidates, - std::string* err); - bool ReadyForRemoteCandidates(const std::string& transport_name); - bool GetStats(const std::string& transport_name, TransportStats* stats); - - // Creates a channel if it doesn't exist. Otherwise, increments a reference - // count and returns an existing channel. - virtual TransportChannel* CreateTransportChannel_w( - const std::string& transport_name, - int component); - - // Decrements a channel's reference count, and destroys the channel if - // nothing is referencing it. - virtual void DestroyTransportChannel_w(const std::string& transport_name, - int component); - - // All of these signals are fired on the signalling thread. - - // If any transport failed => failed, - // Else if all completed => completed, - // Else if all connected => connected, - // Else => connecting - sigslot::signal1 SignalConnectionState; - - // Receiving if any transport is receiving - sigslot::signal1 SignalReceiving; - - // If all transports done gathering => complete, - // Else if any are gathering => gathering, - // Else => new - sigslot::signal1 SignalGatheringState; - - // (transport_name, candidates) - sigslot::signal2 - SignalCandidatesGathered; - - // for unit test - const rtc::scoped_refptr& certificate_for_testing(); - - protected: - // Protected and virtual so we can override it in unit tests. - virtual Transport* CreateTransport_w(const std::string& transport_name); - - // For unit tests - const std::map& transports() { return transports_; } - Transport* GetTransport_w(const std::string& transport_name); - - private: - void OnMessage(rtc::Message* pmsg) override; - - // It's the Transport that's currently responsible for creating/destroying - // channels, but the TransportController keeps track of how many external - // objects (BaseChannels) reference each channel. - struct RefCountedChannel { - RefCountedChannel() : impl_(nullptr), ref_(0) {} - explicit RefCountedChannel(TransportChannelImpl* impl) - : impl_(impl), ref_(0) {} - - void AddRef() { ++ref_; } - void DecRef() { - ASSERT(ref_ > 0); - --ref_; - } - int ref() const { return ref_; } - - TransportChannelImpl* get() const { return impl_; } - TransportChannelImpl* operator->() const { return impl_; } - - private: - TransportChannelImpl* impl_; - int ref_; - }; - - std::vector::iterator FindChannel_w( - const std::string& transport_name, - int component); - - Transport* GetOrCreateTransport_w(const std::string& transport_name); - void DestroyTransport_w(const std::string& transport_name); - void DestroyAllTransports_w(); - - bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version); - void SetIceConfig_w(const IceConfig& config); - void SetIceRole_w(IceRole ice_role); - bool GetSslRole_w(rtc::SSLRole* role); - bool SetLocalCertificate_w( - const rtc::scoped_refptr& certificate); - bool GetLocalCertificate_w( - const std::string& transport_name, - rtc::scoped_refptr* certificate); - bool GetRemoteSSLCertificate_w(const std::string& transport_name, - rtc::SSLCertificate** cert); - bool SetLocalTransportDescription_w(const std::string& transport_name, - const TransportDescription& tdesc, - ContentAction action, - std::string* err); - bool SetRemoteTransportDescription_w(const std::string& transport_name, - const TransportDescription& tdesc, - ContentAction action, - std::string* err); - void MaybeStartGathering_w(); - bool AddRemoteCandidates_w(const std::string& transport_name, - const Candidates& candidates, - std::string* err); - bool ReadyForRemoteCandidates_w(const std::string& transport_name); - bool GetStats_w(const std::string& transport_name, TransportStats* stats); - - // Handlers for signals from Transport. - void OnChannelWritableState_w(TransportChannel* channel); - void OnChannelReceivingState_w(TransportChannel* channel); - void OnChannelGatheringState_w(TransportChannelImpl* channel); - void OnChannelCandidateGathered_w(TransportChannelImpl* channel, - const Candidate& candidate); - void OnChannelRoleConflict_w(TransportChannelImpl* channel); - void OnChannelConnectionRemoved_w(TransportChannelImpl* channel); - - void UpdateAggregateStates_w(); - - rtc::Thread* const signaling_thread_ = nullptr; - rtc::Thread* const worker_thread_ = nullptr; - typedef std::map TransportMap; - TransportMap transports_; - - std::vector channels_; - - PortAllocator* const port_allocator_ = nullptr; - rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10; - - // Aggregate state for TransportChannelImpls. - IceConnectionState connection_state_ = kIceConnectionConnecting; - bool receiving_ = false; - IceGatheringState gathering_state_ = kIceGatheringNew; - - // TODO(deadbeef): Move the fields below down to the transports themselves - IceConfig ice_config_; - IceRole ice_role_ = ICEROLE_CONTROLLING; - // Flag which will be set to true after the first role switch - bool ice_role_switch_ = false; - uint64_t ice_tiebreaker_ = rtc::CreateRandomId64(); - rtc::scoped_refptr certificate_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ diff --git a/include/webrtc/p2p/base/transportdescription.h b/include/webrtc/p2p/base/transportdescription.h deleted file mode 100644 index 8ea1f4b..0000000 --- a/include/webrtc/p2p/base/transportdescription.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ -#define WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ - -#include -#include -#include - -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/constants.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/sslfingerprint.h" - -namespace cricket { - -// SEC_ENABLED and SEC_REQUIRED should only be used if the session -// was negotiated over TLS, to protect the inline crypto material -// exchange. -// SEC_DISABLED: No crypto in outgoing offer, ignore any supplied crypto. -// SEC_ENABLED: Crypto in outgoing offer and answer (if supplied in offer). -// SEC_REQUIRED: Crypto in outgoing offer and answer. Fail any offer with absent -// or unsupported crypto. -enum SecurePolicy { - SEC_DISABLED, - SEC_ENABLED, - SEC_REQUIRED -}; - -// Whether our side of the call is driving the negotiation, or the other side. -enum IceRole { - ICEROLE_CONTROLLING = 0, - ICEROLE_CONTROLLED, - ICEROLE_UNKNOWN -}; - -// ICE RFC 5245 implementation type. -enum IceMode { - ICEMODE_FULL, // As defined in http://tools.ietf.org/html/rfc5245#section-4.1 - ICEMODE_LITE // As defined in http://tools.ietf.org/html/rfc5245#section-4.2 -}; - -// RFC 4145 - http://tools.ietf.org/html/rfc4145#section-4 -// 'active': The endpoint will initiate an outgoing connection. -// 'passive': The endpoint will accept an incoming connection. -// 'actpass': The endpoint is willing to accept an incoming -// connection or to initiate an outgoing connection. -enum ConnectionRole { - CONNECTIONROLE_NONE = 0, - CONNECTIONROLE_ACTIVE, - CONNECTIONROLE_PASSIVE, - CONNECTIONROLE_ACTPASS, - CONNECTIONROLE_HOLDCONN, -}; - -extern const char CONNECTIONROLE_ACTIVE_STR[]; -extern const char CONNECTIONROLE_PASSIVE_STR[]; -extern const char CONNECTIONROLE_ACTPASS_STR[]; -extern const char CONNECTIONROLE_HOLDCONN_STR[]; - -bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role); -bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str); - -typedef std::vector Candidates; - -struct TransportDescription { - TransportDescription() - : ice_mode(ICEMODE_FULL), - connection_role(CONNECTIONROLE_NONE) {} - - TransportDescription(const std::vector& transport_options, - const std::string& ice_ufrag, - const std::string& ice_pwd, - IceMode ice_mode, - ConnectionRole role, - const rtc::SSLFingerprint* identity_fingerprint, - const Candidates& candidates) - : transport_options(transport_options), - ice_ufrag(ice_ufrag), - ice_pwd(ice_pwd), - ice_mode(ice_mode), - connection_role(role), - identity_fingerprint(CopyFingerprint(identity_fingerprint)), - candidates(candidates) {} - TransportDescription(const std::string& ice_ufrag, - const std::string& ice_pwd) - : ice_ufrag(ice_ufrag), - ice_pwd(ice_pwd), - ice_mode(ICEMODE_FULL), - connection_role(CONNECTIONROLE_NONE) {} - TransportDescription(const TransportDescription& from) - : transport_options(from.transport_options), - ice_ufrag(from.ice_ufrag), - ice_pwd(from.ice_pwd), - ice_mode(from.ice_mode), - connection_role(from.connection_role), - identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())), - candidates(from.candidates) {} - - TransportDescription& operator=(const TransportDescription& from) { - // Self-assignment - if (this == &from) - return *this; - - transport_options = from.transport_options; - ice_ufrag = from.ice_ufrag; - ice_pwd = from.ice_pwd; - ice_mode = from.ice_mode; - connection_role = from.connection_role; - - identity_fingerprint.reset(CopyFingerprint( - from.identity_fingerprint.get())); - candidates = from.candidates; - return *this; - } - - bool HasOption(const std::string& option) const { - return (std::find(transport_options.begin(), transport_options.end(), - option) != transport_options.end()); - } - void AddOption(const std::string& option) { - transport_options.push_back(option); - } - bool secure() const { return identity_fingerprint != NULL; } - - static rtc::SSLFingerprint* CopyFingerprint( - const rtc::SSLFingerprint* from) { - if (!from) - return NULL; - - return new rtc::SSLFingerprint(*from); - } - - std::vector transport_options; - std::string ice_ufrag; - std::string ice_pwd; - IceMode ice_mode; - ConnectionRole connection_role; - - rtc::scoped_ptr identity_fingerprint; - Candidates candidates; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_ diff --git a/include/webrtc/p2p/base/transportdescriptionfactory.h b/include/webrtc/p2p/base/transportdescriptionfactory.h deleted file mode 100644 index 828aa6d..0000000 --- a/include/webrtc/p2p/base/transportdescriptionfactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_ -#define WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_ - -#include "webrtc/base/rtccertificate.h" -#include "webrtc/p2p/base/transportdescription.h" - -namespace rtc { -class SSLIdentity; -} - -namespace cricket { - -struct TransportOptions { - TransportOptions() : ice_restart(false), prefer_passive_role(false) {} - bool ice_restart; - bool prefer_passive_role; -}; - -// Creates transport descriptions according to the supplied configuration. -// When creating answers, performs the appropriate negotiation -// of the various fields to determine the proper result. -class TransportDescriptionFactory { - public: - // Default ctor; use methods below to set configuration. - TransportDescriptionFactory(); - SecurePolicy secure() const { return secure_; } - // The certificate to use when setting up DTLS. - const rtc::scoped_refptr& certificate() const { - return certificate_; - } - - // Specifies the transport security policy to use. - void set_secure(SecurePolicy s) { secure_ = s; } - // Specifies the certificate to use (only used when secure != SEC_DISABLED). - void set_certificate( - const rtc::scoped_refptr& certificate) { - certificate_ = certificate; - } - - // Creates a transport description suitable for use in an offer. - TransportDescription* CreateOffer(const TransportOptions& options, - const TransportDescription* current_description) const; - // Create a transport description that is a response to an offer. - TransportDescription* CreateAnswer( - const TransportDescription* offer, - const TransportOptions& options, - const TransportDescription* current_description) const; - - private: - bool SetSecurityInfo(TransportDescription* description, - ConnectionRole role) const; - - SecurePolicy secure_; - rtc::scoped_refptr certificate_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORTDESCRIPTIONFACTORY_H_ diff --git a/include/webrtc/p2p/base/transportinfo.h b/include/webrtc/p2p/base/transportinfo.h deleted file mode 100644 index 3fbf204..0000000 --- a/include/webrtc/p2p/base/transportinfo.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TRANSPORTINFO_H_ -#define WEBRTC_P2P_BASE_TRANSPORTINFO_H_ - -#include -#include - -#include "webrtc/p2p/base/candidate.h" -#include "webrtc/p2p/base/constants.h" -#include "webrtc/p2p/base/transportdescription.h" -#include "webrtc/base/helpers.h" - -namespace cricket { - -// A TransportInfo is NOT a transport-info message. It is comparable -// to a "ContentInfo". A transport-infos message is basically just a -// collection of TransportInfos. -struct TransportInfo { - TransportInfo() {} - - TransportInfo(const std::string& content_name, - const TransportDescription& description) - : content_name(content_name), - description(description) {} - - std::string content_name; - TransportDescription description; -}; - -typedef std::vector TransportInfos; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TRANSPORTINFO_H_ diff --git a/include/webrtc/p2p/base/turnport.h b/include/webrtc/p2p/base/turnport.h deleted file mode 100644 index 4be9249..0000000 --- a/include/webrtc/p2p/base/turnport.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TURNPORT_H_ -#define WEBRTC_P2P_BASE_TURNPORT_H_ - -#include -#include -#include -#include - -#include "webrtc/base/asyncinvoker.h" -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/p2p/base/port.h" -#include "webrtc/p2p/client/basicportallocator.h" - -namespace rtc { -class AsyncResolver; -class SignalThread; -} - -namespace cricket { - -extern const char TURN_PORT_TYPE[]; -class TurnAllocateRequest; -class TurnEntry; - -class TurnPort : public Port { - public: - enum PortState { - STATE_CONNECTING, // Initial state, cannot send any packets. - STATE_CONNECTED, // Socket connected, ready to send stun requests. - STATE_READY, // Received allocate success, can send any packets. - STATE_DISCONNECTED, // TCP connection died, cannot send any packets. - }; - static TurnPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - rtc::AsyncPacketSocket* socket, - const std::string& username, // ice username. - const std::string& password, // ice password. - const ProtocolAddress& server_address, - const RelayCredentials& credentials, - int server_priority, - const std::string& origin) { - return new TurnPort(thread, factory, network, socket, username, password, - server_address, credentials, server_priority, origin); - } - - static TurnPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, // ice username. - const std::string& password, // ice password. - const ProtocolAddress& server_address, - const RelayCredentials& credentials, - int server_priority, - const std::string& origin) { - return new TurnPort(thread, factory, network, ip, min_port, max_port, - username, password, server_address, credentials, - server_priority, origin); - } - - virtual ~TurnPort(); - - const ProtocolAddress& server_address() const { return server_address_; } - // Returns an empty address if the local address has not been assigned. - rtc::SocketAddress GetLocalAddress() const; - - bool ready() const { return state_ == STATE_READY; } - bool connected() const { - return state_ == STATE_READY || state_ == STATE_CONNECTED; - } - const RelayCredentials& credentials() const { return credentials_; } - - virtual void PrepareAddress(); - virtual Connection* CreateConnection( - const Candidate& c, PortInterface::CandidateOrigin origin); - virtual int SendTo(const void* data, size_t size, - const rtc::SocketAddress& addr, - const rtc::PacketOptions& options, - bool payload); - virtual int SetOption(rtc::Socket::Option opt, int value); - virtual int GetOption(rtc::Socket::Option opt, int* value); - virtual int GetError(); - - virtual bool HandleIncomingPacket( - rtc::AsyncPacketSocket* socket, const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time) { - OnReadPacket(socket, data, size, remote_addr, packet_time); - return true; - } - virtual void OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - - virtual void OnReadyToSend(rtc::AsyncPacketSocket* socket); - virtual bool SupportsProtocol(const std::string& protocol) const { - // Turn port only connects to UDP candidates. - return protocol == UDP_PROTOCOL_NAME; - } - - void OnSocketConnect(rtc::AsyncPacketSocket* socket); - void OnSocketClose(rtc::AsyncPacketSocket* socket, int error); - - - const std::string& hash() const { return hash_; } - const std::string& nonce() const { return nonce_; } - - int error() const { return error_; } - - void OnAllocateMismatch(); - - rtc::AsyncPacketSocket* socket() const { - return socket_; - } - - // For testing only. - rtc::AsyncInvoker* invoker() { return &invoker_; } - - // Signal with resolved server address. - // Parameters are port, server address and resolved server address. - // This signal will be sent only if server address is resolved successfully. - sigslot::signal3 SignalResolvedServerAddress; - - // All public methods/signals below are for testing only. - sigslot::signal2 SignalTurnRefreshResult; - sigslot::signal3 - SignalCreatePermissionResult; - void FlushRequests() { request_manager_.Flush(); } - void set_credentials(RelayCredentials& credentials) { - credentials_ = credentials; - } - // Finds the turn entry with |address| and sets its channel id. - // Returns true if the entry is found. - bool SetEntryChannelId(const rtc::SocketAddress& address, int channel_id); - - protected: - TurnPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - rtc::AsyncPacketSocket* socket, - const std::string& username, - const std::string& password, - const ProtocolAddress& server_address, - const RelayCredentials& credentials, - int server_priority, - const std::string& origin); - - TurnPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const ProtocolAddress& server_address, - const RelayCredentials& credentials, - int server_priority, - const std::string& origin); - - private: - enum { - MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, - MSG_ALLOCATE_MISMATCH, - MSG_TRY_ALTERNATE_SERVER - }; - - typedef std::list EntryList; - typedef std::map SocketOptionsMap; - typedef std::set AttemptedServerSet; - - virtual void OnMessage(rtc::Message* pmsg); - - bool CreateTurnClientSocket(); - - void set_nonce(const std::string& nonce) { nonce_ = nonce; } - void set_realm(const std::string& realm) { - if (realm != realm_) { - realm_ = realm; - UpdateHash(); - } - } - - // Shuts down the turn port, usually because of some fatal errors. - void Close(); - void OnTurnRefreshError() { Close(); } - bool SetAlternateServer(const rtc::SocketAddress& address); - void ResolveTurnAddress(const rtc::SocketAddress& address); - void OnResolveResult(rtc::AsyncResolverInterface* resolver); - - void AddRequestAuthInfo(StunMessage* msg); - void OnSendStunPacket(const void* data, size_t size, StunRequest* request); - // Stun address from allocate success response. - // Currently used only for testing. - void OnStunAddress(const rtc::SocketAddress& address); - void OnAllocateSuccess(const rtc::SocketAddress& address, - const rtc::SocketAddress& stun_address); - void OnAllocateError(); - void OnAllocateRequestTimeout(); - - void HandleDataIndication(const char* data, size_t size, - const rtc::PacketTime& packet_time); - void HandleChannelData(int channel_id, const char* data, size_t size, - const rtc::PacketTime& packet_time); - void DispatchPacket(const char* data, size_t size, - const rtc::SocketAddress& remote_addr, - ProtocolType proto, const rtc::PacketTime& packet_time); - - bool ScheduleRefresh(int lifetime); - void SendRequest(StunRequest* request, int delay); - int Send(const void* data, size_t size, - const rtc::PacketOptions& options); - void UpdateHash(); - bool UpdateNonce(StunMessage* response); - - bool HasPermission(const rtc::IPAddress& ipaddr) const; - TurnEntry* FindEntry(const rtc::SocketAddress& address) const; - TurnEntry* FindEntry(int channel_id) const; - bool EntryExists(TurnEntry* e); - void CreateOrRefreshEntry(const rtc::SocketAddress& address); - void DestroyEntry(TurnEntry* entry); - // Destroys the entry only if |timestamp| matches the destruction timestamp - // in |entry|. - void DestroyEntryIfNotCancelled(TurnEntry* entry, uint32_t timestamp); - void ScheduleEntryDestruction(TurnEntry* entry); - void CancelEntryDestruction(TurnEntry* entry); - void OnConnectionDestroyed(Connection* conn); - - // Destroys the connection with remote address |address|. Returns true if - // a connection is found and destroyed. - bool DestroyConnection(const rtc::SocketAddress& address); - - ProtocolAddress server_address_; - RelayCredentials credentials_; - AttemptedServerSet attempted_server_addresses_; - - rtc::AsyncPacketSocket* socket_; - SocketOptionsMap socket_options_; - rtc::AsyncResolverInterface* resolver_; - int error_; - - StunRequestManager request_manager_; - std::string realm_; // From 401/438 response message. - std::string nonce_; // From 401/438 response message. - std::string hash_; // Digest of username:realm:password - - int next_channel_number_; - EntryList entries_; - - PortState state_; - // By default the value will be set to 0. This value will be used in - // calculating the candidate priority. - int server_priority_; - - // The number of retries made due to allocate mismatch error. - size_t allocate_mismatch_retries_; - - rtc::AsyncInvoker invoker_; - - friend class TurnEntry; - friend class TurnAllocateRequest; - friend class TurnRefreshRequest; - friend class TurnCreatePermissionRequest; - friend class TurnChannelBindRequest; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TURNPORT_H_ diff --git a/include/webrtc/p2p/base/turnserver.h b/include/webrtc/p2p/base/turnserver.h deleted file mode 100644 index 113bd4c..0000000 --- a/include/webrtc/p2p/base/turnserver.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2012 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_TURNSERVER_H_ -#define WEBRTC_P2P_BASE_TURNSERVER_H_ - -#include -#include -#include -#include - -#include "webrtc/p2p/base/portinterface.h" -#include "webrtc/base/asyncpacketsocket.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/socketaddress.h" - -namespace rtc { -class ByteBuffer; -class PacketSocketFactory; -class Thread; -} - -namespace cricket { - -class StunMessage; -class TurnMessage; -class TurnServer; - -// The default server port for TURN, as specified in RFC5766. -const int TURN_SERVER_PORT = 3478; - -// Encapsulates the client's connection to the server. -class TurnServerConnection { - public: - TurnServerConnection() : proto_(PROTO_UDP), socket_(NULL) {} - TurnServerConnection(const rtc::SocketAddress& src, - ProtocolType proto, - rtc::AsyncPacketSocket* socket); - const rtc::SocketAddress& src() const { return src_; } - rtc::AsyncPacketSocket* socket() { return socket_; } - bool operator==(const TurnServerConnection& t) const; - bool operator<(const TurnServerConnection& t) const; - std::string ToString() const; - - private: - rtc::SocketAddress src_; - rtc::SocketAddress dst_; - cricket::ProtocolType proto_; - rtc::AsyncPacketSocket* socket_; -}; - -// Encapsulates a TURN allocation. -// The object is created when an allocation request is received, and then -// handles TURN messages (via HandleTurnMessage) and channel data messages -// (via HandleChannelData) for this allocation when received by the server. -// The object self-deletes and informs the server if its lifetime timer expires. -class TurnServerAllocation : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - TurnServerAllocation(TurnServer* server_, - rtc::Thread* thread, - const TurnServerConnection& conn, - rtc::AsyncPacketSocket* server_socket, - const std::string& key); - virtual ~TurnServerAllocation(); - - TurnServerConnection* conn() { return &conn_; } - const std::string& key() const { return key_; } - const std::string& transaction_id() const { return transaction_id_; } - const std::string& username() const { return username_; } - const std::string& origin() const { return origin_; } - const std::string& last_nonce() const { return last_nonce_; } - void set_last_nonce(const std::string& nonce) { last_nonce_ = nonce; } - - std::string ToString() const; - - void HandleTurnMessage(const TurnMessage* msg); - void HandleChannelData(const char* data, size_t size); - - sigslot::signal1 SignalDestroyed; - - private: - class Channel; - class Permission; - typedef std::list PermissionList; - typedef std::list ChannelList; - - void HandleAllocateRequest(const TurnMessage* msg); - void HandleRefreshRequest(const TurnMessage* msg); - void HandleSendIndication(const TurnMessage* msg); - void HandleCreatePermissionRequest(const TurnMessage* msg); - void HandleChannelBindRequest(const TurnMessage* msg); - - void OnExternalPacket(rtc::AsyncPacketSocket* socket, - const char* data, size_t size, - const rtc::SocketAddress& addr, - const rtc::PacketTime& packet_time); - - static int ComputeLifetime(const TurnMessage* msg); - bool HasPermission(const rtc::IPAddress& addr); - void AddPermission(const rtc::IPAddress& addr); - Permission* FindPermission(const rtc::IPAddress& addr) const; - Channel* FindChannel(int channel_id) const; - Channel* FindChannel(const rtc::SocketAddress& addr) const; - - void SendResponse(TurnMessage* msg); - void SendBadRequestResponse(const TurnMessage* req); - void SendErrorResponse(const TurnMessage* req, int code, - const std::string& reason); - void SendExternal(const void* data, size_t size, - const rtc::SocketAddress& peer); - - void OnPermissionDestroyed(Permission* perm); - void OnChannelDestroyed(Channel* channel); - virtual void OnMessage(rtc::Message* msg); - - TurnServer* server_; - rtc::Thread* thread_; - TurnServerConnection conn_; - rtc::scoped_ptr external_socket_; - std::string key_; - std::string transaction_id_; - std::string username_; - std::string origin_; - std::string last_nonce_; - PermissionList perms_; - ChannelList channels_; -}; - -// An interface through which the MD5 credential hash can be retrieved. -class TurnAuthInterface { - public: - // Gets HA1 for the specified user and realm. - // HA1 = MD5(A1) = MD5(username:realm:password). - // Return true if the given username and realm are valid, or false if not. - virtual bool GetKey(const std::string& username, const std::string& realm, - std::string* key) = 0; -}; - -// An interface enables Turn Server to control redirection behavior. -class TurnRedirectInterface { - public: - virtual bool ShouldRedirect(const rtc::SocketAddress& address, - rtc::SocketAddress* out) = 0; - virtual ~TurnRedirectInterface() {} -}; - -// The core TURN server class. Give it a socket to listen on via -// AddInternalServerSocket, and a factory to create external sockets via -// SetExternalSocketFactory, and it's ready to go. -// Not yet wired up: TCP support. -class TurnServer : public sigslot::has_slots<> { - public: - typedef std::map AllocationMap; - - explicit TurnServer(rtc::Thread* thread); - ~TurnServer(); - - // Gets/sets the realm value to use for the server. - const std::string& realm() const { return realm_; } - void set_realm(const std::string& realm) { realm_ = realm; } - - // Gets/sets the value for the SOFTWARE attribute for TURN messages. - const std::string& software() const { return software_; } - void set_software(const std::string& software) { software_ = software; } - - const AllocationMap& allocations() const { return allocations_; } - - // Sets the authentication callback; does not take ownership. - void set_auth_hook(TurnAuthInterface* auth_hook) { auth_hook_ = auth_hook; } - - void set_redirect_hook(TurnRedirectInterface* redirect_hook) { - redirect_hook_ = redirect_hook; - } - - void set_enable_otu_nonce(bool enable) { enable_otu_nonce_ = enable; } - - // If set to true, reject CreatePermission requests to RFC1918 addresses. - void set_reject_private_addresses(bool filter) { - reject_private_addresses_ = filter; - } - - // Starts listening for packets from internal clients. - void AddInternalSocket(rtc::AsyncPacketSocket* socket, - ProtocolType proto); - // Starts listening for the connections on this socket. When someone tries - // to connect, the connection will be accepted and a new internal socket - // will be added. - void AddInternalServerSocket(rtc::AsyncSocket* socket, - ProtocolType proto); - // Specifies the factory to use for creating external sockets. - void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, - const rtc::SocketAddress& address); - - private: - void OnInternalPacket(rtc::AsyncPacketSocket* socket, const char* data, - size_t size, const rtc::SocketAddress& address, - const rtc::PacketTime& packet_time); - - void OnNewInternalConnection(rtc::AsyncSocket* socket); - - // Accept connections on this server socket. - void AcceptConnection(rtc::AsyncSocket* server_socket); - void OnInternalSocketClose(rtc::AsyncPacketSocket* socket, int err); - - void HandleStunMessage( - TurnServerConnection* conn, const char* data, size_t size); - void HandleBindingRequest(TurnServerConnection* conn, const StunMessage* msg); - void HandleAllocateRequest(TurnServerConnection* conn, const TurnMessage* msg, - const std::string& key); - - bool GetKey(const StunMessage* msg, std::string* key); - bool CheckAuthorization(TurnServerConnection* conn, const StunMessage* msg, - const char* data, size_t size, - const std::string& key); - std::string GenerateNonce() const; - bool ValidateNonce(const std::string& nonce) const; - - TurnServerAllocation* FindAllocation(TurnServerConnection* conn); - TurnServerAllocation* CreateAllocation( - TurnServerConnection* conn, int proto, const std::string& key); - - void SendErrorResponse(TurnServerConnection* conn, const StunMessage* req, - int code, const std::string& reason); - - void SendErrorResponseWithRealmAndNonce(TurnServerConnection* conn, - const StunMessage* req, - int code, - const std::string& reason); - - void SendErrorResponseWithAlternateServer(TurnServerConnection* conn, - const StunMessage* req, - const rtc::SocketAddress& addr); - - void SendStun(TurnServerConnection* conn, StunMessage* msg); - void Send(TurnServerConnection* conn, const rtc::ByteBuffer& buf); - - void OnAllocationDestroyed(TurnServerAllocation* allocation); - void DestroyInternalSocket(rtc::AsyncPacketSocket* socket); - - typedef std::map InternalSocketMap; - typedef std::map ServerSocketMap; - - rtc::Thread* thread_; - std::string nonce_key_; - std::string realm_; - std::string software_; - TurnAuthInterface* auth_hook_; - TurnRedirectInterface* redirect_hook_; - // otu - one-time-use. Server will respond with 438 if it's - // sees the same nonce in next transaction. - bool enable_otu_nonce_; - bool reject_private_addresses_ = false; - - InternalSocketMap server_sockets_; - ServerSocketMap server_listen_sockets_; - rtc::scoped_ptr - external_socket_factory_; - rtc::SocketAddress external_addr_; - - AllocationMap allocations_; - - friend class TurnServerAllocation; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_BASE_TURNSERVER_H_ diff --git a/include/webrtc/p2p/base/udpport.h b/include/webrtc/p2p/base/udpport.h deleted file mode 100644 index 9f86864..0000000 --- a/include/webrtc/p2p/base/udpport.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_BASE_UDPPORT_H_ -#define WEBRTC_P2P_BASE_UDPPORT_H_ - -// StunPort will be handling UDPPort functionality. -#include "webrtc/p2p/base/stunport.h" - -#endif // WEBRTC_P2P_BASE_UDPPORT_H_ diff --git a/include/webrtc/p2p/client/autoportallocator.h b/include/webrtc/p2p/client/autoportallocator.h deleted file mode 100644 index 7856510..0000000 --- a/include/webrtc/p2p/client/autoportallocator.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_CLIENT_AUTOPORTALLOCATOR_H_ -#define WEBRTC_P2P_CLIENT_AUTOPORTALLOCATOR_H_ - -#include -#include - -#include "webrtc/p2p/client/httpportallocator.h" -#include "webrtc/base/sigslot.h" - -// This class sets the relay and stun servers using XmppClient. -// It enables the client to traverse Proxy and NAT. -class AutoPortAllocator : public cricket::HttpPortAllocator { - public: - AutoPortAllocator(rtc::NetworkManager* network_manager, - const std::string& user_agent) - : cricket::HttpPortAllocator(network_manager, user_agent) { - } - - // Creates and initiates a task to get relay token from XmppClient and set - // it appropriately. - void SetXmppClient(buzz::XmppClient* client) { - // The JingleInfoTask is freed by the task-runner. - buzz::JingleInfoTask* jit = new buzz::JingleInfoTask(client); - jit->SignalJingleInfo.connect(this, &AutoPortAllocator::OnJingleInfo); - jit->Start(); - jit->RefreshJingleInfoNow(); - } - - private: - void OnJingleInfo( - const std::string& token, - const std::vector& relay_hosts, - const std::vector& stun_hosts) { - SetRelayToken(token); - SetStunHosts(stun_hosts); - SetRelayHosts(relay_hosts); - } -}; - -#endif // WEBRTC_P2P_CLIENT_AUTOPORTALLOCATOR_H_ diff --git a/include/webrtc/p2p/client/basicportallocator.h b/include/webrtc/p2p/client/basicportallocator.h deleted file mode 100644 index 6c301de..0000000 --- a/include/webrtc/p2p/client/basicportallocator.h +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ -#define WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ - -#include -#include - -#include "webrtc/p2p/base/portallocator.h" -#include "webrtc/base/messagequeue.h" -#include "webrtc/base/network.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/thread.h" - -namespace cricket { - -class BasicPortAllocator : public PortAllocator { - public: - BasicPortAllocator(rtc::NetworkManager* network_manager, - rtc::PacketSocketFactory* socket_factory); - explicit BasicPortAllocator(rtc::NetworkManager* network_manager); - BasicPortAllocator(rtc::NetworkManager* network_manager, - rtc::PacketSocketFactory* socket_factory, - const ServerAddresses& stun_servers); - BasicPortAllocator(rtc::NetworkManager* network_manager, - const ServerAddresses& stun_servers, - const rtc::SocketAddress& relay_server_udp, - const rtc::SocketAddress& relay_server_tcp, - const rtc::SocketAddress& relay_server_ssl); - virtual ~BasicPortAllocator(); - - void SetIceServers( - const ServerAddresses& stun_servers, - const std::vector& turn_servers) override { - stun_servers_ = stun_servers; - turn_servers_ = turn_servers; - } - - rtc::NetworkManager* network_manager() { return network_manager_; } - - // If socket_factory() is set to NULL each PortAllocatorSession - // creates its own socket factory. - rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } - - const ServerAddresses& stun_servers() const { - return stun_servers_; - } - - const std::vector& turn_servers() const { - return turn_servers_; - } - virtual void AddTurnServer(const RelayServerConfig& turn_server) { - turn_servers_.push_back(turn_server); - } - - PortAllocatorSession* CreateSessionInternal( - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd) override; - - private: - void Construct(); - - rtc::NetworkManager* network_manager_; - rtc::PacketSocketFactory* socket_factory_; - ServerAddresses stun_servers_; - std::vector turn_servers_; - bool allow_tcp_listen_; -}; - -struct PortConfiguration; -class AllocationSequence; - -class BasicPortAllocatorSession : public PortAllocatorSession, - public rtc::MessageHandler { - public: - BasicPortAllocatorSession(BasicPortAllocator* allocator, - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd); - ~BasicPortAllocatorSession(); - - virtual BasicPortAllocator* allocator() { return allocator_; } - rtc::Thread* network_thread() { return network_thread_; } - rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } - - void StartGettingPorts() override; - void StopGettingPorts() override; - void ClearGettingPorts() override; - bool IsGettingPorts() override { return running_; } - - protected: - // Starts the process of getting the port configurations. - virtual void GetPortConfigurations(); - - // Adds a port configuration that is now ready. Once we have one for each - // network (or a timeout occurs), we will start allocating ports. - virtual void ConfigReady(PortConfiguration* config); - - // MessageHandler. Can be overriden if message IDs do not conflict. - void OnMessage(rtc::Message* message) override; - - private: - class PortData { - public: - PortData() : port_(NULL), sequence_(NULL), state_(STATE_INIT) {} - PortData(Port* port, AllocationSequence* seq) - : port_(port), sequence_(seq), state_(STATE_INIT) { - } - - Port* port() { return port_; } - AllocationSequence* sequence() { return sequence_; } - bool ready() const { return state_ == STATE_READY; } - bool complete() const { - // Returns true if candidate allocation has completed one way or another. - return ((state_ == STATE_COMPLETE) || (state_ == STATE_ERROR)); - } - - void set_ready() { ASSERT(state_ == STATE_INIT); state_ = STATE_READY; } - void set_complete() { - state_ = STATE_COMPLETE; - } - void set_error() { - ASSERT(state_ == STATE_INIT || state_ == STATE_READY); - state_ = STATE_ERROR; - } - - private: - enum State { - STATE_INIT, // No candidates allocated yet. - STATE_READY, // At least one candidate is ready for process. - STATE_COMPLETE, // All candidates allocated and ready for process. - STATE_ERROR // Error in gathering candidates. - }; - Port* port_; - AllocationSequence* sequence_; - State state_; - }; - - void OnConfigReady(PortConfiguration* config); - void OnConfigStop(); - void AllocatePorts(); - void OnAllocate(); - void DoAllocate(); - void OnNetworksChanged(); - void OnAllocationSequenceObjectsCreated(); - void DisableEquivalentPhases(rtc::Network* network, - PortConfiguration* config, - uint32_t* flags); - void AddAllocatedPort(Port* port, AllocationSequence* seq, - bool prepare_address); - void OnCandidateReady(Port* port, const Candidate& c); - void OnPortComplete(Port* port); - void OnPortError(Port* port); - void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto); - void OnPortDestroyed(PortInterface* port); - void OnShake(); - void MaybeSignalCandidatesAllocationDone(); - void OnPortAllocationComplete(AllocationSequence* seq); - PortData* FindPort(Port* port); - void GetNetworks(std::vector* networks); - - bool CheckCandidateFilter(const Candidate& c); - - BasicPortAllocator* allocator_; - rtc::Thread* network_thread_; - rtc::scoped_ptr owned_socket_factory_; - rtc::PacketSocketFactory* socket_factory_; - bool allocation_started_; - bool network_manager_started_; - bool running_; // set when StartGetAllPorts is called - bool allocation_sequences_created_; - std::vector configs_; - std::vector sequences_; - std::vector ports_; - - friend class AllocationSequence; -}; - -// Records configuration information useful in creating ports. -// TODO(deadbeef): Rename "relay" to "turn_server" in this struct. -struct PortConfiguration : public rtc::MessageData { - // TODO(jiayl): remove |stun_address| when Chrome is updated. - rtc::SocketAddress stun_address; - ServerAddresses stun_servers; - std::string username; - std::string password; - - typedef std::vector RelayList; - RelayList relays; - - // TODO(jiayl): remove this ctor when Chrome is updated. - PortConfiguration(const rtc::SocketAddress& stun_address, - const std::string& username, - const std::string& password); - - PortConfiguration(const ServerAddresses& stun_servers, - const std::string& username, - const std::string& password); - - // Returns addresses of both the explicitly configured STUN servers, - // and TURN servers that should be used as STUN servers. - ServerAddresses StunServers(); - - // Adds another relay server, with the given ports and modifier, to the list. - void AddRelay(const RelayServerConfig& config); - - // Determines whether the given relay server supports the given protocol. - bool SupportsProtocol(const RelayServerConfig& relay, - ProtocolType type) const; - bool SupportsProtocol(RelayType turn_type, ProtocolType type) const; - // Helper method returns the server addresses for the matching RelayType and - // Protocol type. - ServerAddresses GetRelayServerAddresses( - RelayType turn_type, ProtocolType type) const; -}; - -class UDPPort; -class TurnPort; - -// Performs the allocation of ports, in a sequenced (timed) manner, for a given -// network and IP address. -class AllocationSequence : public rtc::MessageHandler, - public sigslot::has_slots<> { - public: - enum State { - kInit, // Initial state. - kRunning, // Started allocating ports. - kStopped, // Stopped from running. - kCompleted, // All ports are allocated. - - // kInit --> kRunning --> {kCompleted|kStopped} - }; - AllocationSequence(BasicPortAllocatorSession* session, - rtc::Network* network, - PortConfiguration* config, - uint32_t flags); - ~AllocationSequence(); - bool Init(); - void Clear(); - void OnNetworkRemoved(); - - State state() const { return state_; } - const rtc::Network* network() const { return network_; } - bool network_removed() const { return network_removed_; } - - // Disables the phases for a new sequence that this one already covers for an - // equivalent network setup. - void DisableEquivalentPhases(rtc::Network* network, - PortConfiguration* config, - uint32_t* flags); - - // Starts and stops the sequence. When started, it will continue allocating - // new ports on its own timed schedule. - void Start(); - void Stop(); - - // MessageHandler - void OnMessage(rtc::Message* msg); - - void EnableProtocol(ProtocolType proto); - bool ProtocolEnabled(ProtocolType proto) const; - - // Signal from AllocationSequence, when it's done with allocating ports. - // This signal is useful, when port allocation fails which doesn't result - // in any candidates. Using this signal BasicPortAllocatorSession can send - // its candidate discovery conclusion signal. Without this signal, - // BasicPortAllocatorSession doesn't have any event to trigger signal. This - // can also be achieved by starting timer in BPAS. - sigslot::signal1 SignalPortAllocationComplete; - - protected: - // For testing. - void CreateTurnPort(const RelayServerConfig& config); - - private: - typedef std::vector ProtocolList; - - bool IsFlagSet(uint32_t flag) { return ((flags_ & flag) != 0); } - void CreateUDPPorts(); - void CreateTCPPorts(); - void CreateStunPorts(); - void CreateRelayPorts(); - void CreateGturnPort(const RelayServerConfig& config); - - void OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, - size_t size, - const rtc::SocketAddress& remote_addr, - const rtc::PacketTime& packet_time); - - void OnPortDestroyed(PortInterface* port); - - BasicPortAllocatorSession* session_; - bool network_removed_ = false; - rtc::Network* network_; - rtc::IPAddress ip_; - PortConfiguration* config_; - State state_; - uint32_t flags_; - ProtocolList protocols_; - rtc::scoped_ptr udp_socket_; - // There will be only one udp port per AllocationSequence. - UDPPort* udp_port_; - std::vector turn_ports_; - int phase_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ diff --git a/include/webrtc/p2p/client/fakeportallocator.h b/include/webrtc/p2p/client/fakeportallocator.h deleted file mode 100644 index d9af4b3..0000000 --- a/include/webrtc/p2p/client/fakeportallocator.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_CLIENT_FAKEPORTALLOCATOR_H_ -#define WEBRTC_P2P_CLIENT_FAKEPORTALLOCATOR_H_ - -#include -#include "webrtc/p2p/base/basicpacketsocketfactory.h" -#include "webrtc/p2p/base/portallocator.h" -#include "webrtc/p2p/base/udpport.h" -#include "webrtc/base/scoped_ptr.h" - -namespace rtc { -class SocketFactory; -class Thread; -} - -namespace cricket { - -class TestUDPPort : public UDPPort { - public: - static TestUDPPort* Create(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const std::string& origin, - bool emit_localhost_for_anyaddress) { - TestUDPPort* port = new TestUDPPort(thread, factory, network, ip, min_port, - max_port, username, password, origin, - emit_localhost_for_anyaddress); - if (!port->Init()) { - delete port; - port = nullptr; - } - return port; - } - void SendBindingResponse(StunMessage* request, - const rtc::SocketAddress& addr) override { - UDPPort::SendBindingResponse(request, addr); - sent_binding_response_ = true; - } - bool sent_binding_response() { return sent_binding_response_; } - void set_sent_binding_response(bool response) { - sent_binding_response_ = response; - } - - protected: - TestUDPPort(rtc::Thread* thread, - rtc::PacketSocketFactory* factory, - rtc::Network* network, - const rtc::IPAddress& ip, - uint16_t min_port, - uint16_t max_port, - const std::string& username, - const std::string& password, - const std::string& origin, - bool emit_localhost_for_anyaddress) - : UDPPort(thread, - factory, - network, - ip, - min_port, - max_port, - username, - password, - origin, - emit_localhost_for_anyaddress) {} - - bool sent_binding_response_ = false; -}; - -class FakePortAllocatorSession : public PortAllocatorSession { - public: - FakePortAllocatorSession(rtc::Thread* worker_thread, - rtc::PacketSocketFactory* factory, - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd) - : PortAllocatorSession(content_name, component, ice_ufrag, ice_pwd, - cricket::kDefaultPortAllocatorFlags), - worker_thread_(worker_thread), - factory_(factory), - network_("network", "unittest", - rtc::IPAddress(INADDR_LOOPBACK), 8), - port_(), running_(false), - port_config_count_(0) { - network_.AddIP(rtc::IPAddress(INADDR_LOOPBACK)); - } - - virtual void StartGettingPorts() { - if (!port_) { - port_.reset(TestUDPPort::Create(worker_thread_, factory_, &network_, - network_.GetBestIP(), 0, 0, username(), - password(), std::string(), false)); - AddPort(port_.get()); - } - ++port_config_count_; - running_ = true; - } - - virtual void StopGettingPorts() { running_ = false; } - virtual bool IsGettingPorts() { return running_; } - virtual void ClearGettingPorts() {} - - int port_config_count() { return port_config_count_; } - - void AddPort(cricket::Port* port) { - port->set_component(component_); - port->set_generation(0); - port->SignalPortComplete.connect( - this, &FakePortAllocatorSession::OnPortComplete); - port->PrepareAddress(); - SignalPortReady(this, port); - } - void OnPortComplete(cricket::Port* port) { - SignalCandidatesReady(this, port->Candidates()); - SignalCandidatesAllocationDone(this); - } - - private: - rtc::Thread* worker_thread_; - rtc::PacketSocketFactory* factory_; - rtc::Network network_; - rtc::scoped_ptr port_; - bool running_; - int port_config_count_; -}; - -class FakePortAllocator : public cricket::PortAllocator { - public: - FakePortAllocator(rtc::Thread* worker_thread, - rtc::PacketSocketFactory* factory) - : worker_thread_(worker_thread), factory_(factory) { - if (factory_ == NULL) { - owned_factory_.reset(new rtc::BasicPacketSocketFactory( - worker_thread_)); - factory_ = owned_factory_.get(); - } - } - - void SetIceServers( - const ServerAddresses& stun_servers, - const std::vector& turn_servers) override { - stun_servers_ = stun_servers; - turn_servers_ = turn_servers; - } - - const ServerAddresses& stun_servers() const { return stun_servers_; } - - const std::vector& turn_servers() const { - return turn_servers_; - } - - virtual cricket::PortAllocatorSession* CreateSessionInternal( - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd) override { - return new FakePortAllocatorSession( - worker_thread_, factory_, content_name, component, ice_ufrag, ice_pwd); - } - - private: - rtc::Thread* worker_thread_; - rtc::PacketSocketFactory* factory_; - rtc::scoped_ptr owned_factory_; - ServerAddresses stun_servers_; - std::vector turn_servers_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_CLIENT_FAKEPORTALLOCATOR_H_ diff --git a/include/webrtc/p2p/client/httpportallocator.h b/include/webrtc/p2p/client/httpportallocator.h deleted file mode 100644 index e527659..0000000 --- a/include/webrtc/p2p/client/httpportallocator.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_CLIENT_HTTPPORTALLOCATOR_H_ -#define WEBRTC_P2P_CLIENT_HTTPPORTALLOCATOR_H_ - -#include -#include -#include - -#include "webrtc/p2p/client/basicportallocator.h" - -class HttpPortAllocatorTest_TestSessionRequestUrl_Test; - -namespace rtc { -class AsyncHttpRequest; -class SignalThread; -} - -namespace cricket { - -// TODO(pthatcher): Remove this. It's only used by chromoting, so we -// should just move this code there. It's used in these places in -// chromium: -// src/remoting/protocol/chromium_port_allocator.cc -// src/remoting/client/plugin/pepper_port_allocator.cc -// src/remoting/protocol/libjingle_transport_factory.cc -class HttpPortAllocatorBase : public BasicPortAllocator { - public: - // The number of HTTP requests we should attempt before giving up. - static const int kNumRetries; - - // Records the URL that we will GET in order to create a session. - static const char kCreateSessionURL[]; - - HttpPortAllocatorBase(rtc::NetworkManager* network_manager, - const std::string& user_agent); - HttpPortAllocatorBase(rtc::NetworkManager* network_manager, - rtc::PacketSocketFactory* socket_factory, - const std::string& user_agent); - virtual ~HttpPortAllocatorBase(); - - // CreateSession is defined in BasicPortAllocator but is - // redefined here as pure virtual. - virtual PortAllocatorSession* CreateSessionInternal( - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd) = 0; - - void SetStunHosts(const std::vector& hosts) { - if (!hosts.empty()) { - stun_hosts_ = hosts; - } - } - void SetRelayHosts(const std::vector& hosts) { - if (!hosts.empty()) { - relay_hosts_ = hosts; - } - } - void SetRelayToken(const std::string& relay) { relay_token_ = relay; } - - const std::vector& stun_hosts() const { - return stun_hosts_; - } - - const std::vector& relay_hosts() const { - return relay_hosts_; - } - - const std::string& relay_token() const { - return relay_token_; - } - - const std::string& user_agent() const { - return agent_; - } - - private: - std::vector stun_hosts_; - std::vector relay_hosts_; - std::string relay_token_; - std::string agent_; -}; - -class RequestData; - -class HttpPortAllocatorSessionBase : public BasicPortAllocatorSession { - public: - HttpPortAllocatorSessionBase( - HttpPortAllocatorBase* allocator, - const std::string& content_name, - int component, - const std::string& ice_ufrag, - const std::string& ice_pwd, - const std::vector& stun_hosts, - const std::vector& relay_hosts, - const std::string& relay, - const std::string& agent); - virtual ~HttpPortAllocatorSessionBase(); - - const std::string& relay_token() const { - return relay_token_; - } - - const std::string& user_agent() const { - return agent_; - } - - virtual void SendSessionRequest(const std::string& host, int port) = 0; - virtual void ReceiveSessionResponse(const std::string& response); - - // Made public for testing. Should be protected. - std::string GetSessionRequestUrl(); - - protected: - virtual void GetPortConfigurations(); - void TryCreateRelaySession(); - virtual HttpPortAllocatorBase* allocator() { - return static_cast( - BasicPortAllocatorSession::allocator()); - } - - private: - std::vector relay_hosts_; - std::vector stun_hosts_; - std::string relay_token_; - std::string agent_; - int attempts_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_CLIENT_HTTPPORTALLOCATOR_H_ diff --git a/include/webrtc/p2p/client/socketmonitor.h b/include/webrtc/p2p/client/socketmonitor.h deleted file mode 100644 index eb11516..0000000 --- a/include/webrtc/p2p/client/socketmonitor.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_CLIENT_SOCKETMONITOR_H_ -#define WEBRTC_P2P_CLIENT_SOCKETMONITOR_H_ - -#include - -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/sigslot.h" -#include "webrtc/base/thread.h" -#include "webrtc/p2p/base/transport.h" // for ConnectionInfos - -// TODO(pthatcher): Move these to connectionmonitor.h and -// connectionmonitor.cc, or just move them into channel.cc - -namespace cricket { - -class ConnectionStatsGetter { - public: - virtual ~ConnectionStatsGetter() {} - virtual bool GetConnectionStats(ConnectionInfos* infos) = 0; -}; - -class ConnectionMonitor : public rtc::MessageHandler, - public sigslot::has_slots<> { -public: - ConnectionMonitor(ConnectionStatsGetter* stats_getter, - rtc::Thread* worker_thread, - rtc::Thread* monitoring_thread); - ~ConnectionMonitor(); - - void Start(int cms); - void Stop(); - - sigslot::signal2&> SignalUpdate; - - protected: - void OnMessage(rtc::Message* message); - private: - void PollConnectionStats_w(); - - std::vector connection_infos_; - ConnectionStatsGetter* stats_getter_; - rtc::Thread* worker_thread_; - rtc::Thread* monitoring_thread_; - rtc::CriticalSection crit_; - uint32_t rate_; - bool monitoring_; -}; - -} // namespace cricket - -#endif // WEBRTC_P2P_CLIENT_SOCKETMONITOR_H_ diff --git a/include/webrtc/p2p/stunprober/stunprober.h b/include/webrtc/p2p/stunprober/stunprober.h deleted file mode 100644 index b725cbe..0000000 --- a/include/webrtc/p2p/stunprober/stunprober.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_P2P_STUNPROBER_STUNPROBER_H_ -#define WEBRTC_P2P_STUNPROBER_STUNPROBER_H_ - -#include -#include -#include - -#include "webrtc/base/asyncinvoker.h" -#include "webrtc/base/basictypes.h" -#include "webrtc/base/bytebuffer.h" -#include "webrtc/base/callback.h" -#include "webrtc/base/ipaddress.h" -#include "webrtc/base/network.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/socketaddress.h" -#include "webrtc/base/thread.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/typedefs.h" - -namespace rtc { -class AsyncPacketSocket; -class PacketSocketFactory; -class Thread; -class NetworkManager; -class AsyncResolverInterface; -} // namespace rtc - -namespace stunprober { - -class StunProber; - -static const int kMaxUdpBufferSize = 1200; - -typedef rtc::Callback2 AsyncCallback; - -enum NatType { - NATTYPE_INVALID, - NATTYPE_NONE, // Not behind a NAT. - NATTYPE_UNKNOWN, // Behind a NAT but type can't be determine. - NATTYPE_SYMMETRIC, // Behind a symmetric NAT. - NATTYPE_NON_SYMMETRIC // Behind a non-symmetric NAT. -}; - -class StunProber : public sigslot::has_slots<> { - public: - enum Status { // Used in UMA_HISTOGRAM_ENUMERATION. - SUCCESS, // Successfully received bytes from the server. - GENERIC_FAILURE, // Generic failure. - RESOLVE_FAILED, // Host resolution failed. - WRITE_FAILED, // Sending a message to the server failed. - READ_FAILED, // Reading the reply from the server failed. - }; - - class Observer { - public: - virtual ~Observer() = default; - virtual void OnPrepared(StunProber* prober, StunProber::Status status) = 0; - virtual void OnFinished(StunProber* prober, StunProber::Status status) = 0; - }; - - struct Stats { - Stats() {} - - // |raw_num_request_sent| is the total number of requests - // sent. |num_request_sent| is the count of requests against a server where - // we see at least one response. |num_request_sent| is designed to protect - // against DNS resolution failure or the STUN server is not responsive - // which could skew the result. - int raw_num_request_sent = 0; - int num_request_sent = 0; - - int num_response_received = 0; - NatType nat_type = NATTYPE_INVALID; - int average_rtt_ms = -1; - int success_percent = 0; - int target_request_interval_ns = 0; - int actual_request_interval_ns = 0; - - // Also report whether this trial can't be considered truly as shared - // mode. Share mode only makes sense when we have multiple IP resolved and - // successfully probed. - bool shared_socket_mode = false; - - std::string host_ip; - - // If the srflx_addrs has more than 1 element, the NAT is symmetric. - std::set srflx_addrs; - }; - - StunProber(rtc::PacketSocketFactory* socket_factory, - rtc::Thread* thread, - const rtc::NetworkManager::NetworkList& networks); - virtual ~StunProber(); - - // Begin performing the probe test against the |servers|. If - // |shared_socket_mode| is false, each request will be done with a new socket. - // Otherwise, a unique socket will be used for a single round of requests - // against all resolved IPs. No single socket will be used against a given IP - // more than once. The interval of requests will be as close to the requested - // inter-probe interval |stun_ta_interval_ms| as possible. After sending out - // the last scheduled request, the probe will wait |timeout_ms| for request - // responses and then call |finish_callback|. |requests_per_ip| indicates how - // many requests should be tried for each resolved IP address. In shared mode, - // (the number of sockets to be created) equals to |requests_per_ip|. In - // non-shared mode, (the number of sockets) equals to requests_per_ip * (the - // number of resolved IP addresses). TODO(guoweis): Remove this once - // everything moved to Prepare() and Run(). - bool Start(const std::vector& servers, - bool shared_socket_mode, - int stun_ta_interval_ms, - int requests_per_ip, - int timeout_ms, - const AsyncCallback finish_callback); - - // TODO(guoweis): The combination of Prepare() and Run() are equivalent to the - // Start() above. Remove Start() once everything is migrated. - bool Prepare(const std::vector& servers, - bool shared_socket_mode, - int stun_ta_interval_ms, - int requests_per_ip, - int timeout_ms, - StunProber::Observer* observer); - - // Start to send out the STUN probes. - bool Start(StunProber::Observer* observer); - - // Method to retrieve the Stats once |finish_callback| is invoked. Returning - // false when the result is inconclusive, for example, whether it's behind a - // NAT or not. - bool GetStats(Stats* stats) const; - - int estimated_execution_time() { - return static_cast(requests_per_ip_ * all_servers_addrs_.size() * - interval_ms_); - } - - private: - // A requester tracks the requests and responses from a single socket to many - // STUN servers. - class Requester; - - // TODO(guoweis): Remove this once all dependencies move away from - // AsyncCallback. - class ObserverAdapter : public Observer { - public: - void set_callback(AsyncCallback callback) { callback_ = callback; } - void OnPrepared(StunProber* stunprober, Status status) { - if (status == SUCCESS) { - stunprober->Start(this); - } else { - callback_(stunprober, status); - } - } - void OnFinished(StunProber* stunprober, Status status) { - callback_(stunprober, status); - } - - private: - AsyncCallback callback_; - }; - - bool ResolveServerName(const rtc::SocketAddress& addr); - void OnServerResolved(rtc::AsyncResolverInterface* resolver); - - void OnSocketReady(rtc::AsyncPacketSocket* socket, - const rtc::SocketAddress& addr); - - bool Done() { - return num_request_sent_ >= requests_per_ip_ * all_servers_addrs_.size(); - } - - size_t total_socket_required() { - return (shared_socket_mode_ ? 1 : all_servers_addrs_.size()) * - requests_per_ip_; - } - - bool should_send_next_request(uint32_t now); - int get_wake_up_interval_ms(); - - bool SendNextRequest(); - - // Will be invoked in 1ms intervals and schedule the next request from the - // |current_requester_| if the time has passed for another request. - void MaybeScheduleStunRequests(); - - void ReportOnPrepared(StunProber::Status status); - void ReportOnFinished(StunProber::Status status); - - Requester* CreateRequester(); - - Requester* current_requester_ = nullptr; - - // The time when the next request should go out. - uint64_t next_request_time_ms_ = 0; - - // Total requests sent so far. - uint32_t num_request_sent_ = 0; - - bool shared_socket_mode_ = false; - - // How many requests should be done against each resolved IP. - uint32_t requests_per_ip_ = 0; - - // Milliseconds to pause between each STUN request. - int interval_ms_; - - // Timeout period after the last request is sent. - int timeout_ms_; - - // STUN server name to be resolved. - std::vector servers_; - - // Weak references. - rtc::PacketSocketFactory* socket_factory_; - rtc::Thread* thread_; - - // Accumulate all resolved addresses. - std::vector all_servers_addrs_; - - // The set of STUN probe sockets and their state. - std::vector requesters_; - - rtc::ThreadChecker thread_checker_; - - // Temporary storage for created sockets. - std::vector sockets_; - // This tracks how many of the sockets are ready. - size_t total_ready_sockets_ = 0; - - rtc::AsyncInvoker invoker_; - - Observer* observer_ = nullptr; - // TODO(guoweis): Remove this once all dependencies move away from - // AsyncCallback. - ObserverAdapter observer_adapter_; - - rtc::NetworkManager::NetworkList networks_; - - RTC_DISALLOW_COPY_AND_ASSIGN(StunProber); -}; - -} // namespace stunprober - -#endif // WEBRTC_P2P_STUNPROBER_STUNPROBER_H_ diff --git a/include/webrtc/stream.h b/include/webrtc/stream.h deleted file mode 100644 index 5afab0f..0000000 --- a/include/webrtc/stream.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef WEBRTC_STREAM_H_ -#define WEBRTC_STREAM_H_ - -#include "webrtc/common_types.h" - -namespace webrtc { - -enum NetworkState { - kNetworkUp, - kNetworkDown, -}; - -// Common base class for streams. -class Stream { - public: - // Starts stream activity. - // When a stream is active, it can receive, process and deliver packets. - virtual void Start() = 0; - // Stops stream activity. - // When a stream is stopped, it can't receive, process or deliver packets. - virtual void Stop() = 0; - // Called to notify that network state has changed, so that the stream can - // respond, e.g. by pausing or resuming activity. - virtual void SignalNetworkState(NetworkState state) = 0; - // Called when a RTCP packet is received. - virtual bool DeliverRtcp(const uint8_t* packet, size_t length) = 0; - - protected: - virtual ~Stream() {} -}; - -// Common base class for receive streams. -class ReceiveStream : public Stream { - public: - // Called when a RTP packet is received. - virtual bool DeliverRtp(const uint8_t* packet, - size_t length, - const PacketTime& packet_time) = 0; -}; - -// Common base class for send streams. -// A tag class that denotes send stream type. -class SendStream : public Stream {}; - -} // namespace webrtc - -#endif // WEBRTC_STREAM_H_ diff --git a/include/webrtc/system_wrappers/include/aligned_array.h b/include/webrtc/system_wrappers/include/aligned_array.h deleted file mode 100644 index 7cd182c..0000000 --- a/include/webrtc/system_wrappers/include/aligned_array.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ - -#include "webrtc/base/checks.h" -#include "webrtc/system_wrappers/include/aligned_malloc.h" - -namespace webrtc { - -// Wrapper class for aligned arrays. Every row (and the first dimension) are -// aligned to the given byte alignment. -template class AlignedArray { - public: - AlignedArray(int rows, size_t cols, int alignment) - : rows_(rows), - cols_(cols), - alignment_(alignment) { - RTC_CHECK_GT(alignment_, 0); - head_row_ = static_cast(AlignedMalloc(rows_ * sizeof(*head_row_), - alignment_)); - for (int i = 0; i < rows_; ++i) { - head_row_[i] = static_cast(AlignedMalloc(cols_ * sizeof(**head_row_), - alignment_)); - } - } - - ~AlignedArray() { - for (int i = 0; i < rows_; ++i) { - AlignedFree(head_row_[i]); - } - AlignedFree(head_row_); - } - - T* const* Array() { - return head_row_; - } - - const T* const* Array() const { - return head_row_; - } - - T* Row(int row) { - RTC_CHECK_LE(row, rows_); - return head_row_[row]; - } - - const T* Row(int row) const { - RTC_CHECK_LE(row, rows_); - return head_row_[row]; - } - - T& At(int row, size_t col) { - RTC_CHECK_LE(col, cols_); - return Row(row)[col]; - } - - const T& At(int row, size_t col) const { - RTC_CHECK_LE(col, cols_); - return Row(row)[col]; - } - - int rows() const { - return rows_; - } - - size_t cols() const { - return cols_; - } - - private: - int rows_; - size_t cols_; - int alignment_; - T** head_row_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ diff --git a/include/webrtc/system_wrappers/include/aligned_malloc.h b/include/webrtc/system_wrappers/include/aligned_malloc.h deleted file mode 100644 index 277abec..0000000 --- a/include/webrtc/system_wrappers/include/aligned_malloc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ - -// The functions declared here -// 1) Allocates block of aligned memory. -// 2) Re-calculates a pointer such that it is aligned to a higher or equal -// address. -// Note: alignment must be a power of two. The alignment is in bytes. - -#include - -namespace webrtc { - -// Returns a pointer to the first boundry of |alignment| bytes following the -// address of |ptr|. -// Note that there is no guarantee that the memory in question is available. -// |ptr| has no requirements other than it can't be NULL. -void* GetRightAlign(const void* ptr, size_t alignment); - -// Allocates memory of |size| bytes aligned on an |alignment| boundry. -// The return value is a pointer to the memory. Note that the memory must -// be de-allocated using AlignedFree. -void* AlignedMalloc(size_t size, size_t alignment); -// De-allocates memory created using the AlignedMalloc() API. -void AlignedFree(void* mem_block); - -// Templated versions to facilitate usage of aligned malloc without casting -// to and from void*. -template -T* GetRightAlign(const T* ptr, size_t alignment) { - return reinterpret_cast(GetRightAlign(reinterpret_cast(ptr), - alignment)); -} -template -T* AlignedMalloc(size_t size, size_t alignment) { - return reinterpret_cast(AlignedMalloc(size, alignment)); -} - -// Deleter for use with scoped_ptr. E.g., use as -// scoped_ptr foo; -struct AlignedFreeDeleter { - inline void operator()(void* ptr) const { - AlignedFree(ptr); - } -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ diff --git a/include/webrtc/system_wrappers/include/asm_defines.h b/include/webrtc/system_wrappers/include/asm_defines.h deleted file mode 100644 index fe4c05e..0000000 --- a/include/webrtc/system_wrappers/include/asm_defines.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ASM_DEFINES_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ASM_DEFINES_H_ - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif - -// Define the macros used in ARM assembly code, so that for Mac or iOS builds -// we add leading underscores for the function names. -#ifdef __APPLE__ -.macro GLOBAL_FUNCTION name -.global _\name -.private_extern _\name -.endm -.macro DEFINE_FUNCTION name -_\name: -.endm -.macro CALL_FUNCTION name -bl _\name -.endm -.macro GLOBAL_LABEL name -.global _\name -.private_extern _\name -.endm -#else -.macro GLOBAL_FUNCTION name -.global \name -.hidden \name -.endm -.macro DEFINE_FUNCTION name -#if defined(__linux__) && defined(__ELF__) -.type \name,%function -#endif -\name: -.endm -.macro CALL_FUNCTION name -bl \name -.endm -.macro GLOBAL_LABEL name -.global \name -.hidden \name -.endm -#endif - -// With Apple's clang compiler, for instructions ldrb, strh, etc., -// the condition code is after the width specifier. Here we define -// only the ones that are actually used in the assembly files. -#if (defined __llvm__) && (defined __APPLE__) -.macro streqh reg1, reg2, num -strheq \reg1, \reg2, \num -.endm -#endif - -.text - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ASM_DEFINES_H_ diff --git a/include/webrtc/system_wrappers/include/atomic32.h b/include/webrtc/system_wrappers/include/atomic32.h deleted file mode 100644 index 78e649d..0000000 --- a/include/webrtc/system_wrappers/include/atomic32.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Atomic, system independent 32-bit integer. Unless you know what you're -// doing, use locks instead! :-) -// -// Note: assumes 32-bit (or higher) system -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ATOMIC32_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ATOMIC32_H_ - -#include - -#include "webrtc/base/constructormagic.h" -#include "webrtc/common_types.h" - -namespace webrtc { - -// 32 bit atomic variable. Note that this class relies on the compiler to -// align the 32 bit value correctly (on a 32 bit boundary), so as long as you're -// not doing things like reinterpret_cast over some custom allocated memory -// without being careful with alignment, you should be fine. -class Atomic32 { - public: - Atomic32(int32_t initial_value = 0); - ~Atomic32(); - - // Prefix operator! - int32_t operator++(); - int32_t operator--(); - - int32_t operator+=(int32_t value); - int32_t operator-=(int32_t value); - - // Sets the value atomically to new_value if the value equals compare value. - // The function returns true if the exchange happened. - bool CompareExchange(int32_t new_value, int32_t compare_value); - int32_t Value() { - return *this += 0; - } - - private: - // Disable the + and - operator since it's unclear what these operations - // should do. - Atomic32 operator+(const Atomic32& other); - Atomic32 operator-(const Atomic32& other); - - // Checks if |_value| is 32bit aligned. - inline bool Is32bitAligned() const { - return (reinterpret_cast(&value_) & 3) == 0; - } - - RTC_DISALLOW_COPY_AND_ASSIGN(Atomic32); - - int32_t value_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ATOMIC32_H_ diff --git a/include/webrtc/system_wrappers/include/clock.h b/include/webrtc/system_wrappers/include/clock.h deleted file mode 100644 index f443057..0000000 --- a/include/webrtc/system_wrappers/include/clock.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_ - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -// January 1970, in NTP seconds. -const uint32_t kNtpJan1970 = 2208988800UL; - -// Magic NTP fractional unit. -const double kMagicNtpFractionalUnit = 4.294967296E+9; - -// A clock interface that allows reading of absolute and relative timestamps. -class Clock { - public: - virtual ~Clock() {} - - // Return a timestamp in milliseconds relative to some arbitrary source; the - // source is fixed for this clock. - virtual int64_t TimeInMilliseconds() const = 0; - - // Return a timestamp in microseconds relative to some arbitrary source; the - // source is fixed for this clock. - virtual int64_t TimeInMicroseconds() const = 0; - - // Retrieve an NTP absolute timestamp in seconds and fractions of a second. - virtual void CurrentNtp(uint32_t& seconds, uint32_t& fractions) const = 0; - - // Retrieve an NTP absolute timestamp in milliseconds. - virtual int64_t CurrentNtpInMilliseconds() const = 0; - - // Converts an NTP timestamp to a millisecond timestamp. - static int64_t NtpToMs(uint32_t seconds, uint32_t fractions); - - // Returns an instance of the real-time system clock implementation. - static Clock* GetRealTimeClock(); -}; - -class SimulatedClock : public Clock { - public: - explicit SimulatedClock(int64_t initial_time_us); - - ~SimulatedClock() override; - - // Return a timestamp in milliseconds relative to some arbitrary source; the - // source is fixed for this clock. - int64_t TimeInMilliseconds() const override; - - // Return a timestamp in microseconds relative to some arbitrary source; the - // source is fixed for this clock. - int64_t TimeInMicroseconds() const override; - - // Retrieve an NTP absolute timestamp in milliseconds. - void CurrentNtp(uint32_t& seconds, uint32_t& fractions) const override; - - // Converts an NTP timestamp to a millisecond timestamp. - int64_t CurrentNtpInMilliseconds() const override; - - // Advance the simulated clock with a given number of milliseconds or - // microseconds. - void AdvanceTimeMilliseconds(int64_t milliseconds); - void AdvanceTimeMicroseconds(int64_t microseconds); - - private: - int64_t time_us_; - rtc::scoped_ptr lock_; -}; - -}; // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_ diff --git a/include/webrtc/system_wrappers/include/compile_assert_c.h b/include/webrtc/system_wrappers/include/compile_assert_c.h deleted file mode 100644 index b402d71..0000000 --- a/include/webrtc/system_wrappers/include/compile_assert_c.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_ - -#ifdef __cplusplus -#error "Only use this for C files. For C++, use static_assert." -#endif - -// Use this macro to verify at compile time that certain restrictions are met. -// The argument is the boolean expression to evaluate. -// Example: -// COMPILE_ASSERT(sizeof(foo) < 128); -#define COMPILE_ASSERT(expression) switch (0) {case 0: case expression:;} - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_ diff --git a/include/webrtc/system_wrappers/include/condition_variable_wrapper.h b/include/webrtc/system_wrappers/include/condition_variable_wrapper.h deleted file mode 100644 index 37ca30f..0000000 --- a/include/webrtc/system_wrappers/include/condition_variable_wrapper.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CONDITION_VARIABLE_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CONDITION_VARIABLE_WRAPPER_H_ - -namespace webrtc { - -class CriticalSectionWrapper; - -class ConditionVariableWrapper { - public: - // Factory method, constructor disabled. - static ConditionVariableWrapper* CreateConditionVariable(); - - virtual ~ConditionVariableWrapper() {} - - // Calling thread will atomically release crit_sect and wait until next - // some other thread calls Wake() or WakeAll(). - virtual void SleepCS(CriticalSectionWrapper& crit_sect) = 0; - - // Same as above but with a timeout. - virtual bool SleepCS(CriticalSectionWrapper& crit_sect, - unsigned long max_time_in_ms) = 0; - - // Wakes one thread calling SleepCS(). - virtual void Wake() = 0; - - // Wakes all threads calling SleepCS(). - virtual void WakeAll() = 0; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CONDITION_VARIABLE_WRAPPER_H_ diff --git a/include/webrtc/system_wrappers/include/cpu_features_wrapper.h b/include/webrtc/system_wrappers/include/cpu_features_wrapper.h deleted file mode 100644 index 9838d94..0000000 --- a/include/webrtc/system_wrappers/include/cpu_features_wrapper.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include "webrtc/typedefs.h" - -// List of features in x86. -typedef enum { - kSSE2, - kSSE3 -} CPUFeature; - -// List of features in ARM. -enum { - kCPUFeatureARMv7 = (1 << 0), - kCPUFeatureVFPv3 = (1 << 1), - kCPUFeatureNEON = (1 << 2), - kCPUFeatureLDREXSTREX = (1 << 3) -}; - -typedef int (*WebRtc_CPUInfo)(CPUFeature feature); - -// Returns true if the CPU supports the feature. -extern WebRtc_CPUInfo WebRtc_GetCPUInfo; - -// No CPU feature is available => straight C path. -extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM; - -// Return the features in an ARM device. -// It detects the features in the hardware platform, and returns supported -// values in the above enum definition as a bitmask. -extern uint64_t WebRtc_GetCPUFeaturesARM(void); - -#if defined(__cplusplus) || defined(c_plusplus) -} // extern "C" -#endif - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ diff --git a/include/webrtc/system_wrappers/include/cpu_info.h b/include/webrtc/system_wrappers/include/cpu_info.h deleted file mode 100644 index 3c00d33..0000000 --- a/include/webrtc/system_wrappers/include/cpu_info.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_INFO_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_INFO_H_ - -#include "webrtc/typedefs.h" - -namespace webrtc { - -class CpuInfo { - public: - static uint32_t DetectNumberOfCores(); - - private: - CpuInfo() {} -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_INFO_H_ diff --git a/include/webrtc/system_wrappers/include/critical_section_wrapper.h b/include/webrtc/system_wrappers/include/critical_section_wrapper.h deleted file mode 100644 index 7dd217e..0000000 --- a/include/webrtc/system_wrappers/include/critical_section_wrapper.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CRITICAL_SECTION_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CRITICAL_SECTION_WRAPPER_H_ - -// If the critical section is heavily contended it may be beneficial to use -// read/write locks instead. - -#include "webrtc/base/thread_annotations.h" -#include "webrtc/common_types.h" - -namespace webrtc { -class LOCKABLE CriticalSectionWrapper { - public: - // Factory method, constructor disabled - static CriticalSectionWrapper* CreateCriticalSection(); - - virtual ~CriticalSectionWrapper() {} - - // Tries to grab lock, beginning of a critical section. Will wait for the - // lock to become available if the grab failed. - virtual void Enter() EXCLUSIVE_LOCK_FUNCTION() = 0; - - // Returns a grabbed lock, end of critical section. - virtual void Leave() UNLOCK_FUNCTION() = 0; -}; - -// RAII extension of the critical section. Prevents Enter/Leave mismatches and -// provides more compact critical section syntax. -class SCOPED_LOCKABLE CriticalSectionScoped { - public: - explicit CriticalSectionScoped(CriticalSectionWrapper* critsec) - EXCLUSIVE_LOCK_FUNCTION(critsec) - : ptr_crit_sec_(critsec) { - ptr_crit_sec_->Enter(); - } - - ~CriticalSectionScoped() UNLOCK_FUNCTION() { ptr_crit_sec_->Leave(); } - - private: - CriticalSectionWrapper* ptr_crit_sec_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CRITICAL_SECTION_WRAPPER_H_ diff --git a/include/webrtc/system_wrappers/include/data_log.h b/include/webrtc/system_wrappers/include/data_log.h deleted file mode 100644 index f6cad88..0000000 --- a/include/webrtc/system_wrappers/include/data_log.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This singleton can be used for logging data for offline processing. Data -// logged with it can conveniently be parsed and processed with e.g. Matlab. -// -// Following is an example of the log file format, starting with the header -// row at line 1, and the data rows following. -// col1,col2,col3,multi-value-col4[3],,,col5 -// 123,10.2,-243,1,2,3,100 -// 241,12.3,233,1,2,3,200 -// 13,16.4,-13,1,2,3,300 -// -// As can be seen in the example, a multi-value-column is specified with the -// name followed the number of elements it contains. This followed by -// number of elements - 1 empty columns. -// -// Without multi-value-columns this format can be natively by Matlab. With -// multi-value-columns a small Matlab script is needed, available at -// trunk/tools/matlab/parseLog.m. -// -// Table names and column names are case sensitive. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_H_ - -#include - -#include "webrtc/system_wrappers/include/data_log_impl.h" - -namespace webrtc { - -class DataLog { - public: - // Creates a log which uses a separate thread (referred to as the file - // writer thread) for writing log rows to file. - // - // Calls to this function after the log object has been created will only - // increment the reference counter. - static int CreateLog(); - - // Decrements the reference counter and deletes the log when the counter - // reaches 0. Should be called equal number of times as successful calls to - // CreateLog or memory leak will occur. - static void ReturnLog(); - - // Combines the string table_name and the integer table_id into a new string - // table_name + _ + table_id. The new string will be lower-case. - static std::string Combine(const std::string& table_name, int table_id); - - // Adds a new table, with the name table_name, and creates the file, with the - // name table_name + ".txt", to which the table will be written. - // table_name is treated in a case sensitive way. - static int AddTable(const std::string& table_name); - - // Adds a new column to a table. The column will be a multi-value-column - // if multi_value_length is greater than 1. - // table_name and column_name are treated in a case sensitive way. - static int AddColumn(const std::string& table_name, - const std::string& column_name, - int multi_value_length); - - // Inserts a single value into a table with name table_name at the column with - // name column_name. - // Note that the ValueContainer makes use of the copy constructor, - // operator= and operator<< of the type T, and that the template type must - // implement a deep copy copy constructor and operator=. - // Copy constructor and operator= must not be disabled for the type T. - // table_name and column_name are treated in a case sensitive way. - template - static int InsertCell(const std::string& table_name, - const std::string& column_name, - T value) { - DataLogImpl* data_log = DataLogImpl::StaticInstance(); - if (data_log == NULL) - return -1; - return data_log->InsertCell( - table_name, - column_name, - new ValueContainer(value)); - } - - // Inserts an array of values into a table with name table_name at the - // column specified by column_name, which must be a multi-value-column. - // Note that the MultiValueContainer makes use of the copy constructor, - // operator= and operator<< of the type T, and that the template type - // must implement a deep copy copy constructor and operator=. - // Copy constructor and operator= must not be disabled for the type T. - // table_name and column_name are treated in a case sensitive way. - template - static int InsertCell(const std::string& table_name, - const std::string& column_name, - const T* array, - int length) { - DataLogImpl* data_log = DataLogImpl::StaticInstance(); - if (data_log == NULL) - return -1; - return data_log->InsertCell( - table_name, - column_name, - new MultiValueContainer(array, length)); - } - - // For the table with name table_name: Writes the current row to file. - // Starts a new empty row. - // table_name is treated in a case-sensitive way. - static int NextRow(const std::string& table_name); -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_H_ diff --git a/include/webrtc/system_wrappers/include/data_log_c.h b/include/webrtc/system_wrappers/include/data_log_c.h deleted file mode 100644 index d31e4d9..0000000 --- a/include/webrtc/system_wrappers/include/data_log_c.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This is a pure C wrapper of the DataLog class. The functions are directly -// mapped here except for InsertCell as C does not support templates. -// See data_log.h for a description of the functions. - -#ifndef SRC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_C_H_ -#define SRC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_C_H_ - -#include // size_t - -#include "webrtc/typedefs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// All char* parameters in this file are expected to be null-terminated -// character sequences. -int WebRtcDataLog_CreateLog(); -void WebRtcDataLog_ReturnLog(); -char* WebRtcDataLog_Combine(char* combined_name, size_t combined_len, - const char* table_name, int table_id); -int WebRtcDataLog_AddTable(const char* table_name); -int WebRtcDataLog_AddColumn(const char* table_name, const char* column_name, - int multi_value_length); - -int WebRtcDataLog_InsertCell_int(const char* table_name, - const char* column_name, - int value); -int WebRtcDataLog_InsertArray_int(const char* table_name, - const char* column_name, - const int* values, - int length); -int WebRtcDataLog_InsertCell_float(const char* table_name, - const char* column_name, - float value); -int WebRtcDataLog_InsertArray_float(const char* table_name, - const char* column_name, - const float* values, - int length); -int WebRtcDataLog_InsertCell_double(const char* table_name, - const char* column_name, - double value); -int WebRtcDataLog_InsertArray_double(const char* table_name, - const char* column_name, - const double* values, - int length); -int WebRtcDataLog_InsertCell_int32(const char* table_name, - const char* column_name, - int32_t value); -int WebRtcDataLog_InsertArray_int32(const char* table_name, - const char* column_name, - const int32_t* values, - int length); -int WebRtcDataLog_InsertCell_uint32(const char* table_name, - const char* column_name, - uint32_t value); -int WebRtcDataLog_InsertArray_uint32(const char* table_name, - const char* column_name, - const uint32_t* values, - int length); -int WebRtcDataLog_InsertCell_int64(const char* table_name, - const char* column_name, - int64_t value); -int WebRtcDataLog_InsertArray_int64(const char* table_name, - const char* column_name, - const int64_t* values, - int length); - -int WebRtcDataLog_NextRow(const char* table_name); - -#ifdef __cplusplus -} // end of extern "C" -#endif - -#endif // SRC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_C_H_ // NOLINT diff --git a/include/webrtc/system_wrappers/include/data_log_impl.h b/include/webrtc/system_wrappers/include/data_log_impl.h deleted file mode 100644 index 3551960..0000000 --- a/include/webrtc/system_wrappers/include/data_log_impl.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This file contains the helper classes for the DataLog APIs. See data_log.h -// for the APIs. -// -// These classes are helper classes used for logging data for offline -// processing. Data logged with these classes can conveniently be parsed and -// processed with e.g. Matlab. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_IMPL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_IMPL_H_ - -#include -#include -#include -#include - -#include "webrtc/base/platform_thread.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class CriticalSectionWrapper; -class EventWrapper; -class LogTable; -class RWLockWrapper; - -// All container classes need to implement a ToString-function to be -// writable to file. Enforce this via the Container interface. -class Container { - public: - virtual ~Container() {} - - virtual void ToString(std::string* container_string) const = 0; -}; - -template -class ValueContainer : public Container { - public: - explicit ValueContainer(T data) : data_(data) {} - - virtual void ToString(std::string* container_string) const { - *container_string = ""; - std::stringstream ss; - ss << data_ << ","; - ss >> *container_string; - } - - private: - T data_; -}; - -template -class MultiValueContainer : public Container { - public: - MultiValueContainer(const T* data, int length) - : data_(data, data + length) { - } - - virtual void ToString(std::string* container_string) const { - *container_string = ""; - std::stringstream ss; - for (size_t i = 0; i < data_.size(); ++i) - ss << data_[i] << ","; - *container_string += ss.str(); - } - - private: - std::vector data_; -}; - -class DataLogImpl { - public: - ~DataLogImpl(); - - // The implementation of the CreateLog() method declared in data_log.h. - // See data_log.h for a description. - static int CreateLog(); - - // The implementation of the StaticInstance() method declared in data_log.h. - // See data_log.h for a description. - static DataLogImpl* StaticInstance(); - - // The implementation of the ReturnLog() method declared in data_log.h. See - // data_log.h for a description. - static void ReturnLog(); - - // The implementation of the AddTable() method declared in data_log.h. See - // data_log.h for a description. - int AddTable(const std::string& table_name); - - // The implementation of the AddColumn() method declared in data_log.h. See - // data_log.h for a description. - int AddColumn(const std::string& table_name, - const std::string& column_name, - int multi_value_length); - - // Inserts a Container into a table with name table_name at the column - // with name column_name. - // column_name is treated in a case sensitive way. - int InsertCell(const std::string& table_name, - const std::string& column_name, - const Container* value_container); - - // The implementation of the NextRow() method declared in data_log.h. See - // data_log.h for a description. - int NextRow(const std::string& table_name); - - private: - DataLogImpl(); - - // Initializes the DataLogImpl object, allocates and starts the - // thread file_writer_thread_. - int Init(); - - // Write all complete rows in every table to file. - // This function should only be called by the file_writer_thread_ if that - // thread is running to avoid race conditions. - void Flush(); - - // Run() is called by the thread file_writer_thread_. - static bool Run(void* obj); - - // This function writes data to file. Note, it blocks if there is no data - // that should be written to file availble. Flush is the non-blocking - // version of this function. - void Process(); - - // Stops the continuous calling of Process(). - void StopThread(); - - // Collection of tables indexed by the table name as std::string. - typedef std::map TableMap; - typedef rtc::scoped_ptr CritSectScopedPtr; - - static CritSectScopedPtr crit_sect_; - static DataLogImpl* instance_; - int counter_; - TableMap tables_; - EventWrapper* flush_event_; - // This is a scoped_ptr so that we don't have to create threads in the no-op - // impl. - rtc::scoped_ptr file_writer_thread_; - RWLockWrapper* tables_lock_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_IMPL_H_ diff --git a/include/webrtc/system_wrappers/include/event_wrapper.h b/include/webrtc/system_wrappers/include/event_wrapper.h deleted file mode 100644 index cc3722b..0000000 --- a/include/webrtc/system_wrappers/include/event_wrapper.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_ - -namespace webrtc { -enum EventTypeWrapper { - kEventSignaled = 1, - kEventError = 2, - kEventTimeout = 3 -}; - -#define WEBRTC_EVENT_INFINITE 0xffffffff - -class EventTimerWrapper; - -class EventWrapper { - public: - // Factory method. Constructor disabled. - static EventWrapper* Create(); - - virtual ~EventWrapper() {} - - // Releases threads who are calling Wait() and has started waiting. Please - // note that a thread calling Wait() will not start waiting immediately. - // assumptions to the contrary is a very common source of issues in - // multithreaded programming. - // Set is sticky in the sense that it will release at least one thread - // either immediately or some time in the future. - virtual bool Set() = 0; - - // Puts the calling thread into a wait state. The thread may be released - // by a Set() call depending on if other threads are waiting and if so on - // timing. The thread that was released will reset the event before leaving - // preventing more threads from being released. If multiple threads - // are waiting for the same Set(), only one (random) thread is guaranteed to - // be released. It is possible that multiple (random) threads are released - // Depending on timing. - // - // |max_time| is the maximum time to wait in milliseconds or - // WEBRTC_EVENT_INFINITE to wait infinitely. - virtual EventTypeWrapper Wait(unsigned long max_time) = 0; -}; - -class EventTimerWrapper : public EventWrapper { - public: - static EventTimerWrapper* Create(); - - // Starts a timer that will call a non-sticky version of Set() either once - // or periodically. If the timer is periodic it ensures that there is no - // drift over time relative to the system clock. - // - // |time| is in milliseconds. - virtual bool StartTimer(bool periodic, unsigned long time) = 0; - - virtual bool StopTimer() = 0; - -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_ diff --git a/include/webrtc/system_wrappers/include/field_trial.h b/include/webrtc/system_wrappers/include/field_trial.h deleted file mode 100644 index 62fbfd1..0000000 --- a/include/webrtc/system_wrappers/include/field_trial.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FIELD_TRIAL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FIELD_TRIAL_H_ - -#include - -// Field trials allow webrtc clients (such as Chrome) to turn on feature code -// in binaries out in the field and gather information with that. -// -// WebRTC clients MUST provide an implementation of: -// -// std::string webrtc::field_trial::FindFullName(const std::string& trial). -// -// Or link with a default one provided in: -// -// system_wrappers/system_wrappers.gyp:field_trial_default -// -// -// They are designed to wire up directly to chrome field trials and to speed up -// developers by reducing the need to wire APIs to control whether a feature is -// on/off. E.g. to experiment with a new method that could lead to a different -// trade-off between CPU/bandwidth: -// -// 1 - Develop the feature with default behaviour off: -// -// if (FieldTrial::FindFullName("WebRTCExperimenMethod2") == "Enabled") -// method2(); -// else -// method1(); -// -// 2 - Once the changes are rolled to chrome, the new code path can be -// controlled as normal chrome field trials. -// -// 3 - Evaluate the new feature and clean the code paths. -// -// Notes: -// - NOT every feature is a candidate to be controlled by this mechanism as -// it may require negotation between involved parties (e.g. SDP). -// -// TODO(andresp): since chrome --force-fieldtrials does not marks the trial -// as active it does not gets propaged to renderer process. For now one -// needs to push a config with start_active:true or run a local finch -// server. -// -// TODO(andresp): find out how to get bots to run tests with trials enabled. - -namespace webrtc { -namespace field_trial { - -// Returns the group name chosen for the named trial, or the empty string -// if the trial does not exists. -// -// Note: To keep things tidy append all the trial names with WebRTC. -std::string FindFullName(const std::string& name); - -} // namespace field_trial -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FIELD_TRIAL_H_ diff --git a/include/webrtc/system_wrappers/include/field_trial_default.h b/include/webrtc/system_wrappers/include/field_trial_default.h deleted file mode 100644 index d098ea1..0000000 --- a/include/webrtc/system_wrappers/include/field_trial_default.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FIELD_TRIAL_DEFAULT_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FIELD_TRIAL_DEFAULT_H_ - -namespace webrtc { -namespace field_trial { - -// Optionally initialize field trial from a string. -// This method can be called at most once before any other call into webrtc. -// E.g. before the peer connection factory is constructed. -// Note: trials_string must never be destroyed. -void InitFieldTrialsFromString(const char* trials_string); - -} // namespace field_trial -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FIELD_TRIAL_DEFAULT_H_ diff --git a/include/webrtc/system_wrappers/include/file_wrapper.h b/include/webrtc/system_wrappers/include/file_wrapper.h deleted file mode 100644 index b32a62f..0000000 --- a/include/webrtc/system_wrappers/include/file_wrapper.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FILE_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FILE_WRAPPER_H_ - -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/typedefs.h" - -// Implementation of an InStream and OutStream that can read (exclusive) or -// write from/to a file. - -namespace webrtc { - -class FileWrapper : public InStream, public OutStream { - public: - static const size_t kMaxFileNameSize = 1024; - - // Factory method. Constructor disabled. - static FileWrapper* Create(); - - // Returns true if a file has been opened. - virtual bool Open() const = 0; - - // Opens a file in read or write mode, decided by the read_only parameter. - virtual int OpenFile(const char* file_name_utf8, - bool read_only, - bool loop = false, - bool text = false) = 0; - - // Initializes the wrapper from an existing handle. |read_only| must match in - // the mode the file was opened in. If |manage_file| is true, the wrapper - // takes ownership of |handle| and closes it in CloseFile(). - virtual int OpenFromFileHandle(FILE* handle, - bool manage_file, - bool read_only, - bool loop = false) = 0; - - virtual int CloseFile() = 0; - - // Limits the file size to |bytes|. Writing will fail after the cap - // is hit. Pass zero to use an unlimited size. - virtual int SetMaxFileSize(size_t bytes) = 0; - - // Flush any pending writes. - virtual int Flush() = 0; - - // Returns the opened file's name in |file_name_utf8|. Provide the size of - // the buffer in bytes in |size|. The name will be truncated if |size| is - // too small. - virtual int FileName(char* file_name_utf8, - size_t size) const = 0; - - // Write |format| to the opened file. Arguments are taken in the same manner - // as printf. That is, supply a format string containing text and - // specifiers. Returns the number of characters written or -1 on error. - virtual int WriteText(const char* format, ...) = 0; - - // Inherited from both Instream and OutStream. - // Rewinds the file to the start. Only available when OpenFile() has been - // called with |loop| == true or |readOnly| == true. - // virtual int Rewind() = 0; - int Rewind() override; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FILE_WRAPPER_H_ diff --git a/include/webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h b/include/webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h deleted file mode 100644 index 8fb32ef..0000000 --- a/include/webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Various inline functions and macros to fix compilation of 32 bit target -// on MSVC with /Wp64 flag enabled. - -// The original code can be found here: -// http://src.chromium.org/svn/trunk/src/base/fix_wp64.h - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_FIX_INTERLOCKED_EXCHANGE_POINTER_WINDOWS_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_FIX_INTERLOCKED_EXCHANGE_POINTER_WINDOWS_H_ - -#include - -// Platform SDK fixes when building with /Wp64 for a 32 bits target. -#if !defined(_WIN64) && defined(_Wp64) - -#ifdef InterlockedExchangePointer -#undef InterlockedExchangePointer -// The problem is that the macro provided for InterlockedExchangePointer() is -// doing a (LONG) C-style cast that triggers invariably the warning C4312 when -// building on 32 bits. -inline void* InterlockedExchangePointer(void* volatile* target, void* value) { - return reinterpret_cast(static_cast(InterlockedExchange( - reinterpret_cast(target), - static_cast(reinterpret_cast(value))))); -} -#endif // #ifdef InterlockedExchangePointer - -#endif // #if !defined(_WIN64) && defined(_Wp64) - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_FIX_INTERLOCKED_EXCHANGE_POINTER_WINDOWS_H_ diff --git a/include/webrtc/system_wrappers/include/logcat_trace_context.h b/include/webrtc/system_wrappers/include/logcat_trace_context.h deleted file mode 100644 index 8bb01d8..0000000 --- a/include/webrtc/system_wrappers/include/logcat_trace_context.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGCAT_TRACE_CONTEXT_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGCAT_TRACE_CONTEXT_H_ - -#include "webrtc/system_wrappers/include/trace.h" - -#ifndef ANDROID -#error This file only makes sense to include on Android! -#endif - -namespace webrtc { - -// Scoped helper class for directing Traces to Android's logcat facility. While -// this object lives, Trace output will be sent to logcat. -class LogcatTraceContext : public webrtc::TraceCallback { - public: - LogcatTraceContext(); - virtual ~LogcatTraceContext(); - - // TraceCallback impl. - virtual void Print(TraceLevel level, const char* message, int length); -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGCAT_TRACE_CONTEXT_H_ diff --git a/include/webrtc/system_wrappers/include/logging.h b/include/webrtc/system_wrappers/include/logging.h deleted file mode 100644 index 0089841..0000000 --- a/include/webrtc/system_wrappers/include/logging.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This is a highly stripped-down version of libjingle's talk/base/logging.h. -// It is a thin wrapper around WEBRTC_TRACE, maintaining the libjingle log -// semantics to ease a transition to that format. - -// NOTE: LS_INFO maps to a new trace level which should be reserved for -// infrequent, non-verbose logs. The other levels below kTraceWarning have been -// rendered essentially useless due to their verbosity. Carefully consider the -// impact of adding a new LS_INFO log. If it will be logged at anything -// approaching a frame or packet frequency, use LS_VERBOSE if necessary, or -// preferably, do not log at all. - -// LOG(...) an ostream target that can be used to send formatted -// output to a variety of logging targets, such as debugger console, stderr, -// file, or any StreamInterface. -// The severity level passed as the first argument to the LOGging -// functions is used as a filter, to limit the verbosity of the logging. -// Static members of LogMessage documented below are used to control the -// verbosity and target of the output. -// There are several variations on the LOG macro which facilitate logging -// of common error conditions, detailed below. - -// LOG(sev) logs the given stream at severity "sev", which must be a -// compile-time constant of the LoggingSeverity type, without the namespace -// prefix. -// LOG_V(sev) Like LOG(), but sev is a run-time variable of the LoggingSeverity -// type (basically, it just doesn't prepend the namespace). -// LOG_F(sev) Like LOG(), but includes the name of the current function. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ - -#include - -namespace webrtc { - -////////////////////////////////////////////////////////////////////// - -// Note that the non-standard LoggingSeverity aliases exist because they are -// still in broad use. The meanings of the levels are: -// LS_SENSITIVE: Information which should only be logged with the consent -// of the user, due to privacy concerns. -// LS_VERBOSE: This level is for data which we do not want to appear in the -// normal debug log, but should appear in diagnostic logs. -// LS_INFO: Chatty level used in debugging for all sorts of things, the default -// in debug builds. -// LS_WARNING: Something that may warrant investigation. -// LS_ERROR: Something that should not have occurred. -enum LoggingSeverity { - LS_SENSITIVE, LS_VERBOSE, LS_INFO, LS_WARNING, LS_ERROR -}; - -class LogMessage { - public: - LogMessage(const char* file, int line, LoggingSeverity sev); - ~LogMessage(); - - static bool Loggable(LoggingSeverity sev); - std::ostream& stream() { return print_stream_; } - - private: - // The ostream that buffers the formatted message before output - std::ostringstream print_stream_; - - // The severity level of this message - LoggingSeverity severity_; -}; - -////////////////////////////////////////////////////////////////////// -// Macros which automatically disable logging when WEBRTC_LOGGING == 0 -////////////////////////////////////////////////////////////////////// - -#ifndef LOG -// The following non-obvious technique for implementation of a -// conditional log stream was stolen from google3/base/logging.h. - -// This class is used to explicitly ignore values in the conditional -// logging macros. This avoids compiler warnings like "value computed -// is not used" and "statement has no effect". - -class LogMessageVoidify { - public: - LogMessageVoidify() { } - // This has to be an operator with a precedence lower than << but - // higher than ?: - void operator&(std::ostream&) { } -}; - -#if defined(WEBRTC_RESTRICT_LOGGING) -// This should compile away logs matching the following condition. -#define RESTRICT_LOGGING_PRECONDITION(sev) \ - sev < webrtc::LS_INFO ? (void) 0 : -#else -#define RESTRICT_LOGGING_PRECONDITION(sev) -#endif - -#define LOG_SEVERITY_PRECONDITION(sev) \ - RESTRICT_LOGGING_PRECONDITION(sev) !(webrtc::LogMessage::Loggable(sev)) \ - ? (void) 0 \ - : webrtc::LogMessageVoidify() & - -#define LOG(sev) \ - LOG_SEVERITY_PRECONDITION(webrtc::sev) \ - webrtc::LogMessage(__FILE__, __LINE__, webrtc::sev).stream() - -// The _V version is for when a variable is passed in. It doesn't do the -// namespace concatination. -#define LOG_V(sev) \ - LOG_SEVERITY_PRECONDITION(sev) \ - webrtc::LogMessage(__FILE__, __LINE__, sev).stream() - -// The _F version prefixes the message with the current function name. -#if (defined(__GNUC__) && !defined(NDEBUG)) || defined(WANT_PRETTY_LOG_F) -#define LOG_F(sev) LOG(sev) << __PRETTY_FUNCTION__ << ": " -#else -#define LOG_F(sev) LOG(sev) << __FUNCTION__ << ": " -#endif - -#endif // LOG - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ diff --git a/include/webrtc/system_wrappers/include/metrics.h b/include/webrtc/system_wrappers/include/metrics.h deleted file mode 100644 index 2e6e7b7..0000000 --- a/include/webrtc/system_wrappers/include/metrics.h +++ /dev/null @@ -1,139 +0,0 @@ -// -// Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ - -#include - -#include "webrtc/common_types.h" - -// Macros for allowing WebRTC clients (e.g. Chrome) to gather and aggregate -// statistics. -// -// Histogram for counters. -// RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count); -// -// Histogram for enumerators. -// The boundary should be above the max enumerator sample. -// RTC_HISTOGRAM_ENUMERATION(name, sample, boundary); -// -// -// The macros use the methods HistogramFactoryGetCounts, -// HistogramFactoryGetEnumeration and HistogramAdd. -// -// Therefore, WebRTC clients must either: -// -// - provide implementations of -// Histogram* webrtc::metrics::HistogramFactoryGetCounts( -// const std::string& name, int sample, int min, int max, -// int bucket_count); -// Histogram* webrtc::metrics::HistogramFactoryGetEnumeration( -// const std::string& name, int sample, int boundary); -// void webrtc::metrics::HistogramAdd( -// Histogram* histogram_pointer, const std::string& name, int sample); -// -// - or link with the default implementations (i.e. -// system_wrappers/system_wrappers.gyp:metrics_default). -// -// -// Example usage: -// -// RTC_HISTOGRAM_COUNTS("WebRTC.Video.NacksSent", nacks_sent, 1, 100000, 100); -// -// enum Types { -// kTypeX, -// kTypeY, -// kBoundary, -// }; -// -// RTC_HISTOGRAM_ENUMERATION("WebRTC.Types", kTypeX, kBoundary); - - -// Macros for adding samples to a named histogram. -// -// NOTE: this is a temporary solution. -// The aim is to mimic the behaviour in Chromium's src/base/metrics/histograms.h -// However as atomics are not supported in webrtc, this is for now a modified -// and temporary solution. Note that the histogram is constructed/found for -// each call. Therefore, for now only use this implementation for metrics -// that do not need to be updated frequently. -// TODO(asapersson): Change implementation when atomics are supported. -// Also consider changing string to const char* when switching to atomics. - -// Histogram for counters. -#define RTC_HISTOGRAM_COUNTS_100(name, sample) RTC_HISTOGRAM_COUNTS( \ - name, sample, 1, 100, 50) - -#define RTC_HISTOGRAM_COUNTS_200(name, sample) RTC_HISTOGRAM_COUNTS( \ - name, sample, 1, 200, 50) - -#define RTC_HISTOGRAM_COUNTS_1000(name, sample) RTC_HISTOGRAM_COUNTS( \ - name, sample, 1, 1000, 50) - -#define RTC_HISTOGRAM_COUNTS_10000(name, sample) RTC_HISTOGRAM_COUNTS( \ - name, sample, 1, 10000, 50) - -#define RTC_HISTOGRAM_COUNTS_100000(name, sample) RTC_HISTOGRAM_COUNTS( \ - name, sample, 1, 100000, 50) - -#define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ - RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ - webrtc::metrics::HistogramFactoryGetCounts( \ - name, min, max, bucket_count)) - -// Histogram for percentage. -#define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ - RTC_HISTOGRAM_ENUMERATION(name, sample, 101) - -// Histogram for enumerators. -// |boundary| should be above the max enumerator sample. -#define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ - RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ - webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) - -#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ - factory_get_invocation) \ - do { \ - webrtc::metrics::Histogram* histogram_pointer = factory_get_invocation; \ - webrtc::metrics::HistogramAdd(histogram_pointer, constant_name, sample); \ - } while (0) - - -namespace webrtc { -namespace metrics { - -// Time that should have elapsed for stats that are gathered once per call. -enum { kMinRunTimeInSeconds = 10 }; - -class Histogram; - -// Functions for getting pointer to histogram (constructs or finds the named -// histogram). - -// Get histogram for counters. -Histogram* HistogramFactoryGetCounts( - const std::string& name, int min, int max, int bucket_count); - -// Get histogram for enumerators. -// |boundary| should be above the max enumerator sample. -Histogram* HistogramFactoryGetEnumeration( - const std::string& name, int boundary); - -// Function for adding a |sample| to a histogram. -// |name| can be used to verify that it matches the histogram name. -void HistogramAdd( - Histogram* histogram_pointer, const std::string& name, int sample); - -} // namespace metrics -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ - diff --git a/include/webrtc/system_wrappers/include/ntp_time.h b/include/webrtc/system_wrappers/include/ntp_time.h deleted file mode 100644 index 229666e..0000000 --- a/include/webrtc/system_wrappers/include/ntp_time.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. -* -* Use of this source code is governed by a BSD-style license -* that can be found in the LICENSE file in the root of the source -* tree. An additional intellectual property rights grant can be found -* in the file PATENTS. All contributing project authors may -* be found in the AUTHORS file in the root of the source tree. -*/ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_NTP_TIME_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_NTP_TIME_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/system_wrappers/include/clock.h" - -namespace webrtc { - -class NtpTime { - public: - NtpTime() : seconds_(0), fractions_(0) {} - explicit NtpTime(const Clock& clock) { - clock.CurrentNtp(seconds_, fractions_); - } - NtpTime(uint32_t seconds, uint32_t fractions) - : seconds_(seconds), fractions_(fractions) {} - - NtpTime(const NtpTime&) = default; - NtpTime& operator=(const NtpTime&) = default; - - void SetCurrent(const Clock& clock) { - clock.CurrentNtp(seconds_, fractions_); - } - void Set(uint32_t seconds, uint32_t fractions) { - seconds_ = seconds; - fractions_ = fractions; - } - void Reset() { - seconds_ = 0; - fractions_ = 0; - } - - int64_t ToMs() const { return Clock::NtpToMs(seconds_, fractions_); } - - // NTP standard (RFC1305, section 3.1) explicitly state value 0/0 is invalid. - bool Valid() const { return !(seconds_ == 0 && fractions_ == 0); } - - uint32_t seconds() const { return seconds_; } - uint32_t fractions() const { return fractions_; } - - private: - uint32_t seconds_; - uint32_t fractions_; -}; - -inline bool operator==(const NtpTime& n1, const NtpTime& n2) { - return n1.seconds() == n2.seconds() && n1.fractions() == n2.fractions(); -} -inline bool operator!=(const NtpTime& n1, const NtpTime& n2) { - return !(n1 == n2); -} - -} // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_NTP_TIME_H_ diff --git a/include/webrtc/system_wrappers/include/ref_count.h b/include/webrtc/system_wrappers/include/ref_count.h deleted file mode 100644 index 3dd335a..0000000 --- a/include/webrtc/system_wrappers/include/ref_count.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef SYSTEM_WRAPPERS_INCLUDE_REF_COUNT_H_ -#define SYSTEM_WRAPPERS_INCLUDE_REF_COUNT_H_ - -#include "webrtc/system_wrappers/include/atomic32.h" - -namespace webrtc { - -// This class can be used for instantiating -// reference counted objects. -// int32_t AddRef() and int32_t Release(). -// Usage: -// RefCountImpl* implementation = new RefCountImpl(p); -// -// Example: -// class MyInterface { -// public: -// virtual void DoSomething() = 0; -// virtual int32_t AddRef() = 0; -// virtual int32_t Release() = 0: -// private: -// virtual ~MyInterface(){}; -// } -// class MyImplementation : public MyInterface { -// public: -// virtual DoSomething() { printf("hello"); }; -// }; -// MyImplementation* CreateMyImplementation() { -// RefCountImpl* implementation = -// new RefCountImpl(); -// return implementation; -// } - -template -class RefCountImpl : public T { - public: - RefCountImpl() : ref_count_(0) {} - - template - explicit RefCountImpl(P p) : T(p), ref_count_(0) {} - - template - RefCountImpl(P1 p1, P2 p2) : T(p1, p2), ref_count_(0) {} - - template - RefCountImpl(P1 p1, P2 p2, P3 p3) : T(p1, p2, p3), ref_count_(0) {} - - template - RefCountImpl(P1 p1, P2 p2, P3 p3, P4 p4) : T(p1, p2, p3, p4), ref_count_(0) {} - - template - RefCountImpl(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) - : T(p1, p2, p3, p4, p5), ref_count_(0) {} - - int32_t AddRef() const override { - return ++ref_count_; - } - - int32_t Release() const override { - int32_t ref_count; - ref_count = --ref_count_; - if (ref_count == 0) - delete this; - return ref_count; - } - - protected: - mutable Atomic32 ref_count_; -}; - -} // namespace webrtc - -#endif // SYSTEM_WRAPPERS_INCLUDE_REF_COUNT_H_ diff --git a/include/webrtc/system_wrappers/include/rtp_to_ntp.h b/include/webrtc/system_wrappers/include/rtp_to_ntp.h deleted file mode 100644 index 0c91928..0000000 --- a/include/webrtc/system_wrappers/include/rtp_to_ntp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef SYSTEM_WRAPPERS_INCLUDE_RTP_TO_NTP_H_ -#define SYSTEM_WRAPPERS_INCLUDE_RTP_TO_NTP_H_ - -#include - -#include "webrtc/typedefs.h" - -namespace webrtc { - -struct RtcpMeasurement { - RtcpMeasurement(); - RtcpMeasurement(uint32_t ntp_secs, uint32_t ntp_frac, uint32_t timestamp); - uint32_t ntp_secs; - uint32_t ntp_frac; - uint32_t rtp_timestamp; -}; - -typedef std::list RtcpList; - -// Updates |rtcp_list| with timestamps from the latest RTCP SR. -// |new_rtcp_sr| will be set to true if these are the timestamps which have -// never be added to |rtcp_list|. -bool UpdateRtcpList(uint32_t ntp_secs, - uint32_t ntp_frac, - uint32_t rtp_timestamp, - RtcpList* rtcp_list, - bool* new_rtcp_sr); - -// Converts an RTP timestamp to the NTP domain in milliseconds using two -// (RTP timestamp, NTP timestamp) pairs. -bool RtpToNtpMs(int64_t rtp_timestamp, const RtcpList& rtcp, - int64_t* timestamp_in_ms); - -// Returns 1 there has been a forward wrap around, 0 if there has been no wrap -// around and -1 if there has been a backwards wrap around (i.e. reordering). -int CheckForWrapArounds(uint32_t rtp_timestamp, uint32_t rtcp_rtp_timestamp); - -} // namespace webrtc - -#endif // SYSTEM_WRAPPERS_INCLUDE_RTP_TO_NTP_H_ diff --git a/include/webrtc/system_wrappers/include/rw_lock_wrapper.h b/include/webrtc/system_wrappers/include/rw_lock_wrapper.h deleted file mode 100644 index 751b6a1..0000000 --- a/include/webrtc/system_wrappers/include/rw_lock_wrapper.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_ - -#include "webrtc/base/thread_annotations.h" - -// Note, Windows pre-Vista version of RW locks are not supported natively. For -// these OSs regular critical sections have been used to approximate RW lock -// functionality and will therefore have worse performance. - -namespace webrtc { - -class LOCKABLE RWLockWrapper { - public: - static RWLockWrapper* CreateRWLock(); - virtual ~RWLockWrapper() {} - - virtual void AcquireLockExclusive() EXCLUSIVE_LOCK_FUNCTION() = 0; - virtual void ReleaseLockExclusive() UNLOCK_FUNCTION() = 0; - - virtual void AcquireLockShared() SHARED_LOCK_FUNCTION() = 0; - virtual void ReleaseLockShared() UNLOCK_FUNCTION() = 0; -}; - -// RAII extensions of the RW lock. Prevents Acquire/Release missmatches and -// provides more compact locking syntax. -class SCOPED_LOCKABLE ReadLockScoped { - public: - ReadLockScoped(RWLockWrapper& rw_lock) SHARED_LOCK_FUNCTION(rw_lock) - : rw_lock_(rw_lock) { - rw_lock_.AcquireLockShared(); - } - - ~ReadLockScoped() UNLOCK_FUNCTION() { - rw_lock_.ReleaseLockShared(); - } - - private: - RWLockWrapper& rw_lock_; -}; - -class SCOPED_LOCKABLE WriteLockScoped { - public: - WriteLockScoped(RWLockWrapper& rw_lock) EXCLUSIVE_LOCK_FUNCTION(rw_lock) - : rw_lock_(rw_lock) { - rw_lock_.AcquireLockExclusive(); - } - - ~WriteLockScoped() UNLOCK_FUNCTION() { - rw_lock_.ReleaseLockExclusive(); - } - - private: - RWLockWrapper& rw_lock_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_ diff --git a/include/webrtc/system_wrappers/include/scoped_vector.h b/include/webrtc/system_wrappers/include/scoped_vector.h deleted file mode 100644 index 7336d98..0000000 --- a/include/webrtc/system_wrappers/include/scoped_vector.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/memory/scoped_vector.h. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SCOPED_VECTOR_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SCOPED_VECTOR_H_ - -#include - -#include "webrtc/base/checks.h" -#include "webrtc/system_wrappers/include/stl_util.h" - -namespace webrtc { - -// ScopedVector wraps a vector deleting the elements from its -// destructor. -template -class ScopedVector { - public: - typedef typename std::vector::allocator_type allocator_type; - typedef typename std::vector::size_type size_type; - typedef typename std::vector::difference_type difference_type; - typedef typename std::vector::pointer pointer; - typedef typename std::vector::const_pointer const_pointer; - typedef typename std::vector::reference reference; - typedef typename std::vector::const_reference const_reference; - typedef typename std::vector::value_type value_type; - typedef typename std::vector::iterator iterator; - typedef typename std::vector::const_iterator const_iterator; - typedef typename std::vector::reverse_iterator reverse_iterator; - typedef typename std::vector::const_reverse_iterator - const_reverse_iterator; - - ScopedVector() {} - ~ScopedVector() { clear(); } - - // Move construction and assignment. - ScopedVector(ScopedVector&& other) { - *this = static_cast(other); - } - ScopedVector& operator=(ScopedVector&& other) { - std::swap(v_, other.v_); // The arguments are std::vectors, so std::swap - // is the one that we want. - other.clear(); - return *this; - } - - // Deleted copy constructor and copy assignment, to make the type move-only. - ScopedVector(const ScopedVector& other) = delete; - ScopedVector& operator=(const ScopedVector& other) = delete; - - // Get an rvalue reference. (sv.Pass() does the same thing as std::move(sv).) - ScopedVector&& Pass() { return static_cast(*this); } - - reference operator[](size_t index) { return v_[index]; } - const_reference operator[](size_t index) const { return v_[index]; } - - bool empty() const { return v_.empty(); } - size_t size() const { return v_.size(); } - - reverse_iterator rbegin() { return v_.rbegin(); } - const_reverse_iterator rbegin() const { return v_.rbegin(); } - reverse_iterator rend() { return v_.rend(); } - const_reverse_iterator rend() const { return v_.rend(); } - - iterator begin() { return v_.begin(); } - const_iterator begin() const { return v_.begin(); } - iterator end() { return v_.end(); } - const_iterator end() const { return v_.end(); } - - const_reference front() const { return v_.front(); } - reference front() { return v_.front(); } - const_reference back() const { return v_.back(); } - reference back() { return v_.back(); } - - void push_back(T* elem) { v_.push_back(elem); } - - void pop_back() { - RTC_DCHECK(!empty()); - delete v_.back(); - v_.pop_back(); - } - - std::vector& get() { return v_; } - const std::vector& get() const { return v_; } - void swap(std::vector& other) { v_.swap(other); } - void swap(ScopedVector& other) { v_.swap(other.v_); } - void release(std::vector* out) { - out->swap(v_); - v_.clear(); - } - - void reserve(size_t capacity) { v_.reserve(capacity); } - - // Resize, deleting elements in the disappearing range if we are shrinking. - void resize(size_t new_size) { - if (v_.size() > new_size) - STLDeleteContainerPointers(v_.begin() + new_size, v_.end()); - v_.resize(new_size); - } - - template - void assign(InputIterator begin, InputIterator end) { - v_.assign(begin, end); - } - - void clear() { STLDeleteElements(&v_); } - - // Like |clear()|, but doesn't delete any elements. - void weak_clear() { v_.clear(); } - - // Lets the ScopedVector take ownership of |x|. - iterator insert(iterator position, T* x) { - return v_.insert(position, x); - } - - // Lets the ScopedVector take ownership of elements in [first,last). - template - void insert(iterator position, InputIterator first, InputIterator last) { - v_.insert(position, first, last); - } - - iterator erase(iterator position) { - delete *position; - return v_.erase(position); - } - - iterator erase(iterator first, iterator last) { - STLDeleteContainerPointers(first, last); - return v_.erase(first, last); - } - - // Like |erase()|, but doesn't delete the element at |position|. - iterator weak_erase(iterator position) { - return v_.erase(position); - } - - // Like |erase()|, but doesn't delete the elements in [first, last). - iterator weak_erase(iterator first, iterator last) { - return v_.erase(first, last); - } - - private: - std::vector v_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SCOPED_VECTOR_H_ diff --git a/include/webrtc/system_wrappers/include/sleep.h b/include/webrtc/system_wrappers/include/sleep.h deleted file mode 100644 index e7ed8b3..0000000 --- a/include/webrtc/system_wrappers/include/sleep.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -// An OS-independent sleep function. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SLEEP_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SLEEP_H_ - -namespace webrtc { - -// This function sleeps for the specified number of milliseconds. -// It may return early if the thread is woken by some other event, -// such as the delivery of a signal on Unix. -void SleepMs(int msecs); - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SLEEP_H_ diff --git a/include/webrtc/system_wrappers/include/sort.h b/include/webrtc/system_wrappers/include/sort.h deleted file mode 100644 index 5bf2afa..0000000 --- a/include/webrtc/system_wrappers/include/sort.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Generic unstable sorting routines. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SORT_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SORT_H_ - -#include "webrtc/common_types.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -enum Type { - TYPE_Word8, - TYPE_UWord8, - TYPE_Word16, - TYPE_UWord16, - TYPE_Word32, - TYPE_UWord32, - TYPE_Word64, - TYPE_UWord64, - TYPE_Float32, - TYPE_Float64 -}; - -// Sorts intrinsic data types. -// -// data [in/out] A pointer to an array of intrinsic type. -// Upon return it will be sorted in ascending order. -// num_of_elements The number of elements in the array. -// data_type Enum corresponding to the type of the array. -// -// returns 0 on success, -1 on failure. -int32_t Sort(void* data, uint32_t num_of_elements, Type data_type); - -// Sorts arbitrary data types. This requires an array of intrinsically typed -// key values which will be used to sort the data array. There must be a -// one-to-one correspondence between data elements and key elements, with -// corresponding elements sharing the same position in their respective -// arrays. -// -// data [in/out] A pointer to an array of arbitrary type. -// Upon return it will be sorted in ascending order. -// key [in] A pointer to an array of keys used to sort the -// data array. -// num_of_elements The number of elements in the arrays. -// size_of_element The size, in bytes, of the data array. -// key_type Enum corresponding to the type of the key array. -// -// returns 0 on success, -1 on failure. -// -int32_t KeySort(void* data, void* key, uint32_t num_of_elements, - uint32_t size_of_element, Type key_type); - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SORT_H_ diff --git a/include/webrtc/system_wrappers/include/static_instance.h b/include/webrtc/system_wrappers/include/static_instance.h deleted file mode 100644 index 41946d9..0000000 --- a/include/webrtc/system_wrappers/include/static_instance.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STATIC_INSTANCE_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STATIC_INSTANCE_H_ - -#include - -#include "webrtc/system_wrappers/include/critical_section_wrapper.h" -#ifdef _WIN32 -#include "webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h" -#endif - -namespace webrtc { - -enum CountOperation { - kRelease, - kAddRef, - kAddRefNoCreate -}; -enum CreateOperation { - kInstanceExists, - kCreate, - kDestroy -}; - -template -// Construct On First Use idiom. Avoids -// "static initialization order fiasco". -static T* GetStaticInstance(CountOperation count_operation) { - // TODO (hellner): use atomic wrapper instead. - static volatile long instance_count = 0; - static T* volatile instance = NULL; - CreateOperation state = kInstanceExists; -#ifndef _WIN32 - // This memory is staticly allocated once. The application does not try to - // free this memory. This approach is taken to avoid issues with - // destruction order for statically allocated memory. The memory will be - // reclaimed by the OS and memory leak tools will not recognize memory - // reachable from statics leaked so no noise is added by doing this. - static CriticalSectionWrapper* crit_sect( - CriticalSectionWrapper::CreateCriticalSection()); - CriticalSectionScoped lock(crit_sect); - - if (count_operation == - kAddRefNoCreate && instance_count == 0) { - return NULL; - } - if (count_operation == - kAddRef || - count_operation == kAddRefNoCreate) { - instance_count++; - if (instance_count == 1) { - state = kCreate; - } - } else { - instance_count--; - if (instance_count == 0) { - state = kDestroy; - } - } - if (state == kCreate) { - instance = T::CreateInstance(); - } else if (state == kDestroy) { - T* old_instance = instance; - instance = NULL; - // The state will not change past this point. Release the critical - // section while deleting the object in case it would be blocking on - // access back to this object. (This is the case for the tracing class - // since the thread owned by the tracing class also traces). - // TODO(hellner): this is a bit out of place but here goes, de-couple - // thread implementation with trace implementation. - crit_sect->Leave(); - if (old_instance) { - delete old_instance; - } - // Re-acquire the lock since the scoped critical section will release - // it. - crit_sect->Enter(); - return NULL; - } -#else // _WIN32 - if (count_operation == - kAddRefNoCreate && instance_count == 0) { - return NULL; - } - if (count_operation == kAddRefNoCreate) { - if (1 == InterlockedIncrement(&instance_count)) { - // The instance has been destroyed by some other thread. Rollback. - InterlockedDecrement(&instance_count); - assert(false); - return NULL; - } - // Sanity to catch corrupt state. - if (instance == NULL) { - assert(false); - InterlockedDecrement(&instance_count); - return NULL; - } - } else if (count_operation == kAddRef) { - if (instance_count == 0) { - state = kCreate; - } else { - if (1 == InterlockedIncrement(&instance_count)) { - // InterlockedDecrement because reference count should not be - // updated just yet (that's done when the instance is created). - InterlockedDecrement(&instance_count); - state = kCreate; - } - } - } else { - int new_value = InterlockedDecrement(&instance_count); - if (new_value == 0) { - state = kDestroy; - } - } - - if (state == kCreate) { - // Create instance and let whichever thread finishes first assign its - // local copy to the global instance. All other threads reclaim their - // local copy. - T* new_instance = T::CreateInstance(); - if (1 == InterlockedIncrement(&instance_count)) { - InterlockedExchangePointer(reinterpret_cast(&instance), - new_instance); - } else { - InterlockedDecrement(&instance_count); - if (new_instance) { - delete static_cast(new_instance); - } - } - } else if (state == kDestroy) { - T* old_value = static_cast(InterlockedExchangePointer( - reinterpret_cast(&instance), NULL)); - if (old_value) { - delete static_cast(old_value); - } - return NULL; - } -#endif // #ifndef _WIN32 - return instance; -} - -} // namspace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STATIC_INSTANCE_H_ diff --git a/include/webrtc/system_wrappers/include/stl_util.h b/include/webrtc/system_wrappers/include/stl_util.h deleted file mode 100644 index b7a7021..0000000 --- a/include/webrtc/system_wrappers/include/stl_util.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Borrowed from Chromium's src/base/stl_util.h. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STL_UTIL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STL_UTIL_H_ - -#include -#include -#include -#include -#include -#include - -namespace webrtc { - -// Clears internal memory of an STL object. -// STL clear()/reserve(0) does not always free internal memory allocated -// This function uses swap/destructor to ensure the internal memory is freed. -template -void STLClearObject(T* obj) { - T tmp; - tmp.swap(*obj); - // Sometimes "T tmp" allocates objects with memory (arena implementation?). - // Hence using additional reserve(0) even if it doesn't always work. - obj->reserve(0); -} - -// For a range within a container of pointers, calls delete (non-array version) -// on these pointers. -// NOTE: for these three functions, we could just implement a DeleteObject -// functor and then call for_each() on the range and functor, but this -// requires us to pull in all of algorithm.h, which seems expensive. -// For hash_[multi]set, it is important that this deletes behind the iterator -// because the hash_set may call the hash function on the iterator when it is -// advanced, which could result in the hash function trying to deference a -// stale pointer. -template -void STLDeleteContainerPointers(ForwardIterator begin, ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete *temp; - } -} - -// For a range within a container of pairs, calls delete (non-array version) on -// BOTH items in the pairs. -// NOTE: Like STLDeleteContainerPointers, it is important that this deletes -// behind the iterator because if both the key and value are deleted, the -// container may call the hash function on the iterator when it is advanced, -// which could result in the hash function trying to dereference a stale -// pointer. -template -void STLDeleteContainerPairPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete temp->first; - delete temp->second; - } -} - -// For a range within a container of pairs, calls delete (non-array version) on -// the FIRST item in the pairs. -// NOTE: Like STLDeleteContainerPointers, deleting behind the iterator. -template -void STLDeleteContainerPairFirstPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete temp->first; - } -} - -// For a range within a container of pairs, calls delete. -// NOTE: Like STLDeleteContainerPointers, deleting behind the iterator. -// Deleting the value does not always invalidate the iterator, but it may -// do so if the key is a pointer into the value object. -template -void STLDeleteContainerPairSecondPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete temp->second; - } -} - -// To treat a possibly-empty vector as an array, use these functions. -// If you know the array will never be empty, you can use &*v.begin() -// directly, but that is undefined behaviour if |v| is empty. -template -inline T* vector_as_array(std::vector* v) { - return v->empty() ? NULL : &*v->begin(); -} - -template -inline const T* vector_as_array(const std::vector* v) { - return v->empty() ? NULL : &*v->begin(); -} - -// Return a mutable char* pointing to a string's internal buffer, -// which may not be null-terminated. Writing through this pointer will -// modify the string. -// -// string_as_array(&str)[i] is valid for 0 <= i < str.size() until the -// next call to a string method that invalidates iterators. -// -// As of 2006-04, there is no standard-blessed way of getting a -// mutable reference to a string's internal buffer. However, issue 530 -// (http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#530) -// proposes this as the method. According to Matt Austern, this should -// already work on all current implementations. -inline char* string_as_array(std::string* str) { - // DO NOT USE const_cast(str->data()) - return str->empty() ? NULL : &*str->begin(); -} - -// The following functions are useful for cleaning up STL containers whose -// elements point to allocated memory. - -// STLDeleteElements() deletes all the elements in an STL container and clears -// the container. This function is suitable for use with a vector, set, -// hash_set, or any other STL container which defines sensible begin(), end(), -// and clear() methods. -// -// If container is NULL, this function is a no-op. -// -// As an alternative to calling STLDeleteElements() directly, consider -// STLElementDeleter (defined below), which ensures that your container's -// elements are deleted when the STLElementDeleter goes out of scope. -template -void STLDeleteElements(T* container) { - if (!container) - return; - STLDeleteContainerPointers(container->begin(), container->end()); - container->clear(); -} - -// Given an STL container consisting of (key, value) pairs, STLDeleteValues -// deletes all the "value" components and clears the container. Does nothing -// in the case it's given a NULL pointer. -template -void STLDeleteValues(T* container) { - if (!container) - return; - for (typename T::iterator i(container->begin()); i != container->end(); ++i) - delete i->second; - container->clear(); -} - - -// The following classes provide a convenient way to delete all elements or -// values from STL containers when they goes out of scope. This greatly -// simplifies code that creates temporary objects and has multiple return -// statements. Example: -// -// vector tmp_proto; -// STLElementDeleter > d(&tmp_proto); -// if (...) return false; -// ... -// return success; - -// Given a pointer to an STL container this class will delete all the element -// pointers when it goes out of scope. -template -class STLElementDeleter { - public: - STLElementDeleter(T* container) : container_(container) {} - ~STLElementDeleter() { STLDeleteElements(container_); } - - private: - T* container_; -}; - -// Given a pointer to an STL container this class will delete all the value -// pointers when it goes out of scope. -template -class STLValueDeleter { - public: - STLValueDeleter(T* container) : container_(container) {} - ~STLValueDeleter() { STLDeleteValues(container_); } - - private: - T* container_; -}; - -// Test to see if a set, map, hash_set or hash_map contains a particular key. -// Returns true if the key is in the collection. -template -bool ContainsKey(const Collection& collection, const Key& key) { - return collection.find(key) != collection.end(); -} - -// Returns true if the container is sorted. -template -bool STLIsSorted(const Container& cont) { - // Note: Use reverse iterator on container to ensure we only require - // value_type to implement operator<. - return std::adjacent_find(cont.rbegin(), cont.rend(), - std::less()) - == cont.rend(); -} - -// Returns a new ResultType containing the difference of two sorted containers. -template -ResultType STLSetDifference(const Arg1& a1, const Arg2& a2) { - assert(STLIsSorted(a1)); - assert(STLIsSorted(a2)); - ResultType difference; - std::set_difference(a1.begin(), a1.end(), - a2.begin(), a2.end(), - std::inserter(difference, difference.end())); - return difference; -} - -// Returns a new ResultType containing the union of two sorted containers. -template -ResultType STLSetUnion(const Arg1& a1, const Arg2& a2) { - assert(STLIsSorted(a1)); - assert(STLIsSorted(a2)); - ResultType result; - std::set_union(a1.begin(), a1.end(), - a2.begin(), a2.end(), - std::inserter(result, result.end())); - return result; -} - -// Returns a new ResultType containing the intersection of two sorted -// containers. -template -ResultType STLSetIntersection(const Arg1& a1, const Arg2& a2) { - assert(STLIsSorted(a1)); - assert(STLIsSorted(a2)); - ResultType result; - std::set_intersection(a1.begin(), a1.end(), - a2.begin(), a2.end(), - std::inserter(result, result.end())); - return result; -} - -// Returns true if the sorted container |a1| contains all elements of the sorted -// container |a2|. -template -bool STLIncludes(const Arg1& a1, const Arg2& a2) { - assert(STLIsSorted(a1)); - assert(STLIsSorted(a2)); - return std::includes(a1.begin(), a1.end(), - a2.begin(), a2.end()); -} - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STL_UTIL_H_ diff --git a/include/webrtc/system_wrappers/include/stringize_macros.h b/include/webrtc/system_wrappers/include/stringize_macros.h deleted file mode 100644 index 9c8e7e9..0000000 --- a/include/webrtc/system_wrappers/include/stringize_macros.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Modified from the Chromium original: -// src/base/strings/stringize_macros.h - -// This file defines preprocessor macros for stringizing preprocessor -// symbols (or their output) and manipulating preprocessor symbols -// that define strings. - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STRINGIZE_MACROS_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STRINGIZE_MACROS_H_ - -// This is not very useful as it does not expand defined symbols if -// called directly. Use its counterpart without the _NO_EXPANSION -// suffix, below. -#define STRINGIZE_NO_EXPANSION(x) #x - -// Use this to quote the provided parameter, first expanding it if it -// is a preprocessor symbol. -// -// For example, if: -// #define A FOO -// #define B(x) myobj->FunctionCall(x) -// -// Then: -// STRINGIZE(A) produces "FOO" -// STRINGIZE(B(y)) produces "myobj->FunctionCall(y)" -#define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x) - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STRINGIZE_MACROS_H_ diff --git a/include/webrtc/system_wrappers/include/tick_util.h b/include/webrtc/system_wrappers/include/tick_util.h deleted file mode 100644 index 52f9b4a..0000000 --- a/include/webrtc/system_wrappers/include/tick_util.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// System independant wrapper for polling elapsed time in ms and us. -// The implementation works in the tick domain which can be mapped over to the -// time domain. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TICK_UTIL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TICK_UTIL_H_ - -#if _WIN32 -// Note: The Windows header must always be included before mmsystem.h -#include -#include -#elif WEBRTC_LINUX -#include -#elif WEBRTC_MAC -#include -#include -#else -#include -#include -#endif - -#include "webrtc/typedefs.h" - -namespace webrtc { - -class TickInterval; - -// Class representing the current time. -class TickTime { - public: - TickTime(); - explicit TickTime(int64_t ticks); - - // Current time in the tick domain. - static TickTime Now(); - - // Now in the time domain in ms. - static int64_t MillisecondTimestamp(); - - // Now in the time domain in us. - static int64_t MicrosecondTimestamp(); - - // Returns the number of ticks in the tick domain. - int64_t Ticks() const; - - static int64_t MillisecondsToTicks(const int64_t ms); - - static int64_t TicksToMilliseconds(const int64_t ticks); - - static int64_t TicksToMicroseconds(const int64_t ticks); - - // Returns a TickTime that is ticks later than the passed TickTime. - friend TickTime operator+(const TickTime lhs, const int64_t ticks); - TickTime& operator+=(const int64_t& ticks); - - // Returns a TickInterval that is the difference in ticks beween rhs and lhs. - friend TickInterval operator-(const TickTime& lhs, const TickTime& rhs); - - private: - static int64_t QueryOsForTicks(); - - int64_t ticks_; -}; - -// Represents a time delta in ticks. -class TickInterval { - public: - TickInterval(); - explicit TickInterval(int64_t interval); - - int64_t Milliseconds() const; - int64_t Microseconds() const; - - // Returns the sum of two TickIntervals as a TickInterval. - friend TickInterval operator+(const TickInterval& lhs, - const TickInterval& rhs); - TickInterval& operator+=(const TickInterval& rhs); - - // Returns a TickInterval corresponding to rhs - lhs. - friend TickInterval operator-(const TickInterval& lhs, - const TickInterval& rhs); - TickInterval& operator-=(const TickInterval& rhs); - - friend bool operator>(const TickInterval& lhs, const TickInterval& rhs); - friend bool operator<=(const TickInterval& lhs, const TickInterval& rhs); - friend bool operator<(const TickInterval& lhs, const TickInterval& rhs); - friend bool operator>=(const TickInterval& lhs, const TickInterval& rhs); - - private: - friend class TickTime; - friend TickInterval operator-(const TickTime& lhs, const TickTime& rhs); - - private: - int64_t interval_; -}; - -inline int64_t TickInterval::Milliseconds() const { - return TickTime::TicksToMilliseconds(interval_); -} - -inline int64_t TickInterval::Microseconds() const { - return TickTime::TicksToMicroseconds(interval_); -} - -inline TickInterval operator+(const TickInterval& lhs, - const TickInterval& rhs) { - return TickInterval(lhs.interval_ + rhs.interval_); -} - -inline TickInterval operator-(const TickInterval& lhs, - const TickInterval& rhs) { - return TickInterval(lhs.interval_ - rhs.interval_); -} - -inline TickInterval operator-(const TickTime& lhs, const TickTime& rhs) { - return TickInterval(lhs.ticks_ - rhs.ticks_); -} - -inline TickTime operator+(const TickTime lhs, const int64_t ticks) { - TickTime time = lhs; - time.ticks_ += ticks; - return time; -} - -inline bool operator>(const TickInterval& lhs, const TickInterval& rhs) { - return lhs.interval_ > rhs.interval_; -} - -inline bool operator<=(const TickInterval& lhs, const TickInterval& rhs) { - return lhs.interval_ <= rhs.interval_; -} - -inline bool operator<(const TickInterval& lhs, const TickInterval& rhs) { - return lhs.interval_ <= rhs.interval_; -} - -inline bool operator>=(const TickInterval& lhs, const TickInterval& rhs) { - return lhs.interval_ >= rhs.interval_; -} - -inline TickTime::TickTime() - : ticks_(0) { -} - -inline TickTime::TickTime(int64_t ticks) - : ticks_(ticks) { -} - -inline TickTime TickTime::Now() { - return TickTime(QueryOsForTicks()); -} - -inline int64_t TickTime::Ticks() const { - return ticks_; -} - -inline TickTime& TickTime::operator+=(const int64_t& ticks) { - ticks_ += ticks; - return *this; -} - -inline TickInterval::TickInterval() : interval_(0) { -} - -inline TickInterval::TickInterval(const int64_t interval) - : interval_(interval) { -} - -inline TickInterval& TickInterval::operator+=(const TickInterval& rhs) { - interval_ += rhs.interval_; - return *this; -} - -inline TickInterval& TickInterval::operator-=(const TickInterval& rhs) { - interval_ -= rhs.interval_; - return *this; -} - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TICK_UTIL_H_ diff --git a/include/webrtc/system_wrappers/include/timestamp_extrapolator.h b/include/webrtc/system_wrappers/include/timestamp_extrapolator.h deleted file mode 100644 index d9c5c6f..0000000 --- a/include/webrtc/system_wrappers/include/timestamp_extrapolator.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef SYSTEM_WRAPPERS_INCLUDE_TIMESTAMP_EXTRAPOLATOR_H_ -#define SYSTEM_WRAPPERS_INCLUDE_TIMESTAMP_EXTRAPOLATOR_H_ - -#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" -#include "webrtc/typedefs.h" - -namespace webrtc -{ - -class TimestampExtrapolator -{ -public: - explicit TimestampExtrapolator(int64_t start_ms); - ~TimestampExtrapolator(); - void Update(int64_t tMs, uint32_t ts90khz); - int64_t ExtrapolateLocalTime(uint32_t timestamp90khz); - void Reset(int64_t start_ms); - -private: - void CheckForWrapArounds(uint32_t ts90khz); - bool DelayChangeDetection(double error); - RWLockWrapper* _rwLock; - double _w[2]; - double _pP[2][2]; - int64_t _startMs; - int64_t _prevMs; - uint32_t _firstTimestamp; - int32_t _wrapArounds; - int64_t _prevUnwrappedTimestamp; - int64_t _prevWrapTimestamp; - const double _lambda; - bool _firstAfterReset; - uint32_t _packetCount; - const uint32_t _startUpFilterDelayInPackets; - - double _detectorAccumulatorPos; - double _detectorAccumulatorNeg; - const double _alarmThreshold; - const double _accDrift; - const double _accMaxError; - const double _pP11; -}; - -} // namespace webrtc - -#endif // SYSTEM_WRAPPERS_INCLUDE_TIMESTAMP_EXTRAPOLATOR_H_ diff --git a/include/webrtc/system_wrappers/include/trace.h b/include/webrtc/system_wrappers/include/trace.h deleted file mode 100644 index 25a3d74..0000000 --- a/include/webrtc/system_wrappers/include/trace.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - * System independent wrapper for logging runtime information to file. - * Note: All log messages will be written to the same trace file. - * Note: If too many messages are written to file there will be a build up of - * messages. Apply filtering to avoid that. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ - -#include "webrtc/common_types.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -#if defined(WEBRTC_RESTRICT_LOGGING) -// Disable all TRACE macros. The LOG macro is still functional. -#define WEBRTC_TRACE true ? (void) 0 : Trace::Add -#else -#define WEBRTC_TRACE Trace::Add -#endif - -class Trace { - public: - // The length of the trace text preceeding the log message. - static const int kBoilerplateLength; - // The position of the timestamp text within a trace. - static const int kTimestampPosition; - // The length of the timestamp (without "delta" field). - static const int kTimestampLength; - - // Increments the reference count to the trace. - static void CreateTrace(); - // Decrements the reference count to the trace. - static void ReturnTrace(); - // Note: any instance that writes to the trace file should increment and - // decrement the reference count on construction and destruction, - // respectively. - - // Specifies what type of messages should be written to the trace file. The - // filter parameter is a bitmask where each message type is enumerated by the - // TraceLevel enumerator. TODO(hellner): why is the TraceLevel enumerator not - // defined in this file? - static void set_level_filter(int filter); - - // Returns what type of messages are written to the trace file. - static int level_filter(); - - // Sets the file name. If add_file_counter is false the same file will be - // reused when it fills up. If it's true a new file with incremented name - // will be used. - static int32_t SetTraceFile(const char* file_name, - const bool add_file_counter = false); - - // Returns the name of the file that the trace is currently writing to. - static int32_t TraceFile(char file_name[1024]); - - // Registers callback to receive trace messages. - // TODO(hellner): Why not use OutStream instead? Why is TraceCallback not - // defined in this file? - static int32_t SetTraceCallback(TraceCallback* callback); - - // Adds a trace message for writing to file. The message is put in a queue - // for writing to file whenever possible for performance reasons. I.e. there - // is a crash it is possible that the last, vital logs are not logged yet. - // level is the type of message to log. If that type of messages is - // filtered it will not be written to file. module is an identifier for what - // part of the code the message is coming. - // id is an identifier that should be unique for that set of classes that - // are associated (e.g. all instances owned by an engine). - // msg and the ellipsis are the same as e.g. sprintf. - // TODO(hellner) Why is TraceModule not defined in this file? - static void Add(const TraceLevel level, - const TraceModule module, - const int32_t id, - const char* msg, ...); - - private: - static volatile int level_filter_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ diff --git a/include/webrtc/system_wrappers/include/utf_util_win.h b/include/webrtc/system_wrappers/include/utf_util_win.h deleted file mode 100644 index 0e3f2d0..0000000 --- a/include/webrtc/system_wrappers/include/utf_util_win.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Conversion functions for UTF-8 and UTF-16 strings on Windows. -// Duplicated from talk/base/win32.h. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_UTF_UTIL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_UTF_UTIL_H_ - -#ifdef WIN32 -#include -#include - -#include "webrtc/base/scoped_ptr.h" - -namespace webrtc { - -inline std::wstring ToUtf16(const char* utf8, size_t len) { - int len16 = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast(len), - NULL, 0); - rtc::scoped_ptr ws(new wchar_t[len16]); - ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast(len), ws.get(), - len16); - return std::wstring(ws.get(), len16); -} - -inline std::wstring ToUtf16(const std::string& str) { - return ToUtf16(str.data(), str.length()); -} - -inline std::string ToUtf8(const wchar_t* wide, size_t len) { - int len8 = ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast(len), - NULL, 0, NULL, NULL); - rtc::scoped_ptr ns(new char[len8]); - ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast(len), ns.get(), len8, - NULL, NULL); - return std::string(ns.get(), len8); -} - -inline std::string ToUtf8(const wchar_t* wide) { - return ToUtf8(wide, wcslen(wide)); -} - -inline std::string ToUtf8(const std::wstring& wstr) { - return ToUtf8(wstr.data(), wstr.length()); -} - -} // namespace webrtc - -#endif // WIN32 -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_UTF_UTIL_H_ diff --git a/include/webrtc/system_wrappers/source/condition_variable_event_win.h b/include/webrtc/system_wrappers/source/condition_variable_event_win.h deleted file mode 100644 index cdcef7d..0000000 --- a/include/webrtc/system_wrappers/source/condition_variable_event_win.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_EVENT_WIN_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_EVENT_WIN_H_ - -#include - -#include "webrtc/system_wrappers/include/condition_variable_wrapper.h" - -namespace webrtc { - -class ConditionVariableEventWin : public ConditionVariableWrapper { - public: - ConditionVariableEventWin(); - virtual ~ConditionVariableEventWin(); - - void SleepCS(CriticalSectionWrapper& crit_sect); - bool SleepCS(CriticalSectionWrapper& crit_sect, unsigned long max_time_inMS); - void Wake(); - void WakeAll(); - - private: - enum EventWakeUpType { - WAKEALL_0 = 0, - WAKEALL_1 = 1, - WAKE = 2, - EVENT_COUNT = 3 - }; - - unsigned int num_waiters_[2]; - EventWakeUpType eventID_; - CRITICAL_SECTION num_waiters_crit_sect_; - HANDLE events_[EVENT_COUNT]; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_EVENT_WIN_H_ diff --git a/include/webrtc/system_wrappers/source/condition_variable_native_win.h b/include/webrtc/system_wrappers/source/condition_variable_native_win.h deleted file mode 100644 index c22787f..0000000 --- a/include/webrtc/system_wrappers/source/condition_variable_native_win.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_NATIVE_WIN_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_NATIVE_WIN_H_ - -#include - -#include "webrtc/system_wrappers/include/condition_variable_wrapper.h" - -namespace webrtc { - -#if !defined CONDITION_VARIABLE_INIT -typedef struct RTL_CONDITION_VARIABLE_ { - void* Ptr; -} RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE; - -typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE; -#endif - -typedef void (WINAPI* PInitializeConditionVariable)(PCONDITION_VARIABLE); -typedef BOOL (WINAPI* PSleepConditionVariableCS)(PCONDITION_VARIABLE, - PCRITICAL_SECTION, DWORD); -typedef void (WINAPI* PWakeConditionVariable)(PCONDITION_VARIABLE); -typedef void (WINAPI* PWakeAllConditionVariable)(PCONDITION_VARIABLE); - -class ConditionVariableNativeWin : public ConditionVariableWrapper { - public: - static ConditionVariableWrapper* Create(); - virtual ~ConditionVariableNativeWin(); - - void SleepCS(CriticalSectionWrapper& crit_sect); - bool SleepCS(CriticalSectionWrapper& crit_sect, unsigned long max_time_inMS); - void Wake(); - void WakeAll(); - - private: - ConditionVariableNativeWin(); - - bool Init(); - - CONDITION_VARIABLE condition_variable_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_NATIVE_WIN_H_ diff --git a/include/webrtc/system_wrappers/source/condition_variable_posix.h b/include/webrtc/system_wrappers/source/condition_variable_posix.h deleted file mode 100644 index 0aab1f0..0000000 --- a/include/webrtc/system_wrappers/source/condition_variable_posix.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_POSIX_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_POSIX_H_ - -#include - -#include "webrtc/system_wrappers/include/condition_variable_wrapper.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class ConditionVariablePosix : public ConditionVariableWrapper { - public: - static ConditionVariableWrapper* Create(); - ~ConditionVariablePosix() override; - - void SleepCS(CriticalSectionWrapper& crit_sect) override; - bool SleepCS(CriticalSectionWrapper& crit_sect, - unsigned long max_time_in_ms) override; - void Wake() override; - void WakeAll() override; - - private: - ConditionVariablePosix(); - int Construct(); - - private: - pthread_cond_t cond_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CONDITION_VARIABLE_POSIX_H_ diff --git a/include/webrtc/system_wrappers/source/critical_section_posix.h b/include/webrtc/system_wrappers/source/critical_section_posix.h deleted file mode 100644 index 099f74c..0000000 --- a/include/webrtc/system_wrappers/source/critical_section_posix.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_POSIX_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_POSIX_H_ - -#include "webrtc/system_wrappers/include/critical_section_wrapper.h" - -#include - -namespace webrtc { - -class CriticalSectionPosix : public CriticalSectionWrapper { - public: - CriticalSectionPosix(); - - ~CriticalSectionPosix() override; - - void Enter() override; - void Leave() override; - - private: - pthread_mutex_t mutex_; - friend class ConditionVariablePosix; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_POSIX_H_ diff --git a/include/webrtc/system_wrappers/source/critical_section_win.h b/include/webrtc/system_wrappers/source/critical_section_win.h deleted file mode 100644 index 8268bc3..0000000 --- a/include/webrtc/system_wrappers/source/critical_section_win.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_WIN_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_WIN_H_ - -#include -#include "webrtc/system_wrappers/include/critical_section_wrapper.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class CriticalSectionWindows : public CriticalSectionWrapper { - public: - CriticalSectionWindows(); - - virtual ~CriticalSectionWindows(); - - virtual void Enter(); - virtual void Leave(); - - private: - CRITICAL_SECTION crit; - - friend class ConditionVariableEventWin; - friend class ConditionVariableNativeWin; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_WIN_H_ diff --git a/include/webrtc/system_wrappers/source/data_log_c_helpers_unittest.h b/include/webrtc/system_wrappers/source/data_log_c_helpers_unittest.h deleted file mode 100644 index ef86eae..0000000 --- a/include/webrtc/system_wrappers/source/data_log_c_helpers_unittest.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef SRC_SYSTEM_WRAPPERS_SOURCE_DATA_LOG_C_HELPERS_UNITTEST_H_ -#define SRC_SYSTEM_WRAPPERS_SOURCE_DATA_LOG_C_HELPERS_UNITTEST_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int WebRtcDataLogCHelper_TestCreateLog(); - -int WebRtcDataLogCHelper_TestReturnLog(); - -int WebRtcDataLogCHelper_TestCombine(); - -int WebRtcDataLogCHelper_TestAddTable(); - -int WebRtcDataLogCHelper_TestAddColumn(); - -int WebRtcDataLogCHelper_TestNextRow(); - -int WebRtcDataLogCHelper_TestInsertCell_int(); - -int WebRtcDataLogCHelper_TestInsertArray_int(); - -int WebRtcDataLogCHelper_TestInsertCell_float(); - -int WebRtcDataLogCHelper_TestInsertArray_float(); - -int WebRtcDataLogCHelper_TestInsertCell_double(); - -int WebRtcDataLogCHelper_TestInsertArray_double(); - -int WebRtcDataLogCHelper_TestInsertCell_int32(); - -int WebRtcDataLogCHelper_TestInsertArray_int32(); - -int WebRtcDataLogCHelper_TestInsertCell_uint32(); - -int WebRtcDataLogCHelper_TestInsertArray_uint32(); - -int WebRtcDataLogCHelper_TestInsertCell_int64(); - -int WebRtcDataLogCHelper_TestInsertArray_int64(); - -#ifdef __cplusplus -} // end of extern "C" -#endif - -#endif // SRC_SYSTEM_WRAPPERS_SOURCE_DATA_LOG_C_HELPERS_UNITTEST_H_ diff --git a/include/webrtc/system_wrappers/source/event_timer_posix.h b/include/webrtc/system_wrappers/source/event_timer_posix.h deleted file mode 100644 index bbf51f7..0000000 --- a/include/webrtc/system_wrappers/source/event_timer_posix.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ - -#include "webrtc/system_wrappers/include/event_wrapper.h" - -#include -#include - -#include "webrtc/base/platform_thread.h" - -namespace webrtc { - -enum State { - kUp = 1, - kDown = 2 -}; - -class EventTimerPosix : public EventTimerWrapper { - public: - EventTimerPosix(); - ~EventTimerPosix() override; - - EventTypeWrapper Wait(unsigned long max_time) override; - bool Set() override; - - bool StartTimer(bool periodic, unsigned long time) override; - bool StopTimer() override; - - private: - static bool Run(void* obj); - bool Process(); - EventTypeWrapper Wait(timespec* end_at); - - private: - pthread_cond_t cond_; - pthread_mutex_t mutex_; - bool event_set_; - - // TODO(pbos): Remove scoped_ptr and use PlatformThread directly. - rtc::scoped_ptr timer_thread_; - rtc::scoped_ptr timer_event_; - timespec created_at_; - - bool periodic_; - unsigned long time_; // In ms - unsigned long count_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ diff --git a/include/webrtc/system_wrappers/source/event_timer_win.h b/include/webrtc/system_wrappers/source/event_timer_win.h deleted file mode 100644 index 163cdde..0000000 --- a/include/webrtc/system_wrappers/source/event_timer_win.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_WIN_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_WIN_H_ - -#include - -#include "webrtc/system_wrappers/include/event_wrapper.h" - -#include "webrtc/typedefs.h" - -namespace webrtc { - -class EventTimerWin : public EventTimerWrapper { - public: - EventTimerWin(); - virtual ~EventTimerWin(); - - virtual EventTypeWrapper Wait(unsigned long max_time); - virtual bool Set(); - - virtual bool StartTimer(bool periodic, unsigned long time); - virtual bool StopTimer(); - - private: - HANDLE event_; - uint32_t timerID_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_WIN_H_ diff --git a/include/webrtc/system_wrappers/source/file_impl.h b/include/webrtc/system_wrappers/source/file_impl.h deleted file mode 100644 index 06ba582..0000000 --- a/include/webrtc/system_wrappers/source/file_impl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_FILE_IMPL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_FILE_IMPL_H_ - -#include - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/include/file_wrapper.h" - -namespace webrtc { - -class RWLockWrapper; - -class FileWrapperImpl : public FileWrapper { - public: - FileWrapperImpl(); - ~FileWrapperImpl() override; - - int FileName(char* file_name_utf8, size_t size) const override; - - bool Open() const override; - - int OpenFile(const char* file_name_utf8, - bool read_only, - bool loop = false, - bool text = false) override; - - int OpenFromFileHandle(FILE* handle, - bool manage_file, - bool read_only, - bool loop = false) override; - - int CloseFile() override; - int SetMaxFileSize(size_t bytes) override; - int Flush() override; - - int Read(void* buf, size_t length) override; - bool Write(const void* buf, size_t length) override; - int WriteText(const char* format, ...) override; - int Rewind() override; - - private: - int CloseFileImpl(); - int FlushImpl(); - - rtc::scoped_ptr rw_lock_; - - FILE* id_; - bool managed_file_handle_; - bool open_; - bool looping_; - bool read_only_; - size_t max_size_in_bytes_; // -1 indicates file size limitation is off - size_t size_in_bytes_; - char file_name_utf8_[kMaxFileNameSize]; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_FILE_IMPL_H_ diff --git a/include/webrtc/system_wrappers/source/rw_lock_generic.h b/include/webrtc/system_wrappers/source/rw_lock_generic.h deleted file mode 100644 index f0d4456..0000000 --- a/include/webrtc/system_wrappers/source/rw_lock_generic.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_GENERIC_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_GENERIC_H_ - -#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class CriticalSectionWrapper; -class ConditionVariableWrapper; - -class RWLockGeneric : public RWLockWrapper { - public: - RWLockGeneric(); - ~RWLockGeneric() override; - - void AcquireLockExclusive() override; - void ReleaseLockExclusive() override; - - void AcquireLockShared() override; - void ReleaseLockShared() override; - - private: - CriticalSectionWrapper* critical_section_; - ConditionVariableWrapper* read_condition_; - ConditionVariableWrapper* write_condition_; - - int readers_active_; - bool writer_active_; - int readers_waiting_; - int writers_waiting_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_GENERIC_H_ diff --git a/include/webrtc/system_wrappers/source/rw_lock_posix.h b/include/webrtc/system_wrappers/source/rw_lock_posix.h deleted file mode 100644 index 0ce7305..0000000 --- a/include/webrtc/system_wrappers/source/rw_lock_posix.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_ - -#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" -#include "webrtc/typedefs.h" - -#include - -namespace webrtc { - -class RWLockPosix : public RWLockWrapper { - public: - static RWLockPosix* Create(); - ~RWLockPosix() override; - - void AcquireLockExclusive() override; - void ReleaseLockExclusive() override; - - void AcquireLockShared() override; - void ReleaseLockShared() override; - - private: - RWLockPosix(); - bool Init(); - - pthread_rwlock_t lock_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_ diff --git a/include/webrtc/system_wrappers/source/rw_lock_win.h b/include/webrtc/system_wrappers/source/rw_lock_win.h deleted file mode 100644 index c279eab..0000000 --- a/include/webrtc/system_wrappers/source/rw_lock_win.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_ - -#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" - -#include - -namespace webrtc { - -class RWLockWin : public RWLockWrapper { - public: - static RWLockWin* Create(); - ~RWLockWin() {} - - virtual void AcquireLockExclusive(); - virtual void ReleaseLockExclusive(); - - virtual void AcquireLockShared(); - virtual void ReleaseLockShared(); - - private: - RWLockWin(); - static bool LoadModule(); - - SRWLOCK lock_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_ diff --git a/include/webrtc/system_wrappers/source/trace_impl.h b/include/webrtc/system_wrappers/source/trace_impl.h deleted file mode 100644 index c6d81d5..0000000 --- a/include/webrtc/system_wrappers/source/trace_impl.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_ - -#include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/include/event_wrapper.h" -#include "webrtc/system_wrappers/include/file_wrapper.h" -#include "webrtc/system_wrappers/include/static_instance.h" -#include "webrtc/base/platform_thread.h" -#include "webrtc/system_wrappers/include/trace.h" - -namespace webrtc { - -#define WEBRTC_TRACE_MAX_MESSAGE_SIZE 1024 -// Total buffer size is WEBRTC_TRACE_NUM_ARRAY (number of buffer partitions) * -// WEBRTC_TRACE_MAX_QUEUE (number of lines per buffer partition) * -// WEBRTC_TRACE_MAX_MESSAGE_SIZE (number of 1 byte charachters per line) = -// 1 or 4 Mbyte. - -#define WEBRTC_TRACE_MAX_FILE_SIZE 100*1000 -// Number of rows that may be written to file. On average 110 bytes per row (max -// 256 bytes per row). So on average 110*100*1000 = 11 Mbyte, max 256*100*1000 = -// 25.6 Mbyte - -class TraceImpl : public Trace { - public: - virtual ~TraceImpl(); - - static TraceImpl* CreateInstance(); - static TraceImpl* GetTrace(const TraceLevel level = kTraceAll); - - int32_t SetTraceFileImpl(const char* file_name, const bool add_file_counter); - int32_t TraceFileImpl(char file_name[FileWrapper::kMaxFileNameSize]); - - int32_t SetTraceCallbackImpl(TraceCallback* callback); - - void AddImpl(const TraceLevel level, const TraceModule module, - const int32_t id, const char* msg); - - bool TraceCheck(const TraceLevel level) const; - - protected: - TraceImpl(); - - static TraceImpl* StaticInstance(CountOperation count_operation, - const TraceLevel level = kTraceAll); - - int32_t AddThreadId(char* trace_message) const; - - // OS specific implementations. - virtual int32_t AddTime(char* trace_message, - const TraceLevel level) const = 0; - - virtual int32_t AddDateTimeInfo(char* trace_message) const = 0; - - private: - friend class Trace; - - int32_t AddLevel(char* sz_message, const TraceLevel level) const; - - int32_t AddModuleAndId(char* trace_message, const TraceModule module, - const int32_t id) const; - - int32_t AddMessage(char* trace_message, - const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE], - const uint16_t written_so_far) const; - - void AddMessageToList( - const char trace_message[WEBRTC_TRACE_MAX_MESSAGE_SIZE], - const uint16_t length, - const TraceLevel level); - - bool UpdateFileName( - const char file_name_utf8[FileWrapper::kMaxFileNameSize], - char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize], - const uint32_t new_count) const; - - bool CreateFileName( - const char file_name_utf8[FileWrapper::kMaxFileNameSize], - char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize], - const uint32_t new_count) const; - - void WriteToFile(const char* msg, uint16_t length) - EXCLUSIVE_LOCKS_REQUIRED(crit_); - - TraceCallback* callback_ GUARDED_BY(crit_); - uint32_t row_count_text_ GUARDED_BY(crit_); - uint32_t file_count_text_ GUARDED_BY(crit_); - - const rtc::scoped_ptr trace_file_ GUARDED_BY(crit_); - rtc::CriticalSection crit_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_ diff --git a/include/webrtc/system_wrappers/source/trace_posix.h b/include/webrtc/system_wrappers/source/trace_posix.h deleted file mode 100644 index 25dfeec..0000000 --- a/include/webrtc/system_wrappers/source/trace_posix.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_ - -#include "webrtc/system_wrappers/include/critical_section_wrapper.h" -#include "webrtc/system_wrappers/source/trace_impl.h" - -namespace webrtc { - -class TracePosix : public TraceImpl { - public: - TracePosix(); - ~TracePosix() override; - - // This method can be called on several different threads different from - // the creating thread. - int32_t AddTime(char* trace_message, const TraceLevel level) const override; - - int32_t AddDateTimeInfo(char* trace_message) const override; - - private: - volatile mutable uint32_t prev_api_tick_count_; - volatile mutable uint32_t prev_tick_count_; - - CriticalSectionWrapper& crit_sect_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_ diff --git a/include/webrtc/system_wrappers/source/trace_win.h b/include/webrtc/system_wrappers/source/trace_win.h deleted file mode 100644 index 1311b23..0000000 --- a/include/webrtc/system_wrappers/source/trace_win.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_WIN_H_ -#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_WIN_H_ - -#include -#include - -#include "webrtc/system_wrappers/source/trace_impl.h" - -namespace webrtc { - -class TraceWindows : public TraceImpl { - public: - TraceWindows(); - virtual ~TraceWindows(); - - virtual int32_t AddTime(char* trace_message, const TraceLevel level) const; - - virtual int32_t AddDateTimeInfo(char* trace_message) const; - private: - volatile mutable uint32_t prev_api_tick_count_; - volatile mutable uint32_t prev_tick_count_; -}; - -} // namespace webrtc - -#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_WIN_H_ diff --git a/include/webrtc/transport.h b/include/webrtc/transport.h deleted file mode 100644 index 4e329de..0000000 --- a/include/webrtc/transport.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_TRANSPORT_H_ -#define WEBRTC_TRANSPORT_H_ - -#include - -#include "webrtc/typedefs.h" - -namespace webrtc { - -// TODO(holmer): Look into unifying this with the PacketOptions in -// asyncpacketsocket.h. -struct PacketOptions { - // A 16 bits positive id. Negative ids are invalid and should be interpreted - // as packet_id not being set. - int packet_id = -1; -}; - -class Transport { - public: - virtual bool SendRtp(const uint8_t* packet, - size_t length, - const PacketOptions& options) = 0; - virtual bool SendRtcp(const uint8_t* packet, size_t length) = 0; - - protected: - virtual ~Transport() {} -}; - -} // namespace webrtc - -#endif // WEBRTC_TRANSPORT_H_ diff --git a/include/webrtc/typedefs.h b/include/webrtc/typedefs.h deleted file mode 100644 index f3839c7..0000000 --- a/include/webrtc/typedefs.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This file contains platform-specific typedefs and defines. -// Much of it is derived from Chromium's build/build_config.h. - -#ifndef WEBRTC_TYPEDEFS_H_ -#define WEBRTC_TYPEDEFS_H_ - -// Processor architecture detection. For more info on what's defined, see: -// http://msdn.microsoft.com/en-us/library/b0084kay.aspx -// http://www.agner.org/optimize/calling_conventions.pdf -// or with gcc, run: "echo | gcc -E -dM -" -#if defined(_M_X64) || defined(__x86_64__) -#define WEBRTC_ARCH_X86_FAMILY -#define WEBRTC_ARCH_X86_64 -#define WEBRTC_ARCH_64_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__aarch64__) -#define WEBRTC_ARCH_ARM_FAMILY -#define WEBRTC_ARCH_64_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(_M_IX86) || defined(__i386__) -#define WEBRTC_ARCH_X86_FAMILY -#define WEBRTC_ARCH_X86 -#define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__ARMEL__) -#define WEBRTC_ARCH_ARM_FAMILY -#define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__MIPSEL__) -#if defined(__LP64__) -#define WEBRTC_ARCH_MIPS64_FAMILY -#else -#define WEBRTC_ARCH_MIPS_FAMILY -#endif -#define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__pnacl__) -#define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#else -#error Please add support for your architecture in typedefs.h -#endif - -#if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN)) -#error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN -#endif - -// TODO(zhongwei.yao): WEBRTC_CPU_DETECTION is only used in one place; we should -// probably just remove it. -#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) || \ - defined(WEBRTC_DETECT_NEON) -#define WEBRTC_CPU_DETECTION -#endif - -// TODO(pbos): Use webrtc/base/basictypes.h instead to include fixed-size ints. -#include - -// Annotate a function indicating the caller must examine the return value. -// Use like: -// int foo() WARN_UNUSED_RESULT; -// To explicitly ignore a result, see |ignore_result()| in . -// TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and -// libjingle are merged. -#if !defined(WARN_UNUSED_RESULT) -#if defined(__GNUC__) || defined(__clang__) -#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define WARN_UNUSED_RESULT -#endif -#endif // WARN_UNUSED_RESULT - -// Put after a variable that might not be used, to prevent compiler warnings: -// int result ATTRIBUTE_UNUSED = DoSomething(); -// assert(result == 17); -#ifndef ATTRIBUTE_UNUSED -#if defined(__GNUC__) || defined(__clang__) -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#else -#define ATTRIBUTE_UNUSED -#endif -#endif - -// Macro to be used for switch-case fallthrough (required for enabling -// -Wimplicit-fallthrough warning on Clang). -#ifndef FALLTHROUGH -#if defined(__clang__) -#define FALLTHROUGH() [[clang::fallthrough]] -#else -#define FALLTHROUGH() do { } while (0) -#endif -#endif - -// Annotate a function that will not return control flow to the caller. -#if defined(_MSC_VER) -#define NO_RETURN __declspec(noreturn) -#elif defined(__GNUC__) -#define NO_RETURN __attribute__((noreturn)) -#else -#define NO_RETURN -#endif - -#endif // WEBRTC_TYPEDEFS_H_ diff --git a/include/webrtc/video_decoder.h b/include/webrtc/video_decoder.h deleted file mode 100644 index 3cd94e8..0000000 --- a/include/webrtc/video_decoder.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_DECODER_H_ -#define WEBRTC_VIDEO_DECODER_H_ - -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { - -class RTPFragmentationHeader; -// TODO(pbos): Expose these through a public (root) header or change these APIs. -struct CodecSpecificInfo; -struct VideoCodec; - -class DecodedImageCallback { - public: - virtual ~DecodedImageCallback() {} - - virtual int32_t Decoded(VideoFrame& decodedImage) = 0; - // Provides an alternative interface that allows the decoder to specify the - // decode time excluding waiting time for any previous pending frame to - // return. This is necessary for breaking positive feedback in the delay - // estimation when the decoder has a single output buffer. - // TODO(perkj): Remove default implementation when chromium has been updated. - virtual int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) { - // The default implementation ignores custom decode time value. - return Decoded(decodedImage); - } - - virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) { - return -1; - } - - virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; } -}; - -class VideoDecoder { - public: - enum DecoderType { - kH264, - kVp8, - kVp9, - kUnsupportedCodec, - }; - - static VideoDecoder* Create(DecoderType codec_type); - - virtual ~VideoDecoder() {} - - virtual int32_t InitDecode(const VideoCodec* codec_settings, - int32_t number_of_cores) = 0; - - virtual int32_t Decode(const EncodedImage& input_image, - bool missing_frames, - const RTPFragmentationHeader* fragmentation, - const CodecSpecificInfo* codec_specific_info = NULL, - int64_t render_time_ms = -1) = 0; - - virtual int32_t RegisterDecodeCompleteCallback( - DecodedImageCallback* callback) = 0; - - virtual int32_t Release() = 0; - virtual int32_t Reset() = 0; - - // Returns true if the decoder prefer to decode frames late. - // That is, it can not decode infinite number of frames before the decoded - // frame is consumed. - virtual bool PrefersLateDecoding() const { return true; } - - virtual const char* ImplementationName() const { return "unknown"; } -}; - -// Class used to wrap external VideoDecoders to provide a fallback option on -// software decoding when a hardware decoder fails to decode a stream due to -// hardware restrictions, such as max resolution. -class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { - public: - VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, - VideoDecoder* decoder); - - int32_t InitDecode(const VideoCodec* codec_settings, - int32_t number_of_cores) override; - - int32_t Decode(const EncodedImage& input_image, - bool missing_frames, - const RTPFragmentationHeader* fragmentation, - const CodecSpecificInfo* codec_specific_info, - int64_t render_time_ms) override; - - int32_t RegisterDecodeCompleteCallback( - DecodedImageCallback* callback) override; - - int32_t Release() override; - int32_t Reset() override; - bool PrefersLateDecoding() const override; - - const char* ImplementationName() const override; - - private: - bool InitFallbackDecoder(); - - const DecoderType decoder_type_; - VideoDecoder* const decoder_; - - VideoCodec codec_settings_; - int32_t number_of_cores_; - std::string fallback_implementation_name_; - rtc::scoped_ptr fallback_decoder_; - DecodedImageCallback* callback_; -}; - -} // namespace webrtc - -#endif // WEBRTC_VIDEO_DECODER_H_ diff --git a/include/webrtc/video_encoder.h b/include/webrtc/video_encoder.h deleted file mode 100644 index 9e7e4d7..0000000 --- a/include/webrtc/video_encoder.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_ENCODER_H_ -#define WEBRTC_VIDEO_ENCODER_H_ - -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { - -class RTPFragmentationHeader; -// TODO(pbos): Expose these through a public (root) header or change these APIs. -struct CodecSpecificInfo; -struct VideoCodec; - -class EncodedImageCallback { - public: - virtual ~EncodedImageCallback() {} - - // Callback function which is called when an image has been encoded. - virtual int32_t Encoded(const EncodedImage& encoded_image, - const CodecSpecificInfo* codec_specific_info, - const RTPFragmentationHeader* fragmentation) = 0; -}; - -class VideoEncoder { - public: - enum EncoderType { - kH264, - kVp8, - kVp9, - kUnsupportedCodec, - }; - - static VideoEncoder* Create(EncoderType codec_type); - - static VideoCodecVP8 GetDefaultVp8Settings(); - static VideoCodecVP9 GetDefaultVp9Settings(); - static VideoCodecH264 GetDefaultH264Settings(); - - virtual ~VideoEncoder() {} - - // Initialize the encoder with the information from the codecSettings - // - // Input: - // - codec_settings : Codec settings - // - number_of_cores : Number of cores available for the encoder - // - max_payload_size : The maximum size each payload is allowed - // to have. Usually MTU - overhead. - // - // Return value : Set bit rate if OK - // <0 - Errors: - // WEBRTC_VIDEO_CODEC_ERR_PARAMETER - // WEBRTC_VIDEO_CODEC_ERR_SIZE - // WEBRTC_VIDEO_CODEC_LEVEL_EXCEEDED - // WEBRTC_VIDEO_CODEC_MEMORY - // WEBRTC_VIDEO_CODEC_ERROR - virtual int32_t InitEncode(const VideoCodec* codec_settings, - int32_t number_of_cores, - size_t max_payload_size) = 0; - - // Register an encode complete callback object. - // - // Input: - // - callback : Callback object which handles encoded images. - // - // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. - virtual int32_t RegisterEncodeCompleteCallback( - EncodedImageCallback* callback) = 0; - - // Free encoder memory. - // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. - virtual int32_t Release() = 0; - - // Encode an I420 image (as a part of a video stream). The encoded image - // will be returned to the user through the encode complete callback. - // - // Input: - // - frame : Image to be encoded - // - frame_types : Frame type to be generated by the encoder. - // - // Return value : WEBRTC_VIDEO_CODEC_OK if OK - // <0 - Errors: - // WEBRTC_VIDEO_CODEC_ERR_PARAMETER - // WEBRTC_VIDEO_CODEC_MEMORY - // WEBRTC_VIDEO_CODEC_ERROR - // WEBRTC_VIDEO_CODEC_TIMEOUT - virtual int32_t Encode(const VideoFrame& frame, - const CodecSpecificInfo* codec_specific_info, - const std::vector* frame_types) = 0; - - // Inform the encoder of the new packet loss rate and the round-trip time of - // the network. - // - // Input: - // - packet_loss : Fraction lost - // (loss rate in percent = 100 * packetLoss / 255) - // - rtt : Round-trip time in milliseconds - // Return value : WEBRTC_VIDEO_CODEC_OK if OK - // <0 - Errors: WEBRTC_VIDEO_CODEC_ERROR - virtual int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) = 0; - - // Inform the encoder about the new target bit rate. - // - // Input: - // - bitrate : New target bit rate - // - framerate : The target frame rate - // - // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. - virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; - - virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } - virtual void OnDroppedFrame() {} - virtual int GetTargetFramerate() { return -1; } - virtual bool SupportsNativeHandle() const { return false; } - virtual const char* ImplementationName() const { return "unknown"; } -}; - -// Class used to wrap external VideoEncoders to provide a fallback option on -// software encoding when a hardware encoder fails to encode a stream due to -// hardware restrictions, such as max resolution. -class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { - public: - VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type, - webrtc::VideoEncoder* encoder); - - int32_t InitEncode(const VideoCodec* codec_settings, - int32_t number_of_cores, - size_t max_payload_size) override; - - int32_t RegisterEncodeCompleteCallback( - EncodedImageCallback* callback) override; - - int32_t Release() override; - int32_t Encode(const VideoFrame& frame, - const CodecSpecificInfo* codec_specific_info, - const std::vector* frame_types) override; - int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; - - int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; - void OnDroppedFrame() override; - int GetTargetFramerate() override; - bool SupportsNativeHandle() const override; - const char* ImplementationName() const override; - - private: - bool InitFallbackEncoder(); - - // Settings used in the last InitEncode call and used if a dynamic fallback to - // software is required. - VideoCodec codec_settings_; - int32_t number_of_cores_; - size_t max_payload_size_; - - // The last bitrate/framerate set, and a flag for noting they are set. - bool rates_set_; - uint32_t bitrate_; - uint32_t framerate_; - - // The last channel parameters set, and a flag for noting they are set. - bool channel_parameters_set_; - uint32_t packet_loss_; - int64_t rtt_; - - const EncoderType encoder_type_; - webrtc::VideoEncoder* const encoder_; - - rtc::scoped_ptr fallback_encoder_; - std::string fallback_implementation_name_; - EncodedImageCallback* callback_; -}; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENCODER_H_ diff --git a/include/webrtc/video_frame.h b/include/webrtc/video_frame.h deleted file mode 100644 index 7ad0c32..0000000 --- a/include/webrtc/video_frame.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_FRAME_H_ -#define WEBRTC_VIDEO_FRAME_H_ - -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/common_types.h" -#include "webrtc/common_video/include/video_frame_buffer.h" -#include "webrtc/common_video/rotation.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class VideoFrame { - public: - VideoFrame(); - VideoFrame(const rtc::scoped_refptr& buffer, - uint32_t timestamp, - int64_t render_time_ms, - VideoRotation rotation); - - // TODO(pbos): Make all create/copy functions void, they should not be able to - // fail (which should be RTC_DCHECK/CHECKed instead). - - // CreateEmptyFrame: Sets frame dimensions and allocates buffers based - // on set dimensions - height and plane stride. - // If required size is bigger than the allocated one, new buffers of adequate - // size will be allocated. - // Return value: 0 on success, -1 on error. - int CreateEmptyFrame(int width, - int height, - int stride_y, - int stride_u, - int stride_v); - - // CreateFrame: Sets the frame's members and buffers. If required size is - // bigger than allocated one, new buffers of adequate size will be allocated. - // Return value: 0 on success, -1 on error. - int CreateFrame(const uint8_t* buffer_y, - const uint8_t* buffer_u, - const uint8_t* buffer_v, - int width, - int height, - int stride_y, - int stride_u, - int stride_v); - - // TODO(guoweis): remove the previous CreateFrame when chromium has this code. - int CreateFrame(const uint8_t* buffer_y, - const uint8_t* buffer_u, - const uint8_t* buffer_v, - int width, - int height, - int stride_y, - int stride_u, - int stride_v, - VideoRotation rotation); - - // CreateFrame: Sets the frame's members and buffers. If required size is - // bigger than allocated one, new buffers of adequate size will be allocated. - // |buffer| must be a packed I420 buffer. - // Return value: 0 on success, -1 on error. - int CreateFrame(const uint8_t* buffer, - int width, - int height, - VideoRotation rotation); - - // Deep copy frame: If required size is bigger than allocated one, new - // buffers of adequate size will be allocated. - // Return value: 0 on success, -1 on error. - int CopyFrame(const VideoFrame& videoFrame); - - // Creates a shallow copy of |videoFrame|, i.e, the this object will retain a - // reference to the video buffer also retained by |videoFrame|. - void ShallowCopy(const VideoFrame& videoFrame); - - // Release frame buffer and reset time stamps. - void Reset(); - - // Get pointer to buffer per plane. - uint8_t* buffer(PlaneType type); - // Overloading with const. - const uint8_t* buffer(PlaneType type) const; - - // Get allocated size per plane. - int allocated_size(PlaneType type) const; - - // Get allocated stride per plane. - int stride(PlaneType type) const; - - // Get frame width. - int width() const; - - // Get frame height. - int height() const; - - // Set frame timestamp (90kHz). - void set_timestamp(uint32_t timestamp) { timestamp_ = timestamp; } - - // Get frame timestamp (90kHz). - uint32_t timestamp() const { return timestamp_; } - - // Set capture ntp time in miliseconds. - void set_ntp_time_ms(int64_t ntp_time_ms) { - ntp_time_ms_ = ntp_time_ms; - } - - // Get capture ntp time in miliseconds. - int64_t ntp_time_ms() const { return ntp_time_ms_; } - - // Naming convention for Coordination of Video Orientation. Please see - // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf - // - // "pending rotation" or "pending" = a frame that has a VideoRotation > 0. - // - // "not pending" = a frame that has a VideoRotation == 0. - // - // "apply rotation" = modify a frame from being "pending" to being "not - // pending" rotation (a no-op for "unrotated"). - // - VideoRotation rotation() const { return rotation_; } - void set_rotation(VideoRotation rotation) { - rotation_ = rotation; - } - - // Set render time in miliseconds. - void set_render_time_ms(int64_t render_time_ms) { - render_time_ms_ = render_time_ms; - } - - // Get render time in miliseconds. - int64_t render_time_ms() const { return render_time_ms_; } - - // Return true if underlying plane buffers are of zero size, false if not. - bool IsZeroSize() const; - - // Return the handle of the underlying video frame. This is used when the - // frame is backed by a texture. The object should be destroyed when it is no - // longer in use, so the underlying resource can be freed. - void* native_handle() const; - - // Return the underlying buffer. - rtc::scoped_refptr video_frame_buffer() const; - - // Set the underlying buffer. - void set_video_frame_buffer( - const rtc::scoped_refptr& buffer); - - // Convert native-handle frame to memory-backed I420 frame. Should not be - // called on a non-native-handle frame. - VideoFrame ConvertNativeToI420Frame() const; - - private: - // An opaque reference counted handle that stores the pixel data. - rtc::scoped_refptr video_frame_buffer_; - uint32_t timestamp_; - int64_t ntp_time_ms_; - int64_t render_time_ms_; - VideoRotation rotation_; -}; - - -// TODO(pbos): Rename EncodedFrame and reformat this class' members. -class EncodedImage { - public: - EncodedImage() : EncodedImage(nullptr, 0, 0) {} - EncodedImage(uint8_t* buffer, size_t length, size_t size) - : _buffer(buffer), _length(length), _size(size) {} - - struct AdaptReason { - AdaptReason() - : quality_resolution_downscales(-1), - bw_resolutions_disabled(-1) {} - - int quality_resolution_downscales; // Number of times this frame is down - // scaled in resolution due to quality. - // Or -1 if information is not provided. - int bw_resolutions_disabled; // Number of resolutions that are not sent - // due to bandwidth for this frame. - // Or -1 if information is not provided. - }; - uint32_t _encodedWidth = 0; - uint32_t _encodedHeight = 0; - uint32_t _timeStamp = 0; - // NTP time of the capture time in local timebase in milliseconds. - int64_t ntp_time_ms_ = 0; - int64_t capture_time_ms_ = 0; - FrameType _frameType = kVideoFrameDelta; - uint8_t* _buffer; - size_t _length; - size_t _size; - bool _completeFrame = false; - AdaptReason adapt_reason_; - int qp_ = -1; // Quantizer value. -}; - -} // namespace webrtc -#endif // WEBRTC_VIDEO_FRAME_H_ diff --git a/include/webrtc/video_receive_stream.h b/include/webrtc/video_receive_stream.h deleted file mode 100644 index 51d8426..0000000 --- a/include/webrtc/video_receive_stream.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_RECEIVE_STREAM_H_ -#define WEBRTC_VIDEO_RECEIVE_STREAM_H_ - -#include -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/config.h" -#include "webrtc/frame_callback.h" -#include "webrtc/stream.h" -#include "webrtc/transport.h" -#include "webrtc/video_renderer.h" - -namespace webrtc { - -class VideoDecoder; - -class VideoReceiveStream : public ReceiveStream { - public: - // TODO(mflodman) Move all these settings to VideoDecoder and move the - // declaration to common_types.h. - struct Decoder { - std::string ToString() const; - - // The actual decoder instance. - VideoDecoder* decoder = nullptr; - - // Received RTP packets with this payload type will be sent to this decoder - // instance. - int payload_type = 0; - - // Name of the decoded payload (such as VP8). Maps back to the depacketizer - // used to unpack incoming packets. - std::string payload_name; - }; - - struct Stats { - int network_frame_rate = 0; - int decode_frame_rate = 0; - int render_frame_rate = 0; - - // Decoder stats. - std::string decoder_implementation_name = "unknown"; - FrameCounts frame_counts; - int decode_ms = 0; - int max_decode_ms = 0; - int current_delay_ms = 0; - int target_delay_ms = 0; - int jitter_buffer_ms = 0; - int min_playout_delay_ms = 0; - int render_delay_ms = 10; - - int current_payload_type = -1; - - int total_bitrate_bps = 0; - int discarded_packets = 0; - - uint32_t ssrc = 0; - std::string c_name; - StreamDataCounters rtp_stats; - RtcpPacketTypeCounter rtcp_packet_type_counts; - RtcpStatistics rtcp_stats; - }; - - struct Config { - Config() = delete; - explicit Config(Transport* rtcp_send_transport) - : rtcp_send_transport(rtcp_send_transport) {} - - std::string ToString() const; - - // Decoders for every payload that we can receive. - std::vector decoders; - - // Receive-stream specific RTP settings. - struct Rtp { - std::string ToString() const; - - // Synchronization source (stream identifier) to be received. - uint32_t remote_ssrc = 0; - // Sender SSRC used for sending RTCP (such as receiver reports). - uint32_t local_ssrc = 0; - - // See RtcpMode for description. - RtcpMode rtcp_mode = RtcpMode::kCompound; - - // Extended RTCP settings. - struct RtcpXr { - // True if RTCP Receiver Reference Time Report Block extension - // (RFC 3611) should be enabled. - bool receiver_reference_time_report = false; - } rtcp_xr; - - // See draft-alvestrand-rmcat-remb for information. - bool remb = false; - - // See draft-holmer-rmcat-transport-wide-cc-extensions for details. - bool transport_cc = false; - - // See NackConfig for description. - NackConfig nack; - - // See FecConfig for description. - FecConfig fec; - - // RTX settings for incoming video payloads that may be received. RTX is - // disabled if there's no config present. - struct Rtx { - // SSRCs to use for the RTX streams. - uint32_t ssrc = 0; - - // Payload type to use for the RTX stream. - int payload_type = 0; - }; - - // Map from video RTP payload type -> RTX config. - typedef std::map RtxMap; - RtxMap rtx; - - // If set to true, the RTX payload type mapping supplied in |rtx| will be - // used when restoring RTX packets. Without it, RTX packets will always be - // restored to the last non-RTX packet payload type received. - bool use_rtx_payload_mapping_on_restore = false; - - // RTP header extensions used for the received stream. - std::vector extensions; - } rtp; - - // Transport for outgoing packets (RTCP). - Transport* rtcp_send_transport = nullptr; - - // VideoRenderer will be called for each decoded frame. 'nullptr' disables - // rendering of this stream. - VideoRenderer* renderer = nullptr; - - // Expected delay needed by the renderer, i.e. the frame will be delivered - // this many milliseconds, if possible, earlier than the ideal render time. - // Only valid if 'renderer' is set. - int render_delay_ms = 10; - - // Identifier for an A/V synchronization group. Empty string to disable. - // TODO(pbos): Synchronize streams in a sync group, not just video streams - // to one of the audio streams. - std::string sync_group; - - // Called for each incoming video frame, i.e. in encoded state. E.g. used - // when - // saving the stream to a file. 'nullptr' disables the callback. - EncodedFrameObserver* pre_decode_callback = nullptr; - - // Called for each decoded frame. E.g. used when adding effects to the - // decoded - // stream. 'nullptr' disables the callback. - I420FrameCallback* pre_render_callback = nullptr; - - // Target delay in milliseconds. A positive value indicates this stream is - // used for streaming instead of a real-time call. - int target_delay_ms = 0; - }; - - // TODO(pbos): Add info on currently-received codec to Stats. - virtual Stats GetStats() const = 0; -}; - -} // namespace webrtc - -#endif // WEBRTC_VIDEO_RECEIVE_STREAM_H_ diff --git a/include/webrtc/video_renderer.h b/include/webrtc/video_renderer.h deleted file mode 100644 index 7cb9ed1..0000000 --- a/include/webrtc/video_renderer.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_RENDERER_H_ -#define WEBRTC_VIDEO_RENDERER_H_ - -namespace webrtc { - -class VideoFrame; - -class VideoRenderer { - public: - // This function should return as soon as possible and not block until it's - // time to render the frame. - // TODO(mflodman) Remove time_to_render_ms when VideoFrame contains NTP. - virtual void RenderFrame(const VideoFrame& video_frame, - int time_to_render_ms) = 0; - - virtual bool IsTextureSupported() const = 0; - - // This function returns true if WebRTC should not delay frames for - // smoothness. In general, this case means the renderer can schedule frames to - // optimize smoothness. - virtual bool SmoothsRenderedFrames() const { return false; } - - protected: - virtual ~VideoRenderer() {} -}; -} // namespace webrtc - -#endif // WEBRTC_VIDEO_RENDERER_H_ diff --git a/include/webrtc/video_send_stream.h b/include/webrtc/video_send_stream.h deleted file mode 100644 index 83a96d3..0000000 --- a/include/webrtc/video_send_stream.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_SEND_STREAM_H_ -#define WEBRTC_VIDEO_SEND_STREAM_H_ - -#include -#include - -#include "webrtc/common_types.h" -#include "webrtc/config.h" -#include "webrtc/frame_callback.h" -#include "webrtc/stream.h" -#include "webrtc/transport.h" -#include "webrtc/video_renderer.h" - -namespace webrtc { - -class LoadObserver; -class VideoEncoder; - -class EncodingTimeObserver { - public: - virtual ~EncodingTimeObserver() {} - - virtual void OnReportEncodedTime(int64_t ntp_time_ms, int encode_time_ms) = 0; -}; - -// Class to deliver captured frame to the video send stream. -class VideoCaptureInput { - public: - // These methods do not lock internally and must be called sequentially. - // If your application switches input sources synchronization must be done - // externally to make sure that any old frames are not delivered concurrently. - virtual void IncomingCapturedFrame(const VideoFrame& video_frame) = 0; - - protected: - virtual ~VideoCaptureInput() {} -}; - -class VideoSendStream : public SendStream { - public: - struct StreamStats { - FrameCounts frame_counts; - int width = 0; - int height = 0; - // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer. - int total_bitrate_bps = 0; - int retransmit_bitrate_bps = 0; - int avg_delay_ms = 0; - int max_delay_ms = 0; - StreamDataCounters rtp_stats; - RtcpPacketTypeCounter rtcp_packet_type_counts; - RtcpStatistics rtcp_stats; - }; - - struct Stats { - std::string encoder_implementation_name = "unknown"; - int input_frame_rate = 0; - int encode_frame_rate = 0; - int avg_encode_time_ms = 0; - int encode_usage_percent = 0; - int target_media_bitrate_bps = 0; - int media_bitrate_bps = 0; - bool suspended = false; - bool bw_limited_resolution = false; - std::map substreams; - }; - - struct Config { - Config() = delete; - explicit Config(Transport* send_transport) - : send_transport(send_transport) {} - - std::string ToString() const; - - struct EncoderSettings { - std::string ToString() const; - - std::string payload_name; - int payload_type = -1; - - // TODO(sophiechang): Delete this field when no one is using internal - // sources anymore. - bool internal_source = false; - - // Uninitialized VideoEncoder instance to be used for encoding. Will be - // initialized from inside the VideoSendStream. - VideoEncoder* encoder = nullptr; - } encoder_settings; - - static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4. - struct Rtp { - std::string ToString() const; - - std::vector ssrcs; - - // See RtcpMode for description. - RtcpMode rtcp_mode = RtcpMode::kCompound; - - // Max RTP packet size delivered to send transport from VideoEngine. - size_t max_packet_size = kDefaultMaxPacketSize; - - // RTP header extensions to use for this send stream. - std::vector extensions; - - // See NackConfig for description. - NackConfig nack; - - // See FecConfig for description. - FecConfig fec; - - // Settings for RTP retransmission payload format, see RFC 4588 for - // details. - struct Rtx { - std::string ToString() const; - // SSRCs to use for the RTX streams. - std::vector ssrcs; - - // Payload type to use for the RTX stream. - int payload_type = -1; - } rtx; - - // RTCP CNAME, see RFC 3550. - std::string c_name; - } rtp; - - // Transport for outgoing packets. - Transport* send_transport = nullptr; - - // Callback for overuse and normal usage based on the jitter of incoming - // captured frames. 'nullptr' disables the callback. - LoadObserver* overuse_callback = nullptr; - - // Called for each I420 frame before encoding the frame. Can be used for - // effects, snapshots etc. 'nullptr' disables the callback. - I420FrameCallback* pre_encode_callback = nullptr; - - // Called for each encoded frame, e.g. used for file storage. 'nullptr' - // disables the callback. - EncodedFrameObserver* post_encode_callback = nullptr; - - // Renderer for local preview. The local renderer will be called even if - // sending hasn't started. 'nullptr' disables local rendering. - VideoRenderer* local_renderer = nullptr; - - // Expected delay needed by the renderer, i.e. the frame will be delivered - // this many milliseconds, if possible, earlier than expected render time. - // Only valid if |local_renderer| is set. - int render_delay_ms = 0; - - // Target delay in milliseconds. A positive value indicates this stream is - // used for streaming instead of a real-time call. - int target_delay_ms = 0; - - // True if the stream should be suspended when the available bitrate fall - // below the minimum configured bitrate. If this variable is false, the - // stream may send at a rate higher than the estimated available bitrate. - bool suspend_below_min_bitrate = false; - - // Called for each encoded frame. Passes the total time spent on encoding. - // TODO(ivica): Consolidate with post_encode_callback: - // https://code.google.com/p/webrtc/issues/detail?id=5042 - EncodingTimeObserver* encoding_time_observer = nullptr; - }; - - // Gets interface used to insert captured frames. Valid as long as the - // VideoSendStream is valid. - virtual VideoCaptureInput* Input() = 0; - - // Set which streams to send. Must have at least as many SSRCs as configured - // in the config. Encoder settings are passed on to the encoder instance along - // with the VideoStream settings. - virtual bool ReconfigureVideoEncoder(const VideoEncoderConfig& config) = 0; - - virtual Stats GetStats() = 0; -}; - -} // namespace webrtc - -#endif // WEBRTC_VIDEO_SEND_STREAM_H_ diff --git a/lib/libwebrtc-darwin-amd64-magic.a b/lib/libwebrtc-darwin-amd64-magic.a deleted file mode 100644 index c84a6c7..0000000 Binary files a/lib/libwebrtc-darwin-amd64-magic.a and /dev/null differ diff --git a/lib/libwebrtc-linux-amd64-magic.a b/lib/libwebrtc-linux-amd64-magic.a deleted file mode 100644 index 22b508f..0000000 Binary files a/lib/libwebrtc-linux-amd64-magic.a and /dev/null differ diff --git a/peerconnection.go b/peerconnection.go index a2775ce..a3e3652 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -30,7 +30,7 @@ Please share any improvements or concerns as issues or pull requests on github. package webrtc /* -#cgo CXXFLAGS: -std=c++0x +#cgo CXXFLAGS: -std=c++11 #cgo linux,amd64 pkg-config: webrtc-linux-amd64.pc #cgo darwin,amd64 pkg-config: webrtc-darwin-amd64.pc #include // Needed for C.free diff --git a/webrtc-darwin-amd64.pc b/webrtc-darwin-amd64.pc index 2cefe4f..dfc5539 100644 --- a/webrtc-darwin-amd64.pc +++ b/webrtc-darwin-amd64.pc @@ -6,7 +6,6 @@ Version: 1 Cflags: \ -I${pc}/include \ - -D_GLIBCXX_USE_CXX11_ABI=0 \ -DPOSIX Libs: \ diff --git a/webrtc-linux-amd64.pc b/webrtc-linux-amd64.pc index 512dff8..044ecbe 100644 --- a/webrtc-linux-amd64.pc +++ b/webrtc-linux-amd64.pc @@ -1,4 +1,5 @@ pc=${pcfiledir} +jingle_peerconnection_internal_libs=-ljingle_peerconnection_internal -lboringssl -lprotobuf_lite Name: webrtc Description: webrtc @@ -6,12 +7,13 @@ Version: 1 Cflags: \ -I${pc}/include \ - -D_GLIBCXX_USE_CXX11_ABI=0 \ -DPOSIX Libs: \ -L${pc}/lib \ - -lwebrtc-linux-amd64-magic \ + ${jingle_peerconnection_internal_libs} \ + -ljpeg \ + -lsrtp \ -ldl \ -lX11 \ -lrt