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. --- src/ipcpd/normal/cdap_flow.c | 24 +++++++++---------- src/ipcpd/normal/cdap_flow.h | 20 ++++++++-------- src/ipcpd/normal/enroll.c | 20 ++++++++-------- src/ipcpd/normal/fmgr.c | 18 +++++++------- src/ipcpd/normal/gam.c | 52 ++++++++++++++++++++--------------------- src/ipcpd/normal/gam.h | 8 +++---- src/ipcpd/normal/pol-gam-ops.h | 8 +++---- src/ipcpd/normal/pol/complete.c | 2 +- src/ipcpd/normal/pol/complete.h | 6 ++--- 9 files changed, 79 insertions(+), 79 deletions(-) (limited to 'src/ipcpd') diff --git a/src/ipcpd/normal/cdap_flow.c b/src/ipcpd/normal/cdap_flow.c index a94627c2..71ebcc03 100644 --- a/src/ipcpd/normal/cdap_flow.c +++ b/src/ipcpd/normal/cdap_flow.c @@ -38,17 +38,17 @@ static void cdap_flow_destroy(struct cdap_flow * flow) if (flow->ci != NULL) cdap_destroy(flow->ci); if (flow->info != NULL) { - cacep_info_fini(flow->info); + conn_info_fini(flow->info); free(flow->info); } free(flow); } -struct cdap_flow * cdap_flow_arr(int fd, - int resp, - enum pol_cacep pc, - const struct cacep_info * info) +struct cdap_flow * cdap_flow_arr(int fd, + int resp, + enum pol_cacep pc, + const struct conn_info * info) { struct cdap_flow * flow; @@ -69,7 +69,7 @@ struct cdap_flow * cdap_flow_arr(int fd, flow->fd = fd; flow->ci = NULL; - flow->info = cacep_auth_wait(fd, pc, info); + flow->info = cacep_auth_wait(fd, pc, info, NULL); if (flow->info == NULL) { log_err("Other side failed to authenticate."); cdap_flow_destroy(flow); @@ -86,11 +86,11 @@ struct cdap_flow * cdap_flow_arr(int fd, return flow; } -struct cdap_flow * cdap_flow_alloc(const char * dst_name, - const char * ae_name, - qosspec_t * qs, - enum pol_cacep pc, - const struct cacep_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) { struct cdap_flow * flow; int fd; @@ -123,7 +123,7 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name, flow->fd = fd; flow->ci = NULL; - flow->info = cacep_auth(fd, pc, info); + flow->info = cacep_auth(fd, pc, info, NULL); if (flow->info == NULL) { log_err("Failed to authenticate."); cdap_flow_dealloc(flow); diff --git a/src/ipcpd/normal/cdap_flow.h b/src/ipcpd/normal/cdap_flow.h index c5ca2ab4..14a04f02 100644 --- a/src/ipcpd/normal/cdap_flow.h +++ b/src/ipcpd/normal/cdap_flow.h @@ -30,19 +30,19 @@ struct cdap_flow { int fd; struct cdap * ci; - struct cacep_info * info; + struct conn_info * info; }; -struct cdap_flow * cdap_flow_arr(int fd, - int resp, - enum pol_cacep pc, - const struct cacep_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, - const char * ae_name, - qosspec_t * qs, - enum pol_cacep pc, - const struct cacep_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); void cdap_flow_dealloc(struct cdap_flow * flow); diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index ce6768fb..78bc4d51 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 cacep_info info; + struct conn_info info; cdap_key_t key; enum cdap_opcode oc; char * name; @@ -61,11 +61,11 @@ int enroll_handle(int fd) char * members_ro = MEMBERS_PATH; char * dif_ro = DIF_PATH; - cacep_info_init(&info); + conn_info_init(&info); info.proto.protocol = strdup(CDAP_PROTO); if (info.proto.protocol == NULL) { - cacep_info_fini(&info); + conn_info_fini(&info); return -ENOMEM; } @@ -75,12 +75,12 @@ int enroll_handle(int fd) flow = cdap_flow_arr(fd, 0, ANONYMOUS_AUTH, &info); if (flow == NULL) { log_err("Failed to auth enrollment request."); - cacep_info_fini(&info); + conn_info_fini(&info); flow_dealloc(fd); return -1; } - cacep_info_fini(&info); + conn_info_fini(&info); while (!(boot_r && members_r && dif_name_r)) { key = cdap_request_wait(flow->ci, &oc, &name, &data, @@ -156,7 +156,7 @@ int enroll_handle(int fd) int enroll_boot(char * dst_name) { struct cdap_flow * flow; - struct cacep_info info; + struct conn_info info; cdap_key_t key; uint8_t * data; size_t len; @@ -170,11 +170,11 @@ int enroll_boot(char * dst_name) char * members_ro = MEMBERS_PATH; char * dif_ro = DIF_PATH; - cacep_info_init(&info); + conn_info_init(&info); info.proto.protocol = strdup(CDAP_PROTO); if (info.proto.protocol == NULL) { - cacep_info_fini(&info); + conn_info_fini(&info); return -ENOMEM; } @@ -185,11 +185,11 @@ int enroll_boot(char * dst_name) &info); if (flow == NULL) { log_err("Failed to allocate flow for enrollment request."); - cacep_info_fini(&info); + conn_info_fini(&info); return -1; } - cacep_info_fini(&info); + conn_info_fini(&info); log_dbg("Getting boot information from %s.", dst_name); diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index c2b53abf..74bdda88 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -49,10 +49,10 @@ typedef FlowAllocMsg flow_alloc_msg_t; #define FD_UPDATE_TIMEOUT 100000 /* nanoseconds */ struct nm1_flow { - struct list_head next; - int fd; - qosspec_t qs; - struct cacep_info * info; + struct list_head next; + int fd; + qosspec_t qs; + struct conn_info * info; }; struct { @@ -194,11 +194,11 @@ void * fmgr_nm1_sdu_reader(void * o) static void * fmgr_nm1_flow_wait(void * o) { - qoscube_t cube; - struct cacep_info * info; - int fd; - qosspec_t qs; - struct nm1_flow * flow; + qoscube_t cube; + struct conn_info * info; + int fd; + qosspec_t qs; + struct nm1_flow * flow; (void) o; diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c index 791cf34e..02df0be7 100644 --- a/src/ipcpd/normal/gam.c +++ b/src/ipcpd/normal/gam.c @@ -45,7 +45,7 @@ struct ga { qosspec_t qs; int fd; - struct cacep_info * info; + struct conn_info * info; }; struct gam { @@ -148,10 +148,10 @@ void gam_destroy(struct gam * instance) free(instance); } -static int add_ga(struct gam * instance, - int fd, - qosspec_t qs, - struct cacep_info * info) +static int add_ga(struct gam * instance, + int fd, + qosspec_t qs, + struct conn_info * info) { struct ga * ga; @@ -179,8 +179,8 @@ int gam_flow_arr(struct gam * instance, int fd, qosspec_t qs) { - struct cacep_info * rcv_info; - struct cacep_info snd_info; + struct conn_info * rcv_info; + struct conn_info snd_info; if (flow_alloc_resp(fd, instance->ops->accept_new_flow(instance->ops_o)) < 0) { @@ -188,10 +188,10 @@ int gam_flow_arr(struct gam * instance, return -1; } - cacep_info_init(&snd_info); + conn_info_init(&snd_info); snd_info.proto.protocol = strdup(CDAP_PROTO); if (snd_info.proto.protocol == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } @@ -200,22 +200,22 @@ int gam_flow_arr(struct gam * instance, snd_info.addr = ipcpi.address; snd_info.name = strdup(ipcpi.name); if (snd_info.name == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } - rcv_info = cacep_auth_wait(fd, SIMPLE_AUTH, &snd_info); + rcv_info = cacep_auth_wait(fd, SIMPLE_AUTH, &snd_info, NULL); if (rcv_info == NULL) { log_err("Other side failed to authenticate."); - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -1; } - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return 0; } @@ -223,7 +223,7 @@ 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); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return -1; } @@ -235,8 +235,8 @@ int gam_flow_alloc(struct gam * instance, char * dst_name, qosspec_t qs) { - struct cacep_info * rcv_info; - struct cacep_info snd_info; + struct conn_info * rcv_info; + struct conn_info snd_info; int fd; log_dbg("Allocating flow to %s.", dst_name); @@ -253,10 +253,10 @@ int gam_flow_alloc(struct gam * instance, return -1; } - cacep_info_init(&snd_info); + conn_info_init(&snd_info); snd_info.proto.protocol = strdup(CDAP_PROTO); if (snd_info.proto.protocol == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } @@ -265,22 +265,22 @@ int gam_flow_alloc(struct gam * instance, snd_info.addr = ipcpi.address; snd_info.name = strdup(ipcpi.name); if (snd_info.name == NULL) { - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -ENOMEM; } - rcv_info = cacep_auth(fd, SIMPLE_AUTH, &snd_info); + rcv_info = cacep_auth(fd, SIMPLE_AUTH, &snd_info, NULL); if (rcv_info == NULL) { log_err("Other side failed to authenticate."); - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); return -1; } - cacep_info_fini(&snd_info); + conn_info_fini(&snd_info); if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) { flow_dealloc(fd); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return 0; } @@ -288,7 +288,7 @@ 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); - cacep_info_fini(rcv_info); + conn_info_fini(rcv_info); free(rcv_info); return -1; } @@ -298,7 +298,7 @@ int gam_flow_alloc(struct gam * instance, int gam_flow_wait(struct gam * instance, int * fd, - struct cacep_info ** info, + struct conn_info ** info, qosspec_t * qs) { struct ga * ga; diff --git a/src/ipcpd/normal/gam.h b/src/ipcpd/normal/gam.h index 50f83df9..e4832ca6 100644 --- a/src/ipcpd/normal/gam.h +++ b/src/ipcpd/normal/gam.h @@ -39,9 +39,9 @@ int gam_flow_alloc(struct gam * instance, char * dst_name, qosspec_t qs); -int gam_flow_wait(struct gam * instance, - int * fd, - struct cacep_info ** info, - qosspec_t * qs); +int gam_flow_wait(struct gam * instance, + int * fd, + struct conn_info ** info, + qosspec_t * qs); #endif /* OUROBOROS_IPCPD_NORMAL_GAM_H */ diff --git a/src/ipcpd/normal/pol-gam-ops.h b/src/ipcpd/normal/pol-gam-ops.h index 0721136c..6983e3a0 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 +#include "conn.h" struct pol_gam_ops { void * (* create)(struct gam * instance); @@ -36,9 +36,9 @@ struct pol_gam_ops { int (* accept_new_flow)(void * o); - int (* accept_flow)(void * o, - qosspec_t qs, - const struct cacep_info * info); + int (* accept_flow)(void * o, + qosspec_t qs, + const struct conn_info * info); }; #endif /* OUROBOROS_IPCPD_NORMAL_POL_GAM_OPS_H */ diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index 5faa1ae8..1d4811d2 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -153,7 +153,7 @@ int complete_accept_new_flow(void * o) int complete_accept_flow(void * o, qosspec_t qs, - const struct cacep_info * info) + const struct conn_info * info) { struct list_head * pos = NULL; struct neighbor * n; diff --git a/src/ipcpd/normal/pol/complete.h b/src/ipcpd/normal/pol/complete.h index 3f08c2e5..8fe1437f 100644 --- a/src/ipcpd/normal/pol/complete.h +++ b/src/ipcpd/normal/pol/complete.h @@ -36,9 +36,9 @@ int complete_stop(void * o); int complete_accept_new_flow(void * o); -int complete_accept_flow(void * o, - qosspec_t qs, - const struct cacep_info * info); +int complete_accept_flow(void * o, + qosspec_t qs, + const struct conn_info * info); struct pol_gam_ops complete_ops = { .create = complete_create, -- cgit v1.2.3