diff --git a/webrtc/libjingle/libjingle.gyp b/webrtc/libjingle/libjingle.gyp deleted file mode 100644 index b2322c68ec..0000000000 --- a/webrtc/libjingle/libjingle.gyp +++ /dev/null @@ -1,31 +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. - -{ - 'includes': ['../build/common.gypi'], - 'targets': [ - { - 'target_name': 'libjingle_xmpphelp', - 'type': 'static_library', - 'dependencies': [ - '<(webrtc_root)/pc/pc.gyp:rtc_pc', - ], - 'conditions': [ - ['build_expat==1', { - 'dependencies': [ - '<(DEPTH)/third_party/expat/expat.gyp:expat', - ], - }], - ], - 'sources': [ - 'xmpp/jingleinfotask.cc', - 'xmpp/jingleinfotask.h', - ], - }, # target libjingle_xmpphelp - ], -} diff --git a/webrtc/libjingle/xmpp/jingleinfotask.cc b/webrtc/libjingle/xmpp/jingleinfotask.cc deleted file mode 100644 index 5599edc0eb..0000000000 --- a/webrtc/libjingle/xmpp/jingleinfotask.cc +++ /dev/null @@ -1,123 +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. - */ - -#include "webrtc/libjingle/xmpp/jingleinfotask.h" - -#include - -#include "webrtc/libjingle/xmpp/constants.h" -#include "webrtc/libjingle/xmpp/xmppclient.h" -#include "webrtc/libjingle/xmpp/xmpptask.h" -#include "webrtc/base/socketaddress.h" - -namespace buzz { - -class JingleInfoTask::JingleInfoGetTask : public XmppTask { - public: - explicit JingleInfoGetTask(XmppTaskParentInterface* parent) - : XmppTask(parent, XmppEngine::HL_SINGLE), - done_(false) {} - - virtual int ProcessStart() { - std::unique_ptr get( - MakeIq(STR_GET, Jid(), task_id())); - get->AddElement(new XmlElement(QN_JINGLE_INFO_QUERY, true)); - if (SendStanza(get.get()) != XMPP_RETURN_OK) { - return STATE_ERROR; - } - return STATE_RESPONSE; - } - virtual int ProcessResponse() { - if (done_) - return STATE_DONE; - return STATE_BLOCKED; - } - - protected: - virtual bool HandleStanza(const XmlElement * stanza) { - if (!MatchResponseIq(stanza, Jid(), task_id())) - return false; - - if (stanza->Attr(QN_TYPE) != STR_RESULT) - return false; - - // Queue the stanza with the parent so these don't get handled out of order - JingleInfoTask* parent = static_cast(GetParent()); - parent->QueueStanza(stanza); - - // Wake ourselves so we can go into the done state - done_ = true; - Wake(); - return true; - } - - bool done_; -}; - - -void JingleInfoTask::RefreshJingleInfoNow() { - JingleInfoGetTask* get_task = new JingleInfoGetTask(this); - get_task->Start(); -} - -bool -JingleInfoTask::HandleStanza(const XmlElement * stanza) { - if (!MatchRequestIq(stanza, "set", QN_JINGLE_INFO_QUERY)) - return false; - - // only respect relay push from the server - Jid from(stanza->Attr(QN_FROM)); - if (!from.IsEmpty() && - !from.BareEquals(GetClient()->jid()) && - from != Jid(GetClient()->jid().domain())) - return false; - - QueueStanza(stanza); - return true; -} - -int -JingleInfoTask::ProcessStart() { - std::vector relay_hosts; - std::vector stun_hosts; - std::string relay_token; - const XmlElement * stanza = NextStanza(); - if (stanza == NULL) - return STATE_BLOCKED; - const XmlElement * query = stanza->FirstNamed(QN_JINGLE_INFO_QUERY); - if (query == NULL) - return STATE_START; - const XmlElement *stun = query->FirstNamed(QN_JINGLE_INFO_STUN); - if (stun) { - for (const XmlElement *server = stun->FirstNamed(QN_JINGLE_INFO_SERVER); - server != NULL; server = server->NextNamed(QN_JINGLE_INFO_SERVER)) { - std::string host = server->Attr(QN_JINGLE_INFO_HOST); - std::string port = server->Attr(QN_JINGLE_INFO_UDP); - if (host != STR_EMPTY && host != STR_EMPTY) { - stun_hosts.push_back(rtc::SocketAddress(host, atoi(port.c_str()))); - } - } - } - - const XmlElement *relay = query->FirstNamed(QN_JINGLE_INFO_RELAY); - if (relay) { - relay_token = relay->TextNamed(QN_JINGLE_INFO_TOKEN); - for (const XmlElement *server = relay->FirstNamed(QN_JINGLE_INFO_SERVER); - server != NULL; server = server->NextNamed(QN_JINGLE_INFO_SERVER)) { - std::string host = server->Attr(QN_JINGLE_INFO_HOST); - if (host != STR_EMPTY) { - relay_hosts.push_back(host); - } - } - } - SignalJingleInfo(relay_token, relay_hosts, stun_hosts); - return STATE_START; -} -} diff --git a/webrtc/libjingle/xmpp/jingleinfotask.h b/webrtc/libjingle/xmpp/jingleinfotask.h deleted file mode 100644 index 6ed701de2f..0000000000 --- a/webrtc/libjingle/xmpp/jingleinfotask.h +++ /dev/null @@ -1,44 +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_LIBJINGLE_XMPP_JINGLEINFOTASK_H_ -#define WEBRTC_LIBJINGLE_XMPP_JINGLEINFOTASK_H_ - -#include - -#include "webrtc/p2p/client/httpportallocator.h" -#include "webrtc/libjingle/xmpp/xmppengine.h" -#include "webrtc/libjingle/xmpp/xmpptask.h" -#include "webrtc/base/sigslot.h" - -namespace buzz { - -class JingleInfoTask : public XmppTask { - public: - explicit JingleInfoTask(XmppTaskParentInterface* parent) : - XmppTask(parent, XmppEngine::HL_TYPE) {} - - virtual int ProcessStart(); - void RefreshJingleInfoNow(); - - sigslot::signal3 &, - const std::vector &> - SignalJingleInfo; - - protected: - class JingleInfoGetTask; - friend class JingleInfoGetTask; - - virtual bool HandleStanza(const XmlElement * stanza); -}; -} - -#endif // WEBRTC_LIBJINGLE_XMPP_JINGLEINFOTASK_H_ diff --git a/webrtc/p2p/client/autoportallocator.h b/webrtc/p2p/client/autoportallocator.h deleted file mode 100644 index 7856510e1e..0000000000 --- a/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_