diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-04 15:29:11 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-04 15:29:11 +0200 |
| commit | 5dad968aa90ded83d57211426bc186f6d609ef06 (patch) | |
| tree | 1f072a2f5af07a64d88b85e04f0bc321d921c07a /exports | |
| parent | b950e027b3553ccc767f88be8e88a1b3acf1b383 (diff) | |
State: Rename to client to avoid confusion with the FSM
Diffstat (limited to 'exports')
| -rw-r--r-- | exports/disco.go | 8 | ||||
| -rw-r--r-- | exports/exports.go | 12 | ||||
| -rw-r--r-- | exports/servers.go | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/exports/disco.go b/exports/disco.go index ac7ac7d..3058334 100644 --- a/exports/disco.go +++ b/exports/disco.go @@ -47,7 +47,7 @@ import ( ) func getCPtrDiscoOrganization( - state *eduvpn.VPNState, + state *eduvpn.Client, organization *types.DiscoveryOrganization, ) *C.discoveryOrganization { returnedStruct := (*C.discoveryOrganization)( @@ -61,7 +61,7 @@ func getCPtrDiscoOrganization( } func getCPtrDiscoOrganizations( - state *eduvpn.VPNState, + state *eduvpn.Client, organizations *types.DiscoveryOrganizations, ) (C.size_t, **C.discoveryOrganization) { totalOrganizations := C.size_t(len(organizations.List)) @@ -82,7 +82,7 @@ func getCPtrDiscoOrganizations( } func getCPtrDiscoServer( - state *eduvpn.VPNState, + state *eduvpn.Client, server *types.DiscoveryServer, ) *C.discoveryServer { returnedStruct := (*C.discoveryServer)( @@ -104,7 +104,7 @@ func getCPtrDiscoServer( } func getCPtrDiscoServers( - state *eduvpn.VPNState, + state *eduvpn.Client, servers *types.DiscoveryServers, ) (C.size_t, **C.discoveryServer) { totalServers := C.size_t(len(servers.List)) diff --git a/exports/exports.go b/exports/exports.go index a5c008a..fdf3d94 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -22,10 +22,10 @@ import ( var P_StateCallbacks map[string]C.PythonCB -var VPNStates map[string]*eduvpn.VPNState +var VPNStates map[string]*eduvpn.Client func GetStateData( - state *eduvpn.VPNState, + state *eduvpn.Client, stateID eduvpn.FSMStateID, data interface{}, ) unsafe.Pointer { @@ -55,7 +55,7 @@ func GetStateData( } func StateCallback( - state *eduvpn.VPNState, + state *eduvpn.Client, name string, old_state eduvpn.FSMStateID, new_state eduvpn.FSMStateID, @@ -74,7 +74,7 @@ func StateCallback( // data_c gets freed by the wrapper } -func GetVPNState(name string) (*eduvpn.VPNState, error) { +func GetVPNState(name string) (*eduvpn.Client, error) { state, exists := VPNStates[name] if !exists || state == nil { @@ -94,10 +94,10 @@ func Register( nameStr := C.GoString(name) state, stateErr := GetVPNState(nameStr) if stateErr != nil { - state = &eduvpn.VPNState{} + state = &eduvpn.Client{} } if VPNStates == nil { - VPNStates = make(map[string]*eduvpn.VPNState) + VPNStates = make(map[string]*eduvpn.Client) } if P_StateCallbacks == nil { P_StateCallbacks = make(map[string]C.PythonCB) diff --git a/exports/servers.go b/exports/servers.go index a399db7..175c835 100644 --- a/exports/servers.go +++ b/exports/servers.go @@ -162,7 +162,7 @@ func freeCListStrings(allStrings **C.char, totalStrings C.size_t) { // Function for getting the server, // It gets the main state as a pointer as we need to convert some string maps to localized strings // It gets the base information for a server as well -func getCPtrServer(state *eduvpn.VPNState, base *eduvpn.VPNServerBase) *C.server { +func getCPtrServer(state *eduvpn.Client, base *eduvpn.ServerBase) *C.server { // Allocation using malloc and the size of the struct server := (*C.server)(C.malloc(C.size_t(unsafe.Sizeof(C.server{})))) // String allocation and translate the display name @@ -212,7 +212,7 @@ func FreeServer(info *C.server) { // Get the C ptr to the servers, returns the length in size_t and the double pointer to the struct func getCPtrServers( - state *eduvpn.VPNState, + state *eduvpn.Client, serverMap map[string]*server.InstituteAccessServer, ) (C.size_t, **C.server) { totalServers := C.size_t(len(serverMap)) @@ -263,7 +263,7 @@ func FreeServers(cServers *C.servers) { // Return the servers as a C struct pointer // It takes the state as a pointer as we need to translate some strings // It also takes the servers as a pointer that belongs to the main state or gathered from the callback -func getSavedServersWithOptions(state *eduvpn.VPNState, servers *server.Servers) *C.servers { +func getSavedServersWithOptions(state *eduvpn.Client, servers *server.Servers) *C.servers { // Allocate the struct that we will return // With the size of the c struct returnedStruct := (*C.servers)(C.malloc(C.size_t(unsafe.Sizeof(C.servers{})))) @@ -306,7 +306,7 @@ func GetSavedServers(name *C.char) (*C.servers, *C.error) { // This function takes the state as input which is the main state // It also takes the data as an interface and if it has the servers type gets the data as a c struct otherwise nil -func getTransitionDataServers(state *eduvpn.VPNState, data interface{}) *C.servers { +func getTransitionDataServers(state *eduvpn.Client, data interface{}) *C.servers { if converted, ok := data.(server.Servers); ok { return getSavedServersWithOptions(state, &converted) } @@ -335,7 +335,7 @@ func getTransitionProfiles(data interface{}) *C.serverProfiles { return nil } -func getTransitionServer(state *eduvpn.VPNState, data interface{}) *C.server { +func getTransitionServer(state *eduvpn.Client, data interface{}) *C.server { if server, ok := data.(server.Server); ok { base, baseErr := server.GetBase() if baseErr != nil { |
