#ifndef COMPONENTS_MEDIA_ROUTER_COMMON_PROVIDERS_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#define COMPONENTS_MEDIA_ROUTER_COMMON_PROVIDERS_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#include <optional>
#include <string>
#include <string_view>
#include "base/values.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
namespace cast_channel {
class AuthContext;
CastMessage;
DeviceAuthMessage;
static constexpr char kAuthNamespace[] = …;
static constexpr char kHeartbeatNamespace[] = …;
static constexpr char kConnectionNamespace[] = …;
static constexpr char kReceiverNamespace[] = …;
static constexpr char kMediaNamespace[] = …;
static constexpr char kPlatformSenderId[] = …;
static constexpr char kPlatformReceiverId[] = …;
static constexpr char kWaitingUserResponse[] = …;
static constexpr char kUserAllowedStatus[] = …;
static constexpr char kUserNotAllowedError[] = …;
static constexpr char kNotificationDisabledError[] = …;
enum class CastMessageType { … };
enum class V2MessageType { … };
enum class ReceiverAppType { … };
std::ostream& operator<<(std::ostream& lhs, const CastMessage& rhs);
bool IsCastMessageValid(const CastMessage& message_proto);
bool IsCastReservedNamespace(std::string_view message_namespace);
CastMessageType ParseMessageTypeFromPayload(const base::Value::Dict& payload);
const char* ToString(CastMessageType message_type);
const char* ToString(V2MessageType message_type);
CastMessageType CastMessageTypeFromString(const std::string& type);
V2MessageType V2MessageTypeFromString(const std::string& type);
std::string AuthMessageToString(const DeviceAuthMessage& message);
void CreateAuthChallengeMessage(CastMessage* message_proto,
const AuthContext& auth_context);
bool IsAuthMessage(const CastMessage& message);
bool IsReceiverMessage(const CastMessage& message);
bool IsPlatformSenderMessage(const CastMessage& message);
CastMessage CreateKeepAlivePingMessage();
CastMessage CreateKeepAlivePongMessage();
enum VirtualConnectionType { … };
CastMessage CreateVirtualConnectionRequest(
const std::string& source_id,
const std::string& destination_id,
VirtualConnectionType connection_type,
const std::string& user_agent,
const std::string& browser_version);
CastMessage CreateVirtualConnectionClose(const std::string& source_id,
const std::string& destination_id);
CastMessage CreateGetAppAvailabilityRequest(const std::string& source_id,
int request_id,
const std::string& app_id);
CastMessage CreateReceiverStatusRequest(const std::string& source_id,
int request_id);
CastMessage CreateLaunchRequest(
const std::string& source_id,
int request_id,
const std::string& app_id,
const std::string& locale,
const std::vector<std::string>& supported_app_types,
const std::optional<base::Value>& app_params);
CastMessage CreateStopRequest(const std::string& source_id,
int request_id,
const std::string& session_id);
CastMessage CreateCastMessage(const std::string& message_namespace,
const base::Value& message,
const std::string& source_id,
const std::string& destination_id);
CastMessage CreateMediaRequest(const base::Value::Dict& body,
int request_id,
const std::string& source_id,
const std::string& destination_id);
CastMessage CreateSetVolumeRequest(const base::Value::Dict& body,
int request_id,
const std::string& source_id);
bool IsMediaRequestMessageType(V2MessageType v2_message_type);
enum class GetAppAvailabilityResult { … };
const char* ToString(GetAppAvailabilityResult result);
std::optional<int> GetRequestIdFromResponse(const base::Value::Dict& payload);
GetAppAvailabilityResult GetAppAvailabilityResultFromResponse(
const base::Value::Dict& payload,
const std::string& app_id);
struct LaunchSessionResponse { … };
LaunchSessionResponse GetLaunchSessionResponse(
const base::Value::Dict& payload);
LaunchSessionResponse GetLaunchSessionResponseError(std::string error_msg);
VirtualConnectionType GetConnectionType(const std::string& destination_id);
}
#endif