summaryrefslogtreecommitdiff
path: root/src/lib/irm.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-03-29 23:32:04 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-03-30 00:00:20 +0200
commit2ed8914deed73a558c6fbac7f107f47dc22f22d2 (patch)
tree7343797577910a35fc90f707e1618054ae90b839 /src/lib/irm.c
parent1d4442e472d20f261986089ea468daa93631d1f4 (diff)
downloadouroboros-2ed8914deed73a558c6fbac7f107f47dc22f22d2.tar.gz
ouroboros-2ed8914deed73a558c6fbac7f107f47dc22f22d2.zip
lib: renamed rina_name_t to instance_name_t
all functions taking a char * ap_name and uint id now take either a instance_name_t or instance_name_t *
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r--src/lib/irm.c84
1 files changed, 46 insertions, 38 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 92d8b3a5..af899d0a 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -26,22 +26,25 @@
#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)
+ return -EINVAL;
+
+ if (ipcp_type == NULL || api == 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 +55,21 @@ 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)
+ return -EINVAL;
+
+ if (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 +79,21 @@ 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)
+ return -EINVAL;
+
+ if (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 +103,21 @@ 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)
+ return -EINVAL;
+
+ if (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 +137,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 +151,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 +165,16 @@ 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)
+ return -EINVAL;
+
+ if (api->name == NULL ||
difs == NULL ||
difs_size == 0 ||
difs[0] == NULL) {
@@ -174,9 +182,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;