ROHC compression/decompression library
Data Structures | Macros | Functions
c_tcp_opts_list.h File Reference

Handle the list of TCP options for the TCP ompression profile. More...

#include "rohc_comp_internals.h"
#include "protocols/tcp.h"
#include <stdint.h>
#include <stddef.h>
Include dependency graph for c_tcp_opts_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  c_tcp_opt_ctxt
 The compression context for one TCP option. More...
 
struct  c_tcp_opts_ctxt_tmp
 
struct  c_tcp_opts_ctxt
 

Macros

#define MAX_TCP_OPT_SIZE   40U
 

Functions

bool rohc_comp_tcp_are_options_acceptable (const struct rohc_comp *const comp, const uint8_t *const opts, const size_t data_offset)
 Whether TCP options are acceptable for TCP profile or not. More...
 
bool tcp_detect_options_changes (struct rohc_comp_ctxt *const context, const struct tcphdr *const tcp, struct c_tcp_opts_ctxt *const opts_ctxt, size_t *const opts_len)
 Parse the uncompressed TCP options for changes. More...
 
int c_tcp_code_tcp_opts_list_item (const struct rohc_comp_ctxt *const context, const struct tcphdr *const tcp, const uint16_t msn, const rohc_tcp_chain_t chain_type, struct c_tcp_opts_ctxt *const opts_ctxt, uint8_t *const comp_opts, const size_t comp_opts_max_len, bool *const no_item_needed)
 Build the list of TCP options items. More...
 
int c_tcp_code_tcp_opts_irreg (const struct rohc_comp_ctxt *const context, const struct tcphdr *const tcp, const uint16_t msn, struct c_tcp_opts_ctxt *const opts_ctxt, uint8_t *const comp_opts, const size_t comp_opts_max_len)
 Build the list of TCP options for the irregular chain. More...
 

Detailed Description

Handle the list of TCP options for the TCP ompression profile.

Author
FWX rohc_.nosp@m.team.nosp@m.@dial.nosp@m.ine..nosp@m.fr
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org
Didier Barvaux didie.nosp@m.r.ba.nosp@m.rvaux.nosp@m.@tou.nosp@m.louse.nosp@m..viv.nosp@m.eris..nosp@m.com

Macro Definition Documentation

◆ MAX_TCP_OPT_SIZE

#define MAX_TCP_OPT_SIZE   40U

The maximum size (in bytes) of one TCP option

Function Documentation

◆ c_tcp_code_tcp_opts_irreg()

int c_tcp_code_tcp_opts_irreg ( const struct rohc_comp_ctxt *const  context,
const struct tcphdr *const  tcp,
const uint16_t  msn,
struct c_tcp_opts_ctxt *const  opts_ctxt,
uint8_t *const  comp_opts,
const size_t  comp_opts_max_len 
)

Build the list of TCP options for the irregular chain.

All the CO packets contains an irregular chain.

Parameters
contextThe compression context
tcpThe TCP header
msnThe Master Sequence Number (MSN) of the packet to compress
[in,out]opts_ctxtThe compression context for TCP options
[out]comp_optsThe compressed TCP options
comp_opts_max_lenThe max remaining length in the ROHC buffer
Returns
The length (in bytes) of compressed TCP options in case of success, -1 in case of failure
Todo:
TODO: defines 'options profiles' the same way as for decompressor

◆ c_tcp_code_tcp_opts_list_item()

int c_tcp_code_tcp_opts_list_item ( const struct rohc_comp_ctxt *const  context,
const struct tcphdr *const  tcp,
const uint16_t  msn,
const rohc_tcp_chain_t  chain_type,
struct c_tcp_opts_ctxt *const  opts_ctxt,
uint8_t *const  comp_opts,
const size_t  comp_opts_max_len,
bool *const  no_item_needed 
)

Build the list of TCP options items.

The list of TCP options is used in:

  • the dynamic chain of the IR and IR-DYN packets,
  • the replicate chain of the IR-CR packets,
  • at the end of the rnd_8, seq_8, and co_common packets.
Parameters
contextThe compression context
tcpThe TCP header
msnThe Master Sequence Number (MSN) of the packet to compress
chain_typeThe TCP chain for which the list of items is
[in,out]opts_ctxtThe compression context for TCP options
[out]comp_optsThe compressed TCP options
comp_opts_max_lenThe max remaining length in the ROHC buffer
[out]no_item_neededWhether no item was needed at all
Returns
The length (in bytes) of compressed TCP options in case of success, -1 in case of failure

◆ rohc_comp_tcp_are_options_acceptable()

bool rohc_comp_tcp_are_options_acceptable ( const struct rohc_comp *const  comp,
const uint8_t *const  opts,
const size_t  data_offset 
)

Whether TCP options are acceptable for TCP profile or not.

TCP options are acceptable for the TCP profile if:

  • the last TCP option is not truncated,
  • well-known TCP options got the expected length (see below),
  • no more than ROHC_TCP_OPTS_MAX options are present,
  • each TCP options is present only once (except EOL and NOP).

The following well-known TCP options shall have expected lengthes:

  • MSS shall be TCP_OLEN_MSS long,
  • WS shall be TCP_OLEN_WS long,
  • SACK Permitted shall be TCP_OLEN_SACK_PERM long,
  • SACK shall be 2 + N * 8 with N in range [1, 4]
  • TS shall be TCP_OLEN_TS long.
Parameters
compThe ROHC compressor
optsThe beginning of the TCP options
data_offsetThe length (in 32-bit words) of the full TCP header
Returns
true if the TCP options are acceptable, false if they are not
See also
ROHC_TCP_OPTS_MAX

◆ tcp_detect_options_changes()

bool tcp_detect_options_changes ( struct rohc_comp_ctxt *const  context,
const struct tcphdr *const  tcp,
struct c_tcp_opts_ctxt *const  opts_ctxt,
size_t *const  opts_len 
)

Parse the uncompressed TCP options for changes.

Parameters
contextThe compression context
tcpThe TCP header
[in,out]opts_ctxtThe compression context for TCP options
[out]opts_lenThe length (in bytes) of the TCP options
Returns
true if the TCP options were successfully parsed and can be compressed, false otherwise