removed servreg_hack from the rpl-udp example
This commit is contained in:
parent
f4e2c41c76
commit
71d5c5f3c1
|
@ -35,8 +35,6 @@
|
||||||
#include "net/uip-udp-packet.h"
|
#include "net/uip-udp-packet.h"
|
||||||
#include "sys/ctimer.h"
|
#include "sys/ctimer.h"
|
||||||
|
|
||||||
#include "servreg-hack.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -54,6 +52,8 @@
|
||||||
#define MAX_PAYLOAD_LEN 30
|
#define MAX_PAYLOAD_LEN 30
|
||||||
|
|
||||||
static struct uip_udp_conn *client_conn;
|
static struct uip_udp_conn *client_conn;
|
||||||
|
static uip_ipaddr_t server_ipaddr;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(udp_client_process, "UDP client process");
|
PROCESS(udp_client_process, "UDP client process");
|
||||||
AUTOSTART_PROCESSES(&udp_client_process);
|
AUTOSTART_PROCESSES(&udp_client_process);
|
||||||
|
@ -75,17 +75,13 @@ send_packet(void *ptr)
|
||||||
{
|
{
|
||||||
static int seq_id;
|
static int seq_id;
|
||||||
char buf[MAX_PAYLOAD_LEN];
|
char buf[MAX_PAYLOAD_LEN];
|
||||||
uip_ipaddr_t *ipaddr;
|
|
||||||
|
|
||||||
ipaddr = servreg_hack_lookup(UDP_EXAMPLE_ID);
|
seq_id++;
|
||||||
if(ipaddr != NULL) {
|
PRINTF("DATA send to %d 'Hello %d'\n",
|
||||||
seq_id++;
|
client_conn->ripaddr.u8[15], seq_id);
|
||||||
PRINTF("DATA send to %d 'Hello %d'\n",
|
sprintf(buf, "Hello %d from the client", seq_id);
|
||||||
client_conn->ripaddr.u8[15], seq_id);
|
uip_udp_packet_sendto(client_conn, buf, strlen(buf),
|
||||||
sprintf(buf, "Hello %d from the client", seq_id);
|
&server_ipaddr, HTONS(UDP_SERVER_PORT));
|
||||||
uip_udp_packet_sendto(client_conn, buf, strlen(buf),
|
|
||||||
ipaddr, HTONS(UDP_SERVER_PORT));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
@ -117,6 +113,10 @@ set_global_address(void)
|
||||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||||
|
|
||||||
|
/* set server address */
|
||||||
|
uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(udp_client_process, ev, data)
|
PROCESS_THREAD(udp_client_process, ev, data)
|
||||||
|
@ -126,8 +126,6 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
servreg_hack_init();
|
|
||||||
|
|
||||||
PROCESS_PAUSE();
|
PROCESS_PAUSE();
|
||||||
|
|
||||||
set_global_address();
|
set_global_address();
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#include "net/uip.h"
|
#include "net/uip.h"
|
||||||
#include "net/rpl/rpl.h"
|
#include "net/rpl/rpl.h"
|
||||||
|
|
||||||
#include "servreg-hack.h"
|
|
||||||
|
|
||||||
#include "net/netstack.h"
|
#include "net/netstack.h"
|
||||||
#include "dev/button-sensor.h"
|
#include "dev/button-sensor.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -54,8 +52,6 @@
|
||||||
|
|
||||||
static struct uip_udp_conn *server_conn;
|
static struct uip_udp_conn *server_conn;
|
||||||
|
|
||||||
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
|
||||||
|
|
||||||
PROCESS(udp_server_process, "UDP server process");
|
PROCESS(udp_server_process, "UDP server process");
|
||||||
AUTOSTART_PROCESSES(&udp_server_process);
|
AUTOSTART_PROCESSES(&udp_server_process);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -105,10 +101,6 @@ PROCESS_THREAD(udp_server_process, ev, data)
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
servreg_hack_init();
|
|
||||||
|
|
||||||
servreg_hack_register(UDP_EXAMPLE_ID);
|
|
||||||
|
|
||||||
PROCESS_PAUSE();
|
PROCESS_PAUSE();
|
||||||
|
|
||||||
SENSORS_ACTIVATE(button_sensor);
|
SENSORS_ACTIVATE(button_sensor);
|
||||||
|
@ -116,13 +108,13 @@ PROCESS_THREAD(udp_server_process, ev, data)
|
||||||
PRINTF("UDP server started\n");
|
PRINTF("UDP server started\n");
|
||||||
|
|
||||||
#if UIP_CONF_ROUTER
|
#if UIP_CONF_ROUTER
|
||||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1);
|
||||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
/* uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); */
|
||||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL);
|
||||||
root_if = uip_ds6_addr_lookup(&ipaddr);
|
root_if = uip_ds6_addr_lookup(&ipaddr);
|
||||||
if(root_if != NULL) {
|
if(root_if != NULL) {
|
||||||
rpl_dag_t *dag;
|
rpl_dag_t *dag;
|
||||||
rpl_set_root((uip_ip6addr_t *)dag_id);
|
rpl_set_root((uip_ip6addr_t *)&ipaddr);
|
||||||
dag = rpl_get_dag(RPL_ANY_INSTANCE);
|
dag = rpl_get_dag(RPL_ANY_INSTANCE);
|
||||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||||
rpl_set_prefix(dag, &ipaddr, 64);
|
rpl_set_prefix(dag, &ipaddr, 64);
|
||||||
|
|
Loading…
Reference in a new issue