diff options
author | Sander Vrijders <[email protected]> | 2016-07-27 16:46:23 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-07-27 16:46:23 +0200 |
commit | 0c0508619959b5ac98b31b4389fcfadf5ee26d9b (patch) | |
tree | 08b53089bd819a215412041282776fb225b31395 /src/lib/cdap.c | |
parent | bee74baa8fa8ffa71dbb659496bc88df3e8ce6a5 (diff) | |
download | ouroboros-0c0508619959b5ac98b31b4389fcfadf5ee26d9b.tar.gz ouroboros-0c0508619959b5ac98b31b4389fcfadf5ee26d9b.zip |
ipcpd: normal: Provide initial steps for enrollment
This provides the normal IPCP with bootstrapping and the initial steps
for enrollment. Next step is actually reacting to an enrollment
request and sending the data transfer constants.
Diffstat (limited to 'src/lib/cdap.c')
-rw-r--r-- | src/lib/cdap.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/lib/cdap.c b/src/lib/cdap.c index 4275bfc7..441f7e44 100644 --- a/src/lib/cdap.c +++ b/src/lib/cdap.c @@ -69,6 +69,28 @@ static ssize_t cdap_msg_to_buffer(cdap_t * msg, return len; } +static int next_invoke_id(struct cdap * instance) +{ + int ret; + + pthread_mutex_lock(&instance->ids_lock); + ret = bmp_allocate(instance->ids); + pthread_mutex_unlock(&instance->ids_lock); + + return ret; +} + +static int release_invoke_id(struct cdap * instance, + int id) +{ + int ret; + + pthread_mutex_lock(&instance->ids_lock); + ret = bmp_release(instance->ids, id); + pthread_mutex_unlock(&instance->ids_lock); + + return ret; +} static void * sdu_reader(void * o) { @@ -146,6 +168,7 @@ static void * sdu_reader(void * o) msg->result, val, length); + release_invoke_id(instance, msg->invoke_id); free(val); } break; @@ -225,29 +248,6 @@ int cdap_destroy(struct cdap * instance) return 0; } -static int next_invoke_id(struct cdap * instance) -{ - int ret; - - pthread_mutex_lock(&instance->ids_lock); - ret = bmp_allocate(instance->ids); - pthread_mutex_unlock(&instance->ids_lock); - - return ret; -} - -static int release_invoke_id(struct cdap * instance, - int id) -{ - int ret; - - pthread_mutex_lock(&instance->ids_lock); - ret = bmp_release(instance->ids, id); - pthread_mutex_unlock(&instance->ids_lock); - - return ret; -} - static int write_msg(struct cdap * instance, cdap_t * msg) { |