OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace cast_channel { | |
11 class CastMessage; | |
12 } // namespace cast_channel | |
13 | |
14 namespace extensions { | 10 namespace extensions { |
15 namespace api { | 11 namespace api { |
16 namespace cast_channel { | 12 namespace cast_channel { |
17 | 13 |
| 14 class AuthContext; |
| 15 class CastMessage; |
| 16 class DeviceAuthMessage; |
18 struct MessageInfo; | 17 struct MessageInfo; |
19 | 18 |
20 // Fills |message_proto| from |message| and returns true on success. | 19 // Fills |message_proto| from |message| and returns true on success. |
21 bool MessageInfoToCastMessage(const MessageInfo& message, | 20 bool MessageInfoToCastMessage(const MessageInfo& message, |
22 ::cast_channel::CastMessage* message_proto); | 21 CastMessage* message_proto); |
| 22 |
| 23 // Checks if the contents of |message_proto| are valid. |
| 24 bool IsCastMessageValid(const CastMessage& message_proto); |
23 | 25 |
24 // Fills |message| from |message_proto| and returns true on success. | 26 // Fills |message| from |message_proto| and returns true on success. |
25 bool CastMessageToMessageInfo(const ::cast_channel::CastMessage& message_proto, | 27 bool CastMessageToMessageInfo(const CastMessage& message_proto, |
26 MessageInfo* message); | 28 MessageInfo* message); |
27 | 29 |
| 30 // Returns a human readable string for |message_proto|. |
| 31 std::string CastMessageToString(const CastMessage& message_proto); |
| 32 |
| 33 // Returns a human readable string for |message|. |
| 34 std::string AuthMessageToString(const DeviceAuthMessage& message); |
| 35 |
| 36 // Fills |message_proto| appropriately for an auth challenge request message. |
| 37 // Uses the nonce challenge in |auth_context|. |
| 38 void CreateAuthChallengeMessage(CastMessage* message_proto, |
| 39 const AuthContext& auth_context); |
| 40 |
| 41 // Returns whether the given message is an auth handshake message. |
| 42 bool IsAuthMessage(const CastMessage& message); |
| 43 |
28 } // namespace cast_channel | 44 } // namespace cast_channel |
29 } // namespace api | 45 } // namespace api |
30 } // namespace extensions | 46 } // namespace extensions |
31 | 47 |
32 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 48 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
OLD | NEW |