1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 1993-94, 1999, 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* 28*7c478bd9Sstevel@tonic-gate * nss_netdir.h 29*7c478bd9Sstevel@tonic-gate * 30*7c478bd9Sstevel@tonic-gate * Defines structures that are shared between the OSNET-private 31*7c478bd9Sstevel@tonic-gate * _get_hostserv_inetnetdir_byYY() interfaces and the public 32*7c478bd9Sstevel@tonic-gate * interfaces gethostbyYY()/getservbyYY() and netdir_getbyYY(). 33*7c478bd9Sstevel@tonic-gate * Ideally, this header file should never be visible to developers 34*7c478bd9Sstevel@tonic-gate * outside of the OSNET build. 35*7c478bd9Sstevel@tonic-gate */ 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #ifndef _NSS_NETDIR_H 38*7c478bd9Sstevel@tonic-gate #define _NSS_NETDIR_H 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 43*7c478bd9Sstevel@tonic-gate extern "C" { 44*7c478bd9Sstevel@tonic-gate #endif 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate typedef enum { 47*7c478bd9Sstevel@tonic-gate NSS_HOST, 48*7c478bd9Sstevel@tonic-gate NSS_SERV, 49*7c478bd9Sstevel@tonic-gate NETDIR_BY, 50*7c478bd9Sstevel@tonic-gate NETDIR_BY_NOSRV, /* bypass service lookup */ 51*7c478bd9Sstevel@tonic-gate NETDIR_BY6, 52*7c478bd9Sstevel@tonic-gate NETDIR_BY_NOSRV6, /* bypass service lookup */ 53*7c478bd9Sstevel@tonic-gate NSS_HOST6 54*7c478bd9Sstevel@tonic-gate } nss_netdir_op_t; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate struct nss_netdirbyname_in { 57*7c478bd9Sstevel@tonic-gate nss_netdir_op_t op_t; 58*7c478bd9Sstevel@tonic-gate union { 59*7c478bd9Sstevel@tonic-gate struct nd_hostserv *nd_hs; 60*7c478bd9Sstevel@tonic-gate union { 61*7c478bd9Sstevel@tonic-gate struct { 62*7c478bd9Sstevel@tonic-gate const char *name; 63*7c478bd9Sstevel@tonic-gate char *buf; 64*7c478bd9Sstevel@tonic-gate int buflen; 65*7c478bd9Sstevel@tonic-gate } host; 66*7c478bd9Sstevel@tonic-gate struct { 67*7c478bd9Sstevel@tonic-gate const char *name; 68*7c478bd9Sstevel@tonic-gate char *buf; 69*7c478bd9Sstevel@tonic-gate int buflen; 70*7c478bd9Sstevel@tonic-gate int af_family; /* for ipnode */ 71*7c478bd9Sstevel@tonic-gate int flags; /* for ipnode */ 72*7c478bd9Sstevel@tonic-gate } host6; 73*7c478bd9Sstevel@tonic-gate struct { 74*7c478bd9Sstevel@tonic-gate const char *name; 75*7c478bd9Sstevel@tonic-gate const char *proto; 76*7c478bd9Sstevel@tonic-gate char *buf; 77*7c478bd9Sstevel@tonic-gate int buflen; 78*7c478bd9Sstevel@tonic-gate } serv; 79*7c478bd9Sstevel@tonic-gate } nss; 80*7c478bd9Sstevel@tonic-gate } arg; 81*7c478bd9Sstevel@tonic-gate }; 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate union nss_netdirbyname_out { 84*7c478bd9Sstevel@tonic-gate struct nd_addrlist **nd_alist; 85*7c478bd9Sstevel@tonic-gate union { 86*7c478bd9Sstevel@tonic-gate struct { 87*7c478bd9Sstevel@tonic-gate struct hostent *hent; 88*7c478bd9Sstevel@tonic-gate int *herrno_p; 89*7c478bd9Sstevel@tonic-gate } host; 90*7c478bd9Sstevel@tonic-gate struct servent *serv; 91*7c478bd9Sstevel@tonic-gate } nss; 92*7c478bd9Sstevel@tonic-gate }; 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate struct nss_netdirbyaddr_in { 95*7c478bd9Sstevel@tonic-gate nss_netdir_op_t op_t; 96*7c478bd9Sstevel@tonic-gate union { 97*7c478bd9Sstevel@tonic-gate struct netbuf *nd_nbuf; 98*7c478bd9Sstevel@tonic-gate union { 99*7c478bd9Sstevel@tonic-gate struct { 100*7c478bd9Sstevel@tonic-gate const char *addr; 101*7c478bd9Sstevel@tonic-gate int len; 102*7c478bd9Sstevel@tonic-gate int type; 103*7c478bd9Sstevel@tonic-gate char *buf; 104*7c478bd9Sstevel@tonic-gate int buflen; 105*7c478bd9Sstevel@tonic-gate } host; 106*7c478bd9Sstevel@tonic-gate struct { 107*7c478bd9Sstevel@tonic-gate int port; 108*7c478bd9Sstevel@tonic-gate const char *proto; 109*7c478bd9Sstevel@tonic-gate char *buf; 110*7c478bd9Sstevel@tonic-gate int buflen; 111*7c478bd9Sstevel@tonic-gate } serv; 112*7c478bd9Sstevel@tonic-gate } nss; 113*7c478bd9Sstevel@tonic-gate } arg; 114*7c478bd9Sstevel@tonic-gate }; 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate union nss_netdirbyaddr_out { 117*7c478bd9Sstevel@tonic-gate struct nd_hostservlist **nd_hslist; 118*7c478bd9Sstevel@tonic-gate union { 119*7c478bd9Sstevel@tonic-gate struct { 120*7c478bd9Sstevel@tonic-gate struct hostent *hent; 121*7c478bd9Sstevel@tonic-gate int *herrno_p; 122*7c478bd9Sstevel@tonic-gate } host; 123*7c478bd9Sstevel@tonic-gate struct servent *serv; 124*7c478bd9Sstevel@tonic-gate } nss; 125*7c478bd9Sstevel@tonic-gate }; 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #ifdef __STDC__ 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate int __classic_netdir_getbyname(struct netconfig *, 130*7c478bd9Sstevel@tonic-gate struct nd_hostserv *, struct nd_addrlist **); 131*7c478bd9Sstevel@tonic-gate int __classic_netdir_getbyaddr(struct netconfig *, 132*7c478bd9Sstevel@tonic-gate struct nd_hostservlist **, struct netbuf *); 133*7c478bd9Sstevel@tonic-gate int _get_hostserv_inetnetdir_byname(struct netconfig *, 134*7c478bd9Sstevel@tonic-gate struct nss_netdirbyname_in *, union nss_netdirbyname_out *); 135*7c478bd9Sstevel@tonic-gate int _get_hostserv_inetnetdir_byaddr(struct netconfig *, 136*7c478bd9Sstevel@tonic-gate struct nss_netdirbyaddr_in *, union nss_netdirbyaddr_out *); 137*7c478bd9Sstevel@tonic-gate int __inet_netdir_options(struct netconfig *, 138*7c478bd9Sstevel@tonic-gate int option, int fd, char *par); 139*7c478bd9Sstevel@tonic-gate struct netbuf *__inet_uaddr2taddr(struct netconfig *, char *); 140*7c478bd9Sstevel@tonic-gate char *__inet_taddr2uaddr(struct netconfig *, struct netbuf *); 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate #else 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate int __classic_netdir_getbyname(); 145*7c478bd9Sstevel@tonic-gate int __classic_netdir_getbyaddr(); 146*7c478bd9Sstevel@tonic-gate int _get_hostserv_inetnetdir_byname(); 147*7c478bd9Sstevel@tonic-gate int _get_hostserv_inetnetdir_byaddr(); 148*7c478bd9Sstevel@tonic-gate int __inet_netdir_options(); 149*7c478bd9Sstevel@tonic-gate struct netbuf *__inet_uaddr2taddr(); 150*7c478bd9Sstevel@tonic-gate char *__inet_taddr2uaddr(); 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 155*7c478bd9Sstevel@tonic-gate } 156*7c478bd9Sstevel@tonic-gate #endif 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate #endif /* _NSS_NETDIR_H */ 159