Skip to content

Commit

Permalink
ccn-lite-relay now establishes a UDP interface and HTTP socket by def…
Browse files Browse the repository at this point in the history
…ault, using the NDN port numbers
  • Loading branch information
tschudin committed Jun 20, 2014
1 parent 4d21c83 commit aa75161
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 46 deletions.
17 changes: 9 additions & 8 deletions ccn-lite-relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void ccnl_ageing(void *relay, void *aux)

void
ccnl_relay_config(struct ccnl_relay_s *relay, char *ethdev, int udpport,
int tcpport, char *uxpath, int suite, int max_cache_entries,
int httpport, char *uxpath, int suite, int max_cache_entries,
char *crypto_face_path)
{
struct ccnl_if_s *i;
Expand Down Expand Up @@ -368,8 +368,8 @@ ccnl_relay_config(struct ccnl_relay_s *relay, char *ethdev, int udpport,
}

#ifdef USE_HTTP_STATUS
if (tcpport) {
relay->http = ccnl_http_new(relay, tcpport);
if (httpport > 0) {
relay->http = ccnl_http_new(relay, httpport);
}
#endif // USE_HTTP_STATUS

Expand Down Expand Up @@ -634,7 +634,7 @@ main(int argc, char **argv)
{
int opt;
int max_cache_entries = -1;
int udpport, tcpport;
int udpport, httpport;
char *datadir = NULL;
char *ethdev = NULL;
char *crypto_sock_path = 0;
Expand All @@ -646,6 +646,7 @@ main(int argc, char **argv)

time(&theRelay.startup_time);
srandom(time(NULL));
udpport = httpport = NDN_UDP_PORT;

while ((opt = getopt(argc, argv, "hc:d:e:g:i:s:t:u:v:x:p:")) != -1) {
switch (opt) {
Expand All @@ -669,20 +670,20 @@ main(int argc, char **argv)
switch (suite) {
#ifdef USE_SUITE_CCNB
case CCNL_SUITE_CCNB:
udpport = tcpport = CCN_UDP_PORT;
udpport = httpport = CCN_UDP_PORT;
break;
#endif
#ifdef USE_SUITE_NDNTLV
case CCNL_SUITE_NDNTLV:
udpport = tcpport = NDN_UDP_PORT;
udpport = httpport = NDN_UDP_PORT;
break;
default:
break;
}
break;
#endif
case 't':
tcpport = atoi(optarg);
httpport = atoi(optarg);
break;
case 'u':
udpport = atoi(optarg);
Expand Down Expand Up @@ -723,7 +724,7 @@ main(int argc, char **argv)
DEBUGMSG(1, " compile time: %s %s\n", __DATE__, __TIME__);
DEBUGMSG(1, " compile options: %s\n", compile_string());

ccnl_relay_config(&theRelay, ethdev, udpport, tcpport,
ccnl_relay_config(&theRelay, ethdev, udpport, httpport,
uxpath, suite, max_cache_entries, crypto_sock_path);
if (datadir)
ccnl_populate_cache(&theRelay, datadir, suite);
Expand Down
30 changes: 18 additions & 12 deletions ccnl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,40 +254,46 @@ compile_string(void)
{
static const char *cp = ""
#ifdef USE_CCNxDIGEST
"USE_CCNxDIGEST "
"CCNxDIGEST, "
#endif
#ifdef USE_DEBUG
"USE_DEBUG "
"DEBUG, "
#endif
#ifdef USE_DEBUG_MALLOC
"USE_DEBUG_MALLOC "
"DEBUG_MALLOC, "
#endif
#ifdef USE_FRAG
"USE_FRAG "
"FRAG, "
#endif
#ifdef USE_ETHERNET
"USE_ETHERNET "
"ETHERNET, "
#endif
#ifdef USE_HTTP_STATUS
"USE_HTTP_STATUS "
"HTTP_STATUS, "
#endif
#ifdef USE_MGMT
"USE_MGMT "
"MGMT, "
#endif
#ifdef USE_SCHEDULER
"USE_SCHEDULER "
"SCHEDULER, "
#endif
#ifdef USE_SUITE_CCNB
"USE_SUITE_CCNB "
"SUITE_CCNB, "
#endif
#ifdef USE_SUITE_CCNTLV
"USE_SUITE_CCNTLV "
"SUITE_CCNTLV, "
#endif
#ifdef USE_SUITE_LOCALRPC
"SUITE_LOCALRPC, "
#endif
#ifdef USE_SUITE_NDNTLV
"USE_SUITE_NDNTLV "
"SUITE_NDNTLV, "
#endif
#ifdef USE_UNIXSOCKET
"USE_UNIXSOCKET "
"UNIXSOCKET, "
#endif
#ifdef USE_SIGNATURES
"SIGNATURES, "
#endif
;
return cp;
Expand Down
30 changes: 4 additions & 26 deletions ccnl-ext-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ ccnl_http_new(struct ccnl_relay_s *ccnl, int serverport)
}
http->server = s;

DEBUGMSG(1, "HTTP status server listening at TCP port %d\n", serverport);

return http;
}

Expand Down Expand Up @@ -298,32 +300,8 @@ ccnl_http_status(struct ccnl_relay_s *ccnl, struct ccnl_http_s *http)
len += sprintf(txt+len, "<tr><td>nonces.max:"
"<td align=right> %d<td>\n", CCNL_MAX_NONCES);

len += sprintf(txt+len, "<tr><td>compile.featureset:<td><td>");
#ifdef USE_DEBUG
len += sprintf(txt+len, " DEBUG");
#endif
#ifdef USE_DEBUG_MALLOC
len += sprintf(txt+len, " DEBUG_MALLOC");
#endif
#ifdef USE_FRAG
len += sprintf(txt+len, " FRAGS");
#endif
#ifdef USE_ETHERNET
len += sprintf(txt+len, " ETHERNET");
#endif
#ifdef USE_HTTP_STATUS
len += sprintf(txt+len, " HTTP_STATUS");
#endif
#ifdef USE_MGMT
len += sprintf(txt+len, " MGMT");
#endif
#ifdef USE_SCHEDULER
len += sprintf(txt+len, " SCHEDULER");
#endif
#ifdef USE_UNIXSOCKET
len += sprintf(txt+len, " UNIXSOCKET");
#endif
len += sprintf(txt+len, "\n");
len += sprintf(txt+len, "<tr><td>compile.featureset:<td><td> %s\n",
compile_string());
len += sprintf(txt+len, "<tr><td>compile.time:"
"<td><td>%s %s\n", __DATE__, __TIME__);
len += sprintf(txt+len, "<tr><td>compile.ccnl_core_version:"
Expand Down

0 comments on commit aa75161

Please sign in to comment.