Tizen Native API
9.0
|
The Virtual Private Network (VPN) API provides functions for managing VPN.
Required Header
#include <vpn_service.h>
Overview
The VPN Service functions for managing VPN. There can be only one VPN connection running at the same time. The existing interface is deactivated when a new one is created. Using the VPN Service, you can implement features that allow the users of your application to:
- Initialize / Deinitialize the VPN device
- Routing management
- DNS management
- Firewall management To enable or disable VPN interface, you should launch VPN popup by using app-control.
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.vpn
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | vpnsvc_init (const char *iface_name, vpnsvc_h *handle) |
Initializes VPN interface. | |
int | vpnsvc_deinit (vpnsvc_h handle) |
De-Initializes VPN interface. | |
int | vpnsvc_protect (vpnsvc_h handle, int socket_fd, const char *iface_name) |
Protect a socket from VPN connections. | |
int | vpnsvc_read (vpnsvc_h handle, int timeout_ms) |
Waits for the read event on VPN interface descriptor, but no more than the indicated timeout in milliseconds. | |
int | vpnsvc_write (vpnsvc_h handle, const char *data, size_t size) |
Writes the data supplied into the VPN interface. | |
int | vpnsvc_block_networks (vpnsvc_h handle, char *routes_dest_vpn_addr[], int routes_vpn_prefix[], size_t num_allow_routes_vpn, char *routes_dest_orig_addr[], int routes_orig_prefix[], size_t num_allow_routes_orig) |
Blocks all traffics except specified allowing networks. | |
int | vpnsvc_unblock_networks (vpnsvc_h handle) |
Removes any restrictions imposed by vpnsvc_block_networks(). | |
int | vpnsvc_update_settings (vpnsvc_h handle) |
Updates the VPN interface settings including Local IP, Remote IP, and MTU values. | |
int | vpnsvc_get_iface_fd (vpnsvc_h handle, int *iface_fd) |
Gets the fd of the VPN interface. | |
int | vpnsvc_get_iface_index (vpnsvc_h handle, int *iface_index) |
Gets the index of VPN interface. | |
int | vpnsvc_get_iface_name (vpnsvc_h handle, char **iface_name) |
Gets the name of VPN interface. | |
int | vpnsvc_set_mtu (vpnsvc_h handle, int mtu) |
Sets the Maximum Transmission Unit (MTU) of the VPN interface. | |
int | vpnsvc_set_blocking (vpnsvc_h handle, bool blocking) |
Sets blocking mode of the file descriptor of VPN interface. | |
int | vpnsvc_set_session (vpnsvc_h handle, const char *session) |
Sets the session name for the VPN. (It will be displayed in system-managed dialogs and notifications.) | |
int | vpnsvc_get_session (vpnsvc_h handle, char **session) |
Gets the session name for the VPN. | |
int | vpnsvc_set_local_ip_address (vpnsvc_h handle, const char *local_ip) |
Sets the VPN client IP address. | |
int | vpnsvc_set_remote_ip_address (vpnsvc_h handle, const char *remote_ip) |
Sets the VPN server IP address. | |
int | vpnsvc_add_route (vpnsvc_h handle, const char *route_address, int prefix) |
Adds the route address. | |
int | vpnsvc_remove_route (vpnsvc_h handle, const char *route_address, int prefix) |
Removes the route address. | |
int | vpnsvc_add_dns_server (vpnsvc_h handle, const char *dns_server) |
Adds the DNS server name. | |
int | vpnsvc_remove_dns_server (vpnsvc_h handle, const char *dns_server) |
Removes the DNS server name. | |
Typedefs | |
typedef void * | vpnsvc_h |
The VPN interface handle. |
Typedef Documentation
typedef void* vpnsvc_h |
The VPN interface handle.
This handle can be obtained by calling vpnsvc_init() and destroyed by calling vpnsvc_deinit().
- Since :
- 3.0
- See also:
- vpnsvc_init()
- vpnsvc_deinit()
Enumeration Type Documentation
enum vpnsvc_error_e |
Enumeration for VPN service error types.
Indicate formats of error type field
- Enumerator:
Function Documentation
int vpnsvc_add_dns_server | ( | vpnsvc_h | handle, |
const char * | dns_server | ||
) |
Adds the DNS server name.
This function allows you to add a new DNS server address to the VPN interface by providing the appropriate dns_server. Upon successful execution, the specified DNS server address will be registered, enabling efficient domain name resolution via the VPN interface.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
- Remarks:
- The dns address should be set after enabling VPN interface.
- Parameters:
-
[in] handle The VPN interface handle [in] dns_server The DNS server address (IPv4 only)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_add_route | ( | vpnsvc_h | handle, |
const char * | route_address, | ||
int | prefix | ||
) |
Adds the route address.
This function allows you to add a new route address to the VPN interface by providing the appropriate route_address prefix. Upon successful execution, the specified route address will be added to the routing table, facilitating network communication via the VPN interface.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
- Remarks:
- The route address should be set after enabling VPN interface.
- Parameters:
-
[in] handle The VPN interface handle [in] route_address Destination address of the routes (IPv4 only) [in] prefix The prefix of routes, netmask length (also called a prefix, e.g. 8, 16, 24, 32)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
- vpnsvc_remove_route()
int vpnsvc_block_networks | ( | vpnsvc_h | handle, |
char * | routes_dest_vpn_addr[], | ||
int | routes_vpn_prefix[], | ||
size_t | num_allow_routes_vpn, | ||
char * | routes_dest_orig_addr[], | ||
int | routes_orig_prefix[], | ||
size_t | num_allow_routes_orig | ||
) |
Blocks all traffics except specified allowing networks.
This function enables you to restrict network access by blocking all traffic except for the specified allowing networks. You can define the destination addresses of the routes for both the VPN interface and the original interface, along with their respective prefix lengths. By setting num_allow_routes_vpn num_allow_routes_orig, you can specify up to 255 allowing networks for each interface. Once applied, this function ensures that only the defined allowing networks are accessible while all other traffic remains blocked.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The VPN interface handle [in] routes_dest_vpn_addr Destination address of the routes, the list of allowing networks over VPN interface (e.g., VPN interface such as tun0, etc). [in] routes_vpn_prefix The prefix of VPN interface, netmask length (also called a prefix, e.g. 8, 16, 24, 32). [in] num_allow_routes_vpn The number of allowing networks over VPN interface. Up to 255 addresses can be allowed. [in] routes_dest_orig_addr Destination address of the routes, the list of allowing networks over the original interface (e.g., original interface such as eth0, wlan0, etc). [in] routes_orig_prefix The prefix of Original interface, netmask length (also called a prefix, e.g. 8, 16, 24, 32). [in] num_allow_routes_orig The number of allowing networks over the original interface. Up to 255addresses can be allowed.
- Returns:
- 0 on success. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IPC_FAILED Cannot connect to service daemon VPNSVC_ERROR_PERMISSION_DENIED Permission Denied VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Postcondition:
- Please call vpnsvc_unblock_networks() if you want to allow all traffics.
- See also:
- vpnsvc_unblock_networks()
int vpnsvc_deinit | ( | vpnsvc_h | handle | ) |
De-Initializes VPN interface.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The VPN interface handle
- Returns:
- 0 on success. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IPC_FAILED Cannot connect to service daemon VPNSVC_ERROR_PERMISSION_DENIED Permission Denied VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_get_iface_fd | ( | vpnsvc_h | handle, |
int * | iface_fd | ||
) |
Gets the fd of the VPN interface.
- Since :
- 3.0
- Parameters:
-
[in] handle The VPN interface handle [out] iface_fd The vpn interface fd
- Returns:
- The fd value of VPN interface. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_NOT_SUPPORTED Not Supported
int vpnsvc_get_iface_index | ( | vpnsvc_h | handle, |
int * | iface_index | ||
) |
Gets the index of VPN interface.
- Since :
- 3.0
- Parameters:
-
[in] handle The VPN interface handle [out] iface_index The VPN interface index
- Returns:
- The index of the VPN interface. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_get_iface_name | ( | vpnsvc_h | handle, |
char ** | iface_name | ||
) |
Gets the name of VPN interface.
- Since :
- 3.0
- Remarks:
- The iface_name should be released using free()
- Parameters:
-
[in] handle The VPN interface handle [out] iface_name The name of VPN interface name
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_get_session | ( | vpnsvc_h | handle, |
char ** | session | ||
) |
Gets the session name for the VPN.
- Since :
- 3.0
- Remarks:
- The session should be released using free()
- Parameters:
-
[in] handle The VPN interface handle [out] session The Session Name returned
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_init | ( | const char * | iface_name, |
vpnsvc_h * | handle | ||
) |
Initializes VPN interface.
You should call vpnsvc_get_iface_name() for checking the actual initialized VPN interface name. (In case of duplicated interface name)
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
http://tizen.org/privilege/internet
- Remarks:
- The handle should be released using vpnsvc_deinit().
- Parameters:
-
[in] iface_name The VPN interface name [out] handle The VPN interface handle
- Returns:
- 0 on success. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_IPC_FAILED Cannot connect to service daemon VPNSVC_ERROR_PERMISSION_DENIED Permission Denied VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Postcondition:
- Please call vpnsvc_deinit() if you want to de-initialize VPN interface.
- Please call vpnsvc_get_iface_fd() if you want to know the fd(file descriptor) of VPN interface.
- Please call vpnsvc_get_iface_index() if you want to know the index of VPN interface.
- Please call vpnsvc_get_iface_name() if you want to know the name of VPN interface.
int vpnsvc_protect | ( | vpnsvc_h | handle, |
int | socket_fd, | ||
const char * | iface_name | ||
) |
Protect a socket from VPN connections.
This function allows you to bypass the VPN tunnel and send data directly to the underlying network using the specified socket. It can be useful when you need to access local resources or services that are not available through the VPN connection.
- Remarks:
- socket_fd should refer to an already open socket file descriptor.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The VPN interface handle [in] socket_fd The opened socket file descriptor [in] iface_name The network interface name (e.g., interface name such as eth0, ppp0, etc) through which the VPN is working
- Returns:
- 0 on success. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_IPC_FAILED Cannot connect to service daemon VPNSVC_ERROR_PERMISSION_DENIED Permission Denied VPNSVC_ERROR_NOT_SUPPORTED Not Supported
int vpnsvc_read | ( | vpnsvc_h | handle, |
int | timeout_ms | ||
) |
Waits for the read event on VPN interface descriptor, but no more than the indicated timeout in milliseconds.
This function can block until there is data available for reading from the VPN interface, or the timeout expires. It's important to set a reasonable timeout value to avoid unnecessary delays in your application's response time.
- Since :
- 3.0
- Parameters:
-
[in] handle The VPN interface handle [in] timeout_ms The value of timeout (milliseconds)
- Returns:
- 0 on success. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_TIMEOUT Timeout (no answer in timeout_ms) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_remove_dns_server | ( | vpnsvc_h | handle, |
const char * | dns_server | ||
) |
Removes the DNS server name.
This function enables you to delete a specific DNS server address from the VPN interface by passing dns_server. Upon successful execution, the specified DNS server address will be deregistered, modifying the domain name resolution process accordingly.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
- Parameters:
-
[in] handle The VPN interface handle [in] dns_server The DNS server address (IPv4 only)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_remove_route | ( | vpnsvc_h | handle, |
const char * | route_address, | ||
int | prefix | ||
) |
Removes the route address.
This function enables you to delete a specific route address from the VPN interface by passing route_address and prefix arguments. Upon successful execution, the specified route address will be removed from the routing table, altering the network communication paths accordingly.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
- Parameters:
-
[in] handle The VPN interface handle [in] route_address Destination address of the routes (IPv4 only) [in] prefix The prefix of routes, netmask length (also called a prefix, e.g. 8, 16, 24, 32)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
- vpnsvc_add_route()
int vpnsvc_set_blocking | ( | vpnsvc_h | handle, |
bool | blocking | ||
) |
Sets blocking mode of the file descriptor of VPN interface.
This function allows you to control the blocking behavior of the VPN interface's file descriptor. By setting the blocking to true
, the file descriptor will operate in blocking mode, meaning that system calls such as read or write will block until they complete successfully. Alternatively, setting blocking to false
will enable non-blocking mode, where system calls will return immediately regardless of their completion status.
- Since :
- 3.0
- Parameters:
-
[in] handle The VPN interface handle [in] blocking The blocking mode flag; True = BLOCKING, False = NON_BLOCKING (Default : BLOCKING)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR Failed to set the blocking flags VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_set_local_ip_address | ( | vpnsvc_h | handle, |
const char * | local_ip | ||
) |
Sets the VPN client IP address.
This function allows you to configure the VPN client IP address by providing the appropriate local_ip. Remember to call vpnsvc_update_settings() after setting the local IP address in order for the change to take effect.
- Since :
- 3.0
- Remarks:
- The local address should be set before enabling VPN interface.
vpnsvc_update_settings() should be invoked after setting local IP address.
- Parameters:
-
[in] handle The VPN interface handle [in] local_ip The local (VPN client) IP address (IPv4 only)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
- vpnsvc_update_settings()
int vpnsvc_set_mtu | ( | vpnsvc_h | handle, |
int | mtu | ||
) |
Sets the Maximum Transmission Unit (MTU) of the VPN interface.
This function allows you to adjust the maximum transmission unit (MTU) value for the VPN interface. By providing the appropriate mtu, you can customize the size of packets that can be transmitted over the VPN link. It's crucial to ensure that the VPN interface has been initialized correctly before invoking this function, as mentioned in the precondition. Moreover, remember to call the vpnsvc_update_settings() after modifying the MTU value in order for the change to take effect.
- Since :
- 3.0
- Remarks:
- vpnsvc_update_settings() should be invoked after setting MTU.
- Parameters:
-
[in] handle The VPN interface handle [in] mtu The MTU (Maximum Transmission Unit) value to be set for VPN interface. Default MTU size is 1500.
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
- vpnsvc_update_settings()
int vpnsvc_set_remote_ip_address | ( | vpnsvc_h | handle, |
const char * | remote_ip | ||
) |
Sets the VPN server IP address.
This function allows you to configure the VPN server IP address by providing the appropriate remote_ip. Remember to call vpnsvc_update_settings() after setting the remote IP address in order for the change to take effect.
- Since :
- 3.0
- Remarks:
- The remote address should be set before enabling VPN interface.
vpnsvc_update_settings() should be invoked after setting remote IP address.
- Parameters:
-
[in] handle The VPN interface handle [in] remote_ip The remote (VPN server) IP address (IPv4 only)
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IO_ERROR I/O Error (e.g. socket I/O error) VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()
- vpnsvc_update_settings()
int vpnsvc_set_session | ( | vpnsvc_h | handle, |
const char * | session | ||
) |
Sets the session name for the VPN. (It will be displayed in system-managed dialogs and notifications.)
- Since :
- 3.0
- Parameters:
-
[in] handle The VPN interface handle [in] session The Session Name
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- Before calling this function, VPN interface should be initialized already.
- See also:
- vpnsvc_init()
int vpnsvc_unblock_networks | ( | vpnsvc_h | handle | ) |
Removes any restrictions imposed by vpnsvc_block_networks().
This function serves as the counterpart to vpnsvc_block_networks(), enabling you to remove any previously applied restrictions on network access. By calling this function with the appropriate VPN interface handle, you can effectively lift the limitations imposed by the previous blocking rules and restore full network connectivity.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The VPN interface handle
- Returns:
- 0 on success. otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IPC_FAILED Cannot connect to service daemon VPNSVC_ERROR_PERMISSION_DENIED Permission Denied VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- See also:
- vpnsvc_block_networks()
int vpnsvc_update_settings | ( | vpnsvc_h | handle | ) |
Updates the VPN interface settings including Local IP, Remote IP, and MTU values.
This function allows you to modify various settings related to the VPN interface, such as the local IP address, remote IP address, and MTU value. By providing the appropriate arguments, you can update these configurations accordingly.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/vpnservice
- Parameters:
-
[in] handle The VPN interface handle
- Returns:
- 0 on success. Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_IPC_FAILED Cannot connect to service daemon VPNSVC_ERROR_PERMISSION_DENIED Permission Denied VPNSVC_ERROR_NOT_SUPPORTED Not Supported
- Precondition:
- The VPN interface should be initialized already.
int vpnsvc_write | ( | vpnsvc_h | handle, |
const char * | data, | ||
size_t | size | ||
) |
Writes the data supplied into the VPN interface.
This function allows you to transfer data to the VPN interface by passing data containing the desired information and its corresponding size.
- Since :
- 3.0
- Parameters:
-
[in] handle The VPN interface handle [in] data Data writing to VPN interface [in] size The size of data
- Returns:
- On success, the number of bytes written is returned (zero indicates nothing was written). Otherwise, a negative error value.
- Return values:
-
VPNSVC_ERROR_NONE Success VPNSVC_ERROR_INVALID_PARAMETER Invalid parameter VPNSVC_ERROR_NOT_SUPPORTED Not Supported In case of negative error, please refer to standard posix write API's error code.
- Precondition:
- The VPN interface should be initialized already.
- See also:
- vpnsvc_init()