diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-06-14 14:56:55 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-06-14 14:56:55 +0200 |
commit | 337ab9fe73b86306b72b9eaae3b7be759f7bbd36 (patch) | |
tree | d7b237631ef17df911ec4aef766aba085a63bd30 /src/lib/irm.c | |
parent | 6019a5b1ee574c8cea485ce5ba68ff77a24b4786 (diff) | |
parent | 6271d09bdd17114c3095b7e819a7bcded14f26a5 (diff) | |
download | ouroboros-337ab9fe73b86306b72b9eaae3b7be759f7bbd36.tar.gz ouroboros-337ab9fe73b86306b72b9eaae3b7be759f7bbd36.zip |
Merge remote-tracking branch 'upstream/be' into be-llc
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c index 6bd16576..ff5c3237 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -202,27 +202,39 @@ int irm_enroll_ipcp(instance_name_t * api, return ret; } -int irm_reg_ipcp(instance_name_t * api, - char ** difs, - size_t difs_size) +int irm_reg(char * name, + instance_name_t * api, + int argc, + char ** argv, + bool autoexec, + char ** difs, + size_t difs_len) { irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; int ret = -1; - if (api->name == NULL || - difs == NULL || - difs_size == 0 || - difs[0] == NULL) { + if (name == NULL || api->name == NULL) return -EINVAL; - } - msg.code = IRM_MSG_CODE__IRM_REG_IPCP; + msg.code = IRM_MSG_CODE__IRM_AP_REG; + msg.dst_name = name; msg.ap_name = api->name; - msg.has_api_id = true; - msg.api_id = api->id; - msg.dif_name = difs; - msg.n_dif_name = difs_size; + if (difs != NULL) { + msg.dif_name = difs; + msg.n_dif_name = difs_len; + } + + if (argv != NULL) { + msg.n_args = argc; + msg.args = argv; + } else { + msg.has_api_id = true; + msg.api_id = api->id; + } + + msg.has_autoexec = true; + msg.autoexec = autoexec; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -239,28 +251,36 @@ int irm_reg_ipcp(instance_name_t * api, return ret; } -int irm_unreg_ipcp(const instance_name_t * api, - char ** difs, - size_t difs_size) +int irm_unreg(char * name, + const instance_name_t * api, + char ** difs, + size_t difs_len, + bool hard) { irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; int ret = -1; - if (api == NULL || - api->name == NULL || - difs == NULL || - difs_size == 0 || - difs[0] == NULL) { + if (name == NULL && api == NULL) + return -EINVAL; + + if (difs == NULL || + difs_len == 0 || + difs[0] == NULL) return -EINVAL; + + msg.code = IRM_MSG_CODE__IRM_AP_UNREG; + if (api != NULL) { + msg.ap_name = api->name; + msg.has_api_id = true; + msg.api_id = api->id; } - msg.code = IRM_MSG_CODE__IRM_UNREG_IPCP; - msg.ap_name = api->name; - msg.has_api_id = true; - msg.api_id = api->id; msg.dif_name = difs; - msg.n_dif_name = difs_size; + msg.n_dif_name = difs_len; + if (name != NULL) + msg.dst_name = name; + msg.hard = hard; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) |