IpSecConfig.java revision a10003d5de52339f4d30fedd7294941378e5f13c
1330e1089da80cddcd68758512370d217b19f8890Nathan Harold/*
2330e1089da80cddcd68758512370d217b19f8890Nathan Harold * Copyright (C) 2017 The Android Open Source Project
3330e1089da80cddcd68758512370d217b19f8890Nathan Harold *
4330e1089da80cddcd68758512370d217b19f8890Nathan Harold * Licensed under the Apache License, Version 2.0 (the "License");
5330e1089da80cddcd68758512370d217b19f8890Nathan Harold * you may not use this file except in compliance with the License.
6330e1089da80cddcd68758512370d217b19f8890Nathan Harold * You may obtain a copy of the License at
7330e1089da80cddcd68758512370d217b19f8890Nathan Harold *
8330e1089da80cddcd68758512370d217b19f8890Nathan Harold *      http://www.apache.org/licenses/LICENSE-2.0
9330e1089da80cddcd68758512370d217b19f8890Nathan Harold *
10330e1089da80cddcd68758512370d217b19f8890Nathan Harold * Unless required by applicable law or agreed to in writing, software
11330e1089da80cddcd68758512370d217b19f8890Nathan Harold * distributed under the License is distributed on an "AS IS" BASIS,
12330e1089da80cddcd68758512370d217b19f8890Nathan Harold * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13330e1089da80cddcd68758512370d217b19f8890Nathan Harold * See the License for the specific language governing permissions and
14330e1089da80cddcd68758512370d217b19f8890Nathan Harold * limitations under the License.
15330e1089da80cddcd68758512370d217b19f8890Nathan Harold */
16330e1089da80cddcd68758512370d217b19f8890Nathan Haroldpackage android.net;
17330e1089da80cddcd68758512370d217b19f8890Nathan Harold
18330e1089da80cddcd68758512370d217b19f8890Nathan Haroldimport android.os.Parcel;
19330e1089da80cddcd68758512370d217b19f8890Nathan Haroldimport android.os.Parcelable;
20a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
21a10003d5de52339f4d30fedd7294941378e5f13cNathan Haroldimport com.android.internal.annotations.VisibleForTesting;
22330e1089da80cddcd68758512370d217b19f8890Nathan Harold
23330e1089da80cddcd68758512370d217b19f8890Nathan Harold/** @hide */
24330e1089da80cddcd68758512370d217b19f8890Nathan Haroldpublic final class IpSecConfig implements Parcelable {
2593962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    private static final String TAG = "IpSecConfig";
26330e1089da80cddcd68758512370d217b19f8890Nathan Harold
27a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    // MODE_TRANSPORT or MODE_TUNNEL
28a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private int mMode = IpSecTransform.MODE_TRANSPORT;
29330e1089da80cddcd68758512370d217b19f8890Nathan Harold
30a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    // Needs to be valid only for tunnel mode
31a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    // Preventing this from being null simplifies Java->Native binder
32a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private String mLocalAddress = "";
33330e1089da80cddcd68758512370d217b19f8890Nathan Harold
34a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    // Preventing this from being null simplifies Java->Native binder
35a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private String mRemoteAddress = "";
36330e1089da80cddcd68758512370d217b19f8890Nathan Harold
37a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    // The underlying network interface that represents the "gateway" Network
38a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    // for outbound packets. It may also be used to select packets.
39a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private Network mNetwork;
40330e1089da80cddcd68758512370d217b19f8890Nathan Harold
41330e1089da80cddcd68758512370d217b19f8890Nathan Harold    public static class Flow {
42330e1089da80cddcd68758512370d217b19f8890Nathan Harold        // Minimum requirements for identifying a transform
43330e1089da80cddcd68758512370d217b19f8890Nathan Harold        // SPI identifying the IPsec flow in packet processing
44330e1089da80cddcd68758512370d217b19f8890Nathan Harold        // and a remote IP address
45a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        private int mSpiResourceId = IpSecManager.INVALID_RESOURCE_ID;
46330e1089da80cddcd68758512370d217b19f8890Nathan Harold
47330e1089da80cddcd68758512370d217b19f8890Nathan Harold        // Encryption Algorithm
48a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        private IpSecAlgorithm mEncryption;
49330e1089da80cddcd68758512370d217b19f8890Nathan Harold
50330e1089da80cddcd68758512370d217b19f8890Nathan Harold        // Authentication Algorithm
51a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        private IpSecAlgorithm mAuthentication;
52b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi
53b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi        @Override
54b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi        public String toString() {
55b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi            return new StringBuilder()
56a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                    .append("{mSpiResourceId=")
57a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                    .append(mSpiResourceId)
58a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                    .append(", mEncryption=")
59a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                    .append(mEncryption)
60a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                    .append(", mAuthentication=")
61a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                    .append(mAuthentication)
62b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi                    .append("}")
63b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi                    .toString();
64b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi        }
65330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
66330e1089da80cddcd68758512370d217b19f8890Nathan Harold
67a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private final Flow[] mFlow = new Flow[] {new Flow(), new Flow()};
68330e1089da80cddcd68758512370d217b19f8890Nathan Harold
69330e1089da80cddcd68758512370d217b19f8890Nathan Harold    // For tunnel mode IPv4 UDP Encapsulation
70330e1089da80cddcd68758512370d217b19f8890Nathan Harold    // IpSecTransform#ENCAP_ESP_*, such as ENCAP_ESP_OVER_UDP_IKE
71a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private int mEncapType = IpSecTransform.ENCAP_NONE;
72a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private int mEncapSocketResourceId = IpSecManager.INVALID_RESOURCE_ID;
73a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private int mEncapRemotePort;
74330e1089da80cddcd68758512370d217b19f8890Nathan Harold
75330e1089da80cddcd68758512370d217b19f8890Nathan Harold    // An interval, in seconds between the NattKeepalive packets
76a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    private int mNattKeepaliveInterval;
77a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
78a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    /** Set the mode for this IPsec transform */
79a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setMode(int mode) {
80a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mMode = mode;
81a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
82a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
83a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    /** Set the local IP address for Tunnel mode */
84a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setLocalAddress(String localAddress) {
85a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        if (localAddress == null) {
86a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold            throw new IllegalArgumentException("localAddress may not be null!");
87a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        }
88a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mLocalAddress = localAddress;
89a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
90a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
91a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    /** Set the remote IP address for this IPsec transform */
92a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setRemoteAddress(String remoteAddress) {
93a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        if (remoteAddress == null) {
94a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold            throw new IllegalArgumentException("remoteAddress may not be null!");
95a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        }
96a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mRemoteAddress = remoteAddress;
97a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
98a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
99a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    /** Set the SPI for a given direction by resource ID */
100a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setSpiResourceId(int direction, int resourceId) {
101a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[direction].mSpiResourceId = resourceId;
102a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
103a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
104a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    /** Set the encryption algorithm for a given direction */
105a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setEncryption(int direction, IpSecAlgorithm encryption) {
106a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[direction].mEncryption = encryption;
107a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
108a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
109a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    /** Set the authentication algorithm for a given direction */
110a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setAuthentication(int direction, IpSecAlgorithm authentication) {
111a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[direction].mAuthentication = authentication;
112a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
113a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
114a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setNetwork(Network network) {
115a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mNetwork = network;
116a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
117a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
118a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setEncapType(int encapType) {
119a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mEncapType = encapType;
120a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
121a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
122a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setEncapSocketResourceId(int resourceId) {
123a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mEncapSocketResourceId = resourceId;
124a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
125a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
126a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setEncapRemotePort(int port) {
127a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mEncapRemotePort = port;
128a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
129a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
130a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public void setNattKeepaliveInterval(int interval) {
131a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mNattKeepaliveInterval = interval;
132a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    }
133330e1089da80cddcd68758512370d217b19f8890Nathan Harold
13493962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    // Transport or Tunnel
13593962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    public int getMode() {
136a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mMode;
13793962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    }
13893962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold
139a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public String getLocalAddress() {
140a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mLocalAddress;
141330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
142330e1089da80cddcd68758512370d217b19f8890Nathan Harold
1438dc1fd0237992e1d693376b4f6eea45e7447e9dbNathan Harold    public int getSpiResourceId(int direction) {
144a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mFlow[direction].mSpiResourceId;
145330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
146330e1089da80cddcd68758512370d217b19f8890Nathan Harold
147a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public String getRemoteAddress() {
148a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mRemoteAddress;
149330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
150330e1089da80cddcd68758512370d217b19f8890Nathan Harold
15193962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    public IpSecAlgorithm getEncryption(int direction) {
152a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mFlow[direction].mEncryption;
153330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
154330e1089da80cddcd68758512370d217b19f8890Nathan Harold
15593962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    public IpSecAlgorithm getAuthentication(int direction) {
156a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mFlow[direction].mAuthentication;
157330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
158330e1089da80cddcd68758512370d217b19f8890Nathan Harold
15993962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    public Network getNetwork() {
160a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mNetwork;
161330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
162330e1089da80cddcd68758512370d217b19f8890Nathan Harold
163330e1089da80cddcd68758512370d217b19f8890Nathan Harold    public int getEncapType() {
164a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mEncapType;
165330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
166330e1089da80cddcd68758512370d217b19f8890Nathan Harold
167a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public int getEncapSocketResourceId() {
168a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mEncapSocketResourceId;
169330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
170330e1089da80cddcd68758512370d217b19f8890Nathan Harold
171330e1089da80cddcd68758512370d217b19f8890Nathan Harold    public int getEncapRemotePort() {
172a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mEncapRemotePort;
173330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
174330e1089da80cddcd68758512370d217b19f8890Nathan Harold
17593962f34ce21f5aac825afbcebf2f3e8c7a30910Nathan Harold    public int getNattKeepaliveInterval() {
176a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        return mNattKeepaliveInterval;
177330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
178330e1089da80cddcd68758512370d217b19f8890Nathan Harold
179330e1089da80cddcd68758512370d217b19f8890Nathan Harold    // Parcelable Methods
180330e1089da80cddcd68758512370d217b19f8890Nathan Harold
181330e1089da80cddcd68758512370d217b19f8890Nathan Harold    @Override
182330e1089da80cddcd68758512370d217b19f8890Nathan Harold    public int describeContents() {
183330e1089da80cddcd68758512370d217b19f8890Nathan Harold        return 0;
184330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
185330e1089da80cddcd68758512370d217b19f8890Nathan Harold
186330e1089da80cddcd68758512370d217b19f8890Nathan Harold    @Override
187330e1089da80cddcd68758512370d217b19f8890Nathan Harold    public void writeToParcel(Parcel out, int flags) {
188a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeInt(mMode);
189a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeString(mLocalAddress);
190a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeString(mRemoteAddress);
191a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeParcelable(mNetwork, flags);
192a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeInt(mFlow[IpSecTransform.DIRECTION_IN].mSpiResourceId);
193a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeParcelable(mFlow[IpSecTransform.DIRECTION_IN].mEncryption, flags);
194a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeParcelable(mFlow[IpSecTransform.DIRECTION_IN].mAuthentication, flags);
195a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeInt(mFlow[IpSecTransform.DIRECTION_OUT].mSpiResourceId);
196a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeParcelable(mFlow[IpSecTransform.DIRECTION_OUT].mEncryption, flags);
197a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeParcelable(mFlow[IpSecTransform.DIRECTION_OUT].mAuthentication, flags);
198a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeInt(mEncapType);
199a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeInt(mEncapSocketResourceId);
200a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        out.writeInt(mEncapRemotePort);
201330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
202330e1089da80cddcd68758512370d217b19f8890Nathan Harold
203a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    @VisibleForTesting
204a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold    public IpSecConfig() {}
205a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold
206330e1089da80cddcd68758512370d217b19f8890Nathan Harold    private IpSecConfig(Parcel in) {
207a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mMode = in.readInt();
208a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mLocalAddress = in.readString();
209a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mRemoteAddress = in.readString();
210a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mNetwork = (Network) in.readParcelable(Network.class.getClassLoader());
211a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[IpSecTransform.DIRECTION_IN].mSpiResourceId = in.readInt();
212a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[IpSecTransform.DIRECTION_IN].mEncryption =
213330e1089da80cddcd68758512370d217b19f8890Nathan Harold                (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader());
214a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[IpSecTransform.DIRECTION_IN].mAuthentication =
215330e1089da80cddcd68758512370d217b19f8890Nathan Harold                (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader());
216a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[IpSecTransform.DIRECTION_OUT].mSpiResourceId = in.readInt();
217a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[IpSecTransform.DIRECTION_OUT].mEncryption =
218330e1089da80cddcd68758512370d217b19f8890Nathan Harold                (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader());
219a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mFlow[IpSecTransform.DIRECTION_OUT].mAuthentication =
220330e1089da80cddcd68758512370d217b19f8890Nathan Harold                (IpSecAlgorithm) in.readParcelable(IpSecAlgorithm.class.getClassLoader());
221a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mEncapType = in.readInt();
222a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mEncapSocketResourceId = in.readInt();
223a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold        mEncapRemotePort = in.readInt();
224330e1089da80cddcd68758512370d217b19f8890Nathan Harold    }
225330e1089da80cddcd68758512370d217b19f8890Nathan Harold
226b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi    @Override
227b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi    public String toString() {
228b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi        StringBuilder strBuilder = new StringBuilder();
229b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi        strBuilder
230a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append("{mMode=")
231a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mMode == IpSecTransform.MODE_TUNNEL ? "TUNNEL" : "TRANSPORT")
232a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mLocalAddress=")
233a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mLocalAddress)
234a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mRemoteAddress=")
235a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mRemoteAddress)
236a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mNetwork=")
237a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mNetwork)
238a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mEncapType=")
239a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mEncapType)
240a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mEncapSocketResourceId=")
241a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mEncapSocketResourceId)
242a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mEncapRemotePort=")
243a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mEncapRemotePort)
244a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mNattKeepaliveInterval=")
245a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mNattKeepaliveInterval)
246a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mFlow[OUT]=")
247a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mFlow[IpSecTransform.DIRECTION_OUT])
248a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(", mFlow[IN]=")
249a10003d5de52339f4d30fedd7294941378e5f13cNathan Harold                .append(mFlow[IpSecTransform.DIRECTION_IN])
250b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi                .append("}");
251b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi
252b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi        return strBuilder.toString();
253b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi    }
254b0c95b19ab4384bfc7141abfe3840736d52b4a44ludi
255330e1089da80cddcd68758512370d217b19f8890Nathan Harold    public static final Parcelable.Creator<IpSecConfig> CREATOR =
256330e1089da80cddcd68758512370d217b19f8890Nathan Harold            new Parcelable.Creator<IpSecConfig>() {
257330e1089da80cddcd68758512370d217b19f8890Nathan Harold                public IpSecConfig createFromParcel(Parcel in) {
258330e1089da80cddcd68758512370d217b19f8890Nathan Harold                    return new IpSecConfig(in);
259330e1089da80cddcd68758512370d217b19f8890Nathan Harold                }
260330e1089da80cddcd68758512370d217b19f8890Nathan Harold
261330e1089da80cddcd68758512370d217b19f8890Nathan Harold                public IpSecConfig[] newArray(int size) {
262330e1089da80cddcd68758512370d217b19f8890Nathan Harold                    return new IpSecConfig[size];
263330e1089da80cddcd68758512370d217b19f8890Nathan Harold                }
264330e1089da80cddcd68758512370d217b19f8890Nathan Harold            };
265330e1089da80cddcd68758512370d217b19f8890Nathan Harold}
266