From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA12846; Thu, 23 Aug 2001 00:49:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA12904 for ; Thu, 23 Aug 2001 00:49:19 +0200 (MET DST) Received: from smtpout.mac.com (smtpout.mac.com [204.179.120.88]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7MMnHf01628 for ; Thu, 23 Aug 2001 00:49:18 +0200 (MET DST) Received: by smtpout.mac.com; Wed, 22 Aug 2001 15:45:13 -0700 (PDT) Message-Id: <200108222245.PAA05409@smtpout.mac.com> Received: from asmtp02.mac.com ([10.13.10.66]) by smtp-relay02.mac.com (Netscape Messaging Server 4.15 relay02 Jun 21 2001 23:53:48) with ESMTP id GIHR7B00.PWL for ; Wed, 22 Aug 2001 15:45:11 -0700 Received: from localhost ([17.206.25.144]) by asmtp02.mac.com (Netscape Messaging Server 4.15 asmtp02 Jun 21 2001 23:53:48) with ESMTP id GIHR7A00.OF5 for ; Wed, 22 Aug 2001 15:45:10 -0700 Date: Wed, 22 Aug 2001 15:45:10 -0700 Reply-To: jhw@wetware.com Content-Type: text/plain; format=flowed; charset=us-ascii X-Mailer: Apple Mail (2.388) From: j h woodyatt To: caml-list@inria.fr Mime-Version: 1.0 (Apple Message framework v388) Content-Transfer-Encoding: 7bit Subject: [Caml-list] Unix.socket_option in ocaml-3.0.2 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk everyone-- I noticed that the Unix library module in 3.0.2 has an improved interface for socket options. I am grateful for the ability to set options that are not boolean values, but there are other options that are still out of reach for me. Specifically, the IP_MULTICAST_XXXX options, which want IP address values. I know you could just add more setsockopt_foo and getsockopt_foo functions, but I want to propose an alternative interface. Please consider something like the following as a possible addition to unix.mli (and the appropriate implementation in unix.ml): ---- BEGIN EXCERPT type socket_option_level and socket_option_name module type SocketOption_sig = sig type t val level: socket_option_level val name: socket_option_name end module type SocketOption_t = sig type t val set: fd:file_descr -> t -> unit val get: file_descr -> t end module SocketOption(S: SocketOption_sig) : SocketOption_t with type t = S.t module SO_DEBUG: SocketOption_t with type t = bool module SO_BROADCAST: SocketOption_t with type t = bool module SO_REUSEADDR: SocketOption_t with type t = bool module SO_KEEPALIVE: SocketOption_t with type t = bool module SO_DONTROUTE: SocketOption_t with type t = bool module SO_OOBINLINE: SocketOption_t with type t = bool module SO_ACCEPTCONN: SocketOption_t with type t = bool module SO_SNDBUF: SocketOption_t with type t = int module SO_RCVBUF: SocketOption_t with type t = int module SO_ERROR: SocketOption_t with type t = int module SO_TYPE: SocketOption_t with type t = int module SO_RCVLOWAT: SocketOption_t with type t = int module SO_SNDLOWAT: SocketOption_t with type t = int module SO_LINGER: SocketOption_t with type t = int option module SO_RCVTIMEO: SocketOption_t with type t = float module SO_SNDTIMEO: SocketOption_t with type t = float type ip_mreq = inet_addr * inet_addr module IP_ADD_MEMBERSHIP: SocketOption_t with type t = ip_mreq module IP_DROP_MEMBERSHIP: SocketOption_t with type t = ip_mreq module IP_MULTICAST_IF: SocketOption_t with type t = inet_addr module IP_MULTICAST_TTL: SocketOption_t with type t = int module IP_MULTICAST_LOOP: SocketOption_t with type t = bool module TCP_NODELAY: SocketOption_t with type t = bool ----- END EXCERPT Comments? (I know. Some of these options are more commonly available than others. I'm specifically interested in calling attention to the functorial interface I'm proposing.) I'm curious to know what are the tradeoffs associated with doing it this way. I can see how the nested modules are fairly easily done, but the functorial might be harder, but still possible (maybe with more members in the input signature, I don't know yet). Any ideas on how space and time performance would be affected? -- j h woodyatt "You're standing on sacred ground. Many strange and wonderful things have transpired right where you're standing." --unattributable ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr