2 * Network Configuration - VPN Service Internal Module
4 * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #ifndef __NETCONFIG_VPN_SERVICE_INTERNAL_H__
22 #define __NETCONFIG_VPN_SERVICE_INTERNAL_H__
24 #include <vpn_service.h>
26 #define VPNSVC_VPN_IFACE_NAME_LEN 16
27 #define VPNSVC_SESSION_STRING_LEN 32
29 typedef struct _vpnsvc_tun_s {
30 GDBusConnection *connection; /**< D-Bus Connection */
31 int fd; /**< tun socket fd */
32 int index; /**< tun index (if.iface_index) */
33 char name[VPNSVC_VPN_IFACE_NAME_LEN]; /**< tun name (if.iface_name) */
34 char session[VPNSVC_SESSION_STRING_LEN];/**< session name (user setting) */
35 unsigned int mtu; /**< mtu (user setting) */
38 int vpn_service_init(const char* iface_name, size_t iface_name_len, int fd, vpnsvc_tun_s *handle_s);
39 int vpn_service_deinit(const char* dev_name);
40 int vpn_service_protect(int socket, const char* dev_name);
41 int vpn_service_up(const char *iface_name);
42 int vpn_service_down(const char *iface_name);
43 int vpn_service_block_networks(char* nets_vpn[], int prefix_vpn[], size_t nr_nets_vpn,
44 char* nets_orig[], int prefix_orig[], size_t nr_nets_orig);
45 int vpn_service_unblock_networks(void);
46 int vpn_service_update_settings(int iface_index, const char *local_ip,
47 const char *remote_ip, const unsigned int mtu);
48 int vpn_service_add_route(char *iface_name, const char *route, int prefix);
49 int vpn_service_remove_route(char *iface_name, const char *route, int prefix);
50 int vpn_service_add_dns_server(char *iface_name, const char *dns_server);
52 #endif /* __NETCONFIG_VPN_SERVICE_INTERNAL_H__ */