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/pre-sock.sml
ViewVC logotype

Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Sockets/pre-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 1  Line 1 
1  (* pre-sock.sml  (* pre-soc.ksml
2   *   *
3   * COPYRIGHT (c) 1995 AT&T Bell Laboratories.   * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4   *   *
# Line 6  Line 6 
6   * structure is called Sock, so that the signatures will compile.   * structure is called Sock, so that the signatures will compile.
7   *   *
8   *)   *)
   
9  local  local
10      structure SysWord = SysWordImp      structure SysWord = SysWordImp
11      structure Word8 = Word8Imp      structure Word8 = Word8Imp
12      structure Word = WordImp      structure Word = WordImp
13  in  in
14  structure PreSock =  structure Socket = struct
   struct  
15    
16    (* the raw representation address data *)    (* the raw representation address data *)
17      type addr = Word8Vector.vector      type addr = Word8Vector.vector
# Line 21  Line 19 
19    (* the raw representation of an address family *)    (* the raw representation of an address family *)
20      type af = CInterface.system_const      type af = CInterface.system_const
21    
22    (* the raw representation of a socket (a file descriptor for now) *)    (* the raw representation of a socket:
23      type socket = int     *   a file descriptor for now and a mutable flag indicating
24       *   (with a value of true) if the socket is currently set
25       *   to non-blocking *)
26        type sockFD = int
27        type socket = { fd: sockFD, nb: bool ref }
28    
29    (* an internet address; this is here because it is abstract in the    (* sockets are polymorphic; the instantiation of the type variables
30     * NetHostDB and IP structures.     * provides a way to distinguish between different kinds of sockets.
31     *)     *)
32      datatype in_addr = INADDR of addr      datatype ('sock, 'af) sock = SOCK of socket
33        datatype 'af sock_addr = ADDR of addr
34    
35    (* an address family *)    (* witness types for the socket parameter *)
36        datatype dgram = DGRAM
37        datatype 'a stream = STREAM
38        datatype passive = PASSIVE
39        datatype active = ACTIVE
40    
41        structure AF = struct
42      datatype addr_family = AF of af      datatype addr_family = AF of af
43        end
44    
45        structure SOCK = struct
46    (* socket types *)    (* socket types *)
47      datatype sock_type = SOCKTY of CInterface.system_const      datatype sock_type = SOCKTY of CInterface.system_const
48        end
49    
50    (* sockets are polymorphic; the instantiation of the type variables      datatype shutdown_mode = NO_RECVS | NO_SENDS | NO_RECVS_OR_SENDS
51     * provides a way to distinguish between different kinds of sockets.      type sock_desc = OS.IO.iodesc
52     *)  
53      datatype ('sock, 'af) sock = SOCK of socket    (* Sock I/O option types *)
54      datatype 'af sock_addr = ADDR of addr      type out_flags = {don't_route : bool, oob : bool}
55        type in_flags = {peek : bool, oob : bool}
56    
57    (** Utility functions for parsing/unparsing network addresses **)    (** Utility functions for parsing/unparsing network addresses **)
58      local      local
# Line 101  Line 114 
114    
115    end (* PreSock *)    end (* PreSock *)
116  end  end
   
 (* We alias this structure to Socket so that the signature files will compile.  
  * We also need to keep the PreSock structure visible, so that structures  
  * compiled after the real Sock structure still have access to the representation  
  * types.  
  *)  
 structure Socket = PreSock;  
   
   

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