From 791468646dc749d34ad4a3ad144246b9d2c6eae8 Mon Sep 17 00:00:00 2001 From: powellda Date: Fri, 18 May 2018 20:25:27 +0100 Subject: [PATCH] adding demonstrator v0.2 --- evaluation/demonstration/client.c | 4 ++-- evaluation/demonstration/common.c | 21 +++------------------ evaluation/demonstration/common.h | 8 ++++---- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/evaluation/demonstration/client.c b/evaluation/demonstration/client.c index 80cc5f9..8bd37aa 100644 --- a/evaluation/demonstration/client.c +++ b/evaluation/demonstration/client.c @@ -154,7 +154,7 @@ client_Connect(SSL_CTX *ptSSLctx, ClientConfig *ptConf) iStatus=COMMON_AppendProxy(ptConf->pSSL,ptConf->MiddleboxURLs[i]); } /*step 2.2 - add server url*/ - iStatus=COMMON_AppendClientServer(ptConf->pSSL,ptConf->serverURL,1); + iStatus=COMMON_SetServer(ptConf->pSSL,ptConf->serverURL); /*step 3 - set the middlebox access permissions*/ /*for demonstration purposed, we will set by the following rule: @@ -168,7 +168,7 @@ client_Connect(SSL_CTX *ptSSLctx, ClientConfig *ptConf) /*grant server*/ iStatus=COMMON_SetProxyAccessPermissionByID(ptConf->pSSL,ptConf->pSSL->slices[j]->slice_id, ptConf->numMiddleboxes-1, 1,1); - for(i=0;i!=ptConf->numMiddleboxes-1;i++) { /*change to i=1 if client included*/ + for(i=0;i!=ptConf->numMiddleboxes/*-1*/;i++) { /*change to i=1 if client included*/ char *sMBoxUrl=ptConf->pSSL->proxies[i]->address; char *sPort=strchr(sMBoxUrl,':'); assert(sPort); diff --git a/evaluation/demonstration/common.c b/evaluation/demonstration/common.c index 7f08ffd..8293861 100644 --- a/evaluation/demonstration/common.c +++ b/evaluation/demonstration/common.c @@ -139,28 +139,13 @@ COMMON_AppendProxy(SSL *ptSSL, return SUCCESS; } ERROR_STATUS -COMMON_AppendClientServer(SSL *ptSSL, - const char *psURL, int isServer) +COMMON_SetServer(SSL *ptSSL, + const char *psURL) { char *psUrlCpy=NULL; - if(ptSSL->proxies_len>=(sizeof(ptSSL->proxies)/sizeof(ptSSL->proxies[0]))) - return ARRAY_OVERFLOW; - - /*SPP_generate_proxy will generate something with the string provide - * but there is no guarantee that it will be sensible if - * invalid data is passed in*/ psUrlCpy=strdup(psURL); - /* TODO - SPP_generate_proxy probably won't assign the correct ID's - * to denote server and client - */ - if(isServer) { - ptSSL->proxies[ptSSL->proxies_len] = SPP_generate_proxy(ptSSL, psUrlCpy); - (ptSSL->proxies_len)++; - } else { /*isClient*/ - memmove(&ptSSL->proxies[1],&ptSSL->proxies[0],ptSSL->proxies_len * sizeof(*ptSSL->proxies)); - ptSSL->proxies[0] = SPP_generate_proxy(ptSSL, psUrlCpy); - } + ptSSL->spp_server_address = psUrlCpy; return SUCCESS; } ERROR_STATUS diff --git a/evaluation/demonstration/common.h b/evaluation/demonstration/common.h index 1ebc06a..1259ba0 100644 --- a/evaluation/demonstration/common.h +++ b/evaluation/demonstration/common.h @@ -8,8 +8,8 @@ #include #include -#define DEFAULT_SERVER_PORT 168888 -#define DEFAULT_MBOX_PORT 169000 +#define DEFAULT_SERVER_PORT 4433 +#define DEFAULT_MBOX_PORT 8423 #define str(x) #x #define xstr(x) str(x) @@ -71,8 +71,8 @@ ERROR_STATUS COMMON_AppendProxy(SSL *ptSSL, const char *psProxyURL); ERROR_STATUS -COMMON_AppendClientServer(SSL *ptSSL, - const char *psURL, int isServer); +COMMON_SetServer(SSL *ptSSL, + const char *psURL); ERROR_STATUS COMMON_AppendContext(SSL *ptSSL, const char *psContextDesc); -- GitLab