diff options
Diffstat (limited to 'wrappers/python/eduvpncommon')
| -rw-r--r-- | wrappers/python/eduvpncommon/__init__.py | 1 | ||||
| -rw-r--r-- | wrappers/python/eduvpncommon/main.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/wrappers/python/eduvpncommon/__init__.py b/wrappers/python/eduvpncommon/__init__.py index 056ce18..50af8eb 100644 --- a/wrappers/python/eduvpncommon/__init__.py +++ b/wrappers/python/eduvpncommon/__init__.py @@ -38,6 +38,7 @@ lib.Deregister.argtypes, lib.Deregister.restype = [], None lib.Register.argtypes, lib.Register.restype = [c_char_p, c_char_p, VPNStateChange, c_int], c_void_p lib.GetOrganizationsList.argtypes, lib.GetOrganizationsList.restype = [], DataError lib.GetServersList.argtypes, lib.GetServersList.restype = [], DataError +lib.SendData.argtypes, lib.SendData.restype = [c_char_p], None # 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.FreeString.argtypes, lib.FreeString.restype = [c_void_p], None diff --git a/wrappers/python/eduvpncommon/main.py b/wrappers/python/eduvpncommon/main.py index 53b9831..8d2de9c 100644 --- a/wrappers/python/eduvpncommon/main.py +++ b/wrappers/python/eduvpncommon/main.py @@ -47,6 +47,10 @@ def register_callback(eduvpn): ) +def SendData(data): + lib.SendData(data.encode("utf-8")) + + class EduVPN(object): def __init__(self, name, config_directory): self.event_handler = EventHandler() @@ -75,6 +79,9 @@ class EduVPN(object): def callback(self, old_state, new_state, data): self.event.run(old_state, new_state, data) + def send_data(self, data): + return SendData(data) + class EventHandler(object): def __init__(self): |
