package mnet

  1. Overview
  2. Docs
An implementation of TCP (Transmission Control Protocol) in OCaml for Miou & Solo5

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mnet-0.0.1.tbz
sha256=c3151b243150c7b7412bf27b08107bed0e132f0a271d5f5b34bc0fdffed8ec3e
sha512=4a70d77ed42519a547f7b13e76ccfa05192514ca84e9dc9dcb97a5d141a8cc4551a669017a48290d70f01790a83fbeba53950a2d5f975e8e51e7daf3017d6b5e

doc/mnet.ipv4/IPv4/Packet/index.html

Module IPv4.PacketSource

Sourcetype partial =
  1. | Partial
    (*

    Marker type for a packet whose checksum and length have not yet been computed (used during encoding).

    *)
Sourcetype complete = {
  1. checksum : int;
  2. length : int;
}

A fully decoded packet header with verified checksum and total length.

Sourcetype error = [
  1. | `Invalid_IPv4_packet
  2. | `Invalid_checksum
]

Decoding errors.

  • `Invalid_IPv4_packet: the buffer is too short or contains invalid header fields.
  • `Invalid_checksum: the IPv4 header checksum does not match.
Sourcetype 'a packet = {
  1. src : Ipaddr.V4.t;
  2. dst : Ipaddr.V4.t;
  3. uid : int;
  4. flags : Flag.t list;
  5. off : int;
  6. ttl : int;
  7. protocol : int;
  8. checksum_and_length : 'a;
  9. opt : Slice_bstr.t;
}

An IPv4 packet header parameterized by its checksum state ('a is either partial or complete).

  • uid: the IP identification field, used for fragment reassembly.
  • off: the fragment offset (in 8-byte units).
  • ttl: Time-To-Live.
  • protocol: the upper-layer protocol number (6 = TCP, 17 = UDP, 1 = ICMP).
  • opt: IP options (usually empty).

decode slice decodes an IPv4 packet header from slice and returns the header along with a sub-slice pointing to the payload.