6loWPAN: Various fixes for building with different configurations; Some minimal testing of HC06

This commit is contained in:
Gregory Nutt 2017-04-04 17:06:17 -06:00
parent ca2c18c023
commit 38eed0a847
5 changed files with 22 additions and 19 deletions

View File

@ -364,6 +364,12 @@ struct ieee802154_driver_s
uint8_t i_dsn;
#if CONFIG_NET_6LOWPAN_FRAG
/* Fragmentation Support *************************************************/
/* Fragmentation is handled frame by frame and requires that certain
* state information be retained from frame to frame.
*/
/* i_dgramtag. Datagram tag to be put in the header of the set of
* fragments. It is used by the recipient to match fragments of the
* same payload.
@ -371,12 +377,6 @@ struct ieee802154_driver_s
uint16_t i_dgramtag;
#if CONFIG_NET_6LOWPAN_FRAG
/* Fragmentation Support *************************************************/
/* Fragementation is handled frame by frame and requires that certain
* state information be retained from frame to frame.
*/
/* i_pktlen. The total length of the IPv6 packet to be re-assembled in
* d_buf.
*/

View File

@ -51,6 +51,7 @@
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/net/netdev.h>
@ -171,7 +172,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
FAR uint8_t *fptr;
int framer_hdrlen;
struct rimeaddr_s bcastmac;
#ifdef CONFIG_NET_6LOWPAN_FRAG
uint16_t outlen = 0;
#endif
/* Initialize global data. Locking the network guarantees that we have
* exclusive use of the global values for intermediate calculations.
@ -278,7 +281,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
(int)CONFIG_NET_6LOWPAN_MAXPAYLOAD - framer_hdrlen -
(int)g_frame_hdrlen)
{
#if CONFIG_NET_6LOWPAN_FRAG
#ifdef CONFIG_NET_6LOWPAN_FRAG
/* ieee->i_framelist will hold the generated frames; frames will be
* added at qtail.
*/

View File

@ -18,7 +18,7 @@
* Joel Hoglund <joel@sics.se>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* modification, are permitted provided that the following c/onditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
@ -74,9 +74,9 @@
****************************************************************************/
#define IPv6BUF(ieee) \
((FAR struct ipv6_hdr_s *)&(ieee)->i_dev.d_buf)
((FAR struct ipv6_hdr_s *)((ieee)->i_dev.d_buf))
#define UDPIPv6BUF(ieee) \
((FAR struct udp_hdr_s *)&(ieee)->i_dev.d_buf[IPv6_HDRLEN])
((FAR struct udp_hdr_s *)&((ieee)->i_dev.d_buf[IPv6_HDRLEN]))
/****************************************************************************
* Private Types
@ -841,7 +841,7 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
void sixlowpan_uncompresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
uint16_t iplen, FAR struct iob_s *iob,
FAR char *payptr)
FAR uint8_t *payptr)
{
FAR struct ipv6_hdr_s *ipv6 = IPv6BUF(ieee);
FAR uint8_t *iphc = payptr + g_frame_hdrlen;

View File

@ -54,7 +54,7 @@
#include <errno.h>
#include <debug.h>
#if CONFIG_NET_6LOWPAN_FRAG
#ifdef CONFIG_NET_6LOWPAN_FRAG
# include "nuttx/clock.h"
#endif
@ -214,11 +214,11 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
uint16_t fragsize = 0; /* Size of the IP packet (read from fragment) */
uint8_t fragoffset = 0; /* Offset of the fragment in the IP packet */
bool isfrag = false;
int reqsize; /* Required buffer size */
int hdrsize; /* Size of the IEEE802.15.4 header */
#if CONFIG_NET_6LOWPAN_FRAG
#ifdef CONFIG_NET_6LOWPAN_FRAG
bool isfrag = false;
bool isfirstfrag = false;
bool islastfrag = false;
uint16_t fragtag = 0; /* Tag of the fragment */
@ -243,7 +243,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
payptr = &iob->io_data[hdrsize];
#if CONFIG_NET_6LOWPAN_FRAG
#ifdef CONFIG_NET_6LOWPAN_FRAG
/* Since we don't support the mesh and broadcast header, the first header
* we look for is the fragmentation header
*/
@ -285,7 +285,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
g_frame_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN;
ninfo("islastfrag?: i_accumlen %d g_rime_payloadlen %d fragsize %d\n",
ninfo("FRAGN: i_accumlen %d g_rime_payloadlen %d fragsize %d\n",
ieee->i_accumlen, iob->io_len - g_frame_hdrlen, fragsize);
/* Indicate that this frame is a another fragment for reassembly */
@ -480,7 +480,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
return OK;
}
#if CONFIG_NET_6LOWPAN_FRAG
#ifdef CONFIG_NET_6LOWPAN_FRAG
copypayload:
#endif /* CONFIG_NET_6LOWPAN_FRAG */
@ -514,7 +514,7 @@ copypayload:
(int)(fragoffset << 3), payptr + g_frame_hdrlen,
g_rime_payloadlen);
#if CONFIG_NET_6LOWPAN_FRAG
#ifdef CONFIG_NET_6LOWPAN_FRAG
/* Update ieee->i_accumlen if the frame is a fragment, ieee->i_pktlen
* otherwise.
*/

View File

@ -454,7 +454,7 @@ extern uint8_t g_frame_hdrlen;
/* Offset first available byte for the payload after header region. */
uint8_t g_dataoffset;
extern uint8_t g_dataoffset;
/* Packet buffer metadata: Attributes and addresses */