[PATCH 1/2] vpn: Add provider struct to error code function

Patrik Flykt patrik.flykt at linux.intel.com
Wed Sep 25 03:37:31 PDT 2013


A VPN plugin can now modify for example authentication information
when the daemon exits.
---
 vpn/plugins/openconnect.c |    2 +-
 vpn/plugins/vpn.c         |    3 ++-
 vpn/plugins/vpn.h         |    2 +-
 vpn/plugins/vpnc.c        |    2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/vpn/plugins/openconnect.c b/vpn/plugins/openconnect.c
index 2b732ae..9bccef2 100644
--- a/vpn/plugins/openconnect.c
+++ b/vpn/plugins/openconnect.c
@@ -547,7 +547,7 @@ static int oc_save(struct vpn_provider *provider, GKeyFile *keyfile)
 	return 0;
 }
 
-static int oc_error_code(int exit_code)
+static int oc_error_code(struct vpn_provider *provider, int exit_code)
 {
 
 	switch (exit_code) {
diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
index 2fdb483..16c302e 100644
--- a/vpn/plugins/vpn.c
+++ b/vpn/plugins/vpn.c
@@ -154,7 +154,8 @@ vpn_exit:
 
 		if (vpn_data &&
 				vpn_data->vpn_driver->error_code)
-			ret = vpn_data->vpn_driver->error_code(exit_code);
+			ret = vpn_data->vpn_driver->error_code(provider,
+					exit_code);
 		else
 			ret = VPN_PROVIDER_ERROR_UNKNOWN;
 
diff --git a/vpn/plugins/vpn.h b/vpn/plugins/vpn.h
index 0dd2470..3d2b66c 100644
--- a/vpn/plugins/vpn.h
+++ b/vpn/plugins/vpn.h
@@ -48,7 +48,7 @@ struct vpn_driver {
 			vpn_provider_connect_cb_t cb, const char *dbus_sender,
 			void *user_data);
 	void (*disconnect) (struct vpn_provider *provider);
-	int (*error_code) (int exit_code);
+	int (*error_code) (struct vpn_provider *provider, int exit_code);
 	int (*save) (struct vpn_provider *provider, GKeyFile *keyfile);
 };
 
diff --git a/vpn/plugins/vpnc.c b/vpn/plugins/vpnc.c
index 4c41efe..8713ea4 100644
--- a/vpn/plugins/vpnc.c
+++ b/vpn/plugins/vpnc.c
@@ -317,7 +317,7 @@ done:
 	return err;
 }
 
-static int vc_error_code(int exit_code)
+static int vc_error_code(struct vpn_provider *provider, int exit_code)
 {
 	switch (exit_code) {
 	case 1:
-- 
1.7.10.4




More information about the connman mailing list