nexus: Flesh out VPN support a bit more, cleanup service handling
Signed-off-by: San Mehat <san@google.com>
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 @@
}
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;
+}