ROHC compression/decompression library
Data Structures | 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 "protocols/rfc6846.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
 

Functions

bool rohc_comp_tcp_are_options_acceptable (const struct rohc_comp *const comp, const uint8_t *const opts, const size_t data_offset, struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
 Whether TCP options are acceptable for TCP profile or not. More...
 
void tcp_detect_options_changes (struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, struct c_tcp_opts_ctxt *const opts_ctxt, struct c_tcp_opts_ctxt_tmp *const tmp, const bool tcp_ack_num_changed)
 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 rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_chain_t chain_type, struct c_tcp_opts_ctxt *const opts_ctxt, struct c_tcp_opts_ctxt_tmp *const tmp, 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 rohc_pkt_hdrs *const uncomp_pkt_hdrs, struct c_tcp_opts_ctxt *const opts_ctxt, const struct c_tcp_opts_ctxt_tmp *const tmp, 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

Function Documentation

◆ c_tcp_code_tcp_opts_irreg()

int c_tcp_code_tcp_opts_irreg ( const struct rohc_comp_ctxt *const  context,
const struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs,
struct c_tcp_opts_ctxt *const  opts_ctxt,
const struct c_tcp_opts_ctxt_tmp *const  tmp,
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
uncomp_pkt_hdrsThe uncompressed headers to encode
[in,out]opts_ctxtThe compression context for TCP options
tmpThe temporary state for compressed 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 rohc_pkt_hdrs *const  uncomp_pkt_hdrs,
const rohc_chain_t  chain_type,
struct c_tcp_opts_ctxt *const  opts_ctxt,
struct c_tcp_opts_ctxt_tmp *const  tmp,
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
uncomp_pkt_hdrsThe uncompressed headers to encode
chain_typeThe TCP chain for which the list of items is
[in,out]opts_ctxtThe compression context for TCP options
tmpThe temporary state for compressed 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,
struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs 
)

Whether TCP options are acceptable for TCP profile or not.

TCP options are acceptable for the TCP profile if:

  • every TCP option is smaller than ROHC_TCP_OPT_MAX_LEN
  • 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 lengths:

  • 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
[out]uncomp_pkt_hdrsThe parsed uncompressed headers
Returns
true if the TCP options are acceptable, false if they are not
See also
ROHC_TCP_OPTS_MAX

◆ tcp_detect_options_changes()

void tcp_detect_options_changes ( struct rohc_comp_ctxt *const  context,
const struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs,
struct c_tcp_opts_ctxt *const  opts_ctxt,
struct c_tcp_opts_ctxt_tmp *const  tmp,
const bool  tcp_ack_num_changed 
)

Parse the uncompressed TCP options for changes.

Parameters
contextThe compression context
uncomp_pkt_hdrsThe uncompressed headers to encode
[in,out]opts_ctxtThe compression context for TCP options
tmpThe temporary state for compressed TCP options
tcp_ack_num_changedWhether the TCP ACK number changed or not