diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-06-24 14:00:39 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-06-24 14:30:05 +0200 |
commit | 8b775e99eaddda50d2cfb61e1fb301d0c883abe9 (patch) | |
tree | 5575ccbb89335b56a6c88c7862fe51d84d7fb650 /src/libcharon/plugins/android/android_service.c | |
parent | 94ec9adc1088825ff59ef0be772740c1a97d2e0c (diff) | |
download | strongswan-8b775e99eaddda50d2cfb61e1fb301d0c883abe9.tar.bz2 strongswan-8b775e99eaddda50d2cfb61e1fb301d0c883abe9.tar.xz |
Implement the listener_t interface in the Android plugin to track the status of an SA.
Diffstat (limited to 'src/libcharon/plugins/android/android_service.c')
-rw-r--r-- | src/libcharon/plugins/android/android_service.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/libcharon/plugins/android/android_service.c b/src/libcharon/plugins/android/android_service.c index 6afcc4c3f..4214d538b 100644 --- a/src/libcharon/plugins/android/android_service.c +++ b/src/libcharon/plugins/android/android_service.c @@ -36,9 +36,9 @@ struct private_android_service_t { android_service_t public; /** - * listener to track progress + * current IKE_SA */ - listener_t listener; + ike_sa_t *ike_sa; /** * job that handles requests from the Android control socket @@ -80,6 +80,36 @@ static void send_status(private_android_service_t *this, u_char code) send(this->control, &code, 1, 0); } +METHOD(listener_t, ike_updown, bool, + private_android_service_t *this, ike_sa_t *ike_sa, bool up) +{ + return TRUE; +} + +METHOD(listener_t, child_state_change, bool, + private_android_service_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa, + child_sa_state_t state) +{ + return TRUE; +} + +METHOD(listener_t, child_updown, bool, + private_android_service_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa, + bool up) +{ + return TRUE; +} + +METHOD(listener_t, ike_rekey, bool, + private_android_service_t *this, ike_sa_t *old, ike_sa_t *new) +{ + if (this->ike_sa == old) + { + this->ike_sa = new; + } + return TRUE; +} + /** * Read a string argument from the Android control socket */ @@ -245,6 +275,7 @@ static job_requeue_t initiate(private_android_service_t *this) METHOD(android_service_t, destroy, void, private_android_service_t *this) { + charon->bus->remove_listener(charon->bus, &this->public.listener); close(this->control); free(this); } @@ -258,6 +289,12 @@ android_service_t *android_service_create(android_creds_t *creds) INIT(this, .public = { + .listener = { + .ike_updown = _ike_updown, + .child_state_change = _child_state_change, + .child_updown = _child_updown, + .ike_rekey = _ike_rekey, + }, .destroy = _destroy, }, .creds = creds, @@ -280,6 +317,7 @@ android_service_t *android_service_create(android_creds_t *creds) return NULL; } + charon->bus->add_listener(charon->bus, &this->public.listener); this->job = callback_job_create((callback_job_cb_t)initiate, this, NULL, NULL); charon->processor->queue_job(charon->processor, (job_t*)this->job); |