diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-20 13:02:50 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | de403deed73340f8068739dc240ebebfa1053872 (patch) | |
| tree | 75876f2021a05d454125ee1e6cf5d926ae19b86d /wrappers/python/eduvpn_common/loader.py | |
| parent | 7e7472c30e09eed15424494547729c1f93bc924e (diff) | |
Wrappers Python: Implement V2 initial API
Diffstat (limited to 'wrappers/python/eduvpn_common/loader.py')
| -rw-r--r-- | wrappers/python/eduvpn_common/loader.py | 102 |
1 files changed, 18 insertions, 84 deletions
diff --git a/wrappers/python/eduvpn_common/loader.py b/wrappers/python/eduvpn_common/loader.py index 673d180..c5709fb 100644 --- a/wrappers/python/eduvpn_common/loader.py +++ b/wrappers/python/eduvpn_common/loader.py @@ -4,13 +4,7 @@ from collections import defaultdict from ctypes import CDLL, c_char_p, c_int, c_void_p, cdll from eduvpn_common import __version__ -from eduvpn_common.types import ( - cToken, - DataError, - ReadRxBytes, - UpdateToken, - VPNStateChange, -) +from eduvpn_common.types import DataError, ReadRxBytes, VPNStateChange def load_lib() -> CDLL: @@ -63,111 +57,51 @@ def initialize_functions(lib: CDLL) -> None: # Exposed functions # We have to use c_void_p instead of c_char_p to free it properly # See https://stackoverflow.com/questions/13445568/python-ctypes-how-to-free-memory-getting-invalid-pointer-error - lib.CancelOAuth.argtypes, lib.CancelOAuth.restype = [c_char_p], c_void_p - lib.ChangeSecureLocation.argtypes, lib.ChangeSecureLocation.restype = [ - c_char_p - ], c_void_p - lib.Deregister.argtypes, lib.Deregister.restype = [c_char_p], None - lib.FreeConfig.argtypes, lib.FreeConfig.restype = [c_void_p], None - lib.FreeTokens.argtypes, lib.FreeTokens.restype = [c_void_p], None - lib.FreeDiscoOrganizations.argtypes, lib.FreeDiscoOrganizations.restype = [ - c_void_p - ], None - lib.FreeDiscoServers.argtypes, lib.FreeDiscoServers.restype = [c_void_p], None - lib.FreeError.argtypes, lib.FreeError.restype = [c_void_p], None - lib.FreeProfiles.argtypes, lib.FreeProfiles.restype = [c_void_p], None - lib.FreeSecureLocations.argtypes, lib.FreeSecureLocations.restype = [c_void_p], None - lib.FreeServer.argtypes, lib.FreeServer.restype = [c_void_p], None - lib.FreeServers.argtypes, lib.FreeServers.restype = [c_void_p], None + lib.CancelOAuth.argtypes, lib.CancelOAuth.restype = [], c_void_p + lib.Deregister.argtypes, lib.Deregister.restype = [], None + lib.ExpiryTimes.argtypes, lib.ExpiryTimes.restype = [], DataError lib.FreeString.argtypes, lib.FreeString.restype = [c_void_p], None - lib.GetConfigCustomServer.argtypes, lib.GetConfigCustomServer.restype = [ + lib.DiscoOrganizations.argtypes, lib.DiscoOrganizations.restype = [], DataError + lib.DiscoServers.argtypes, lib.DiscoServers.restype = [], DataError + lib.GetConfig.argtypes, lib.GetConfig.restype = [ c_char_p, c_char_p, c_int, - cToken, + c_char_p, ], DataError - lib.GetConfigInstituteAccess.argtypes, lib.GetConfigInstituteAccess.restype = [ + lib.AddServer.argtypes, lib.AddServer.restype = [ c_char_p, c_char_p, - c_int, - cToken, - ], DataError - lib.GetConfigSecureInternet.argtypes, lib.GetConfigSecureInternet.restype = [ + ], c_char_p + lib.CurrentServer.argtypes, lib.CurrentServer.restype = [], DataError + lib.RemoveServer.argtypes, lib.RemoveServer.restype = [ c_char_p, c_char_p, - c_int, - cToken, - ], DataError - lib.GetDiscoOrganizations.argtypes, lib.GetDiscoOrganizations.restype = [ - c_char_p - ], DataError - lib.GetDiscoServers.argtypes, lib.GetDiscoServers.restype = [c_char_p], DataError - lib.GetCurrentServer.argtypes, lib.GetCurrentServer.restype = [c_char_p], DataError - lib.GetSavedServers.argtypes, lib.GetSavedServers.restype = [c_char_p], DataError - lib.GoBack.argtypes, lib.GoBack.restype = [c_char_p], None - lib.InFSMState.argtypes, lib.InFSMState.restype = [c_void_p, c_int], int + ], c_char_p + lib.ServerList.argtypes, lib.ServerList.restype = [], DataError lib.Register.argtypes, lib.Register.restype = [ c_char_p, c_char_p, c_char_p, - c_char_p, VPNStateChange, c_int, ], c_void_p - lib.SetTokenUpdater.argtypes, lib.SetTokenUpdater.restype = [ - c_char_p, - UpdateToken, - ], c_void_p - lib.RemoveCustomServer.argtypes, lib.RemoveCustomServer.restype = [ - c_char_p, - c_char_p, - ], c_void_p - lib.AddInstituteAccess.argtypes, lib.AddInstituteAccess.restype = [ - c_char_p, - c_char_p, - ], c_void_p - ( - lib.AddSecureInternetHomeServer.argtypes, - lib.AddSecureInternetHomeServer.restype, - ) = [ - c_char_p, - c_char_p, - ], c_void_p - lib.AddCustomServer.argtypes, lib.AddCustomServer.restype = [ - c_char_p, - c_char_p, - ], c_void_p - lib.RemoveInstituteAccess.argtypes, lib.RemoveInstituteAccess.restype = [ - c_char_p, - c_char_p, - ], c_void_p - lib.RemoveSecureInternet.argtypes, lib.RemoveSecureInternet.restype = [ - c_char_p - ], c_void_p - lib.RenewSession.argtypes, lib.RenewSession.restype = [c_char_p], c_void_p - lib.SetConnected.argtypes, lib.SetConnected.restype = [c_char_p], c_void_p - lib.SetConnecting.argtypes, lib.SetConnecting.restype = [c_char_p], c_void_p + lib.RenewSession.argtypes, lib.RenewSession.restype = [], c_void_p lib.Cleanup.argtypes, lib.Cleanup.restype = [ c_char_p, - cToken, ], c_void_p - lib.SetDisconnected.argtypes, lib.SetDisconnected.restype = [c_char_p], c_void_p - lib.SetDisconnecting.argtypes, lib.SetDisconnecting.restype = [c_char_p], c_void_p - lib.SetProfileID.argtypes, lib.SetProfileID.restype = [c_char_p, c_char_p], c_void_p - lib.SetSearchServer.argtypes, lib.SetSearchServer.restype = [c_char_p], c_void_p + lib.SetProfileID.argtypes, lib.SetProfileID.restype = [c_char_p], c_void_p lib.SetSecureLocation.argtypes, lib.SetSecureLocation.restype = [ c_char_p, - c_char_p, ], c_void_p + lib.SecureLocationList.argtypes, lib.SecureLocationList.restype = [], DataError lib.SetSupportWireguard.argtypes, lib.SetSupportWireguard.restype = [ - c_char_p, c_int, ], c_void_p lib.ShouldRenewButton.argtypes, lib.ShouldRenewButton.restype = [], int lib.StartFailover.argtypes, lib.StartFailover.restype = [ c_char_p, - c_char_p, c_int, ReadRxBytes, ], DataError - lib.CancelFailover.argtypes, lib.CancelFailover.restype = [c_char_p], c_void_p + lib.CancelFailover.argtypes, lib.CancelFailover.restype = [], c_void_p |
