xref: /aosp_15_r20/external/cronet/components/cronet/android/proto/flags.proto (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1// Describes the proto schema for HTTP flags.
2//
3// IMPORTANT: a copy of the proto schema described here is used by the HTTP
4// flags producer, which is the responsibility of the host system. Be very
5// careful about backward compatibility implications of any changes made in this
6// file.
7
8syntax = "proto2";
9
10package org.chromium.net.httpflags;
11
12option java_package = "org.chromium.net.httpflags";
13option java_multiple_files = true;
14
15// Describes the value that an HTTP flag should have, based on various criteria
16// depending on the context in which the flag is used.
17message FlagValue {
18  // A possible value for this flag, along with a set of constraints that have
19  // to be met for that value to be used.
20  message ConstrainedValue {
21    // App selector: only apply this value to applications whose package ID
22    // matches the value of this field, e.g. "com.google.foo".
23    // If not set, matches all apps.
24    optional string app_id = 1;
25
26    // Only apply this value to client libraries running at least this version.
27    //
28    // Currently this refers to Cronet versions, which are in the form
29    // <MAJOR>.<MINOR>.<BUILD>.<PATCH>.
30    //
31    // The comparison is done in the usual way version numbers are compared,
32    // i.e. they are treated as numeric tuples and compared
33    // lexicographically. If the tuple dimensions differ, the smallest tuple is
34    // zero-extended to match. For example, a `min_version` of 4.5.6.0 (or
35    // just 4.5.6) will match 4.5.6.0, 4.5.6.1, 4.5.7.0, 4.5.10.0, 4.6.0.0,
36    // 5.0.0.0, etc. but will not match 4.5.5.99, 4.4.7.0, 3.6.7.1, etc.
37    //
38    // If not set, matches all versions. The empty string is not a valid value.
39    optional string min_version = 2;
40
41    // If none of these fields are set, the flag is deemed to be unset.
42    oneof value {
43      bool bool_value = 3;
44      int64 int_value = 4;
45      float float_value = 5;
46      string string_value = 6;
47      bytes bytes_value = 7;
48    }
49  }
50
51  // Each entry in this list is tried in turn, and the first entry to match
52  // determines the flag value. If no entries match, the flag is deemed to be
53  // unset.
54  repeated ConstrainedValue constrained_values = 8;
55}
56
57// The format of the HTTP flags file is defined as the binary representation of
58// an instance of this proto.
59message Flags {
60  // The key is the name of the flag. For example, "Cronet_log_me".
61  map<string, FlagValue> flags = 1;
62}
63