summaryrefslogtreecommitdiff
path: root/src/lib/irm.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-06-13 13:48:17 +0200
committerdimitri staessens <[email protected]>2016-06-13 13:48:17 +0200
commit7834e92b218da69cd934679dec9c2d714d89d15e (patch)
treee2174dd2810a20e90050481e2fd54ce61e414baf /src/lib/irm.c
parentddfc7091d2698d36c1cfec49eaaad96b278bb37b (diff)
downloadouroboros-7834e92b218da69cd934679dec9c2d714d89d15e.tar.gz
ouroboros-7834e92b218da69cd934679dec9c2d714d89d15e.zip
lib, irmd, tools, ipcpd: updates to dev API.
The registration function has been moved to the irm tool, applications now need to be registered by an administrator. Currently only supports one instance per registered name, and an AP can be registered under only one name. The irmd can now start a registered server application on demand. For the full functionality of the tool, execute "irm register". AP name removed from flow allocation. Flow allocation does not send the source ap name as it is quite useless. The accept() call now only returns the AE name.
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)