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. --- 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 +- 11 files changed, 16 insertions(+), 40 deletions(-) (limited to 'src/ipcpd/normal') 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; -- cgit v1.2.3