package tcpip

All checked builds pass
  1. Overview
  2. Docs
OCaml TCP/IP networking stack, used in MirageOS

Install

dune-project
 Dependency

Authors

Maintainers

Sources

tcpip-9.0.2.tbz
sha256=6ed788e5eb5a5735e674d3c9690996162f28a7665f9b69e509c383bd0afb70c7
sha512=e02b4986b4170ed06c6206459ef34042b919201545a5ed50047808c32190ade7b0902c928e0608e59ed5e9e5bcdf673752f69f190852122fcfd1b10ab549bda8

doc/src/tcpip/ip.ml.html

Source file ip.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
type error = [
  | `No_route of string (** can't send a message to that destination *)
  | `Would_fragment
]
let pp_error ppf = function
  | `No_route s -> Fmt.pf ppf "no route to destination: %s" s
  | `Would_fragment -> Fmt.string ppf "would fragment"

type proto = [ `TCP | `UDP | `ICMP ]
let pp_proto ppf = function
  | `TCP -> Fmt.string ppf "TCP"
  | `UDP -> Fmt.string ppf "UDP"
  | `ICMP -> Fmt.string ppf "ICMP"

module type S = sig
  type nonrec error = private [> error]
  val pp_error: error Fmt.t
  type ipaddr
  val pp_ipaddr : ipaddr Fmt.t
  type prefix
  val pp_prefix : prefix Fmt.t
  type t
  val disconnect : t -> unit Lwt.t
  type callback = src:ipaddr -> dst:ipaddr -> Cstruct.t -> unit Lwt.t
  val input:
    t ->
    tcp:callback -> udp:callback -> default:(proto:int -> callback) ->
    Cstruct.t -> unit Lwt.t
  val write: t -> ?fragment:bool -> ?ttl:int ->
    ?src:ipaddr -> ipaddr -> proto -> ?size:int -> (Cstruct.t -> int) ->
    Cstruct.t list -> (unit, error) result Lwt.t
  val pseudoheader : t -> ?src:ipaddr -> ipaddr -> proto -> int -> Cstruct.t
  val src: t -> dst:ipaddr -> ipaddr
  val get_ip: t -> ipaddr list
  [@@ocaml.deprecated "this function will be removed soon, use [configured_ips] instead."]
  val configured_ips: t -> prefix list
  val mtu: t -> dst:ipaddr -> int
end