Skip to content

Instantly share code, notes, and snippets.

@avsm
Created February 7, 2011 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avsm/814254 to your computer and use it in GitHub Desktop.
Save avsm/814254 to your computer and use it in GitHub Desktop.
module type FLOW = sig
(* Type of an individual flow *)
type t
(* Type that manages a collection of flows *)
type mgr
(* Type that identifies a flow source and destination endpoint *)
type src
type dst
(* Read and write to a flow *)
val read: t -> OS.Istring.View.t option Lwt.t
val write: t -> OS.Istring.View.t -> unit Lwt.t
val close: t -> unit Lwt.t
(* Flow construction *)
val listen: mgr -> src -> (dst -> t -> unit Lwt.t) -> unit Lwt.t
val connect: mgr -> src -> dst -> (t -> unit Lwt.t) -> unit Lwt.t
end
module TCPv4 : sig
type t
type mgr = Manager.t
type src = ipv4_addr option * int
type dst = ipv4_addr * int
val read : t -> OS.Istring.View.t option Lwt.t
val write : t -> OS.Istring.View.t -> unit Lwt.t
val close : t -> unit Lwt.t
val listen : mgr -> src -> (dst -> t -> unit Lwt.t) -> unit Lwt.t
val connect : mgr -> src -> dst -> (t -> unit Lwt.t) -> unit Lwt.t
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment