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

SCM Repository

[smlnj] View of /sml/trunk/src/compiler/PervEnv/Sockets/serv-db.sml
ViewVC logotype

View of /sml/trunk/src/compiler/PervEnv/Sockets/serv-db.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 94 - (download) (annotate)
Tue May 12 21:56:22 1998 UTC (22 years, 4 months ago) by monnier
File size: 1224 byte(s)
This commit was generated by cvs2svn to compensate for changes in r93,
which included commits to RCS files with non-trunk default branches.
(* serv-db.sml
 *
 * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
 *
 *)

structure NetServDB : NET_SERV_DB =
  struct

    fun netdbFun x = CInterface.c_function "SMLNJ-Sockets" x

    datatype entry = SERVENT of {
	  name : string,
	  aliases : string list,
	  port : int,
	  protocol : string
	}

    local
      fun conc field (SERVENT a) = field a
    in
    val name = conc #name
    val aliases = conc #aliases
    val port = conc #port
    val protocol = conc #protocol
    end (* local *)

  (* Server DB query functions *)
    local
      type servent = (string * string list * int * string)
      fun getServEnt NONE = NONE
	| getServEnt (SOME(name, aliases, port, protocol)) = SOME(SERVENT{
	      name = name, aliases = aliases, port = port, protocol = protocol
	    })
      val getServerByName' : (string  * string option) -> servent option
	    = netdbFun "getServByName"
      val getServerByPort' : (int  * string option) -> servent option
	    = netdbFun "getServByPort"
    in
    val getByName = getServEnt o getServerByName'
    val getByPort = getServEnt o getServerByPort'
    end (* local *)

  end

(*
 * $Log: serv-db.sml,v $
 * Revision 1.1.1.1  1998/04/08 18:39:57  george
 * Version 110.5
 *
 *)

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