diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-02-24 15:07:39 +0000 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-02-24 15:07:39 +0000 |
commit | 7baebbfc117e3b349f397d4675c49a582d13653a (patch) | |
tree | 96779e5d2cdf964432506f774d5bf61d11b27d68 /src/ipcpd | |
parent | 75cf809a95b75f09ff805b3872dcb71b80fef586 (diff) | |
parent | cdab533860ba69423695e1d08acc25b074a0e065 (diff) | |
download | ouroboros-7baebbfc117e3b349f397d4675c49a582d13653a.tar.gz ouroboros-7baebbfc117e3b349f397d4675c49a582d13653a.zip |
Merged in sandervrijders/ouroboros/be-ae (pull request #392)
lib: Remove application entity name
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/ipcp-ops.h | 51 | ||||
-rw-r--r-- | src/ipcpd/ipcp.c | 1 | ||||
-rw-r--r-- | src/ipcpd/ipcp.h | 1 | ||||
-rw-r--r-- | src/ipcpd/local/main.c | 4 | ||||
-rw-r--r-- | src/ipcpd/normal/cdap_flow.c | 5 | ||||
-rw-r--r-- | src/ipcpd/normal/cdap_flow.h | 1 | ||||
-rw-r--r-- | src/ipcpd/normal/enroll.c | 3 | ||||
-rw-r--r-- | src/ipcpd/normal/flow_alloc.proto | 5 | ||||
-rw-r--r-- | src/ipcpd/normal/fmgr.c | 5 | ||||
-rw-r--r-- | src/ipcpd/normal/fmgr.h | 1 | ||||
-rw-r--r-- | src/ipcpd/normal/gam.c | 20 | ||||
-rw-r--r-- | src/ipcpd/normal/gam.h | 3 | ||||
-rw-r--r-- | src/ipcpd/normal/main.c | 9 | ||||
-rw-r--r-- | src/ipcpd/normal/pol-gam-ops.h | 2 | ||||
-rw-r--r-- | src/ipcpd/normal/ribmgr.c | 2 | ||||
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 15 | ||||
-rw-r--r-- | src/ipcpd/shim-eth-llc/shim_eth_llc_messages.proto | 9 | ||||
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 12 |
18 files changed, 26 insertions, 123 deletions
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 <dimitri.staessens@intec.ugent.be> - * Sander Vrijders <sander.vrijders@intec.ugent.be> - * - * 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 <ouroboros/irm_config.h> -#include <ouroboros/shared.h> - -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 <ouroboros/cacep.h> #include <ouroboros/irm_config.h> -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 <ouroboros/cacep.h> 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); |