OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Utility methods for MCS interactions. | 5 // Utility methods for MCS interactions. |
6 | 6 |
7 #ifndef GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ | 7 #ifndef GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ |
8 #define GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ | 8 #define GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 enum MCSIqStanzaExtension { | 52 enum MCSIqStanzaExtension { |
53 kSelectiveAck = 12, | 53 kSelectiveAck = 12, |
54 kStreamAck = 13, | 54 kStreamAck = 13, |
55 }; | 55 }; |
56 | 56 |
57 // Builds a LoginRequest with the hardcoded local data. | 57 // Builds a LoginRequest with the hardcoded local data. |
58 GCM_EXPORT scoped_ptr<mcs_proto::LoginRequest> BuildLoginRequest( | 58 GCM_EXPORT scoped_ptr<mcs_proto::LoginRequest> BuildLoginRequest( |
59 uint64 auth_id, | 59 uint64 auth_id, |
60 uint64 auth_token, | 60 uint64 auth_token, |
| 61 const std::string& version_string, |
61 const std::vector<int64>& user_serial_numbers); | 62 const std::vector<int64>& user_serial_numbers); |
62 | 63 |
63 // Builds a StreamAck IqStanza message. | 64 // Builds a StreamAck IqStanza message. |
64 GCM_EXPORT scoped_ptr<mcs_proto::IqStanza> BuildStreamAck(); | 65 GCM_EXPORT scoped_ptr<mcs_proto::IqStanza> BuildStreamAck(); |
65 GCM_EXPORT scoped_ptr<mcs_proto::IqStanza> BuildSelectiveAck( | 66 GCM_EXPORT scoped_ptr<mcs_proto::IqStanza> BuildSelectiveAck( |
66 const std::vector<std::string>& acked_ids); | 67 const std::vector<std::string>& acked_ids); |
67 | 68 |
68 // Utility methods for building and identifying MCS protobufs. | 69 // Utility methods for building and identifying MCS protobufs. |
69 GCM_EXPORT scoped_ptr<google::protobuf::MessageLite> | 70 GCM_EXPORT scoped_ptr<google::protobuf::MessageLite> |
70 BuildProtobufFromTag(uint8 tag); | 71 BuildProtobufFromTag(uint8 tag); |
(...skipping 14 matching lines...) Expand all Loading... |
85 // Returns whether the TTL (time to live) for this message has expired, based | 86 // Returns whether the TTL (time to live) for this message has expired, based |
86 // on the |sent| timestamps and base::TimeTicks::Now(). If |protobuf| is not | 87 // on the |sent| timestamps and base::TimeTicks::Now(). If |protobuf| is not |
87 // for a DataMessageStanza or the TTL is 0, will return false. | 88 // for a DataMessageStanza or the TTL is 0, will return false. |
88 GCM_EXPORT bool HasTTLExpired(const google::protobuf::MessageLite& protobuf, | 89 GCM_EXPORT bool HasTTLExpired(const google::protobuf::MessageLite& protobuf, |
89 base::Clock* clock); | 90 base::Clock* clock); |
90 GCM_EXPORT int GetTTL(const google::protobuf::MessageLite& protobuf); | 91 GCM_EXPORT int GetTTL(const google::protobuf::MessageLite& protobuf); |
91 | 92 |
92 } // namespace gcm | 93 } // namespace gcm |
93 | 94 |
94 #endif // GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ | 95 #endif // GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ |
OLD | NEW |