Print this page
11622 clean up rarer mandoc lint warnings
   1 '\" te
   2 .\" Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
   3 .\"  Copyright 1989 AT&T
   4 .\" Copyright (C) 2005, Sun Microsystems, Inc. All Rights Reserved
   5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   8 .TH NETDIR 3NSL "Feb 14, 2015"
   9 .SH NAME
  10 netdir, netdir_getbyname, netdir_getbyaddr, netdir_free, netdir_options,
  11 taddr2uaddr, uaddr2taddr, netdir_perror, netdir_sperror, netdir_mergeaddr \-
  12 generic transport name-to-address translation
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lnsl\fR [ \fIlibrary\fR...]
  17 #include <netdir.h>
  18 
  19 \fBint\fR \fBnetdir_getbyname\fR(\fBstruct netconfig  *\fR\fIconfig\fR,
  20      \fBstruct nd_hostserv *\fR\fIservice\fR, \fBstruct nd_addrlist **\fR\fIaddrs\fR);
  21 .fi
  22 
  23 .LP
  24 .nf
  25 \fBint\fR \fBnetdir_getbyaddr\fR(\fBstruct netconfig  *\fR\fIconfig\fR,
  26      \fBstruct nd_hostservlist **\fR\fIservice\fR, \fBstruct netbuf  *\fR\fInetaddr\fR);
  27 .fi
  28 
  29 .LP
  30 .nf
  31 \fBvoid\fR \fBnetdir_free\fR(\fBvoid *\fR\fIptr\fR, \fBint\fR \fIstruct_type\fR);
  32 .fi
  33 
  34 .LP


  41 .nf
  42 \fBchar *\fR\fBtaddr2uaddr\fR(\fBstruct netconfig *\fR\fIconfig\fR, \fBstruct netbuf *\fR\fIaddr\fR);
  43 .fi
  44 
  45 .LP
  46 .nf
  47 \fBstruct netbuf *\fR\fBuaddr2taddr\fR(\fBstruct netconfig *\fR\fIconfig\fR, \fBchar *\fR\fIuaddr\fR);
  48 .fi
  49 
  50 .LP
  51 .nf
  52 \fBvoid\fR \fBnetdir_perror\fR(\fBchar *\fR\fIs\fR);
  53 .fi
  54 
  55 .LP
  56 .nf
  57 \fBchar *\fR\fBnetdir_sperror\fR(\fBvoid\fR);
  58 .fi
  59 
  60 .SH DESCRIPTION
  61 .LP
  62 The \fBnetdir\fR functions provide a generic interface for name-to-address
  63 mapping that will work with all transport protocols. This interface provides a
  64 generic way for programs to convert transport specific addresses into common
  65 structures and back again. The \fBnetconfig\fR structure, described on the
  66 \fBnetconfig\fR(4) manual page, identifies the transport.
  67 .sp
  68 .LP
  69 The \fBnetdir_getbyname()\fR function maps the machine name and service name in
  70 the \fBnd_hostserv\fR structure to a collection of addresses of the type
  71 understood by the transport identified in the \fBnetconfig\fR structure. This
  72 function returns all addresses that are valid for that transport in the
  73 \fBnd_addrlist\fR structure. The \fBnd_hostserv\fR structure contains the
  74 following members:
  75 .sp
  76 .in +2
  77 .nf
  78 char *h_host;      /* host name */
  79 char *h_serv;      /* service name */
  80 .fi
  81 .in -2


 168 the name to address translation functions. The \fIptr\fR parameter points to
 169 the structure that has to be freed. The parameter \fBstruct_type\fR identifies
 170 the structure:
 171 .sp
 172 .in +2
 173 .nf
 174 struct netbuf            ND_ADDR
 175 struct nd_addrlist       ND_ADDRLIST
 176 struct hostserv          ND_HOSTSERV
 177 struct nd_hostservlist   ND_HOSTSERVLIST
 178 .fi
 179 .in -2
 180 
 181 .sp
 182 .LP
 183 The \fBnetdir_options()\fR function is used to do all transport-specific setups
 184 and option management. \fIfildes\fR is the associated file descriptor.
 185 \fIoption\fR, \fIfildes\fR, and \fIpointer_to_args\fR are passed to the
 186 \fBnetdir_options()\fR function for the transport specified in \fIconfig\fR.
 187 Currently four values are defined for \fIoption\fR:
 188 .br
 189 
 190 .in +2
 191 \fBND_SET_BROADCAST\fR
 192 .in -2
 193 .br
 194 .in +2
 195 \fBND_SET_RESERVEDPORT\fR
 196 .in -2
 197 .br
 198 .in +2
 199 \fBND_CHECK_RESERVEDPORT\fR
 200 .in -2
 201 .br
 202 .in +2
 203 \fBND_MERGEADDR\fR
 204 .sp
 205 .LP
 206 The specific actions of each option follow.
 207 .sp
 208 .ne 2


 286 .LP
 287 The \fBfree()\fR function is used to free the universal address returned by the
 288 \fBtaddr2uaddr()\fR function.
 289 .sp
 290 .LP
 291 The \fBuaddr2taddr()\fR function is the reverse of the \fBtaddr2uaddr()\fR
 292 function. It returns the \fBstruct netbuf\fR data structure for the given
 293 universal address and \fINULL\fR on failure.
 294 
 295 .sp
 296 .LP
 297 The \fBnetdir_perror()\fR function prints an error message in standard output
 298 that states the cause of a name-to-address mapping failure. The error message
 299 is preceded by the string given as an argument.
 300 .sp
 301 .LP
 302 The \fBnetdir_sperror()\fR function returns a string with an error message that
 303 states the cause of a name-to-address mapping failure.
 304 
 305 .SH RETURN VALUES
 306 .LP
 307 The \fBnetdir_sperror()\fR function returns a pointer to a buffer which
 308 contains the error message string. The buffer is overwritten on each call. In
 309 multithreaded applications, this buffer is implemented as thread-specific
 310 data.
 311 .sp
 312 .LP
 313 The \fBnetdir_getbyname()\fR, \fBnetdir_getbyaddr()\fR, and \fBnetdir_options()\fR
 314 functions return \fB0\fR on success and a non-zero value on failure.
 315 .SH ATTRIBUTES
 316 .LP
 317 See \fBattributes\fR(5) for descriptions of the following attributes:
 318 .sp
 319 
 320 .sp
 321 .TS
 322 box;
 323 c | c
 324 l | l .
 325 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 326 _
 327 MT-Level        Safe
 328 .TE
 329 
 330 .SH SEE ALSO
 331 .LP
 332 \fBgethostname\fR(3C), \fBgetnetconfig\fR(3NSL), \fBgetnetpath\fR(3NSL),
 333 \fBnetconfig\fR(4), \fBattributes\fR(5)
   1 '\" te
   2 .\" Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
   3 .\"  Copyright 1989 AT&T
   4 .\" Copyright (C) 2005, Sun Microsystems, Inc. All Rights Reserved
   5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   8 .TH NETDIR 3NSL "Feb 14, 2015"
   9 .SH NAME
  10 netdir, netdir_getbyname, netdir_getbyaddr, netdir_free, netdir_options,
  11 taddr2uaddr, uaddr2taddr, netdir_perror, netdir_sperror, netdir_mergeaddr \-
  12 generic transport name-to-address translation
  13 .SH SYNOPSIS

  14 .nf
  15 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lnsl\fR [ \fIlibrary\fR...]
  16 #include <netdir.h>
  17 
  18 \fBint\fR \fBnetdir_getbyname\fR(\fBstruct netconfig  *\fR\fIconfig\fR,
  19      \fBstruct nd_hostserv *\fR\fIservice\fR, \fBstruct nd_addrlist **\fR\fIaddrs\fR);
  20 .fi
  21 
  22 .LP
  23 .nf
  24 \fBint\fR \fBnetdir_getbyaddr\fR(\fBstruct netconfig  *\fR\fIconfig\fR,
  25      \fBstruct nd_hostservlist **\fR\fIservice\fR, \fBstruct netbuf  *\fR\fInetaddr\fR);
  26 .fi
  27 
  28 .LP
  29 .nf
  30 \fBvoid\fR \fBnetdir_free\fR(\fBvoid *\fR\fIptr\fR, \fBint\fR \fIstruct_type\fR);
  31 .fi
  32 
  33 .LP


  40 .nf
  41 \fBchar *\fR\fBtaddr2uaddr\fR(\fBstruct netconfig *\fR\fIconfig\fR, \fBstruct netbuf *\fR\fIaddr\fR);
  42 .fi
  43 
  44 .LP
  45 .nf
  46 \fBstruct netbuf *\fR\fBuaddr2taddr\fR(\fBstruct netconfig *\fR\fIconfig\fR, \fBchar *\fR\fIuaddr\fR);
  47 .fi
  48 
  49 .LP
  50 .nf
  51 \fBvoid\fR \fBnetdir_perror\fR(\fBchar *\fR\fIs\fR);
  52 .fi
  53 
  54 .LP
  55 .nf
  56 \fBchar *\fR\fBnetdir_sperror\fR(\fBvoid\fR);
  57 .fi
  58 
  59 .SH DESCRIPTION

  60 The \fBnetdir\fR functions provide a generic interface for name-to-address
  61 mapping that will work with all transport protocols. This interface provides a
  62 generic way for programs to convert transport specific addresses into common
  63 structures and back again. The \fBnetconfig\fR structure, described on the
  64 \fBnetconfig\fR(4) manual page, identifies the transport.
  65 .sp
  66 .LP
  67 The \fBnetdir_getbyname()\fR function maps the machine name and service name in
  68 the \fBnd_hostserv\fR structure to a collection of addresses of the type
  69 understood by the transport identified in the \fBnetconfig\fR structure. This
  70 function returns all addresses that are valid for that transport in the
  71 \fBnd_addrlist\fR structure. The \fBnd_hostserv\fR structure contains the
  72 following members:
  73 .sp
  74 .in +2
  75 .nf
  76 char *h_host;      /* host name */
  77 char *h_serv;      /* service name */
  78 .fi
  79 .in -2


 166 the name to address translation functions. The \fIptr\fR parameter points to
 167 the structure that has to be freed. The parameter \fBstruct_type\fR identifies
 168 the structure:
 169 .sp
 170 .in +2
 171 .nf
 172 struct netbuf            ND_ADDR
 173 struct nd_addrlist       ND_ADDRLIST
 174 struct hostserv          ND_HOSTSERV
 175 struct nd_hostservlist   ND_HOSTSERVLIST
 176 .fi
 177 .in -2
 178 
 179 .sp
 180 .LP
 181 The \fBnetdir_options()\fR function is used to do all transport-specific setups
 182 and option management. \fIfildes\fR is the associated file descriptor.
 183 \fIoption\fR, \fIfildes\fR, and \fIpointer_to_args\fR are passed to the
 184 \fBnetdir_options()\fR function for the transport specified in \fIconfig\fR.
 185 Currently four values are defined for \fIoption\fR:

 186 
 187 .in +2
 188 \fBND_SET_BROADCAST\fR
 189 .in -2
 190 .br
 191 .in +2
 192 \fBND_SET_RESERVEDPORT\fR
 193 .in -2
 194 .br
 195 .in +2
 196 \fBND_CHECK_RESERVEDPORT\fR
 197 .in -2
 198 .br
 199 .in +2
 200 \fBND_MERGEADDR\fR
 201 .sp
 202 .LP
 203 The specific actions of each option follow.
 204 .sp
 205 .ne 2


 283 .LP
 284 The \fBfree()\fR function is used to free the universal address returned by the
 285 \fBtaddr2uaddr()\fR function.
 286 .sp
 287 .LP
 288 The \fBuaddr2taddr()\fR function is the reverse of the \fBtaddr2uaddr()\fR
 289 function. It returns the \fBstruct netbuf\fR data structure for the given
 290 universal address and \fINULL\fR on failure.
 291 
 292 .sp
 293 .LP
 294 The \fBnetdir_perror()\fR function prints an error message in standard output
 295 that states the cause of a name-to-address mapping failure. The error message
 296 is preceded by the string given as an argument.
 297 .sp
 298 .LP
 299 The \fBnetdir_sperror()\fR function returns a string with an error message that
 300 states the cause of a name-to-address mapping failure.
 301 
 302 .SH RETURN VALUES

 303 The \fBnetdir_sperror()\fR function returns a pointer to a buffer which
 304 contains the error message string. The buffer is overwritten on each call. In
 305 multithreaded applications, this buffer is implemented as thread-specific
 306 data.
 307 .sp
 308 .LP
 309 The \fBnetdir_getbyname()\fR, \fBnetdir_getbyaddr()\fR, and \fBnetdir_options()\fR
 310 functions return \fB0\fR on success and a non-zero value on failure.
 311 .SH ATTRIBUTES

 312 See \fBattributes\fR(5) for descriptions of the following attributes:
 313 .sp
 314 
 315 .sp
 316 .TS
 317 box;
 318 c | c
 319 l | l .
 320 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 321 _
 322 MT-Level        Safe
 323 .TE
 324 
 325 .SH SEE ALSO

 326 \fBgethostname\fR(3C), \fBgetnetconfig\fR(3NSL), \fBgetnetpath\fR(3NSL),
 327 \fBnetconfig\fR(4), \fBattributes\fR(5)