From e5069182d99165270c585b5424e97bcd225d9a13 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Tue, 1 Apr 2014 18:20:39 +0100 Subject: [PATCH] The socket version is just a skeleton that fails if most functions are used. These can eventually be filled in with the UNIX equivalents, but I'm deferring this work as it's hard to get it done quickly and portably, and noone needs this functionality in the socket backend at present. --- unix/ipv4_socket.ml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 unix/ipv4_socket.ml diff --git a/unix/ipv4_socket.ml b/unix/ipv4_socket.ml new file mode 100644 index 000000000..a66b605f1 --- /dev/null +++ b/unix/ipv4_socket.ml @@ -0,0 +1,43 @@ +(* + * Copyright (c) 2014 Anil Madhavapeddy + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + *) + +open Lwt + +type id = string +type ipv4 = unit +type t = unit +type +'a io = 'a Lwt.t +type error = [ `Unimplemented | `Unknown of string ] +type ipv4addr = Ipaddr.V4.t +type ethif = unit +type buffer = Cstruct.t +type callback = src:ipv4addr -> dst:ipv4addr -> buffer -> unit io + +let id _ = () +let disconnect () = return () +let connect () = return (`Ok ()) + +let input ~tcp ~udp ~default _ _ = return () +let allocate_frame ~proto ~dest_ip t = fail (Failure "Not implemented") +let write _ _ _ = fail (Failure "Not implemented") +let writev _ _ _ = fail (Failure "Not implemented") + +let get_ipv4 _ = Ipaddr.V4.of_string_exn "0.0.0.0" +let set_ipv4 _ _ = fail (Failure "Not implemented") +let get_ipv4_netmask _ = Ipaddr.V4.of_string_exn "255.255.255.0" +let get_ipv4_gateways _ = raise (Failure "Not implemented") +let set_ipv4_netmask _ _ = fail (Failure "Not implemented") +let set_ipv4_gateways _ _ = fail (Failure "Not implemented")