4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright (c) 2016 by Delphix. All rights reserved.
26 /* Copyright (c) 1992 Sun Microsystems, Inc. */
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
33 * This is the include file that defines various structures and
34 * constants used by the netdir routines.
41 * This files uses struct netconfig, and netconfig.h must be included
42 * before this to avoid warnings.
45 #include <netconfig.h>
52 int n_cnt
; /* number of netbufs */
53 struct netbuf
*n_addrs
; /* the netbufs */
56 struct nd_hostservlist
{
57 int h_cnt
; /* number of nd_hostservs */
58 struct nd_hostserv
*h_hostservs
; /* the entries */
62 char *h_host
; /* the host name */
63 char *h_serv
; /* the service name */
67 char *s_uaddr
; /* servers universal address */
68 char *c_uaddr
; /* clients universal address */
69 char *m_uaddr
; /* merged universal address */
73 * _nderror is a private variable to the netdir system.
75 extern int *__nderror();
76 #define _nderror (*(__nderror()))
79 int netdir_options(struct netconfig
*, int option
, int fd
, char *par
);
80 int netdir_getbyname(struct netconfig
*, struct nd_hostserv
*,
81 struct nd_addrlist
**);
82 int netdir_getbyaddr(struct netconfig
*, struct nd_hostservlist
**,
84 int __netdir_getbyaddr_nosrv(struct netconfig
*, struct nd_hostservlist
**,
86 int netdir_mergeaddr(struct netconfig
*, char **muaddr
, char *uaddr
,
88 void netdir_free(void *, int);
89 struct netbuf
*uaddr2taddr(struct netconfig
*, char *);
90 char *taddr2uaddr(struct netconfig
*, struct netbuf
*);
91 void netdir_perror(char *);
92 char *netdir_sperror();
93 struct nd_addrlist
*_netdir_getbyname(struct netconfig
*, struct nd_hostserv
*);
94 struct nd_hostservlist
*_netdir_getbyaddr(struct netconfig
*, struct netbuf
*);
95 struct netbuf
*_uaddr2taddr(struct netconfig
*, char *);
96 char *_taddr2uaddr(struct netconfig
*, struct netbuf
*);
97 char *_netdir_mergeaddr(struct netconfig
*, char *uaddr
, char *ruaddr
);
100 * These are all objects that can be freed by netdir_free
102 #define ND_HOSTSERV 0
103 #define ND_HOSTSERVLIST 1
105 #define ND_ADDRLIST 3
108 * These are the various errors that can be encountered while attempting
109 * to translate names to addresses. Note that none of them (except maybe
110 * no memory) are truely fatal unless the ntoa deamon is on its last attempt
111 * to translate the name. First four errors are to failitate return values
112 * from DNS, that are used by mail and others.
114 * Negative errors terminate the search resolution process, positive errors
115 * are treated as warnings.
118 #define ND_TRY_AGAIN -5 /* Non-Authoritive Host not found, or */
120 #define ND_NO_RECOVERY -4 /* Non recoverable errors, FORMERR, REFUSED, */
122 #define ND_NO_DATA -3 /* Valid name, no data record of requested */
124 #define ND_NO_ADDRESS ND_NO_DATA /* no address, look for MX record */
125 #define ND_BADARG -2 /* Bad arguments passed */
126 #define ND_NOMEM -1 /* No virtual memory left */
127 #define ND_OK 0 /* Translation successful */
128 #define ND_NOHOST 1 /* Hostname was not resolvable */
129 #define ND_NOSERV 2 /* Service was unknown */
130 #define ND_NOSYM 3 /* Couldn't resolve symbol */
131 #define ND_OPEN 4 /* File couldn't be opened */
132 #define ND_ACCESS 5 /* File is not accessable */
133 #define ND_UKNWN 6 /* Unknown object to be freed */
134 #define ND_NOCTRL 7 /* Unknown option passed to netdir_options */
135 #define ND_FAILCTRL 8 /* Option failed in netdir_options */
136 #define ND_SYSTEM 9 /* Other System error */
139 * The following netdir_options commands can be given to the fd. These is
140 * a way of providing for any transport specific action which the caller
141 * may want to initiate on its transport. It is up to the trasport provider
142 * to support the netdir_options it wants to support.
145 #define ND_SET_BROADCAST 1 /* Do t_optmgmt to support broadcast */
146 #define ND_SET_RESERVEDPORT 2 /* bind it to reserve address */
147 #define ND_CHECK_RESERVEDPORT 3 /* check if address is reserved */
148 #define ND_MERGEADDR 4 /* Merge universal address */
151 * The following special case host names are used to give the underlying
152 * transport provides a clue as to the intent of the request.
155 #define HOST_SELF "\\1"
156 #define HOST_ANY "\\2"
157 #define HOST_BROADCAST "\\3"
158 #define HOST_SELF_BIND HOST_SELF
159 #define HOST_SELF_CONNECT "\\4"
165 #endif /* _NETDIR_H */