diff options
author | Kristian Monsen <kristianm@google.com> | 2011-06-28 21:49:31 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-07-08 17:55:00 +0100 |
commit | ddb351dbec246cf1fab5ec20d2d5520909041de1 (patch) | |
tree | 158e3fb57bdcac07c7f1e767fde3c70687c9fbb1 /third_party | |
parent | 6b92e04f5f151c896e3088e86f70db7081009308 (diff) | |
download | external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.zip external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.gz external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.bz2 |
Merge Chromium at r12.0.742.93: Initial merge by git
Change-Id: Ic5ee2fec31358bbee305f7e915442377bfa6cda6
Diffstat (limited to 'third_party')
16 files changed, 1279 insertions, 6 deletions
diff --git a/third_party/libjingle/overrides/talk/base/scoped_ptr.h b/third_party/libjingle/overrides/talk/base/scoped_ptr.h index cc4fec9..3d396d1 100644 --- a/third_party/libjingle/overrides/talk/base/scoped_ptr.h +++ b/third_party/libjingle/overrides/talk/base/scoped_ptr.h @@ -1,14 +1,14 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. -// This file overrides the inclusion of talk/base/scoped_ptr.h. We use +// This file overrides the inclusion of talk/base/memory/scoped_ptr.h. We use // a version of scoped_ptr from Chromium base, to avoid multiple definitions. #ifndef OVERRIDES_TALK_BASE_SCOPED_PTR_H_ #define OVERRIDES_TALK_BASE_SCOPED_PTR_H_ -#include "base/scoped_ptr.h" +#include "base/memory/scoped_ptr.h" #include "talk/base/common.h" namespace talk_base { diff --git a/third_party/libjingle/source/README.chrome-sandbox b/third_party/libjingle/source/README.chrome-sandbox new file mode 100644 index 0000000..5930d32 --- /dev/null +++ b/third_party/libjingle/source/README.chrome-sandbox @@ -0,0 +1,2 @@ +The chrome-sandbox branch contains some experemental changes that are needed +to make libjingle work in sandbox in Chrome. diff --git a/third_party/libjingle/source/talk/base/basicpacketsocketfactory.cc b/third_party/libjingle/source/talk/base/basicpacketsocketfactory.cc new file mode 100644 index 0000000..20173d1 --- /dev/null +++ b/third_party/libjingle/source/talk/base/basicpacketsocketfactory.cc @@ -0,0 +1,159 @@ +/* + * 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. + */ + +#include "talk/base/basicpacketsocketfactory.h" + +#include "talk/base/asyncudpsocket.h" +#include "talk/base/asynctcpsocket.h" +#include "talk/base/logging.h" +#include "talk/base/socketadapters.h" +#include "talk/base/thread.h" + +namespace talk_base { + +BasicPacketSocketFactory::BasicPacketSocketFactory( + Thread* thread) + : thread_(thread), + socket_factory_(NULL) { +} + +BasicPacketSocketFactory::BasicPacketSocketFactory( + SocketFactory* socket_factory) + : thread_(NULL), + socket_factory_(socket_factory) { +} + +BasicPacketSocketFactory::~BasicPacketSocketFactory() { +} + +AsyncPacketSocket* BasicPacketSocketFactory::CreateUdpSocket( + const SocketAddress& address, int min_port, int max_port) { + // UDP sockets are simple. + talk_base::AsyncSocket* socket = + socket_factory()->CreateAsyncSocket(SOCK_DGRAM); + if (!socket) { + return NULL; + } + if (BindSocket(socket, address, min_port, max_port) < 0) { + LOG(LS_ERROR) << "UDP bind failed with error " + << socket->GetError(); + delete socket; + return NULL; + } + return new talk_base::AsyncUDPSocket(socket); +} + +AsyncPacketSocket* BasicPacketSocketFactory::CreateServerTcpSocket( + const SocketAddress& local_address, int min_port, int max_port, + bool listen, bool ssl) { + talk_base::AsyncSocket* socket = + socket_factory()->CreateAsyncSocket(SOCK_STREAM); + if (!socket) { + return NULL; + } + + if (BindSocket(socket, local_address, min_port, max_port) < 0) { + LOG(LS_ERROR) << "TCP bind failed with error " + << socket->GetError(); + delete socket; + return NULL; + } + + // If using SSLTCP, wrap the TCP socket in a pseudo-SSL socket. + if (ssl) { + socket = new talk_base::AsyncSSLSocket(socket); + } + + return new talk_base::AsyncTCPSocket(socket, true); +} + +AsyncPacketSocket* BasicPacketSocketFactory::CreateClientTcpSocket( + const SocketAddress& local_address, const SocketAddress& remote_address, + const ProxyInfo& proxy_info, const std::string& user_agent, bool ssl) { + talk_base::AsyncSocket* socket = + socket_factory()->CreateAsyncSocket(SOCK_STREAM); + if (!socket) { + return NULL; + } + + if (BindSocket(socket, local_address, 0, 0) < 0) { + LOG(LS_ERROR) << "TCP bind failed with error " + << socket->GetError(); + delete socket; + return NULL; + } + + // If using a proxy, wrap the socket in a proxy socket. + if (proxy_info.type == talk_base::PROXY_SOCKS5) { + socket = new talk_base::AsyncSocksProxySocket( + socket, proxy_info.address, proxy_info.username, proxy_info.password); + } else if (proxy_info.type == talk_base::PROXY_HTTPS) { + socket = new talk_base::AsyncHttpsProxySocket( + socket, user_agent, proxy_info.address, + proxy_info.username, proxy_info.password); + } + + // If using SSLTCP, wrap the TCP socket in a pseudo-SSL socket. + if (ssl) { + socket = new talk_base::AsyncSSLSocket(socket); + } + + if (socket->Connect(remote_address) < 0) { + LOG(LS_ERROR) << "TCP connect failed with error " + << socket->GetError(); + delete socket; + return NULL; + } + + // Finally, wrap that socket in a TCP packet socket. + return new talk_base::AsyncTCPSocket(socket, false); +} + +int BasicPacketSocketFactory::BindSocket( + AsyncSocket* socket, const SocketAddress& local_address, + int min_port, int max_port) { + int ret = -1; + if (min_port == 0 && max_port == 0) { + // If there's no port range, let the OS pick a port for us. + ret = socket->Bind(local_address); + } else { + // Otherwise, try to find a port in the provided range. + for (int port = min_port; ret < 0 && port <= max_port; ++port) { + ret = socket->Bind(talk_base::SocketAddress(local_address.ip(), port)); + } + } + return ret; +} + +SocketFactory* BasicPacketSocketFactory::socket_factory() { + if (thread_) + return thread_->socketserver(); + else + return socket_factory_; +} + +} // namespace talk_base diff --git a/third_party/libjingle/source/talk/base/basicpacketsocketfactory.h b/third_party/libjingle/source/talk/base/basicpacketsocketfactory.h new file mode 100644 index 0000000..2f39d07 --- /dev/null +++ b/third_party/libjingle/source/talk/base/basicpacketsocketfactory.h @@ -0,0 +1,67 @@ +/* + * 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_BASE_BASICPACKETSOCKETFACTORY_H_ +#define TALK_BASE_BASICPACKETSOCKETFACTORY_H_ + +#include "talk/base/asyncsocket.h" +#include "talk/base/packetsocketfactory.h" + +namespace talk_base { + +class AsyncSocket; +class SocketFactory; +class Thread; + +class BasicPacketSocketFactory : public PacketSocketFactory { + public: + explicit BasicPacketSocketFactory(Thread* thread); + explicit BasicPacketSocketFactory(SocketFactory* socket_factory); + virtual ~BasicPacketSocketFactory(); + + virtual AsyncPacketSocket* CreateUdpSocket( + const SocketAddress& local_address, int min_port, int max_port); + virtual AsyncPacketSocket* CreateServerTcpSocket( + const SocketAddress& local_address, int min_port, int max_port, + bool listen, bool ssl); + virtual AsyncPacketSocket* CreateClientTcpSocket( + const SocketAddress& local_address, const SocketAddress& remote_address, + const ProxyInfo& proxy_info, const std::string& user_agent, bool ssl); + + private: + int BindSocket(AsyncSocket* socket, const SocketAddress& local_address, + int min_port, int max_port); + + SocketFactory* socket_factory(); + + Thread* thread_; + SocketFactory* socket_factory_; +}; + +} // namespace talk_base + +#endif // TALK_BASE_BASICPACKETSOCKETFACTORY_H_ diff --git a/third_party/libjingle/source/talk/base/buffer.h b/third_party/libjingle/source/talk/base/buffer.h new file mode 100644 index 0000000..311cfad --- /dev/null +++ b/third_party/libjingle/source/talk/base/buffer.h @@ -0,0 +1,119 @@ +/* + * libjingle + * Copyright 2004-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_BASE_BUFFER_H_ +#define TALK_BASE_BUFFER_H_ + +#include <cstring> + +#include "talk/base/scoped_ptr.h" + +namespace talk_base { + +// Basic buffer class, can be grown and shrunk dynamically. +// Unlike std::string/vector, does not initialize data when expanding capacity. +class Buffer { + public: + Buffer() { + Construct(NULL, 0, 0); + } + Buffer(const void* data, size_t length) { + Construct(data, length, length); + } + Buffer(const void* data, size_t length, size_t capacity) { + Construct(data, length, capacity); + } + Buffer(const Buffer& buf) { + Construct(buf.data(), buf.length(), buf.length()); + } + + const char* data() const { return data_.get(); } + char* data() { return data_.get(); } + // TODO: should this be size(), like STL? + size_t length() const { return length_; } + size_t capacity() const { return capacity_; } + + Buffer& operator=(const Buffer& buf) { + if (&buf != this) { + Construct(buf.data(), buf.length(), buf.length()); + } + return *this; + } + bool operator==(const Buffer& buf) const { + return (length_ == buf.length() && + memcmp(data_.get(), buf.data(), length_) == 0); + } + bool operator!=(const Buffer& buf) const { + return !operator==(buf); + } + + void SetData(const void* data, size_t length) { + ASSERT(data != NULL || length == 0); + SetLength(length); + memcpy(data_.get(), data, length); + } + void AppendData(const void* data, size_t length) { + ASSERT(data != NULL || length == 0); + size_t old_length = length_; + SetLength(length_ + length); + memcpy(data_.get() + old_length, data, length); + } + void SetLength(size_t length) { + SetCapacity(length); + length_ = length; + } + void SetCapacity(size_t capacity) { + if (capacity > capacity_) { + talk_base::scoped_array<char> data(new char[capacity]); + memcpy(data.get(), data_.get(), length_); + data_.swap(data); + capacity_ = capacity; + } + } + + void TransferTo(Buffer* buf) { + ASSERT(buf != NULL); + buf->data_.reset(data_.release()); + buf->length_ = length_; + buf->capacity_ = capacity_; + Construct(NULL, 0, 0); + } + + protected: + void Construct(const void* data, size_t length, size_t capacity) { + data_.reset(new char[capacity_ = capacity]); + SetData(data, length); + } + + scoped_array<char> data_; + size_t length_; + size_t capacity_; +}; + +} // namespace talk_base + +#endif // TALK_BASE_BUFFER_H_ diff --git a/third_party/libjingle/source/talk/base/latebindingsymboltable.cc b/third_party/libjingle/source/talk/base/latebindingsymboltable.cc new file mode 100644 index 0000000..f9d59ab --- /dev/null +++ b/third_party/libjingle/source/talk/base/latebindingsymboltable.cc @@ -0,0 +1,111 @@ +/* + * libjingle + * Copyright 2004--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. + */ + +#include "talk/base/latebindingsymboltable.h" + +#ifdef LINUX +#include <dlfcn.h> +#endif + +#include "talk/base/logging.h" + +namespace talk_base { + +inline static const char *GetDllError() { +#ifdef LINUX + char *err = dlerror(); + if (err) { + return err; + } else { + return "No error"; + } +#else +#error Not implemented +#endif +} + +DllHandle InternalLoadDll(const char dll_name[]) { +#ifdef LINUX + DllHandle handle = dlopen(dll_name, RTLD_NOW); +#else +#error Not implemented +#endif + if (handle == kInvalidDllHandle) { + LOG(LS_WARNING) << "Can't load " << dll_name << ": " << GetDllError(); + } + return handle; +} + +void InternalUnloadDll(DllHandle handle) { +#ifdef LINUX + if (dlclose(handle) != 0) { + LOG(LS_ERROR) << GetDllError(); + } +#else +#error Not implemented +#endif +} + +static bool LoadSymbol(DllHandle handle, + const char *symbol_name, + void **symbol) { +#ifdef LINUX + *symbol = dlsym(handle, symbol_name); + char *err = dlerror(); + if (err) { + LOG(LS_ERROR) << "Error loading symbol " << symbol_name << ": " << err; + return false; + } else if (!*symbol) { + LOG(LS_ERROR) << "Symbol " << symbol_name << " is NULL"; + return false; + } + return true; +#else +#error Not implemented +#endif +} + +// This routine MUST assign SOME value for every symbol, even if that value is +// NULL, or else some symbols may be left with uninitialized data that the +// caller may later interpret as a valid address. +bool InternalLoadSymbols(DllHandle handle, + int num_symbols, + const char *const symbol_names[], + void *symbols[]) { +#ifdef LINUX + // Clear any old errors. + dlerror(); +#endif + for (int i = 0; i < num_symbols; ++i) { + if (!LoadSymbol(handle, symbol_names[i], &symbols[i])) { + return false; + } + } + return true; +} + +} // namespace talk_base diff --git a/third_party/libjingle/source/talk/base/latebindingsymboltable.h b/third_party/libjingle/source/talk/base/latebindingsymboltable.h new file mode 100644 index 0000000..994c26a --- /dev/null +++ b/third_party/libjingle/source/talk/base/latebindingsymboltable.h @@ -0,0 +1,193 @@ +/* + * libjingle + * Copyright 2004--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_BASE_LATEBINDINGSYMBOLTABLE_H_ +#define TALK_BASE_LATEBINDINGSYMBOLTABLE_H_ + +#include <stddef.h> // for NULL +#include <string.h> + +#include "talk/base/common.h" +#include "talk/base/logging.h" + +// This file provides macros for creating "symbol table" classes to simplify the +// dynamic loading of symbols from DLLs. Currently the implementation only +// supports Linux and pure C symbols. +// See talk/sound/pulseaudiosymboltable.(h|cc) for an example. + +namespace talk_base { + +#ifdef LINUX +typedef void *DllHandle; + +const DllHandle kInvalidDllHandle = NULL; +#else +#error Not implemented +#endif + +// These are helpers for use only by the class below. +DllHandle InternalLoadDll(const char dll_name[]); + +void InternalUnloadDll(DllHandle handle); + +bool InternalLoadSymbols(DllHandle handle, + int num_symbols, + const char *const symbol_names[], + void *symbols[]); + +template <int SYMBOL_TABLE_SIZE, + const char kDllName[], + const char *const kSymbolNames[]> +class LateBindingSymbolTable { + public: + LateBindingSymbolTable() + : handle_(kInvalidDllHandle), + undefined_symbols_(false) { + memset(symbols_, 0, sizeof(symbols_)); + } + + ~LateBindingSymbolTable() { + Unload(); + } + + static int NumSymbols() { + return SYMBOL_TABLE_SIZE; + } + + // We do not use this, but we offer it for theoretical convenience. + static const char *GetSymbolName(int index) { + ASSERT(index < NumSymbols()); + return kSymbolNames[index]; + } + + bool IsLoaded() const { + return handle_ != kInvalidDllHandle; + } + + // Loads the DLL and the symbol table. Returns true iff the DLL and symbol + // table loaded successfully. + bool Load() { + if (IsLoaded()) { + return true; + } + if (undefined_symbols_) { + // We do not attempt to load again because repeated attempts are not + // likely to succeed and DLL loading is costly. + LOG(LS_ERROR) << "We know there are undefined symbols"; + return false; + } + handle_ = InternalLoadDll(kDllName); + if (!IsLoaded()) { + return false; + } + if (!InternalLoadSymbols(handle_, NumSymbols(), kSymbolNames, symbols_)) { + undefined_symbols_ = true; + Unload(); + return false; + } + return true; + } + + void Unload() { + if (!IsLoaded()) { + return; + } + InternalUnloadDll(handle_); + handle_ = kInvalidDllHandle; + memset(symbols_, 0, sizeof(symbols_)); + } + + // Retrieves the given symbol. NOTE: Recommended to use LATESYM_GET below + // instead of this. + void *GetSymbol(int index) const { + ASSERT(IsLoaded()); + ASSERT(index < NumSymbols()); + return symbols_[index]; + } + + private: + DllHandle handle_; + bool undefined_symbols_; + void *symbols_[SYMBOL_TABLE_SIZE]; + + DISALLOW_COPY_AND_ASSIGN(LateBindingSymbolTable); +}; + +// This macro must be invoked in a header to declare a symbol table class. +#define LATE_BINDING_SYMBOL_TABLE_DECLARE_BEGIN(ClassName) \ +enum { + +// This macro must be invoked in the header declaration once for each symbol +// (recommended to use an X-Macro to avoid duplication). +// This macro defines an enum with names built from the symbols, which +// essentially creates a hash table in the compiler from symbol names to their +// indices in the symbol table class. +#define LATE_BINDING_SYMBOL_TABLE_DECLARE_ENTRY(ClassName, sym) \ + ClassName##_SYMBOL_TABLE_INDEX_##sym, + +// This macro completes the header declaration. +#define LATE_BINDING_SYMBOL_TABLE_DECLARE_END(ClassName) \ + ClassName##_SYMBOL_TABLE_SIZE \ +}; \ +\ +extern const char ClassName##_kDllName[]; \ +extern const char *const \ + ClassName##_kSymbolNames[ClassName##_SYMBOL_TABLE_SIZE]; \ +\ +typedef ::talk_base::LateBindingSymbolTable<ClassName##_SYMBOL_TABLE_SIZE, \ + ClassName##_kDllName, \ + ClassName##_kSymbolNames> \ + ClassName; + +// This macro must be invoked in a .cc file to define a previously-declared +// symbol table class. +#define LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(ClassName, dllName) \ +const char ClassName##_kDllName[] = dllName; \ +const char *const ClassName##_kSymbolNames[ClassName##_SYMBOL_TABLE_SIZE] = { + +// This macro must be invoked in the .cc definition once for each symbol +// (recommended to use an X-Macro to avoid duplication). +// This would have to use the mangled name if we were to ever support C++ +// symbols. +#define LATE_BINDING_SYMBOL_TABLE_DEFINE_ENTRY(ClassName, sym) \ + #sym, + +#define LATE_BINDING_SYMBOL_TABLE_DEFINE_END(ClassName) \ +}; + +// Index of a given symbol in the given symbol table class. +#define LATESYM_INDEXOF(ClassName, sym) \ + (ClassName##_SYMBOL_TABLE_INDEX_##sym) + +// Returns a reference to the given late-binded symbol, with the correct type. +#define LATESYM_GET(ClassName, inst, sym) \ + (*reinterpret_cast<typeof(&sym)>( \ + (inst)->GetSymbol(LATESYM_INDEXOF(ClassName, sym)))) + +} // namespace talk_base + +#endif // TALK_BASE_LATEBINDINGSYMBOLTABLE_H_ diff --git a/third_party/libjingle/source/talk/base/packetsocketfactory.h b/third_party/libjingle/source/talk/base/packetsocketfactory.h new file mode 100644 index 0000000..4d1f982 --- /dev/null +++ b/third_party/libjingle/source/talk/base/packetsocketfactory.h @@ -0,0 +1,57 @@ +/* + * 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_BASE_PACKETSOCKETFACTORY_H_ +#define TALK_BASE_PACKETSOCKETFACTORY_H_ + +#include "talk/base/proxyinfo.h" + +namespace talk_base { + +class AsyncPacketSocket; + +class PacketSocketFactory { + public: + PacketSocketFactory() { } + virtual ~PacketSocketFactory() { } + + virtual AsyncPacketSocket* CreateUdpSocket( + const SocketAddress& address, int min_port, int max_port) = 0; + virtual AsyncPacketSocket* CreateServerTcpSocket( + const SocketAddress& local_address, int min_port, int max_port, + bool listen, bool ssl) = 0; + virtual AsyncPacketSocket* CreateClientTcpSocket( + const SocketAddress& local_address, const SocketAddress& remote_address, + const ProxyInfo& proxy_info, const std::string& user_agent, bool ssl) = 0; + + private: + DISALLOW_EVIL_CONSTRUCTORS(PacketSocketFactory); +}; + +} // namespace talk_base + +#endif // TALK_BASE_PACKETSOCKETFACTORY_H_ diff --git a/third_party/libjingle/source/talk/base/ratetracker.cc b/third_party/libjingle/source/talk/base/ratetracker.cc new file mode 100644 index 0000000..d5207cd --- /dev/null +++ b/third_party/libjingle/source/talk/base/ratetracker.cc @@ -0,0 +1,80 @@ +/* + * libjingle + * Copyright 2004--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. + */ + +#include "talk/base/ratetracker.h" +#include "talk/base/time.h" + +namespace talk_base { + +RateTracker::RateTracker() + : total_units_(0), units_second_(0), + last_units_second_time_(static_cast<uint32>(-1)), + last_units_second_calc_(0) { +} + +size_t RateTracker::total_units() const { + return total_units_; +} + +size_t RateTracker::units_second() { + // Snapshot units / second calculator. Determine how many seconds have + // elapsed since our last reference point. If over 1 second, establish + // a new reference point that is an integer number of seconds since the + // last one, and compute the units over that interval. + uint32 current_time = Time(); + if (last_units_second_time_ != static_cast<uint32>(-1)) { + int delta = talk_base::TimeDiff(current_time, last_units_second_time_); + if (delta >= 1000) { + int fraction_time = delta % 1000; + int seconds = delta / 1000; + int fraction_units = + static_cast<int>(total_units_ - last_units_second_calc_) * + fraction_time / delta; + // Compute "units received during the interval" / "seconds in interval" + units_second_ = + (total_units_ - last_units_second_calc_ - fraction_units) / seconds; + last_units_second_time_ = current_time - fraction_time; + last_units_second_calc_ = total_units_ - fraction_units; + } + } + if (last_units_second_time_ == static_cast<uint32>(-1)) { + last_units_second_time_ = current_time; + last_units_second_calc_ = total_units_; + } + + return units_second_; +} + +void RateTracker::Update(size_t units) { + total_units_ += units; +} + +uint32 RateTracker::Time() const { + return talk_base::Time(); +} + +} // namespace talk_base diff --git a/third_party/libjingle/source/talk/base/ratetracker.h b/third_party/libjingle/source/talk/base/ratetracker.h new file mode 100644 index 0000000..28c7bb3 --- /dev/null +++ b/third_party/libjingle/source/talk/base/ratetracker.h @@ -0,0 +1,59 @@ +/* + * libjingle + * Copyright 2004--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_BASE_RATETRACKER_H_ +#define TALK_BASE_RATETRACKER_H_ + +#include <stdlib.h> +#include "talk/base/basictypes.h" + +namespace talk_base { + +// Computes instantaneous units per second. +class RateTracker { + public: + RateTracker(); + virtual ~RateTracker() {} + + size_t total_units() const; + size_t units_second(); + void Update(size_t units); + + protected: + // overrideable for tests + virtual uint32 Time() const; + + private: + size_t total_units_; + size_t units_second_; + uint32 last_units_second_time_; + size_t last_units_second_calc_; +}; + +} // namespace talk_base + +#endif // TALK_BASE_RATETRACKER_H_ diff --git a/third_party/libjingle/source/talk/session/phone/libudevsymboltable.cc b/third_party/libjingle/source/talk/session/phone/libudevsymboltable.cc new file mode 100644 index 0000000..b312306 --- /dev/null +++ b/third_party/libjingle/source/talk/session/phone/libudevsymboltable.cc @@ -0,0 +1,39 @@ +/* + * libjingle + * Copyright 2004--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. + */ + +#include "talk/session/phone/libudevsymboltable.h" + +namespace cricket { + +LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(LibUDevSymbolTable, "libudev.so.0") +#define X(sym) \ + LATE_BINDING_SYMBOL_TABLE_DEFINE_ENTRY(LibUDevSymbolTable, sym) +LIBUDEV_SYMBOLS_LIST +#undef X +LATE_BINDING_SYMBOL_TABLE_DEFINE_END(LibUDevSymbolTable) + +} // namespace cricket diff --git a/third_party/libjingle/source/talk/session/phone/libudevsymboltable.h b/third_party/libjingle/source/talk/session/phone/libudevsymboltable.h new file mode 100644 index 0000000..0dbef6c --- /dev/null +++ b/third_party/libjingle/source/talk/session/phone/libudevsymboltable.h @@ -0,0 +1,58 @@ +/* + * libjingle + * Copyright 2004--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_LIBUDEVSYMBOLTABLE_H_ +#define TALK_SESSION_PHONE_LIBUDEVSYMBOLTABLE_H_ + +#include "talk/base/latebindingsymboltable.h" + +namespace cricket { + +// The libudev symbols we need, as an X-Macro list. +// This list must contain precisely every libudev function that is used in +// devicemanager.cc. +#define LIBUDEV_SYMBOLS_LIST \ + X(udev_device_unref) \ + 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) + +LATE_BINDING_SYMBOL_TABLE_DECLARE_BEGIN(LibUDevSymbolTable) +#define X(sym) \ + LATE_BINDING_SYMBOL_TABLE_DECLARE_ENTRY(LibUDevSymbolTable, sym) +LIBUDEV_SYMBOLS_LIST +#undef X +LATE_BINDING_SYMBOL_TABLE_DECLARE_END(LibUDevSymbolTable) + +} // namespace cricket + +#endif // TALK_SESSION_PHONE_LIBUDEVSYMBOLTABLE_H_ diff --git a/third_party/libjingle/source/talk/session/phone/rtcpmuxfilter.cc b/third_party/libjingle/source/talk/session/phone/rtcpmuxfilter.cc new file mode 100644 index 0000000..8654214 --- /dev/null +++ b/third_party/libjingle/source/talk/session/phone/rtcpmuxfilter.cc @@ -0,0 +1,92 @@ +/* + * libjingle + * Copyright 2004--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. + */ + +#include "talk/session/phone/rtcpmuxfilter.h" + +#include "talk/base/logging.h" + +namespace cricket { + +RtcpMuxFilter::RtcpMuxFilter() : state_(ST_INIT), offer_enable_(false) { +} + +bool RtcpMuxFilter::IsActive() const { + // We can receive muxed media prior to the accept, so we have to be able to + // deal with that. + return (state_ == ST_SENTOFFER || state_ == ST_ACTIVE); +} + +bool RtcpMuxFilter::SetOffer(bool offer_enable, ContentSource source) { + bool ret = false; + if (state_ == ST_INIT) { + offer_enable_ = offer_enable; + state_ = (source == CS_LOCAL) ? ST_SENTOFFER : ST_RECEIVEDOFFER; + ret = true; + } else { + LOG(LS_ERROR) << "Invalid state for RTCP mux offer"; + } + return ret; +} + +bool RtcpMuxFilter::SetAnswer(bool answer_enable, ContentSource source) { + bool ret = false; + if ((state_ == ST_SENTOFFER && source == CS_REMOTE) || + (state_ == ST_RECEIVEDOFFER && source == CS_LOCAL)) { + if (offer_enable_) { + state_ = (answer_enable) ? ST_ACTIVE : ST_INIT; + ret = true; + } else { + // If the offer didn't specify RTCP mux, the answer shouldn't either. + if (!answer_enable) { + ret = true; + state_ = ST_INIT; + } else { + LOG(LS_WARNING) << "Invalid parameters in RTCP mux answer"; + } + } + } else { + LOG(LS_ERROR) << "Invalid state for RTCP mux answer"; + } + return ret; +} + +bool RtcpMuxFilter::DemuxRtcp(const char* data, int len) { + // If we're muxing RTP/RTCP, we must inspect each packet delivered and + // determine whether it is RTP or RTCP. We do so by checking the packet type, + // and assuming RTP if type is 0-63 or 96-127. For additional details, see + // http://tools.ietf.org/html/rfc5761. + // Note that if we offer RTCP mux, we may receive muxed RTCP before we + // receive the answer, so we operate in that state too. + if (!IsActive()) { + return false; + } + + int type = (len >= 2) ? (static_cast<uint8>(data[1]) & 0x7F) : 0; + return (type >= 64 && type < 96); +} + +} // namespace cricket diff --git a/third_party/libjingle/source/talk/session/phone/rtcpmuxfilter.h b/third_party/libjingle/source/talk/session/phone/rtcpmuxfilter.h new file mode 100644 index 0000000..0224e9f --- /dev/null +++ b/third_party/libjingle/source/talk/session/phone/rtcpmuxfilter.h @@ -0,0 +1,61 @@ +/* + * libjingle + * Copyright 2004--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_RTCPMUXFILTER_H_ +#define TALK_SESSION_PHONE_RTCPMUXFILTER_H_ + +#include "talk/base/basictypes.h" +#include "talk/p2p/base/sessiondescription.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; + + // Specifies whether the offer indicates the use of RTCP mux. + bool SetOffer(bool offer_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: + enum State { ST_INIT, ST_SENTOFFER, ST_RECEIVEDOFFER, ST_ACTIVE }; + State state_; + bool offer_enable_; +}; + +} // namespace cricket + +#endif // TALK_SESSION_PHONE_RTCPMUXFILTER_H_ diff --git a/third_party/libjingle/source/talk/third_party/libudev/libudev.h b/third_party/libjingle/source/talk/third_party/libudev/libudev.h new file mode 100644 index 0000000..5bc42df --- /dev/null +++ b/third_party/libjingle/source/talk/third_party/libudev/libudev.h @@ -0,0 +1,175 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers <kay.sievers@vrfy.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#ifndef _LIBUDEV_H_ +#define _LIBUDEV_H_ + +#include <stdarg.h> +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * udev - library context + * + * reads the udev config and system environment + * allows custom logging + */ +struct udev; +struct udev *udev_ref(struct udev *udev); +void udev_unref(struct udev *udev); +struct udev *udev_new(void); +void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)); +int udev_get_log_priority(struct udev *udev); +void udev_set_log_priority(struct udev *udev, int priority); +const char *udev_get_sys_path(struct udev *udev); +const char *udev_get_dev_path(struct udev *udev); +void *udev_get_userdata(struct udev *udev); +void udev_set_userdata(struct udev *udev, void *userdata); + +/* + * udev_list + * + * access to libudev generated lists + */ +struct udev_list_entry; +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); +/** + * udev_list_entry_foreach: + * @list_entry: entry to store the current position + * @first_entry: first entry to start with + * + * Helper to iterate over all entries of a list. + */ +#define udev_list_entry_foreach(list_entry, first_entry) \ + for (list_entry = first_entry; \ + list_entry != NULL; \ + list_entry = udev_list_entry_get_next(list_entry)) + +/* + * udev_device + * + * access to sysfs/kernel devices + */ +struct udev_device; +struct udev_device *udev_device_ref(struct udev_device *udev_device); +void udev_device_unref(struct udev_device *udev_device); +struct udev *udev_device_get_udev(struct udev_device *udev_device); +struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); +struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); +struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); +struct udev_device *udev_device_new_from_environment(struct udev *udev); +/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ +struct udev_device *udev_device_get_parent(struct udev_device *udev_device); +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, + const char *subsystem, const char *devtype); +/* retrieve device properties */ +const char *udev_device_get_devpath(struct udev_device *udev_device); +const char *udev_device_get_subsystem(struct udev_device *udev_device); +const char *udev_device_get_devtype(struct udev_device *udev_device); +const char *udev_device_get_syspath(struct udev_device *udev_device); +const char *udev_device_get_sysname(struct udev_device *udev_device); +const char *udev_device_get_sysnum(struct udev_device *udev_device); +const char *udev_device_get_devnode(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); +const char *udev_device_get_driver(struct udev_device *udev_device); +dev_t udev_device_get_devnum(struct udev_device *udev_device); +const char *udev_device_get_action(struct udev_device *udev_device); +unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); + +/* + * udev_monitor + * + * access to kernel uevents and udev events + */ +struct udev_monitor; +struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); +void udev_monitor_unref(struct udev_monitor *udev_monitor); +struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); +/* kernel and udev generated events over netlink */ +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); +/* custom socket (use netlink and filters instead) */ +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +/* bind socket */ +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); +int udev_monitor_get_fd(struct udev_monitor *udev_monitor); +struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); +/* in-kernel socket filters to select messages that get delivered to a listener */ +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, + const char *subsystem, const char *devtype); +int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag); +int udev_monitor_filter_update(struct udev_monitor *udev_monitor); +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); + +/* + * udev_enumerate + * + * search sysfs for specific devices and provide a sorted list + */ +struct udev_enumerate; +struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); +void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); +struct udev_enumerate *udev_enumerate_new(struct udev *udev); +/* device properties filter */ +int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); +int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); +int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); +int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); +/* run enumeration with active filters */ +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); +int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); +/* return device list */ +struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); + +/* + * udev_queue + * + * access to the currently running udev events + */ +struct udev_queue; +struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); +void udev_queue_unref(struct udev_queue *udev_queue); +struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); +struct udev_queue *udev_queue_new(struct udev *udev); +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); +int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); +int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end); +struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/third_party/modp_b64/README.chromium b/third_party/modp_b64/README.chromium index fc30450..16588b5 100644 --- a/third_party/modp_b64/README.chromium +++ b/third_party/modp_b64/README.chromium @@ -1,8 +1,9 @@ Name: modp base64 decoder -URL: http://modp.com/release/base64/ - -See the header of modp_b64.cc for the license terms. +Short Name: stringencoders +URL: http://code.google.com/p/stringencoders/ +Version: unknown +Description: The modp_b64.c file was modified to remove the inclusion of modp's config.h and to fix compilation errors that occur under VC8. The file was renamed modp_b64.cc to force it to be compiled as C++ so that the inclusion of |