Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Sockets/inet-sock.sml
ViewVC logotype

Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Sockets/inet-sock.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1470, Mon Mar 29 22:45:55 2004 UTC revision 1471, Mon Mar 29 22:45:55 2004 UTC
# Line 3  Line 3 
3   * COPYRIGHT (c) 1995 AT&T Bell Laboratories.   * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4   *   *
5   *)   *)
   
 local  
     structure Socket = SocketImp  
 in  
6  structure INetSock : INET_SOCK =  structure INetSock : INET_SOCK =
7    struct    struct
8      structure SOCK = Socket.SOCK      structure SOCK = SocketImp.SOCK
9    
10      fun sockFn x = CInterface.c_function "SMLNJ-Sockets" x      fun sockFn x = CInterface.c_function "SMLNJ-Sockets" x
11    
12      datatype inet = INET      datatype inet = INET
13    
14      type 'a sock = (inet, 'a) Socket.sock      type 'a sock = (inet, 'a) Socket.sock
15      type 'a stream_sock = 'a Socket.stream sock      type 'a stream_sock = 'a SocketImp.stream sock
16      type dgram_sock = Socket.dgram sock      type dgram_sock = SocketImp.dgram sock
17    
18      type sock_addr = inet Socket.sock_addr      type sock_addr = inet Socket.sock_addr
19    
20      val inetAF = Option.valOf(Socket.AF.fromString "INET")      val inetAF = Option.valOf(SocketImp.AF.fromString "INET")
21    
22      local      local
23        val toInetAddr : (PreSock.addr * int) -> PreSock.addr = sockFn "toInetAddr"        val toInetAddr : (Socket.addr * int) -> Socket.addr = sockFn "toInetAddr"
24        val fromInetAddr : PreSock.addr -> (PreSock.addr * int) = sockFn "fromInetAddr"        val fromInetAddr : Socket.addr -> (Socket.addr * int) = sockFn "fromInetAddr"
25        val inetAny  : int -> PreSock.addr = sockFn "inetany"        val inetAny  : int -> Socket.addr = sockFn "inetany"
26      in      in
27      fun toAddr (PreSock.INADDR a, port) = PreSock.ADDR(toInetAddr(a, port))      fun toAddr (ina, port) =
28      fun fromAddr (PreSock.ADDR addr) = let          Socket.ADDR(toInetAddr(NetHostDBInternal.unINADDR ina, port))
29        fun fromAddr (Socket.ADDR addr) = let
30            val (a, port) = fromInetAddr addr            val (a, port) = fromInetAddr addr
31            in            in
32              (PreSock.INADDR a, port)              (NetHostDBInternal.INADDR a, port)
33            end            end
34      fun any port = PreSock.ADDR(inetAny port)      fun any port = Socket.ADDR(inetAny port)
35      end      end
36    
37      structure UDP =      structure UDP =
# Line 51  Line 48 
48          local          local
49            val ctlDELAY : (int * bool option) -> bool = sockFn "ctlNODELAY"            val ctlDELAY : (int * bool option) -> bool = sockFn "ctlNODELAY"
50          in          in
51          fun getNODELAY (PreSock.SOCK fd) = ctlDELAY(fd, NONE)          fun getNODELAY (Socket.SOCK { fd, ... }) =
52          fun setNODELAY (PreSock.SOCK fd, flg) = ignore(ctlDELAY(fd, SOME flg))              ctlDELAY(fd, NONE)
53            fun setNODELAY (Socket.SOCK { fd, ... }, flg) =
54                ignore(ctlDELAY(fd, SOME flg))
55          end (* local *)          end (* local *)
56        end        end
57    end    end
 end  
   

Legend:
Removed from v.1470  
changed lines
  Added in v.1471

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0