examples for uIPv6

ico
julienabeille 2008-10-14 10:01:52 +00:00
parent e7b38010a2
commit f5f0044578
19 changed files with 390 additions and 0 deletions

View File

@ -0,0 +1,8 @@
all: empty
DEFAULT_TARGET=minimal-net
UIP_CONF_IPV6=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

5
examples/new-ipv6/README Normal file
View File

@ -0,0 +1,5 @@
This example just runs the IPv6 stack without any application on the
top.
To test the stack you can, for example, run a ping6 command:
ping6 -I tap0 ff02:0000:0000:0000:0000:0001:ff00:0232

44
examples/new-ipv6/empty.c Normal file
View File

@ -0,0 +1,44 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* No application for this example, this file is a place holder
*/
#include "contiki.h"
//#include <stdio.h>
/*---------------------------------------------------------------------------*/
PROCESS(init_stack_process, "Init stack process");
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(init_stack_process, ev, data)
{
PROCESS_BEGIN();
//printf("WARNING: Running Contiki without application\n");
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
AUTOSTART_PROCESSES(&init_stack_process);
/*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,8 @@
all: example-ping6
APPS=ping6
DEFAULT_TARGET=minimal-net
UIP_CONF_IPV6=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

11
examples/ping-ipv6/README Normal file
View File

@ -0,0 +1,11 @@
Simple ping6 application for testing purpose.
The user should wait for the prompt and input the ping6 command
followed by the destination IPv6 address. The address should not use
any abbreviated form (the application does very little input format
check).
E.g. of a correct command:
> ping6 fe80:0000:0000:0000:02bd:07ff:fee2:1c00
The ping6 application will then send PING6_NB = 5 ping request packets.

View File

@ -0,0 +1,33 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
#include "ping6.h"
/*---------------------------------------------------------------------------*/
AUTOSTART_PROCESSES(&ping6_process);
/*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,9 @@
all:
make TARGET=avr-ravenusb -f Makefile.ravenusbstick ravenusbstick.elf
avr-objcopy -O ihex -R .eeprom ravenusbstick.elf ravenusbstick.hex
avr-size -C ravenusbstick.elf
clean:
make -f Makefile.ravenusbstick clean
rm -rf obj_avr-ravenusb
rm symbols.c symbols.h ravenusbstick.elf ravenusbstick.hex

View File

@ -0,0 +1,13 @@
all: ravenusbstick
DEFAULT_TARGET=avr-ravenusb
CONTIKI_NO_NET=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: ravenusbstick.c,v 1.1 2008/10/14 10:01:52 julienabeille Exp $
*/
/*---------------------------------------------------------------------------*/
//#include "mac_event.h"
#include "uip.h"
#include <avr/pgmspace.h>
#include <stdio.h>

View File

@ -0,0 +1,8 @@
all: example-udp-receiver
APPS=udp
DEFAULT_TARGET=minimal-net
UIP_CONF_IPV6=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

View File

@ -0,0 +1,32 @@
This example features a simple application listening for udp packets on port
0xF0B0 (src F0B1). It must be used in conjonction with a node running
udp-sender-ipv6 example.
We use this example to test UDP, and most particularly UDP header compression
with IPv6 and 6lowpan support. When IPv6 is used over an 802.15.4 link,
6lowpan acts as teh adaptation layer between IPv6 and MAC. In particular, it
can compress packet headers. IP header is compressed, as well as UDP header.
With both HC1 and HC01 header compression schemes, UDP 16-bit ports are
compressed to 4 bits if they are between F0B0 and F0BF.
sender behavior:
The sender is implemented in apps/udp/udp-sender.c and acts the following way:
it waits 15 seconds (to be sure the node configures a global address, in case
a router on the link sends router advertisements usable for address
autoconfiguration) , then sends 5 UDP packets to the receiver address
entered staticvally in apps/udp/udp-sender.c.
receiver behavior:
When receiving a packet, the receiver answers with a simmilar packet.
To run this example, contiki-conf.h must have at least the following flags
values:
#define UIP_CONF_UDP 1
#define UIP_CONF_IPV6 1
You must configure addresses in apps/udp/udp-sender.c and apps/udp/udp-receiver.c
which match your platforms addresses.

View File

@ -0,0 +1,34 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: example-udp-receiver.c,v 1.1 2008/10/14 10:01:52 julienabeille Exp $
*/
#include "udp.h"
AUTOSTART_PROCESSES(&udp_process_receiver);

View File

@ -0,0 +1,8 @@
all: example-udp-sender
APPS=udp
DEFAULT_TARGET=minimal-net
UIP_CONF_IPV6=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

View File

@ -0,0 +1,29 @@
This example features a simple application sending udp packets on port 0xF0B0,
from port F0B1, to a udp receiver. It must be used in conjonction with a node
running the udp-receiver-ipv6 example.
We use this example to test UDP, and most particularly UDP header compression
with IPv6 and 6lowpan support. When IPv6 is used over an 802.15.4 link,
6lowpan acts as teh adaptation layer between IPv6 and MAC. In particular, it
can compress packet headers. IP header is compressed, as well as UDP header.
With both HC1 and HC01 header compression schemes, UDP 16-bit ports are
compressed to 4 bits if they are between F0B0 and F0BF.
sender behavior:
The sender is implemented in apps/udp/udp-sender.c and acts the following way:
it waits 15 seconds (to be sure the node configures a global address, in case
a router on the link sends router advertisements usable for address
autoconfiguration) , then sends 5 UDP packets to the receiver address
entered staticvally in apps/udp/udp-sender.c.
receiver behavior:
When receiving a packet, the receiver answers with a simmilar packet.
To run this example, contiki-conf.h must have at least the following flags
values:
#define UIP_CONF_UDP 1
#define UIP_CONF_IPV6 1
You must configure addresses in apps/udp/udp-sender.c and apps/udp/udp-receiver.c
which match your platforms addresses.

View File

@ -0,0 +1,33 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: example-udp-sender.c,v 1.1 2008/10/14 10:01:52 julienabeille Exp $
*/
#include "udp.h"
AUTOSTART_PROCESSES(&udp_process_sender);

View File

@ -0,0 +1,9 @@
all:
make -f Makefile.example TARGET=avr-raven webserver6.elf
avr-objcopy -O ihex -R .eeprom webserver6.elf webserver6.hex
avr-size -C webserver6.elf
clean:
make -f Makefile.example TARGET=avr-raven clean
rm symbols.c symbols.h webserver6.elf webserver6.hex
rm -rf obj_avr-raven

View File

@ -0,0 +1,8 @@
all: webserver6
APPS=webserver raven-lcd-interface
DEFAULT_TARGET=minimal-net
UIP_CONF_IPV6=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

View File

@ -0,0 +1,21 @@
This example features a simple webserver running on top of the IPv6
contiki stack.
For this example to run properly the UIP_CONF_TCP compilation flag
must be set to 1 in the contiki-conf.h file of the platform.
If you are using the minimal-net platform on linux you can test the
code as follows:
- First do 'ifconfig tap0 inet6 3ffe:0501:ffff:0100:0206:98ff:fe00:0231'
or 'ip -6 address add 3ffe:0501:ffff:0100:0206:98ff:fe00:0231' dev tap0.
- You might need to add a route 'ip -6 route add
aaaa:0000:0000:0000:0206:98ff:fe00:0232/64 dev tap0'
- Then configure a global address by sending a router advertisement (RA)
with a prefix option. You can use radvd for example to generate such a
packet.
Assume the prefix in the RA is:
3ffe:0501:ffff:0100:0000:0000:0000:0000/64.
and that the resulting address created by the contiki stack is:
3ffe:0501:ffff:0100:0206:98ff:fe00:0232
- Finally you can use 'wget http://[3ffe:0501:ffff:0100:0206:98ff:fe00:0232]'
to get the web page (index.html file)

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: webserver6.c,v 1.1 2008/10/14 10:01:53 julienabeille Exp $
*/
#include "webserver-nogui.h"
/*---------------------------------------------------------------------------*/
AUTOSTART_PROCESSES(&webserver_nogui_process);
/*---------------------------------------------------------------------------*/