1 /* 2 * CDDL HEADER START 3 * 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 7 * with the License. 8 * 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. 13 * 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] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1993-94, 1999, 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* 28 * nss_netdir.h 29 * 30 * Defines structures that are shared between the OSNET-private 31 * _get_hostserv_inetnetdir_byYY() interfaces and the public 32 * interfaces gethostbyYY()/getservbyYY() and netdir_getbyYY(). 33 * Ideally, this header file should never be visible to developers 34 * outside of the OSNET build. 35 */ 36 37 #ifndef _NSS_NETDIR_H 38 #define _NSS_NETDIR_H 39 40 #pragma ident "%Z%%M% %I% %E% SMI" 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 typedef enum { 47 NSS_HOST, 48 NSS_SERV, 49 NETDIR_BY, 50 NETDIR_BY_NOSRV, /* bypass service lookup */ 51 NETDIR_BY6, 52 NETDIR_BY_NOSRV6, /* bypass service lookup */ 53 NSS_HOST6 54 } nss_netdir_op_t; 55 56 struct nss_netdirbyname_in { 57 nss_netdir_op_t op_t; 58 union { 59 struct nd_hostserv *nd_hs; 60 union { 61 struct { 62 const char *name; 63 char *buf; 64 int buflen; 65 } host; 66 struct { 67 const char *name; 68 char *buf; 69 int buflen; 70 int af_family; /* for ipnode */ 71 int flags; /* for ipnode */ 72 } host6; 73 struct { 74 const char *name; 75 const char *proto; 76 char *buf; 77 int buflen; 78 } serv; 79 } nss; 80 } arg; 81 }; 82 83 union nss_netdirbyname_out { 84 struct nd_addrlist **nd_alist; 85 union { 86 struct { 87 struct hostent *hent; 88 int *herrno_p; 89 } host; 90 struct servent *serv; 91 } nss; 92 }; 93 94 struct nss_netdirbyaddr_in { 95 nss_netdir_op_t op_t; 96 union { 97 struct netbuf *nd_nbuf; 98 union { 99 struct { 100 const char *addr; 101 int len; 102 int type; 103 char *buf; 104 int buflen; 105 } host; 106 struct { 107 int port; 108 const char *proto; 109 char *buf; 110 int buflen; 111 } serv; 112 } nss; 113 } arg; 114 }; 115 116 union nss_netdirbyaddr_out { 117 struct nd_hostservlist **nd_hslist; 118 union { 119 struct { 120 struct hostent *hent; 121 int *herrno_p; 122 } host; 123 struct servent *serv; 124 } nss; 125 }; 126 127 #ifdef __STDC__ 128 129 int __classic_netdir_getbyname(struct netconfig *, 130 struct nd_hostserv *, struct nd_addrlist **); 131 int __classic_netdir_getbyaddr(struct netconfig *, 132 struct nd_hostservlist **, struct netbuf *); 133 int _get_hostserv_inetnetdir_byname(struct netconfig *, 134 struct nss_netdirbyname_in *, union nss_netdirbyname_out *); 135 int _get_hostserv_inetnetdir_byaddr(struct netconfig *, 136 struct nss_netdirbyaddr_in *, union nss_netdirbyaddr_out *); 137 int __inet_netdir_options(struct netconfig *, 138 int option, int fd, char *par); 139 struct netbuf *__inet_uaddr2taddr(struct netconfig *, char *); 140 char *__inet_taddr2uaddr(struct netconfig *, struct netbuf *); 141 142 #else 143 144 int __classic_netdir_getbyname(); 145 int __classic_netdir_getbyaddr(); 146 int _get_hostserv_inetnetdir_byname(); 147 int _get_hostserv_inetnetdir_byaddr(); 148 int __inet_netdir_options(); 149 struct netbuf *__inet_uaddr2taddr(); 150 char *__inet_taddr2uaddr(); 151 152 #endif /* __STDC__ */ 153 154 #ifdef __cplusplus 155 } 156 #endif 157 158 #endif /* _NSS_NETDIR_H */ 159