1 /*
2  * Copyright (C) 2021 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 
17 package android.net;
18 
19 import android.net.NativeNetworkType;
20 import android.net.NativeVpnType;
21 
22 /**
23  * The configuration to create a network.
24  *
25  * {@hide}
26  */
27 @JavaDerive(toString=true, equals=true)
28 @JavaOnlyImmutable
29 parcelable NativeNetworkConfig {
30     /** The networkId to create. */
31     int netId;
32 
33     /**
34      * The type of network : virtual, physical or physical local network.
35      */
36     NativeNetworkType networkType = NativeNetworkType.PHYSICAL;
37 
38     /**
39      * The permission necessary to use the network. Must be PERMISSION_NONE, PERMISSION_NETWORK
40      * or PERMISSION_SYSTEM. Ignored for virtual network types.
41      */
42     int permission;
43 
44     /**
45      *  For virtual networks. Whether unprivileged apps are allowed to bypass the VPN. Ignored for
46      *  all other network types.
47      */
48     boolean secure;
49 
50     /** For virtual networks. The type of VPN to create.  Ignored for all other network types. */
51     NativeVpnType vpnType = NativeVpnType.PLATFORM;
52 
53     /**
54      * For virtual networks. Whether local traffic is excluded from the VPN.
55      */
56     boolean excludeLocalRoutes = false;
57 }
58