// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ #include <cstdint> #include <memory> #include <string> #include "base/functional/callback_forward.h" namespace remoting { // ----------------------------------------------------------------------------- // Introduction // ----------------------------------------------------------------------------- // // This file defines the message format and messages used to interact with the // remote_security_key process which is used to forward security key requests // to a remote client and return security key responses from the remote client. // ----------------------------------------------------------------------------- // Message Format // ----------------------------------------------------------------------------- // // {Header: uint32_t}{Control Code: uint8_t}{Payload: optional, variable length} // // Header: Defines the length of the message (Control Code + Payload). // The header endianness is determined by the platform. // Control Code: Contains a value representing the message type. // Payload: An optional field of variable length. Data being represented in // this field is dependent on the message type. // The endianess of the payload is dependent on the message type. // Multi-byte payloads which are part of the security key request and // response messages are expected to be big endian. The bytes for // these messages will be transmitted across the network as-is. // The format for all other payloads is the endianness of the platform. // ----------------------------------------------------------------------------- // Messages // ----------------------------------------------------------------------------- // NOTE: Make sure SecurityKeyMessage::MessageTypeFromValue is updated when new // enum values are added/removed. enum class SecurityKeyMessageType : uint8_t { … }; const uint8_t kConnectResponseNoSession = …; const uint8_t kConnectResponseActiveSession = …; class SecurityKeyMessage final { … }; // Used to pass security key message data between classes. SecurityKeyMessageCallback; } // namespace remoting #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_