Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Deprecated #21

Merged
merged 1 commit into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mirage-stack.opam
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ bug-reports: "https://github.com/mirage/mirage-stack/issues"
depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "1.0"}
"mirage-protocols" {>= "4.0.0"}
"fmt"
"lwt" {>= "4.0.0"}
"tcpip" {>= "7.0.0"}
]
build: [
["dune" "subst"] {dev}
Expand Down
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name mirage_stack)
(public_name mirage-stack)
(libraries mirage-protocols fmt lwt))
(libraries tcpip))
160 changes: 6 additions & 154 deletions src/mirage_stack.ml
Original file line number Diff line number Diff line change
@@ -1,156 +1,8 @@
module type V4 = sig
module type V4 = Tcpip.Stack.V4
[@@ocaml.deprecated "Please use 'Tcpip.Stack.V4' directly (and depend on tcpip >= 7.0.0)"]

type t
(** The type representing the internal state of the IPv4 stack. *)
module type V6 = Tcpip.Stack.V6
[@@ocaml.deprecated "Please use 'Tcpip.Stack.V6' directly (and depend on tcpip >= 7.0.0)"]

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: Mirage_protocols.UDPV4

module TCPV4: Mirage_protocols.TCPV4

module IPV4: Mirage_protocols.IPV4

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:Mirage_protocols.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: Mirage_protocols.UDPV6

module TCP: Mirage_protocols.TCPV6

module IP: Mirage_protocols.IPV6

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:Mirage_protocols.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: Mirage_protocols.UDP with type ipaddr = Ipaddr.t

module TCP: Mirage_protocols.TCP with type ipaddr = Ipaddr.t

module IP: Mirage_protocols.IP 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:Mirage_protocols.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
module type V4V6 = Tcpip.Stack.V4V6
[@@ocaml.deprecated "Please use 'Tcpip.Stack.V4V6' directly (and depend on tcpip >= 7.0.0)"]