// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CAST_COMMON_CHANNEL_CONNECTION_NAMESPACE_HANDLER_H_ #define CAST_COMMON_CHANNEL_CONNECTION_NAMESPACE_HANDLER_H_ #include <functional> #include <vector> #include "cast/common/channel/cast_message_handler.h" #include "cast/common/channel/proto/cast_channel.pb.h" #include "cast/common/channel/virtual_connection.h" #include "util/json/json_serialization.h" namespace openscreen::cast { class VirtualConnectionRouter; // Handles CastMessages in the connection namespace by opening and closing // VirtualConnections on the socket on which the messages were received. // // This is meant to be used in either/both the initiator or responder role: // // 1. Initiators call Open/CloseRemoteConnection() to establish/close a virtual // connection with a remote peer. Internally, OpenRemoteConnection() sends a // CONNECT request to the remote peer, and the remote peer is expected to // respond with a either a CONNECTED response or a CLOSE response. // // 2. Responders simply handle CONNECT or CLOSE requests, allowing or // disallowing connections based on the VirtualConnectionPolicy, and // ConnectionNamespaceHandler will report new/closed connections to the local // VirtualConnectionRouter to enable/disable message routing. class ConnectionNamespaceHandler : public CastMessageHandler { … }; } // namespace openscreen::cast #endif // CAST_COMMON_CHANNEL_CONNECTION_NAMESPACE_HANDLER_H_