summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-10 17:50:45 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-10 19:10:38 +0200
commit11c6be30491ebe4e41380f48a271c57bcff4b043 (patch)
treea920a9b345e2760d0b425de6678f03c1a4669cc8 /src/lib/dev.c
parent26b20744a441705accbe550aa0b996f8601a9404 (diff)
downloadouroboros-11c6be30491ebe4e41380f48a271c57bcff4b043.tar.gz
ouroboros-11c6be30491ebe4e41380f48a271c57bcff4b043.zip
lib, irmd: Bind AP instances to AP_subsets
This call will allow grouping AP instances of a certain AP together which are configured identically. Adds the bind operation to dev and updates the applications to make use of this call. Flow_alloc is now only called with the pid and doesn't send the apn anymore.
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index cc332233..765c493e 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -134,6 +134,42 @@ void ap_fini(void)
free(_ap_instance);
}
+int api_bind(char * ap_subset)
+{
+ irm_msg_t msg = IRM_MSG__INIT;
+ irm_msg_t * recv_msg = NULL;
+ int ret = -1;
+
+ msg.code = IRM_MSG_CODE__IRM_API_BIND;
+ msg.has_api = true;
+
+ if (_ap_instance->ap_name == NULL)
+ return -EPERM; /* call init first */
+
+ pthread_rwlock_rdlock(&_ap_instance->data_lock);
+
+ msg.api = _ap_instance->api;
+ msg.ap_name = _ap_instance->ap_name;
+
+ pthread_rwlock_unlock(&_ap_instance->data_lock);
+
+ msg.ap_subset = ap_subset;
+
+ recv_msg = send_recv_irm_msg(&msg);
+ if (recv_msg == NULL) {
+ return -1;
+ }
+
+ if (!recv_msg->has_result || (ret = recv_msg->result)) {
+ irm_msg__free_unpacked(recv_msg, NULL);
+ return ret;
+ }
+
+ irm_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
+}
+
static int port_id_to_fd(int port_id)
{
int i;
@@ -154,7 +190,6 @@ int flow_accept(char ** ae_name)
pthread_rwlock_rdlock(&_ap_instance->data_lock);
- msg.ap_name = _ap_instance->ap_name;
msg.api = _ap_instance->api;
pthread_rwlock_unlock(&_ap_instance->data_lock);