From 6ad0fcf2f32f412091d0dfd58da1d8f5dc474809 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 8 Apr 2016 16:32:35 +0200 Subject: lib, irmd, irm: Add dif_config This adds dif_config to the prototype, in which one is able to specify the parameters a DIF should have. The bootstrap operation of an IPCP takes this as parameter and is oblivious to whether it is a shim or a normal IPCP. The dif_config struct is also correctly serialized and deserialized and passed opaquely to the correct IPCP. This IPCP is in charge of deserializing it correctly. --- src/lib/ipcp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/lib/ipcp.c') diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c index d61fcb50..a0febe4e 100644 --- a/src/lib/ipcp.c +++ b/src/lib/ipcp.c @@ -100,7 +100,7 @@ static ipcp_msg_t * send_recv_ipcp_msg(pid_t pid, } pid_t ipcp_create(instance_name_t * api, - char * ipcp_type) + enum ipcp_type ipcp_type) { pid_t pid = 0; char * api_id = NULL; @@ -108,11 +108,6 @@ pid_t ipcp_create(instance_name_t * api, char * ipcp_dir = "bin/ipcpd"; char * full_name = NULL; - if (ipcp_type == NULL) - return -1; - - LOG_DBG("%lu", _POSIX_C_SOURCE); - pid = fork(); if (pid == -1) { LOG_ERR("Failed to fork"); @@ -146,7 +141,7 @@ pid_t ipcp_create(instance_name_t * api, char * argv[] = {full_name, api->name, api_id, - ipcp_type, 0}; + 0}; char * envp[] = {0}; @@ -241,14 +236,19 @@ int ipcp_unreg(pid_t pid, return ret; } + int ipcp_bootstrap(pid_t pid, - struct dif_config * conf) + dif_config_msg_t * conf) { ipcp_msg_t msg = IPCP_MSG__INIT; ipcp_msg_t * recv_msg = NULL; int ret = -1; + if (conf == NULL) + return -EINVAL; + msg.code = IPCP_MSG_CODE__IPCP_BOOTSTRAP; + msg.conf = conf; recv_msg = send_recv_ipcp_msg(pid, &msg); if (recv_msg == NULL) -- cgit v1.2.3