diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-03-30 15:36:19 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-03-30 15:36:19 +0200 |
commit | 231f60c51c1346069ab82ab17eb392e039620270 (patch) | |
tree | b4dea779cd0b2de5b6ffd760704700dbb665cdf6 /src/lib/irm.c | |
parent | dd20c175f10c04bf5abd0ca764ededaa7a4ac621 (diff) | |
parent | a3f002d6f2d102588f988c99eb16c64a68706dd2 (diff) | |
download | ouroboros-231f60c51c1346069ab82ab17eb392e039620270.tar.gz ouroboros-231f60c51c1346069ab82ab17eb392e039620270.zip |
Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into be-flow
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c index 92d8b3a5..644e1113 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -26,22 +26,22 @@ #include <ouroboros/common.h> #include <ouroboros/logs.h> #include <ouroboros/sockets.h> +#include <ouroboros/instance_name.h> #include <stdlib.h> -int irm_create_ipcp(char * ap_name, - int api_id, - char * ipcp_type) +int irm_create_ipcp(instance_name_t * api, + char * ipcp_type) { irm_msg_t msg = IRM_MSG__INIT; - if (ipcp_type == NULL || ap_name == NULL) + if (api == NULL || ipcp_type == NULL || api->name == NULL) return -EINVAL; msg.code = IRM_MSG_CODE__IRM_CREATE_IPCP; - msg.ap_name = ap_name; + msg.ap_name = api->name; msg.has_api_id = true; - msg.api_id = api_id; + msg.api_id = api->id; msg.ipcp_type = ipcp_type; if (send_irm_msg(&msg)) { @@ -52,19 +52,17 @@ int irm_create_ipcp(char * ap_name, return 0; } -int irm_destroy_ipcp(char * ap_name, - int api_id) +int irm_destroy_ipcp(instance_name_t * api) { irm_msg_t msg = IRM_MSG__INIT; - if (ap_name == NULL) { + if (api == NULL || api->name == NULL) return -EINVAL; - } msg.code = IRM_MSG_CODE__IRM_DESTROY_IPCP; - msg.ap_name = ap_name; + msg.ap_name = api->name; msg.has_api_id = true; - msg.api_id = api_id; + msg.api_id = api->id; if (send_irm_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); @@ -74,20 +72,18 @@ int irm_destroy_ipcp(char * ap_name, return 0; } -int irm_bootstrap_ipcp(char * ap_name, - int api_id, +int irm_bootstrap_ipcp(instance_name_t * api, struct dif_config * conf) { irm_msg_t msg = IRM_MSG__INIT; - if (ap_name == NULL || conf == NULL) { + if (api == NULL || api->name == NULL || conf == NULL) return -EINVAL; - } msg.code = IRM_MSG_CODE__IRM_BOOTSTRAP_IPCP; - msg.ap_name = ap_name; + msg.ap_name = api->name; msg.has_api_id = true; - msg.api_id = api_id; + msg.api_id = api->id; if (send_irm_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); @@ -97,20 +93,18 @@ int irm_bootstrap_ipcp(char * ap_name, return 0; } -int irm_enroll_ipcp(char * ap_name, - int api_id, - char * dif_name) +int irm_enroll_ipcp(instance_name_t * api, + char * dif_name) { irm_msg_t msg = IRM_MSG__INIT; - if (ap_name == NULL || dif_name == NULL) { + if (api == NULL || api->name == NULL || dif_name == NULL) return -EINVAL; - } msg.code = IRM_MSG_CODE__IRM_ENROLL_IPCP; - msg.ap_name = ap_name; + msg.ap_name = api->name; msg.has_api_id = true; - msg.api_id = api_id; + msg.api_id = api->id; msg.n_dif_name = 1; msg.dif_name = malloc(sizeof(*(msg.dif_name))); if (msg.dif_name == NULL) { @@ -130,14 +124,13 @@ int irm_enroll_ipcp(char * ap_name, return 0; } -int irm_reg_ipcp(char * ap_name, - int api_id, - char ** difs, - size_t difs_size) +int irm_reg_ipcp(instance_name_t * api, + char ** difs, + size_t difs_size) { irm_msg_t msg = IRM_MSG__INIT; - if (ap_name == NULL || + if (api->name == NULL || difs == NULL || difs_size == 0 || difs[0] == NULL) { @@ -145,9 +138,9 @@ int irm_reg_ipcp(char * ap_name, } msg.code = IRM_MSG_CODE__IRM_REG_IPCP; - msg.ap_name = ap_name; + msg.ap_name = api->name; msg.has_api_id = true; - msg.api_id = api_id; + msg.api_id = api->id; msg.dif_name = difs; msg.n_dif_name = difs_size; @@ -159,14 +152,14 @@ int irm_reg_ipcp(char * ap_name, return 0; } -int irm_unreg_ipcp(char * ap_name, - int api_id, - char ** difs, - size_t difs_size) +int irm_unreg_ipcp(const instance_name_t * api, + char ** difs, + size_t difs_size) { irm_msg_t msg = IRM_MSG__INIT; - if (ap_name == NULL || + if (api == NULL || + api->name == NULL || difs == NULL || difs_size == 0 || difs[0] == NULL) { @@ -174,9 +167,9 @@ int irm_unreg_ipcp(char * ap_name, } msg.code = IRM_MSG_CODE__IRM_UNREG_IPCP; - msg.ap_name = ap_name; + msg.ap_name = api->name; msg.has_api_id = true; - msg.api_id = api_id; + msg.api_id = api->id; msg.dif_name = difs; msg.n_dif_name = difs_size; |