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/net-db.sml
ViewVC logotype

Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Sockets/net-db.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 17  Line 17 
17    
18      datatype net_addr = NETADDR of SysW.word      datatype net_addr = NETADDR of SysW.word
19    
20      type addr_family = PreSock.addr_family      type addr_family = Socket.AF.addr_family
21    
22      datatype entry = NETENT of {      datatype entry = NETENT of {
23          name : string,          name : string,
# Line 38  Line 38 
38    (* Network DB query functions *)    (* Network DB query functions *)
39      local      local
40        type netent        type netent
41          = (string * string list * PreSock.af * SysWord.word)          = (string * string list * Socket.af * SysWord.word)
42        fun getNetEnt NONE = NONE        fun getNetEnt NONE = NONE
43          | getNetEnt (SOME(name, aliases, addrType, addr)) = SOME(NETENT{          | getNetEnt (SOME(name, aliases, addrType, addr)) = SOME(NETENT{
44                name = name, aliases = aliases,                name = name, aliases = aliases,
45                addrType = PreSock.AF addrType, addr = NETADDR addr                addrType = Socket.AF.AF addrType, addr = NETADDR addr
46              })              })
47        val getNetByName' : string -> netent option        val getNetByName' : string -> netent option
48              = netdbFun "getNetByName"              = netdbFun "getNetByName"
49        val getNetByAddr' : (SysWord.word * PreSock.af) -> netent option        val getNetByAddr' : (SysWord.word * Socket.af) -> netent option
50              = netdbFun "getNetByAddr"              = netdbFun "getNetByAddr"
51      in      in
52      val getByName = getNetEnt o getNetByName'      val getByName = getNetEnt o getNetByName'
53      fun getByAddr (NETADDR addr, PreSock.AF af) =      fun getByAddr (NETADDR addr, Socket.AF.AF af) =
54            getNetEnt(getNetByAddr'(addr, af))            getNetEnt(getNetByAddr'(addr, af))
55      end (* local *)      end (* local *)
56    
57      fun scan getc strm = let      fun scan getc strm = let
58            val (op +) = SysW.+            val (op +) = SysW.+
59            in            in
60              case (PreSock.toWords getc strm)              case (Socket.toWords getc strm)
61               of SOME([a, b, c, d], strm) =>               of SOME([a, b, c, d], strm) =>
62                    SOME(                    SOME(
63                      NETADDR(SysW.<<(a, 0w24)+SysW.<<(b, 0w16)+SysW.<<(c, 0w8)+d),                      NETADDR(SysW.<<(a, 0w24)+SysW.<<(b, 0w16)+SysW.<<(c, 0w8)+d),
# Line 76  Line 76 
76      fun toString (NETADDR addr) = let      fun toString (NETADDR addr) = let
77            fun get n = Word8.fromLargeWord(SysW.toLargeWord((SysW.>>(addr, n))))            fun get n = Word8.fromLargeWord(SysW.toLargeWord((SysW.>>(addr, n))))
78            in            in
79              PreSock.fromBytes (get 0w24, get 0w16, get 0w8, get 0w0)              Socket.fromBytes (get 0w24, get 0w16, get 0w8, get 0w0)
80            end            end
81    
82    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