diff options
Diffstat (limited to 'nexus/VpnController.cpp')
-rw-r--r-- | nexus/VpnController.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/nexus/VpnController.cpp b/nexus/VpnController.cpp index 17bfe41..cd24c19 100644 --- a/nexus/VpnController.cpp +++ b/nexus/VpnController.cpp @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include <string.h> #include <errno.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + #include "VpnController.h" VpnController::VpnController() : @@ -21,21 +27,34 @@ VpnController::VpnController() : } int VpnController::start() { - errno = -ENOSYS; + errno = ENOSYS; return -1; } int VpnController::stop() { - errno = -ENOSYS; + errno = ENOSYS; return -1; } int VpnController::enable() { - errno = -ENOSYS; + errno = ENOSYS; return -1; } int VpnController::disable() { - errno = -ENOSYS; + errno = ENOSYS; return -1; } + +int VpnController::setVpnGateway(const char *vpnGw) { + if (!inet_aton(vpnGw, &mVpnGateway)) { + errno = EINVAL; + return -1; + } + return 0; +} + +int VpnController::setVpnGateway(struct in_addr *vpnGw) { + memcpy(&mVpnGateway, vpnGw, sizeof(struct in_addr)); + return 0; +} |