package tcpip

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Static_ipv4.MakeSource

Parameters

module E : Ethernet.S
module A : Arp.S

Signature

include Tcpip.Ip.S with type ipaddr = Ipaddr.V4.t and type prefix = Ipaddr.V4.Prefix.t
Sourcetype nonrec error = private [>
  1. | Tcpip.Ip.error
]

The type for IP errors.

Sourceval pp_error : error Fmt.t

pp_error is the pretty-printer for errors.

Sourcetype ipaddr = Ipaddr.V4.t

The type for IP addresses.

Sourceval pp_ipaddr : ipaddr Fmt.t

pp_ipaddr is the pretty-printer for IP addresses.

The type for the IP address and netmask.

Sourceval pp_prefix : prefix Fmt.t

pp_prefix is the pretty-printer for the prefix.

Sourcetype t

The type representing the internal state of the IP layer.

Sourceval disconnect : t -> unit Lwt.t

Disconnect from the IP layer. While this might take some time to complete, it can never result in an error.

Sourcetype callback = src:ipaddr -> dst:ipaddr -> Cstruct.t -> unit Lwt.t

An input continuation used by the parsing functions to pass on an input packet down the stack.

callback ~src ~dst buf will be called with src and dst containing the source and destination IP address respectively, and buf will be a buffer pointing at the start of the IP payload.

Sourceval input : t -> tcp:callback -> udp:callback -> default:(proto:int -> callback) -> Cstruct.t -> unit Lwt.t

input ~tcp ~udp ~default ip buf demultiplexes an incoming buffer that contains an IP frame. It examines the protocol header and passes the result onto either the tcp or udp function, or the default function for unknown IP protocols.

Sourceval write : t -> ?fragment:bool -> ?ttl:int -> ?src:ipaddr -> ipaddr -> Tcpip.Ip.proto -> ?size:int -> (Cstruct.t -> int) -> Cstruct.t list -> (unit, error) result Lwt.t

write t ~fragment ~ttl ~src dst proto ~size headerf payload allocates a buffer, writes the IP header, and calls the headerf function. This may write to the provided buffer of size (default 0). If size + ip header exceeds the maximum transfer unit, an error is returned. The payload is appended. The optional fragment argument defaults to true, in which case multiple IP-fragmented frames are sent if the payload is too big for a single frame. When it is false, the don't fragment bit is set and if the payload and header would exceed the maximum transfer unit, an error is returned.

Sourceval pseudoheader : t -> ?src:ipaddr -> ipaddr -> Tcpip.Ip.proto -> int -> Cstruct.t

pseudoheader t ~src dst proto len gives a pseudoheader suitable for use in TCP or UDP checksum calculation based on t.

Sourceval src : t -> dst:ipaddr -> ipaddr

src ip ~dst is the source address to be used to send a packet to dst. In the case of IPv4, this will always return the same IP, which is the only one set.

Sourceval get_ip : t -> ipaddr list

Get the IP addresses associated with this interface. For IPv4, only one IP address can be set at a time, so the list will always be of length 1 (and may be the default value, [10.0.0.2]).

  • deprecated this function will be removed soon, use [configured_ips] instead.
Sourceval configured_ips : t -> prefix list

Get the prefix associated with this interface. For IPv4, only one prefix can be set at a time, so the list will always be of length 1, e.g. [10.0.0.2/24].

Sourceval mtu : t -> dst:ipaddr -> int

mtu ~dst ip is the Maximum Transmission Unit of the ip i.e. the maximum size of the payload, not including the IP header.

Sourceval connect : ?no_init:bool -> cidr:Ipaddr.V4.Prefix.t -> ?gateway:Ipaddr.V4.t -> ?fragment_cache_size:int -> E.t -> A.t -> t Lwt.t

connect ~no_init ~cidr ~gateway ~fragment_cache_size eth arp connects the ipv4 device using cidr and gateway for network communication. The size of the IPv4 fragment cache (for reassembly) can be provided in byte-size of fragments (defaults to 256kB).

OCaml

Innovation. Community. Security.