ROHC compression/decompression library
|
ROHC compression context for the TCP profile. More...
#include "rohc_traces_internal.h"
#include "rohc_utils.h"
#include "rohc_packets.h"
#include "protocols/tcp.h"
#include "schemes/cid.h"
#include "schemes/rfc4996.h"
#include "sdvl.h"
#include "crc.h"
#include "c_generic.h"
#include "c_ip.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
Data Structures | |
struct | tcp_tmp_variables |
Define the TCP-specific temporary variables in the profile compression context. More... | |
struct | ipv6_option_context |
Define the IPv6 generic option context. More... | |
struct | ipv6_gre_option_context |
Define the IPv6 GRE option context. More... | |
struct | ipv6_mime_option_context |
Define the IPv6 MIME option context. More... | |
struct | ipv6_ah_option_context |
Define the IPv6 AH option context. More... | |
struct | ipvx_context |
Define the common IP header context to IPv4 and IPv6. More... | |
struct | ipv4_context |
Define the IPv4 header context. More... | |
struct | ipv6_context |
Define the IPv6 header context. More... | |
union | ip_context_ptr_t |
Define union of IP contexts pointers. More... | |
struct | tcp_opt_context |
The compression context for one TCP option. More... | |
struct | sc_tcp_context |
Define the TCP part of the profile decompression context. More... | |
Defines | |
#define | TRACE_GOTO_CHOICE rohc_comp_debug(context, "Compressed format choice LINE %d", __LINE__ ) |
#define | MAX_IPV6_OPTION_LENGTH 6 |
#define | MAX_IPV6_CONTEXT_OPTION_SIZE (2 + ((MAX_IPV6_OPTION_LENGTH + 1) << 3)) |
#define | MAX_TCP_OPT_SIZE 40U |
#define | TCP_LIST_ITEM_MAP_LEN 16U |
Typedefs | |
typedef struct ipv6_option_context | ipv6_option_context_t |
Define the IPv6 generic option context. | |
typedef struct ipv6_gre_option_context | ipv6_gre_option_context_t |
Define the IPv6 GRE option context. | |
typedef struct ipv6_mime_option_context | ipv6_mime_option_context_t |
Define the IPv6 MIME option context. | |
typedef struct ipv6_ah_option_context | ipv6_ah_option_context_t |
Define the IPv6 AH option context. | |
typedef struct ipvx_context | ipvx_context_t |
Define the common IP header context to IPv4 and IPv6. | |
typedef struct ipv4_context | ipv4_context_t |
Define the IPv4 header context. | |
typedef struct ipv6_context | ipv6_context_t |
Define the IPv6 header context. | |
Functions | |
static bool | c_tcp_create (struct rohc_comp_ctxt *const context, const struct net_pkt *const packet) |
Create a new TCP context and initialize it thanks to the given IP/TCP packet. | |
static void | c_tcp_destroy (struct rohc_comp_ctxt *const context) |
Destroy the TCP context. | |
static bool | c_tcp_check_profile (const struct rohc_comp *const comp, const struct net_pkt *const packet) |
Check if the given packet corresponds to the TCP profile. | |
static bool | c_tcp_check_context (const struct rohc_comp_ctxt *const context, const struct net_pkt *const packet) |
Check if the IP/TCP packet belongs to the context. | |
static int | c_tcp_encode (struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt, unsigned char *const rohc_pkt, const size_t rohc_pkt_max_len, rohc_packet_t *const packet_type, size_t *const payload_offset) |
Encode an IP/TCP packet according to a pattern decided by several different factors. | |
static bool | tcp_detect_changes (struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt) |
Detect changes between packet and context. | |
static void | tcp_decide_state (struct rohc_comp_ctxt *const context) |
Decide the state that should be used for the next packet. | |
static bool | tcp_encode_uncomp_fields (struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt) |
Encode uncompressed fields with the corresponding encoding scheme. | |
static rohc_packet_t | tcp_decide_packet (const struct rohc_comp_ctxt *const context, const ip_context_ptr_t *const ip_inner_context, const tcphdr_t *const tcp) |
Decide which packet to send when in the different states. | |
static rohc_packet_t | tcp_decide_SO_packet (const struct rohc_comp_ctxt *const context, const ip_context_ptr_t *const ip_inner_context, const tcphdr_t *const tcp) |
Decide which packet to send when in SO state. | |
static uint8_t * | tcp_code_static_ipv6_option_part (struct rohc_comp_ctxt *const context, multi_ptr_t mptr, uint8_t protocol, base_header_ip_t base_header) |
Build the static part of the IPv6 option header. | |
static uint8_t * | tcp_code_dynamic_ipv6_option_part (struct rohc_comp_ctxt *const context, ip_context_ptr_t ip_context, multi_ptr_t mptr, uint8_t protocol, base_header_ip_t base_header) |
Build the dynamic part of the IPv6 option header. | |
static uint8_t * | tcp_code_irregular_ipv6_option_part (struct rohc_comp_ctxt *const context, ip_context_ptr_t ip_context, multi_ptr_t mptr, uint8_t protocol, base_header_ip_t base_header) |
Build the irregular part of the IPv6 option header. | |
static uint8_t * | tcp_code_static_ip_part (struct rohc_comp_ctxt *const context, base_header_ip_t base_header, multi_ptr_t mptr) |
Build the static part of the IP header. | |
static uint8_t * | tcp_code_dynamic_ip_part (const struct rohc_comp_ctxt *context, ip_context_ptr_t ip_context, base_header_ip_t base_header, multi_ptr_t mptr, int is_innermost) |
Build the dynamic part of the IP header. | |
static uint8_t * | tcp_code_irregular_ip_part (struct rohc_comp_ctxt *const context, ip_context_ptr_t ip_context, base_header_ip_t base_header, uint8_t *rohc_data, int ecn_used, int is_innermost, int ttl_irregular_chain_flag, int ip_inner_ecn) |
Build the irregular part of the IP header. | |
static uint8_t * | tcp_code_static_tcp_part (const struct rohc_comp_ctxt *context, const tcphdr_t *tcp, multi_ptr_t mptr) |
Build the static part of the TCP header. | |
static uint8_t * | tcp_code_dynamic_tcp_part (const struct rohc_comp_ctxt *context, const unsigned char *next_header, multi_ptr_t mptr) |
Build the dynamic part of the TCP header. | |
static uint8_t * | tcp_code_irregular_tcp_part (struct rohc_comp_ctxt *const context, tcphdr_t *tcp, uint8_t *const rohc_data, int ip_inner_ecn) |
Build the irregular part of the TCP header. | |
static int | code_CO_packet (struct rohc_comp_ctxt *const context, const struct ip_packet *ip, const int packet_size, const unsigned char *next_header, unsigned char *const rohc_pkt, const size_t rohc_pkt_max_len, const rohc_packet_t packet_type, size_t *const payload_offset) |
Build the CO packet. | |
static int | co_baseheader (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, ip_context_ptr_t ip_context, base_header_ip_t base_header, unsigned char *const rohc_pkt, const size_t rohc_pkt_max_len,const rohc_packet_t packet_type, const tcphdr_t *const tcp, const uint8_t crc) |
Compress the innermost IP header AND the TCP header. | |
static size_t | c_tcp_build_rnd_1 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_1_t *const rnd1) |
Build a TCP rnd_1 packet. | |
static size_t | c_tcp_build_rnd_2 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_2_t *const rnd2) |
Build a TCP rnd_2 packet. | |
static size_t | c_tcp_build_rnd_3 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_3_t *const rnd3) |
Build a TCP rnd_3 packet. | |
static size_t | c_tcp_build_rnd_4 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_4_t *const rnd4) |
Build a TCP rnd_4 packet. | |
static size_t | c_tcp_build_rnd_5 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_5_t *const rnd5) |
Build a TCP rnd_5 packet. | |
static size_t | c_tcp_build_rnd_6 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_6_t *const rnd6) |
Build a TCP rnd_6 packet. | |
static size_t | c_tcp_build_rnd_7 (struct rohc_comp_ctxt *const context, struct sc_tcp_context *const tcp_context, const tcphdr_t *const tcp, const uint8_t crc, rnd_7_t *const rnd7) |
Build a TCP rnd_7 packet. | |
static bool | c_tcp_build_rnd_8 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, rnd_8_t *const rnd8, size_t *const rnd8_len) |
Build a TCP rnd_8 packet. | |
static size_t | c_tcp_build_seq_1 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_1_t *const seq1) |
Build a TCP seq_1 packet. | |
static size_t | c_tcp_build_seq_2 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_2_t *const seq2) |
Build a TCP seq_2 packet. | |
static size_t | c_tcp_build_seq_3 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_3_t *const seq3) |
Build a TCP seq_3 packet. | |
static size_t | c_tcp_build_seq_4 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_4_t *const seq4) |
Build a TCP seq_4 packet. | |
static size_t | c_tcp_build_seq_5 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_5_t *const seq5) |
Build a TCP seq_5 packet. | |
static size_t | c_tcp_build_seq_6 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_6_t *const seq6) |
Build a TCP seq_6 packet. | |
static size_t | c_tcp_build_seq_7 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_7_t *const seq7) |
Build a TCP seq_7 packet. | |
static bool | c_tcp_build_seq_8 (struct rohc_comp_ctxt *const context, const ip_context_ptr_t ip_context, struct sc_tcp_context *const tcp_context, const base_header_ip_t ip, const tcphdr_t *const tcp, const uint8_t crc, seq_8_t *const seq8, size_t *const seq8_len) |
Build a TCP seq_8 packet. | |
static bool | tcp_compress_tcp_options (struct rohc_comp_ctxt *const context, const tcphdr_t *const tcp, uint8_t *const comp_opts, size_t *const comp_opts_len) |
Compress the TCP options. | |
static bool | c_ts_lsb (const struct rohc_comp_ctxt *const context, uint8_t **dest, const uint32_t timestamp, const size_t nr_bits_minus_1, const size_t nr_bits_0x40000) |
Compress the TimeStamp option value. | |
static uint8_t * | c_tcp_opt_sack (const struct rohc_comp_ctxt *const context, uint8_t *ptr, uint32_t ack_value, uint8_t length, const sack_block_t *const sack_block) |
Compress the SACK TCP option. | |
static tcp_ip_id_behavior_t | tcp_detect_ip_id_behavior (const uint16_t last_ip_id, const uint16_t new_ip_id) |
Detect the behavior of the IPv4 Identification field. | |
static void | tcp_field_descr_change (const struct rohc_comp_ctxt *const context, const char *const name, const bool changed) |
Print a debug trace for the field change. | |
static void | tcp_field_descr_present (const struct rohc_comp_ctxt *const context, const char *const name, const bool present) |
Print a debug trace for the field presence. | |
static char * | tcp_ip_id_behavior_get_descr (const tcp_ip_id_behavior_t behavior) |
Get a string that describes the given IP-ID behavior. | |
static char * | tcp_opt_get_descr (const uint8_t opt_type) |
Get a string that describes the given option type. | |
static uint8_t * | c_sack_pure_lsb (const struct rohc_comp_ctxt *const context, uint8_t *ptr, uint32_t base, uint32_t field) |
Compress the SACK field value. | |
static uint8_t * | c_sack_block (const struct rohc_comp_ctxt *const context, uint8_t *ptr, uint32_t reference, const sack_block_t *const sack_block) |
Compress a SACK block. | |
static uint8_t * | c_tcp_opt_generic (struct sc_tcp_context *tcp_context, uint8_t *ptr, uint8_t *options) |
Compress a generic TCP option. | |
Variables | |
static int | tcp_options_index [TCP_LIST_ITEM_MAP_LEN] |
Table of TCP option index, from option Id. | |
struct rohc_comp_profile | c_tcp_profile |
Define the compression part of the TCP profile as described in the RFC 3095. |
ROHC compression context for the TCP profile.
#define MAX_IPV6_CONTEXT_OPTION_SIZE (2 + ((MAX_IPV6_OPTION_LENGTH + 1) << 3)) |
#define MAX_IPV6_OPTION_LENGTH 6 |
#define MAX_TCP_OPT_SIZE 40U |
The maximum size (in bytes) of one TCP option
#define TCP_LIST_ITEM_MAP_LEN 16U |
The length of the table mapping for TCP options
#define TRACE_GOTO_CHOICE rohc_comp_debug(context, "Compressed format choice LINE %d", __LINE__ ) |
typedef struct ipv4_context ipv4_context_t |
Define the IPv4 header context.
typedef struct ipv6_ah_option_context ipv6_ah_option_context_t |
Define the IPv6 AH option context.
typedef struct ipv6_context ipv6_context_t |
Define the IPv6 header context.
typedef struct ipv6_gre_option_context ipv6_gre_option_context_t |
Define the IPv6 GRE option context.
typedef struct ipv6_mime_option_context ipv6_mime_option_context_t |
Define the IPv6 MIME option context.
typedef struct ipv6_option_context ipv6_option_context_t |
Define the IPv6 generic option context.
typedef struct ipvx_context ipvx_context_t |
Define the common IP header context to IPv4 and IPv6.
static uint8_t* c_sack_block | ( | const struct rohc_comp_ctxt *const | context, |
uint8_t * | ptr, | ||
uint32_t | reference, | ||
const sack_block_t *const | sack_block | ||
) | [static] |
Compress a SACK block.
See RFC6846 page 68 (and RFC2018 for Selective Acknowledgement option)
context | The compression context |
ptr | Pointer to the compressed value |
reference | The reference value |
sack_block | Pointer to the SACK block to compress |
static uint8_t* c_sack_pure_lsb | ( | const struct rohc_comp_ctxt *const | context, |
uint8_t * | ptr, | ||
uint32_t | base, | ||
uint32_t | field | ||
) | [static] |
Compress the SACK field value.
See RFC6846 page 67 (and RFC2018 for Selective Acknowledgement option)
context | The compression context |
ptr | Pointer to the compressed value |
base | The base value |
field | The value to compress |
static size_t c_tcp_build_rnd_1 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_1_t *const | rnd1 | ||
) | [static] |
Build a TCP rnd_1 packet.
Send LSBs of sequence number See RFC4996 page 81
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd1 | IN/OUT: The rnd_1 packet to build |
static size_t c_tcp_build_rnd_2 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_2_t *const | rnd2 | ||
) | [static] |
Build a TCP rnd_2 packet.
Send scaled sequence number LSBs See RFC4996 page 81
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd2 | IN/OUT: The rnd_2 packet to build |
static size_t c_tcp_build_rnd_3 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_3_t *const | rnd3 | ||
) | [static] |
Build a TCP rnd_3 packet.
Send acknowlegment number LSBs See RFC4996 page 81
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd3 | IN/OUT: The rnd_3 packet to build |
static size_t c_tcp_build_rnd_4 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_4_t *const | rnd4 | ||
) | [static] |
Build a TCP rnd_4 packet.
Send acknowlegment number scaled See RFC4996 page 81
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd4 | IN/OUT: The rnd_4 packet to build |
static size_t c_tcp_build_rnd_5 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_5_t *const | rnd5 | ||
) | [static] |
Build a TCP rnd_5 packet.
Send ACK and sequence number See RFC4996 page 82
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd5 | IN/OUT: The rnd_5 packet to build |
static size_t c_tcp_build_rnd_6 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_6_t *const | rnd6 | ||
) | [static] |
Build a TCP rnd_6 packet.
Send both ACK and scaled sequence number LSBs See RFC4996 page 82
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd6 | IN/OUT: The rnd_6 packet to build |
static size_t c_tcp_build_rnd_7 | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_7_t *const | rnd7 | ||
) | [static] |
Build a TCP rnd_7 packet.
Send ACK and window See RFC4996 page 82
context | The compression context |
tcp_context | The specific TCP context |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd7 | IN/OUT: The rnd_7 packet to build |
static bool c_tcp_build_rnd_8 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
rnd_8_t *const | rnd8, | ||
size_t *const | rnd8_len | ||
) | [static] |
Build a TCP rnd_8 packet.
Send LSBs of TTL, RSF flags, change ECN behavior and options list See RFC4996 page 82
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
rnd8 | IN/OUT: The rnd_8 packet to build |
rnd8_len | OUT: The length (in bytes) of the rnd_8 packet |
static size_t c_tcp_build_seq_1 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_1_t *const | seq1 | ||
) | [static] |
Build a TCP seq_1 packet.
Send LSBs of sequence number See RFC4996 page 83
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq1 | IN/OUT: The seq_1 packet to build |
static size_t c_tcp_build_seq_2 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_2_t *const | seq2 | ||
) | [static] |
Build a TCP seq_2 packet.
Send scaled sequence number LSBs See RFC4996 page 83
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq2 | IN/OUT: The seq_2 packet to build |
static size_t c_tcp_build_seq_3 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_3_t *const | seq3 | ||
) | [static] |
Build a TCP seq_3 packet.
Send acknowledgment number LSBs See RFC4996 page 83
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq3 | IN/OUT: The seq_3 packet to build |
static size_t c_tcp_build_seq_4 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_4_t *const | seq4 | ||
) | [static] |
Build a TCP seq_4 packet.
Send scaled acknowledgment number scaled See RFC4996 page 84
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq4 | IN/OUT: The seq_4 packet to build |
static size_t c_tcp_build_seq_5 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_5_t *const | seq5 | ||
) | [static] |
Build a TCP seq_5 packet.
Send ACK and sequence number See RFC4996 page 84
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq5 | IN/OUT: The seq_5 packet to build |
static size_t c_tcp_build_seq_6 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_6_t *const | seq6 | ||
) | [static] |
Build a TCP seq_6 packet.
See RFC4996 page 84
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq6 | IN/OUT: The seq_6 packet to build |
static size_t c_tcp_build_seq_7 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_7_t *const | seq7 | ||
) | [static] |
Build a TCP seq_7 packet.
Send ACK and window See RFC4996 page 85
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq7 | IN/OUT: The seq_7 packet to build |
static bool c_tcp_build_seq_8 | ( | struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t | ip_context, | ||
struct sc_tcp_context *const | tcp_context, | ||
const base_header_ip_t | ip, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc, | ||
seq_8_t *const | seq8, | ||
size_t *const | seq8_len | ||
) | [static] |
Build a TCP seq_8 packet.
Send LSBs of TTL, RSF flags, change ECN behavior, and options list See RFC4996 page 85
context | The compression context |
ip_context | The specific IP innermost context |
tcp_context | The specific TCP context |
ip | The IPv4 or IPv6 header to compress |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
seq8 | IN/OUT: The seq_8 packet to build |
seq8_len | OUT: The length (in bytes) of the seq_8 packet |
static bool c_tcp_check_context | ( | const struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | packet | ||
) | [static] |
Check if the IP/TCP packet belongs to the context.
Conditions are:
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
packet | The IP/TCP packet to check |
static bool c_tcp_check_profile | ( | const struct rohc_comp *const | comp, |
const struct net_pkt *const | packet | ||
) | [static] |
Check if the given packet corresponds to the TCP profile.
Conditions are:
This function is one of the functions that must exist in one profile for the framework to work.
comp | The ROHC compressor |
packet | The packet to check |
static bool c_tcp_create | ( | struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | packet | ||
) | [static] |
Create a new TCP context and initialize it thanks to the given IP/TCP packet.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
packet | The IP/TCP packet given to initialize the new context |
static void c_tcp_destroy | ( | struct rohc_comp_ctxt *const | context | ) | [static] |
Destroy the TCP context.
context | The TCP compression context to destroy |
static int c_tcp_encode | ( | struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | uncomp_pkt, | ||
unsigned char *const | rohc_pkt, | ||
const size_t | rohc_pkt_max_len, | ||
rohc_packet_t *const | packet_type, | ||
size_t *const | payload_offset | ||
) | [static] |
Encode an IP/TCP packet according to a pattern decided by several different factors.
1. Check if we have double IP headers.
2. Check if the IP-ID fields are random and if they are in NBO.
3. Decide in which state to go (IR, FO or SO).
4. Decide how many bits are needed to send the IP-ID and SN fields and more important update the sliding windows.
5. Decide which packet type to send.
6. Code the packet.
context | The compression context |
uncomp_pkt | The uncompressed packet to encode |
rohc_pkt | OUT: The ROHC packet |
rohc_pkt_max_len | The maximum length of the ROHC packet |
packet_type | OUT: The type of ROHC packet that is created |
payload_offset | OUT: The offset for the payload in the IP packet |
static uint8_t* c_tcp_opt_generic | ( | struct sc_tcp_context * | tcp_context, |
uint8_t * | ptr, | ||
uint8_t * | options | ||
) | [static] |
Compress a generic TCP option.
See RFC4996 page 67
tcp_context | The specific TCP context |
ptr | Pointer where to compress the option |
options | Pointer to the TCP option to compress |
static uint8_t * c_tcp_opt_sack | ( | const struct rohc_comp_ctxt *const | context, |
uint8_t * | ptr, | ||
uint32_t | ack_value, | ||
uint8_t | length, | ||
const sack_block_t *const | sack_block | ||
) | [static] |
Compress the SACK TCP option.
See RFC6846 page 68 (and RFC2018 for Selective Acknowledgement option)
context | The compression context |
ptr | Pointer to the compressed value |
ack_value | The ack value |
length | The length of the sack block |
sack_block | Pointer to the first SACK block to compress |
static bool c_ts_lsb | ( | const struct rohc_comp_ctxt *const | context, |
uint8_t ** | dest, | ||
const uint32_t | timestamp, | ||
const size_t | nr_bits_minus_1, | ||
const size_t | nr_bits_0x40000 | ||
) | [static] |
Compress the TimeStamp option value.
See RFC4996 page 65
context | The compression context | |
[out] | dest | Pointer to the compressed value |
timestamp | The timestamp value to compress | |
nr_bits_minus_1 | The minimal number of required bits for p = -1 | |
nr_bits_0x40000 | The minimal number of required bits for p = 0x40000 |
static int co_baseheader | ( | struct rohc_comp_ctxt *const | context, |
struct sc_tcp_context *const | tcp_context, | ||
ip_context_ptr_t | ip_context, | ||
base_header_ip_t | base_header, | ||
unsigned char *const | rohc_pkt, | ||
const size_t | rohc_pkt_max_len, | ||
const rohc_packet_t | packet_type, | ||
const tcphdr_t *const | tcp, | ||
const uint8_t | crc | ||
) | [static] |
Compress the innermost IP header AND the TCP header.
See RFC4996 page 77
context | The compression context |
tcp_context | The specific TCP context |
ip_context | The specific IP innermost context |
base_header | The innermost IP header |
rohc_pkt | OUT: The ROHC packet |
rohc_pkt_max_len | The maximum length of the ROHC packet |
packet_type | OUT: The type of ROHC packet that is created |
tcp | The TCP header to compress |
crc | The CRC on the uncompressed headers |
static int code_CO_packet | ( | struct rohc_comp_ctxt *const | context, |
const struct ip_packet * | ip, | ||
const int | packet_size, | ||
const unsigned char * | next_header, | ||
unsigned char *const | rohc_pkt, | ||
const size_t | rohc_pkt_max_len, | ||
const rohc_packet_t | packet_type, | ||
size_t *const | payload_offset | ||
) | [static] |
Build the CO packet.
See RFC4996 page 46
CO packet (RFC4996 ยง7.3 page 41): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : if for small CIDs and CID != 0 +---+---+---+---+---+---+---+---+ 2 | First octet of base header | (with type indication) +---+---+---+---+---+---+---+---+ | | 3 / 0-2 octets of CID info / 1-2 octets if for large CIDs | | +---+---+---+---+---+---+---+---+ 4 / Remainder of base header / variable number of octets +---+---+---+---+---+---+---+---+ : Irregular chain : 5 / (including irregular chain / variable : items for TCP options) : +---+---+---+---+---+---+---+---+ | | 6 / Payload / variable length | | - - - - - - - - - - - - - - - -
context | The compression context |
ip | The outer IP header |
packet_size | The length of the uncompressed packet (in bytes) |
next_header | The next header data used to code the static and dynamic parts of the next header for some profiles such as UDP, UDP-Lite, and so on. |
rohc_pkt | OUT: The ROHC packet |
rohc_pkt_max_len | The maximum length of the ROHC packet |
packet_type | The type of ROHC packet to create |
payload_offset | OUT: The offset for the payload in the IP packet |
static uint8_t * tcp_code_dynamic_ip_part | ( | const struct rohc_comp_ctxt * | context, |
ip_context_ptr_t | ip_context, | ||
base_header_ip_t | base_header, | ||
multi_ptr_t | mptr, | ||
int | is_innermost | ||
) | [static] |
Build the dynamic part of the IP header.
context | The compression context |
ip_context | The specific IP compression context |
base_header | The IP header |
mptr | The current pointer in the rohc-packet-under-build buffer |
is_innermost | True if the IP header is the innermost of the packet |
static uint8_t * tcp_code_dynamic_ipv6_option_part | ( | struct rohc_comp_ctxt *const | context, |
ip_context_ptr_t | ip_context, | ||
multi_ptr_t | mptr, | ||
uint8_t | protocol, | ||
base_header_ip_t | base_header | ||
) | [static] |
Build the dynamic part of the IPv6 option header.
context | The compression context |
ip_context | The specific IP compression context |
mptr | The current pointer in the rohc-packet-under-build buffer |
protocol | The IPv6 protocol option |
base_header | The IP header |
static uint8_t * tcp_code_dynamic_tcp_part | ( | const struct rohc_comp_ctxt * | context, |
const unsigned char * | next_header, | ||
multi_ptr_t | mptr | ||
) | [static] |
Build the dynamic part of the TCP header.
Dynamic part of TCP header: TODO
context | The compression context |
next_header | The TCP header |
mptr | The current pointer in the rohc-packet-under-build buffer |
static uint8_t * tcp_code_irregular_ip_part | ( | struct rohc_comp_ctxt *const | context, |
ip_context_ptr_t | ip_context, | ||
base_header_ip_t | base_header, | ||
uint8_t * | rohc_data, | ||
int | ecn_used, | ||
int | is_innermost, | ||
int | ttl_irregular_chain_flag, | ||
int | ip_inner_ecn | ||
) | [static] |
Build the irregular part of the IP header.
See Rfc4996 page 63
context | The compression context |
ip_context | The specific IP compression context |
base_header | The IP header |
rohc_data | The current pointer in the rohc-packet-under-build buffer |
ecn_used | The indicator of ECN usage |
is_innermost | True if IP header is the innermost of the packet |
ttl_irregular_chain_flag | Whether he TTL/Hop Limit of an outer header changed |
ip_inner_ecn | The ECN flags of the IP innermost header |
static uint8_t * tcp_code_irregular_ipv6_option_part | ( | struct rohc_comp_ctxt *const | context, |
ip_context_ptr_t | ip_context, | ||
multi_ptr_t | mptr, | ||
uint8_t | protocol, | ||
base_header_ip_t | base_header | ||
) | [static] |
Build the irregular part of the IPv6 option header.
context | The compression context |
ip_context | The specific IP compression context |
mptr | The current pointer in the rohc-packet-under-build buffer |
protocol | The IPv6 protocol option |
base_header | The IP header |
static uint8_t * tcp_code_irregular_tcp_part | ( | struct rohc_comp_ctxt *const | context, |
tcphdr_t * | tcp, | ||
uint8_t *const | rohc_data, | ||
int | ip_inner_ecn | ||
) | [static] |
Build the irregular part of the TCP header.
context | The compression context |
tcp | The TCP header |
rohc_data | The current pointer in the rohc-packet-under-build buffer |
ip_inner_ecn | The ecn flags of the ip inner |
static uint8_t * tcp_code_static_ip_part | ( | struct rohc_comp_ctxt *const | context, |
base_header_ip_t | base_header, | ||
multi_ptr_t | mptr | ||
) | [static] |
Build the static part of the IP header.
context | The compression context |
base_header | The IP header |
mptr | The current pointer in the rohc-packet-under-build buffer |
static uint8_t * tcp_code_static_ipv6_option_part | ( | struct rohc_comp_ctxt *const | context, |
multi_ptr_t | mptr, | ||
uint8_t | protocol, | ||
base_header_ip_t | base_header | ||
) | [static] |
Build the static part of the IPv6 option header.
context | The compression context |
mptr | The current pointer in the rohc-packet-under-build buffer |
protocol | The IPv6 protocol option |
base_header | The IP header |
static uint8_t * tcp_code_static_tcp_part | ( | const struct rohc_comp_ctxt * | context, |
const tcphdr_t * | tcp, | ||
multi_ptr_t | mptr | ||
) | [static] |
Build the static part of the TCP header.
Static part of TCP header: +---+---+---+---+---+---+---+---+ 1 / Source port / 2 octets +---+---+---+---+---+---+---+---+ 2 / Destination port / 2 octets +---+---+---+---+---+---+---+---+
context | The compression context |
tcp | The TCP header |
mptr | The current pointer in the rohc-packet-under-build buffer |
static bool tcp_compress_tcp_options | ( | struct rohc_comp_ctxt *const | context, |
const tcphdr_t *const | tcp, | ||
uint8_t *const | comp_opts, | ||
size_t *const | comp_opts_len | ||
) | [static] |
Compress the TCP options.
context | The compression context |
tcp | The TCP header |
comp_opts | IN/OUT: The compressed TCP options |
comp_opts_len | OUT: The length (in bytes) of the compressed TCP options |
static rohc_packet_t tcp_decide_packet | ( | const struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t *const | ip_inner_context, | ||
const tcphdr_t *const | tcp | ||
) | [static] |
Decide which packet to send when in the different states.
context | The compression context |
ip_inner_context | The context of the inner IP header |
tcp | The TCP header to compress |
static rohc_packet_t tcp_decide_SO_packet | ( | const struct rohc_comp_ctxt *const | context, |
const ip_context_ptr_t *const | ip_inner_context, | ||
const tcphdr_t *const | tcp | ||
) | [static] |
Decide which packet to send when in SO state.
context | The compression context |
ip_inner_context | The context of the inner IP header |
tcp | The TCP header to compress |
static void tcp_decide_state | ( | struct rohc_comp_ctxt *const | context | ) | [static] |
Decide the state that should be used for the next packet.
The three states are:
context | The compression context |
static bool tcp_detect_changes | ( | struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | uncomp_pkt | ||
) | [static] |
Detect changes between packet and context.
context | The compression context to compare |
uncomp_pkt | The uncompressed packet to compare |
static tcp_ip_id_behavior_t tcp_detect_ip_id_behavior | ( | const uint16_t | last_ip_id, |
const uint16_t | new_ip_id | ||
) | [static] |
Detect the behavior of the IPv4 Identification field.
last_ip_id | The IP-ID value of the previous packet (in HBO) |
new_ip_id | The IP-ID value of the current packet (in HBO) |
static bool tcp_encode_uncomp_fields | ( | struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | uncomp_pkt | ||
) | [static] |
Encode uncompressed fields with the corresponding encoding scheme.
context | The compression context |
uncomp_pkt | The uncompressed packet to encode |
static void tcp_field_descr_change | ( | const struct rohc_comp_ctxt *const | context, |
const char *const | name, | ||
const bool | changed | ||
) | [static] |
Print a debug trace for the field change.
context | The compression context |
name | The name of the field |
changed | Whether the field changed or not |
static void tcp_field_descr_present | ( | const struct rohc_comp_ctxt *const | context, |
const char *const | name, | ||
const bool | present | ||
) | [static] |
Print a debug trace for the field presence.
context | The compression context |
name | The name of the field |
present | Whether the field is present or not |
static char * tcp_ip_id_behavior_get_descr | ( | const tcp_ip_id_behavior_t | behavior | ) | [static] |
Get a string that describes the given IP-ID behavior.
behavior | The type of the option to get a description for |
static char * tcp_opt_get_descr | ( | const uint8_t | opt_type | ) | [static] |
Get a string that describes the given option type.
opt_type | The type of the option to get a description for |
struct rohc_comp_profile c_tcp_profile |
{ .id = ROHC_PROFILE_TCP, .protocol = ROHC_IPPROTO_TCP, .create = c_tcp_create, .destroy = c_tcp_destroy, .check_profile = c_tcp_check_profile, .check_context = c_tcp_check_context, .encode = c_tcp_encode, .reinit_context = c_generic_reinit_context, .feedback = c_generic_feedback, .use_udp_port = c_generic_use_udp_port, }
Define the compression part of the TCP profile as described in the RFC 3095.
int tcp_options_index[TCP_LIST_ITEM_MAP_LEN] [static] |
{ TCP_INDEX_EOL, TCP_INDEX_NOP, TCP_INDEX_MAXSEG, TCP_INDEX_WINDOW, TCP_INDEX_SACK_PERMITTED, TCP_INDEX_SACK, -1, -1, TCP_INDEX_TIMESTAMP, -1, -1, -1, -1, -1, -1, -1 }
Table of TCP option index, from option Id.
See RFC4996 6.3.4 Return item index of TCP option