blob: a6a071cc8c1ef37d4b29a54df131a0e347d23a47 [file] [log] [blame]
mvanouwerkerkf8633deb2015-07-13 11:04:061// 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
13namespace gcm {
14
15// Message data consisting of key-value pairs.
16typedef std::map<std::string, std::string> MessageData;
17
18// Message to be delivered to the other party.
19struct 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.
33struct GCM_DRIVER_EXPORT IncomingMessage {
34 IncomingMessage();
35 ~IncomingMessage();
36
37 MessageData data;
38 std::string collapse_key;
39 std::string sender_id;
petera5aedc52015-07-22 10:47:3040 std::string raw_data;
peteradd31f62015-10-09 10:18:5241
42 // Whether the contents of the message have been decrypted, and are
43 // available in |raw_data|.
44 bool decrypted;
mvanouwerkerkf8633deb2015-07-13 11:04:0645};
46
47} // namespace gcm
48
49#endif // COMPONENTS_GCM_DRIVER_COMMON_GCM_MESSAGES_H_