The Standard ML Basis Library


The NetServDB structure


Synopsis

signature NET_SERV_DB  (* OPTIONAL *)
structure NetServDB :> NET_SERV_DB  (* OPTIONAL *)

This structure accesses the information contained in the network services data base. This data may be retrieved from the file /etc/services on many Unix systems, or from some other data base.


Interface

type entry
val name : entry -> string
val aliases : entry -> string list
val port : entry -> int
val protocol : entry -> string
val getByName : string * string option -> entry option
val getByPort : int * string option -> entry option

Description

type entry
The abstract type of a network service database entry.

name ent
returns the official name of the service described by entry ent (e.g., "ftp", "telnet", etc.).

aliases ent
returns the alias list of the service described by entry ent.

port ent
returns the port number of the service described by entry ent.

protocol ent
returns the name of the protocol to use for the service described by the entry ent (e.g., "tcp" or "udp").

getByName (s, prot)
reads the network service data base for a service with name s. If prot is SOME(protname), the protocol of the service must also match protname; if prot is NONE, no protocol restriction is imposed. If successful, it returns SOME(en) where en is the corresponding data base entry; otherwise, it returns NONE.

getByPort (i, prot)
reads the network service data base for a service with port number i. If prot is SOME(protname), the protocol of the service must also match protname; if prot is NONE, no protocol restriction is imposed. If successful, it returns SOME(en) where en the corresponding data base entry; otherwise, it returns NONE.

See Also

Socket, NetHostDB, NetProtDB

[ Top | Parent | Contents | Index | Root ]

Generated October 02, 2003
Last Modified June 5, 1998
Comments to John Reppy.


This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.

Copyright © 2003 AT&T and Lucent Technologies. All rights reserved.

Permission is granted for internet users to make one paper copy for their own personal use. Further hardcopy reproduction is strictly prohibited. Permission to distribute the HTML document electronically on any medium other than the internet must be requested from the copyright holders by contacting the editors. Printed versions of the SML Basis Manual are available from Cambridge University Press. To order, please visit www.cup.org (North America) or www.cup.cam.ac.uk (outside North America).