#include "remoting/protocol/jingle_session.h"
#include <stdint.h>
#include <limits>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/authenticator.h"
#include "remoting/protocol/content_description.h"
#include "remoting/protocol/errors.h"
#include "remoting/protocol/jingle_messages.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/session_config.h"
#include "remoting/protocol/session_observer.h"
#include "remoting/protocol/session_plugin.h"
#include "remoting/protocol/transport.h"
#include "remoting/signaling/iq_sender.h"
#include "remoting/signaling/xmpp_constants.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
#include "third_party/webrtc/api/candidate.h"
XmlElement;
namespace remoting::protocol {
namespace {
const int kDefaultMessageTimeout = …;
const int kSessionInitiateAndAcceptTimeout = …;
const int kTransportInfoTimeout = …;
const int kInvalid = …;
const int kAny = …;
ErrorCode AuthRejectionReasonToErrorCode(
Authenticator::RejectionReason reason) { … }
int GetSequentialId(const std::string& id) { … }
}
class JingleSession::OrderedMessageQueue { … };
std::vector<JingleSession::PendingMessage>
JingleSession::OrderedMessageQueue::OnIncomingMessage(
const std::string& id,
JingleSession::PendingMessage&& message) { … }
void JingleSession::OrderedMessageQueue::SetInitialId(const std::string& id) { … }
JingleSession::PendingMessage::PendingMessage() = default;
JingleSession::PendingMessage::PendingMessage(PendingMessage&& moved) = default;
JingleSession::PendingMessage::PendingMessage(
std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback)
: … { … }
JingleSession::PendingMessage::~PendingMessage() = default;
JingleSession::PendingMessage& JingleSession::PendingMessage::operator=(
PendingMessage&& moved) = default;
JingleSession::JingleSession(JingleSessionManager* session_manager)
: … { … }
JingleSession::~JingleSession() { … }
void JingleSession::SetEventHandler(Session::EventHandler* event_handler) { … }
ErrorCode JingleSession::error() const { … }
void JingleSession::StartConnection(
const SignalingAddress& peer_address,
std::unique_ptr<Authenticator> authenticator) { … }
void JingleSession::InitializeIncomingConnection(
const std::string& message_id,
const JingleMessage& initiate_message,
std::unique_ptr<Authenticator> authenticator) { … }
void JingleSession::AcceptIncomingConnection(
const JingleMessage& initiate_message) { … }
void JingleSession::ContinueAcceptIncomingConnection() { … }
const std::string& JingleSession::jid() { … }
const SessionConfig& JingleSession::config() { … }
const Authenticator& JingleSession::authenticator() const { … }
void JingleSession::SetTransport(Transport* transport) { … }
void JingleSession::SendTransportInfo(
std::unique_ptr<jingle_xmpp::XmlElement> transport_info) { … }
void JingleSession::Close(protocol::ErrorCode error) { … }
void JingleSession::AddPlugin(SessionPlugin* plugin) { … }
void JingleSession::SendMessage(std::unique_ptr<JingleMessage> message) { … }
void JingleSession::OnMessageResponse(JingleMessage::ActionType request_type,
IqRequest* request,
const jingle_xmpp::XmlElement* response) { … }
void JingleSession::OnTransportInfoResponse(
IqRequest* request,
const jingle_xmpp::XmlElement* response) { … }
void JingleSession::OnIncomingMessage(const std::string& id,
std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) { … }
void JingleSession::ProcessIncomingMessage(
std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) { … }
void JingleSession::OnAccept(std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) { … }
void JingleSession::OnSessionInfo(std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) { … }
void JingleSession::OnTransportInfo(std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) { … }
void JingleSession::OnTerminate(std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) { … }
void JingleSession::OnAuthenticatorStateChangeAfterAccepted() { … }
bool JingleSession::InitializeConfigFromDescription(
const ContentDescription* description) { … }
void JingleSession::ProcessAuthenticationStep() { … }
void JingleSession::OnAuthenticated() { … }
void JingleSession::SetState(State new_state) { … }
bool JingleSession::is_session_active() { … }
void JingleSession::ProcessIncomingPluginMessage(const JingleMessage& message) { … }
void JingleSession::AddPluginAttachments(JingleMessage* message) { … }
void JingleSession::SendSessionInitiateMessage() { … }
std::string JingleSession::GetNextOutgoingId() { … }
}