1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.net;
20
21option java_multiple_files = true;
22
23import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
24import "frameworks/base/core/proto/android/privacy.proto";
25
26/**
27 * An android.net.NetworkRequest object.
28 */
29message NetworkRequestProto {
30    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
31
32    enum Type {
33        TYPE_UNKNOWN = 0;
34        // Only used by applications. When an application creates a
35        // NetworkRequest, it does not have a type; the type is set by the
36        // system depending on the method used to file the request
37        // (requestNetwork, registerNetworkCallback, etc.).
38        TYPE_NONE = 1;
39        // The framework will issue callbacks about any and all networks that
40        // match the specified NetworkCapabilities.
41        TYPE_LISTEN = 2;
42        // A hybrid of the two designed such that the framework will issue
43        // callbacks for the single, highest scoring current network (if any)
44        // that matches the capabilities of the default Internet request
45        // (mDefaultRequest), but which cannot cause the framework to either
46        // create or retain the existence of any specific network. Note that
47        // from the point of view of the request matching code, TRACK_DEFAULT is
48        // identical to REQUEST: its special behaviour is not due to different
49        // semantics, but to the fact that the system will only ever create a
50        // TRACK_DEFAULT with capabilities that are identical to the default
51        // request's capabilities, thus causing it to share fate in every way
52        // with the default request.
53        TYPE_TRACK_DEFAULT = 3;
54        // Capable of causing a specific network to be created first (e.g. a
55        // telephony DUN request), the framework will issue callbacks about the
56        // single, highest scoring current network (if any) that matches the
57        // specified NetworkCapabilities.
58        TYPE_REQUEST = 4;
59        // Like REQUEST but does not cause any networks to retain the
60        // NET_CAPABILITY_FOREGROUND capability. A network with no foreground
61        // requests is in the background. A network that has one or more
62        // background requests and loses its last foreground request to a
63        // higher-scoring network will not go into the background immediately,
64        // but will linger and go into the background after the linger timeout.
65        TYPE_BACKGROUND_REQUEST = 5;
66    }
67    // The type of the request. This is only used by the system and is always
68    // NONE elsewhere.
69    optional Type type = 1;
70    // Identifies the request.
71    optional int32 request_id = 2;
72    // Set for legacy requests and the default.
73    optional int32 legacy_type = 3;
74    optional NetworkCapabilitiesProto network_capabilities = 4;
75}
76