blob: e74af5eb50de0e6ec40b25dc1c59faf494774df8 [file] [log] [blame]
Wenchao Tongf5ea3402015-03-04 13:26:38 -08001/*
2 * Copyright (C) 2015 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
17package com.android.internal.net;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
Benedict Wongedcd5ad2019-06-12 17:46:15 +000022import java.util.Arrays;
23
Wenchao Tongf5ea3402015-03-04 13:26:38 -080024/**
25 * A lightweight container used to carry information of the ongoing VPN.
26 * Internal use only..
27 *
28 * @hide
29 */
30public class VpnInfo implements Parcelable {
31 public int ownerUid;
32 public String vpnIface;
Benedict Wongedcd5ad2019-06-12 17:46:15 +000033 public String[] underlyingIfaces;
Wenchao Tongf5ea3402015-03-04 13:26:38 -080034
35 @Override
36 public String toString() {
Irina Dumitrescu18622d32018-12-05 16:19:47 +000037 return "VpnInfo{"
38 + "ownerUid=" + ownerUid
39 + ", vpnIface='" + vpnIface + '\''
Benedict Wongedcd5ad2019-06-12 17:46:15 +000040 + ", underlyingIfaces='" + Arrays.toString(underlyingIfaces) + '\''
Irina Dumitrescu18622d32018-12-05 16:19:47 +000041 + '}';
Wenchao Tongf5ea3402015-03-04 13:26:38 -080042 }
43
44 @Override
45 public int describeContents() {
46 return 0;
47 }
48
49 @Override
50 public void writeToParcel(Parcel dest, int flags) {
51 dest.writeInt(ownerUid);
52 dest.writeString(vpnIface);
Benedict Wongedcd5ad2019-06-12 17:46:15 +000053 dest.writeStringArray(underlyingIfaces);
Wenchao Tongf5ea3402015-03-04 13:26:38 -080054 }
55
56 public static final Parcelable.Creator<VpnInfo> CREATOR = new Parcelable.Creator<VpnInfo>() {
57 @Override
58 public VpnInfo createFromParcel(Parcel source) {
59 VpnInfo info = new VpnInfo();
60 info.ownerUid = source.readInt();
61 info.vpnIface = source.readString();
Benedict Wongedcd5ad2019-06-12 17:46:15 +000062 info.underlyingIfaces = source.readStringArray();
Wenchao Tongf5ea3402015-03-04 13:26:38 -080063 return info;
64 }
65
66 @Override
67 public VpnInfo[] newArray(int size) {
68 return new VpnInfo[size];
69 }
70 };
71}