chromium/components/safe_browsing/core/common/proto/webui.proto

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file includes Safe Browsing WebUI protocol buffer.

syntax = "proto2";

package safe_browsing;

option optimize_for = LITE_RUNTIME;

// Describes the state of the database manager.
message DatabaseManagerInfo {
  // Describes the status of the last update request sent to SafeBrowsing.
  message UpdateInfo {
    // Network status code for the last update request sent to SafeBrowsing.
    optional int32 network_status_code = 1;

    // The time, since epoch, when the last update request was sent to
    // SafeBrowsing.
    optional uint64 last_update_time_millis = 2;

    // The time, since epoch, when the next update request will be sent to
    // SafeBrowsing.
    optional uint64 next_update_time_millis = 3;
  }

  optional UpdateInfo update_info = 1;

  // Describes the state of the database.
  message DatabaseInfo {
    // Was the last update applied successfully?
    optional bool update_successful = 1;

    // Sum of the store sizes in the database.
    optional uint64 database_size_bytes = 2;

    // Describes the state of a store in the database.
    message StoreInfo {
      // The store file name.
      optional string file_name = 1;

      // The store file size.
      optional int64 file_size_bytes = 2;

      // The status of applying the updates fetched from the server to the
      // store. The values of update_status corresponds to the enum
      // ApplyUpdateResult in V4Store.
      optional int32 update_status = 3;

      // The time, since epoch, of applying the updates to the store.
      optional uint64 last_apply_update_time_millis = 4;

      // The number of times the store has been queried for a prefix.
      optional uint32 checks_attempted = 5;

      // The current state of the client for the requested store (the encrypted
      // ClientState that was sent to the client from the previous request).
      optional string state = 6;

      // A message encapsulating the number of prefixes of a given size.
      message PrefixSet {
        // Size of the prefixes in the set, in bytes.
        optional int64 size = 1;

        // Number of prefixes in the set.
        optional int64 count = 2;
      }

      // Has an entry for each prefix size found within the store as well as the
      // corresponding count of prefixes of that size.
      repeated PrefixSet prefix_sets = 7;
    }

    // Information about each of the stores managed by the database.
    repeated StoreInfo store_info = 3;
  }

  optional DatabaseInfo database_info = 2;
}

// The information about the list of prefixes for which the full hashes have
// been stored in the cache.
message FullHashCacheInfo {
  // Records number of cache hits since the beginning of the session.
  optional int32 number_of_hits = 1;
  // Cached full hashes received from the server for the corresponding hash
  // prefixes.
  message FullHashCache {
    // The hash prefix for which the full hashes are stored in the cache.
    optional string hash_prefix = 1;
    // The information about a hash prefix stored in the cache.
    message CachedHashPrefixInfo {
      // The negative ttl for the hash prefix.
      optional int64 negative_expiry = 1;
      // The information about a particular full hash.
      message FullHashInfo {
        // The expiration time of the full hash for a particular store.
        optional int64 positive_expiry = 1;
        // A variable-length SHA256 hash with size between 4 and 32 bytes
        // inclusive.
        optional string full_hash = 2;
        // The list for which this full hash is applicable.
        message ListIdentifier {
          // Types of platforms. The value of platform_type corresponds to the
          // PlatformType enum in safebrowsing_proto.
          optional int32 platform_type = 1;
          // Types of entries that pose threats. The value of threat_entry_type
          // corresponds to the ThreatEntryType enum in safebrowsing_proto.
          optional int32 threat_entry_type = 2;
          // Types of threats. The value of threat_type corresponds to the
          // ThreatType enum in safebrowsing_proto.
          optional int32 threat_type = 3;
        }
        optional ListIdentifier list_identifier = 3;
      }
      // The list of all full hashes (and related info) that start with a
      // particular hash prefix and are known to be unsafe.
      repeated FullHashInfo full_hash_info = 2;
    }
    // Information about the cached hash prefix for each hash prefix in the
    // cache.
    optional CachedHashPrefixInfo cached_hash_prefix_info = 2;
  }
  repeated FullHashCache full_hash_cache = 2;
}