Home | History | Annotate | Download | only in vpn
      1 /*
      2  * Copyright (C) 2009, 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.vpn;
     18 
     19 import android.os.Parcel;
     20 
     21 /**
     22  * The profile for L2TP type of VPN.
     23  * {@hide}
     24  */
     25 public class L2tpProfile extends VpnProfile {
     26     private static final long serialVersionUID = 1L;
     27 
     28     private boolean mSecret;
     29     private String mSecretString;
     30 
     31     @Override
     32     public VpnType getType() {
     33         return VpnType.L2TP;
     34     }
     35 
     36     /**
     37      * Enables/disables the secret for authenticating tunnel connection.
     38      */
     39     public void setSecretEnabled(boolean enabled) {
     40         mSecret = enabled;
     41     }
     42 
     43     public boolean isSecretEnabled() {
     44         return mSecret;
     45     }
     46 
     47     public void setSecretString(String secret) {
     48         mSecretString = secret;
     49     }
     50 
     51     public String getSecretString() {
     52         return mSecretString;
     53     }
     54 
     55     @Override
     56     protected void readFromParcel(Parcel in) {
     57         super.readFromParcel(in);
     58         mSecret = in.readInt() > 0;
     59         mSecretString = in.readString();
     60     }
     61 
     62     @Override
     63     public void writeToParcel(Parcel parcel, int flags) {
     64         super.writeToParcel(parcel, flags);
     65         parcel.writeInt(mSecret ? 1 : 0);
     66         parcel.writeString(mSecretString);
     67     }
     68 }
     69