From 48599a14144725dedc45f7558d814950791d069d Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 24 Feb 2017 11:32:24 +0100 Subject: Revise CACEP API The information passed to CACEP is split between the information about the connection and the information to be used during the authentication exchange. --- include/ouroboros/cacep.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h index e0737c47..f155023e 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cacep.h @@ -32,7 +32,7 @@ enum proto_concrete_syntax { PROTO_FIXED }; -struct cacep_info { +struct conn_info{ struct { char * protocol; uint32_t pref_version; @@ -40,19 +40,20 @@ struct cacep_info { } proto; char * name; uint64_t addr; - void * data; }; -int cacep_info_init(struct cacep_info * info); +int conn_info_init(struct conn_info * info); -void cacep_info_fini(struct cacep_info * info); +void conn_info_fini(struct conn_info * info); -struct cacep_info * cacep_auth(int fd, - enum pol_cacep pc, - const struct cacep_info * info); +struct conn_info * cacep_auth(int fd, + enum pol_cacep pc, + const struct conn_info * info, + const void * auth); -struct cacep_info * cacep_auth_wait(int fd, - enum pol_cacep pc, - const struct cacep_info * info); +struct conn_info * cacep_auth_wait(int fd, + enum pol_cacep pc, + const struct conn_info * info, + const void * auth); #endif /* OUROBOROS_CACEP_H */ -- cgit v1.2.3 From cdab533860ba69423695e1d08acc25b074a0e065 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 24 Feb 2017 16:03:28 +0100 Subject: lib: Remove application entity name The AE name should not be passed over the layer boundaries. If an application has more than one AE it should exchange this in CACEP. --- include/ouroboros/dev.h | 8 +--- include/ouroboros/ipcp-dev.h | 1 - src/ipcpd/ipcp-ops.h | 51 ---------------------- src/ipcpd/ipcp.c | 1 - src/ipcpd/ipcp.h | 1 - src/ipcpd/local/main.c | 4 +- src/ipcpd/normal/cdap_flow.c | 5 +-- src/ipcpd/normal/cdap_flow.h | 1 - src/ipcpd/normal/enroll.c | 3 +- src/ipcpd/normal/flow_alloc.proto | 5 +-- src/ipcpd/normal/fmgr.c | 5 +-- src/ipcpd/normal/fmgr.h | 1 - src/ipcpd/normal/gam.c | 20 ++------- src/ipcpd/normal/gam.h | 3 +- src/ipcpd/normal/main.c | 9 ++-- src/ipcpd/normal/pol-gam-ops.h | 2 +- src/ipcpd/normal/ribmgr.c | 2 +- src/ipcpd/shim-eth-llc/main.c | 15 ++----- src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto | 9 ++-- src/ipcpd/shim-udp/main.c | 12 +---- src/irmd/ipcp.c | 4 +- src/irmd/ipcp.h | 1 - src/irmd/main.c | 17 ++------ src/irmd/registry.c | 1 - src/irmd/registry.h | 1 - src/lib/dev.c | 24 +--------- src/lib/ipcpd_messages.proto | 13 +++--- src/lib/irmd_messages.proto | 25 +++++------ src/tools/cbr/cbr_client.c | 2 +- src/tools/cbr/cbr_server.c | 2 +- src/tools/echo/echo_client.c | 2 +- src/tools/echo/echo_server.c | 2 +- src/tools/operf/operf_client.c | 2 +- src/tools/operf/operf_server.c | 2 +- src/tools/oping/oping_client.c | 2 +- src/tools/oping/oping_server.c | 2 +- 36 files changed, 61 insertions(+), 199 deletions(-) delete mode 100644 src/ipcpd/ipcp-ops.h (limited to 'include') diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h index 1d2a2533..c4d2cb16 100644 --- a/include/ouroboros/dev.h +++ b/include/ouroboros/dev.h @@ -27,16 +27,13 @@ #ifndef OUROBOROS_DEV_H #define OUROBOROS_DEV_H -#define UNKNOWN_AE "__UNKNOWN_AE__" - /* These calls should be removed once we write the ouroboros OS. */ int ap_init(const char * ap_name); void ap_fini(void); -/* Returns flow descriptor (> 0), client AE name and qos spec. */ -int flow_accept(char ** ae_name, - qosspec_t * spec); +/* Returns flow descriptor (> 0) and qos spec. */ +int flow_accept(qosspec_t * spec); int flow_alloc_resp(int fd, int response); @@ -46,7 +43,6 @@ int flow_alloc_resp(int fd, * On returning, spec will contain the actual supplied QoS. */ int flow_alloc(const char * dst_name, - const char * src_ae_name, qosspec_t * spec); int flow_alloc_res(int fd); diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 81aca1d7..fc82f374 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -31,7 +31,6 @@ int ipcp_create_r(pid_t api, int ipcp_flow_req_arr(pid_t api, char * dst_name, - char * src_ae_name, qoscube_t cube); int ipcp_flow_alloc_reply(int fd, diff --git a/src/ipcpd/ipcp-ops.h b/src/ipcpd/ipcp-ops.h deleted file mode 100644 index 6a42ec5c..00000000 --- a/src/ipcpd/ipcp-ops.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * IPC process ops - * - * Dimitri Staessens - * Sander Vrijders - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef IPCPD_IPCP_OPS_H -#define IPCPD_IPCP_OPS_H - -#include -#include - -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); -}; - -#endif /* IPCPD_IPCP_OPS_H */ diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 19b3a721..41b5bb48 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -191,7 +191,6 @@ static void * ipcp_main_loop(void * o) ret_msg.result = ipcpi.ops->ipcp_flow_alloc(fd, msg->dst_name, - msg->src_ae_name, msg->qoscube); break; case IPCP_MSG_CODE__IPCP_FLOW_ALLOC_RESP: diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index de7d72b0..d0b5e022 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -50,7 +50,6 @@ struct ipcp_ops { int (* ipcp_flow_alloc)(int fd, char * dst_ap_name, - char * src_ae_name, qoscube_t qos); int (* ipcp_flow_alloc_resp)(int fd, diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 8d770c94..2d995680 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -220,7 +220,6 @@ static int ipcp_local_name_query(char * name) static int ipcp_local_flow_alloc(int fd, char * dst_name, - char * src_ae_name, qoscube_t cube) { int out_fd = -1; @@ -228,7 +227,6 @@ static int ipcp_local_flow_alloc(int fd, log_dbg("Allocating flow to %s on fd %d.", dst_name, fd); assert(dst_name); - assert(src_ae_name); pthread_rwlock_rdlock(&ipcpi.state_lock); @@ -240,7 +238,7 @@ static int ipcp_local_flow_alloc(int fd, pthread_rwlock_wrlock(&local_data.lock); - out_fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube); + out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube); local_data.in_out[fd] = out_fd; local_data.in_out[out_fd] = fd; diff --git a/src/ipcpd/normal/cdap_flow.c b/src/ipcpd/normal/cdap_flow.c index 71ebcc03..3d1b2b22 100644 --- a/src/ipcpd/normal/cdap_flow.c +++ b/src/ipcpd/normal/cdap_flow.c @@ -87,7 +87,6 @@ struct cdap_flow * cdap_flow_arr(int fd, } struct cdap_flow * cdap_flow_alloc(const char * dst_name, - const char * ae_name, qosspec_t * qs, enum pol_cacep pc, const struct conn_info * info) @@ -97,12 +96,12 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name, log_dbg("Allocating flow to %s.", dst_name); - if (dst_name == NULL || ae_name == NULL) { + if (dst_name == NULL) { log_err("Not enough info to establish flow."); return NULL; } - fd = flow_alloc(dst_name, ae_name, qs); + fd = flow_alloc(dst_name, qs); if (fd < 0) { log_err("Failed to allocate flow to %s.", dst_name); return NULL; diff --git a/src/ipcpd/normal/cdap_flow.h b/src/ipcpd/normal/cdap_flow.h index 14a04f02..8aa26dc0 100644 --- a/src/ipcpd/normal/cdap_flow.h +++ b/src/ipcpd/normal/cdap_flow.h @@ -39,7 +39,6 @@ struct cdap_flow * cdap_flow_arr(int fd, const struct conn_info * info); struct cdap_flow * cdap_flow_alloc(const char * dst_name, - const char * ae_name, qosspec_t * qs, enum pol_cacep pc, const struct conn_info * info); diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index 78bc4d51..b420533e 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -181,8 +181,7 @@ int enroll_boot(char * dst_name) info.proto.pref_version = 1; info.proto.pref_syntax = PROTO_GPB; - flow = cdap_flow_alloc(dst_name, ENROLL_AE, NULL, ANONYMOUS_AUTH, - &info); + flow = cdap_flow_alloc(dst_name, NULL, ANONYMOUS_AUTH, &info); if (flow == NULL) { log_err("Failed to allocate flow for enrollment request."); conn_info_fini(&info); diff --git a/src/ipcpd/normal/flow_alloc.proto b/src/ipcpd/normal/flow_alloc.proto index 16e8be2c..3b08f047 100644 --- a/src/ipcpd/normal/flow_alloc.proto +++ b/src/ipcpd/normal/flow_alloc.proto @@ -31,7 +31,6 @@ enum flow_alloc_code { message flow_alloc_msg { required flow_alloc_code code = 1; optional string dst_name = 2; - optional string src_ae_name = 3; - optional uint32 qoscube = 4; - optional sint32 response = 5; + optional uint32 qoscube = 3; + optional sint32 response = 4; }; diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 74bdda88..071a895f 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -301,7 +301,7 @@ int fmgr_init(void) /* FIXME: Implement cacep policies */ (void) pc; - fmgr.gam = gam_create(pg, DT_AE); + fmgr.gam = gam_create(pg); if (fmgr.gam == NULL) { log_err("Failed to create graph adjacency manager."); fmgr_destroy_flows(); @@ -360,7 +360,6 @@ void fmgr_fini() int fmgr_np1_alloc(int fd, char * dst_ap_name, - char * src_ae_name, qoscube_t cube) { cep_id_t cep_id; @@ -406,7 +405,6 @@ int fmgr_np1_alloc(int fd, msg.code = FLOW_ALLOC_CODE__FLOW_REQ; msg.dst_name = dst_ap_name; - msg.src_ae_name = src_ae_name; msg.has_qoscube = true; msg.qoscube = cube; @@ -546,7 +544,6 @@ int fmgr_np1_post_buf(cep_id_t cep_id, case FLOW_ALLOC_CODE__FLOW_REQ: fd = ipcp_flow_req_arr(getpid(), msg->dst_name, - msg->src_ae_name, msg->qoscube); if (fd < 0) { flow_alloc_msg__free_unpacked(msg, NULL); diff --git a/src/ipcpd/normal/fmgr.h b/src/ipcpd/normal/fmgr.h index 3c61f55a..e75417f3 100644 --- a/src/ipcpd/normal/fmgr.h +++ b/src/ipcpd/normal/fmgr.h @@ -34,7 +34,6 @@ void fmgr_fini(void); int fmgr_np1_alloc(int fd, char * dst_ap_name, - char * src_ae_name, qoscube_t qos); int fmgr_np1_alloc_resp(int fd, diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index 02df0be7..2479fa62 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -53,14 +53,11 @@ struct gam { pthread_mutex_t gas_lock; pthread_cond_t gas_cond; - char * ae_name; - struct pol_gam_ops * ops; void * ops_o; }; -struct gam * gam_create(enum pol_gam gam_type, - const char * ae_name) +struct gam * gam_create(enum pol_gam gam_type) { struct gam * tmp; @@ -80,21 +77,13 @@ struct gam * gam_create(enum pol_gam gam_type, list_head_init(&tmp->gas); - tmp->ae_name = strdup(ae_name); - if (tmp->ae_name == NULL) { - free(tmp); - return NULL; - } - if (pthread_mutex_init(&tmp->gas_lock, NULL)) { - free(tmp->ae_name); free(tmp); return NULL; } if (pthread_cond_init(&tmp->gas_cond, NULL)) { pthread_mutex_destroy(&tmp->gas_lock); - free(tmp->ae_name); free(tmp); return NULL; } @@ -103,7 +92,6 @@ struct gam * gam_create(enum pol_gam gam_type, if (tmp->ops_o == NULL) { pthread_cond_destroy(&tmp->gas_cond); pthread_mutex_destroy(&tmp->gas_lock); - free(tmp->ae_name); free(tmp); return NULL; } @@ -111,7 +99,6 @@ struct gam * gam_create(enum pol_gam gam_type, if (tmp->ops->start(tmp->ops_o)) { pthread_cond_destroy(&tmp->gas_cond); pthread_mutex_destroy(&tmp->gas_lock); - free(tmp->ae_name); free(tmp); return NULL; } @@ -143,7 +130,6 @@ void gam_destroy(struct gam * instance) pthread_mutex_destroy(&instance->gas_lock); pthread_cond_destroy(&instance->gas_cond); - free(instance->ae_name); instance->ops->destroy(instance->ops_o); free(instance); } @@ -170,7 +156,7 @@ static int add_ga(struct gam * instance, pthread_cond_signal(&instance->gas_cond); pthread_mutex_unlock(&instance->gas_lock); - log_info("Added %s flow to %s.", instance->ae_name, info->name); + log_info("Added flow to %s.", info->name); return 0; } @@ -241,7 +227,7 @@ int gam_flow_alloc(struct gam * instance, log_dbg("Allocating flow to %s.", dst_name); - fd = flow_alloc(dst_name, instance->ae_name, NULL); + fd = flow_alloc(dst_name, NULL); if (fd < 0) { log_err("Failed to allocate flow to %s.", dst_name); return -1; diff --git a/src/ipcpd/normal/gam.h b/src/ipcpd/normal/gam.h index e4832ca6..58b028b9 100644 --- a/src/ipcpd/normal/gam.h +++ b/src/ipcpd/normal/gam.h @@ -26,8 +26,7 @@ #include #include -struct gam * gam_create(enum pol_gam gam_type, - const char * ae_name); +struct gam * gam_create(enum pol_gam gam_type); void gam_destroy(struct gam * instance); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 522daa3b..939544c3 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -85,8 +85,9 @@ void ipcp_sig_handler(int sig, static void * flow_acceptor(void * o) { int fd; - char * ae_name; qosspec_t qs; + /* FIXME: Remove once correct AE is known. */ + char * ae_name = ENROLL_AE; (void) o; @@ -101,14 +102,14 @@ static void * flow_acceptor(void * o) pthread_rwlock_unlock(&ipcpi.state_lock); - fd = flow_accept(&ae_name, &qs); + fd = flow_accept(&qs); if (fd < 0) { if (fd != -EIRMD) log_warn("Flow accept failed: %d", fd); continue; } - log_dbg("New flow allocation request for AE %s.", ae_name); + /* FIXME: Perform CACEP at this point */ if (strcmp(ae_name, ENROLL_AE) == 0) { enroll_handle(fd); @@ -123,8 +124,6 @@ static void * flow_acceptor(void * o) log_warn("Failed to reply to flow allocation."); flow_dealloc(fd); } - - free(ae_name); } return (void *) 0; diff --git a/src/ipcpd/normal/pol-gam-ops.h b/src/ipcpd/normal/pol-gam-ops.h index 6983e3a0..264f252b 100644 --- a/src/ipcpd/normal/pol-gam-ops.h +++ b/src/ipcpd/normal/pol-gam-ops.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_IPCPD_NORMAL_POL_GAM_OPS_H #define OUROBOROS_IPCPD_NORMAL_POL_GAM_OPS_H -#include "conn.h" +#include struct pol_gam_ops { void * (* create)(struct gam * instance); diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index f254bd50..1436a7d4 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -71,7 +71,7 @@ int ribmgr_init(void) /* FIXME: Implement cacep policies */ (void) pc; - ribmgr.gam = gam_create(pg, MGMT_AE); + ribmgr.gam = gam_create(pg); if (ribmgr.gam == NULL) { log_err("Failed to create gam."); return -1; diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index cd913de4..01121fa3 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -334,7 +334,6 @@ static int eth_llc_ipcp_send_mgmt_frame(shim_eth_llc_msg_t * msg, static int eth_llc_ipcp_sap_alloc(uint8_t * dst_addr, uint8_t ssap, char * dst_name, - char * src_ae_name, qoscube_t cube) { shim_eth_llc_msg_t msg = SHIM_ETH_LLC_MSG__INIT; @@ -343,7 +342,6 @@ static int eth_llc_ipcp_sap_alloc(uint8_t * dst_addr, msg.has_ssap = true; msg.ssap = ssap; msg.dst_name = dst_name; - msg.src_ae_name = src_ae_name; msg.has_qoscube = true; msg.qoscube = cube; @@ -371,7 +369,6 @@ static int eth_llc_ipcp_sap_alloc_resp(uint8_t * dst_addr, static int eth_llc_ipcp_sap_req(uint8_t r_sap, uint8_t * r_addr, char * dst_name, - char * src_ae_name, qoscube_t cube) { int fd; @@ -380,7 +377,7 @@ static int eth_llc_ipcp_sap_req(uint8_t r_sap, pthread_rwlock_wrlock(ð_llc_data.flows_lock); /* reply to IRM */ - fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube); + fd = ipcp_flow_req_arr(getpid(), dst_name, cube); if (fd < 0) { pthread_rwlock_unlock(ð_llc_data.flows_lock); pthread_rwlock_unlock(&ipcpi.state_lock); @@ -491,7 +488,6 @@ static int eth_llc_ipcp_mgmt_frame(uint8_t * buf, eth_llc_ipcp_sap_req(msg->ssap, r_addr, msg->dst_name, - msg->src_ae_name, msg->qoscube); } break; @@ -989,7 +985,6 @@ static int eth_llc_ipcp_name_query(char * name) static int eth_llc_ipcp_flow_alloc(int fd, char * dst_name, - char * src_ae_name, qoscube_t cube) { uint8_t ssap = 0; @@ -998,7 +993,7 @@ static int eth_llc_ipcp_flow_alloc(int fd, log_dbg("Allocating flow to %s.", dst_name); - if (dst_name == NULL || src_ae_name == NULL) + if (dst_name == NULL) return -1; if (cube != QOS_CUBE_BE && cube != QOS_CUBE_FRC) { @@ -1038,11 +1033,7 @@ static int eth_llc_ipcp_flow_alloc(int fd, memcpy(r_addr, &addr, MAC_SIZE); - if (eth_llc_ipcp_sap_alloc(r_addr, - ssap, - dst_name, - src_ae_name, - cube) < 0) { + if (eth_llc_ipcp_sap_alloc(r_addr, ssap, dst_name, cube) < 0) { pthread_rwlock_rdlock(&ipcpi.state_lock); pthread_rwlock_wrlock(ð_llc_data.flows_lock); bmp_release(eth_llc_data.saps, eth_llc_data.fd_to_ef[fd].sap); diff --git a/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto b/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto index cedb0fd4..2d66428c 100644 --- a/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto +++ b/src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto @@ -32,9 +32,8 @@ enum shim_eth_llc_msg_code { message shim_eth_llc_msg { required shim_eth_llc_msg_code code = 1; optional string dst_name = 2; - optional string src_ae_name = 3; - optional uint32 ssap = 4; - optional uint32 dsap = 5; - optional uint32 qoscube = 6; - optional sint32 response = 7; + optional uint32 ssap = 3; + optional uint32 dsap = 4; + optional uint32 qoscube = 5; + optional sint32 response = 6; }; diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 4d6fdc3b..a67a60ee 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -197,7 +197,6 @@ static int send_shim_udp_msg(shim_udp_msg_t * msg, static int ipcp_udp_port_alloc(uint32_t dst_ip_addr, uint16_t src_udp_port, char * dst_name, - char * src_ae_name, qoscube_t cube) { shim_udp_msg_t msg = SHIM_UDP_MSG__INIT; @@ -205,7 +204,6 @@ static int ipcp_udp_port_alloc(uint32_t dst_ip_addr, msg.code = SHIM_UDP_MSG_CODE__FLOW_REQ; msg.src_udp_port = src_udp_port; msg.dst_name = dst_name; - msg.src_ae_name = src_ae_name; msg.has_qoscube = true; msg.qoscube = cube; @@ -231,7 +229,6 @@ static int ipcp_udp_port_alloc_resp(uint32_t dst_ip_addr, static int ipcp_udp_port_req(struct sockaddr_in * c_saddr, char * dst_name, - char * src_ae_name, qoscube_t cube) { int skfd; @@ -275,7 +272,7 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr, pthread_rwlock_wrlock(&udp_data.flows_lock); /* reply to IRM */ - fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube); + fd = ipcp_flow_req_arr(getpid(), dst_name, cube); if (fd < 0) { pthread_rwlock_unlock(&udp_data.flows_lock); pthread_rwlock_unlock(&ipcpi.state_lock); @@ -397,7 +394,6 @@ static void * ipcp_udp_listener(void * o) c_saddr.sin_port = msg->src_udp_port; ipcp_udp_port_req(&c_saddr, msg->dst_name, - msg->src_ae_name, msg->qoscube); break; case SHIM_UDP_MSG_CODE__FLOW_REPLY: @@ -957,7 +953,6 @@ static int ipcp_udp_name_query(char * name) static int ipcp_udp_flow_alloc(int fd, char * dst_name, - char * src_ae_name, qoscube_t cube) { struct sockaddr_in r_saddr; /* server address */ @@ -969,10 +964,8 @@ static int ipcp_udp_flow_alloc(int fd, log_dbg("Allocating flow to %s.", dst_name); assert(dst_name); - assert(src_ae_name); - if (strlen(dst_name) > 255 - || strlen(src_ae_name) > 255) { + if (strlen(dst_name) > 255) { log_err("Name too long for this shim."); return -1; } @@ -1043,7 +1036,6 @@ static int ipcp_udp_flow_alloc(int fd, if (ipcp_udp_port_alloc(ip_addr, f_saddr.sin_port, dst_name, - src_ae_name, cube) < 0) { pthread_rwlock_rdlock(&ipcpi.state_lock); pthread_rwlock_wrlock(&udp_data.flows_lock); diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index dcf77eec..ae9ec957 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -328,14 +328,13 @@ int ipcp_flow_alloc(pid_t api, int port_id, pid_t n_api, char * dst_name, - char * src_ae_name, qoscube_t cube) { ipcp_msg_t msg = IPCP_MSG__INIT; ipcp_msg_t * recv_msg = NULL; int ret = -1; - if (dst_name == NULL || src_ae_name == NULL) + if (dst_name == NULL) return -EINVAL; msg.code = IPCP_MSG_CODE__IPCP_FLOW_ALLOC; @@ -343,7 +342,6 @@ int ipcp_flow_alloc(pid_t api, msg.port_id = port_id; msg.has_api = true; msg.api = n_api; - msg.src_ae_name = src_ae_name; msg.dst_name = dst_name; msg.has_qoscube = true; msg.qoscube = cube; diff --git a/src/irmd/ipcp.h b/src/irmd/ipcp.h index 658aa2ea..7ddfc3c4 100644 --- a/src/irmd/ipcp.h +++ b/src/irmd/ipcp.h @@ -52,7 +52,6 @@ int ipcp_flow_alloc(pid_t api, int port_id, pid_t n_api, char * dst_name, - char * src_ae_name, qoscube_t qos); int ipcp_flow_alloc_resp(pid_t api, diff --git a/src/irmd/main.c b/src/irmd/main.c index 9aceb27a..a0115f56 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -976,7 +976,6 @@ static int api_announce(pid_t api, } static struct irm_flow * flow_accept(pid_t api, - char ** dst_ae_name, qoscube_t * cube) { struct irm_flow * f = NULL; @@ -999,8 +998,10 @@ static struct irm_flow * flow_accept(pid_t api, log_err("Unknown instance %d calling accept.", api); return NULL; } + log_dbg("New instance (%d) of %s added.", api, e->apn); log_dbg("This instance accepts flows for:"); + list_for_each(p, &e->names) { struct str_el * s = list_entry(p, struct str_el, next); log_dbg(" %s", s->str); @@ -1064,9 +1065,6 @@ static struct irm_flow * flow_accept(pid_t api, *cube = re->qos; - if (dst_ae_name != NULL) - *dst_ae_name = re->req_ae_name; - log_info("Flow on port_id %d allocated.", f->port_id); pthread_rwlock_unlock(&irmd->flows_lock); @@ -1148,7 +1146,6 @@ static int flow_alloc_resp(pid_t n_api, static struct irm_flow * flow_alloc(pid_t api, char * dst_name, - char * src_ae_name, qoscube_t cube) { struct irm_flow * f; @@ -1197,7 +1194,7 @@ static struct irm_flow * flow_alloc(pid_t api, pthread_rwlock_unlock(&irmd->state_lock); if (ipcp_flow_alloc(ipcp, port_id, api, - dst_name, src_ae_name, cube) < 0) { + dst_name, cube) < 0) { pthread_rwlock_rdlock(&irmd->state_lock); pthread_rwlock_wrlock(&irmd->flows_lock); list_del(&f->next); @@ -1348,7 +1345,6 @@ static pid_t auto_execute(char ** argv) static struct irm_flow * flow_req_arr(pid_t api, char * dst_name, - char * ae_name, qoscube_t cube) { struct reg_entry * re = NULL; @@ -1363,8 +1359,7 @@ static struct irm_flow * flow_req_arr(pid_t api, struct timespec wt = {IRMD_REQ_ARR_TIMEOUT % 1000, (IRMD_REQ_ARR_TIMEOUT % 1000) * MILLION}; - log_dbg("Flow req arrived from IPCP %d for %s on AE %s.", - api, dst_name, ae_name); + log_dbg("Flow req arrived from IPCP %d for %s.", api, dst_name); pthread_rwlock_rdlock(&irmd->state_lock); pthread_rwlock_rdlock(&irmd->reg_lock); @@ -1469,7 +1464,6 @@ static struct irm_flow * flow_req_arr(pid_t api, pthread_rwlock_unlock(&irmd->flows_lock); pthread_rwlock_rdlock(&irmd->reg_lock); - re->req_ae_name = ae_name; re->qos = cube; reg_entry_set_state(re, REG_NAME_FLOW_ARRIVED); @@ -1926,7 +1920,6 @@ void * mainloop(void * o) case IRM_MSG_CODE__IRM_FLOW_ACCEPT: ret_msg.has_qoscube = true; e = flow_accept(msg->api, - &ret_msg.ae_name, (qoscube_t *) &ret_msg.qoscube); if (e == NULL) { ret_msg.has_result = true; @@ -1947,7 +1940,6 @@ void * mainloop(void * o) case IRM_MSG_CODE__IRM_FLOW_ALLOC: e = flow_alloc(msg->api, msg->dst_name, - msg->ae_name, msg->qoscube); if (e == NULL) { ret_msg.has_result = true; @@ -1970,7 +1962,6 @@ void * mainloop(void * o) case IRM_MSG_CODE__IPCP_FLOW_REQ_ARR: e = flow_req_arr(msg->api, msg->dst_name, - msg->ae_name, msg->qoscube); if (e == NULL) { ret_msg.has_result = true; diff --git a/src/irmd/registry.c b/src/irmd/registry.c index 985ecda0..f4579d08 100644 --- a/src/irmd/registry.c +++ b/src/irmd/registry.c @@ -52,7 +52,6 @@ static struct reg_entry * reg_entry_create(void) e->name = NULL; e->state = REG_NAME_NULL; - e->req_ae_name = NULL; e->response = -1; return e; diff --git a/src/irmd/registry.h b/src/irmd/registry.h index 67e4da40..76b32398 100644 --- a/src/irmd/registry.h +++ b/src/irmd/registry.h @@ -62,7 +62,6 @@ struct reg_entry { struct list_head reg_apis; enum reg_name_state state; - char * req_ae_name; qoscube_t qos; int response; pthread_cond_t state_cond; diff --git a/src/lib/dev.c b/src/lib/dev.c index 4d85a5d9..cb8044cf 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -382,8 +382,7 @@ void ap_fini() pthread_rwlock_destroy(&ai.data_lock); } -int flow_accept(char ** ae_name, - qosspec_t * spec) +int flow_accept(qosspec_t * spec) { irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; @@ -451,18 +450,6 @@ int flow_accept(char ** ae_name, return -1; } - if (ae_name != NULL) { - *ae_name = strdup(recv_msg->ae_name); - if (*ae_name == NULL) { - reset_flow(fd); - bmp_release(ai.fds, fd); - pthread_rwlock_unlock(&ai.flows_lock); - pthread_rwlock_unlock(&ai.data_lock); - irm_msg__free_unpacked(recv_msg, NULL); - return -ENOMEM; - } - } - ai.flows[fd].port_id = recv_msg->port_id; ai.flows[fd].oflags = FLOW_O_DEFAULT; ai.flows[fd].api = recv_msg->api; @@ -531,7 +518,6 @@ int flow_alloc_resp(int fd, } int flow_alloc(const char * dst_name, - const char * src_ae_name, qosspec_t * spec) { irm_msg_t msg = IRM_MSG__INIT; @@ -541,12 +527,8 @@ int flow_alloc(const char * dst_name, if (dst_name == NULL) return -EINVAL; - if (src_ae_name == NULL) - src_ae_name = UNKNOWN_AE; - msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC; msg.dst_name = (char *) dst_name; - msg.ae_name = (char *) src_ae_name; msg.has_api = true; msg.has_qoscube = true; msg.qoscube = spec_to_cube(spec); @@ -1270,7 +1252,6 @@ int ipcp_create_r(pid_t api, int ipcp_flow_req_arr(pid_t api, char * dst_name, - char * src_ae_name, qoscube_t cube) { irm_msg_t msg = IRM_MSG__INIT; @@ -1278,14 +1259,13 @@ int ipcp_flow_req_arr(pid_t api, int port_id = -1; int fd = -1; - if (dst_name == NULL || src_ae_name == NULL) + if (dst_name == NULL) return -EINVAL; msg.code = IRM_MSG_CODE__IPCP_FLOW_REQ_ARR; msg.has_api = true; msg.api = api; msg.dst_name = dst_name; - msg.ae_name = src_ae_name; msg.has_qoscube = true; msg.qoscube = cube; diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto index 827bd370..da817944 100644 --- a/src/lib/ipcpd_messages.proto +++ b/src/lib/ipcpd_messages.proto @@ -45,11 +45,10 @@ message ipcp_msg { optional string name = 5; optional sint32 port_id = 6; optional string dst_name = 7; - optional string src_ae_name = 8; - optional sint32 qoscube = 9; - optional dif_config_msg conf = 10; - optional sint32 fd = 11; - optional sint32 api = 12; - optional sint32 response = 13; - optional sint32 result = 14; + optional sint32 qoscube = 8; + optional dif_config_msg conf = 9; + optional sint32 fd = 10; + optional sint32 api = 11; + optional sint32 response = 12; + optional sint32 result = 13; }; diff --git a/src/lib/irmd_messages.proto b/src/lib/irmd_messages.proto index a0965f43..c25d2c18 100644 --- a/src/lib/irmd_messages.proto +++ b/src/lib/irmd_messages.proto @@ -52,17 +52,16 @@ enum irm_msg_code { message irm_msg { required irm_msg_code code = 1; optional string ap_name = 2; - optional string ae_name = 3; - optional sint32 api = 4; - optional uint32 ipcp_type = 5; - repeated string dif_name = 6; - repeated string args = 7; - optional sint32 response = 8; - optional string dst_name = 9; - optional sint32 port_id = 10; - optional sint32 qoscube = 11; - optional dif_config_msg conf = 12; - optional uint32 opts = 13; - repeated sint32 apis = 14; - optional sint32 result = 15; + optional sint32 api = 3; + optional uint32 ipcp_type = 4; + repeated string dif_name = 5; + repeated string args = 6; + optional sint32 response = 7; + optional string dst_name = 8; + optional sint32 port_id = 9; + optional sint32 qoscube = 10; + optional dif_config_msg conf = 11; + optional uint32 opts = 12; + repeated sint32 apis = 13; + optional sint32 result = 14; }; diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c index 173dab24..48a18cd1 100644 --- a/src/tools/cbr/cbr_client.c +++ b/src/tools/cbr/cbr_client.c @@ -90,7 +90,7 @@ int client_main(char * server, printf("Client started, duration %d, rate %lu b/s, size %d B.\n", duration, rate, size); - fd = flow_alloc(server, NULL, NULL); + fd = flow_alloc(server, NULL); if (fd < 0) { printf("Failed to allocate flow.\n"); return -1; diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c index 7105ff09..b0be9d7b 100644 --- a/src/tools/cbr/cbr_server.c +++ b/src/tools/cbr/cbr_server.c @@ -164,7 +164,7 @@ static void * listener(void * o) server_settings.interval, server_settings.timeout); while (true) { - client_fd = flow_accept(NULL, &qs); + client_fd = flow_accept(&qs); if (client_fd < 0) { printf("Failed to accept flow.\n"); break; diff --git a/src/tools/echo/echo_client.c b/src/tools/echo/echo_client.c index 783188d5..3036d338 100644 --- a/src/tools/echo/echo_client.c +++ b/src/tools/echo/echo_client.c @@ -30,7 +30,7 @@ int client_main(void) char * message = "Client says hi!"; ssize_t count = 0; - fd = flow_alloc("echo", NULL, NULL); + fd = flow_alloc("echo", NULL); if (fd < 0) { printf("Failed to allocate flow.\n"); return -1; diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c index 8940a0b5..94c54eee 100644 --- a/src/tools/echo/echo_server.c +++ b/src/tools/echo/echo_server.c @@ -50,7 +50,7 @@ int server_main(void) } while (true) { - client_fd = flow_accept(NULL, &qs); + client_fd = flow_accept(&qs); if (client_fd < 0) { printf("Failed to accept flow.\n"); break; diff --git a/src/tools/operf/operf_client.c b/src/tools/operf/operf_client.c index 5b31e27b..0c943cf7 100644 --- a/src/tools/operf/operf_client.c +++ b/src/tools/operf/operf_client.c @@ -182,7 +182,7 @@ int client_main(void) client.sent = 0; client.rcvd = 0; - fd = flow_alloc(client.s_apn, NULL, NULL); + fd = flow_alloc(client.s_apn, NULL); if (fd < 0) { printf("Failed to allocate flow.\n"); return -1; diff --git a/src/tools/operf/operf_server.c b/src/tools/operf/operf_server.c index 3c3b9788..f23b52f3 100644 --- a/src/tools/operf/operf_server.c +++ b/src/tools/operf/operf_server.c @@ -108,7 +108,7 @@ void * accept_thread(void * o) printf("Ouroboros perf server started.\n"); while (true) { - fd = flow_accept(NULL, &qs); + fd = flow_accept(&qs); if (fd < 0) { printf("Failed to accept flow.\n"); break; diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index 99c11a68..253ea168 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -213,7 +213,7 @@ int client_main(void) return -1; } - fd = flow_alloc(client.s_apn, NULL, NULL); + fd = flow_alloc(client.s_apn, NULL); if (fd < 0) { printf("Failed to allocate flow.\n"); return -1; diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index 24cd9bf1..e0a6655b 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -119,7 +119,7 @@ void * accept_thread(void * o) printf("Ouroboros ping server started.\n"); while (true) { - fd = flow_accept(NULL, &qs); + fd = flow_accept(&qs); if (fd < 0) { printf("Failed to accept flow.\n"); break; -- cgit v1.2.3 From d06cb62e111be1ac3f09398ae559f99e4833b4bf Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Mon, 27 Feb 2017 17:04:40 +0100 Subject: lib: Split authentication from CACEP By removing authentication as part of CACEP, all policies disappear. CACEP becomes a policy-free connection establishment protocol between Application Entities. Authentication can later be added cleanly as a pure policy function when needed. --- include/ouroboros/cacep.h | 37 +++--- include/ouroboros/irm_config.h | 5 - src/ipcpd/normal/cdap_flow.c | 25 ++-- src/ipcpd/normal/cdap_flow.h | 8 +- src/ipcpd/normal/enroll.c | 42 +++---- src/ipcpd/normal/fmgr.c | 11 -- src/ipcpd/normal/gam.c | 87 ++++++-------- src/ipcpd/normal/main.c | 11 -- src/ipcpd/normal/pol/complete.c | 6 +- src/ipcpd/normal/ribmgr.c | 10 -- src/lib/CMakeLists.txt | 14 +-- src/lib/cacep.c | 152 ++++++++++++++---------- src/lib/cacep.proto | 33 ++++++ src/lib/pol/cacep_anonymous_auth.c | 209 --------------------------------- src/lib/pol/cacep_anonymous_auth.h | 35 ------ src/lib/pol/cacep_anonymous_auth.proto | 30 ----- src/lib/pol/cacep_proto.c | 52 -------- src/lib/pol/cacep_proto.h | 36 ------ src/lib/pol/cacep_proto.proto | 38 ------ src/lib/pol/cacep_simple_auth.c | 190 ------------------------------ src/lib/pol/cacep_simple_auth.h | 35 ------ src/lib/pol/cacep_simple_auth.proto | 32 ----- 22 files changed, 210 insertions(+), 888 deletions(-) create mode 100644 src/lib/cacep.proto delete mode 100644 src/lib/pol/cacep_anonymous_auth.c delete mode 100644 src/lib/pol/cacep_anonymous_auth.h delete mode 100644 src/lib/pol/cacep_anonymous_auth.proto delete mode 100644 src/lib/pol/cacep_proto.c delete mode 100644 src/lib/pol/cacep_proto.h delete mode 100644 src/lib/pol/cacep_proto.proto delete mode 100644 src/lib/pol/cacep_simple_auth.c delete mode 100644 src/lib/pol/cacep_simple_auth.h delete mode 100644 src/lib/pol/cacep_simple_auth.proto (limited to 'include') diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h index f155023e..5ef66433 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cacep.h @@ -1,7 +1,7 @@ /* * Ouroboros - Copyright (C) 2016 - 2017 * - * The Common Application Connection Establishment Phase + * The Common Application Connection Establishment Protocol * * Sander Vrijders * Dimitri Staessens @@ -24,7 +24,7 @@ #ifndef OUROBOROS_CACEP_H #define OUROBOROS_CACEP_H -#include +#include enum proto_concrete_syntax { PROTO_GPB = 0, @@ -33,27 +33,22 @@ enum proto_concrete_syntax { }; struct conn_info{ - struct { - char * protocol; - uint32_t pref_version; - enum proto_concrete_syntax pref_syntax; - } proto; - char * name; - uint64_t addr; + char ae_name[64]; + char protocol[64]; + uint32_t pref_version; + enum proto_concrete_syntax pref_syntax; + union { + char name[64]; + uint64_t addr; + } ae; }; -int conn_info_init(struct conn_info * info); +int cacep_connect(int fd, + const struct conn_info * in, + struct conn_info * out); -void conn_info_fini(struct conn_info * info); - -struct conn_info * cacep_auth(int fd, - enum pol_cacep pc, - const struct conn_info * info, - const void * auth); - -struct conn_info * cacep_auth_wait(int fd, - enum pol_cacep pc, - const struct conn_info * info, - const void * auth); +int cacep_listen(int fd, + const struct conn_info * in, + struct conn_info * out); #endif /* OUROBOROS_CACEP_H */ diff --git a/include/ouroboros/irm_config.h b/include/ouroboros/irm_config.h index 9a05a434..5e3c84b4 100644 --- a/include/ouroboros/irm_config.h +++ b/include/ouroboros/irm_config.h @@ -47,11 +47,6 @@ enum pol_gam { COMPLETE = 0 }; -enum pol_cacep { - ANONYMOUS_AUTH = 0, - SIMPLE_AUTH -}; - struct dif_config { char * dif_name; enum ipcp_type type; diff --git a/src/ipcpd/normal/cdap_flow.c b/src/ipcpd/normal/cdap_flow.c index 3d1b2b22..d3d98884 100644 --- a/src/ipcpd/normal/cdap_flow.c +++ b/src/ipcpd/normal/cdap_flow.c @@ -29,6 +29,7 @@ #include "cdap_flow.h" #include +#include #include static void cdap_flow_destroy(struct cdap_flow * flow) @@ -37,20 +38,15 @@ static void cdap_flow_destroy(struct cdap_flow * flow) if (flow->ci != NULL) cdap_destroy(flow->ci); - if (flow->info != NULL) { - conn_info_fini(flow->info); - free(flow->info); - } free(flow); } -struct cdap_flow * cdap_flow_arr(int fd, +struct cdap_flow * cdap_flow_arr(int fd, int resp, - enum pol_cacep pc, const struct conn_info * info) { - struct cdap_flow * flow; + struct cdap_flow * flow; if (flow_alloc_resp(fd, resp) < 0) { log_err("Could not respond to new flow."); @@ -66,12 +62,13 @@ struct cdap_flow * cdap_flow_arr(int fd, return NULL; } + memset(&flow->info, 0, sizeof(flow->info)); + flow->fd = fd; flow->ci = NULL; - flow->info = cacep_auth_wait(fd, pc, info, NULL); - if (flow->info == NULL) { - log_err("Other side failed to authenticate."); + if (cacep_listen(fd, info, &flow->info)) { + log_err("Error establishing application connection."); cdap_flow_destroy(flow); return NULL; } @@ -88,7 +85,6 @@ struct cdap_flow * cdap_flow_arr(int fd, struct cdap_flow * cdap_flow_alloc(const char * dst_name, qosspec_t * qs, - enum pol_cacep pc, const struct conn_info * info) { struct cdap_flow * flow; @@ -119,12 +115,13 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name, return NULL; } + memset(&flow->info, 0, sizeof(flow->info)); + flow->fd = fd; flow->ci = NULL; - flow->info = cacep_auth(fd, pc, info, NULL); - if (flow->info == NULL) { - log_err("Failed to authenticate."); + if (cacep_connect(fd, info, &flow->info)) { + log_err("Failed to connect to application."); cdap_flow_dealloc(flow); return NULL; } diff --git a/src/ipcpd/normal/cdap_flow.h b/src/ipcpd/normal/cdap_flow.h index 8aa26dc0..761f3463 100644 --- a/src/ipcpd/normal/cdap_flow.h +++ b/src/ipcpd/normal/cdap_flow.h @@ -28,19 +28,17 @@ #include struct cdap_flow { - int fd; - struct cdap * ci; - struct conn_info * info; + int fd; + struct cdap * ci; + struct conn_info info; }; struct cdap_flow * cdap_flow_arr(int fd, int resp, - enum pol_cacep pc, const struct conn_info * info); struct cdap_flow * cdap_flow_alloc(const char * dst_name, qosspec_t * qs, - enum pol_cacep pc, const struct conn_info * info); void cdap_flow_dealloc(struct cdap_flow * flow); diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index b420533e..5c7ebd7e 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -44,7 +44,7 @@ int enroll_handle(int fd) { struct cdap_flow * flow; - struct conn_info info; + struct conn_info info; cdap_key_t key; enum cdap_opcode oc; char * name; @@ -61,27 +61,20 @@ int enroll_handle(int fd) char * members_ro = MEMBERS_PATH; char * dif_ro = DIF_PATH; - conn_info_init(&info); + memset(&info, 0, sizeof(info)); - info.proto.protocol = strdup(CDAP_PROTO); - if (info.proto.protocol == NULL) { - conn_info_fini(&info); - return -ENOMEM; - } - - info.proto.pref_version = 1; - info.proto.pref_syntax = PROTO_GPB; + strcpy(info.ae_name, ENROLL_AE); + strcpy(info.protocol, CDAP_PROTO); + info.pref_version = 1; + info.pref_syntax = PROTO_GPB; - flow = cdap_flow_arr(fd, 0, ANONYMOUS_AUTH, &info); + flow = cdap_flow_arr(fd, 0, &info); if (flow == NULL) { log_err("Failed to auth enrollment request."); - conn_info_fini(&info); flow_dealloc(fd); return -1; } - conn_info_fini(&info); - while (!(boot_r && members_r && dif_name_r)) { key = cdap_request_wait(flow->ci, &oc, &name, &data, (size_t *) &len , &flags); @@ -156,7 +149,7 @@ int enroll_handle(int fd) int enroll_boot(char * dst_name) { struct cdap_flow * flow; - struct conn_info info; + struct conn_info info; cdap_key_t key; uint8_t * data; size_t len; @@ -170,26 +163,19 @@ int enroll_boot(char * dst_name) char * members_ro = MEMBERS_PATH; char * dif_ro = DIF_PATH; - conn_info_init(&info); + memset(&info, 0, sizeof(info)); - info.proto.protocol = strdup(CDAP_PROTO); - if (info.proto.protocol == NULL) { - conn_info_fini(&info); - return -ENOMEM; - } - - info.proto.pref_version = 1; - info.proto.pref_syntax = PROTO_GPB; + strcpy(info.ae_name, ENROLL_AE); + strcpy(info.protocol, CDAP_PROTO); + info.pref_version = 1; + info.pref_syntax = PROTO_GPB; - flow = cdap_flow_alloc(dst_name, NULL, ANONYMOUS_AUTH, &info); + flow = cdap_flow_alloc(dst_name, NULL, &info); if (flow == NULL) { log_err("Failed to allocate flow for enrollment request."); - conn_info_fini(&info); return -1; } - conn_info_fini(&info); - log_dbg("Getting boot information from %s.", dst_name); clock_gettime(CLOCK_REALTIME, &t0); diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 071a895f..0c927fc7 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -249,7 +249,6 @@ static void fmgr_destroy_flows(void) int fmgr_init(void) { - enum pol_cacep pc; enum pol_gam pg; int i; @@ -292,15 +291,6 @@ int fmgr_init(void) return -1; } - if (rib_read(BOOT_PATH "/dt/gam/cacep", &pc, sizeof(pc)) - != sizeof(pc)) { - log_err("Failed to read CACEP policy for ribmgr gam."); - return -1; - } - - /* FIXME: Implement cacep policies */ - (void) pc; - fmgr.gam = gam_create(pg); if (fmgr.gam == NULL) { log_err("Failed to create graph adjacency manager."); @@ -345,7 +335,6 @@ void fmgr_fini() flow_dealloc(flow->fd); ipcp_flow_get_qoscube(flow->fd, &cube); flow_set_del(fmgr.nm1_set[cube], flow->fd); - free(flow->info->name); free(flow->info); free(flow); } diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index 2479fa62..bdfc8cb9 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -120,7 +120,6 @@ void gam_destroy(struct gam * instance) list_for_each_safe(p, n, &instance->gas) { struct ga * e = list_entry(p, struct ga, next); list_del(&e->next); - free(e->info->name); free(e->info); free(e); } @@ -156,7 +155,7 @@ static int add_ga(struct gam * instance, pthread_cond_signal(&instance->gas_cond); pthread_mutex_unlock(&instance->gas_lock); - log_info("Added flow to %s.", info->name); + log_info("Added flow."); return 0; } @@ -166,7 +165,7 @@ int gam_flow_arr(struct gam * instance, qosspec_t qs) { struct conn_info * rcv_info; - struct conn_info snd_info; + struct conn_info snd_info; if (flow_alloc_resp(fd, instance->ops->accept_new_flow(instance->ops_o)) < 0) { @@ -174,34 +173,29 @@ int gam_flow_arr(struct gam * instance, return -1; } - conn_info_init(&snd_info); - snd_info.proto.protocol = strdup(CDAP_PROTO); - if (snd_info.proto.protocol == NULL) { - conn_info_fini(&snd_info); + rcv_info = malloc(sizeof(*rcv_info)); + if (rcv_info == NULL) return -ENOMEM; - } - snd_info.proto.pref_version = 1; - snd_info.proto.pref_syntax = PROTO_GPB; - snd_info.addr = ipcpi.address; - snd_info.name = strdup(ipcpi.name); - if (snd_info.name == NULL) { - conn_info_fini(&snd_info); - return -ENOMEM; - } + memset(&snd_info, 0, sizeof(snd_info)); + memset(rcv_info, 0, sizeof(*rcv_info)); + + /* FIXME: send correct AE */ + strcpy(snd_info.ae_name, "FIXME:CORRECT_AE"); + strcpy(snd_info.protocol, CDAP_PROTO); + snd_info.pref_version = 1; + snd_info.pref_syntax = PROTO_GPB; + snd_info.ae.addr = ipcpi.address; - rcv_info = cacep_auth_wait(fd, SIMPLE_AUTH, &snd_info, NULL); - if (rcv_info == NULL) { - log_err("Other side failed to authenticate."); - conn_info_fini(&snd_info); + if (cacep_listen(fd, &snd_info, rcv_info)) { + log_err("Failed to create application connection."); + flow_dealloc(fd); + free(rcv_info); return -1; } - conn_info_fini(&snd_info); - if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); - conn_info_fini(rcv_info); free(rcv_info); return 0; } @@ -209,7 +203,6 @@ int gam_flow_arr(struct gam * instance, if (add_ga(instance, fd, qs, rcv_info)) { log_err("Failed to add ga to graph adjacency manager list."); flow_dealloc(fd); - conn_info_fini(rcv_info); free(rcv_info); return -1; } @@ -222,11 +215,15 @@ int gam_flow_alloc(struct gam * instance, qosspec_t qs) { struct conn_info * rcv_info; - struct conn_info snd_info; + struct conn_info snd_info; int fd; log_dbg("Allocating flow to %s.", dst_name); + rcv_info = malloc(sizeof(*rcv_info)); + if (rcv_info == NULL) + return -ENOMEM; + fd = flow_alloc(dst_name, NULL); if (fd < 0) { log_err("Failed to allocate flow to %s.", dst_name); @@ -239,34 +236,25 @@ int gam_flow_alloc(struct gam * instance, return -1; } - conn_info_init(&snd_info); - snd_info.proto.protocol = strdup(CDAP_PROTO); - if (snd_info.proto.protocol == NULL) { - conn_info_fini(&snd_info); - return -ENOMEM; - } + memset(&snd_info, 0, sizeof(snd_info)); + memset(rcv_info, 0, sizeof(*rcv_info)); - snd_info.proto.pref_version = 1; - snd_info.proto.pref_syntax = PROTO_GPB; - snd_info.addr = ipcpi.address; - snd_info.name = strdup(ipcpi.name); - if (snd_info.name == NULL) { - conn_info_fini(&snd_info); - return -ENOMEM; - } + /* FIXME: send correct AE */ + strcpy(snd_info.ae_name, "FIXME:CORRECT_AE"); + strcpy(snd_info.protocol, CDAP_PROTO); + snd_info.pref_version = 1; + snd_info.pref_syntax = PROTO_GPB; + snd_info.ae.addr = ipcpi.address; - rcv_info = cacep_auth(fd, SIMPLE_AUTH, &snd_info, NULL); - if (rcv_info == NULL) { - log_err("Other side failed to authenticate."); - conn_info_fini(&snd_info); + if (cacep_connect(fd, &snd_info, rcv_info)) { + log_err("Failed to create application connection."); + flow_dealloc(fd); + free(rcv_info); return -1; } - conn_info_fini(&snd_info); - if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); - conn_info_fini(rcv_info); free(rcv_info); return 0; } @@ -274,7 +262,6 @@ int gam_flow_alloc(struct gam * instance, if (add_ga(instance, fd, qs, rcv_info)) { log_err("Failed to add GA to graph adjacency manager list."); flow_dealloc(fd); - conn_info_fini(rcv_info); free(rcv_info); return -1; } @@ -282,10 +269,10 @@ int gam_flow_alloc(struct gam * instance, return 0; } -int gam_flow_wait(struct gam * instance, - int * fd, +int gam_flow_wait(struct gam * instance, + int * fd, struct conn_info ** info, - qosspec_t * qs) + qosspec_t * qs) { struct ga * ga; diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 939544c3..c75a74d6 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -336,11 +336,6 @@ int normal_rib_init(void) static int normal_ipcp_bootstrap(struct dif_config * conf) { - /* FIXME: get CACEP policies from conf */ - enum pol_cacep pol = SIMPLE_AUTH; - - (void) pol; - assert(conf); assert(conf->type == THIS_TYPE); @@ -388,12 +383,6 @@ static int normal_ipcp_bootstrap(struct dif_config * conf) rib_write(BOOT_PATH "/rm/gam/type", &conf->rm_gam_type, sizeof(conf->rm_gam_type)) || - rib_write(BOOT_PATH "/rm/gam/cacep", - &pol, - sizeof(pol)) || - rib_write(BOOT_PATH "/dt/gam/cacep", - &pol, - sizeof(pol)) || rib_write(BOOT_PATH "/addr_auth/type", &conf->addr_auth_type, sizeof(conf->addr_auth_type))) { diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index 1d4811d2..68f43e81 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -167,7 +167,8 @@ int complete_accept_flow(void * o, list_for_each(pos, &complete->neighbors) { struct neighbor * e = list_entry(pos, struct neighbor, next); - if (strcmp(e->neighbor, info->name) == 0) { + /* FIXME: figure out union type and check name or address */ + if (strcmp(e->neighbor, info->ae.name) == 0) { pthread_mutex_unlock(&complete->neighbors_lock); return -1; } @@ -185,7 +186,8 @@ int complete_accept_flow(void * o, list_head_init(&n->next); - n->neighbor = strdup(info->name); + /* FIXME: figure out union type and check name or address */ + n->neighbor = strdup(info->ae.name); if (n->neighbor == NULL) { pthread_mutex_unlock(&complete->neighbors_lock); free(n); diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index 1436a7d4..25f1687e 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -53,7 +53,6 @@ struct { int ribmgr_init(void) { - enum pol_cacep pc; enum pol_gam pg; if (rib_read(BOOT_PATH "/rm/gam/type", &pg, sizeof(pg)) @@ -62,15 +61,6 @@ int ribmgr_init(void) return -1; } - if (rib_read(BOOT_PATH "/rm/gam/cacep", &pc, sizeof(pc)) - != sizeof(pc)) { - log_err("Failed to read CACEP policy for ribmgr gam."); - return -1; - } - - /* FIXME: Implement cacep policies */ - (void) pc; - ribmgr.gam = gam_create(pg); if (ribmgr.gam == NULL) { log_err("Failed to create gam."); diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index fcea0fb2..03452705 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -10,12 +10,7 @@ protobuf_generate_c(DIF_CONFIG_PROTO_SRCS DIF_CONFIG_PROTO_HDRS dif_config.proto) protobuf_generate_c(CDAP_PROTO_SRCS CDAP_PROTO_HDRS cdap.proto) protobuf_generate_c(RO_PROTO_SRCS RO_PROTO_HDRS ro.proto) -protobuf_generate_c(CACEP_PROTO_PROTO_SRCS CACEP_CDAP_PROTO_HDRS - pol/cacep_proto.proto) -protobuf_generate_c(CACEP_ANONYMOUS_AUTH_PROTO_SRCS - CACEP_ANONYMOUS_AUTH_PROTO_HDRS pol/cacep_anonymous_auth.proto) -protobuf_generate_c(CACEP_SIMPLE_AUTH_PROTO_SRCS CACEP_SIMPLE_AUTH_PROTO_HDRS - pol/cacep_simple_auth.proto) +protobuf_generate_c(CACEP_PROTO_SRCS CACEP_PROTO_HDRS cacep.proto) if(NOT APPLE) find_library(LIBRT_LIBRARIES rt) @@ -54,16 +49,11 @@ set(SOURCE_FILES sockets.c time_utils.c utils.c - # Add policies last - pol/cacep_proto.c - pol/cacep_anonymous_auth.c - pol/cacep_simple_auth.c ) add_library(ouroboros SHARED ${SOURCE_FILES} ${IRM_PROTO_SRCS} ${IPCP_PROTO_SRCS} ${DIF_CONFIG_PROTO_SRCS} ${CDAP_PROTO_SRCS} - ${CACEP_PROTO_PROTO_SRCS} ${CACEP_ANONYMOUS_AUTH_PROTO_SRCS} - ${CACEP_SIMPLE_AUTH_PROTO_SRCS} ${RO_PROTO_SRCS}) + ${CACEP_PROTO_SRCS} ${RO_PROTO_SRCS}) target_link_libraries(ouroboros ${LIBRT_LIBRARIES} ${LIBPTHREAD_LIBRARIES} ${PROTOBUF_C_LIBRARY}) diff --git a/src/lib/cacep.c b/src/lib/cacep.c index 89bd05e7..badeccc0 100644 --- a/src/lib/cacep.c +++ b/src/lib/cacep.c @@ -1,9 +1,10 @@ /* * Ouroboros - Copyright (C) 2016 - 2017 * - * The Common Application Connection Establishment Phase + * The Common Application Connection Establishment Protocol * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -20,91 +21,118 @@ * 02110-1301 USA */ -#define OUROBOROS_PREFIX "cacep" - #include #include #include #include -#include - -#include "pol/cacep_anonymous_auth.h" -#include "pol/cacep_simple_auth.h" #include #include -#define BUF_SIZE 2048 +#include "cacep.pb-c.h" +typedef CacepMsg cacep_msg_t; -int conn_info_init(struct conn_info * info) +#define BUF_SIZE 64 + +int read_msg(int fd, + struct conn_info * info) { - if (info == NULL) - return -EINVAL; + uint8_t buf[BUF_SIZE]; + cacep_msg_t * msg; + ssize_t len; + + len = flow_read(fd, buf, BUF_SIZE); + if (len < 0) + return -1; + + msg = cacep_msg__unpack(NULL, len, buf); + if (msg == NULL) + return -1; + + strcpy(info->protocol, msg->protocol); + + info->pref_version = msg->pref_version; + info->pref_syntax = msg->pref_syntax; - info->proto.protocol = NULL; - info->name = NULL; + cacep_msg__free_unpacked(msg, NULL); return 0; } -void conn_info_fini(struct conn_info * info) +static int send_msg(int fd, + const struct conn_info * info) { - if (info == NULL) - return; + cacep_msg_t msg = CACEP_MSG__INIT; + uint8_t * data = NULL; + size_t len = 0; - if (info->proto.protocol != NULL) { - free(info->proto.protocol); - info->proto.protocol = NULL; - } + msg.ae_name = (char *) info->ae_name; + msg.protocol = (char *) info->protocol; + msg.pref_version = info->pref_version; + msg.pref_syntax = info->pref_syntax; + if (msg.pref_syntax < 0) + return -1; + + len = cacep_msg__get_packed_size(&msg); + if (len == 0) + return -1; + + data = malloc(len); + if (data == NULL) + return -ENOMEM; + + cacep_msg__pack(&msg, data); - if (info->name != NULL) { - free(info->name); - info->name = NULL; + if (flow_write(fd, data, len) < 0) { + free(data); + return -1; } + + free(data); + + return 0; } -struct conn_info * cacep_auth(int fd, - enum pol_cacep pc, - const struct conn_info * info, - const void * auth) +int cacep_connect(int fd, + const struct conn_info * in, + struct conn_info * out) { - if (info == NULL) { - log_err("No info provided."); - return NULL; - } + if (in == NULL || out == NULL) + return -EINVAL; - switch (pc) { - case ANONYMOUS_AUTH: - return cacep_anonymous_auth(fd, info, auth); - case SIMPLE_AUTH: - if (info == NULL) - return NULL; - return cacep_simple_auth_auth(fd, info, auth); - default: - log_err("Unsupported CACEP policy."); - return NULL; - } + if (send_msg(fd, in)) + return -1; + + if (read_msg(fd, out)) + return -1; + + if (strcmp(in->ae_name, out->ae_name) || + strcmp(in->protocol, out->protocol) || + in->pref_version != out->pref_version || + in->pref_syntax != out->pref_syntax) + return -EPROTO; + + return 0; } -struct conn_info * cacep_auth_wait(int fd, - enum pol_cacep pc, - const struct conn_info * info, - const void * auth) +int cacep_listen(int fd, + const struct conn_info * in, + struct conn_info * out) { - if (info == NULL) { - log_err("No info provided."); - return NULL; - } + if (in == NULL || out == NULL) + return -EINVAL; - switch (pc) { - case ANONYMOUS_AUTH: - return cacep_anonymous_auth_wait(fd, info, auth); - case SIMPLE_AUTH: - if (info == NULL) - return NULL; - return cacep_simple_auth_auth_wait(fd, info, auth); - default: - log_err("Unsupported CACEP policy."); - return NULL; - } + if (send_msg(fd, in)) + return -1; + + if (read_msg(fd, out)) + return -1; + + if (strcmp(in->ae_name, out->ae_name) || + strcmp(in->protocol, out->protocol) || + in->pref_version != out->pref_version || + in->pref_syntax != out->pref_syntax) + return -EPROTO; + + return 0; } diff --git a/src/lib/cacep.proto b/src/lib/cacep.proto new file mode 100644 index 00000000..3e1291f6 --- /dev/null +++ b/src/lib/cacep.proto @@ -0,0 +1,33 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Message for Connection Information in CACEP + * + * Dimitri Staessens + * Sander Vrijders + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +syntax = "proto2"; + +message cacep_msg { + required string ae_name = 1; + required string protocol = 2; + required int32 pref_version = 3; + repeated int32 supp_version = 4; + required int32 pref_syntax = 5; + repeated int32 supp_syntax = 6; +} \ No newline at end of file diff --git a/src/lib/pol/cacep_anonymous_auth.c b/src/lib/pol/cacep_anonymous_auth.c deleted file mode 100644 index 44c7bd17..00000000 --- a/src/lib/pol/cacep_anonymous_auth.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Anonymous policy for CACEP - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include -#include -#include -#include -#include - -#include "cacep_proto.h" -#include "cacep_anonymous_auth.h" - -#include -#include -#include -#include - -#include "cacep_anonymous_auth.pb-c.h" -typedef CacepAnonymousAuthMsg cacep_anonymous_auth_msg_t; -typedef CacepProtoMsg cacep_proto_msg_t; - -#define BUF_SIZE 2048 -#define NAME_LEN 8 - -/* this policy generates a hex string */ -static struct conn_info * anonymous_info(void) -{ - struct conn_info * info; - struct timespec t; - - info = malloc(sizeof(*info)); - if (info == NULL) - return NULL; - - conn_info_init(info); - - info->name = malloc(NAME_LEN + 1); - if (info->name == NULL) { - free(info); - return NULL; - } - - clock_gettime(CLOCK_REALTIME, &t); - srand(t.tv_nsec); - - sprintf(info->name, "%8x", - (uint32_t)((rand() % RAND_MAX) & 0xFFFFFFFF)); - - info->addr = 0; - - return info; -} - -static struct conn_info * read_msg(int fd) -{ - struct conn_info * tmp; - uint8_t buf[BUF_SIZE]; - cacep_anonymous_auth_msg_t * msg; - ssize_t len; - - len = flow_read(fd, buf, BUF_SIZE); - if (len < 0) - return NULL; - - msg = cacep_anonymous_auth_msg__unpack(NULL, len, buf); - if (msg == NULL) - return NULL; - - tmp = anonymous_info(); - if (tmp == NULL) { - cacep_anonymous_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - tmp->proto.protocol = strdup(msg->proto->protocol); - if (tmp->proto.protocol == NULL) { - free(tmp); - cacep_anonymous_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - tmp->proto.pref_version = msg->proto->pref_version; - tmp->proto.pref_syntax = code_to_syntax(msg->proto->pref_syntax); - if (tmp->proto.pref_syntax < 0) { - free(tmp->proto.protocol); - free(tmp); - cacep_anonymous_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - cacep_anonymous_auth_msg__free_unpacked(msg, NULL); - - return tmp; -} - -static int send_msg(int fd, - const struct conn_info * info) -{ - cacep_anonymous_auth_msg_t msg = CACEP_ANONYMOUS_AUTH_MSG__INIT; - cacep_proto_msg_t cmsg = CACEP_PROTO_MSG__INIT; - int ret = 0; - uint8_t * data = NULL; - size_t len = 0; - - cmsg.protocol = info->proto.protocol; - cmsg.pref_version = info->proto.pref_version; - cmsg.pref_syntax = syntax_to_code(info->proto.pref_syntax); - if (cmsg.pref_syntax < 0) - return -1; - - msg.proto = &cmsg; - - len = cacep_anonymous_auth_msg__get_packed_size(&msg); - if (len == 0) - return -1; - - data = malloc(len); - if (data == NULL) - return -ENOMEM; - - cacep_anonymous_auth_msg__pack(&msg, data); - - if (flow_write(fd, data, len) < 0) - ret = -1; - - free(data); - - return ret; -} - -struct conn_info * cacep_anonymous_auth(int fd, - const struct conn_info * info, - const void * auth) -{ - struct conn_info * tmp; - - assert(info); - - (void) auth; - - if (send_msg(fd, info)) - return NULL; - - tmp = read_msg(fd); - if (tmp == NULL) - return NULL; - - if (strcmp(info->proto.protocol, tmp->proto.protocol) || - info->proto.pref_version != tmp->proto.pref_version || - info->proto.pref_syntax != tmp->proto.pref_syntax) { - conn_info_fini(tmp); - free(tmp); - return NULL; - } - - return tmp; -} - - -struct conn_info * cacep_anonymous_auth_wait(int fd, - const struct conn_info * info, - const void * auth) -{ - struct conn_info * tmp; - - assert(info); - - (void) auth; - - tmp = read_msg(fd); - if (tmp == NULL) - return NULL; - - if (send_msg(fd, info)) { - conn_info_fini(tmp); - free(tmp); - return NULL; - } - - if (strcmp(info->proto.protocol, tmp->proto.protocol) || - info->proto.pref_version != tmp->proto.pref_version || - info->proto.pref_syntax != tmp->proto.pref_syntax) { - conn_info_fini(tmp); - free(tmp); - return NULL; - } - - return tmp; -} diff --git a/src/lib/pol/cacep_anonymous_auth.h b/src/lib/pol/cacep_anonymous_auth.h deleted file mode 100644 index ca47b1b8..00000000 --- a/src/lib/pol/cacep_anonymous_auth.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Anonymous policy for CACEP - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef OUROBOROS_LIB_CACEP_ANONYMOUS_AUTH_H -#define OUROBOROS_LIB_CACEP_ANONYMOUS_AUTH_H - -struct conn_info * cacep_anonymous_auth(int fd, - const struct conn_info * info, - const void * auth); - -struct conn_info * cacep_anonymous_auth_wait(int fd, - const struct conn_info * info, - const void * auth); - -#endif /* OUROBOROS_LIB_CACEP_ANONYMOUS_AUTH_H */ diff --git a/src/lib/pol/cacep_anonymous_auth.proto b/src/lib/pol/cacep_anonymous_auth.proto deleted file mode 100644 index 79734e28..00000000 --- a/src/lib/pol/cacep_anonymous_auth.proto +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Message for no authentication CACEP policy - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -syntax = "proto2"; - -import "cacep_proto.proto"; - -message cacep_anonymous_auth_msg { - required cacep_proto_msg proto = 1; -} \ No newline at end of file diff --git a/src/lib/pol/cacep_proto.c b/src/lib/pol/cacep_proto.c deleted file mode 100644 index 9990a05a..00000000 --- a/src/lib/pol/cacep_proto.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * CACEP - Read/Write Protocol info - * - * Sander Vrijders - * Dimitri Staessens - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include "cacep_proto.h" - -enum proto_concrete_syntax code_to_syntax(int code) -{ - switch(code) { - case PROTO_CONCRETE_SYNTAX_CODE__GPB: - return PROTO_GPB; - case PROTO_CONCRETE_SYNTAX_CODE__ASN_1: - return PROTO_ASN_1; - case PROTO_CONCRETE_SYNTAX_CODE__FIXED: - return PROTO_FIXED; - default: - return -1; - } -} - -int syntax_to_code(enum proto_concrete_syntax stx) -{ - switch(stx) { - case PROTO_GPB: - return PROTO_CONCRETE_SYNTAX_CODE__GPB; - case PROTO_ASN_1: - return PROTO_CONCRETE_SYNTAX_CODE__ASN_1; - case PROTO_FIXED: - return PROTO_CONCRETE_SYNTAX_CODE__FIXED; - default: - return -1; - } -} diff --git a/src/lib/pol/cacep_proto.h b/src/lib/pol/cacep_proto.h deleted file mode 100644 index bfb1b247..00000000 --- a/src/lib/pol/cacep_proto.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * CACEP - Convert syntax to msg code and back - * - * Sander Vrijders - * Dimitri Staessens - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef OUROBOROS_LIB_CACEP_CDAP_H -#define OUROBOROS_LIB_CACEP_CDAP_H - -#include -#include - -#include "cacep_proto.pb-c.h" - -enum proto_concrete_syntax code_to_syntax(int code); - -int syntax_to_code(enum proto_concrete_syntax stx); - -#endif /* OUROBOROS_LIB_CACEP_CDAP_H */ diff --git a/src/lib/pol/cacep_proto.proto b/src/lib/pol/cacep_proto.proto deleted file mode 100644 index f313bfc1..00000000 --- a/src/lib/pol/cacep_proto.proto +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Message for setting Protocol information in CACEP - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -syntax = "proto2"; - -enum proto_concrete_syntax_code { - GPB = 1; - ASN_1 = 2; - FIXED = 3; -} - -message cacep_proto_msg { - required string protocol = 1; - required int32 pref_version = 2; - repeated int32 supp_version = 3; - required proto_concrete_syntax_code pref_syntax = 4; - repeated proto_concrete_syntax_code supp_syntax = 5; -} diff --git a/src/lib/pol/cacep_simple_auth.c b/src/lib/pol/cacep_simple_auth.c deleted file mode 100644 index 69189114..00000000 --- a/src/lib/pol/cacep_simple_auth.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Simple authentication policy for CACEP - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include -#include -#include -#include - -#include "cacep_proto.h" -#include "cacep_simple_auth.h" - -#include -#include - -#include "cacep_simple_auth.pb-c.h" -typedef CacepSimpleAuthMsg cacep_simple_auth_msg_t; -typedef CacepProtoMsg cacep_proto_msg_t; - -#define BUF_SIZE 2048 - -static struct conn_info * read_msg(int fd) -{ - struct conn_info * tmp; - uint8_t buf[BUF_SIZE]; - cacep_simple_auth_msg_t * msg; - ssize_t len; - - len = flow_read(fd, buf, BUF_SIZE); - if (len < 0) - return NULL; - - msg = cacep_simple_auth_msg__unpack(NULL, len, buf); - if (msg == NULL) - return NULL; - - tmp = malloc(sizeof(*tmp)); - if (tmp == NULL) { - cacep_simple_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - conn_info_init(tmp); - - tmp->addr = msg->addr; - tmp->name = strdup(msg->name); - if (tmp->name == NULL) { - free(tmp); - cacep_simple_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - tmp->proto.protocol = strdup(msg->proto->protocol); - if (tmp->proto.protocol == NULL) { - conn_info_fini(tmp); - free(tmp); - cacep_simple_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - tmp->proto.pref_version = msg->proto->pref_version; - tmp->proto.pref_syntax = code_to_syntax(msg->proto->pref_syntax); - if (tmp->proto.pref_syntax < 0) { - conn_info_fini(tmp); - free(tmp); - cacep_simple_auth_msg__free_unpacked(msg, NULL); - return NULL; - } - - cacep_simple_auth_msg__free_unpacked(msg, NULL); - - return tmp; -} - -static int send_msg(int fd, - const struct conn_info * info) -{ - cacep_simple_auth_msg_t msg = CACEP_SIMPLE_AUTH_MSG__INIT; - cacep_proto_msg_t cmsg = CACEP_PROTO_MSG__INIT; - int ret = 0; - uint8_t * data = NULL; - size_t len = 0; - - cmsg.protocol = info->proto.protocol; - cmsg.pref_version = info->proto.pref_version; - cmsg.pref_syntax = syntax_to_code(info->proto.pref_syntax); - if (cmsg.pref_syntax < 0) - return -1; - - msg.proto = &cmsg; - msg.name = info->name; - msg.addr = info->addr; - - len = cacep_simple_auth_msg__get_packed_size(&msg); - if (len == 0) - return -1; - - data = malloc(len); - if (data == NULL) - return -ENOMEM; - - cacep_simple_auth_msg__pack(&msg, data); - - if (flow_write(fd, data, len) < 0) - ret = -1; - - free(data); - - return ret; -} - -struct conn_info * cacep_simple_auth_auth(int fd, - const struct conn_info * info, - const void * auth) -{ - struct conn_info * tmp; - - assert(info); - - /* This policy does not need info to authenticate */ - (void) auth; - - if (send_msg(fd, info)) - return NULL; - - tmp = read_msg(fd); - if (tmp == NULL) - return NULL; - - if (strcmp(info->proto.protocol, tmp->proto.protocol) || - info->proto.pref_version != tmp->proto.pref_version || - info->proto.pref_syntax != tmp->proto.pref_syntax) { - conn_info_fini(tmp); - free(tmp); - return NULL; - } - - return tmp; -} - - -struct conn_info * cacep_simple_auth_auth_wait(int fd, - const struct conn_info * info, - const void * auth) -{ - struct conn_info * tmp; - - assert(info); - - (void) auth; - - tmp = read_msg(fd); - if (tmp == NULL) - return NULL; - - if (send_msg(fd, info)) { - conn_info_fini(tmp); - free(tmp); - return NULL; - } - - if (strcmp(info->proto.protocol, tmp->proto.protocol) || - info->proto.pref_version != tmp->proto.pref_version || - info->proto.pref_syntax != tmp->proto.pref_syntax) { - conn_info_fini(tmp); - free(tmp); - return NULL; - } - - return tmp; -} diff --git a/src/lib/pol/cacep_simple_auth.h b/src/lib/pol/cacep_simple_auth.h deleted file mode 100644 index 31398a68..00000000 --- a/src/lib/pol/cacep_simple_auth.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Simple authentication policy for CACEP - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef OUROBOROS_LIB_CACEP_SIMPLE_AUTH_H -#define OUROBOROS_LIB_CACEP_SIMPLE_AUTH_H - -struct conn_info * cacep_simple_auth_auth(int fd, - const struct conn_info * info, - const void * auth); - -struct conn_info * cacep_simple_auth_auth_wait(int fd, - const struct conn_info * info, - const void * auth); - -#endif /* OUROBOROS_LIB_CACEP_SIMPLE_AUTH_H */ diff --git a/src/lib/pol/cacep_simple_auth.proto b/src/lib/pol/cacep_simple_auth.proto deleted file mode 100644 index 1a1e7ea8..00000000 --- a/src/lib/pol/cacep_simple_auth.proto +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Message for no authentication CACEP policy - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -syntax = "proto2"; - -import "cacep_proto.proto"; - -message cacep_simple_auth_msg { - required cacep_proto_msg proto = 1; - required string name = 2; - required uint64 addr = 3; -} -- cgit v1.2.3 From e6f5d45855b4a8091b52b3fc91451d2d132a5a6d Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Mon, 27 Feb 2017 22:59:52 +0100 Subject: lib: Split CACEP into request/response protocol --- include/ouroboros/cacep.h | 10 ++++----- src/ipcpd/normal/cdap_flow.c | 48 ++++++++++++++++++++++++++++++++++++++++---- src/ipcpd/normal/gam.c | 43 ++++++++++++++++++++++++++++++++++++--- src/lib/cacep.c | 32 ++++++----------------------- 4 files changed, 94 insertions(+), 39 deletions(-) (limited to 'include') diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h index 5ef66433..c7b7f38c 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cacep.h @@ -43,12 +43,10 @@ struct conn_info{ } ae; }; -int cacep_connect(int fd, - const struct conn_info * in, - struct conn_info * out); +int cacep_snd(int fd, + const struct conn_info * in); -int cacep_listen(int fd, - const struct conn_info * in, - struct conn_info * out); +int cacep_rcv(int fd, + struct conn_info * out); #endif /* OUROBOROS_CACEP_H */ diff --git a/src/ipcpd/normal/cdap_flow.c b/src/ipcpd/normal/cdap_flow.c index d3d98884..c694e637 100644 --- a/src/ipcpd/normal/cdap_flow.c +++ b/src/ipcpd/normal/cdap_flow.c @@ -67,12 +67,32 @@ struct cdap_flow * cdap_flow_arr(int fd, flow->fd = fd; flow->ci = NULL; - if (cacep_listen(fd, info, &flow->info)) { + if (cacep_rcv(fd, &flow->info)) { log_err("Error establishing application connection."); cdap_flow_destroy(flow); return NULL; } + if (cacep_snd(fd, info)) { + log_err("Failed to respond to application connection request."); + cdap_flow_destroy(flow); + return NULL; + } + + if (strcmp(flow->info.ae_name, info->ae_name)) { + log_err("Received connection for wrong AE."); + cdap_flow_destroy(flow); + return NULL; + } + + if (strcmp(flow->info.protocol, info->protocol) || + flow->info.pref_version != info->pref_version || + flow->info.pref_syntax != info->pref_syntax) { + log_err("Unknown protocol."); + cdap_flow_destroy(flow); + return NULL; + } + flow->ci = cdap_create(fd); if (flow->ci == NULL) { log_err("Failed to create CDAP instance."); @@ -87,8 +107,8 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name, qosspec_t * qs, const struct conn_info * info) { - struct cdap_flow * flow; - int fd; + struct cdap_flow * flow; + int fd; log_dbg("Allocating flow to %s.", dst_name); @@ -120,12 +140,32 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name, flow->fd = fd; flow->ci = NULL; - if (cacep_connect(fd, info, &flow->info)) { + if (cacep_snd(fd, info)) { + log_err("Failed to send connection request."); + cdap_flow_dealloc(flow); + return NULL; + } + + if (cacep_rcv(fd, &flow->info)) { log_err("Failed to connect to application."); cdap_flow_dealloc(flow); return NULL; } + if (strcmp(flow->info.ae_name, info->ae_name)) { + log_err("Received connection for wrong AE."); + cdap_flow_destroy(flow); + return NULL; + } + + if (strcmp(flow->info.protocol, info->protocol) || + flow->info.pref_version != info->pref_version || + flow->info.pref_syntax != info->pref_syntax) { + log_err("Unknown protocol."); + cdap_flow_destroy(flow); + return NULL; + } + flow->ci = cdap_create(fd); if (flow->ci == NULL) { log_err("Failed to create CDAP instance."); diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index bdfc8cb9..f98c0d4f 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -187,8 +187,30 @@ int gam_flow_arr(struct gam * instance, snd_info.pref_syntax = PROTO_GPB; snd_info.ae.addr = ipcpi.address; - if (cacep_listen(fd, &snd_info, rcv_info)) { - log_err("Failed to create application connection."); + if (cacep_rcv(fd, rcv_info)) { + log_err("Error establishing application connection."); + flow_dealloc(fd); + free(rcv_info); + return -1; + } + + if (cacep_snd(fd, &snd_info)) { + log_err("Failed to respond to application connection request."); + flow_dealloc(fd); + free(rcv_info); + return -1; + } + + if (strcmp(snd_info.ae_name, rcv_info->ae_name)) { + log_err("Received connection for wrong AE."); + flow_dealloc(fd); + free(rcv_info); + return -1; + } + + if (strcmp(snd_info.protocol, rcv_info->protocol) || + snd_info.pref_version != rcv_info->pref_version || + snd_info.pref_syntax != rcv_info->pref_syntax) { flow_dealloc(fd); free(rcv_info); return -1; @@ -246,13 +268,28 @@ int gam_flow_alloc(struct gam * instance, snd_info.pref_syntax = PROTO_GPB; snd_info.ae.addr = ipcpi.address; - if (cacep_connect(fd, &snd_info, rcv_info)) { + if (cacep_snd(fd, &snd_info)) { log_err("Failed to create application connection."); flow_dealloc(fd); free(rcv_info); return -1; } + if (cacep_rcv(fd, rcv_info)) { + log_err("Failed to connect to application."); + flow_dealloc(fd); + free(rcv_info); + return -1; + } + + if (strcmp(snd_info.protocol, rcv_info->protocol) || + snd_info.pref_version != rcv_info->pref_version || + snd_info.pref_syntax != rcv_info->pref_syntax) { + flow_dealloc(fd); + free(rcv_info); + return -1; + } + if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); free(rcv_info); diff --git a/src/lib/cacep.c b/src/lib/cacep.c index badeccc0..abff0aaa 100644 --- a/src/lib/cacep.c +++ b/src/lib/cacep.c @@ -93,46 +93,26 @@ static int send_msg(int fd, return 0; } -int cacep_connect(int fd, - const struct conn_info * in, - struct conn_info * out) +int cacep_snd(int fd, + const struct conn_info * in) { - if (in == NULL || out == NULL) + if (in == NULL) return -EINVAL; if (send_msg(fd, in)) return -1; - if (read_msg(fd, out)) - return -1; - - if (strcmp(in->ae_name, out->ae_name) || - strcmp(in->protocol, out->protocol) || - in->pref_version != out->pref_version || - in->pref_syntax != out->pref_syntax) - return -EPROTO; - return 0; } -int cacep_listen(int fd, - const struct conn_info * in, - struct conn_info * out) +int cacep_rcv(int fd, + struct conn_info * out) { - if (in == NULL || out == NULL) + if (out == NULL) return -EINVAL; - if (send_msg(fd, in)) - return -1; - if (read_msg(fd, out)) return -1; - if (strcmp(in->ae_name, out->ae_name) || - strcmp(in->protocol, out->protocol) || - in->pref_version != out->pref_version || - in->pref_syntax != out->pref_syntax) - return -EPROTO; - return 0; } -- cgit v1.2.3 From 9d2fbef7b8569aac930c95ca1afb92a5dec79dac Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 2 Mar 2017 15:29:11 +0100 Subject: ipcpd: normal: Add connection manager This adds the connection manager which allows the different AEs of the normal IPCP to register with it. An AE can then use the connection manager to allocate a flow to a neighbor, or to wait for a new connection from a neighbor. --- include/ouroboros/cacep.h | 7 +- src/ipcpd/ipcp.h | 2 +- src/ipcpd/normal/CMakeLists.txt | 1 + src/ipcpd/normal/connmgr.c | 350 ++++++++++++++++++++++++++++++++++++++++ src/ipcpd/normal/connmgr.h | 57 +++++++ src/ipcpd/normal/enroll.c | 2 +- src/ipcpd/normal/fmgr.c | 2 +- src/ipcpd/normal/frct.c | 8 +- src/ipcpd/normal/gam.c | 4 +- src/ipcpd/normal/main.c | 93 +++-------- src/ipcpd/normal/pol/complete.c | 13 +- src/lib/cacep.c | 3 + src/lib/cacep.proto | 1 + 13 files changed, 452 insertions(+), 91 deletions(-) create mode 100644 src/ipcpd/normal/connmgr.c create mode 100644 src/ipcpd/normal/connmgr.h (limited to 'include') diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h index c7b7f38c..b6fb8625 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cacep.h @@ -32,15 +32,12 @@ enum proto_concrete_syntax { PROTO_FIXED }; -struct conn_info{ +struct conn_info { char ae_name[64]; char protocol[64]; uint32_t pref_version; enum proto_concrete_syntax pref_syntax; - union { - char name[64]; - uint64_t addr; - } ae; + uint64_t addr; }; int cacep_snd(int fd, diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index d0b5e022..07c72791 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -65,7 +65,7 @@ struct ipcp { enum ipcp_type type; char * dif_name; - uint64_t address; + uint64_t dt_addr; struct ipcp_ops * ops; int irmd_fd; diff --git a/src/ipcpd/normal/CMakeLists.txt b/src/ipcpd/normal/CMakeLists.txt index 7e10cc0d..70742336 100644 --- a/src/ipcpd/normal/CMakeLists.txt +++ b/src/ipcpd/normal/CMakeLists.txt @@ -20,6 +20,7 @@ set(SOURCE_FILES # Add source files here addr_auth.c cdap_flow.c + connmgr.c dir.c enroll.c fmgr.c diff --git a/src/ipcpd/normal/connmgr.c b/src/ipcpd/normal/connmgr.c new file mode 100644 index 00000000..387c38fd --- /dev/null +++ b/src/ipcpd/normal/connmgr.c @@ -0,0 +1,350 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Handles the different AP connections + * + * Sander Vrijders + * Dimitri Staessens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define OUROBOROS_PREFIX "normal-ipcp" + +#include +#include +#include +#include +#include +#include + +#include "ae.h" +#include "connmgr.h" +#include "enroll.h" +#include "fmgr.h" +#include "frct.h" +#include "ipcp.h" +#include "ribmgr.h" + +#include +#include +#include +#include + +#define FRCT_PROTO "frct" + +struct ae_conn { + struct list_head next; + struct conn conn; +}; + +struct ae { + struct list_head next; + struct conn_info info; + + struct list_head conn_list; + pthread_cond_t conn_cond; + pthread_mutex_t conn_lock; +}; + +struct { + pthread_t acceptor; + + struct list_head aes; + pthread_mutex_t aes_lock; +} connmgr; + +static int add_ae_conn(struct ae * ae, + int fd, + qosspec_t qs, + struct conn_info * rcv_info) +{ + struct ae_conn * ae_conn = NULL; + + ae_conn = malloc(sizeof(*ae_conn)); + if (ae_conn == NULL) { + log_err("Not enough memory."); + return -1; + } + + ae_conn->conn.conn_info = *rcv_info; + ae_conn->conn.flow_info.fd = fd; + ae_conn->conn.flow_info.qs = qs; + + list_head_init(&ae_conn->next); + + pthread_mutex_lock(&ae->conn_lock); + list_add(&ae_conn->next, &ae->conn_list); + pthread_cond_signal(&ae->conn_cond); + pthread_mutex_unlock(&ae->conn_lock); + + return 0; +} + +static struct ae * find_ae_by_name(char * name) +{ + struct list_head * p = NULL; + + list_for_each(p, &connmgr.aes) { + struct ae * ae = list_entry(p, struct ae, next); + if (strcmp(ae->info.ae_name, name) == 0) + return ae; + } + + return NULL; +} + +static void * flow_acceptor(void * o) +{ + int fd; + qosspec_t qs; + struct conn_info rcv_info; + struct conn_info fail_info; + struct ae * ae = NULL; + + (void) o; + + memset(&fail_info, 0, sizeof(fail_info)); + + while (true) { + pthread_rwlock_rdlock(&ipcpi.state_lock); + + if (ipcp_get_state() != IPCP_OPERATIONAL) { + pthread_rwlock_unlock(&ipcpi.state_lock); + log_info("Shutting down flow acceptor."); + return 0; + } + + pthread_rwlock_unlock(&ipcpi.state_lock); + + fd = flow_accept(&qs); + if (fd < 0) { + if (fd != -EIRMD) + log_warn("Flow accept failed: %d", fd); + continue; + } + + if (flow_alloc_resp(fd, 0)) { + log_err("Failed to respond to flow alloc request."); + continue; + } + + if (cacep_rcv(fd, &rcv_info)) { + log_err("Error establishing application connection."); + flow_dealloc(fd); + continue; + } + + pthread_mutex_lock(&connmgr.aes_lock); + ae = find_ae_by_name(rcv_info.ae_name); + pthread_mutex_unlock(&connmgr.aes_lock); + + if (ae != NULL) { + if (cacep_snd(fd, &ae->info)) { + log_err("Failed to respond to req."); + flow_dealloc(fd); + continue; + } + + if (add_ae_conn(ae, fd, qs, &rcv_info)) { + log_err("Failed to add ae conn."); + flow_dealloc(fd); + continue; + } + } else { + cacep_snd(fd, &fail_info); + flow_dealloc(fd); + } + } + + return (void *) 0; +} + +int connmgr_init(void) +{ + list_head_init(&connmgr.aes); + + if (pthread_mutex_init(&connmgr.aes_lock, NULL)) + return -1; + + return 0; +} + +int connmgr_start(void) +{ + pthread_create(&connmgr.acceptor, NULL, flow_acceptor, NULL); + + return 0; +} + +void connmgr_stop(void) +{ + pthread_cancel(connmgr.acceptor); + pthread_join(connmgr.acceptor, NULL); +} + +void connmgr_fini(void) +{ + struct list_head * p = NULL; + struct list_head * n = NULL; + + pthread_mutex_lock(&connmgr.aes_lock); + + list_for_each_safe(p, n, &connmgr.aes) { + struct ae * e = list_entry(p, struct ae, next); + connmgr_ae_destroy(e); + } + + pthread_mutex_unlock(&connmgr.aes_lock); + + pthread_mutex_destroy(&connmgr.aes_lock); +} + +struct ae * connmgr_ae_create(struct conn_info info) +{ + struct ae * ae; + + ae = malloc(sizeof(*ae)); + if (ae == NULL) + return NULL; + + list_head_init(&ae->next); + list_head_init(&ae->conn_list); + + ae->info = info; + + if (pthread_mutex_init(&ae->conn_lock, NULL)) { + free(ae); + return NULL; + } + + if (pthread_cond_init(&ae->conn_cond, NULL)) { + pthread_mutex_destroy(&ae->conn_lock); + free(ae); + return NULL; + } + + pthread_mutex_lock(&connmgr.aes_lock); + list_add(&ae->next, &connmgr.aes); + pthread_mutex_unlock(&connmgr.aes_lock); + + return ae; +} + +void connmgr_ae_destroy(struct ae * ae) +{ + struct list_head * p = NULL; + struct list_head * n = NULL; + + assert(ae); + + pthread_mutex_lock(&connmgr.aes_lock); + pthread_mutex_lock(&ae->conn_lock); + + list_for_each_safe(p, n, &ae->conn_list) { + struct ae_conn * e = list_entry(p, struct ae_conn, next); + list_del(&e->next); + free(e); + } + + pthread_mutex_unlock(&ae->conn_lock); + + pthread_cond_destroy(&ae->conn_cond); + pthread_mutex_destroy(&ae->conn_lock); + + list_del(&ae->next); + + pthread_mutex_unlock(&connmgr.aes_lock); + + free(ae); +} + +int connmgr_alloc(struct ae * ae, + char * dst_name, + qosspec_t qs, + struct conn * conn) +{ + assert(ae); + assert(dst_name); + assert(conn); + + memset(&conn->conn_info, 0, sizeof(conn->conn_info)); + + conn->flow_info.fd = flow_alloc(dst_name, &qs); + if (conn->flow_info.fd < 0) { + log_err("Failed to allocate flow to %s.", dst_name); + return -1; + } + + conn->flow_info.qs = qs; + + if (flow_alloc_res(conn->flow_info.fd)) { + log_err("Flow allocation to %s failed.", dst_name); + flow_dealloc(conn->flow_info.fd); + return -1; + } + + if (cacep_snd(conn->flow_info.fd, &ae->info)) { + log_err("Failed to create application connection."); + flow_dealloc(conn->flow_info.fd); + return -1; + } + + if (cacep_rcv(conn->flow_info.fd, &conn->conn_info)) { + log_err("Failed to connect to application."); + flow_dealloc(conn->flow_info.fd); + return -1; + } + + if (strcmp(ae->info.protocol, conn->conn_info.protocol) || + ae->info.pref_version != conn->conn_info.pref_version || + ae->info.pref_syntax != conn->conn_info.pref_syntax) { + flow_dealloc(conn->flow_info.fd); + return -1; + } + + return 0; +} + +int connmgr_wait(struct ae * ae, + struct conn * conn) +{ + struct ae_conn * ae_conn; + + assert(ae); + assert(conn); + + pthread_mutex_lock(&ae->conn_lock); + + pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock, + (void *) &ae->conn_lock); + + while (list_is_empty(&ae->conn_list)) + pthread_cond_wait(&ae->conn_cond, &ae->conn_lock); + + ae_conn = list_first_entry((&ae->conn_list), struct ae_conn, next); + if (ae_conn == NULL) { + pthread_mutex_unlock(&ae->conn_lock); + return -1; + } + + *conn = ae_conn->conn; + + list_del(&ae_conn->next); + free(ae_conn); + + pthread_cleanup_pop(true); + + return 0; +} diff --git a/src/ipcpd/normal/connmgr.h b/src/ipcpd/normal/connmgr.h new file mode 100644 index 00000000..bfb3d762 --- /dev/null +++ b/src/ipcpd/normal/connmgr.h @@ -0,0 +1,57 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Handles the different AP connections + * + * Sander Vrijders + * Dimitri Staessens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef OUROBOROS_IPCPD_NORMAL_CONNMGR_H +#define OUROBOROS_IPCPD_NORMAL_CONNMGR_H + +#include +#include + +struct conn { + struct conn_info conn_info; + struct flow_info { + int fd; + qosspec_t qs; + } flow_info; +}; + +int connmgr_init(void); + +void connmgr_fini(void); + +int connmgr_start(void); + +void connmgr_stop(void); + +struct ae * connmgr_ae_create(struct conn_info info); + +void connmgr_ae_destroy(struct ae * ae); + +int connmgr_alloc(struct ae * ae, + char * dst_name, + qosspec_t qs, + struct conn * conn); + +int connmgr_wait(struct ae * ae, + struct conn * conn); + +#endif /* OUROBOROS_IPCPD_NORMAL_CONNMGR_H */ diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index 5c7ebd7e..9c3b9973 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -197,7 +197,7 @@ int enroll_boot(char * dst_name) delta_t = ts_diff_ms(&t0, &rtt); - assert (len == 2 * sizeof (uint64_t)); + assert(len == 2 * sizeof (uint64_t)); rtt.tv_sec = ntoh64(((uint64_t *) data)[0]); rtt.tv_nsec = ntoh64(((uint64_t *) data)[1]); diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 0c927fc7..34724ddd 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -162,7 +162,7 @@ void * fmgr_nm1_sdu_reader(void * o) shm_pci_des(sdb, &pci); - if (pci.dst_addr != ipcpi.address) { + if (pci.dst_addr != ipcpi.dt_addr) { log_dbg("PDU needs to be forwarded."); if (pci.ttl == 0) { diff --git a/src/ipcpd/normal/frct.c b/src/ipcpd/normal/frct.c index 915feaf8..c9b23060 100644 --- a/src/ipcpd/normal/frct.c +++ b/src/ipcpd/normal/frct.c @@ -285,7 +285,7 @@ cep_id_t frct_i_create(uint64_t address, pci.pdu_type = PDU_TYPE_MGMT; pci.dst_addr = address; - pci.src_addr = ipcpi.address; + pci.src_addr = ipcpi.dt_addr; pci.dst_cep_id = 0; pci.src_cep_id = id; pci.seqno = 0; @@ -330,7 +330,7 @@ int frct_i_accept(cep_id_t id, pci.pdu_type = PDU_TYPE_MGMT; pci.dst_addr = instance->r_address; - pci.src_addr = ipcpi.address; + pci.src_addr = ipcpi.dt_addr; pci.dst_cep_id = instance->r_cep_id; pci.src_cep_id = instance->cep_id; pci.seqno = 0; @@ -367,7 +367,7 @@ int frct_i_destroy(cep_id_t id, pci.pdu_type = PDU_TYPE_MGMT; pci.dst_addr = instance->r_address; - pci.src_addr = ipcpi.address; + pci.src_addr = ipcpi.dt_addr; pci.dst_cep_id = instance->r_cep_id; pci.src_cep_id = instance->cep_id; pci.seqno = 0; @@ -413,7 +413,7 @@ int frct_i_write_sdu(cep_id_t id, pci.pdu_type = PDU_TYPE_DTP; pci.dst_addr = instance->r_address; - pci.src_addr = ipcpi.address; + pci.src_addr = ipcpi.dt_addr; pci.dst_cep_id = instance->r_cep_id; pci.src_cep_id = instance->cep_id; pci.seqno = (instance->seqno)++; diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index f98c0d4f..212cfd83 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -185,7 +185,7 @@ int gam_flow_arr(struct gam * instance, strcpy(snd_info.protocol, CDAP_PROTO); snd_info.pref_version = 1; snd_info.pref_syntax = PROTO_GPB; - snd_info.ae.addr = ipcpi.address; + snd_info.addr = ipcpi.dt_addr; if (cacep_rcv(fd, rcv_info)) { log_err("Error establishing application connection."); @@ -266,7 +266,7 @@ int gam_flow_alloc(struct gam * instance, strcpy(snd_info.protocol, CDAP_PROTO); snd_info.pref_version = 1; snd_info.pref_syntax = PROTO_GPB; - snd_info.ae.addr = ipcpi.address; + snd_info.addr = ipcpi.dt_addr; if (cacep_snd(fd, &snd_info)) { log_err("Failed to create application connection."); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index c75a74d6..3e5907a8 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -33,11 +32,10 @@ #include #include "addr_auth.h" -#include "ae.h" +#include "connmgr.h" #include "dir.h" #include "enroll.h" #include "fmgr.h" -#include "frct.h" #include "ipcp.h" #include "ribconfig.h" #include "ribmgr.h" @@ -45,16 +43,11 @@ #include #include #include -#include #include #include #include -#define THIS_TYPE IPCP_NORMAL - -struct { - pthread_t acceptor; -} normal; +#define THIS_TYPE IPCP_NORMAL void ipcp_sig_handler(int sig, siginfo_t * info, @@ -82,53 +75,6 @@ void ipcp_sig_handler(int sig, } } -static void * flow_acceptor(void * o) -{ - int fd; - qosspec_t qs; - /* FIXME: Remove once correct AE is known. */ - char * ae_name = ENROLL_AE; - - (void) o; - - while (true) { - pthread_rwlock_rdlock(&ipcpi.state_lock); - - if (ipcp_get_state() != IPCP_OPERATIONAL) { - pthread_rwlock_unlock(&ipcpi.state_lock); - log_info("Shutting down flow acceptor."); - return 0; - } - - pthread_rwlock_unlock(&ipcpi.state_lock); - - fd = flow_accept(&qs); - if (fd < 0) { - if (fd != -EIRMD) - log_warn("Flow accept failed: %d", fd); - continue; - } - - /* FIXME: Perform CACEP at this point */ - - if (strcmp(ae_name, ENROLL_AE) == 0) { - enroll_handle(fd); - } else if (strcmp(ae_name, MGMT_AE) == 0) { - ribmgr_flow_arr(fd, qs); - } else if (strcmp(ae_name, DT_AE) == 0) { - fmgr_nm1_flow_arr(fd, qs); - } else { - log_dbg("Flow allocation request for unknown AE %s.", - ae_name); - if (flow_alloc_resp(fd, -1)) - log_warn("Failed to reply to flow allocation."); - flow_dealloc(fd); - } - } - - return (void *) 0; -} - /* * Boots the IPCP off information in the rib. * Common function after bootstrap or enroll. @@ -153,15 +99,21 @@ static int boot_components(void) } if (rib_add(MEMBERS_PATH, ipcpi.name)) { - log_warn("Failed to add name to " MEMBERS_PATH); + log_err("Failed to add name to " MEMBERS_PATH); return -1; } log_dbg("Starting components."); + if (connmgr_init()) { + log_err("Failed to init ap connection manager"); + return -1; + } + if (rib_read(BOOT_PATH "/addr_auth/type", &pa, sizeof(pa)) != sizeof(pa)) { log_err("Failed to read policy for address authority."); + connmgr_fini(); return -1; } @@ -170,20 +122,22 @@ static int boot_components(void) return -1; } - ipcpi.address = addr_auth_address(); - if (ipcpi.address == 0) { + ipcpi.dt_addr = addr_auth_address(); + if (ipcpi.dt_addr == 0) { log_err("Failed to get a valid address."); addr_auth_fini(); + connmgr_fini(); return -1; } - log_dbg("IPCP got address %" PRIu64 ".", ipcpi.address); + log_dbg("IPCP got address %" PRIu64 ".", ipcpi.dt_addr); log_dbg("Starting ribmgr."); if (ribmgr_init()) { log_err("Failed to initialize RIB manager."); addr_auth_fini(); + connmgr_fini(); return -1; } @@ -191,6 +145,7 @@ static int boot_components(void) log_err("Failed to initialize directory."); ribmgr_fini(); addr_auth_fini(); + connmgr_fini(); return -1; } @@ -200,6 +155,7 @@ static int boot_components(void) dir_fini(); ribmgr_fini(); addr_auth_fini(); + connmgr_fini(); log_err("Failed to start flow manager."); return -1; } @@ -209,19 +165,21 @@ static int boot_components(void) dir_fini(); ribmgr_fini(); addr_auth_fini(); + connmgr_fini(); log_err("Failed to initialize FRCT."); return -1; } ipcp_set_state(IPCP_OPERATIONAL); - if (pthread_create(&normal.acceptor, NULL, flow_acceptor, NULL)) { + if (connmgr_start()) { ipcp_set_state(IPCP_INIT); fmgr_fini(); dir_fini(); ribmgr_fini(); addr_auth_fini(); - log_err("Failed to create acceptor thread."); + connmgr_fini(); + log_err("Failed to start AP connection manager."); return -1; } @@ -230,8 +188,7 @@ static int boot_components(void) void shutdown_components(void) { - pthread_cancel(normal.acceptor); - pthread_join(normal.acceptor, NULL); + connmgr_stop(); frct_fini(); @@ -242,6 +199,8 @@ void shutdown_components(void) ribmgr_fini(); addr_auth_fini(); + + connmgr_fini(); } static int normal_ipcp_enroll(char * dst_name) @@ -410,9 +369,9 @@ static struct ipcp_ops normal_ops = { .ipcp_name_reg = dir_name_reg, .ipcp_name_unreg = dir_name_unreg, .ipcp_name_query = dir_name_query, - .ipcp_flow_alloc = NULL, /* fmgr_np1_alloc, */ - .ipcp_flow_alloc_resp = NULL, /* fmgr_np1_alloc_resp, */ - .ipcp_flow_dealloc = NULL, /* fmgr_np1_dealloc */ + .ipcp_flow_alloc = fmgr_np1_alloc, + .ipcp_flow_alloc_resp = fmgr_np1_alloc_resp, + .ipcp_flow_dealloc = fmgr_np1_dealloc }; int main(int argc, diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index 68f43e81..daf8c9bf 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -38,7 +38,7 @@ struct neighbor { struct list_head next; - char * neighbor; + uint64_t neighbor; }; struct complete { @@ -135,7 +135,6 @@ void complete_destroy(void * o) list_for_each_safe(p, n, &complete->neighbors) { struct neighbor * e = list_entry(p, struct neighbor, next); list_del(&e->next); - free(e->neighbor); free(e); } @@ -168,7 +167,7 @@ int complete_accept_flow(void * o, list_for_each(pos, &complete->neighbors) { struct neighbor * e = list_entry(pos, struct neighbor, next); /* FIXME: figure out union type and check name or address */ - if (strcmp(e->neighbor, info->ae.name) == 0) { + if (e->neighbor == info->addr) { pthread_mutex_unlock(&complete->neighbors_lock); return -1; } @@ -186,13 +185,7 @@ int complete_accept_flow(void * o, list_head_init(&n->next); - /* FIXME: figure out union type and check name or address */ - n->neighbor = strdup(info->ae.name); - if (n->neighbor == NULL) { - pthread_mutex_unlock(&complete->neighbors_lock); - free(n); - return -1; - } + n->neighbor = info->addr; list_add(&n->next, &complete->neighbors); diff --git a/src/lib/cacep.c b/src/lib/cacep.c index abff0aaa..a2c5c3d2 100644 --- a/src/lib/cacep.c +++ b/src/lib/cacep.c @@ -49,10 +49,12 @@ int read_msg(int fd, if (msg == NULL) return -1; + strcpy(info->ae_name, msg->ae_name); strcpy(info->protocol, msg->protocol); info->pref_version = msg->pref_version; info->pref_syntax = msg->pref_syntax; + info->addr = msg->address; cacep_msg__free_unpacked(msg, NULL); @@ -68,6 +70,7 @@ static int send_msg(int fd, msg.ae_name = (char *) info->ae_name; msg.protocol = (char *) info->protocol; + msg.address = info->addr; msg.pref_version = info->pref_version; msg.pref_syntax = info->pref_syntax; if (msg.pref_syntax < 0) diff --git a/src/lib/cacep.proto b/src/lib/cacep.proto index 3e1291f6..cdeaa0b7 100644 --- a/src/lib/cacep.proto +++ b/src/lib/cacep.proto @@ -30,4 +30,5 @@ message cacep_msg { repeated int32 supp_version = 4; required int32 pref_syntax = 5; repeated int32 supp_syntax = 6; + required uint64 address = 7; } \ No newline at end of file -- cgit v1.2.3 From 13e438d5bc2350cf3d71a77f6d3c5a54ba436161 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 3 Mar 2017 14:42:22 +0100 Subject: lib: Install cacep.h on install cacep.h was not installed on install, but other applications may want to use it as well. --- include/ouroboros/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index d1a3166c..a8589da1 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -3,6 +3,7 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/config.h") set(HEADER_FILES + cacep.h cdap.h dev.h endian.h -- cgit v1.2.3 From c9fb31c7ebadc076b7c3bfd9dbe1c492c6ef7172 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 3 Mar 2017 15:31:42 +0100 Subject: Change email addresses to ugent.be Our mailserver was migrated from intec.ugent.be to the central ugent.be emailserver. This PR updates the header files to reflect this change as well. Some header files were also homogenized if the parameters within the functions were badly aligned. --- include/ouroboros/bitmap.h | 4 +- include/ouroboros/cacep.h | 4 +- include/ouroboros/cdap.h | 4 +- include/ouroboros/crc32.h | 3 +- include/ouroboros/dev.h | 3 +- include/ouroboros/endian.h | 4 +- include/ouroboros/errno.h | 3 +- include/ouroboros/fcntl.h | 3 +- include/ouroboros/fqueue.h | 4 +- include/ouroboros/hashtable.h | 3 +- include/ouroboros/ipcp-dev.h | 4 +- include/ouroboros/irm.h | 3 +- include/ouroboros/irm_config.h | 3 +- include/ouroboros/list.h | 4 +- include/ouroboros/local-dev.h | 3 +- include/ouroboros/lockfile.h | 6 ++- include/ouroboros/logs.h | 5 +-- include/ouroboros/np1_flow.h | 3 +- include/ouroboros/nsm.h | 3 +- include/ouroboros/qos.h | 3 +- include/ouroboros/rib.h | 4 +- include/ouroboros/rqueue.h | 4 +- include/ouroboros/shared.h | 3 +- include/ouroboros/shm_flow_set.h | 3 +- include/ouroboros/shm_rbuff.h | 9 +++-- include/ouroboros/shm_rdrbuff.h | 4 +- include/ouroboros/sockets.h | 3 +- include/ouroboros/time_utils.h | 6 ++- include/ouroboros/utils.h | 6 +-- src/ipcpd/ipcp.c | 3 +- src/ipcpd/ipcp.h | 3 +- src/ipcpd/local/main.c | 3 +- src/ipcpd/normal/addr_auth.c | 4 +- src/ipcpd/normal/addr_auth.h | 4 +- src/ipcpd/normal/ae.h | 4 +- src/ipcpd/normal/connmgr.c | 2 +- src/ipcpd/normal/connmgr.h | 2 +- src/ipcpd/normal/dir.c | 4 +- src/ipcpd/normal/dir.h | 3 +- src/ipcpd/normal/dt_const.h | 4 +- src/ipcpd/normal/enroll.c | 3 +- src/ipcpd/normal/enroll.h | 3 +- src/ipcpd/normal/fmgr.c | 3 +- src/ipcpd/normal/fmgr.h | 3 +- src/ipcpd/normal/frct.c | 3 +- src/ipcpd/normal/frct.h | 3 +- src/ipcpd/normal/gam.c | 4 +- src/ipcpd/normal/gam.h | 4 +- src/ipcpd/normal/main.c | 4 +- src/ipcpd/normal/neighbors.c | 4 +- src/ipcpd/normal/neighbors.h | 4 +- src/ipcpd/normal/pff.c | 3 +- src/ipcpd/normal/pff.h | 4 +- src/ipcpd/normal/pol-addr-auth-ops.h | 4 +- src/ipcpd/normal/pol-gam-ops.h | 4 +- src/ipcpd/normal/pol/complete.c | 4 +- src/ipcpd/normal/pol/complete.h | 4 +- src/ipcpd/normal/pol/flat.c | 4 +- src/ipcpd/normal/pol/flat.h | 3 +- src/ipcpd/normal/ribmgr.c | 4 +- src/ipcpd/normal/ribmgr.h | 3 +- src/ipcpd/normal/routing.c | 4 +- src/ipcpd/normal/routing.h | 4 +- src/ipcpd/normal/shm_pci.c | 4 +- src/ipcpd/normal/shm_pci.h | 4 +- src/ipcpd/shim-data.c | 4 +- src/ipcpd/shim-data.h | 4 +- src/ipcpd/shim-eth-llc/main.c | 3 +- src/ipcpd/shim-udp/main.c | 3 +- src/ipcpd/shim-udp/tests/shim_udp_test.c | 3 +- src/ipcpd/tests/timerwheel_test.c | 3 +- src/ipcpd/timerwheel.c | 3 +- src/ipcpd/timerwheel.h | 9 +++-- src/irmd/api_table.c | 3 +- src/irmd/api_table.h | 3 +- src/irmd/apn_table.c | 3 +- src/irmd/apn_table.h | 3 +- src/irmd/ipcp.c | 3 +- src/irmd/ipcp.h | 3 +- src/irmd/irm_flow.c | 3 +- src/irmd/irm_flow.h | 3 +- src/irmd/main.c | 4 +- src/irmd/registry.c | 3 +- src/irmd/registry.h | 3 +- src/irmd/utils.c | 4 +- src/irmd/utils.h | 4 +- src/lib/bitmap.c | 4 +- src/lib/btree.c | 4 +- src/lib/btree.h | 3 +- src/lib/cdap.c | 3 +- src/lib/cdap_req.c | 4 +- src/lib/cdap_req.h | 4 +- src/lib/crc32.c | 3 +- src/lib/dev.c | 4 +- src/lib/hashtable.c | 3 +- src/lib/irm.c | 3 +- src/lib/list.c | 4 +- src/lib/lockfile.c | 3 +- src/lib/logs.c | 4 +- src/lib/nsm.c | 3 +- src/lib/rib.c | 4 +- src/lib/sha3.c | 3 ++ src/lib/sha3.h | 3 +- src/lib/shm_flow_set.c | 3 +- src/lib/shm_rbuff.c | 3 +- src/lib/shm_rdrbuff.c | 4 +- src/lib/sockets.c | 3 +- src/lib/tests/bitmap_test.c | 3 +- src/lib/tests/btree_test.c | 3 +- src/lib/tests/crc32_test.c | 3 +- src/lib/tests/hashtable_test.c | 3 +- src/lib/tests/rib_test.c | 3 +- src/lib/tests/sha3_test.c | 3 +- src/lib/time_utils.c | 3 +- src/lib/utils.c | 3 +- src/nsmd/main.c | 26 ++++++++++++- src/tools/cbr/cbr.c | 4 +- src/tools/cbr/cbr_client.c | 4 +- src/tools/cbr/cbr_server.c | 4 +- src/tools/echo/echo.c | 3 +- src/tools/echo/echo_client.c | 3 +- src/tools/echo/echo_server.c | 3 +- src/tools/irm/irm.c | 3 +- src/tools/irm/irm_bind.c | 4 +- src/tools/irm/irm_bind_ap.c | 4 +- src/tools/irm/irm_bind_api.c | 4 +- src/tools/irm/irm_bind_ipcp.c | 4 +- src/tools/irm/irm_ipcp.c | 3 +- src/tools/irm/irm_ipcp_bootstrap.c | 3 +- src/tools/irm/irm_ipcp_create.c | 3 +- src/tools/irm/irm_ipcp_destroy.c | 3 +- src/tools/irm/irm_ipcp_enroll.c | 3 +- src/tools/irm/irm_ops.h | 63 +++++++++++++++++++++++--------- src/tools/irm/irm_register.c | 4 +- src/tools/irm/irm_unbind.c | 4 +- src/tools/irm/irm_unbind_ap.c | 4 +- src/tools/irm/irm_unbind_api.c | 4 +- src/tools/irm/irm_unbind_ipcp.c | 4 +- src/tools/irm/irm_unregister.c | 4 +- src/tools/irm/irm_utils.c | 3 +- src/tools/irm/irm_utils.h | 6 ++- src/tools/operf/operf.c | 4 +- src/tools/operf/operf_client.c | 4 +- src/tools/operf/operf_server.c | 4 +- src/tools/oping/oping.c | 4 +- src/tools/oping/oping_client.c | 4 +- src/tools/oping/oping_server.c | 4 +- 147 files changed, 374 insertions(+), 238 deletions(-) (limited to 'include') diff --git a/include/ouroboros/bitmap.h b/include/ouroboros/bitmap.h index d6ce623a..cb62312a 100644 --- a/include/ouroboros/bitmap.h +++ b/include/ouroboros/bitmap.h @@ -3,8 +3,8 @@ * * Bitmap implementation * - * Sander Vrijders - * Francesco Salvestrini + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h index b6fb8625..950f3cf7 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cacep.h @@ -3,8 +3,8 @@ * * The Common Application Connection Establishment Protocol * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h index cc04cf27..19ab39a8 100644 --- a/include/ouroboros/cdap.h +++ b/include/ouroboros/cdap.h @@ -3,8 +3,8 @@ * * The Common Distributed Application Protocol * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/crc32.h b/include/ouroboros/crc32.h index 3c7721de..dccdf7cb 100644 --- a/include/ouroboros/crc32.h +++ b/include/ouroboros/crc32.h @@ -3,7 +3,8 @@ * * 32-bit Cyclic Redundancy Check * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h index c4d2cb16..e92cdd1c 100644 --- a/include/ouroboros/dev.h +++ b/include/ouroboros/dev.h @@ -3,7 +3,8 @@ * * API for applications * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/endian.h b/include/ouroboros/endian.h index 46f384ec..d712b1b3 100644 --- a/include/ouroboros/endian.h +++ b/include/ouroboros/endian.h @@ -3,8 +3,8 @@ * * Endianness * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/errno.h b/include/ouroboros/errno.h index 600f016f..d2117992 100644 --- a/include/ouroboros/errno.h +++ b/include/ouroboros/errno.h @@ -3,7 +3,8 @@ * * Ouroboros specific error numbers * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/fcntl.h b/include/ouroboros/fcntl.h index 7ee4229e..c07b7bf0 100644 --- a/include/ouroboros/fcntl.h +++ b/include/ouroboros/fcntl.h @@ -3,7 +3,8 @@ * * Flows * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/fqueue.h b/include/ouroboros/fqueue.h index fdd2cbfb..fc7dc303 100644 --- a/include/ouroboros/fqueue.h +++ b/include/ouroboros/fqueue.h @@ -3,8 +3,8 @@ * * Flow queues * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/hashtable.h b/include/ouroboros/hashtable.h index 4cb6000d..81fbcc1a 100644 --- a/include/ouroboros/hashtable.h +++ b/include/ouroboros/hashtable.h @@ -3,7 +3,8 @@ * * Hash table with integer keys with separate chaining on collisions * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index fc82f374..6cad9a87 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -3,8 +3,8 @@ * * Additional API for IPCPs * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h index 07052727..9bd0c93b 100644 --- a/include/ouroboros/irm.h +++ b/include/ouroboros/irm.h @@ -3,7 +3,8 @@ * * The API to instruct the IPC Resource Manager * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/irm_config.h b/include/ouroboros/irm_config.h index 5e3c84b4..3dd55823 100644 --- a/include/ouroboros/irm_config.h +++ b/include/ouroboros/irm_config.h @@ -3,7 +3,8 @@ * * Configuration information for the IPC Resource Manager * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/list.h b/include/ouroboros/list.h index 5f246775..5da93b9a 100644 --- a/include/ouroboros/list.h +++ b/include/ouroboros/list.h @@ -3,8 +3,8 @@ * * Simple doubly linked list implementation. * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/local-dev.h b/include/ouroboros/local-dev.h index 3c95e589..228a2a98 100644 --- a/include/ouroboros/local-dev.h +++ b/include/ouroboros/local-dev.h @@ -3,7 +3,8 @@ * * Optimized calls for the local IPCPs * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/lockfile.h b/include/ouroboros/lockfile.h index 561e31ab..1b988092 100644 --- a/include/ouroboros/lockfile.h +++ b/include/ouroboros/lockfile.h @@ -3,7 +3,8 @@ * * Lockfile for Ouroboros * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -28,8 +29,11 @@ struct lockfile; struct lockfile * lockfile_create(void); + struct lockfile * lockfile_open(void); + void lockfile_close(struct lockfile * lf); + void lockfile_destroy(struct lockfile * lf); pid_t lockfile_owner(struct lockfile * lf); diff --git a/include/ouroboros/logs.h b/include/ouroboros/logs.h index 9b83abd2..38b50053 100644 --- a/include/ouroboros/logs.h +++ b/include/ouroboros/logs.h @@ -3,9 +3,8 @@ * * Logging facilities * - * Sander Vrijders - * Francesco Salvestrini - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h index 6144ec06..a4e94b89 100644 --- a/include/ouroboros/np1_flow.h +++ b/include/ouroboros/np1_flow.h @@ -3,7 +3,8 @@ * * Adapter functions for N + 1 flow descriptors * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/nsm.h b/include/ouroboros/nsm.h index 0bcc028a..22a2a593 100644 --- a/include/ouroboros/nsm.h +++ b/include/ouroboros/nsm.h @@ -3,7 +3,8 @@ * * The API to instruct the global Namespace Manager * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h index 57d0ab0e..b12fed60 100644 --- a/include/ouroboros/qos.h +++ b/include/ouroboros/qos.h @@ -3,7 +3,8 @@ * * Quality of Service specification * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/rib.h b/include/ouroboros/rib.h index 50747498..320ef860 100644 --- a/include/ouroboros/rib.h +++ b/include/ouroboros/rib.h @@ -3,8 +3,8 @@ * * Resource Information Base * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/rqueue.h b/include/ouroboros/rqueue.h index 7bfbfa8f..b0ec4a60 100644 --- a/include/ouroboros/rqueue.h +++ b/include/ouroboros/rqueue.h @@ -3,8 +3,8 @@ * * RIB event queues * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/shared.h b/include/ouroboros/shared.h index 1f309d27..07d4be5e 100644 --- a/include/ouroboros/shared.h +++ b/include/ouroboros/shared.h @@ -3,7 +3,8 @@ * * Shared definitions between IRMd and IPCPs * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/shm_flow_set.h b/include/ouroboros/shm_flow_set.h index 95b1718e..947fe897 100644 --- a/include/ouroboros/shm_flow_set.h +++ b/include/ouroboros/shm_flow_set.h @@ -3,7 +3,8 @@ * * Management of flow_sets for fqueue * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h index 14cfb79a..f31dab63 100644 --- a/include/ouroboros/shm_rbuff.h +++ b/include/ouroboros/shm_rbuff.h @@ -3,7 +3,8 @@ * * Ring buffer for incoming SDUs * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -28,9 +29,11 @@ struct shm_rbuff; -struct shm_rbuff * shm_rbuff_create(pid_t api, int port_id); +struct shm_rbuff * shm_rbuff_create(pid_t api, + int port_id); -struct shm_rbuff * shm_rbuff_open(pid_t api, int port_id); +struct shm_rbuff * shm_rbuff_open(pid_t api, + int port_id); void shm_rbuff_close(struct shm_rbuff * rb); diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h index 73d6bfbc..92173388 100644 --- a/include/ouroboros/shm_rdrbuff.h +++ b/include/ouroboros/shm_rdrbuff.h @@ -3,8 +3,8 @@ * * Random Deletion Ring Buffer for Data Units * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h index efd4a08f..bcc60e17 100644 --- a/include/ouroboros/sockets.h +++ b/include/ouroboros/sockets.h @@ -3,7 +3,8 @@ * * The sockets layer to communicate between daemons * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/include/ouroboros/time_utils.h b/include/ouroboros/time_utils.h index f45df27f..35f2dcbb 100644 --- a/include/ouroboros/time_utils.h +++ b/include/ouroboros/time_utils.h @@ -3,7 +3,8 @@ * * Time utilities * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -97,7 +98,8 @@ int ts_to_tv(const struct timespec * src, #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) #define CLOCKS_MONO CLOCK_MONOTONIC -int clock_gettime(int clock, struct timespec * t); +int clock_gettime(int clock, + struct timespec * t); #endif #endif /* OUROBOROS_TIME_UTILS_H */ diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h index 29fb4367..19a29097 100644 --- a/include/ouroboros/utils.h +++ b/include/ouroboros/utils.h @@ -3,7 +3,8 @@ * * Handy utilities * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -40,9 +41,6 @@ typedef struct { */ int n_digits(unsigned i); -/* Returns a copy of the source string */ -char * strdup(const char * src); - /* gets the application name */ char * path_strip(char * src); diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 41b5bb48..8646121a 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -3,7 +3,8 @@ * * IPC process main loop * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 07c72791..a64ab65c 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -3,7 +3,8 @@ * * IPC process structure * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 2d995680..f025afa2 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -3,7 +3,8 @@ * * Local IPC process * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/addr_auth.c b/src/ipcpd/normal/addr_auth.c index 8469e95e..5b3c6170 100644 --- a/src/ipcpd/normal/addr_auth.c +++ b/src/ipcpd/normal/addr_auth.c @@ -3,8 +3,8 @@ * * Address authority * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/addr_auth.h b/src/ipcpd/normal/addr_auth.h index b389fa90..fbe7d790 100644 --- a/src/ipcpd/normal/addr_auth.h +++ b/src/ipcpd/normal/addr_auth.h @@ -3,8 +3,8 @@ * * Address authority * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/ae.h b/src/ipcpd/normal/ae.h index 882625dd..aafef625 100644 --- a/src/ipcpd/normal/ae.h +++ b/src/ipcpd/normal/ae.h @@ -3,8 +3,8 @@ * * Application Entities for the normal IPC process * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/connmgr.c b/src/ipcpd/normal/connmgr.c index 0c908cd1..87daeddb 100644 --- a/src/ipcpd/normal/connmgr.c +++ b/src/ipcpd/normal/connmgr.c @@ -3,8 +3,8 @@ * * Handles the different AP connections * - * Sander Vrijders * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/connmgr.h b/src/ipcpd/normal/connmgr.h index 5dbf2bcc..c0356f6d 100644 --- a/src/ipcpd/normal/connmgr.h +++ b/src/ipcpd/normal/connmgr.h @@ -3,8 +3,8 @@ * * Handles the different AP connections * - * Sander Vrijders * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c index 55d6e3f6..ae9793c6 100644 --- a/src/ipcpd/normal/dir.c +++ b/src/ipcpd/normal/dir.c @@ -3,8 +3,8 @@ * * DIF directory * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/dir.h b/src/ipcpd/normal/dir.h index 925fc823..04e722f3 100644 --- a/src/ipcpd/normal/dir.h +++ b/src/ipcpd/normal/dir.h @@ -3,7 +3,8 @@ * * DIF directory * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/dt_const.h b/src/ipcpd/normal/dt_const.h index c94e9395..327f51b8 100644 --- a/src/ipcpd/normal/dt_const.h +++ b/src/ipcpd/normal/dt_const.h @@ -3,8 +3,8 @@ * * Data Transfer Constants for the IPCP * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index 25460161..680cfbba 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -3,7 +3,8 @@ * * Enrollment Task * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/enroll.h b/src/ipcpd/normal/enroll.h index 3c81ae25..05f950ba 100644 --- a/src/ipcpd/normal/enroll.h +++ b/src/ipcpd/normal/enroll.h @@ -3,7 +3,8 @@ * * Enrollment Task * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index b7a99f6c..2593e8fd 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -3,7 +3,8 @@ * * Flow manager of the IPC Process * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/fmgr.h b/src/ipcpd/normal/fmgr.h index 06eab0a1..f5076eab 100644 --- a/src/ipcpd/normal/fmgr.h +++ b/src/ipcpd/normal/fmgr.h @@ -3,7 +3,8 @@ * * Flow manager of the IPC Process * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/frct.c b/src/ipcpd/normal/frct.c index b5a42db4..62cbf9f7 100644 --- a/src/ipcpd/normal/frct.c +++ b/src/ipcpd/normal/frct.c @@ -3,7 +3,8 @@ * * The Flow and Retransmission control component * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/frct.h b/src/ipcpd/normal/frct.h index d85d11f5..a1dcb151 100644 --- a/src/ipcpd/normal/frct.h +++ b/src/ipcpd/normal/frct.h @@ -3,7 +3,8 @@ * * The Flow and Retransmission control component * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index cb4e662f..643d83b0 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -3,8 +3,8 @@ * * Data transfer graph adjacency manager * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/gam.h b/src/ipcpd/normal/gam.h index 01a6e40e..4ae0b1b3 100644 --- a/src/ipcpd/normal/gam.h +++ b/src/ipcpd/normal/gam.h @@ -3,8 +3,8 @@ * * Data transfer graph adjacency manager * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 8b9a7c09..814a0c0b 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -3,8 +3,8 @@ * * Normal IPC Process * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/neighbors.c b/src/ipcpd/normal/neighbors.c index 40ef0d73..1c399145 100644 --- a/src/ipcpd/normal/neighbors.c +++ b/src/ipcpd/normal/neighbors.c @@ -3,8 +3,8 @@ * * Data transfer neighbors * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/neighbors.h b/src/ipcpd/normal/neighbors.h index 743bc7b8..8714a9aa 100644 --- a/src/ipcpd/normal/neighbors.h +++ b/src/ipcpd/normal/neighbors.h @@ -3,8 +3,8 @@ * * Data transfer neighbors * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pff.c b/src/ipcpd/normal/pff.c index b44f79bf..8cab7936 100644 --- a/src/ipcpd/normal/pff.c +++ b/src/ipcpd/normal/pff.c @@ -3,7 +3,8 @@ * * PDU Forwarding Function * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pff.h b/src/ipcpd/normal/pff.h index d4edb90c..667c341e 100644 --- a/src/ipcpd/normal/pff.h +++ b/src/ipcpd/normal/pff.h @@ -3,8 +3,8 @@ * * PDU Forwarding Function * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pol-addr-auth-ops.h b/src/ipcpd/normal/pol-addr-auth-ops.h index 25952636..f0f473ef 100644 --- a/src/ipcpd/normal/pol-addr-auth-ops.h +++ b/src/ipcpd/normal/pol-addr-auth-ops.h @@ -3,8 +3,8 @@ * * Address authority policy ops * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pol-gam-ops.h b/src/ipcpd/normal/pol-gam-ops.h index a7753b8b..cfe9cbc3 100644 --- a/src/ipcpd/normal/pol-gam-ops.h +++ b/src/ipcpd/normal/pol-gam-ops.h @@ -3,8 +3,8 @@ * * Graph adjacency manager policy ops * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index f84c3a23..3a9dd548 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -3,8 +3,8 @@ * * Sets up a complete graph * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pol/complete.h b/src/ipcpd/normal/pol/complete.h index 40aca69d..46a535c2 100644 --- a/src/ipcpd/normal/pol/complete.h +++ b/src/ipcpd/normal/pol/complete.h @@ -3,8 +3,8 @@ * * Sets up a complete graph * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c index aa0f6c7c..e709da7c 100644 --- a/src/ipcpd/normal/pol/flat.c +++ b/src/ipcpd/normal/pol/flat.c @@ -3,8 +3,8 @@ * * Policy for flat addresses in a distributed way * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/pol/flat.h b/src/ipcpd/normal/pol/flat.h index 85fe9281..d45a89cd 100644 --- a/src/ipcpd/normal/pol/flat.h +++ b/src/ipcpd/normal/pol/flat.h @@ -3,7 +3,8 @@ * * Policy for flat addresses in a distributed way * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index e8fa77a4..ec465c6b 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -3,8 +3,8 @@ * * RIB manager of the IPC Process * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/ribmgr.h b/src/ipcpd/normal/ribmgr.h index f3f4cc24..8922688a 100644 --- a/src/ipcpd/normal/ribmgr.h +++ b/src/ipcpd/normal/ribmgr.h @@ -3,7 +3,8 @@ * * RIB manager of the IPC Process * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/routing.c b/src/ipcpd/normal/routing.c index 48c2c16d..449c9379 100644 --- a/src/ipcpd/normal/routing.c +++ b/src/ipcpd/normal/routing.c @@ -3,8 +3,8 @@ * * Routing component of the IPCP * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/routing.h b/src/ipcpd/normal/routing.h index 624763ec..81208ffa 100644 --- a/src/ipcpd/normal/routing.h +++ b/src/ipcpd/normal/routing.h @@ -3,8 +3,8 @@ * * Routing component of the IPCP * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/shm_pci.c b/src/ipcpd/normal/shm_pci.c index 0807a24f..1170adff 100644 --- a/src/ipcpd/normal/shm_pci.c +++ b/src/ipcpd/normal/shm_pci.c @@ -3,8 +3,8 @@ * * Protocol Control Information in Shared Memory Map * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/normal/shm_pci.h b/src/ipcpd/normal/shm_pci.h index 17ce5cdd..0c54c883 100644 --- a/src/ipcpd/normal/shm_pci.h +++ b/src/ipcpd/normal/shm_pci.h @@ -3,8 +3,8 @@ * * Protocol Control Information in Shared Memory Map * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/shim-data.c b/src/ipcpd/shim-data.c index 933f3a64..6f5832a1 100644 --- a/src/ipcpd/shim-data.c +++ b/src/ipcpd/shim-data.c @@ -3,8 +3,8 @@ * * IPC process utilities * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/shim-data.h b/src/ipcpd/shim-data.h index 28087901..ac670b43 100644 --- a/src/ipcpd/shim-data.h +++ b/src/ipcpd/shim-data.h @@ -3,8 +3,8 @@ * * Utitilies for building IPC processes * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 01121fa3..8015d64a 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -3,7 +3,8 @@ * * Shim IPC process over Ethernet with LLC * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index a67a60ee..3bbce79d 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -3,7 +3,8 @@ * * Shim IPC process over UDP * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/shim-udp/tests/shim_udp_test.c b/src/ipcpd/shim-udp/tests/shim_udp_test.c index d4a5d8ed..d7bd0bb7 100644 --- a/src/ipcpd/shim-udp/tests/shim_udp_test.c +++ b/src/ipcpd/shim-udp/tests/shim_udp_test.c @@ -3,7 +3,8 @@ * * Test of the Shim UDP IPCP Daemon * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/tests/timerwheel_test.c b/src/ipcpd/tests/timerwheel_test.c index 23de403a..cf5b0333 100644 --- a/src/ipcpd/tests/timerwheel_test.c +++ b/src/ipcpd/tests/timerwheel_test.c @@ -3,7 +3,8 @@ * * Test of the timer wheel * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/timerwheel.c b/src/ipcpd/timerwheel.c index ef79bc14..d309bbf9 100644 --- a/src/ipcpd/timerwheel.c +++ b/src/ipcpd/timerwheel.c @@ -3,7 +3,8 @@ * * Timerwheel * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/ipcpd/timerwheel.h b/src/ipcpd/timerwheel.h index 8ef9437c..aa71c73d 100644 --- a/src/ipcpd/timerwheel.h +++ b/src/ipcpd/timerwheel.h @@ -3,7 +3,8 @@ * * Ring buffer for incoming SDUs * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -31,8 +32,8 @@ void timerwheel_destroy(struct timerwheel * tw); int timerwheel_add(struct timerwheel * tw, void (* func)(void *), - void * arg, - size_t arg_len, - unsigned int delay); /* ms */ + void * arg, + size_t arg_len, + unsigned int delay); /* ms */ #endif /* OUROBOROS_IPCPD_TIMERWHEEL_H */ diff --git a/src/irmd/api_table.c b/src/irmd/api_table.c index df300cea..9ba0f551 100644 --- a/src/irmd/api_table.c +++ b/src/irmd/api_table.c @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Application Instance Table * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/api_table.h b/src/irmd/api_table.h index df788bbc..c7998c7f 100644 --- a/src/irmd/api_table.h +++ b/src/irmd/api_table.h @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Application Instance Table * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/apn_table.c b/src/irmd/apn_table.c index 955618d8..d265e2f0 100644 --- a/src/irmd/apn_table.c +++ b/src/irmd/apn_table.c @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Application Process Table * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/apn_table.h b/src/irmd/apn_table.h index 550012bf..311c0f3d 100644 --- a/src/irmd/apn_table.h +++ b/src/irmd/apn_table.h @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Application Process Names Table * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index ae9ec957..06b66d3b 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -3,7 +3,8 @@ * * The API to instruct IPCPs * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/ipcp.h b/src/irmd/ipcp.h index 7ddfc3c4..bb868191 100644 --- a/src/irmd/ipcp.h +++ b/src/irmd/ipcp.h @@ -3,7 +3,8 @@ * * The API for the IRM to instruct IPCPs * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c index d2482391..20d2511c 100644 --- a/src/irmd/irm_flow.c +++ b/src/irmd/irm_flow.c @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Flows * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/irm_flow.h b/src/irmd/irm_flow.h index dc60d139..9a439204 100644 --- a/src/irmd/irm_flow.h +++ b/src/irmd/irm_flow.h @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Flows * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/main.c b/src/irmd/main.c index a0115f56..08e41f8d 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -3,8 +3,8 @@ * * The IPC Resource Manager * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/registry.c b/src/irmd/registry.c index f4579d08..a488d80a 100644 --- a/src/irmd/registry.c +++ b/src/irmd/registry.c @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Registry * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/registry.h b/src/irmd/registry.h index 76b32398..cf4ea432 100644 --- a/src/irmd/registry.h +++ b/src/irmd/registry.h @@ -3,7 +3,8 @@ * * The IPC Resource Manager - Registry * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/utils.c b/src/irmd/utils.c index 7d63f020..97193b53 100644 --- a/src/irmd/utils.c +++ b/src/irmd/utils.c @@ -3,8 +3,8 @@ * * The IPC Resource Manager - Utilities * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/irmd/utils.h b/src/irmd/utils.h index 03296259..36ec3d8e 100644 --- a/src/irmd/utils.h +++ b/src/irmd/utils.h @@ -3,7 +3,8 @@ * * Utils of the IPC Resource Manager * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -44,6 +45,7 @@ int wildcard_match(const char * pattern, /* functions for copying and destroying arguments list */ char ** argvdup(char ** argv); + void argvfree(char ** argv); #endif /* OUROBOROS_IRM_UTILS_H */ diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index 255f2b4d..93ffda77 100644 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -3,8 +3,8 @@ * * Bitmap implementation * - * Sander Vrijders - * Francesco Salvestrini + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/btree.c b/src/lib/btree.c index 38302dae..10a900d6 100644 --- a/src/lib/btree.c +++ b/src/lib/btree.c @@ -3,8 +3,8 @@ * * B-trees * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/btree.h b/src/lib/btree.h index 79467099..f7c293c5 100644 --- a/src/lib/btree.h +++ b/src/lib/btree.h @@ -3,7 +3,8 @@ * * B-trees * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/cdap.c b/src/lib/cdap.c index 6c46775c..ba4a2a21 100644 --- a/src/lib/cdap.c +++ b/src/lib/cdap.c @@ -3,7 +3,8 @@ * * The Common Distributed Application Protocol * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/cdap_req.c b/src/lib/cdap_req.c index 810ec9bf..a0348a14 100644 --- a/src/lib/cdap_req.c +++ b/src/lib/cdap_req.c @@ -3,8 +3,8 @@ * * CDAP - CDAP request management * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/cdap_req.h b/src/lib/cdap_req.h index 2d69526b..9023357d 100644 --- a/src/lib/cdap_req.h +++ b/src/lib/cdap_req.h @@ -3,8 +3,8 @@ * * CDAP - CDAP request management * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/crc32.c b/src/lib/crc32.c index 8cafe5b5..549938b8 100644 --- a/src/lib/crc32.c +++ b/src/lib/crc32.c @@ -3,7 +3,8 @@ * * 32-bit Cyclic Redundancy Check * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/dev.c b/src/lib/dev.c index cb8044cf..9ddc5b84 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -3,8 +3,8 @@ * * API for applications * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/hashtable.c b/src/lib/hashtable.c index f17accaf..0a534da7 100644 --- a/src/lib/hashtable.c +++ b/src/lib/hashtable.c @@ -3,7 +3,8 @@ * * Hash table with separate chaining on collisions * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/irm.c b/src/lib/irm.c index b610a59e..0e4bfc40 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -3,7 +3,8 @@ * * The API to instruct the IRM * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/list.c b/src/lib/list.c index 01fdf6e3..b6b4bbd2 100644 --- a/src/lib/list.c +++ b/src/lib/list.c @@ -3,8 +3,8 @@ * * Simple doubly linked list implementation. * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/lockfile.c b/src/lib/lockfile.c index 2868cb71..e84c6692 100644 --- a/src/lib/lockfile.c +++ b/src/lib/lockfile.c @@ -3,7 +3,8 @@ * * Lockfile for Ouroboros * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/logs.c b/src/lib/logs.c index 3184773f..e38f2a8b 100644 --- a/src/lib/logs.c +++ b/src/lib/logs.c @@ -3,8 +3,8 @@ * * Logging facilities * - * Sander Vrijders - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/nsm.c b/src/lib/nsm.c index 3fc98021..979f711e 100644 --- a/src/lib/nsm.c +++ b/src/lib/nsm.c @@ -3,7 +3,8 @@ * * The API to instruct the global Namespace Manager * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/rib.c b/src/lib/rib.c index af4abccf..8468e88c 100644 --- a/src/lib/rib.c +++ b/src/lib/rib.c @@ -3,8 +3,8 @@ * * Resource Information Base * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/sha3.c b/src/lib/sha3.c index 212f645a..750038f2 100644 --- a/src/lib/sha3.c +++ b/src/lib/sha3.c @@ -3,6 +3,9 @@ * * SHA3 algorithm * + * Dimitri Staessens + * Sander Vrijders + * * This implementation is adapted and redistributed from the RHASH * project * diff --git a/src/lib/sha3.h b/src/lib/sha3.h index 413228a2..6ce67482 100644 --- a/src/lib/sha3.h +++ b/src/lib/sha3.h @@ -3,7 +3,8 @@ * * SHA3 algorithm * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This implementation is adapted and redistributed from the RHASH * project implementation of the sha3 algorithm diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c index 161e070c..a8e3fc79 100644 --- a/src/lib/shm_flow_set.c +++ b/src/lib/shm_flow_set.c @@ -3,7 +3,8 @@ * * Management of flow_sets for fqueue * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c index 0d0795aa..a206a019 100644 --- a/src/lib/shm_rbuff.c +++ b/src/lib/shm_rbuff.c @@ -3,7 +3,8 @@ * * Ring buffer for incoming SDUs * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c index eb51a278..0976c4bd 100644 --- a/src/lib/shm_rdrbuff.c +++ b/src/lib/shm_rdrbuff.c @@ -3,8 +3,8 @@ * * Random Deletion Ring Buffer for Data Units * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/sockets.c b/src/lib/sockets.c index e57cd748..3a26a2cf 100644 --- a/src/lib/sockets.c +++ b/src/lib/sockets.c @@ -3,7 +3,8 @@ * * The sockets layer to communicate between daemons * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/tests/bitmap_test.c b/src/lib/tests/bitmap_test.c index b1684f72..7480600e 100644 --- a/src/lib/tests/bitmap_test.c +++ b/src/lib/tests/bitmap_test.c @@ -3,7 +3,8 @@ * * Test of the bitmap * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/lib/tests/btree_test.c b/src/lib/tests/btree_test.c index 257a7e37..6981f63a 100644 --- a/src/lib/tests/btree_test.c +++ b/src/lib/tests/btree_test.c @@ -3,7 +3,8 @@ * * Test of the B-tree implementation * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/lib/tests/crc32_test.c b/src/lib/tests/crc32_test.c index 563d23b0..6a8ee9c3 100644 --- a/src/lib/tests/crc32_test.c +++ b/src/lib/tests/crc32_test.c @@ -3,7 +3,8 @@ * * Test of the CRC32 function * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/lib/tests/hashtable_test.c b/src/lib/tests/hashtable_test.c index fb7f1156..a5b0e469 100644 --- a/src/lib/tests/hashtable_test.c +++ b/src/lib/tests/hashtable_test.c @@ -3,7 +3,8 @@ * * Test of the hash table * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/lib/tests/rib_test.c b/src/lib/tests/rib_test.c index 8996c379..54926e10 100644 --- a/src/lib/tests/rib_test.c +++ b/src/lib/tests/rib_test.c @@ -3,7 +3,8 @@ * * Test of the RIB * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/lib/tests/sha3_test.c b/src/lib/tests/sha3_test.c index 30334f49..212452ef 100644 --- a/src/lib/tests/sha3_test.c +++ b/src/lib/tests/sha3_test.c @@ -3,7 +3,8 @@ * * Test of the SHA3 function * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/lib/time_utils.c b/src/lib/time_utils.c index 3b791157..97e97b09 100644 --- a/src/lib/time_utils.c +++ b/src/lib/time_utils.c @@ -3,7 +3,8 @@ * * Time utilities * - * Dimitri Staessens + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/lib/utils.c b/src/lib/utils.c index 40d1c285..e97dddb0 100644 --- a/src/lib/utils.c +++ b/src/lib/utils.c @@ -3,7 +3,8 @@ * * Handy utilities * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/src/nsmd/main.c b/src/nsmd/main.c index f3b87330..b85b39a9 100644 --- a/src/nsmd/main.c +++ b/src/nsmd/main.c @@ -1,10 +1,32 @@ -#define OUROBOROS_PREFIX "da" +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Normal IPC Process + * + * Dimitri Staessens + * Sander Vrijders + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define OUROBOROS_PREFIX "nsmd" #include int main(void) { - log_dbg("Test of the DA"); + log_dbg("Test of the NSMd"); return 0; } diff --git a/src/tools/cbr/cbr.c b/src/tools/cbr/cbr.c index ef8a58ba..cd29c9ad 100644 --- a/src/tools/cbr/cbr.c +++ b/src/tools/cbr/cbr.c @@ -3,8 +3,8 @@ * * CBR traffic generator * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c index 48a18cd1..16ade13d 100644 --- a/src/tools/cbr/cbr_client.c +++ b/src/tools/cbr/cbr_client.c @@ -3,8 +3,8 @@ * * A simple CBR generator * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c index b0be9d7b..9198858c 100644 --- a/src/tools/cbr/cbr_server.c +++ b/src/tools/cbr/cbr_server.c @@ -3,8 +3,8 @@ * * A simple CBR generator * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/echo/echo.c b/src/tools/echo/echo.c index 3dd7527b..051a16c3 100644 --- a/src/tools/echo/echo.c +++ b/src/tools/echo/echo.c @@ -3,7 +3,8 @@ * * A simple echo application * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/echo/echo_client.c b/src/tools/echo/echo_client.c index 3036d338..f84de73a 100644 --- a/src/tools/echo/echo_client.c +++ b/src/tools/echo/echo_client.c @@ -3,7 +3,8 @@ * * A simple echo application * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c index 94c54eee..aa136485 100644 --- a/src/tools/echo/echo_server.c +++ b/src/tools/echo/echo_server.c @@ -3,7 +3,8 @@ * * A simple echo application * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c index 85d03245..0e77e22a 100644 --- a/src/tools/irm/irm.c +++ b/src/tools/irm/irm.c @@ -3,7 +3,8 @@ * * A tool to instruct the IRM daemon * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c index bb19d13c..bbe370db 100644 --- a/src/tools/irm/irm_bind.c +++ b/src/tools/irm/irm_bind.c @@ -3,8 +3,8 @@ * * Bind names in the processing system * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_bind_ap.c b/src/tools/irm/irm_bind_ap.c index dc66e399..d23f7035 100644 --- a/src/tools/irm/irm_bind_ap.c +++ b/src/tools/irm/irm_bind_ap.c @@ -3,8 +3,8 @@ * * Bind AP to a name * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_bind_api.c b/src/tools/irm/irm_bind_api.c index dd405347..6e171099 100644 --- a/src/tools/irm/irm_bind_api.c +++ b/src/tools/irm/irm_bind_api.c @@ -3,8 +3,8 @@ * * Bind AP-I to a name * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_bind_ipcp.c b/src/tools/irm/irm_bind_ipcp.c index 404207c0..81347080 100644 --- a/src/tools/irm/irm_bind_ipcp.c +++ b/src/tools/irm/irm_bind_ipcp.c @@ -3,8 +3,8 @@ * * Bind IPCP Instance to a name * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_ipcp.c b/src/tools/irm/irm_ipcp.c index 59869a12..fef803d9 100644 --- a/src/tools/irm/irm_ipcp.c +++ b/src/tools/irm/irm_ipcp.c @@ -3,7 +3,8 @@ * * A tool to instruct the IRM daemon * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c index 10c89060..ac52c6c1 100644 --- a/src/tools/irm/irm_ipcp_bootstrap.c +++ b/src/tools/irm/irm_ipcp_bootstrap.c @@ -3,7 +3,8 @@ * * Bootstrap IPC Processes * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_ipcp_create.c b/src/tools/irm/irm_ipcp_create.c index e8ed1186..494f01f5 100644 --- a/src/tools/irm/irm_ipcp_create.c +++ b/src/tools/irm/irm_ipcp_create.c @@ -3,7 +3,8 @@ * * Create IPC Processes * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_ipcp_destroy.c b/src/tools/irm/irm_ipcp_destroy.c index 96808850..1c81c9ce 100644 --- a/src/tools/irm/irm_ipcp_destroy.c +++ b/src/tools/irm/irm_ipcp_destroy.c @@ -3,7 +3,8 @@ * * Destroy IPC Processes * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_ipcp_enroll.c b/src/tools/irm/irm_ipcp_enroll.c index 3731fa81..05b3f6b6 100644 --- a/src/tools/irm/irm_ipcp_enroll.c +++ b/src/tools/irm/irm_ipcp_enroll.c @@ -3,7 +3,8 @@ * * Enroll IPC Processes * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_ops.h b/src/tools/irm/irm_ops.h index 514570f5..8f0e790e 100644 --- a/src/tools/irm/irm_ops.h +++ b/src/tools/irm/irm_ops.h @@ -3,7 +3,8 @@ * * Functions of the IRM tool that are one level deep * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -19,19 +20,47 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -int ipcp_cmd(int argc, char ** argv); -int do_create_ipcp(int argc, char ** argv); -int do_destroy_ipcp(int argc, char ** argv); -int do_bootstrap_ipcp(int argc, char ** argv); -int do_enroll_ipcp(int argc, char ** argv); - -int bind_cmd(int argc, char ** argv); -int do_bind_ap(int argc, char ** argv); -int do_bind_api(int argc, char ** argv); -int do_bind_ipcp(int argc, char ** argv); -int unbind_cmd(int argc, char ** argv); -int do_unbind_ap(int argc, char ** argv); -int do_unbind_api(int argc, char ** argv); -int do_unbind_ipcp(int argc, char ** argv); -int do_register(int argc, char ** argv); -int do_unregister(int argc, char ** argv); +int ipcp_cmd(int argc, + char ** argv); + +int do_create_ipcp(int argc, + char ** argv); + +int do_destroy_ipcp(int argc, + char ** argv); + +int do_bootstrap_ipcp(int argc, + char ** argv); + +int do_enroll_ipcp(int argc, + char ** argv); + +int bind_cmd(int argc, + char ** argv); + +int do_bind_ap(int argc, + char ** argv); + +int do_bind_api(int argc, + char ** argv); + +int do_bind_ipcp(int argc, + char ** argv); + +int unbind_cmd(int argc, + char ** argv); + +int do_unbind_ap(int argc, + char ** argv); + +int do_unbind_api(int argc, + char ** argv); + +int do_unbind_ipcp(int argc, + char ** argv); + +int do_register(int argc, + char ** argv); + +int do_unregister(int argc, + char ** argv); diff --git a/src/tools/irm/irm_register.c b/src/tools/irm/irm_register.c index cdb4b888..094268c0 100644 --- a/src/tools/irm/irm_register.c +++ b/src/tools/irm/irm_register.c @@ -3,8 +3,8 @@ * * Register names in IPCPs * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_unbind.c b/src/tools/irm/irm_unbind.c index 2a570547..e21f7993 100644 --- a/src/tools/irm/irm_unbind.c +++ b/src/tools/irm/irm_unbind.c @@ -3,8 +3,8 @@ * * Unbind names in the processing system * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_unbind_ap.c b/src/tools/irm/irm_unbind_ap.c index 779506bd..a1b07d36 100644 --- a/src/tools/irm/irm_unbind_ap.c +++ b/src/tools/irm/irm_unbind_ap.c @@ -3,8 +3,8 @@ * * Unbind AP names * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_unbind_api.c b/src/tools/irm/irm_unbind_api.c index 29e4a9c1..6200c21f 100644 --- a/src/tools/irm/irm_unbind_api.c +++ b/src/tools/irm/irm_unbind_api.c @@ -3,8 +3,8 @@ * * Unbind AP-I names * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_unbind_ipcp.c b/src/tools/irm/irm_unbind_ipcp.c index be7e995f..34af66e0 100644 --- a/src/tools/irm/irm_unbind_ipcp.c +++ b/src/tools/irm/irm_unbind_ipcp.c @@ -3,8 +3,8 @@ * * Unbind name from IPCP Instance * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_unregister.c b/src/tools/irm/irm_unregister.c index d8cadc33..18314e96 100644 --- a/src/tools/irm/irm_unregister.c +++ b/src/tools/irm/irm_unregister.c @@ -3,8 +3,8 @@ * * Unregister names from IPCPs * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c index 25f8dc3a..24841b99 100644 --- a/src/tools/irm/irm_utils.c +++ b/src/tools/irm/irm_utils.c @@ -3,7 +3,8 @@ * * Handy helper functions for the IRM tool * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/irm/irm_utils.h b/src/tools/irm/irm_utils.h index b5a6f56f..d6d2232c 100644 --- a/src/tools/irm/irm_utils.h +++ b/src/tools/irm/irm_utils.h @@ -3,7 +3,8 @@ * * Handy helper functions for the IRM tool * - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -19,4 +20,5 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -int matches(const char * cmd, const char * pattern); +int matches(const char * cmd, + const char * pattern); diff --git a/src/tools/operf/operf.c b/src/tools/operf/operf.c index 1d91ff42..7935d12c 100644 --- a/src/tools/operf/operf.c +++ b/src/tools/operf/operf.c @@ -3,8 +3,8 @@ * * Ouroboros perf application * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/operf/operf_client.c b/src/tools/operf/operf_client.c index 0c943cf7..d2f08ef4 100644 --- a/src/tools/operf/operf_client.c +++ b/src/tools/operf/operf_client.c @@ -3,8 +3,8 @@ * * Ouroboros ping application * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/operf/operf_server.c b/src/tools/operf/operf_server.c index f23b52f3..3665d4cc 100644 --- a/src/tools/operf/operf_server.c +++ b/src/tools/operf/operf_server.c @@ -3,8 +3,8 @@ * * Ouroboros perf application * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c index 64cb7dd8..7c9c108c 100644 --- a/src/tools/oping/oping.c +++ b/src/tools/oping/oping.c @@ -3,8 +3,8 @@ * * Ouroboros ping application * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index 253ea168..a91a126c 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -3,8 +3,8 @@ * * Ouroboros ping application * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index e0a6655b..e20e236d 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -3,8 +3,8 @@ * * Ouroboros ping application * - * Dimitri Staessens - * Sander Vrijders + * Dimitri Staessens + * Sander Vrijders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as -- cgit v1.2.3 From a688b8a38d7eb9f42406eeb611717db737b0d257 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 3 Mar 2017 15:41:11 +0100 Subject: lib: Manage multiple flows with a single CDAP instance You can now add multiple flows to a CDAP instance. This will simplify sending messages to different peers (e.g. for syncing the RIB). A request will now return an array of keys terminated by CDAP_KEY_INVALID. Removes the enum from the CDAP proto file to just take the opcode as an integer. --- include/ouroboros/cdap.h | 11 +- src/ipcpd/normal/enroll.c | 48 +++++-- src/lib/cdap.c | 341 +++++++++++++++++++++++++++++++--------------- src/lib/cdap.proto | 12 +- src/lib/cdap_req.c | 9 +- src/lib/cdap_req.h | 5 +- 6 files changed, 287 insertions(+), 139 deletions(-) (limited to 'include') diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h index 19ab39a8..32edb51c 100644 --- a/include/ouroboros/cdap.h +++ b/include/ouroboros/cdap.h @@ -46,12 +46,17 @@ struct cdap; typedef int32_t cdap_key_t; -/* Assumes flow is blocking */ -struct cdap * cdap_create(int fd); +struct cdap * cdap_create(void); int cdap_destroy(struct cdap * instance); -cdap_key_t cdap_request_send(struct cdap * instance, +int cdap_add_flow(struct cdap * instance, + int fd); + +int cdap_del_flow(struct cdap * instance, + int fd); + +cdap_key_t * cdap_request_send(struct cdap * instance, enum cdap_opcode code, const char * name, const void * data, diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index 680cfbba..4e510038 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -78,13 +78,20 @@ static void * enroll_handle(void * o) continue; } - cdap = cdap_create(conn.flow_info.fd); + cdap = cdap_create(); if (cdap == NULL) { log_err("Failed to instantiate CDAP."); flow_dealloc(conn.flow_info.fd); continue; } + if (cdap_add_flow(cdap, conn.flow_info.fd)) { + log_warn("Failed to add flow to CDAP."); + cdap_destroy(cdap); + flow_dealloc(conn.flow_info.fd); + continue; + } + while (!(boot_r && members_r && dif_name_r)) { key = cdap_request_wait(cdap, &oc, &name, &data, (size_t *) &len , &flags); @@ -167,7 +174,7 @@ static void * enroll_handle(void * o) int enroll_boot(char * dst_name) { struct cdap * cdap; - cdap_key_t key; + cdap_key_t * key; uint8_t * data; size_t len; struct conn conn; @@ -186,31 +193,41 @@ int enroll_boot(char * dst_name) return -1; } - cdap = cdap_create(conn.flow_info.fd); + cdap = cdap_create(); if (cdap == NULL) { log_err("Failed to instantiate CDAP."); return -1; } + if (cdap_add_flow(cdap, conn.flow_info.fd)) { + log_warn("Failed to add flow to CDAP."); + cdap_destroy(cdap); + flow_dealloc(conn.flow_info.fd); + return -1; + } + log_dbg("Getting boot information from %s.", dst_name); clock_gettime(CLOCK_REALTIME, &t0); key = cdap_request_send(cdap, CDAP_READ, TIME_PATH, NULL, 0, 0); - if (key < 0) { + if (key == NULL) { log_err("Failed to send CDAP request."); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } - if (cdap_reply_wait(cdap, key, &data, &len)) { + if (cdap_reply_wait(cdap, key[0], &data, &len)) { log_err("Failed to get CDAP reply."); + free(key); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } + free(key); + clock_gettime(CLOCK_REALTIME, &rtt); delta_t = ts_diff_ms(&t0, &rtt); @@ -226,20 +243,23 @@ int enroll_boot(char * dst_name) free(data); key = cdap_request_send(cdap, CDAP_READ, boot_ro, NULL, 0, 0); - if (key < 0) { + if (key == NULL) { log_err("Failed to send CDAP request."); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } - if (cdap_reply_wait(cdap, key, &data, &len)) { + if (cdap_reply_wait(cdap, key[0], &data, &len)) { log_err("Failed to get CDAP reply."); + free(key); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } + free(key); + log_dbg("Packed information received (%zu bytes).", len); if (rib_unpack(data, len, UNPACK_CREATE)) { @@ -254,20 +274,23 @@ int enroll_boot(char * dst_name) log_dbg("Packed information inserted into RIB."); key = cdap_request_send(cdap, CDAP_READ, members_ro, NULL, 0, 0); - if (key < 0) { + if (key == NULL) { log_err("Failed to send CDAP request."); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } - if (cdap_reply_wait(cdap, key, &data, &len)) { + if (cdap_reply_wait(cdap, key[0], &data, &len)) { log_err("Failed to get CDAP reply."); + free(key); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } + free(key); + log_dbg("Packed information received (%zu bytes).", len); if (rib_unpack(data, len, UNPACK_CREATE)) { @@ -282,20 +305,23 @@ int enroll_boot(char * dst_name) log_dbg("Packed information inserted into RIB."); key = cdap_request_send(cdap, CDAP_READ, dif_ro, NULL, 0, 0); - if (key < 0) { + if (key == NULL) { log_err("Failed to send CDAP request."); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } - if (cdap_reply_wait(cdap, key, &data, &len)) { + if (cdap_reply_wait(cdap, key[0], &data, &len)) { log_err("Failed to get CDAP reply."); + free(key); cdap_destroy(cdap); flow_dealloc(conn.flow_info.fd); return -1; } + free(key); + log_dbg("Packed information received (%zu bytes).", len); if (rib_unpack(data, len, UNPACK_CREATE)) { diff --git a/src/lib/cdap.c b/src/lib/cdap.c index ba4a2a21..86554dd2 100644 --- a/src/lib/cdap.c +++ b/src/lib/cdap.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -37,28 +38,39 @@ #include "cdap.pb-c.h" typedef Cdap cdap_t; -typedef Opcode opcode_t; typedef int32_t invoke_id_t; +#define CDAP_REPLY (CDAP_DELETE + 1) + #define INVALID_INVOKE_ID -1 #define IDS_SIZE 256 #define BUF_SIZE 2048 -struct cdap { +struct fd_el { + struct list_head next; + int fd; +}; + +struct cdap { + flow_set_t * set; + + size_t n_flows; + struct list_head flows; + pthread_rwlock_t flows_lock; struct bmp * ids; pthread_mutex_t ids_lock; - pthread_t reader; - struct list_head sent; pthread_rwlock_t sent_lock; struct list_head rcvd; pthread_cond_t rcvd_cond; pthread_mutex_t rcvd_lock; + + pthread_t reader; }; struct cdap_rcvd { @@ -133,6 +145,7 @@ static struct cdap_req * cdap_sent_get_by_key(struct cdap * instance, } static struct cdap_req * cdap_sent_add(struct cdap * instance, + int fd, cdap_key_t key) { struct cdap_req * req; @@ -141,7 +154,7 @@ static struct cdap_req * cdap_sent_add(struct cdap * instance, assert(key >= 0); assert(!cdap_sent_has_key(instance, key)); - req = cdap_req_create(key); + req = cdap_req_create(fd, key); if (req == NULL) return NULL; @@ -220,9 +233,14 @@ static void * sdu_reader(void * o) uint8_t buf[BUF_SIZE]; ssize_t len; buffer_t data; + fqueue_t * fq; - while (true) { - len = flow_read(instance->fd, buf, BUF_SIZE); + fq = fqueue_create(); + if (fq == NULL) + return (void *) -1; + + while (flow_event_wait(instance->set, fq, NULL)) { + len = flow_read(fqueue_next(fq), buf, BUF_SIZE); if (len < 0) continue; @@ -230,41 +248,17 @@ static void * sdu_reader(void * o) if (msg == NULL) continue; - if (msg->opcode != OPCODE__REPLY) { + if (msg->opcode != CDAP_REPLY) { rcvd = malloc(sizeof(*rcvd)); if (rcvd == NULL) { cdap__free_unpacked(msg, NULL); continue; } - switch (msg->opcode) { - case OPCODE__START: - rcvd->opcode = CDAP_START; - break; - case OPCODE__STOP: - rcvd->opcode = CDAP_STOP; - break; - case OPCODE__READ: - rcvd->opcode = CDAP_READ; - break; - case OPCODE__WRITE: - rcvd->opcode = CDAP_WRITE; - break; - case OPCODE__CREATE: - rcvd->opcode = CDAP_CREATE; - break; - case OPCODE__DELETE: - rcvd->opcode = CDAP_DELETE; - break; - default: - cdap__free_unpacked(msg, NULL); - free(rcvd); - continue; - } - - rcvd->iid = msg->invoke_id; - rcvd->flags = msg->flags; - rcvd->name = strdup(msg->name); + rcvd->opcode = msg->opcode; + rcvd->iid = msg->invoke_id; + rcvd->flags = msg->flags; + rcvd->name = strdup(msg->name); if (rcvd->name == NULL) { cdap__free_unpacked(msg, NULL); free(rcvd); @@ -303,7 +297,7 @@ static void * sdu_reader(void * o) cdap__free_unpacked(msg, NULL); continue; } - memcpy(data.data, msg->value.data, data.len); + memcpy(data.data, msg->value.data Iata.len); } else { data.len = 0; data.data = NULL; @@ -311,36 +305,32 @@ static void * sdu_reader(void * o) cdap_req_respond(req, msg->result, data); } - - cdap__free_unpacked(msg, NULL); } - return (void *) 0; } -struct cdap * cdap_create(int fd) +struct cdap * cdap_create() { struct cdap * instance = NULL; - int flags; - - if (fd < 0) - return NULL; - - flags = flow_get_flags(fd); - if (flags & FLOW_O_NONBLOCK) - return NULL; instance = malloc(sizeof(*instance)); if (instance == NULL) return NULL; + if (pthread_rwlock_init(&instance->flows_lock, NULL)) { + free(instance); + return NULL; + } + if (pthread_mutex_init(&instance->ids_lock, NULL)) { + pthread_rwlock_destroy(&instance->flows_lock); free(instance); return NULL; } if (pthread_mutex_init(&instance->rcvd_lock, NULL)) { pthread_mutex_destroy(&instance->ids_lock); + pthread_rwlock_destroy(&instance->flows_lock); free(instance); return NULL; } @@ -348,6 +338,7 @@ struct cdap * cdap_create(int fd) if (pthread_rwlock_init(&instance->sent_lock, NULL)) { pthread_mutex_destroy(&instance->rcvd_lock); pthread_mutex_destroy(&instance->ids_lock); + pthread_rwlock_destroy(&instance->flows_lock); free(instance); return NULL; } @@ -356,6 +347,7 @@ struct cdap * cdap_create(int fd) pthread_rwlock_destroy(&instance->sent_lock); pthread_mutex_destroy(&instance->rcvd_lock); pthread_mutex_destroy(&instance->ids_lock); + pthread_rwlock_destroy(&instance->flows_lock); free(instance); return NULL; } @@ -366,15 +358,29 @@ struct cdap * cdap_create(int fd) pthread_rwlock_destroy(&instance->sent_lock); pthread_mutex_destroy(&instance->rcvd_lock); pthread_mutex_destroy(&instance->ids_lock); + pthread_rwlock_destroy(&instance->flows_lock); free(instance); return NULL; } + instance->set = flow_set_create(); + if (instance->set == NULL) { + bmp_destroy(instance->ids); + pthread_cond_destroy(&instance->rcvd_cond); + pthread_rwlock_destroy(&instance->sent_lock); + pthread_mutex_destroy(&instance->rcvd_lock); + pthread_mutex_destroy(&instance->ids_lock); + pthread_rwlock_destroy(&instance->flows_lock); + free(instance); + return NULL; + } + + instance->n_flows = 0; + + list_head_init(&instance->flows); list_head_init(&instance->sent); list_head_init(&instance->rcvd); - instance->fd = fd; - pthread_create(&instance->reader, NULL, sdu_reader, instance); return instance; @@ -382,12 +388,29 @@ struct cdap * cdap_create(int fd) int cdap_destroy(struct cdap * instance) { + struct list_head * p; + struct list_head * h; + if (instance == NULL) return 0; pthread_cancel(instance->reader); pthread_join(instance->reader, NULL); + flow_set_destroy(instance->set); + + pthread_rwlock_wrlock(&instance->flows_lock); + + list_for_each_safe(p,h, &instance->flows) { + struct fd_el * e = list_entry(p, struct fd_el, next); + list_del(&e->next); + free(e); + } + + pthread_rwlock_unlock(&instance->flows_lock); + + pthread_rwlock_destroy(&instance->flows_lock); + pthread_mutex_lock(&instance->ids_lock); bmp_destroy(instance->ids); @@ -409,14 +432,71 @@ int cdap_destroy(struct cdap * instance) return 0; } -static int write_msg(struct cdap * instance, +int cdap_add_flow(struct cdap * instance, + int fd) +{ + struct fd_el * e; + + if (fd < 0) + return -EINVAL; + + e = malloc(sizeof(*e)); + if (e == NULL) + return -ENOMEM; + + e->fd = fd; + + pthread_rwlock_wrlock(&instance->flows_lock); + + if (flow_set_add(instance->set, fd)) { + pthread_rwlock_unlock(&instance->flows_lock); + return -1; + } + + list_add(&e->next, &instance->flows); + + ++instance->n_flows; + + pthread_rwlock_unlock(&instance->flows_lock); + + return 0; +} + +int cdap_del_flow(struct cdap * instance, + int fd) +{ + struct list_head * p; + struct list_head * h; + + if (fd < 0) + return -EINVAL; + + pthread_rwlock_wrlock(&instance->flows_lock); + + flow_set_del(instance->set, fd); + + list_for_each_safe(p, h, &instance->flows) { + struct fd_el * e = list_entry(p, struct fd_el, next); + if (e->fd == fd) { + list_del(&e->next); + free(e); + break; + } + } + + --instance->n_flows; + + pthread_rwlock_unlock(&instance->flows_lock); + + return 0; +} + +static int write_msg(int fd, cdap_t * msg) { - int ret; uint8_t * data; size_t len; - assert(instance); assert(msg); len = cdap__get_packed_size(msg); @@ -429,11 +509,14 @@ static int write_msg(struct cdap * instance, cdap__pack(msg, data); - ret = flow_write(instance->fd, data, len); + if (flow_write(fd, data, len)) { + free(data); + return -1; + } free(data); - return ret; + return 0; } static cdap_key_t invoke_id_to_key(invoke_id_t iid) @@ -452,75 +535,114 @@ static invoke_id_t key_to_invoke_id(cdap_key_t key) return (invoke_id_t) key; } -cdap_key_t cdap_request_send(struct cdap * instance, - enum cdap_opcode code, - const char * name, - const void * data, - size_t len, - uint32_t flags) +cdap_key_t * cdap_request_send(struct cdap * instance, + enum cdap_opcode code, + const char * name, + const void * data, + size_t len, + uint32_t flags) { - cdap_t msg = CDAP__INIT; - struct cdap_req * req; - invoke_id_t iid; - cdap_key_t key; + cdap_key_t * keys; + cdap_key_t * key; + cdap_t msg = CDAP__INIT; + struct list_head * p; + int ret; - if (instance == NULL || name == NULL) - return -EINVAL; + if (instance == NULL || name == NULL || code > CDAP_DELETE) + return NULL; + pthread_rwlock_rdlock(&instance->flows_lock); - iid = next_invoke_id(instance); - if (iid == INVALID_INVOKE_ID) - return INVALID_CDAP_KEY; + keys = malloc(sizeof(*keys) * (instance->n_flows + 1)); + if (keys == NULL) + return NULL; - switch (code) { - case CDAP_READ: - msg.opcode = OPCODE__READ; - break; - case CDAP_WRITE: - msg.opcode = OPCODE__WRITE; - break; - case CDAP_CREATE: - msg.opcode = OPCODE__CREATE; - break; - case CDAP_DELETE: - msg.opcode = OPCODE__DELETE; - break; - case CDAP_START: - msg.opcode = OPCODE__START; - break; - case CDAP_STOP: - msg.opcode = OPCODE__STOP; - break; - default: - release_invoke_id(instance, iid); - return -EINVAL; - } + memset(keys, INVALID_CDAP_KEY, sizeof(*keys) * (instance->n_flows + 1)); + key = keys; + + msg.opcode = code; msg.name = (char *) name; msg.has_flags = true; msg.flags = flags; - msg.invoke_id = iid; + if (data != NULL) { msg.has_value = true; msg.value.data = (uint8_t *) data; msg.value.len = len; } - key = invoke_id_to_key(iid); + list_for_each(p, &instance->flows) { + struct cdap_req * req; + invoke_id_t iid; + struct fd_el * e; + cdap__init(&msg); + + iid = next_invoke_id(instance); + if (iid == INVALID_INVOKE_ID) { + pthread_rwlock_unlock(&instance->flows_lock); + while(key > keys) { + struct cdap_req * r = + cdap_sent_get_by_key(instance, + *(--key)); + cdap_sent_del(instance, r); + cdap_req_destroy(r); + } - req = cdap_sent_add(instance, key); - if (req == NULL) { - release_invoke_id(instance, iid); - return INVALID_CDAP_KEY; - } + free(keys); + return NULL; + } - if (write_msg(instance, &msg)) { - cdap_sent_del(instance, req); - release_invoke_id(instance, iid); - return INVALID_CDAP_KEY; + msg.invoke_id = iid; + + *key = invoke_id_to_key(iid); + + e = list_entry(p, struct fd_el, next); + + req = cdap_sent_add(instance, e->fd, *key); + if (req == NULL) { + pthread_rwlock_unlock(&instance->flows_lock); + while(key > keys) { + struct cdap_req * r = + cdap_sent_get_by_key(instance, + *(--key)); + release_invoke_id(instance, iid); + cdap_sent_del(instance, r); + release_invoke_id(instance, + key_to_invoke_id(r->key)); + cdap_req_destroy(r); + } + free(keys); + return NULL; + } + + ret = write_msg(e->fd, &msg); + if (ret == -ENOMEM) { + pthread_rwlock_unlock(&instance->flows_lock); + while(key >= keys) { + struct cdap_req * r = + cdap_sent_get_by_key(instance, *key); + cdap_sent_del(instance, r); + release_invoke_id(instance, + key_to_invoke_id(r->key)); + cdap_req_destroy(r); + } + + free(keys); + return NULL; + } + + if (ret < 0) { + release_invoke_id(instance, iid); + cdap_sent_del(instance, req); + } + + ++key; } - return key; + pthread_rwlock_unlock(&instance->flows_lock); + + return keys; } int cdap_reply_wait(struct cdap * instance, @@ -609,11 +731,14 @@ int cdap_reply_send(struct cdap * instance, { cdap_t msg = CDAP__INIT; invoke_id_t iid = key_to_invoke_id(key); + struct cdap_req * req = cdap_sent_get_by_key(instance, key); + if (req == NULL) + return -EINVAL; if (instance == NULL) return -EINVAL; - msg.opcode = OPCODE__REPLY; + msg.opcode = CDAP_REPLY; msg.invoke_id = iid; msg.has_result = true; msg.result = result; @@ -624,5 +749,5 @@ int cdap_reply_send(struct cdap * instance, msg.value.len = len; } - return write_msg(instance, &msg); + return write_msg(req->fd, &msg); } diff --git a/src/lib/cdap.proto b/src/lib/cdap.proto index 5fde1658..120b2c97 100644 --- a/src/lib/cdap.proto +++ b/src/lib/cdap.proto @@ -23,18 +23,8 @@ syntax = "proto2"; -enum opcode { - CREATE = 1; - DELETE = 2; - READ = 3; - WRITE = 4; - START = 5; - STOP = 6; - REPLY = 7; -} - message cdap { - required opcode opcode = 1; + required uint32 opcode = 1; required uint32 invoke_id = 2; optional uint32 flags = 3; optional string name = 4; diff --git a/src/lib/cdap_req.c b/src/lib/cdap_req.c index a0348a14..b60e73ad 100644 --- a/src/lib/cdap_req.c +++ b/src/lib/cdap_req.c @@ -30,7 +30,8 @@ #include #include -struct cdap_req * cdap_req_create(cdap_key_t key) +struct cdap_req * cdap_req_create(int fd, + cdap_key_t key) { struct cdap_req * creq = malloc(sizeof(*creq)); pthread_condattr_t cattr; @@ -38,10 +39,10 @@ struct cdap_req * cdap_req_create(cdap_key_t key) if (creq == NULL) return NULL; - creq->key = key; + creq->fd = fd; + creq->key = key; creq->state = REQ_INIT; - - creq->response = -1; + creq->response = -1; creq->data.data = NULL; creq->data.len = 0; diff --git a/src/lib/cdap_req.h b/src/lib/cdap_req.h index 9023357d..fe8e3613 100644 --- a/src/lib/cdap_req.h +++ b/src/lib/cdap_req.h @@ -43,8 +43,8 @@ enum creq_state { struct cdap_req { struct list_head next; + int fd; struct timespec birth; - cdap_key_t key; int response; @@ -55,7 +55,8 @@ struct cdap_req { pthread_mutex_t lock; }; -struct cdap_req * cdap_req_create(cdap_key_t key); +struct cdap_req * cdap_req_create(int fd, + cdap_key_t key); void cdap_req_destroy(struct cdap_req * creq); -- cgit v1.2.3 From 0c8d8e419f7c9052d88bb9765bf43b01187977d0 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Tue, 21 Mar 2017 15:21:52 +0100 Subject: lib: Add queued SDUs when adding fd to flow_set This solves some race conditions where packets arrive on a flow before it is added to a flow_set. --- include/ouroboros/shm_rbuff.h | 2 ++ src/lib/dev.c | 6 ++++++ src/lib/shm_rbuff.c | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+) (limited to 'include') diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h index f31dab63..8471f47f 100644 --- a/include/ouroboros/shm_rbuff.h +++ b/include/ouroboros/shm_rbuff.h @@ -53,4 +53,6 @@ ssize_t shm_rbuff_read(struct shm_rbuff * rb); ssize_t shm_rbuff_read_b(struct shm_rbuff * rb, const struct timespec * timeout); +size_t shm_rbuff_queued(struct shm_rbuff * rb); + #endif /* OUROBOROS_SHM_RBUFF_H */ diff --git a/src/lib/dev.c b/src/lib/dev.c index 9ddc5b84..bd706dc8 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -1029,6 +1029,8 @@ int flow_set_add(struct flow_set * set, int fd) { int ret; + size_t sdus; + size_t i; if (set == NULL) return -EINVAL; @@ -1038,6 +1040,10 @@ int flow_set_add(struct flow_set * set, ret = shm_flow_set_add(ai.fqset, set->idx, ai.flows[fd].port_id); + sdus = shm_rbuff_queued(ai.flows[fd].rx_rb); + for (i = 0; i < sdus; i++) + shm_flow_set_notify(ai.fqset, ai.flows[fd].port_id); + pthread_rwlock_unlock(&ai.flows_lock); pthread_rwlock_unlock(&ai.data_lock); diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c index a206a019..b8db7c19 100644 --- a/src/lib/shm_rbuff.c +++ b/src/lib/shm_rbuff.c @@ -384,3 +384,23 @@ void shm_rbuff_fini(struct shm_rbuff * rb) #endif pthread_cleanup_pop(true); } + +size_t shm_rbuff_queued(struct shm_rbuff * rb) +{ + size_t ret; + + assert(rb); + +#ifdef __APPLE__ + pthread_mutex_lock(rb->lock); +#else + if (pthread_mutex_lock(rb->lock) == EOWNERDEAD) + pthread_mutex_consistent(rb->lock); +#endif + + ret = shm_rbuff_used(rb); + + pthread_mutex_unlock(rb->lock); + + return ret; +} -- cgit v1.2.3