Skip to content

Commit

Permalink
Allow for using a fixed frame header length.
Browse files Browse the repository at this point in the history
When SICSLOWPAN_FRAMER_HDRLEN is defined its value is used
as a frame header length. This allows for using sicslowpan
without calling a framer. This is usefull if framer is not
used on a given platform or when header length is always
the same.

In addition this commit also fixes an inline define.
  • Loading branch information
wbober committed Feb 15, 2016
1 parent 4cd0e3a commit 1cc659d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core/net/ipv6/sicslowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ void uip_log(char *msg);
#define COMPRESSION_THRESHOLD 0
#endif

/** \brief Fixed size of a frame header. This value is
* used in case framer returns an error or if SICSLOWPAN_USE_FIXED_HDRLEN
* is defined.
*/
#ifndef SICSLOWPAN_FIXED_HDRLEN
#define SICSLOWPAN_FIXED_HDRLEN 21
#endif

/** \name General variables
* @{
*/
Expand Down Expand Up @@ -1345,16 +1353,15 @@ output(const uip_lladdr_t *localdest)
/* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_RDC.
* We calculate it here only to make a better decision of whether the outgoing packet
* needs to be fragmented or not. */
#define USE_FRAMER_HDRLEN 1
#if USE_FRAMER_HDRLEN
#ifndef SICSLOWPAN_USE_FIXED_HDRLEN
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &dest);
framer_hdrlen = NETSTACK_FRAMER.length();
if(framer_hdrlen < 0) {
/* Framing failed, we assume the maximum header length */
framer_hdrlen = 21;
framer_hdrlen = SICSLOWPAN_FIXED_HDRLEN;
}
#else /* USE_FRAMER_HDRLEN */
framer_hdrlen = 21;
framer_hdrlen = SICSLOWPAN_FIXED_HDRLEN;
#endif /* USE_FRAMER_HDRLEN */

max_payload = MAC_MAX_PAYLOAD - framer_hdrlen;
Expand Down

0 comments on commit 1cc659d

Please sign in to comment.