San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | */ |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 16 | |
| 17 | #include <string.h> |
San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 18 | #include <errno.h> |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 19 | #include <sys/socket.h> |
| 20 | #include <netinet/in.h> |
| 21 | #include <arpa/inet.h> |
| 22 | |
San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 23 | #include "VpnController.h" |
| 24 | |
| 25 | VpnController::VpnController() : |
| 26 | Controller("VPN") { |
| 27 | } |
| 28 | |
| 29 | int VpnController::start() { |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 30 | errno = ENOSYS; |
San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 31 | return -1; |
| 32 | } |
| 33 | |
| 34 | int VpnController::stop() { |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 35 | errno = ENOSYS; |
San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 36 | return -1; |
| 37 | } |
| 38 | |
| 39 | int VpnController::enable() { |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 40 | errno = ENOSYS; |
San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 41 | return -1; |
| 42 | } |
| 43 | |
| 44 | int VpnController::disable() { |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 45 | errno = ENOSYS; |
San Mehat | dc26607 | 2009-05-06 11:16:52 -0700 | [diff] [blame] | 46 | return -1; |
| 47 | } |
San Mehat | 5d6d417 | 2009-05-14 15:00:06 -0700 | [diff] [blame^] | 48 | |
| 49 | int VpnController::setVpnGateway(const char *vpnGw) { |
| 50 | if (!inet_aton(vpnGw, &mVpnGateway)) { |
| 51 | errno = EINVAL; |
| 52 | return -1; |
| 53 | } |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | int VpnController::setVpnGateway(struct in_addr *vpnGw) { |
| 58 | memcpy(&mVpnGateway, vpnGw, sizeof(struct in_addr)); |
| 59 | return 0; |
| 60 | } |