29 #ifndef ROHC_PROTOCOLS_TCP_H
30 #define ROHC_PROTOCOLS_TCP_H
44 #define ROHC_PACKET_TYPE_IR 0xFD
45 #define ROHC_PACKET_TYPE_IR_DYN 0xF8
58 #define ROHC_TCP_MAX_IP_HDRS 10U
67 #define ROHC_TCP_MAX_IP_EXT_HDRS 20U
76 #define MAX_TCP_OPTION_INDEX 15U
87 #define ROHC_TCP_OPTS_MAX_PROTO 40U
102 #define ROHC_TCP_OPTS_MAX 15U
121 #if WORDS_BIGENDIAN == 1
142 } __attribute__((packed));
146 #define RSF_RST_ONLY 0x04
147 #define RSF_SYN_ONLY 0x02
148 #define RSF_FIN_ONLY 0x01
149 #define RSF_NONE 0x00
163 #define TCP_OLEN_MSS 4U
165 #define TCP_OLEN_WS 3U
167 #define TCP_OLEN_SACK_PERM 2U
170 #define TCP_OLEN_TS 10U
176 #define TCP_INDEX_NOP 0U
177 #define TCP_INDEX_EOL 1U
178 #define TCP_INDEX_MSS 2U
179 #define TCP_INDEX_WS 3U
180 #define TCP_INDEX_TS 4U
181 #define TCP_INDEX_SACK_PERM 5U
182 #define TCP_INDEX_SACK 6U
183 #define TCP_INDEX_GENERIC7 7U
184 #define TCP_INDEX_GENERIC8 8U
185 #define TCP_INDEX_GENERIC9 9U
186 #define TCP_INDEX_GENERIC10 10U
187 #define TCP_INDEX_GENERIC11 11U
188 #define TCP_INDEX_GENERIC12 12U
189 #define TCP_INDEX_GENERIC13 13U
190 #define TCP_INDEX_GENERIC14 14U
191 #define TCP_INDEX_GENERIC15 15U
208 #define TCP_SACK_BLOCKS_MAX_NR 4U
216 } __attribute__((packed));
231 #if WORDS_BIGENDIAN == 1
232 uint8_t version_flag:1;
236 uint8_t version_flag:1;
261 #if WORDS_BIGENDIAN == 1
264 uint8_t ip_id_behavior:2;
266 uint8_t ip_ecn_flags:2;
268 uint8_t ip_id_behavior:2;
271 uint8_t ip_ecn_flags:2;
285 #if WORDS_BIGENDIAN == 1
288 uint8_t ip_id_behavior:2;
290 uint8_t ip_ecn_flags:2;
292 uint8_t ip_id_behavior:2;
295 uint8_t ip_ecn_flags:2;
348 #if WORDS_BIGENDIAN == 1
349 uint8_t version_flag:1;
351 uint8_t flow_label_enc_discriminator:1;
355 uint8_t flow_label_enc_discriminator:1;
357 uint8_t version_flag:1;
360 uint32_t src_addr[4];
361 uint32_t dst_addr[4];
372 #if WORDS_BIGENDIAN == 1
373 uint8_t version_flag:1;
375 uint8_t flow_label_enc_discriminator:1;
376 uint8_t flow_label1:4;
378 uint8_t flow_label1:4;
379 uint8_t flow_label_enc_discriminator:1;
381 uint8_t version_flag:1;
385 uint32_t src_addr[4];
386 uint32_t dst_addr[4];
397 #if WORDS_BIGENDIAN == 1
399 uint8_t ip_ecn_flags:2;
401 uint8_t ip_ecn_flags:2;
432 #if WORDS_BIGENDIAN == 1
434 uint8_t ack_stride_flag:1;
437 uint8_t tcp_res_flags:4;
439 uint8_t tcp_ecn_flags:2;
445 uint8_t tcp_res_flags:4;
448 uint8_t ack_stride_flag:1;
455 uint8_t tcp_ecn_flags:2;
479 #if WORDS_BIGENDIAN == 1
481 uint8_t discriminator:7;
482 uint8_t ttl_hopl_outer_flag:1;
490 uint8_t seq_indicator:2;
491 uint8_t ack_indicator:2;
492 uint8_t ack_stride_indicator:1;
493 uint8_t window_indicator:1;
494 uint8_t ip_id_indicator:1;
495 uint8_t urg_ptr_present:1;
499 uint8_t dscp_present:1;
500 uint8_t ttl_hopl_present:1;
501 uint8_t list_present:1;
502 uint8_t ip_id_behavior:2;
506 uint8_t header_crc:7;
510 uint8_t ttl_hopl_outer_flag:1;
511 uint8_t discriminator:7;
518 uint8_t urg_ptr_present:1;
519 uint8_t ip_id_indicator:1;
520 uint8_t window_indicator:1;
521 uint8_t ack_stride_indicator:1;
522 uint8_t ack_indicator:2;
523 uint8_t seq_indicator:2;
526 uint8_t ip_id_behavior:2;
527 uint8_t list_present:1;
528 uint8_t ttl_hopl_present:1;
529 uint8_t dscp_present:1;
533 uint8_t header_crc:7;
562 #if WORDS_BIGENDIAN == 1
563 uint8_t discriminator:6;
568 uint8_t header_crc:3;
571 uint8_t discriminator:6;
573 uint8_t header_crc:3;
578 } __attribute__((packed))
rnd_1_t;
589 #if WORDS_BIGENDIAN == 1
590 uint8_t discriminator:4;
591 uint8_t seq_num_scaled:4;
594 uint8_t header_crc:3;
596 uint8_t seq_num_scaled:4;
597 uint8_t discriminator:4;
598 uint8_t header_crc:3;
603 } __attribute__((packed))
rnd_2_t;
614 #if WORDS_BIGENDIAN == 1
615 uint16_t discriminator:1;
620 uint8_t header_crc:3;
623 uint8_t discriminator:1;
625 uint8_t header_crc:3;
630 } __attribute__((packed))
rnd_3_t;
641 #if WORDS_BIGENDIAN == 1
642 uint8_t discriminator:4;
643 uint8_t ack_num_scaled:4;
646 uint8_t header_crc:3;
648 uint8_t ack_num_scaled:4;
649 uint8_t discriminator:4;
650 uint8_t header_crc:3;
655 } __attribute__((packed))
rnd_4_t;
666 #if WORDS_BIGENDIAN == 1
667 uint8_t discriminator:3;
670 uint32_t header_crc:3;
679 uint8_t discriminator:3;
681 uint8_t header_crc:3;
688 } __attribute__((packed))
rnd_5_t;
699 #if WORDS_BIGENDIAN == 1
700 uint8_t discriminator:4;
701 uint8_t header_crc:3;
705 uint8_t header_crc:3;
706 uint8_t discriminator:4;
709 #if WORDS_BIGENDIAN == 1
711 uint8_t seq_num_scaled:4;
713 uint8_t seq_num_scaled:4;
717 } __attribute__((packed))
rnd_6_t;
728 #if WORDS_BIGENDIAN == 1
729 uint8_t discriminator:6;
734 uint8_t discriminator:6;
738 #if WORDS_BIGENDIAN == 1
741 uint8_t header_crc:3;
743 uint8_t header_crc:3;
748 } __attribute__((packed))
rnd_7_t;
759 #if WORDS_BIGENDIAN == 1
760 uint8_t discriminator:5;
762 uint8_t list_present:1;
763 uint16_t header_crc:7;
770 uint8_t list_present:1;
772 uint8_t discriminator:5;
774 uint8_t header_crc:7;
785 } __attribute__((packed))
rnd_8_t;
796 #if WORDS_BIGENDIAN == 1
797 uint8_t discriminator:4;
801 uint8_t discriminator:4;
804 #if WORDS_BIGENDIAN == 1
807 uint8_t header_crc:3;
809 uint8_t header_crc:3;
814 } __attribute__((packed))
seq_1_t;
825 #if WORDS_BIGENDIAN == 1
826 uint16_t discriminator:5;
829 uint16_t seq_num_scaled:4;
832 uint8_t header_crc:3;
835 uint8_t discriminator:5;
836 uint8_t seq_num_scaled:4;
838 uint8_t header_crc:3;
843 } __attribute__((packed))
seq_2_t;
854 #if WORDS_BIGENDIAN == 1
855 uint8_t discriminator:4;
859 uint8_t discriminator:4;
862 #if WORDS_BIGENDIAN == 1
865 uint8_t header_crc:3;
867 uint8_t header_crc:3;
872 } __attribute__((packed))
seq_3_t;
883 #if WORDS_BIGENDIAN == 1
884 uint8_t discriminator:1;
885 uint8_t ack_num_scaled:4;
889 uint8_t header_crc:3;
892 uint8_t ack_num_scaled:4;
893 uint8_t discriminator:1;
894 uint8_t header_crc:3;
899 } __attribute__((packed))
seq_4_t;
910 #if WORDS_BIGENDIAN == 1
911 uint8_t discriminator:4;
915 uint8_t discriminator:4;
919 #if WORDS_BIGENDIAN == 1
922 uint8_t header_crc:3;
924 uint8_t header_crc:3;
929 } __attribute__((packed))
seq_5_t;
940 #if WORDS_BIGENDIAN == 1
941 uint16_t discriminator:5;
942 uint16_t seq_num_scaled1:3;
943 uint16_t seq_num_scaled2:1;
946 uint8_t seq_num_scaled1:3;
947 uint8_t discriminator:5;
949 uint8_t seq_num_scaled2:1;
952 #if WORDS_BIGENDIAN == 1
955 uint8_t header_crc:3;
957 uint8_t header_crc:3;
962 } __attribute__((packed))
seq_6_t;
973 #if WORDS_BIGENDIAN == 1
974 uint8_t discriminator:4;
982 uint8_t header_crc:3;
985 uint8_t discriminator:4;
990 uint8_t header_crc:3;
995 } __attribute__((packed))
seq_7_t;
1006 #if WORDS_BIGENDIAN == 1
1007 uint8_t discriminator:4;
1009 uint8_t list_present:1;
1010 uint8_t header_crc:7;
1017 uint8_t rsf_flags:2;
1022 uint8_t discriminator:4;
1023 uint8_t header_crc:7;
1024 uint8_t list_present:1;
1032 uint8_t rsf_flags:2;
1038 } __attribute__((packed))
seq_8_t;
1047 __attribute__((warn_unused_result, const));
1050 __attribute__((warn_unused_result, const));
1064 return "sequential";
1066 return "sequential swapped";
1070 return "constant zero";
1072 return "unknown IP-ID behavior";
1094 return "Window Scale";
1096 return "SACK permitted";
uint8_t ecn_flags
Definition: tcp.h:136
uint32_t ts
Definition: tcp.h:214
uint16_t window
Definition: tcp.h:138
The rnd_1 compressed packet format.
Definition: tcp.h:560
The rnd_6 compressed packet format.
Definition: tcp.h:697
The Selective Acknowlegment TCP option.
Definition: tcp.h:200
uint8_t protocol
Definition: tcp.h:238
The rnd_2 compressed packet format.
Definition: tcp.h:587
uint32_t block_end
Definition: tcp.h:203
uint8_t next_header
Definition: tcp.h:335
The rnd_8 compressed packet format.
Definition: tcp.h:757
uint16_t dst_port
Definition: tcp.h:118
uint16_t ack_num
Definition: tcp.h:861
uint16_t seq_num
Definition: tcp.h:918
The IPv6 static part, flow_label encoded with 1+20 bits.
Definition: tcp.h:370
uint16_t ack_num
Definition: tcp.h:708
uint16_t msn
Definition: tcp.h:457
The rnd_7 compressed packet format.
Definition: tcp.h:726
uint8_t window2
Definition: tcp.h:986
The rnd_4 compressed packet format.
Definition: tcp.h:639
uint8_t ttl_hopl
Definition: tcp.h:274
The TCP static part.
Definition: tcp.h:418
The rnd_5 compressed packet format.
Definition: tcp.h:664
The IPv6 dynamic part.
Definition: tcp.h:395
uint8_t length
Definition: tcp.h:328
uint32_t seq_num
Definition: tcp.h:458
The rnd_3 compressed packet format.
Definition: tcp.h:612
uint16_t ip_id
Definition: tcp.h:299
uint8_t urg_flag
Definition: tcp.h:135
The seq_1 compressed packet format.
Definition: tcp.h:794
uint16_t src_port
Definition: tcp.h:117
static char * tcp_ip_id_behavior_get_descr(const tcp_ip_id_behavior_t ip_id_behavior)
Get a string that describes the given IP-ID behavior.
Definition: tcp.h:1059
The IPv4 dynamic part without IP-ID field.
Definition: tcp.h:259
The seq_6 compressed packet format.
Definition: tcp.h:938
uint16_t ack_num
Definition: tcp.h:781
uint16_t ack_num
Definition: tcp.h:989
uint8_t ttl_hopl
Definition: tcp.h:298
uint16_t src_port
Definition: tcp.h:420
uint16_t urg_ptr
Definition: tcp.h:140
rohc_tcp_option_type_t
Definition: tcp.h:158
uint16_t checksum
Definition: tcp.h:139
uint32_t block_start
Definition: tcp.h:202
uint16_t seq_num2
Definition: tcp.h:572
uint8_t ttl_hopl
Definition: tcp.h:404
The TCP dynamic part.
Definition: tcp.h:430
The seq_2 compressed packet format.
Definition: tcp.h:823
The IPv6 static part, null flow_label encoded with 1 bit.
Definition: tcp.h:346
uint8_t ack_num2
Definition: tcp.h:685
uint8_t options[0]
Definition: tcp.h:141
The IPv4 dynamic part with IP-ID field.
Definition: tcp.h:283
static char * tcp_opt_get_descr(const uint8_t opt_type)
Get a string that describes the given option type.
Definition: tcp.h:1083
The seq_8 compressed packet format.
Definition: tcp.h:1004
uint8_t res_flags
Definition: tcp.h:130
uint8_t next_header
Definition: tcp.h:384
uint8_t data_offset
Definition: tcp.h:131
The TCP base header without options.
Definition: tcp.h:115
uint16_t seq_num
Definition: tcp.h:780
The IPv4 static part.
Definition: tcp.h:229
uint16_t dst_port
Definition: tcp.h:421
uint16_t flow_label2
Definition: tcp.h:383
uint32_t ack_num
Definition: tcp.h:120
uint8_t next_header
Definition: tcp.h:359
The seq_7 compressed packet format.
Definition: tcp.h:971
uint8_t length
Definition: tcp.h:312
uint32_t seq_num
Definition: tcp.h:119
uint16_t ack_num
Definition: tcp.h:951
uint16_t window
Definition: tcp.h:737
uint8_t seq_num2
Definition: tcp.h:682
uint8_t rsf_flags
Definition: tcp.h:132
The seq_4 compressed packet format.
Definition: tcp.h:881
The seq_5 compressed packet format.
Definition: tcp.h:908
uint8_t length
Definition: tcp.h:336
uint32_t dst_addr
Definition: tcp.h:240
uint16_t seq_num
Definition: tcp.h:803
The seq_3 compressed packet format.
Definition: tcp.h:852
uint8_t next_header
Definition: tcp.h:327
uint32_t src_addr
Definition: tcp.h:239
uint8_t ack_num2
Definition: tcp.h:1030
uint8_t next_header
Definition: tcp.h:319
uint16_t ack_num
Definition: tcp.h:917
uint8_t next_header
Definition: tcp.h:311
uint8_t psh_flag
Definition: tcp.h:133
uint8_t length
Definition: tcp.h:320
tcp_ip_id_behavior_t
Definition: tcp.h:245
The Common compressed packet format.
Definition: tcp.h:477
uint8_t ack_flag
Definition: tcp.h:134
uint32_t ts_reply
Definition: tcp.h:215
uint16_t ack_num2
Definition: tcp.h:735