Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63ddfd9e authored by Chia-chi Yeh's avatar Chia-chi Yeh
Browse files

VPN: remove the old VpnService.

Now VPN is (kind of) integrated into ConnectivityService.

Change-Id: If98e456e779f8e97f562d99c57d909b1f5d9db55
parent 4c868b23
Loading
Loading
Loading
Loading
+0 −50
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.vpn;

import android.net.vpn.VpnProfile;

/**
 * Interface to access a VPN service.
 * {@hide}
 */
interface IVpnService {
    /**
     * Sets up a VPN connection.
     * @param profile the profile object
     * @param username the username for authentication
     * @param password the corresponding password for authentication
     * @return true if VPN is successfully connected
     */
    boolean connect(in VpnProfile profile, String username, String password);

    /**
     * Tears down the VPN connection.
     */
    void disconnect();

    /**
     * Gets the the current connection state.
     */
    String getState(in VpnProfile profile);

    /**
     * Returns the idle state.
     * @return true if the system is not connecting/connected to a VPN
     */
    boolean isIdle();
}
+0 −65
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.vpn;

import android.os.Parcel;

/**
 * The profile for certificate-based L2TP-over-IPSec type of VPN.
 * {@hide}
 */
public class L2tpIpsecProfile extends L2tpProfile {
    private static final long serialVersionUID = 1L;

    private String mUserCertificate;
    private String mCaCertificate;

    @Override
    public VpnType getType() {
        return VpnType.L2TP_IPSEC;
    }

    public void setCaCertificate(String name) {
        mCaCertificate = name;
    }

    public String getCaCertificate() {
        return mCaCertificate;
    }

    public void setUserCertificate(String name) {
        mUserCertificate = name;
    }

    public String getUserCertificate() {
        return mUserCertificate;
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mCaCertificate = in.readString();
        mUserCertificate = in.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        super.writeToParcel(parcel, flags);
        parcel.writeString(mCaCertificate);
        parcel.writeString(mUserCertificate);
    }
}
+0 −54
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.vpn;

import android.os.Parcel;

/**
 * The profile for pre-shared-key-based L2TP-over-IPSec type of VPN.
 * {@hide}
 */
public class L2tpIpsecPskProfile extends L2tpProfile {
    private static final long serialVersionUID = 1L;

    private String mPresharedKey;

    @Override
    public VpnType getType() {
        return VpnType.L2TP_IPSEC_PSK;
    }

    public void setPresharedKey(String key) {
        mPresharedKey = key;
    }

    public String getPresharedKey() {
        return mPresharedKey;
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mPresharedKey = in.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        super.writeToParcel(parcel, flags);
        parcel.writeString(mPresharedKey);
    }
}
+0 −68
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.vpn;

import android.os.Parcel;

/**
 * The profile for L2TP type of VPN.
 * {@hide}
 */
public class L2tpProfile extends VpnProfile {
    private static final long serialVersionUID = 1L;

    private boolean mSecret;
    private String mSecretString;

    @Override
    public VpnType getType() {
        return VpnType.L2TP;
    }

    /**
     * Enables/disables the secret for authenticating tunnel connection.
     */
    public void setSecretEnabled(boolean enabled) {
        mSecret = enabled;
    }

    public boolean isSecretEnabled() {
        return mSecret;
    }

    public void setSecretString(String secret) {
        mSecretString = secret;
    }

    public String getSecretString() {
        return mSecretString;
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mSecret = in.readInt() > 0;
        mSecretString = in.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        super.writeToParcel(parcel, flags);
        parcel.writeInt(mSecret ? 1 : 0);
        parcel.writeString(mSecretString);
    }
}
+0 −56
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.vpn;

import android.os.Parcel;

/**
 * The profile for PPTP type of VPN.
 * {@hide}
 */
public class PptpProfile extends VpnProfile {
    private static final long serialVersionUID = 1L;
    private boolean mEncryption = true;

    @Override
    public VpnType getType() {
        return VpnType.PPTP;
    }

    /**
     * Enables/disables the encryption for PPTP tunnel.
     */
    public void setEncryptionEnabled(boolean enabled) {
        mEncryption = enabled;
    }

    public boolean isEncryptionEnabled() {
        return mEncryption;
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mEncryption = in.readInt() > 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        super.writeToParcel(parcel, flags);
        parcel.writeInt(mEncryption ? 1 : 0);
    }
}
Loading