summaryrefslogtreecommitdiff
path: root/src/irmd/ipcp.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-08 11:14:43 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-09 11:23:48 +0100
commit0a071a42d4e80f54e92f34911cafda3d666d35d5 (patch)
tree456cb6250d0396705bef29b0d80c889bee205fe7 /src/irmd/ipcp.c
parente56d24010287127fc6b9c9da8d1f7cf160c50253 (diff)
downloadouroboros-0a071a42d4e80f54e92f34911cafda3d666d35d5.tar.gz
ouroboros-0a071a42d4e80f54e92f34911cafda3d666d35d5.zip
ipcpd: Let IPCPs bind a name
This allows IPCPs to bind a name, so that they can announce their name to neighbors which can then allocate a flow to them. Registering of the name happens by an administrator. It also moves the irmd_api to common ground, since it is used by all IPCPs.
Diffstat (limited to 'src/irmd/ipcp.c')
-rw-r--r--src/irmd/ipcp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index 07ae0dc2..f16587e1 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* The API to instruct IPCPs
*
@@ -100,7 +100,7 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t api, ipcp_msg_t * msg)
return recv_msg;
}
-pid_t ipcp_create(enum ipcp_type ipcp_type)
+pid_t ipcp_create(char * name, enum ipcp_type ipcp_type)
{
pid_t api = -1;
char irmd_api[10];
@@ -109,7 +109,7 @@ pid_t ipcp_create(enum ipcp_type ipcp_type)
char * full_name = NULL;
char * exec_name = NULL;
char * log_file = NULL;
- char * argv[4];
+ char * argv[5];
sprintf(irmd_api, "%u", getpid());
@@ -119,9 +119,8 @@ pid_t ipcp_create(enum ipcp_type ipcp_type)
return api;
}
- if (api != 0) {
+ if (api != 0)
return api;
- }
if (ipcp_type == IPCP_NORMAL)
exec_name = IPCP_NORMAL_EXEC;
@@ -162,8 +161,9 @@ pid_t ipcp_create(enum ipcp_type ipcp_type)
/* log_file to be placed at the end */
argv[0] = full_name;
argv[1] = irmd_api;
- argv[2] = log_file;
- argv[3] = NULL;
+ argv[2] = name;
+ argv[3] = log_file;
+ argv[4] = NULL;
execv(argv[0], &argv[0]);