Skip to content

Commit

Permalink
Merge pull request #11 from avsm/master
Browse files Browse the repository at this point in the history
Updates for Mirage portability
  • Loading branch information
avsm committed Feb 21, 2014
2 parents 0e085bb + a16923b commit e9a7250
Show file tree
Hide file tree
Showing 35 changed files with 2,040 additions and 959 deletions.
7 changes: 7 additions & 0 deletions .merlin
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PKG lwt cstruct mirage-net mirage
S lib
S lib_test
S lwt
B _build/lib
B _build/lib_test
B _build/lwt
2 changes: 1 addition & 1 deletion .travis-ci.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OPAM_DEPENDS="lwt cstruct ipaddr re ounit mirage-net async cmdliner"
OPAM_DEPENDS="lwt cstruct ipaddr re ounit cmdliner"

case "$OCAML_VERSION,$OPAM_VERSION" in
3.12.1,1.0.0) ppa=avsm/ocaml312+opam10 ;;
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: c
script: bash -ex .travis-ci.sh
env:
- OCAML_VERSION=4.01.0 OPAM_VERSION=1.0.0
- OCAML_VERSION=4.01.0 OPAM_VERSION=1.1.0
- OCAML_VERSION=4.00.1 OPAM_VERSION=1.0.0
- OCAML_VERSION=4.00.1 OPAM_VERSION=1.1.0
11 changes: 10 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
0.7.1 (trunk):
0.8.0 (trunk):
* Use `Ipaddr.V6` to restore IPv6/AAAA RR support.
* `process_query` now takes an output buffer so it doesn't have to
overwrite the input buffer it just parsed.
* Add Travis continuous integration scripts.
* Regenerate with OASIS 0.4.1
* Split the `dns.lwt` into a portable `dns.lwt-core` that doesn't
require Unix (from which a Mirage version can be built). The only
change to existing applications is that Unix-specific functions
have shifted into `Dns_resolver_unix` or `Dns_server_unix`, with
the module types for `PROCESSOR` and `CLIENT` unchanged.

