From bfb86b66c8e7d9d8dc45d9075a4db6d10931dccf Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Tue, 7 Feb 2017 20:45:14 +0100 Subject: ipcpd: Refactor ipcpi struct The ipcp-ops header was removed and merged into ipcp.h. The common components dif_name and ipcp_type have been moved to the main ipcp struct. After this move, ipcp_data only contained shim information, so it was renamed to shim_data. The ipcp_init() function checks the type and will only include the shim_data if the type is not an IPCP_NORMAL. All ipcps have been adapted to this change in API. --- src/ipcpd/ipcp.h | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'src/ipcpd/ipcp.h') diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 8b590cc2..9a4d272a 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -23,9 +23,9 @@ #define IPCPD_IPCP_H #include +#include -#include "ipcp-ops.h" -#include "ipcp-data.h" +#include "shim-data.h" #include #include @@ -37,16 +37,42 @@ enum ipcp_state { IPCP_SHUTDOWN }; +struct ipcp_ops { + int (* ipcp_bootstrap)(struct dif_config * conf); + + int (* ipcp_enroll)(char * dif_name); + + int (* ipcp_name_reg)(char * name); + + int (* ipcp_name_unreg)(char * name); + + int (* ipcp_name_query)(char * name); + + int (* ipcp_flow_alloc)(int fd, + char * dst_ap_name, + char * src_ae_name, + qoscube_t qos); + + int (* ipcp_flow_alloc_resp)(int fd, + int response); + + int (* ipcp_flow_dealloc)(int fd); +}; + struct ipcp { int irmd_api; char * name; + enum ipcp_type type; + char * dif_name; + uint64_t address; - struct ipcp_data * data; struct ipcp_ops * ops; int irmd_fd; + struct shim_data * shim_data; + enum ipcp_state state; pthread_rwlock_t state_lock; pthread_mutex_t state_mtx; @@ -57,7 +83,7 @@ struct ipcp { pthread_t * threadpool; } ipcpi; -int ipcp_init(enum ipcp_type type, +int ipcp_init(enum ipcp_type type, struct ipcp_ops * ops); int ipcp_boot(void); @@ -73,7 +99,7 @@ enum ipcp_state ipcp_get_state(void); int ipcp_wait_state(enum ipcp_state state, const struct timespec * timeout); -int ipcp_parse_arg(int argc, +int ipcp_parse_arg(int argc, char * argv[]); #endif -- cgit v1.2.3