| 750 | |
| 751 | |
| 752 | void cb_pause(GVariant *params) |
| 753 | { |
| 754 | // Pauses and suspends an on-going and connected VPN tunnel. |
| 755 | // The reason message provided with this call is sent to the |
| 756 | // log. |
| 757 | |
| 758 | if (!registered || !vpnclient) |
| 759 | { |
| 760 | throw ClientException("Pause", |
| 761 | "Backend service is not initialized"); |
| 762 | } |
| 763 | |
| 764 | if (paused) |
| 765 | { |
| 766 | throw ClientException("Pause", |
| 767 | "Connection is already paused"); |
| 768 | } |
| 769 | |
| 770 | glib2::Utils::checkParams(__func__, params, "(s)", 1); |
| 771 | std::string reason = filter_ctrl_chars( |
| 772 | glib2::Value::Extract<std::string>(params, 0), |
| 773 | true); |
| 774 | |
| 775 | signal->LogInfo("Pausing connection"); |
| 776 | signal->StatusChange(Events::Status(StatusMajor::CONNECTION, |
| 777 | StatusMinor::CONN_PAUSING, |
| 778 | "Reason: " + reason)); |
| 779 | vpnclient->pause(reason); |
| 780 | paused = true; |
| 781 | signal->StatusChange(Events::Status(StatusMajor::CONNECTION, |
| 782 | StatusMinor::CONN_PAUSED)); |
| 783 | } |
| 784 | |
| 785 | |
| 786 | void cb_resume() |
no test coverage detected