1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00
freebsd/lib/libc/rpc/getnetconfig.3
Alfred Perlstein 8360efbd6c Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.

  Bring in required TLI library routines to support this.

  Since we don't support TLI we've essentially copied what NetBSD
  has done, adding a thin layer to emulate direct the TLI calls
  into BSD socket calls.

  This is mostly from Sun's tirpc release that was made in 1994,
  however some fixes were backported from the 1999 release (supposedly
  only made available after this porting effort was underway).

  The submitter has agreed to continue on and bring us up to the
  1999 release.

  Several key features are introduced with this update:
    Client calls are thread safe. (1999 code has server side thread
    safe)
    Updated, a more modern interface.

  Many userland updates were done to bring the code up to par with
  the recent RPC API.

  There is an update to the pthreads library, a function
  pthread_main_np() was added to emulate a function of Sun's threads
  library.

  While we're at it, bring in NetBSD's lockd, it's been far too
  long of a wait.

  New rpcbind(8) replaces portmap(8) (supporting communication over
  an authenticated Unix-domain socket, and by default only allowing
  set and unset requests over that channel). It's much more secure
  than the old portmapper.

  Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
  to support TI-RPC and to support IPV6.

  Umount(8) is also fixed to unmount pathnames longer than 80 chars,
  which are currently truncated by the Kernel statfs structure.

Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00

183 lines
3.9 KiB
Groff

.\" @(#)getnetconfig.3n 1.28 93/06/02 SMI; from SVr4
.\" $NetBSD: getnetconfig.3,v 1.1 2000/06/02 23:11:11 fvdl Exp $
.\" $FreeBSD$
.\" Copyright 1989 AT&T
.Dd April 22, 2000
.Dt GETNETCONFIG 3
.Os
.Sh NAME
.Nm getnetconfig ,
.Nm setnetconfig ,
.Nm endnetconfig ,
.Nm getnetconfigent ,
.Nm freenetconfigent ,
.Nm nc_perror ,
.Nm nc_sperror
.Nd get network configuration database entry
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.Fd #include <netconfig.h>
.Ft "struct netconfig *"
.Fn getnetconfig "void *handlep"
.Ft "void *"
.Fn setnetconfig "void"
.Ft int
.Fn endnetconfig "void *handlep"
.Ft "struct netconfig *"
.Fn getnetconfigent "const char *netid"
.Ft void
.Fn freenetconfigent "struct netconfig *netconfigp"
.Ft void
.Fn nc_perror "const char *msg"
.Ft "char *"
.Fn nc_sperror "void"
.Sh DESCRIPTION
The library routines described on this page
provide the application access to
the system network configuration database,
.Pa /etc/netconfig .
.Fn getnetconfig
returns a pointer to the
current entry in the
netconfig
database, formatted as a
.Ft "struct netconfig" .
Successive calls will return successive netconfig
entries in the netconfig database.
.Fn getnetconfig
can be used to search the entire netconfig
file.
.Fn getnetconfig
returns
.Dv NULL
at the end of the file.
.Fa handlep
is the handle obtained through
.Fn setnetconfig .
.Pp
A call to
.Fn setnetconfig
has the effect of
.Dq binding
to or
.Dq rewinding
the netconfig database.
.Fn setnetconfig
must be called before the first call to
.Fn getnetconfig
and may be called at any other time.
.Fn setnetconfig
need not be called before a call to
.Fn getnetconfigent .
.Fn setnetconfig
returns a unique handle to be used by
.Fn getnetconfig .
.Pp
.Fn endnetconfig
should be called when processing is complete to release resources for reuse.
.Fa handlep
is the handle obtained through
.Fn setnetconfig .
Programmers should be aware, however, that the last call to
.Fn endnetconfig
frees all memory allocated by
.Fn getnetconfig
for the
.Ft "struct netconfig"
data structure.
.Fn endnetconfig
may not be called before
.Fn setnetconfig .
.Pp
.Fn getnetconfigent
returns a pointer
to the netconfig structure corresponding
to
.Fa netid .
It returns
.Dv NULL
if
.Fa netid
is invalid
(that is, does not name an entry in the netconfig database).
.Pp
.Fn freenetconfigent
frees the netconfig structure pointed to by
.Fa netconfigp
(previously returned by
.Fn getnetconfigent ) .
.Pp
.Fn nc_perror
prints a message to the standard error indicating why any of the
above routines failed.
The message is prepended with the string
.Fa msg
and a colon.
A newline character is appended at the end of the message.
.Pp
.Fn nc_sperror
is similar to
.Fn nc_perror
but instead of sending the message
to the standard error, will return a pointer to a string that
contains the error message.
.Pp
.Fn nc_perror
and
.Fn nc_sperror
can also be used with the
.Ev NETPATH
access routines defined in
.Xr getnetpath 3 .
.Sh RETURN VALUES
.Fn setnetconfig
returns a unique handle to be used by
.Fn getnetconfig .
In the case of an error,
.Fn setnetconfig
returns
.Dv NULL
and
.Fn nc_perror
or
.Fn nc_sperror
can be used to print the reason for failure.
.Pp
.Fn getnetconfig
returns a pointer to the current entry in the netconfig
database, formatted as a
.Ft "struct netconfig" .
.Fn getnetconfig
returns
.Dv NULL
at the end of the file, or upon failure.
.Pp
.Fn endnetconfig
returns 0 on success and \-1 on failure
(for example, if
.Fn setnetconfig
was not called previously).
.Pp
On success,
.Fn getnetconfigent
returns a pointer to the
.Ft "struct netconfig"
structure corresponding to
.Fa netid ;
otherwise it returns
.Dv NULL .
.Pp
.Fn nc_sperror
returns a pointer to a buffer which contains the error message string.
This buffer is overwritten on each call.
In multithreaded applications, this buffer is
implemented as thread-specific data.
.Sh FILES
.Bl -tag -width /etc/netconfig -compact
.It Pa /etc/netconfig
.El
.Sh SEE ALSO
.Xr getnetpath 3 ,
.Xr netconfig 5