From fc10a7587b1a642748ae0fd69f08d92b4a902248 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 12 Apr 2017 16:57:48 +0200 Subject: lib, ipcpd, irmd: Register hash instead of name All information passed over the IRMd/IPCP boundary for using IPC services (flow allocation, registration) is now hashed. This effectively fixes the shared namespace between DIFs and the IRMDs. This PR also fixes some API issues (adding const identifiers), shuffles the include headers a bit and some small bugs. --- src/ipcpd/ipcp.h | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/ipcpd/ipcp.h') diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index e5c4b9af..d6e2aa7c 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -24,12 +24,13 @@ #define IPCPD_IPCP_H #include -#include +#include #include "shim-data.h" #include #include +#include enum ipcp_state { IPCP_NULL = 0, @@ -39,19 +40,19 @@ enum ipcp_state { }; struct ipcp_ops { - int (* ipcp_bootstrap)(struct dif_config * conf); + int (* ipcp_bootstrap)(const struct ipcp_config * conf); - int (* ipcp_enroll)(char * dif_name); + int (* ipcp_enroll)(const char * dst); - int (* ipcp_name_reg)(char * name); + int (* ipcp_reg)(const uint8_t * hash); - int (* ipcp_name_unreg)(char * name); + int (* ipcp_unreg)(const uint8_t * hash); - int (* ipcp_name_query)(char * name); + int (* ipcp_query)(const uint8_t * hash); - int (* ipcp_flow_alloc)(int fd, - char * dst_ap_name, - qoscube_t qos); + int (* ipcp_flow_alloc)(int fd, + const uint8_t * dst, + qoscube_t qos); int (* ipcp_flow_alloc_resp)(int fd, int response); @@ -59,6 +60,8 @@ struct ipcp_ops { int (* ipcp_flow_dealloc)(int fd); }; +#define DIR_HASH_STRLEN (ipcpi.dir_hash_len * 2) + struct ipcp { int irmd_api; char * name; @@ -67,6 +70,7 @@ struct ipcp { char * dif_name; uint64_t dt_addr; + uint16_t dir_hash_len; struct ipcp_ops * ops; int irmd_fd; @@ -117,4 +121,15 @@ int ipcp_wait_state(enum ipcp_state state, int ipcp_parse_arg(int argc, char * argv[]); +/* Handle shutdown of IPCP */ +void ipcp_sig_handler(int sig, + siginfo_t * info, + void * c); + +/* Helper functions for directory entries, could be moved */ +uint8_t * ipcp_hash_dup(const uint8_t * hash); + +void ipcp_hash_str(char buf[], + const uint8_t * hash); + #endif -- cgit v1.2.3