package tcpip

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

Source file stack.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
module type V4 = sig

  type t
  (** The type representing the internal state of the IPv4 stack. *)

  val disconnect: t -> unit Lwt.t
  (** Disconnect from the IPv4 stack. While this might take some time to
      complete, it can never result in an error. *)

  module UDPV4: Udp.S with type ipaddr = Ipaddr.V4.t

  module TCPV4: Tcp.S with type ipaddr = Ipaddr.V4.t

  module IPV4: Ip.S with type ipaddr = Ipaddr.V4.t

  val udpv4: t -> UDPV4.t
  (** [udpv4 t] obtains a descriptor for use with the [UDPV4] module,
      usually to transmit traffic. *)

  val tcpv4: t -> TCPV4.t
  (** [tcpv4 t] obtains a descriptor for use with the [TCPV4] module,
      usually to initiate outgoing connections. *)

  val ipv4: t -> IPV4.t
  (** [ipv4 t] obtains a descriptor for use with the [IPV4] module,
      which can handle raw IPv4 frames, or manipulate IP address
      configuration on the stack interface. *)

  val listen_udpv4: t -> port:int -> UDPV4.callback -> unit
  [@@ocaml.deprecated "use UDPV4.listen instead (since mirage-protocols 6.0.0)."]
  (** [listen_udpv4 t ~port cb] registers the [cb] callback on the
      UDPv4 [port] and immediately return.  If [port] is invalid (not
      between 0 and 65535 inclusive), it raises [Invalid_argument].
      Multiple bindings to the same port will overwrite previous
      bindings, so callbacks will not chain if ports clash. *)

  val listen_tcpv4: ?keepalive:Tcp.Keepalive.t
    -> t -> port:int -> (TCPV4.flow -> unit Lwt.t) -> unit
  [@@ocaml.deprecated "use TCPV4.listen instead (since mirage-protocols 6.0.0)."]
  (** [listen_tcpv4 ~keepalive t ~port cb] registers the [cb] callback
      on the TCPv4 [port] and immediately return.  If [port] is invalid (not
      between 0 and 65535 inclusive), it raises [Invalid_argument].
      Multiple bindings to the same port will overwrite previous
      bindings, so callbacks will not chain if ports clash.
      If [~keepalive] is provided then these keepalive settings will be
      applied to the accepted connections before the callback is called. *)

  val listen: t -> unit Lwt.t
  (** [listen t] requests that the stack listen for traffic on the
      network interface associated with the stack, and demultiplex
      traffic to the appropriate callbacks. *)
end

module type V6 = sig
  type t
  (** The type representing the internal state of the IPv6 stack. *)

  val disconnect: t -> unit Lwt.t
  (** Disconnect from the IPv6 stack. While this might take some time to
      complete, it can never result in an error. *)

  module UDP: Udp.S with type ipaddr = Ipaddr.V6.t

  module TCP: Tcp.S with type ipaddr = Ipaddr.V6.t

  module IP: Ip.S with type ipaddr = Ipaddr.V6.t

  val udp: t -> UDP.t
  (** [udp t] obtains a descriptor for use with the [UDPV6] module,
      usually to transmit traffic. *)

  val tcp: t -> TCP.t
  (** [tcp t] obtains a descriptor for use with the [TCPV6] module,
      usually to initiate outgoing connections. *)

  val ip: t -> IP.t
  (** [ip t] obtains a descriptor for use with the [IPV6] module,
      which can handle raw IPv6 frames, or manipulate IP address
      configuration on the stack interface. *)

  val listen_udp: t -> port:int -> UDP.callback -> unit
  [@@ocaml.deprecated "use UDP.listen instead (since mirage-protocols 6.0.0)."]
  (** [listen_udp t ~port cb] registers the [cb] callback on the
      UDPv6 [port] and immediately return.  If [port] is invalid (not
      between 0 and 65535 inclusive), it raises [Invalid_argument].
      Multiple bindings to the same port will overwrite previous
      bindings, so callbacks will not chain if ports clash. *)

  val listen_tcp: ?keepalive:Tcp.Keepalive.t
    -> t -> port:int -> (TCP.flow -> unit Lwt.t) -> unit
  [@@ocaml.deprecated "use TCP.listen instead (since mirage-protocols 6.0.0)."]
  (** [listen_tcp ~keepalive t ~port cb] registers the [cb] callback
      on the TCPv6 [port] and immediately return.  If [port] is invalid (not
      between 0 and 65535 inclusive), it raises [Invalid_argument].
      Multiple bindings to the same port will overwrite previous
      bindings, so callbacks will not chain if ports clash.
      If [~keepalive] is provided then these keepalive settings will be
      applied to the accepted connections before the callback is called. *)

  val listen: t -> unit Lwt.t
  (** [listen t] requests that the stack listen for traffic on the
      network interface associated with the stack, and demultiplex
      traffic to the appropriate callbacks. *)
end

module type V4V6 = sig
  type t
  (** The type representing the internal state of the dual IPv4 and IPv6 stack. *)

  val disconnect: t -> unit Lwt.t
  (** Disconnect from the dual IPv4 and IPv6 stack. While this might take some
      time to complete, it can never result in an error. *)

  module UDP: Udp.S with type ipaddr = Ipaddr.t

  module TCP: Tcp.S with type ipaddr = Ipaddr.t

  module IP: Ip.S with type ipaddr = Ipaddr.t

  val udp: t -> UDP.t
  (** [udp t] obtains a descriptor for use with the [UDP] module,
      usually to transmit traffic. *)

  val tcp: t -> TCP.t
  (** [tcp t] obtains a descriptor for use with the [TCP] module,
      usually to initiate outgoing connections. *)

  val ip: t -> IP.t
  (** [ip t] obtains a descriptor for use with the [IP] module,
      which can handle raw IPv4 and IPv6 frames, or manipulate IP address
      configuration on the stack interface. *)

  val listen_udp: t -> port:int -> UDP.callback -> unit
  [@@ocaml.deprecated "use UDP.listen instead (since mirage-protocols 6.0.0)."]
  (** [listen_udp t ~port cb] registers the [cb] callback on the
      UDP [port] and immediately return.  If [port] is invalid (not
      between 0 and 65535 inclusive), it raises [Invalid_argument].
      Multiple bindings to the same port will overwrite previous
      bindings, so callbacks will not chain if ports clash. *)

  val listen_tcp: ?keepalive:Tcp.Keepalive.t
    -> t -> port:int -> (TCP.flow -> unit Lwt.t) -> unit
  [@@ocaml.deprecated "use TCP.listen instead (since mirage-protocols 6.0.0)."]
  (** [listen_tcp ~keepalive t ~port cb] registers the [cb] callback
      on the TCP [port] and immediately return.  If [port] is invalid (not
      between 0 and 65535 inclusive), it raises [Invalid_argument].
      Multiple bindings to the same port will overwrite previous
      bindings, so callbacks will not chain if ports clash.
      If [~keepalive] is provided then these keepalive settings will be
      applied to the accepted connections before the callback is called. *)

  val listen: t -> unit Lwt.t
  (** [listen t] requests that the stack listen for traffic on the
      network interface associated with the stack, and demultiplex
      traffic to the appropriate callbacks. *)
end