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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 250 - (download) (annotate)
Sat Apr 17 18:57:03 1999 UTC (21 years, 4 months ago) by monnier
File size: 1024 byte(s)
This commit was generated by cvs2svn to compensate for changes in r249,
which included commits to RCS files with non-trunk default branches.
(* prot-db.sml
 *
 * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
 *
 *)

structure NetProtDB : NET_PROT_DB =
  struct

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

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

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

  (* Protocol DB query functions *)
    local
      type protoent = (string * string list * int)
      fun getProtEnt NONE = NONE
	| getProtEnt (SOME(name, aliases, protocol)) = SOME(PROTOENT{
	      name = name, aliases = aliases, protocol = protocol
	    })
      val getProtByName' : string -> protoent option = netdbFun "getProtByName"
      val getProtByNumber' : int -> protoent option = netdbFun "getProtByNum"
    in
    val getByName = getProtEnt o getProtByName'
    val getByNumber = getProtEnt o getProtByNumber'
    end (* local *)

  end

(*
 * $Log$
 *)

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