1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

ccnl: finish rebase

This commit is contained in:
Christian Mehlis 2014-07-18 20:35:32 +02:00
parent ba22fd41b7
commit d2b78a398f
6 changed files with 23 additions and 18 deletions

View File

@ -42,10 +42,10 @@
#define RIOT_CCN_APPSERVER (1)
#define RIOT_CCN_TESTS (0)
char relay_stack[KERNEL_CONF_STACKSIZE_PRINTF];
char relay_stack[KERNEL_CONF_STACKSIZE_MAIN];
#if RIOT_CCN_APPSERVER
char appserver_stack[KERNEL_CONF_STACKSIZE_PRINTF];
char appserver_stack[KERNEL_CONF_STACKSIZE_MAIN];
#endif
int relay_pid, appserver_pid;
@ -58,10 +58,6 @@ unsigned char big_buf[3 * 1024];
char small_buf[PAYLOAD_SIZE];
#if RIOT_CCN_APPSERVER
static void appserver_thread(void)
{
ccnl_riot_appserver_start(relay_pid);
}
static void riot_ccn_appserver(int argc, char **argv)
{
@ -76,7 +72,7 @@ static void riot_ccn_appserver(int argc, char **argv)
appserver_pid = thread_create(
appserver_stack, sizeof(appserver_stack),
PRIORITY_MAIN - 1, CREATE_STACKTEST,
appserver_thread, NULL, "appserver");
ccnl_riot_appserver_start, (void *) relay_pid, "appserver");
DEBUG("ccn-lite appserver on thread_id %d...\n", appserver_pid);
}
#endif
@ -186,7 +182,7 @@ static void riot_ccn_relay_start(void)
relay_pid = thread_create(
relay_stack, sizeof(relay_stack),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
relay_thread, NULL, "relay");
ccnl_riot_relay_start, NULL, "relay");
DEBUG("ccn-lite relay on thread_id %d...\n", relay_pid);
riot_ccn_transceiver_start(relay_pid);

View File

@ -75,11 +75,11 @@ int main(void)
relay_pid = thread_getpid();
thread_create(t2_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN + 1,
thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN + 1,
CREATE_STACKTEST, second_thread, NULL, "helper thread");
printf("starting ccn-lite relay...\n");
ccnl_riot_relay_start();
ccnl_riot_relay_start(NULL);
return 0;
}

View File

@ -387,8 +387,10 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
* @param pointer to count transceiver pids
*
*/
void ccnl_riot_relay_start(void)
void *ccnl_riot_relay_start(void *arg)
{
(void) arg;
theRelay = calloc(1, sizeof(struct ccnl_relay_s));
ccnl_get_timeval(&theRelay->startup_time);
theRelay->riot_pid = sched_active_pid;
@ -415,10 +417,12 @@ void ccnl_riot_relay_start(void)
mutex_lock(&theRelay->stop_lock);
ccnl_free(theRelay);
return NULL;
}
void ccnl_riot_relay_helper_start(void)
void *ccnl_riot_relay_helper_start(void *arg)
{
(void) arg;
unsigned long us = CCNL_CHECK_RETRANSMIT_USEC;
mutex_lock(&theRelay->stop_lock);
while (!theRelay->halt_flag) {
@ -430,6 +434,7 @@ void ccnl_riot_relay_helper_start(void)
}
mutex_unlock(&theRelay->stop_lock);
return NULL;
}
// eof

View File

@ -166,12 +166,14 @@ static void riot_ccnl_appserver_register(void)
free(mgnt_pkg);
}
void ccnl_riot_appserver_start(int _relay_pid)
void *ccnl_riot_appserver_start(void *arg)
{
int _relay_pid = (int) arg;
relay_pid = _relay_pid;
riot_ccnl_appserver_register();
riot_ccnl_appserver_ioloop();
DEBUGMSG(1, "appserver terminated\n");
return NULL;
}
#endif

View File

@ -93,11 +93,13 @@ void riot_send_nack(uint16_t to)
msg_send(&m, to, 0);
}
void ccnl_riot_relay_helper_start(void);
void *ccnl_riot_relay_helper_start(void *);
int riot_start_helper_thread(void)
{
return thread_create(relay_helper_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 2, CREATE_STACKTEST, ccnl_riot_relay_helper_start, "relay-helper");
return thread_create(relay_helper_stack, sizeof(relay_helper_stack),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
ccnl_riot_relay_helper_start, NULL, "relay-helper");
}
char *riot_ccnl_event_to_string(int event)

View File

@ -73,14 +73,14 @@
* @note to stop the relay send msg "RIOT_HALT" to this thread
*
*/
void ccnl_riot_relay_start(void);
void *ccnl_riot_relay_start(void *arg);
/**
* @brief starts an appication server, which can repy to ccn interests
*
* @param relay_pid the pid of the relay
* @param arg the pid of the relay
*/
void ccnl_riot_appserver_start(int relay_pid);
void *ccnl_riot_appserver_start(void *arg);
/**
* @}