Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1757)

Unified Diff: rlz/lib/net_response_check.h

Issue 2857343004: Add rlz_utils as a new build target to rlz/ (Closed)
Patch Set: Move RLZ_LIB_API to shared rlz_enums.h Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: rlz/lib/net_response_check.h
diff --git a/rlz/lib/net_response_check.h b/rlz/lib/net_response_check.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef23a17f2c0dd6f45eccc4ea957d0264750ea90a
--- /dev/null
+++ b/rlz/lib/net_response_check.h
@@ -0,0 +1,27 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef RLZ_LIB_NET_RESPONSE_CHECK_H_
+#define RLZ_LIB_NET_RESPONSE_CHECK_H_
+
+#include <string>
+#include "rlz/lib/rlz_enums.h"
+
+// Checksum validation convenience call for RLZ network responses.
+namespace rlz_lib {
+// The maximum length of a ping response we will parse in bytes. If the response
+// is bigger, please break it up into separate calls.
+const size_t kMaxPingResponseLength = 0x4000; // 16K
+
+// Checks if a ping response is valid - ie. it has a checksum line which
+// is the CRC-32 checksum of the message uptil the checksum. If
Roger Tawa OOO till Jul 10th 2017/05/05 15:31:29 Nit: uptil --> "up to", or "up till"
Yusuf 2017/05/05 17:14:57 Done.
+// checksum_idx is not NULL, it will get the index of the checksum, i.e. -
+// the effective end of the message.
+// Access: No restrictions.
+bool RLZ_LIB_API IsPingResponseValid(const char* response, int* checksum_idx);
+
+}; // namespace rlz_lib
+
+#endif // RLZ_LIB_NET_RESPONSE_CHECK_H_

Powered by Google App Engine
This is Rietveld 408576698