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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.h

Issue 2495783003: Implement support for checking bad IPs aka MatchMalwareIP (Closed)
Patch Set: Add a comma after the last enum value Created 4 years, 1 month 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: components/safe_browsing_db/v4_protocol_manager_util.h
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.h b/components/safe_browsing_db/v4_protocol_manager_util.h
index 4970f07eb18518a8b1b4a7613ecd1a2ac7da2808..3cadb0b147900e22dccd4093db593ad93b061596 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.h
+++ b/components/safe_browsing_db/v4_protocol_manager_util.h
@@ -20,6 +20,7 @@
namespace net {
class HttpRequestHeaders;
+class IPAddress;
} // namespace net
namespace safe_browsing {
@@ -136,6 +137,7 @@ struct ListIdentifier {
std::ostream& operator<<(std::ostream& os, const ListIdentifier& id);
PlatformType GetCurrentPlatformType();
+const ListIdentifier GetAnyIpMalwareId();
const ListIdentifier GetChromeUrlApiId();
const ListIdentifier GetChromeUrlClientIncidentId();
const ListIdentifier GetChromeUrlMalwareId();
@@ -272,6 +274,16 @@ class V4ProtocolManagerUtil {
static void SetClientInfoFromConfig(ClientInfo* client_info,
const V4ProtocolConfig& config);
+ static bool GetIPV6AddressFromString(const std::string& ip_address,
+ net::IPAddress* address);
+
+ // Converts a IPV4 or IPV6 address in |ip_address| to the SHA1 hash of the
+ // corresponding packed IPV6 address in |hashed_encoded_ip|, and adds an
+ // extra byte containing the value 128 at the end. This is done to match the
+ // server implementation for calculating the hash prefix of an IP address.
+ static bool IPAddressToEncodedIPV6Hash(const std::string& ip_address,
+ FullHash* hashed_encoded_ip);
+
private:
V4ProtocolManagerUtil(){};
FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, TestBackOffLogic);

Powered by Google App Engine
This is Rietveld 408576698