diff options
author | Sander Vrijders <[email protected]> | 2016-03-11 16:52:28 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-03-11 16:52:28 +0100 |
commit | f5cf4e478bf7dec70dc22d80de706f82ef4b38f1 (patch) | |
tree | 60160c5cac28eb8cfcd376428429e03cf2e7e203 /src/lib/irm.c | |
parent | d68e4e5e540720d9b02e2062e3982f1c438eb1e0 (diff) | |
download | ouroboros-f5cf4e478bf7dec70dc22d80de706f82ef4b38f1.tar.gz ouroboros-f5cf4e478bf7dec70dc22d80de706f82ef4b38f1.zip |
lib: Add helpers for RINA names
This adds helper functions for RINA names, to aid with handling them.
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c index 493cb71d..a1847eed 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -63,6 +63,11 @@ int irm_create_ipcp(rina_name_t name, if (ipcp_type == NULL) return -1; + if (!name_is_ok(&name)) { + LOG_ERR("Bad name"); + return -1; + } + msg.code = IRM_CREATE_IPCP; msg.name = &name; msg.ipcp_type = ipcp_type; @@ -79,6 +84,11 @@ int irm_destroy_ipcp(rina_name_t name) { struct irm_msg msg; + if (!name_is_ok(&name)) { + LOG_ERR("Bad name"); + return -1; + } + msg.code = IRM_DESTROY_IPCP; msg.name = &name; @@ -95,6 +105,11 @@ int irm_bootstrap_ipcp(rina_name_t name, { struct irm_msg msg; + if (!name_is_ok(&name)) { + LOG_ERR("Bad name"); + return -1; + } + msg.code = IRM_BOOTSTRAP_IPCP; msg.name = &name; msg.conf = &conf; @@ -112,6 +127,11 @@ int irm_enroll_ipcp(rina_name_t name, { struct irm_msg msg; + if (!name_is_ok(&name)) { + LOG_ERR("Bad name"); + return -1; + } + msg.code = IRM_ENROLL_IPCP; msg.name = &name; msg.dif_name = dif_name; @@ -130,6 +150,11 @@ int irm_reg_ipcp(rina_name_t name, { struct irm_msg msg; + if (!name_is_ok(&name)) { + LOG_ERR("Bad name"); + return -1; + } + msg.code = IRM_REG_IPCP; msg.name = &name; msg.difs = difs; @@ -149,6 +174,11 @@ int irm_unreg_ipcp(rina_name_t name, { struct irm_msg msg; + if (!name_is_ok(&name)) { + LOG_ERR("Bad name"); + return -1; + } + msg.code = IRM_UNREG_IPCP; msg.name = &name; msg.difs = difs; |