summaryrefslogtreecommitdiff
path: root/src/lib/irm.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-06-14 14:55:39 +0200
committerSander Vrijders <[email protected]>2016-06-14 14:55:39 +0200
commit6271d09bdd17114c3095b7e819a7bcded14f26a5 (patch)
treea1c2a7bd200eb0343557524ddc80b0af6df4ec9e /src/lib/irm.c
parentddfc7091d2698d36c1cfec49eaaad96b278bb37b (diff)
parent95124310f647913a678060fc10155a0ad9311dba (diff)
downloadouroboros-6271d09bdd17114c3095b7e819a7bcded14f26a5.tar.gz
ouroboros-6271d09bdd17114c3095b7e819a7bcded14f26a5.zip
Merged in dstaesse/ouroboros/be-api (pull request #122)
lib, irmd, tools, ipcpd: updates to dev API.
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r--src/lib/irm.c72
1 files changed, 46 insertions, 26 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c
index cff5a76a..7c87f034 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -199,27 +199,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)
@@ -236,28 +248,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)