package tcpip

  1. Overview
  2. Docs
val src : Logs.src
module Log : Logs.LOG
type ipaddr = Ipaddr.t
type callback = src:ipaddr -> dst:ipaddr -> src_port:int -> Cstruct.t -> unit Lwt.t
val any_v6 : Unix.inet_addr
type t = {
  1. interface : [ `Any | `Ip of Unix.inet_addr * Unix.inet_addr | `V4_only of Unix.inet_addr | `V6_only of Unix.inet_addr ];
  2. listen_fds : (int, Lwt_unix.file_descr * Lwt_unix.file_descr option) Stdlib.Hashtbl.t;
  3. mutable switched_off : unit Lwt.t;
}
val set_switched_off : t -> unit Lwt.t -> unit
val ignore_canceled : exn -> unit Lwt.t
val get_udpv4v6_listening_fd : ?preserve:bool -> ?v4_or_v6:[< `Both | `V4 | `V6 Both ] -> t -> int -> (bool * Lwt_unix.file_descr list) Lwt.t
type error = [
  1. | `Sendto_failed
  2. | `Different_ip_version
]
val pp_error : Stdlib.Format.formatter -> [< `Different_ip_version | `Sendto_failed ] -> unit
val close : Lwt_unix.file_descr -> unit Lwt.t
val connect : ipv4_only:bool -> ipv6_only:bool -> Ipaddr.V4.Prefix.t -> Ipaddr.V6.Prefix.t option -> t Lwt.t
val disconnect : t -> unit Lwt.t
val input : 'a -> src:'b -> dst:'c -> 'd -> unit Lwt.t
val write : ?src:'a -> ?src_port:int -> ?ttl:'b -> dst:Ipaddr.t -> dst_port:int -> t -> Cstruct.t -> (unit, [> `Different_ip_version | `Sendto_failed ]) Stdlib.result Lwt.t
val unlisten : t -> port:int -> unit
val listen : t -> port:int -> (src:Ipaddr.t -> dst:('a, Ipaddr.V6.t) Ipaddr.v4v6 -> src_port:int -> Cstruct.t -> unit Lwt.t) -> unit