1// Copyright 2017 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// This file includes Safe Browsing WebUI protocol buffer.
6
7syntax = "proto2";
8
9package safe_browsing;
10
11option optimize_for = LITE_RUNTIME;
12
13// Describes the state of the database manager.
14message DatabaseManagerInfo {
15  // Describes the status of the last update request sent to SafeBrowsing.
16  message UpdateInfo {
17    // Network status code for the last update request sent to SafeBrowsing.
18    optional int32 network_status_code = 1;
19
20    // The time, since epoch, when the last update request was sent to
21    // SafeBrowsing.
22    optional uint64 last_update_time_millis = 2;
23
24    // The time, since epoch, when the next update request will be sent to
25    // SafeBrowsing.
26    optional uint64 next_update_time_millis = 3;
27  }
28
29  optional UpdateInfo update_info = 1;
30
31  // Describes the state of the database.
32  message DatabaseInfo {
33    // Was the last update applied successfully?
34    optional bool update_successful = 1;
35
36    // Sum of the store sizes in the database.
37    optional uint64 database_size_bytes = 2;
38
39    // Describes the state of a store in the database.
40    message StoreInfo {
41      // The store file name.
42      optional string file_name = 1;
43
44      // The store file size.
45      optional int64 file_size_bytes = 2;
46
47      // The status of applying the updates fetched from the server to the
48      // store. The values of update_status corresponds to the enum
49      // ApplyUpdateResult in V4Store.
50      optional int32 update_status = 3;
51
52      // The time, since epoch, of applying the updates to the store.
53      optional uint64 last_apply_update_time_millis = 4;
54
55      // The number of times the store has been queried for a prefix.
56      optional uint32 checks_attempted = 5;
57    }
58
59    // Information about each of the stores managed by the database.
60    repeated StoreInfo store_info = 3;
61  }
62
63  optional DatabaseInfo database_info = 2;
64}
65
66// The information about the list of prefixes for which the full hashes have
67// been stored in the cache.
68message FullHashCacheInfo {
69  // Records number of cache hits since the beginning of the session.
70  optional int32 number_of_hits = 1;
71  // Cached full hashes received from the server for the corresponding hash
72  // prefixes.
73  message FullHashCache {
74    // The hash prefix for which the full hashes are stored in the cache.
75    optional string hash_prefix = 1;
76    // The information about a hash prefix stored in the cache.
77    message CachedHashPrefixInfo {
78      // The negative ttl for the hash prefix.
79      optional int64 negative_expiry = 1;
80      // The information about a particular full hash.
81      message FullHashInfo {
82        // The expiration time of the full hash for a particular store.
83        optional int64 positive_expiry = 1;
84        // A variable-length SHA256 hash with size between 4 and 32 bytes
85        // inclusive.
86        optional string full_hash = 2;
87        // The list for which this full hash is applicable.
88        message ListIdentifier {
89          // Types of platforms. The value of platform_type corresponds to the
90          // PlatformType enum in safebrowsing_proto.
91          optional int32 platform_type = 1;
92          // Types of entries that pose threats. The value of threat_entry_type
93          // corresponds to the ThreatEntryType enum in safebrowsing_proto.
94          optional int32 threat_entry_type = 2;
95          // Types of threats. The value of threat_type corresponds to the
96          // ThreatType enum in safebrowsing_proto.
97          optional int32 threat_type = 3;
98        }
99        optional ListIdentifier list_identifier = 3;
100      }
101      // The list of all full hashes (and related info) that start with a
102      // particular hash prefix and are known to be unsafe.
103      repeated FullHashInfo full_hash_info = 2;
104    }
105    // Information about the cached hash prefix for each hash prefix in the
106    // cache.
107    optional CachedHashPrefixInfo cached_hash_prefix_info = 2;
108  }
109  repeated FullHashCache full_hash_cache = 2;
110}
111