Skip to main content

VPN Status

The commands below are useful once VPN connection has been successfully established.

Get VPN Status

Requests current VPN connection status.

Login required: Yes

CmdProc Code: OVS_CMD_GET_STATUS

Command number: 5

Input: Not required

Response: OVS_NOTIFY_GET_STATUS

OVS_NOTIFY_GET_STATUS Successful response
    OVS_ERR_OK

{
"VPN_Status": 1
}

VPN_Status will contain one of the following values:

1.  VPN_NOTIFY_CONNECTING
2. VPN_NOTIFY_CONNECTED
3. VPN_NOTIFY_DISCONNECTED
4. VPN_NOTIFY_CONN_FAILED
5. VPN_NOTIFY_ABNORMALLY_DISCONNECTED
6. VPN_NOTIFY_AUTH
7. VPN_NOTIFY_ASSIGNIP
8. VPN_NOTIFY_GETCONFIG

Code sample:

macOS Code Sample
    void GetVPNStatus()
{
json_object *j_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_GET_STATUS));
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}

Get Active VPN Profile

Returns the active VPN connection parameters - server, protocol and port.

Login required: Yes

CmdProc Code: OVS_CMD_GET_CURRENT_PROFILE

Command number: 17

Input: Not required

Response: OVS_NOTIFY_GET_CURRENT_PROFILE

OVS_NOTIFY_GET_CURRENT_PROFILE Successful response
    OVS_ERR_OK

data will return

{
"server_ip": "104.192.3.90",
"protocol": "tcp",
"server_port": 1194
}

Code sample:

macOS Code Sample
    void GetCurrentProfile()
{
json_object *j_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_GET_CURRENT_PROFILE));
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}

Enable IO Counter

Enables of disables IO counter.

Login required: Yes

CmdProc Code: OVS_CMD_SET_IOCOUNT

Command number: 15

Input:

{
"status": true|false
}

Status indicates whether IO counter should be enabled or not.

Response: OVS_NOTIFY_SET_IOCOUNT

OVS_NOTIFY_SET_IOCOUNT Successful response
    OVS_NOTIFY_SET_IOCOUNT

data will contain:
{
"data_in": 0,
"speed_in": 0,
"data_out": 0,
"speed_out": 0
}

The fields returned are as follow:

data_in - Downloaded data amount
speed_in - Current download speed
data_out - Uploaded data amount
speed_out - Current upload speed

Code sample:

macOS Code Sample
    void SetIOCount(bool status)
{
json_object *j_obj, *j_data_obj;
char szCmd[1024];
j_obj = json_object_new_object();
json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_SET_IOCOUNT));
j_data_obj = json_object_new_object();
json_object_object_add(j_data_obj, "status", json_object_new_boolean(status));
json_object_object_add(j_obj, "data", j_data_obj);
snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
json_object_put(j_obj);
CmdProc(szCmd);
}