Skip to content

Commit

Permalink
Added documentation, flags, TCP options skipping (see #353)
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyCat committed Jan 15, 2024
1 parent 09f4172 commit 74901a0
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions network/tcp_segment.ksy
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ meta:
rfc:
- 793
- 1323
- 9293
wikidata: Q8803
license: CC0-1.0
endian: be
ks-version: 0.10
doc: |
TCP is one of the core Internet protocols on transport layer (AKA
OSI layer 4), providing stateful connections with error checking,
Expand All @@ -16,21 +18,69 @@ doc: |
seq:
- id: src_port
type: u2
doc: Source port
- id: dst_port
type: u2
doc: Destination port
- id: seq_num
type: u4
doc: Sequence number
- id: ack_num
type: u4
- id: b12
type: u1
- id: b13
type: u1
doc: Acknowledgment number
- id: data_offset
type: b4
doc: Data offset (in 32-bit words from the beginning of this type, normally 32 or can be extended if there are any TCP options or padding is present)
- id: reserved
type: b4
- id: flags
type: flags
- id: window_size
type: u2
- id: checksum
type: u2
- id: urgent_pointer
type: u2
- id: options
size: (data_offset * 4) - 20
if: ((data_offset * 4) - 20) != 0
- id: body
size-eos: true
types:
flags:
doc: |
TCP header flags as defined "TCP Header Flags" registry.
seq:
- id: cwr
type: b1
doc: Congestion Window Reduced
- id: ece
type: b1
doc: ECN-Echo
- id: urg
type: b1
doc: Urgent pointer field is significant
- id: ack
type: b1
doc: Acknowledgment field is significant
- id: psh
type: b1
doc: Push function
- id: rst
type: b1
doc: Reset the connection
- id: syn
type: b1
doc: Synchronize sequence numbers
- id: fin
type: b1
doc: No more data from sender
to-string: |
(cwr ? "|CWR" : "") +
(ece ? "|ECE" : "") +
(urg ? "|URG" : "") +
(ack ? "|ACK" : "") +
(psh ? "|PSH" : "") +
(rst ? "|RST" : "") +
(syn ? "|SYN" : "") +
(fin ? "|FIN" : "")

0 comments on commit 74901a0

Please sign in to comment.