Utcp.SegmentThe module of TCP segments, as seen on the wire.
The variant type of supported TCP options
type t = {src_port : int;dst_port : int;seq : Sequence.t;ack : Sequence.t option;flag : [ `Syn | `Fin | `Rst ] option;push : bool;window : int;options : tcp_option list;payload : string list;payload_len : int;}The record type of the TCP segment
equal s1 s2 is true if s1 and s2 are equal (comparing all fields of the record).
val decode_and_validate :
src:Ipaddr.t ->
dst:Ipaddr.t ->
Cstruct.t ->
(t * flow, [ `Msg of string ]) resultdecode_and_validate ~src ~dst data decodes data and validates its checksum. Some further checks are done: broadcast and multicast packets error, also packets to and from the same endpoint (equal IP address and equal port). If the result is Ok, it is a segment and the flow.
val length : t -> intlength seg computes the length in bytes of s.
encode_and_checksum now ~src ~dst seg encodes the segment seg into a buffer, and computes its checksum. The value now is only used for logging.
encode_and_checksum_into now buf ~src ~dst seg encodes the segment seg into the buffer buf, and computes its checksum. The value now is only used for logging.
checksum ~src ~dst buf computes the checksum of buf.