Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGES_H_ | |
| 6 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGES_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/callback_forward.h" | |
| 13 | |
| 14 namespace remoting { | |
| 15 | |
| 16 // ----------------------------------------------------------------------------- | |
| 17 // Introduction | |
| 18 // ----------------------------------------------------------------------------- | |
| 19 // | |
| 20 // This file defines the message format and messages used to interact with the | |
| 21 // remote_security_key process which is used to forward security key requests | |
| 22 // to a remote client and return security key responses from the remote client. | |
| 23 | |
| 24 // ----------------------------------------------------------------------------- | |
| 25 // 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.
| |
| 26 // ----------------------------------------------------------------------------- | |
| 27 // | |
| 28 // {Header: uint32_t}{Control Code: uint8_t}{Payload: optional, variable length} | |
| 29 // | |
| 30 // 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.
| |
| 31 // Control Code: Contains a value representing the message type. | |
| 32 // Payload: An optional field of variable length. Data being represented in | |
| 33 // this field is dependent on the message type. | |
| 34 // | |
| 35 // These constants are used to enforce and validate length limitations for both | |
| 36 // the message fields and the message itself. | |
| 37 extern const uint32_t kMaxRemoteSecurityKeyMessageByteCount; | |
| 38 extern const int kRemoteSecurityKeyMessageHeaderByteCount; | |
| 39 extern const int kRemoteSecurityKeyMessageControlCodeByteCount; | |
| 40 extern const int kRemoteSecurityKeyMessagePayloadByteCount; | |
| 41 | |
| 42 // ----------------------------------------------------------------------------- | |
| 43 // Messages | |
| 44 // ----------------------------------------------------------------------------- | |
| 45 | |
| 46 // This message is sent to the remote_security_key process to ask it to | |
| 47 // establish a connection to the Chromoting host if a security key enabled | |
| 48 // session exists for the current user. | |
| 49 // Payload length: 0 | |
| 50 extern const uint8_t kConnectToSecurityKeyEnabledSessionMsg; | |
| 51 | |
| 52 // This message is sent is sent by the remote_security_key process in response | |
| 53 // to the request above. | |
| 54 // Payload length: 1 byte bool indicating whether a connection was established. | |
| 55 // True(1): A connection with the Chromoting Host is established and ready to | |
| 56 // receive security key requests to forward. | |
| 57 // False(0): No security key session was found. | |
| 58 extern const uint8_t kConnectToSecurityKeyEnabledSessionRsp; | |
| 59 | |
| 60 // This message is sent by the remote_security_key proces when an error occurs | |
| 61 // while attempting to detect the existence of a Chromoting session or when to | |
| 62 // establish a connection to it. | |
| 63 // Payload length: variable. If > 0 bytes, the bytes represent an error string, | |
| 64 // ascii encoded and null terminated. | |
| 65 extern const uint8_t kConnectToSecurityKeyEnabledSessionErr; | |
| 66 | |
| 67 // This message is sent to the remote_security_key process to ask it to | |
| 68 // forward a security key request. | |
| 69 // Payload length: > 0 bytes consisting of the security key message to forward | |
| 70 // to the remote machine using Length-Value format. | |
| 71 extern const uint8_t kRemoteSecurityKeyRequestMsg; | |
| 72 | |
| 73 // This message is sent by the remote_security_key once a response has been | |
| 74 // received from the remote machine. | |
| 75 // Payload length: > 0 bytes consisting of the security key response from the | |
| 76 // remote machine using Length-Value format. | |
| 77 extern const uint8_t kRemoteSecurityKeyRequestRsp; | |
| 78 | |
| 79 // This message is sent by the remote_security_key if an error occurs either in | |
| 80 // sending the request data to the remote host or if an error occurs when | |
| 81 // receiving the response. | |
| 82 // Payload length: variable. If > 0 bytes, the bytes represent an error string, | |
| 83 // which is ascii encoded and null terminated. | |
| 84 extern const uint8_t kRemoteSecurityKeyRequestErr; | |
| 85 | |
| 86 // This message is sent by the remote_security_key if an unknown command is sent | |
| 87 // to it. | |
| 88 // Payload length: 0 bytes. | |
| 89 extern const uint8_t kRemoteSecurityKeyUnknownMessageErrorMsg; | |
| 90 | |
| 91 // This message is sent by the remote_security_key if an unexpected error occurs | |
| 92 // which does not conform to any existing category. No response to this message | |
| 93 // is expected. | |
| 94 // Payload length: variable. If > 0 bytes, the bytes represent an error string, | |
| 95 // which is ascii encoded and null terminated. | |
| 96 extern const uint8_t kRemoteSecurityKeyUnknownErrorMsg; | |
| 97 | |
| 98 // Used to pass remote security key message data between classes. | |
| 99 typedef base::Callback<void(uint8_t message_type, | |
| 100 const std::string& message_payload)> | |
| 101 RemoteSecurityKeyMessageCallback; | |
| 102 | |
| 103 } // namespace remoting | |
| 104 | |
| 105 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGES_H_ | |
| OLD | NEW |