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