ROHC compression/decompression library
c_tcp_defines.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012,2013,2014,2015,2016 Didier Barvaux
3  * Copyright 2013,2014 Viveris Technologies
4  * Copyright 2012 WBX
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file c_tcp_defines.h
23  * @brief Main definitions for the TCP compression profile
24  * @author FWX <rohc_team@dialine.fr>
25  * @author Didier Barvaux <didier@barvaux.org>
26  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
27  */
28 
29 #ifndef ROHC_COMP_TCP_DEFINES_H
30 #define ROHC_COMP_TCP_DEFINES_H
31 
32 #include "protocols/ip.h"
33 #include "protocols/tcp.h"
34 #include "schemes/ip_ctxt.h"
35 #include "c_tcp_opts_list.h"
36 
37 
38 /**
39  * @brief Define the TCP-specific temporary variables in the profile
40  * compression context.
41  *
42  * This object must be used by the TCP-specific compression context
43  * sc_tcp_context.
44  *
45  * @see sc_tcp_context
46  */
48 {
49  /** Whether at least one of the static part of the IPv6 extensions changed
50  * in the current packet */
52  /** Whether at least one of the dynamic part of the IPv6 extensions changed
53  * in the current packet */
55  /** The new number of IP extensions headers (for every IP header) */
57 
58  /* the length of the TCP payload (headers and options excluded) */
59  size_t payload_len;
60 
61  /** The minimal number of bits required to encode the MSN value */
62  size_t nr_msn_bits;
63 
64  /** Whether the TCP window changed or not */
66  /** The minimal number of bits required to encode the TCP window */
68 
69  /** Whether the TCP sequence number changed or not */
71  /** The minimal number of bits required to encode the TCP scaled sequence
72  * number */
74 
75  /** Whether the ACK number changed or not */
77  /** The minimal number of bits required to encode the TCP ACK number
78  * with p = 16383 */
80  /** The minimal number of bits required to encode the TCP scaled ACK
81  * number */
83 
84  /** The IP-ID / SN delta (with bits swapped if necessary) */
85  uint16_t ip_id_delta;
86  /** Whether the behavior of the IP-ID field changed with current packet */
88  /** The minimal number of bits required to encode the innermost IP-ID value
89  * with p = 3 */
91  /** The minimal number of bits required to encode the innermost IP-ID value
92  * with p = 1 */
94 
95  /* innermost IPv4 TTL or IPv6 Hop Limit */
96  uint8_t ttl_hopl;
99  /* outer IPv4 TTLs or IPv6 Hop Limits */
102 
105 
109 
110  /** Whether the ecn_used flag changed or not */
112 };
113 
114 
115 /** Define the TCP part of the profile compression context */
117 {
118  /// The number of times the sequence number field was added to the compressed header
120  /** The number of times the window field was added to the compressed header */
122 
123  /** Explicit Congestion Notification used */
124  bool ecn_used;
125  /** The number of times the ECN fields were added to the compressed header */
127  /** The number of times the ECN fields were not needed */
129 
130  uint16_t msn; /**< The Master Sequence Number (MSN) */
131  struct c_wlsb msn_wlsb; /**< The W-LSB decoding context for MSN */
132 
133  /** The MSN of the last packet that updated the context (used to determine
134  * if a positive ACK may cause a transition to a higher compression state) */
136 
137  struct c_wlsb ttl_hopl_wlsb;
139 
140  struct c_wlsb ip_id_wlsb;
141 
142 // lsb(15, 16383)
143  struct c_wlsb window_wlsb; /**< The W-LSB decoding context for TCP window */
144 
145  uint32_t seq_num;
146  struct c_wlsb seq_wlsb;
147  struct c_wlsb seq_scaled_wlsb;
148 
149  uint32_t seq_num_scaled;
150  uint32_t seq_num_residue;
153 
154  uint32_t ack_num;
155  struct c_wlsb ack_wlsb;
156  struct c_wlsb ack_scaled_wlsb;
157 
159  uint16_t ack_deltas_width[20];
160  uint16_t ack_stride;
161  uint32_t ack_num_scaled;
162  uint16_t ack_num_residue;
164 
165  /* Context Replication */
169 
170  /** The compression context for TCP options */
171  struct c_tcp_opts_ctxt tcp_opts;
172 
173  /// The previous TCP header
174  struct tcphdr old_tcphdr;
175 
176  /// @brief TCP-specific temporary variables that are used during one single
177  /// compression of packet
178  struct tcp_tmp_variables tmp;
179 
182 };
183 
184 #endif /* ROHC_COMP_TCP_DEFINES_H */
185 
size_t seq_num_scaling_nr
Definition: c_tcp_defines.h:152
bool ecn_used_changed
Definition: c_tcp_defines.h:111
size_t nr_seq_scaled_bits
Definition: c_tcp_defines.h:73
uint32_t ack_num
Definition: c_tcp_defines.h:154
size_t nr_ip_id_bits_3
Definition: c_tcp_defines.h:90
Definition: c_tcp_defines.h:116
uint32_t seq_num_residue
Definition: c_tcp_defines.h:150
Define the TCP-specific temporary variables in the profile compression context.
Definition: c_tcp_defines.h:47
bool ecn_used
Definition: c_tcp_defines.h:124
size_t ack_num_scaling_nr
Definition: c_tcp_defines.h:163
uint32_t seq_num
Definition: c_tcp_defines.h:145
bool cr_tcp_ack_num_present
Definition: c_tcp_defines.h:168
bool tcp_urg_flag_changed
Definition: c_tcp_defines.h:108
Handle the list of TCP options for the TCP ompression profile.
size_t ack_deltas_next
Definition: c_tcp_defines.h:158
size_t ecn_used_zero_count
Definition: c_tcp_defines.h:128
bool is_ipv6_exts_list_dyn_changed
Definition: c_tcp_defines.h:54
size_t nr_ttl_hopl_bits
Definition: c_tcp_defines.h:97
bool outer_ip_ttl_changed
Definition: c_tcp_defines.h:101
bool tcp_urg_flag_present
Definition: c_tcp_defines.h:107
int ttl_irreg_chain_flag
Definition: c_tcp_defines.h:100
uint16_t msn_of_last_ctxt_updating_pkt
Definition: c_tcp_defines.h:135
Definition: c_tcp_opts_list.h:113
One W-LSB encoding object.
Definition: comp_wlsb.h:56
uint16_t ip_id_delta
Definition: c_tcp_defines.h:85
uint32_t seq_num_scaled
Definition: c_tcp_defines.h:149
uint16_t msn
Definition: c_tcp_defines.h:130
uint32_t ack_num_scaled
Definition: c_tcp_defines.h:161
bool ip_df_changed
Definition: c_tcp_defines.h:103
size_t seq_num_factor
Definition: c_tcp_defines.h:151
size_t ecn_used_change_count
Definition: c_tcp_defines.h:126
size_t tcp_window_changed
Definition: c_tcp_defines.h:65
The TCP base header without options.
Definition: tcp.h:50
size_t nr_ip_id_bits_1
Definition: c_tcp_defines.h:93
size_t ttl_hopl_change_count
Definition: c_tcp_defines.h:138
size_t nr_msn_bits
Definition: c_tcp_defines.h:62
size_t nr_window_bits_16383
Definition: c_tcp_defines.h:67
size_t nr_ack_bits_16383
Definition: c_tcp_defines.h:79
int tcp_seq_num_change_count
The number of times the sequence number field was added to the compressed header. ...
Definition: c_tcp_defines.h:119
size_t ip_exts_nr[ROHC_MAX_IP_HDRS]
Definition: c_tcp_defines.h:56
bool cr_tcp_urg_ptr_present
Definition: c_tcp_defines.h:167
bool ttl_hopl_changed
Definition: c_tcp_defines.h:98
bool ip_id_behavior_changed
Definition: c_tcp_defines.h:87
size_t tcp_window_change_count
Definition: c_tcp_defines.h:121
Define union of IP contexts.
Definition: comp/schemes/ip_ctxt.h:155
size_t nr_ack_scaled_bits
Definition: c_tcp_defines.h:82
bool cr_tcp_window_present
Definition: c_tcp_defines.h:166
Defines the common IPv4/v6 header.
bool tcp_ack_flag_changed
Definition: c_tcp_defines.h:106
bool tcp_ack_num_changed
Definition: c_tcp_defines.h:76
bool is_ipv6_exts_list_static_changed
Definition: c_tcp_defines.h:51
TCP header description.
uint8_t ttl_hopl
Definition: c_tcp_defines.h:96
uint16_t ack_stride
Definition: c_tcp_defines.h:160
size_t ip_contexts_nr
Definition: c_tcp_defines.h:180
uint16_t ack_num_residue
Definition: c_tcp_defines.h:162
#define ROHC_MAX_IP_HDRS
The maximum number of IP headers supported.
Definition: protocols/ip.h:46
bool dscp_changed
Definition: c_tcp_defines.h:104
size_t payload_len
Definition: c_tcp_defines.h:59
bool tcp_seq_num_changed
Definition: c_tcp_defines.h:70