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. |
TCP/IP header compression implementation.
Definition in file hc.c.
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.
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().