diff --git a/apps/servreg-hack/servreg-hack.c b/apps/servreg-hack/servreg-hack.c deleted file mode 100644 index d7ccf7dac..000000000 --- a/apps/servreg-hack/servreg-hack.c +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * Implementation of the servreg-hack application - * \author - * Adam Dunkels - */ - -/** \addtogroup servreghack - * @{ */ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - -#include "net/ip/uip.h" - -#include "net/ipv6/uip-ds6.h" - -#include "servreg-hack.h" - -#include - -struct servreg_hack_registration { - struct servreg_hack_registration *next; - - struct timer timer; - uip_ipaddr_t addr; - servreg_hack_id_t id; - uint8_t seqno; -}; - - -#define MAX_REGISTRATIONS 16 - -LIST(others_services); -LIST(own_services); - -MEMB(registrations, struct servreg_hack_registration, MAX_REGISTRATIONS); - -PROCESS(servreg_hack_process, "Service regstry hack"); - -#define PERIOD_TIME 120 * CLOCK_SECOND - -#define NEW_REG_TIME 10 * CLOCK_SECOND - -#define MAX_BUFSIZE 2 + 80 - -#define UDP_PORT 61616 - -#define LIFETIME 10 * 60 * CLOCK_SECOND - -#define SEQNO_LT(a, b) ((signed char)((a) - (b)) < 0) - -static struct etimer sendtimer; - -static uint8_t started = 0; - -/*---------------------------------------------------------------------------*/ -/* Go through the list of registrations and remove those that are too - old. */ -static void -purge_registrations(void) -{ - struct servreg_hack_registration *t; - - for(t = list_head(own_services); - t != NULL; - t = list_item_next(t)) { - if(timer_expired(&t->timer)) { - t->seqno++; - timer_set(&t->timer, LIFETIME / 2); - } - } - - for(t = list_head(others_services); - t != NULL; - t = list_item_next(t)) { - if(timer_expired(&t->timer)) { - list_remove(others_services, t); - memb_free(®istrations, t); - t = list_head(others_services); - } - } -} -/*---------------------------------------------------------------------------*/ -void -servreg_hack_init(void) -{ - if(started == 0) { - list_init(others_services); - list_init(own_services); - memb_init(®istrations); - - process_start(&servreg_hack_process, NULL); - started = 1; - } -} -/*---------------------------------------------------------------------------*/ -void -servreg_hack_register(servreg_hack_id_t id, const uip_ipaddr_t *addr) -{ - servreg_hack_item_t *t; - struct servreg_hack_registration *r; - /* Walk through list, see if we already have a service ID - registered. If not, allocate a new registration and put it on our - list. If we cannot allocate a service registration, we reuse one - from the service registrations made by others. */ - - servreg_hack_init(); - - for(t = list_head(own_services); - t != NULL; - t = list_item_next(t)) { - if(servreg_hack_item_id(t) == id) { - return; - } - } - - r = memb_alloc(®istrations); - if(r == NULL) { - printf("servreg_hack_register: error, could not allocate memory, should reclaim another registration but this has not been implemented yet.\n"); - return; - } - r->id = id; - r->seqno = 1; - uip_ipaddr_copy(&r->addr, addr); - timer_set(&r->timer, LIFETIME / 2); - list_push(own_services, r); - - - PROCESS_CONTEXT_BEGIN(&servreg_hack_process); - etimer_set(&sendtimer, random_rand() % (NEW_REG_TIME)); - PROCESS_CONTEXT_END(&servreg_hack_process); - -} -/*---------------------------------------------------------------------------*/ -servreg_hack_item_t * -servreg_hack_list_head(void) -{ - purge_registrations(); - return list_head(others_services); -} -/*---------------------------------------------------------------------------*/ -servreg_hack_id_t -servreg_hack_item_id(servreg_hack_item_t *item) -{ - return ((struct servreg_hack_registration *)item)->id; -} -/*---------------------------------------------------------------------------*/ -uip_ipaddr_t * -servreg_hack_item_address(servreg_hack_item_t *item) -{ - return &((struct servreg_hack_registration *)item)->addr; -} -/*---------------------------------------------------------------------------*/ -uip_ipaddr_t * -servreg_hack_lookup(servreg_hack_id_t id) -{ - servreg_hack_item_t *t; - - servreg_hack_init(); - - purge_registrations(); - - for(t = servreg_hack_list_head(); t != NULL; t = list_item_next(t)) { - if(servreg_hack_item_id(t) == id) { - return servreg_hack_item_address(t); - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static void -handle_incoming_reg(const uip_ipaddr_t *owner, servreg_hack_id_t id, uint8_t seqno) -{ - servreg_hack_item_t *t; - struct servreg_hack_registration *r; - - /* Walk through list, see if we already have a service ID - registered. If so, we do different things depending on the seqno - of the update: if the seqno is older than what we have, we - discard the incoming registration. If the seqno is newer than - what we have, we reset the lifetime timer of the current - registration. - - If we did not have the service registered already, we allocate a - new registration and put it on our list. If we cannot allocate a - service registration, we discard the incoming registration (for - now - we might later choose to discard the oldest registration - that we have). */ - - for(t = servreg_hack_list_head(); - t != NULL; - t = list_item_next(t)) { - if(servreg_hack_item_id(t) == id) { - r = t; - if(SEQNO_LT(r->seqno, seqno)) { - r->seqno = seqno; - timer_set(&r->timer, LIFETIME); - - /* Put item first on list, so that subsequent lookups will - find this one. */ - list_remove(others_services, r); - list_push(others_services, r); - } - return; - } - } - - r = memb_alloc(®istrations); - if(r == NULL) { - printf("servreg_hack_register: error, could not allocate memory, should reclaim another registration but this has not been implemented yet.\n"); - return; - } - r->id = id; - r->seqno = 1; - uip_ipaddr_copy(&r->addr, owner); - timer_set(&r->timer, LIFETIME); - list_add(others_services, r); -} -/*---------------------------------------------------------------------------*/ -/* - * The structure of UDP messages: - * - * +-------------------+-------------------+ - * | Numregs (1 byte) | Flags (1 byte) | - * +-------------------+-------------------+-------------------+ - * | IP addr (16 bytes)| 3 regs (3 bytes) | Seqno (1 byte) | - * +-------------------+-------------------+-------------------+ - * | IP addr (16 bytes)| 3 regs (3 bytes) | Seqno (1 byte) | - * +-------------------+-------------------+-------------------+ - * | ... | ... | ... | - * +-------------------+-------------------+-------------------+ - */ - -#define MSG_NUMREGS_OFFSET 0 -#define MSG_FLAGS_OFFSET 1 -#define MSG_ADDRS_OFFSET 2 - -#define MSG_IPADDR_SUBOFFSET 0 -#define MSG_REGS_SUBOFFSET 16 -#define MSG_SEQNO_SUBOFFSET 19 - -#define MSG_ADDRS_LEN 20 - -/*---------------------------------------------------------------------------*/ -static void -send_udp_packet(struct uip_udp_conn *conn) -{ - int numregs; - uint8_t buf[MAX_BUFSIZE]; - int bufptr; - servreg_hack_item_t *t; - - buf[MSG_FLAGS_OFFSET] = 0; - - numregs = 0; - bufptr = MSG_ADDRS_OFFSET; - - for(t = list_head(own_services); - (bufptr + MSG_ADDRS_LEN <= MAX_BUFSIZE) && t != NULL; - t = list_item_next(t)) { - - uip_ipaddr_copy((uip_ipaddr_t *)&buf[bufptr + MSG_IPADDR_SUBOFFSET], - servreg_hack_item_address(t)); - buf[bufptr + MSG_REGS_SUBOFFSET] = - servreg_hack_item_id(t); - buf[bufptr + MSG_REGS_SUBOFFSET + 1] = - buf[bufptr + MSG_REGS_SUBOFFSET + 2] = 0; - buf[bufptr + MSG_SEQNO_SUBOFFSET] = ((struct servreg_hack_registration *)t)->seqno; - - bufptr += MSG_ADDRS_LEN; - ++numregs; - } - - for(t = servreg_hack_list_head(); - (bufptr + MSG_ADDRS_LEN <= MAX_BUFSIZE) && t != NULL; - t = list_item_next(t)) { - uip_ipaddr_copy((uip_ipaddr_t *)&buf[bufptr + MSG_IPADDR_SUBOFFSET], - servreg_hack_item_address(t)); - buf[bufptr + MSG_REGS_SUBOFFSET] = - servreg_hack_item_id(t); - buf[bufptr + MSG_REGS_SUBOFFSET + 1] = - buf[bufptr + MSG_REGS_SUBOFFSET + 2] = 0; - buf[bufptr + MSG_SEQNO_SUBOFFSET] = ((struct servreg_hack_registration *)t)->seqno; - - bufptr += MSG_ADDRS_LEN; - ++numregs; - } - /* printf("send_udp_packet numregs %d\n", numregs);*/ - buf[MSG_NUMREGS_OFFSET] = numregs; - - if(numregs > 0) { - /* printf("Sending buffer len %d\n", bufptr);*/ - uip_udp_packet_send(conn, buf, bufptr); - } -} -/*---------------------------------------------------------------------------*/ -static void -parse_incoming_packet(const uint8_t *buf, int len) -{ - int numregs; - int i; - int bufptr; - - numregs = buf[MSG_NUMREGS_OFFSET]; - - bufptr = MSG_ADDRS_OFFSET; - for(i = 0; i < numregs; ++i) { - handle_incoming_reg((uip_ipaddr_t *)&buf[bufptr + MSG_IPADDR_SUBOFFSET], - buf[bufptr + MSG_REGS_SUBOFFSET], - buf[bufptr + MSG_SEQNO_SUBOFFSET]); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(servreg_hack_process, ev, data) -{ - static struct etimer periodic; - static struct uip_udp_conn *outconn, *inconn; - PROCESS_BEGIN(); - - /* Create outbound UDP connection. */ - outconn = udp_broadcast_new(UIP_HTONS(UDP_PORT), NULL); - udp_bind(outconn, UIP_HTONS(UDP_PORT)); - - /* Create inbound UDP connection. */ - inconn = udp_new(NULL, UIP_HTONS(UDP_PORT), NULL); - udp_bind(inconn, UIP_HTONS(UDP_PORT)); - - etimer_set(&periodic, PERIOD_TIME); - etimer_set(&sendtimer, random_rand() % (PERIOD_TIME)); - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == PROCESS_EVENT_TIMER && data == &periodic) { - etimer_reset(&periodic); - etimer_set(&sendtimer, random_rand() % (PERIOD_TIME)); - } else if(ev == PROCESS_EVENT_TIMER && data == &sendtimer) { - send_udp_packet(outconn); - } else if(ev == tcpip_event) { - parse_incoming_packet(uip_appdata, uip_datalen()); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/apps/servreg-hack/servreg-hack.h b/apps/servreg-hack/servreg-hack.h deleted file mode 100644 index b24590f90..000000000 --- a/apps/servreg-hack/servreg-hack.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * Header file for the servreg-hack application - * \author - * Adam Dunkels - */ - -/** \addtogroup apps - * @{ */ - -/** - * \defgroup servreghack A service registration and diseemination hack - * @{ - * - * This application is a quick'n'dirty hack for registering, - * disseminating, and looking up services. A service is identified by - * an 8-bit integer between 1 and 255. Integers below 128 are reserved - * for system services. - * - * A service is registered with the function - * servreg_hack_register(). Registered services will be transmitted to - * all neighbors that run the servreg-hack application. These will in - * turn resend the registration to their neighbors. - * - * Services from neighbors are stored in a local table. Services - * stored in the table can be looked up using a combination of the - * servreg_hack_list() and servreg_hack_item_match() functions. - * - */ - -#ifndef SERVREG_HACK_H -#define SERVREG_HACK_H - -#include "contiki-conf.h" -#include "net/ip/uip.h" - -typedef uint8_t servreg_hack_id_t; -typedef void servreg_hack_item_t; - -/** - * \brief Initialize and start the servreg-hack application - * - * This function initializes and starts the servreg-hack - * application and daemon. - */ -void servreg_hack_init(void); - -/** - * \brief Register that this node provides a service - * \param service_id The 8-bit ID for the service - * \param addr The address associated with the service - * - * This function is used to register a - * service. Registering a service means that other nodes - * in the network will become aware that this node - * provides this service. The servreg-hack application - * does not specify what this service means, nor does it - * provide any mechanism by which the service can be - * reached: this is up to the application that uses the - * servreg-hack application. - */ -void servreg_hack_register(servreg_hack_id_t service_id, const uip_ipaddr_t *addr); - - -/** - * \brief Get the IP address of a node offering a service - * \param service_id The service ID of the service - * \return A pointer to the IP address of the node, or NULL if the service was not known - * - * This function returns the address of the node offering - * a specific service. If the service is not known, the - * function returns NULL. If there are more than one nodes - * offering the service, this function returns the address - * of the node that most recently announced its service. - * - * To get a list of all nodes offering a specific service, - * use the servreg_hack_list_head() function to get the - * full list of offered services. - */ -uip_ipaddr_t * servreg_hack_lookup(servreg_hack_id_t service_id); - - -/** - * \brief Obtain the list of services provided by neighbors - * \return The list of services - * - * This function returns a list of services registered by - * other nodes. To find a specific service, the caller - * needs to iterate through the list and check each list - * item with the servreg_hack_item_match() function. - */ -servreg_hack_item_t *servreg_hack_list_head(void); - -/** - * \brief Get the service ID for a list item - * \param item The list item - * \return The service ID for a list item - * - * This function is used when iterating through the list - * of registered services. - */ -servreg_hack_id_t servreg_hack_item_id(servreg_hack_item_t *item); - -/** - * \brief Get the IP address for a list item - * \param item The list item - * \return The IP address - * - * This function is used when iterating through the list - * of registered services. - */ -uip_ipaddr_t * servreg_hack_item_address(servreg_hack_item_t *item); - -#endif /* SERVREG_HACK_H */ - - -/** @} */ -/** @} */ diff --git a/examples/ipv6/simple-udp-rpl/Makefile b/examples/ipv6/simple-udp-rpl/Makefile deleted file mode 100644 index 72e0cda32..000000000 --- a/examples/ipv6/simple-udp-rpl/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: broadcast-example unicast-sender unicast-receiver -APPS=servreg-hack -CONTIKI=../../.. - -CONTIKI_WITH_IPV6 = 1 -include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/simple-udp-rpl/broadcast-example.c b/examples/ipv6/simple-udp-rpl/broadcast-example.c deleted file mode 100644 index 31f86e34a..000000000 --- a/examples/ipv6/simple-udp-rpl/broadcast-example.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2011, 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. - * - */ - -#include "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ip/uip.h" -#include "net/ipv6/uip-ds6.h" - -#include "simple-udp.h" - - -#include -#include - -#define UDP_PORT 1234 - -#define SEND_INTERVAL (20 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection broadcast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(broadcast_example_process, "UDP broadcast example process"); -AUTOSTART_PROCESSES(&broadcast_example_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received on port %d from port %d with length %d\n", - receiver_port, sender_port, datalen); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(broadcast_example_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t addr; - - PROCESS_BEGIN(); - - simple_udp_register(&broadcast_connection, UDP_PORT, - NULL, UDP_PORT, - receiver); - - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - etimer_set(&send_timer, SEND_TIME); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer)); - printf("Sending broadcast\n"); - uip_create_linklocal_allnodes_mcast(&addr); - simple_udp_sendto(&broadcast_connection, "Test", 4, &addr); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/ipv6/simple-udp-rpl/broadcast-example.csc b/examples/ipv6/simple-udp-rpl/broadcast-example.csc deleted file mode 100644 index 72bc733d0..000000000 --- a/examples/ipv6/simple-udp-rpl/broadcast-example.csc +++ /dev/null @@ -1,248 +0,0 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - /home/user/contikiprojects/sics.se/mobility - [CONTIKI_DIR]/tools/cooja/apps/collect-view - /home/user/nes/papers/smartip-paper/code/cooja_qr - - Simple UDP broadcast example - 0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Broadcast example - [CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/broadcast-example.c - make broadcast-example.sky TARGET=sky - [CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/broadcast-example.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 64.1956818968534 - 28.591062627059372 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 51.81261061627534 - 24.647047255346667 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 9.068527629624546 - 46.26817786392282 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 87.5626508274206 - 4.896101751816129 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 55.15853460164762 - 3.4681662067903796 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 99.33682438963966 - 49.73072195748186 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 61.26294736288044 - 61.845254356789646 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 70.4693668755668 - 52.43101713632271 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 33.5789440978246 - 48.10557568631877 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 9 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 62.6079314243491 - 76.96581640898913 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 10 - - sky1 - - - - org.contikios.cooja.plugins.SimControl - 318 - 3 - 192 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 2.9205864417411154 0.0 0.0 2.9205864417411154 -13.303600659817928 3.5428004585568913 - - 300 - 2 - 300 - 1122 - 0 - - - org.contikios.cooja.plugins.LogListener - - - - 1422 - 0 - 236 - -1 - 302 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - - - 125 - 500.0 - - 1422 - 1 - 190 - 0 - 539 - - - diff --git a/examples/ipv6/simple-udp-rpl/unicast-example.csc b/examples/ipv6/simple-udp-rpl/unicast-example.csc deleted file mode 100644 index 60bd834bb..000000000 --- a/examples/ipv6/simple-udp-rpl/unicast-example.csc +++ /dev/null @@ -1,287 +0,0 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - /home/user/contikiprojects/sics.se/mobility - [CONTIKI_DIR]/tools/cooja/apps/collect-view - /home/user/nes/papers/smartip-paper/code/cooja_qr - - Simple UDP unicast example - 0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - UDP receiver - [CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-receiver.c - make unicast-receiver.sky TARGET=sky - [CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-receiver.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - UDP sender - [CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-sender.c - make unicast-sender.sky TARGET=sky - [CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-sender.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 82.45117687053667 - 90.0660093026363 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 44.53120632368774 - 89.83566130147413 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 91.76407203945963 - 8.764533976596468 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 10.771554112657956 - 16.155558894723033 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 40.99108749529099 - 33.68910640819968 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 49.762281669516085 - 15.219756237459913 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 26.209078576184762 - 97.71885344901867 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 96.30596045236783 - 3.353548431613529 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 52.22023117695779 - 56.516553603970586 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 9 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 57.92282771739404 - 34.17317501704098 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 10 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 3.8628214275088335 - 52.90298303308778 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 11 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 318 - 3 - 192 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 2.3409990660057263 0.0 0.0 2.3409990660057263 27.752487588138713 2.6948007992423 - - 300 - 2 - 300 - 1122 - 0 - - - org.contikios.cooja.plugins.LogListener - - - - 1422 - 1 - 239 - 0 - 293 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - - 125 - 500.0 - - 1422 - 0 - 198 - 0 - 531 - - - diff --git a/examples/ipv6/simple-udp-rpl/unicast-receiver.c b/examples/ipv6/simple-udp-rpl/unicast-receiver.c deleted file mode 100644 index 7c6205dab..000000000 --- a/examples/ipv6/simple-udp-rpl/unicast-receiver.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2011, 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. - * - */ - -#include "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ip/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ip/uip-debug.h" - -#include "simple-udp.h" -#include "servreg-hack.h" - -#include "net/rpl/rpl.h" - -#include -#include - -#define UDP_PORT 1234 -#define SERVICE_ID 190 - -#define SEND_INTERVAL (10 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(unicast_receiver_process, "Unicast receiver example process"); -AUTOSTART_PROCESSES(&unicast_receiver_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received from "); - uip_debug_ipaddr_print(sender_addr); - printf(" on port %d from port %d with length %d: '%s'\n", - receiver_port, sender_port, datalen, data); -} -/*---------------------------------------------------------------------------*/ -static uip_ipaddr_t * -set_global_address(void) -{ - static uip_ipaddr_t ipaddr; - int i; - uint8_t state; - - uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - printf("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); - printf("\n"); - } - } - - return &ipaddr; -} -/*---------------------------------------------------------------------------*/ -static void -create_rpl_dag(uip_ipaddr_t *ipaddr) -{ - struct uip_ds6_addr *root_if; - - root_if = uip_ds6_addr_lookup(ipaddr); - if(root_if != NULL) { - rpl_dag_t *dag; - uip_ipaddr_t prefix; - - rpl_set_root(RPL_DEFAULT_INSTANCE, ipaddr); - dag = rpl_get_any_dag(); - uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0); - rpl_set_prefix(dag, &prefix, 64); - PRINTF("created a new RPL dag\n"); - } else { - PRINTF("failed to create a new RPL DAG\n"); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(unicast_receiver_process, ev, data) -{ - uip_ipaddr_t *ipaddr; - - PROCESS_BEGIN(); - - servreg_hack_init(); - - ipaddr = set_global_address(); - - create_rpl_dag(ipaddr); - - servreg_hack_register(SERVICE_ID, ipaddr); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/ipv6/simple-udp-rpl/unicast-sender.c b/examples/ipv6/simple-udp-rpl/unicast-sender.c deleted file mode 100644 index f441ec728..000000000 --- a/examples/ipv6/simple-udp-rpl/unicast-sender.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2011, 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. - * - */ - -#include "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ip/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ip/uip-debug.h" - -#include "sys/node-id.h" - -#include "simple-udp.h" -#include "servreg-hack.h" - -#include -#include - -#define UDP_PORT 1234 -#define SERVICE_ID 190 - -#define SEND_INTERVAL (60 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(unicast_sender_process, "Unicast sender example process"); -AUTOSTART_PROCESSES(&unicast_sender_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received on port %d from port %d with length %d\n", - receiver_port, sender_port, datalen); -} -/*---------------------------------------------------------------------------*/ -static void -set_global_address(void) -{ - uip_ipaddr_t ipaddr; - int i; - uint8_t state; - - uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - printf("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); - printf("\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(unicast_sender_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t *addr; - - PROCESS_BEGIN(); - - servreg_hack_init(); - - set_global_address(); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - etimer_set(&send_timer, SEND_TIME); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer)); - addr = servreg_hack_lookup(SERVICE_ID); - if(addr != NULL) { - static unsigned int message_number; - char buf[20]; - - printf("Sending unicast to "); - uip_debug_ipaddr_print(addr); - printf("\n"); - sprintf(buf, "Message %d", message_number); - message_number++; - simple_udp_sendto(&unicast_connection, buf, strlen(buf) + 1, addr); - } else { - printf("Service %d not found\n", SERVICE_ID); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/regression-tests/08-ipv6/code-slip-radio/Makefile b/regression-tests/08-ipv6/code-slip-radio/Makefile index 12e72d165..96a32e28d 100644 --- a/regression-tests/08-ipv6/code-slip-radio/Makefile +++ b/regression-tests/08-ipv6/code-slip-radio/Makefile @@ -1,5 +1,4 @@ all: wait-dag -APPS=servreg-hack CONTIKI=../../.. CONTIKI_WITH_IPV6 = 1