hc.c File Reference

TCP/IP header compression implementation. More...

#include "net/hc.h"
#include "net/uip.h"
#include <string.h>
#include <stdio.h>

Go to the source code of this file.

Functions

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

Detailed Description

TCP/IP header compression implementation.

Author:
Adam Dunkels <adam@sics.se>

Definition in file hc.c.


Function Documentation

int hc_compress ( u8_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 ( u8_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().


Generated on Mon Apr 11 14:23:46 2011 for Contiki 2.5 by  doxygen 1.6.1