summaryrefslogtreecommitdiff
path: root/src/ipcpd/local
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-06-28 16:11:19 +0200
committerSander Vrijders <[email protected]>2016-06-28 16:22:01 +0200
commit0d789ed8d938cc342c8f2138280795a1d5a61e3d (patch)
treeb0a3b305473a68ee18262e7f103185b9ce9cb98c /src/ipcpd/local
parentacd29da104d0d8ddace2b2693314542bb5a56fcc (diff)
downloadouroboros-0d789ed8d938cc342c8f2138280795a1d5a61e3d.tar.gz
ouroboros-0d789ed8d938cc342c8f2138280795a1d5a61e3d.zip
lib, irmd, ipcpd: Change of IRM API
This changes the IRM API after discussions with Dimitri. The register operation is now split into a bind and register operation. The same for unregister; unbind and unregister. PIDs are now used as the application instance name. A name for a PID is only provided for scriptability in bash. It is therefore also no longer passed down to the IPCP. Every operation on an IPCP through the IRM API has to use the PID. Quering of the PIDs by name is possible. The IRM tool has been updated to use this new API as well. A subcommand 'ipcp' has been added for operations that take effect on IPCPs only. Fixes #12
Diffstat (limited to 'src/ipcpd/local')
-rw-r--r--src/ipcpd/local/main.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 06e2b0a4..1f1cf839 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -28,7 +28,7 @@
#include <ouroboros/list.h>
#include <ouroboros/utils.h>
#include <ouroboros/ipcp.h>
-#include <ouroboros/dif_config.h>
+#include <ouroboros/irm_config.h>
#include <ouroboros/sockets.h>
#include <ouroboros/bitmap.h>
#include <ouroboros/common.h>
@@ -67,7 +67,7 @@ struct ipcp * _ipcp;
/* the shim needs access to these internals */
struct shim_ap_data {
- instance_name_t * api;
+ pid_t api;
struct shm_du_map * dum;
struct bmp * fds;
struct shm_ap_rbuff * rb;
@@ -82,7 +82,7 @@ struct shim_ap_data {
} * _ap_instance;
-static int shim_ap_init(char * ap_name)
+static int shim_ap_init()
{
int i;
@@ -91,30 +91,16 @@ static int shim_ap_init(char * ap_name)
return -1;
}
- _ap_instance->api = instance_name_create();
- if (_ap_instance->api == NULL) {
- free(_ap_instance);
- return -1;
- }
-
- if (instance_name_init_from(_ap_instance->api,
- ap_name,
- getpid()) == NULL) {
- instance_name_destroy(_ap_instance->api);
- free(_ap_instance);
- return -1;
- }
+ _ap_instance->api = getpid();
_ap_instance->fds = bmp_create(AP_MAX_FLOWS, 0);
if (_ap_instance->fds == NULL) {
- instance_name_destroy(_ap_instance->api);
free(_ap_instance);
return -1;
}
_ap_instance->dum = shm_du_map_open();
if (_ap_instance->dum == NULL) {
- instance_name_destroy(_ap_instance->api);
bmp_destroy(_ap_instance->fds);
free(_ap_instance);
return -1;
@@ -122,7 +108,6 @@ static int shim_ap_init(char * ap_name)
_ap_instance->rb = shm_ap_rbuff_create();
if (_ap_instance->rb == NULL) {
- instance_name_destroy(_ap_instance->api);
shm_du_map_close(_ap_instance->dum);
bmp_destroy(_ap_instance->fds);
free(_ap_instance);
@@ -153,8 +138,6 @@ void shim_ap_fini()
if (_ipcp->state != IPCP_SHUTDOWN)
LOG_WARN("Cleaning up AP while not in shutdown.");
- if (_ap_instance->api != NULL)
- instance_name_destroy(_ap_instance->api);
if (_ap_instance->fds != NULL)
bmp_destroy(_ap_instance->fds);
if (_ap_instance->dum != NULL)
@@ -592,8 +575,6 @@ static struct ipcp * ipcp_local_create()
int main (int argc, char * argv[])
{
- /* argument 1: pid of irmd ? */
- /* argument 2: ap name */
struct sigaction sig_act;
sigset_t sigset;
sigemptyset(&sigset);
@@ -607,7 +588,7 @@ int main (int argc, char * argv[])
exit(1);
}
- if (shim_ap_init(argv[2]) < 0)
+ if (shim_ap_init() < 0)
exit(1);
/* store the process id of the irmd */