Contiki 2.6

hc.h File Reference

TCP/IP header compression header file. More...

#include "net/uip.h"

Go to the source code of this file.

Functions

void hc_init (void)
 Initialize the header compression module.
int hc_compress (uint8_t *buf, int len)
 Compress a header.
int hc_inflate (uint8_t *buf, int len)
 Inflate (decompress) a header.

Detailed Description

TCP/IP header compression header file.

Author:
Adam Dunkels <adam@sics.se>

Definition in file hc.h.


Function Documentation

int hc_compress ( uint8_t *  buf,
int  len 
)

Compress a header.

This function compresses the TCP/IP headers in a buffer and should be called just before sending out data on the network. A pointer to the compressed header is returned, and len is adjusted.

If the header could not be compressed, the function does nothing and returns a NULL pointer.

Returns:
A pointer to the start of the compressed header or NULL if the header could not be compressed.

Definition at line 103 of file hc.c.

References uip_htons(), UIP_HTONS, uip_ipaddr_cmp, and uip_ipaddr_copy.

int hc_inflate ( uint8_t *  buf,
int  len 
)

Inflate (decompress) a header.

This function should be called to inflate a possibly compressed packet header just after a packet has been received from the network. The function will copy the packet data so that the original header fits and adjusts uip_len.

Definition at line 165 of file hc.c.

References UIP_HTONS, uip_ipaddr_copy, and uip_ipchksum().