Commit 79146864 authored by powelld's avatar powelld

adding demonstrator v0.2

parent 9d920694
...@@ -154,7 +154,7 @@ client_Connect(SSL_CTX *ptSSLctx, ClientConfig *ptConf) ...@@ -154,7 +154,7 @@ client_Connect(SSL_CTX *ptSSLctx, ClientConfig *ptConf)
iStatus=COMMON_AppendProxy(ptConf->pSSL,ptConf->MiddleboxURLs[i]); iStatus=COMMON_AppendProxy(ptConf->pSSL,ptConf->MiddleboxURLs[i]);
} }
/*step 2.2 - add server url*/ /*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*/ /*step 3 - set the middlebox access permissions*/
/*for demonstration purposed, we will set by the following rule: /*for demonstration purposed, we will set by the following rule:
...@@ -168,7 +168,7 @@ client_Connect(SSL_CTX *ptSSLctx, ClientConfig *ptConf) ...@@ -168,7 +168,7 @@ client_Connect(SSL_CTX *ptSSLctx, ClientConfig *ptConf)
/*grant server*/ /*grant server*/
iStatus=COMMON_SetProxyAccessPermissionByID(ptConf->pSSL,ptConf->pSSL->slices[j]->slice_id, ptConf->numMiddleboxes-1, iStatus=COMMON_SetProxyAccessPermissionByID(ptConf->pSSL,ptConf->pSSL->slices[j]->slice_id, ptConf->numMiddleboxes-1,
1,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 *sMBoxUrl=ptConf->pSSL->proxies[i]->address;
char *sPort=strchr(sMBoxUrl,':'); char *sPort=strchr(sMBoxUrl,':');
assert(sPort); assert(sPort);
......
...@@ -139,28 +139,13 @@ COMMON_AppendProxy(SSL *ptSSL, ...@@ -139,28 +139,13 @@ COMMON_AppendProxy(SSL *ptSSL,
return SUCCESS; return SUCCESS;
} }
ERROR_STATUS ERROR_STATUS
COMMON_AppendClientServer(SSL *ptSSL, COMMON_SetServer(SSL *ptSSL,
const char *psURL, int isServer) const char *psURL)
{ {
char *psUrlCpy=NULL; 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); psUrlCpy=strdup(psURL);
/* TODO - SPP_generate_proxy probably won't assign the correct ID's ptSSL->spp_server_address = psUrlCpy;
* 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);
}
return SUCCESS; return SUCCESS;
} }
ERROR_STATUS ERROR_STATUS
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#define DEFAULT_SERVER_PORT 168888 #define DEFAULT_SERVER_PORT 4433
#define DEFAULT_MBOX_PORT 169000 #define DEFAULT_MBOX_PORT 8423
#define str(x) #x #define str(x) #x
#define xstr(x) str(x) #define xstr(x) str(x)
...@@ -71,8 +71,8 @@ ERROR_STATUS ...@@ -71,8 +71,8 @@ ERROR_STATUS
COMMON_AppendProxy(SSL *ptSSL, COMMON_AppendProxy(SSL *ptSSL,
const char *psProxyURL); const char *psProxyURL);
ERROR_STATUS ERROR_STATUS
COMMON_AppendClientServer(SSL *ptSSL, COMMON_SetServer(SSL *ptSSL,
const char *psURL, int isServer); const char *psURL);
ERROR_STATUS ERROR_STATUS
COMMON_AppendContext(SSL *ptSSL, COMMON_AppendContext(SSL *ptSSL,
const char *psContextDesc); const char *psContextDesc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment