Sky: Calling NETSTACK_LLSEC.bootstrap from contiki-sky-main.c
This commit is contained in:
parent
bb74fc320f
commit
c7b394c51b
@ -182,6 +182,65 @@ set_gateway(void)
|
||||
}
|
||||
#endif /* WITH_UIP */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
start_autostart_processes()
|
||||
{
|
||||
#if !PROCESS_CONF_NO_PROCESS_NAMES
|
||||
print_processes(autostart_processes);
|
||||
#else /* !PROCESS_CONF_NO_PROCESS_NAMES */
|
||||
putchar('\n'); /* include putchar() */
|
||||
#endif /* !PROCESS_CONF_NO_PROCESS_NAMES */
|
||||
autostart_start(autostart_processes);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if WITH_UIP6
|
||||
static void
|
||||
start_uip6()
|
||||
{
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
process_start(&tcpip_process, NULL);
|
||||
|
||||
printf("Tentative link-local IPv6 address ");
|
||||
{
|
||||
uip_ds6_addr_t *lladdr;
|
||||
int i;
|
||||
lladdr = uip_ds6_get_link_local(-1);
|
||||
for(i = 0; i < 7; ++i) {
|
||||
printf("%02x%02x:", lladdr->ipaddr.u8[i * 2],
|
||||
lladdr->ipaddr.u8[i * 2 + 1]);
|
||||
}
|
||||
printf("%02x%02x\n", lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
|
||||
}
|
||||
|
||||
if(!UIP_CONF_IPV6_RPL) {
|
||||
uip_ipaddr_t ipaddr;
|
||||
int i;
|
||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
|
||||
printf("Tentative global IPv6 address ");
|
||||
for(i = 0; i < 7; ++i) {
|
||||
printf("%02x%02x:",
|
||||
ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]);
|
||||
}
|
||||
printf("%02x%02x\n",
|
||||
ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]);
|
||||
}
|
||||
}
|
||||
#endif /* WITH_UIP6 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
start_network_layer()
|
||||
{
|
||||
#if WITH_UIP6
|
||||
start_uip6();
|
||||
#endif /* WITH_UIP6 */
|
||||
start_autostart_processes();
|
||||
/* To support link layer security in combination with WITH_UIP and
|
||||
* TIMESYNCH_CONF_ENABLED further things may need to be moved here */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if WITH_TINYOS_AUTO_IDS
|
||||
uint16_t TOS_NODE_ID = 0x1234; /* non-zero */
|
||||
uint16_t TOS_LOCAL_ADDRESS = 0x1234; /* non-zero */
|
||||
@ -290,52 +349,22 @@ main(int argc, char **argv)
|
||||
queuebuf_init();
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %s, channel check rate %lu Hz, radio channel %u, CCA threshold %i\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
printf("%s %s %s, channel check rate %lu Hz, radio channel %u, CCA threshold %i\n",
|
||||
NETSTACK_LLSEC.name, NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||
NETSTACK_RDC.channel_check_interval()),
|
||||
CC2420_CONF_CHANNEL,
|
||||
CC2420_CONF_CCA_THRESH);
|
||||
|
||||
process_start(&tcpip_process, NULL);
|
||||
|
||||
printf("Tentative link-local IPv6 address ");
|
||||
{
|
||||
uip_ds6_addr_t *lladdr;
|
||||
int i;
|
||||
lladdr = uip_ds6_get_link_local(-1);
|
||||
for(i = 0; i < 7; ++i) {
|
||||
printf("%02x%02x:", lladdr->ipaddr.u8[i * 2],
|
||||
lladdr->ipaddr.u8[i * 2 + 1]);
|
||||
}
|
||||
printf("%02x%02x\n", lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
|
||||
}
|
||||
|
||||
if(!UIP_CONF_IPV6_RPL) {
|
||||
uip_ipaddr_t ipaddr;
|
||||
int i;
|
||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
|
||||
printf("Tentative global IPv6 address ");
|
||||
for(i = 0; i < 7; ++i) {
|
||||
printf("%02x%02x:",
|
||||
ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]);
|
||||
}
|
||||
printf("%02x%02x\n",
|
||||
ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]);
|
||||
}
|
||||
|
||||
#else /* WITH_UIP6 */
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %s, channel check rate %lu Hz, radio channel %u\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
printf("%s %s %s, channel check rate %lu Hz, radio channel %u\n",
|
||||
NETSTACK_LLSEC.name, NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||
NETSTACK_RDC.channel_check_interval()),
|
||||
CC2420_CONF_CHANNEL);
|
||||
@ -387,12 +416,7 @@ main(int argc, char **argv)
|
||||
|
||||
watchdog_start();
|
||||
|
||||
#if !PROCESS_CONF_NO_PROCESS_NAMES
|
||||
print_processes(autostart_processes);
|
||||
#else /* !PROCESS_CONF_NO_PROCESS_NAMES */
|
||||
putchar('\n'); /* include putchar() */
|
||||
#endif /* !PROCESS_CONF_NO_PROCESS_NAMES */
|
||||
autostart_start(autostart_processes);
|
||||
NETSTACK_LLSEC.bootstrap(start_network_layer);
|
||||
|
||||
/*
|
||||
* This is the scheduler loop.
|
||||
|
Loading…
Reference in New Issue
Block a user