#include "cast/common/channel/connection_namespace_handler.h"
#include <algorithm>
#include <optional>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include "cast/common/channel/message_util.h"
#include "cast/common/channel/proto/cast_channel.pb.h"
#include "cast/common/channel/virtual_connection.h"
#include "cast/common/channel/virtual_connection_router.h"
#include "cast/common/public/cast_socket.h"
#include "util/json/json_serialization.h"
#include "util/json/json_value.h"
#include "util/osp_logging.h"
namespace openscreen::cast {
CastMessage;
CastMessage_PayloadType;
namespace {
bool IsValidProtocolVersion(int version) { … }
std::optional<int> FindMaxProtocolVersion(const Json::Value* version,
const Json::Value* version_list) { … }
VirtualConnection::CloseReason GetCloseReason(
const Json::Value& parsed_message) { … }
}
ConnectionNamespaceHandler::ConnectionNamespaceHandler(
VirtualConnectionRouter& vc_router,
VirtualConnectionPolicy& vc_policy)
: … { … }
ConnectionNamespaceHandler::~ConnectionNamespaceHandler() { … }
void ConnectionNamespaceHandler::OpenRemoteConnection(
VirtualConnection conn,
RemoteConnectionResultCallback result_callback) { … }
void ConnectionNamespaceHandler::CloseRemoteConnection(VirtualConnection conn) { … }
void ConnectionNamespaceHandler::OnMessage(VirtualConnectionRouter* router,
CastSocket* socket,
CastMessage message) { … }
void ConnectionNamespaceHandler::HandleConnect(CastSocket* socket,
CastMessage message,
Json::Value parsed_message) { … }
void ConnectionNamespaceHandler::HandleClose(CastSocket* socket,
CastMessage message,
Json::Value parsed_message) { … }
void ConnectionNamespaceHandler::HandleConnectedResponse(
CastSocket* socket,
CastMessage message,
Json::Value parsed_message) { … }
void ConnectionNamespaceHandler::SendConnect(VirtualConnection virtual_conn) { … }
void ConnectionNamespaceHandler::SendClose(VirtualConnection virtual_conn) { … }
void ConnectionNamespaceHandler::SendConnectedResponse(
const VirtualConnection& virtual_conn,
int max_protocol_version) { … }
bool ConnectionNamespaceHandler::RemoveConnection(
const VirtualConnection& conn,
VirtualConnection::CloseReason reason) { … }
}