Subject: [6lowpan] plz plz help with sending uncompressed packets in BLIP

From: amy wang <[email-masked]>
Date: Wed, 26 May 2010 08:09:30 +0800

Hi all.
As in BLip it uses 6lowpan-hui-hc-00 to compress packets , I want to make
the blip also can send no compressed packet. THe dispatch is
LOWPAN_IPV6_PATTERN=0x41.
I only  add some codes in  lib6lowpanIP.c/unpackHeaders()   and
packHeaders(). It can compile but node uploaded can not communicate.
Ip-drive on pc do not display the info: INFO: Starting to proxy for 0x1.
DO I have to change sth else ? plz give me some help.
thx a lot.

The code like following :
////////////////////////////
packheaders()

#ifdef TEST_NOCOMPRESS
{
  *dispatch =LOWPAN_IPV6_PATTERN;
  ip_memcpy(buf, (uint8_t *)hdr, 40);
  buf +=40;
  len -= (buf - dispatch);

  while (cur != NULL) {
      if (i==0 && nxt_hdr == IANA_UDP) {
         if (len < sizeof(struct udp_hdr)) return (buf - dispatch);
         ip_memcpy(buf, (uint8_t *)cur->hdr.udp, 8);
         buf +=8;
      }
      else{
         if (len < cur->len) return 0;
         ip_memcpy(buf, (uint8_t *)cur->hdr.ext, cur->len);
         len -= cur->len;
         buf += cur->len;
      }
      cur = cur->next;
      i++;
  } //end while
}
#else .....

//////////////////////////
unpackheader()

if (dispatch ==LOWPAN_IPV6_PATTERN){
    ip_memcpy(dest, buf, 6);
    buf += 6;
    dest += 6;

    *dest=*buf;buf++; //next header
    nxt_hdr = dest;
    dest += 1;
    *dest = *buf; //hoplimt
    u_info->hlim = buf;
    buf++;dest++;
    ip_memcpy(dest, buf, 32);
    buf += 32;
    dest += 32;
    if (*nxt_hdr==IANA_UDP){
      struct udp_hdr *udp1 = (struct udp_hdr *)dest;
      if (len < sizeof(struct udp_hdr)) return NULL;
      len -= sizeof(struct udp_hdr);
      extra_header_length = sizeof(struct udp_hdr);
      ip_memcpy(dest, buf, 8);
      buf += 8;
      dest += 8;
      u_info->nxt_hdr = IANA_UDP;
      u_info->payload_offset += sizeof(struct udp_hdr);
      u_info->transport_ptr = (uint8_t *)udp1;

      }
    else{ //not udp,the ipv6 extention header

       nhdr = *nxt_hdr;
      u_info->nxt_hdr = nhdr;
    while (EXTENSION_HEADER(nhdr)) {
      hdr = (struct ip6_ext *)buf;

      switch (nhdr) {
      case IPV6_HOP:
        u_info->hdr_hop = (struct ip6_ext *)buf;
        break;
      case IPV6_ROUTING:
        u_info->hdr_route = (struct ip6_route *)buf;
        break;
      case IPV6_DEST:
        u_info->hdr_dest = (struct ip6_ext *)buf;
        break;
        }
      nhdr = hdr->nxt_hdr;
      nhdr_len = hdr->len;
      u_info->nxt_hdr = nhdr;

      if (len < nhdr_len) return NULL;
      ip_memcpy(dest, buf, nhdr_len);
      dest += nhdr_len;
      buf += nhdr_len;

      u_info->payload_offset += nhdr_len;

     // extra_header_length += nhdr_len;
     } //while till here

     u_info->transport_ptr = dest;
     } //end else

     u_info->payload_start = buf;
      u_info->header_end = dest;
     if (u_info->transport_ptr == NULL)
        u_info->transport_ptr = dest;
  }
else { ...        //hc-00 compress