0.7.0 (2013-08-26):
* Add path argument to `Resolv_conf in Dns_resolver.config.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ than low-level performance hacks.

To build it, the following packages are required:

* OCaml 3.12.0 or higher.
* OCaml 4.00.1 or higher.
* Lwt 2.3.2 or higher: http://ocsigen.org/lwt/
* Cstruct: http://github.com/mirage/ocaml-cstruct
* Re: http://github.com/mirage/ocaml-re
Expand Down
34 changes: 12 additions & 22 deletions _oasis
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OASISFormat: 0.3
OCamlVersion: >= 4.00.0
Name: dns
Version: 0.7.1
Version: 0.8.0
Authors: Anil Madhavapeddy, Tim Deegan, Richard Mortier, Haris Rotsos, David Sheets, Thomas Gazagnaire
Maintainers: Anil Madhavapeddy <[email protected]>
License: ISC
Expand All @@ -17,14 +17,6 @@ Flag lwt
Description: build the Lwt library
Default: false

Flag async
Description: build the Core/Async library
Default: false

Flag mirage
Description: build the Mirage library
Default: false

Flag nettests
Description: run the internet-using tests
Default: false
Expand All @@ -36,26 +28,24 @@ Library dns
Modules:
Base64, Hashcons, Loader, Name, Operators, Packet, Query, RR, Trie,
Zone, Zone_lexer, Zone_parser, Resolvconf, Buf, Protocol
BuildDepends: cstruct (>= 0.7.1), cstruct.syntax, re, re.str,
ipaddr (>= 0.2.2)
BuildDepends: cstruct (>= 0.7.1), cstruct.syntax, re, re.str, ipaddr (>= 2.2.0)

Library lwt
Path: lwt
Build$: flag(lwt)
Install$: flag(lwt)
Findlibname: lwt
Modules: Dns_server, Dns_resolver
BuildDepends:
lwt.unix (>= 2.4.1), lwt.syntax, dns
Modules: Dns_server_unix, Dns_resolver_unix
BuildDepends: lwt.unix (>= 2.4.1), cstruct.lwt, lwt.syntax, dns, dns.lwt-core, ipaddr.unix
FindlibParent: dns

Library mirage
Path: mirage
Build$: flag(mirage)
Install$: flag(mirage)
Findlibname: mirage
Modules: Dns_server
BuildDepends: mirage, mirage-net (>= 0.9.4), cstruct, cstruct.syntax, dns
Library "lwt-core"
Path: lwt
Build$: flag(lwt)
Install$: flag(lwt)
Findlibname: lwt-core
Modules: Dns_server, Dns_resolver
BuildDepends: lwt, cstruct, lwt.syntax, dns
FindlibParent: dns

Document dns
Expand Down Expand Up @@ -100,7 +90,7 @@ Executable mldig
Custom: true
CompiledObject: best
Install: false
BuildDepends: lwt, lwt.unix, lwt.syntax, dns, re, re.str, ipaddr, cmdliner
BuildDepends: lwt, lwt.unix, lwt.syntax, dns, dns.lwt, re, re.str, ipaddr, cmdliner

Test lwt_server
Run$: flag(tests) && flag(lwt)
Expand Down
131 changes: 70 additions & 61 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# OASIS_START
# DO NOT EDIT (digest: c803411911cbf0397826cf3612ce7c98)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# DO NOT EDIT (digest: b46ef21097bddd75899af6867db104a7)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
<**/.svn>: -traverse
<**/.svn>: not_hygienic
Expand Down Expand Up @@ -30,81 +30,90 @@
"lib/resolvconf.cmx": for-pack(Dns)
"lib/buf.cmx": for-pack(Dns)
"lib/protocol.cmx": for-pack(Dns)
<lib/*.ml{,i}>: pkg_re
<lib/*.ml{,i}>: pkg_re.str
<lib/*.ml{,i}>: pkg_ipaddr
<lib/*.ml{,i}>: pkg_cstruct
<lib/*.ml{,i}>: pkg_cstruct.syntax
<lib/*.ml{,i}>: package(re)
<lib/*.ml{,i}>: package(re.str)
<lib/*.ml{,i}>: package(ipaddr)
<lib/*.ml{,i}>: package(cstruct)
<lib/*.ml{,i}>: package(cstruct.syntax)
# Library lwt-core
"lwt/lwt-core.cmxs": use_lwt-core
# Library lwt
"lwt/lwt.cmxs": use_lwt
# Library mirage
"mirage/mirage.cmxs": use_mirage
<mirage/*.ml{,i}>: use_dns
<mirage/*.ml{,i}>: pkg_re
<mirage/*.ml{,i}>: pkg_re.str
<mirage/*.ml{,i}>: pkg_ipaddr
<mirage/*.ml{,i}>: pkg_mirage
<mirage/*.ml{,i}>: pkg_mirage-net
<mirage/*.ml{,i}>: pkg_cstruct
<mirage/*.ml{,i}>: pkg_cstruct.syntax
# Executable lwt_server
<lib_test/lwt_server.{native,byte}>: use_lwt
<lib_test/lwt_server.{native,byte}>: use_lwt-core
<lib_test/lwt_server.{native,byte}>: use_dns
<lib_test/lwt_server.{native,byte}>: pkg_lwt
<lib_test/lwt_server.{native,byte}>: pkg_lwt.unix
<lib_test/lwt_server.{native,byte}>: pkg_lwt.syntax
<lib_test/lwt_server.{native,byte}>: pkg_re
<lib_test/lwt_server.{native,byte}>: pkg_re.str
<lib_test/lwt_server.{native,byte}>: pkg_ipaddr
<lib_test/lwt_server.{native,byte}>: pkg_cstruct
<lib_test/lwt_server.{native,byte}>: pkg_cstruct.syntax
<lib_test/lwt_server.{native,byte}>: package(lwt)
<lib_test/lwt_server.{native,byte}>: package(lwt.unix)
<lib_test/lwt_server.{native,byte}>: package(lwt.syntax)
<lib_test/lwt_server.{native,byte}>: package(re)
<lib_test/lwt_server.{native,byte}>: package(re.str)
<lib_test/lwt_server.{native,byte}>: package(ipaddr)
<lib_test/lwt_server.{native,byte}>: package(cstruct.lwt)
<lib_test/lwt_server.{native,byte}>: package(ipaddr.unix)
<lib_test/lwt_server.{native,byte}>: package(cstruct)
<lib_test/lwt_server.{native,byte}>: package(cstruct.syntax)
<lib_test/lwt_server.{native,byte}>: custom
# Executable time_server
<lib_test/time_server.{native,byte}>: use_lwt
<lib_test/time_server.{native,byte}>: use_lwt-core
<lib_test/time_server.{native,byte}>: use_dns
<lib_test/time_server.{native,byte}>: pkg_lwt
<lib_test/time_server.{native,byte}>: pkg_lwt.unix
<lib_test/time_server.{native,byte}>: pkg_lwt.syntax
<lib_test/time_server.{native,byte}>: pkg_re
<lib_test/time_server.{native,byte}>: pkg_re.str
<lib_test/time_server.{native,byte}>: pkg_ipaddr
<lib_test/time_server.{native,byte}>: pkg_cstruct
<lib_test/time_server.{native,byte}>: pkg_cstruct.syntax
<lib_test/time_server.{native,byte}>: package(lwt)
<lib_test/time_server.{native,byte}>: package(lwt.unix)
<lib_test/time_server.{native,byte}>: package(lwt.syntax)
<lib_test/time_server.{native,byte}>: package(re)
<lib_test/time_server.{native,byte}>: package(re.str)
<lib_test/time_server.{native,byte}>: package(ipaddr)
<lib_test/time_server.{native,byte}>: package(cstruct.lwt)
<lib_test/time_server.{native,byte}>: package(ipaddr.unix)
<lib_test/time_server.{native,byte}>: package(cstruct)
<lib_test/time_server.{native,byte}>: package(cstruct.syntax)
<lib_test/*.ml{,i}>: use_lwt
<lib_test/*.ml{,i}>: use_lwt-core
<lib_test/*.ml{,i}>: use_dns
<lib_test/*.ml{,i}>: pkg_lwt
<lib_test/*.ml{,i}>: pkg_lwt.unix
<lib_test/*.ml{,i}>: pkg_lwt.syntax
<lib_test/*.ml{,i}>: pkg_re
<lib_test/*.ml{,i}>: pkg_re.str
<lib_test/*.ml{,i}>: pkg_ipaddr
<lib_test/*.ml{,i}>: pkg_cstruct
<lib_test/*.ml{,i}>: pkg_cstruct.syntax
<lib_test/*.ml{,i}>: package(lwt)
<lib_test/*.ml{,i}>: package(lwt.unix)
<lib_test/*.ml{,i}>: package(lwt.syntax)
<lib_test/*.ml{,i}>: package(re)
<lib_test/*.ml{,i}>: package(re.str)
<lib_test/*.ml{,i}>: package(ipaddr)
<lib_test/*.ml{,i}>: package(cstruct.lwt)
<lib_test/*.ml{,i}>: package(ipaddr.unix)
<lib_test/*.ml{,i}>: package(cstruct)
<lib_test/*.ml{,i}>: package(cstruct.syntax)
<lib_test/time_server.{native,byte}>: custom
# Executable mldig
<lwt/mldig.{native,byte}>: use_lwt
<lwt/mldig.{native,byte}>: use_lwt-core
<lwt/mldig.{native,byte}>: use_dns
<lwt/mldig.{native,byte}>: pkg_lwt
<lwt/mldig.{native,byte}>: pkg_lwt.unix
<lwt/mldig.{native,byte}>: pkg_lwt.syntax
<lwt/mldig.{native,byte}>: pkg_re
<lwt/mldig.{native,byte}>: pkg_re.str
<lwt/mldig.{native,byte}>: pkg_ipaddr
<lwt/mldig.{native,byte}>: pkg_cmdliner
<lwt/mldig.{native,byte}>: pkg_cstruct
<lwt/mldig.{native,byte}>: pkg_cstruct.syntax
<lwt/mldig.{native,byte}>: package(lwt)
<lwt/mldig.{native,byte}>: package(lwt.unix)
<lwt/mldig.{native,byte}>: package(lwt.syntax)
<lwt/mldig.{native,byte}>: package(re)
<lwt/mldig.{native,byte}>: package(re.str)
<lwt/mldig.{native,byte}>: package(ipaddr)
<lwt/mldig.{native,byte}>: package(cmdliner)
<lwt/mldig.{native,byte}>: package(cstruct.lwt)
<lwt/mldig.{native,byte}>: package(ipaddr.unix)
<lwt/mldig.{native,byte}>: package(cstruct)
<lwt/mldig.{native,byte}>: package(cstruct.syntax)
<lwt/*.ml{,i}>: use_lwt
<lwt/*.ml{,i}>: use_lwt-core
<lwt/*.ml{,i}>: use_dns
<lwt/*.ml{,i}>: pkg_lwt
<lwt/*.ml{,i}>: pkg_lwt.unix
<lwt/*.ml{,i}>: pkg_lwt.syntax
<lwt/*.ml{,i}>: pkg_re
<lwt/*.ml{,i}>: pkg_re.str
<lwt/*.ml{,i}>: pkg_ipaddr
<lwt/*.ml{,i}>: pkg_cmdliner
<lwt/*.ml{,i}>: pkg_cstruct
<lwt/*.ml{,i}>: pkg_cstruct.syntax
<lwt/*.ml{,i}>: package(lwt)
<lwt/*.ml{,i}>: package(lwt.unix)
<lwt/*.ml{,i}>: package(lwt.syntax)
<lwt/*.ml{,i}>: package(re)
<lwt/*.ml{,i}>: package(re.str)
<lwt/*.ml{,i}>: package(ipaddr)
<lwt/*.ml{,i}>: package(cmdliner)
<lwt/*.ml{,i}>: package(cstruct.lwt)
<lwt/*.ml{,i}>: package(ipaddr.unix)
<lwt/*.ml{,i}>: package(cstruct)
<lwt/*.ml{,i}>: package(cstruct.syntax)
<lwt/mldig.{native,byte}>: custom
# OASIS_STOP
true: annot
true: annot, bin_annot
<lib/*>: syntax_camlp4o, pkg_lwt.syntax
<lwt/*>: syntax_camlp4o, pkg_lwt.syntax
<mirage/*>: syntax_camlp4o, pkg_lwt.syntax
Expand Down
24 changes: 12 additions & 12 deletions lib/META
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# OASIS_START
# DO NOT EDIT (digest: fa7cda67d0e6410c6a4bcecec00e858c)
version = "0.7.1"
# DO NOT EDIT (digest: 85565c0ecd22b743afa123d3a0ed14d4)
version = "0.8.0"
description = "DNS client and server implementation"
requires = "cstruct cstruct.syntax re re.str ipaddr"
archive(byte) = "dns.cma"
archive(byte, plugin) = "dns.cma"
archive(native) = "dns.cmxa"
archive(native, plugin) = "dns.cmxs"
exists_if = "dns.cma"
package "mirage" (
version = "0.7.1"
package "lwt-core" (
version = "0.8.0"
description = "DNS client and server implementation"
requires = "mirage mirage-net cstruct cstruct.syntax dns"
archive(byte) = "mirage.cma"
archive(byte, plugin) = "mirage.cma"
archive(native) = "mirage.cmxa"
archive(native, plugin) = "mirage.cmxs"
exists_if = "mirage.cma"
requires = "lwt cstruct lwt.syntax dns"
archive(byte) = "lwt-core.cma"
archive(byte, plugin) = "lwt-core.cma"
archive(native) = "lwt-core.cmxa"
archive(native, plugin) = "lwt-core.cmxs"
exists_if = "lwt-core.cma"
)

package "lwt" (
version = "0.7.1"
version = "0.8.0"
description = "DNS client and server implementation"
requires = "lwt.unix lwt.syntax dns"
requires = "lwt.unix cstruct.lwt lwt.syntax dns dns.lwt-core ipaddr.unix"
archive(byte) = "lwt.cma"
archive(byte, plugin) = "lwt.cma"
archive(native) = "lwt.cmxa"
Expand Down
2 changes: 1 addition & 1 deletion lib/RR.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ and rrsig = {

and rdata =
| A of Ipaddr.V4.t list (* always length = 1 *)
| AAAA of cstr list
| AAAA of Ipaddr.V6.t list (* always length = 1 *)
| AFSDB of (Cstruct.uint16 * dnsnode) list
| CNAME of dnsnode list
| HINFO of (cstr * cstr) list
Expand Down
2 changes: 1 addition & 1 deletion lib/RR.mli
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ and rrsig = {
*)
and rdata =
| A of Ipaddr.V4.t list
| AAAA of cstr list
| AAAA of Ipaddr.V6.t list
| AFSDB of (uint16 * dnsnode) list
| CNAME of dnsnode list
| HINFO of (cstr * cstr) list
Expand Down
4 changes: 4 additions & 0 deletions lib/dns.mllib
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OASIS_START
# DO NOT EDIT (digest: 4d3cc87f77cb704db96a7dc499206433)
Dns
# OASIS_STOP
7 changes: 3 additions & 4 deletions lib/loader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ let add_generic_rr tcode str ttl owner db =
let add_a_rr ip ttl owner db =
add_rrset { ttl; rdata = A [ ip ] } owner db

let add_aaaa_rr ip ttl owner db =
add_rrset { ttl; rdata = AAAA [ ip ] } owner db

let add_ns_rr target ttl owner db =
try
let targetnode = get_target_dnsnode target db in
Expand Down Expand Up @@ -258,10 +261,6 @@ let add_rt_rr pref target ttl owner db =
let targetnode = get_target_dnsnode target db in
add_rrset { ttl; rdata = RT [ (pref, targetnode) ] } owner db

let add_aaaa_rr str ttl owner db =
let s = hashcons_charstring str in
add_rrset { ttl; rdata = AAAA [ s ] } owner db

let add_srv_rr pri weight port target ttl owner db =
let pri = pri in
let weight = weight in
Expand Down
2 changes: 1 addition & 1 deletion lib/loader.mli
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ val no_more_updates : db -> unit

val add_generic_rr : int -> string -> int32 -> domain_name -> db -> unit
val add_a_rr : Ipaddr.V4.t -> int32 -> domain_name -> db -> unit
val add_aaaa_rr : Ipaddr.V6.t -> int32 -> domain_name -> db -> unit
val add_ns_rr : domain_name -> int32 -> domain_name -> db -> unit
val add_cname_rr : domain_name -> int32 -> domain_name -> db -> unit
val add_soa_rr :
Expand All @@ -62,7 +63,6 @@ val add_x25_rr : string -> int32 -> domain_name -> db -> unit
val add_isdn_rr :
string -> string option -> int32 -> domain_name -> db -> unit
val add_rt_rr : int -> domain_name -> int32 -> domain_name -> db -> unit
val add_aaaa_rr : string -> int32 -> domain_name -> db -> unit
val add_srv_rr :
int -> int -> int -> domain_name -> int32 -> domain_name -> db -> unit
(* val add_unspec_rr : string -> int32 -> domain_name -> db -> unit *)
Expand Down
Loading

0 comments on commit e9a7250

Please sign in to comment.