Chromium Code Reviews| Index: remoting/host/security_key/remote_security_key_messages.h |
| diff --git a/remoting/host/security_key/remote_security_key_messages.h b/remoting/host/security_key/remote_security_key_messages.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d25f1dc89b4fba3e5110d0686d7a3c9e2ffa626a |
| --- /dev/null |
| +++ b/remoting/host/security_key/remote_security_key_messages.h |
| @@ -0,0 +1,105 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// 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_REMOTE_SECURITY_KEY_MESSAGES_H_ |
| +#define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGES_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <string> |
| + |
| +#include "base/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 |
|
Sergey Ulanov
2016/03/23 19:07:25
Are you going to put formatting/parsing code in th
joedow
2016/03/24 17:48:08
Done.
|
| +// ----------------------------------------------------------------------------- |
| +// |
| +// {Header: uint32_t}{Control Code: uint8_t}{Payload: optional, variable length} |
| +// |
| +// Header: Defines the length of the message (Control Code + Payload). |
|
Sergey Ulanov
2016/03/23 19:07:25
Specify byte order please
joedow
2016/03/24 17:48:08
Done.
|
| +// 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. |
| +// |
| +// These constants are used to enforce and validate length limitations for both |
| +// the message fields and the message itself. |
| +extern const uint32_t kMaxRemoteSecurityKeyMessageByteCount; |
| +extern const int kRemoteSecurityKeyMessageHeaderByteCount; |
| +extern const int kRemoteSecurityKeyMessageControlCodeByteCount; |
| +extern const int kRemoteSecurityKeyMessagePayloadByteCount; |
| + |
| +// ----------------------------------------------------------------------------- |
| +// Messages |
| +// ----------------------------------------------------------------------------- |
| + |
| +// This message is sent to the remote_security_key process to ask it to |
| +// establish a connection to the Chromoting host if a security key enabled |
| +// session exists for the current user. |
| +// Payload length: 0 |
| +extern const uint8_t kConnectToSecurityKeyEnabledSessionMsg; |
| + |
| +// This message is sent is sent by the remote_security_key process in response |
| +// to the request above. |
| +// Payload length: 1 byte bool indicating whether a connection was established. |
| +// True(1): A connection with the Chromoting Host is established and ready to |
| +// receive security key requests to forward. |
| +// False(0): No security key session was found. |
| +extern const uint8_t kConnectToSecurityKeyEnabledSessionRsp; |
| + |
| +// This message is sent by the remote_security_key proces when an error occurs |
| +// while attempting to detect the existence of a Chromoting session or when to |
| +// establish a connection to it. |
| +// Payload length: variable. If > 0 bytes, the bytes represent an error string, |
| +// ascii encoded and null terminated. |
| +extern const uint8_t kConnectToSecurityKeyEnabledSessionErr; |
| + |
| +// This message is sent to the remote_security_key process to ask it to |
| +// forward a security key request. |
| +// Payload length: > 0 bytes consisting of the security key message to forward |
| +// to the remote machine using Length-Value format. |
| +extern const uint8_t kRemoteSecurityKeyRequestMsg; |
| + |
| +// This message is sent by the remote_security_key once a response has been |
| +// received from the remote machine. |
| +// Payload length: > 0 bytes consisting of the security key response from the |
| +// remote machine using Length-Value format. |
| +extern const uint8_t kRemoteSecurityKeyRequestRsp; |
| + |
| +// This message is sent by the remote_security_key if an error occurs either in |
| +// sending the request data to the remote host or if an error occurs when |
| +// receiving the response. |
| +// Payload length: variable. If > 0 bytes, the bytes represent an error string, |
| +// which is ascii encoded and null terminated. |
| +extern const uint8_t kRemoteSecurityKeyRequestErr; |
| + |
| +// This message is sent by the remote_security_key if an unknown command is sent |
| +// to it. |
| +// Payload length: 0 bytes. |
| +extern const uint8_t kRemoteSecurityKeyUnknownMessageErrorMsg; |
| + |
| +// This message is sent by the remote_security_key if an unexpected error occurs |
| +// which does not conform to any existing category. No response to this message |
| +// is expected. |
| +// Payload length: variable. If > 0 bytes, the bytes represent an error string, |
| +// which is ascii encoded and null terminated. |
| +extern const uint8_t kRemoteSecurityKeyUnknownErrorMsg; |
| + |
| +// Used to pass remote security key message data between classes. |
| +typedef base::Callback<void(uint8_t message_type, |
| + const std::string& message_payload)> |
| + RemoteSecurityKeyMessageCallback; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGES_H_ |