mvanouwerkerk | f8633deb | 2015-07-13 11:04:06 | [diff] [blame] | 1 | // Copyright 2015 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 COMPONENTS_GCM_DRIVER_COMMON_GCM_MESSAGES_H_ |
| 6 | #define COMPONENTS_GCM_DRIVER_COMMON_GCM_MESSAGES_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "components/gcm_driver/common/gcm_driver_export.h" |
| 12 | |
| 13 | namespace gcm { |
| 14 | |
| 15 | // Message data consisting of key-value pairs. |
| 16 | typedef std::map<std::string, std::string> MessageData; |
| 17 | |
| 18 | // Message to be delivered to the other party. |
| 19 | struct GCM_DRIVER_EXPORT OutgoingMessage { |
| 20 | OutgoingMessage(); |
| 21 | ~OutgoingMessage(); |
| 22 | |
| 23 | // Message ID. |
| 24 | std::string id; |
| 25 | // In seconds. |
| 26 | int time_to_live; |
| 27 | MessageData data; |
| 28 | |
| 29 | static const int kMaximumTTL; |
| 30 | }; |
| 31 | |
| 32 | // Message being received from the other party. |
| 33 | struct GCM_DRIVER_EXPORT IncomingMessage { |
| 34 | IncomingMessage(); |
| 35 | ~IncomingMessage(); |
| 36 | |
| 37 | MessageData data; |
| 38 | std::string collapse_key; |
| 39 | std::string sender_id; |
peter | a5aedc5 | 2015-07-22 10:47:30 | [diff] [blame] | 40 | std::string raw_data; |
peter | add31f6 | 2015-10-09 10:18:52 | [diff] [blame] | 41 | |
| 42 | // Whether the contents of the message have been decrypted, and are |
| 43 | // available in |raw_data|. |
| 44 | bool decrypted; |
mvanouwerkerk | f8633deb | 2015-07-13 11:04:06 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | } // namespace gcm |
| 48 | |
| 49 | #endif // COMPONENTS_GCM_DRIVER_COMMON_GCM_MESSAGES_H_ |