From de2f5aaddc2bba849c53b39e5472671ccece79f0 Mon Sep 17 00:00:00 2001
From: dak664 <dak664>
Date: Wed, 17 Mar 2010 20:19:33 +0000
Subject: [PATCH] change for ds6 calls

---
 .../apps/raven-lcd-interface/raven-lcd.c      | 17 +++++++++++--
 platform/avr-raven/contiki-raven-main.c       | 25 ++++++-------------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c b/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c
index f4b2a9704..13136e6ee 100644
--- a/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c
+++ b/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c
@@ -28,7 +28,7 @@
  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  *
- * $Id: raven-lcd.c,v 1.6 2010/02/28 21:29:20 dak664 Exp $
+ * $Id: raven-lcd.c,v 1.7 2010/03/17 20:19:33 dak664 Exp $
 */
 
 /**
@@ -71,7 +71,6 @@
 #include <stdio.h>
 
 
-static u16_t addr[8];
 static u8_t count = 0;
 static u8_t seqno;
 uip_ipaddr_t dest_addr;
@@ -106,7 +105,10 @@ void
 raven_ping6(void)
 {
     /* ping the router */
+
+#if THEOLDWAY
     // Setup destination address.
+	static u16_t addr[8];
     struct uip_nd6_defrouter *defrouter;
     uint8_t i,tmp;
 
@@ -130,6 +132,17 @@ raven_ping6(void)
     UIP_IP_BUF->ttl = uip_netif_physical_if.cur_hop_limit;
     uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &dest_addr);
     uip_netif_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr);
+
+ #else
+    /* Get address from default router */
+    UIP_IP_BUF->vtc = 0x60;
+    UIP_IP_BUF->tcflow = 1;
+    UIP_IP_BUF->flow = 0;
+    UIP_IP_BUF->proto = UIP_PROTO_ICMP6;
+	UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit;
+	uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, uip_ds6_defrt_choose());
+	uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr);
+#endif  
  
     UIP_ICMP_BUF->type = ICMP6_ECHO_REQUEST;
     UIP_ICMP_BUF->icode = 0;
diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c
index dbc53f2e4..8e9d56325 100644
--- a/platform/avr-raven/contiki-raven-main.c
+++ b/platform/avr-raven/contiki-raven-main.c
@@ -227,21 +227,13 @@ void initialize(void)
   }
 #endif /* COFFEE_FILES */
 
-/* Add prefixes for testing */
+/* Add addresses for testing */
 #if 0
 {  
   uip_ip6addr_t ipaddr;
   uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
-  uip_netif_addr_autoconf_set(&ipaddr, &uip_lladdr);
-  uip_netif_addr_add(&ipaddr, 16, 0, TENTATIVE);
-}
-#endif
-#if 0
-{
-  uip_ip6addr_t ipaddr;
-  uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
-  uip_netif_addr_add(&ipaddr, UIP_DEFAULT_PREFIX_LEN, 0, AUTOCONF);
-  uip_nd6_prefix_add(&ipaddr, UIP_DEFAULT_PREFIX_LEN, 0);
+  uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
+//  uip_ds6_prefix_add(&ipaddr,64,0);
 }
 #endif
 
@@ -253,13 +245,12 @@ void initialize(void)
   char buf[80];
   unsigned int size;
 
-  for(i = 0; i < UIP_CONF_NETIF_MAX_ADDRESSES; i ++) {
-   if(uip_netif_physical_if.addresses[i].state != NOT_USED) {
-      httpd_cgi_sprint_ip6(*(uip_ipaddr_t*)&uip_netif_physical_if.addresses[i],buf);
-      printf_P(PSTR("IPv6 Address: %s\n"),buf);
-   }
+  for (i=0;i<UIP_DS6_ADDR_NB;i++) {
+	if (uip_ds6_if.addr_list[i].isused) {	  
+	   httpd_cgi_sprint_ip6(uip_ds6_if.addr_list[i].ipaddr,buf);
+       printf_P(PSTR("IPv6 Address: %s\n"),buf);
+	}
   }
-
    eeprom_read_block (buf,server_name, sizeof(server_name));
    buf[sizeof(server_name)]=0;
    printf_P(PSTR("%s"),buf);