| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Sent by the remote_security_key if an error occurs which does not conform | 93 // Sent by the remote_security_key if an error occurs which does not conform |
| 94 // to any existing category. No response to this message is expected. | 94 // to any existing category. No response to this message is expected. |
| 95 // Payload length: variable. If > 0 bytes, the bytes represent an error | 95 // Payload length: variable. If > 0 bytes, the bytes represent an error |
| 96 // string which is ascii encoded and does not include a null terminator. | 96 // string which is ascii encoded and does not include a null terminator. |
| 97 UNKNOWN_ERROR = 255, | 97 UNKNOWN_ERROR = 255, |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class SecurityKeyMessage final { | 100 class SecurityKeyMessage final { |
| 101 public: | 101 public: |
| 102 // The number of bytes used to represent the header. | 102 // The number of bytes used to represent the header. |
| 103 static const int kHeaderSizeBytes = 4; | 103 static const int kHeaderSizeBytes; |
| 104 |
| 105 // The number of bytes used to represent the message type. |
| 106 static const int kMessageTypeSizeBytes; |
| 104 | 107 |
| 105 SecurityKeyMessage(); | 108 SecurityKeyMessage(); |
| 106 ~SecurityKeyMessage(); | 109 ~SecurityKeyMessage(); |
| 107 | 110 |
| 108 // When given a header value (uint32_t), this method will return whether the | 111 // When given a header value (uint32_t), this method will return whether the |
| 109 // length is within the allowable size range. | 112 // length is within the allowable size range. |
| 110 static bool IsValidMessageSize(uint32_t message_size); | 113 static bool IsValidMessageSize(uint32_t message_size); |
| 111 | 114 |
| 112 // Returns a RemoteSecurityKeyMessageType enum value corresponding to the | 115 // Returns a RemoteSecurityKeyMessageType enum value corresponding to the |
| 113 // value passed in if it is valid, otherwise INVALID is returned. | 116 // value passed in if it is valid, otherwise INVALID is returned. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 128 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessage); | 131 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessage); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 // Used to pass remote security key message data between classes. | 134 // Used to pass remote security key message data between classes. |
| 132 typedef base::Callback<void(scoped_ptr<SecurityKeyMessage> message)> | 135 typedef base::Callback<void(scoped_ptr<SecurityKeyMessage> message)> |
| 133 SecurityKeyMessageCallback; | 136 SecurityKeyMessageCallback; |
| 134 | 137 |
| 135 } // namespace remoting | 138 } // namespace remoting |
| 136 | 139 |
| 137 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ | 140 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ |
| OLD | NEW |