aboutsummaryrefslogtreecommitdiffstats
path: root/src/frontends/osx
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-05-02 18:11:47 +0200
committerMartin Willi <martin@revosec.ch>2013-07-18 12:17:55 +0200
commit4edcc8614901b65c58844787362047fe2d33f0fb (patch)
treed5377e173e8ff08f482a5a44de0a11f0edbc815c /src/frontends/osx
parentd60c8d2c740d6cb02776974fa3cd1c0a3f8613cf (diff)
downloadstrongswan-4edcc8614901b65c58844787362047fe2d33f0fb.tar.bz2
strongswan-4edcc8614901b65c58844787362047fe2d33f0fb.tar.xz
xpc: send child_updown events over XPC channel
Diffstat (limited to 'src/frontends/osx')
-rw-r--r--src/frontends/osx/charon-xpc/xpc_channels.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/frontends/osx/charon-xpc/xpc_channels.c b/src/frontends/osx/charon-xpc/xpc_channels.c
index ce2c83bfb..1310b37f6 100644
--- a/src/frontends/osx/charon-xpc/xpc_channels.c
+++ b/src/frontends/osx/charon-xpc/xpc_channels.c
@@ -254,6 +254,48 @@ METHOD(listener_t, ike_rekey, bool,
return TRUE;
}
+METHOD(listener_t, child_updown, bool,
+ private_xpc_channels_t *this, ike_sa_t *ike_sa,
+ child_sa_t *child_sa, bool up)
+{
+ entry_t *entry;
+ uintptr_t sa;
+
+ sa = ike_sa->get_unique_id(ike_sa);
+ this->lock->read_lock(this->lock);
+ entry = this->channels->get(this->channels, (void*)sa);
+ if (entry)
+ {
+ xpc_object_t msg;
+ linked_list_t *list;
+ char buf[256];
+
+ msg = xpc_dictionary_create(NULL, NULL, 0);
+ xpc_dictionary_set_string(msg, "type", "event");
+ if (up)
+ {
+ xpc_dictionary_set_string(msg, "event", "child_up");
+ }
+ else
+ {
+ xpc_dictionary_set_string(msg, "event", "child_down");
+ }
+
+ list = child_sa->get_traffic_selectors(child_sa, TRUE);
+ snprintf(buf, sizeof(buf), "%#R", list);
+ xpc_dictionary_set_string(msg, "ts_local", buf);
+
+ list = child_sa->get_traffic_selectors(child_sa, FALSE);
+ snprintf(buf, sizeof(buf), "%#R", list);
+ xpc_dictionary_set_string(msg, "ts_remote", buf);
+
+ xpc_connection_send_message(entry->conn, msg);
+ xpc_release(msg);
+ }
+ this->lock->unlock(this->lock);
+ return TRUE;
+}
+
METHOD(listener_t, ike_updown, bool,
private_xpc_channels_t *this, ike_sa_t *ike_sa, bool up)
{
@@ -396,6 +438,7 @@ xpc_channels_t *xpc_channels_create()
.listener = {
.ike_updown = _ike_updown,
.ike_rekey = _ike_rekey,
+ .child_updown = _child_updown,
},
.add = _add,
.destroy = _destroy,