17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5cb5caa98Sdjl * Common Development and Distribution License (the "License"). 6cb5caa98Sdjl * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 23*ba3594baSGarrett D'Amore * 24cb5caa98Sdjl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * nss_netdir.h 307c478bd9Sstevel@tonic-gate * 317c478bd9Sstevel@tonic-gate * Defines structures that are shared between the OSNET-private 327c478bd9Sstevel@tonic-gate * _get_hostserv_inetnetdir_byYY() interfaces and the public 337c478bd9Sstevel@tonic-gate * interfaces gethostbyYY()/getservbyYY() and netdir_getbyYY(). 347c478bd9Sstevel@tonic-gate * Ideally, this header file should never be visible to developers 357c478bd9Sstevel@tonic-gate * outside of the OSNET build. 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifndef _NSS_NETDIR_H 397c478bd9Sstevel@tonic-gate #define _NSS_NETDIR_H 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate typedef enum { 467c478bd9Sstevel@tonic-gate NSS_HOST, 477c478bd9Sstevel@tonic-gate NSS_SERV, 487c478bd9Sstevel@tonic-gate NETDIR_BY, 497c478bd9Sstevel@tonic-gate NETDIR_BY_NOSRV, /* bypass service lookup */ 507c478bd9Sstevel@tonic-gate NETDIR_BY6, 517c478bd9Sstevel@tonic-gate NETDIR_BY_NOSRV6, /* bypass service lookup */ 527c478bd9Sstevel@tonic-gate NSS_HOST6 537c478bd9Sstevel@tonic-gate } nss_netdir_op_t; 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate struct nss_netdirbyname_in { 567c478bd9Sstevel@tonic-gate nss_netdir_op_t op_t; 577c478bd9Sstevel@tonic-gate union { 587c478bd9Sstevel@tonic-gate struct nd_hostserv *nd_hs; 597c478bd9Sstevel@tonic-gate union { 607c478bd9Sstevel@tonic-gate struct { 617c478bd9Sstevel@tonic-gate const char *name; 627c478bd9Sstevel@tonic-gate char *buf; 637c478bd9Sstevel@tonic-gate int buflen; 647c478bd9Sstevel@tonic-gate } host; 657c478bd9Sstevel@tonic-gate struct { 667c478bd9Sstevel@tonic-gate const char *name; 677c478bd9Sstevel@tonic-gate char *buf; 687c478bd9Sstevel@tonic-gate int buflen; 697c478bd9Sstevel@tonic-gate int af_family; /* for ipnode */ 707c478bd9Sstevel@tonic-gate int flags; /* for ipnode */ 717c478bd9Sstevel@tonic-gate } host6; 727c478bd9Sstevel@tonic-gate struct { 737c478bd9Sstevel@tonic-gate const char *name; 747c478bd9Sstevel@tonic-gate const char *proto; 757c478bd9Sstevel@tonic-gate char *buf; 767c478bd9Sstevel@tonic-gate int buflen; 777c478bd9Sstevel@tonic-gate } serv; 787c478bd9Sstevel@tonic-gate } nss; 797c478bd9Sstevel@tonic-gate } arg; 807c478bd9Sstevel@tonic-gate }; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate union nss_netdirbyname_out { 837c478bd9Sstevel@tonic-gate struct nd_addrlist **nd_alist; 847c478bd9Sstevel@tonic-gate union { 857c478bd9Sstevel@tonic-gate struct { 867c478bd9Sstevel@tonic-gate struct hostent *hent; 877c478bd9Sstevel@tonic-gate int *herrno_p; 887c478bd9Sstevel@tonic-gate } host; 897c478bd9Sstevel@tonic-gate struct servent *serv; 907c478bd9Sstevel@tonic-gate } nss; 917c478bd9Sstevel@tonic-gate }; 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate struct nss_netdirbyaddr_in { 947c478bd9Sstevel@tonic-gate nss_netdir_op_t op_t; 957c478bd9Sstevel@tonic-gate union { 967c478bd9Sstevel@tonic-gate struct netbuf *nd_nbuf; 977c478bd9Sstevel@tonic-gate union { 987c478bd9Sstevel@tonic-gate struct { 997c478bd9Sstevel@tonic-gate const char *addr; 1007c478bd9Sstevel@tonic-gate int len; 1017c478bd9Sstevel@tonic-gate int type; 1027c478bd9Sstevel@tonic-gate char *buf; 1037c478bd9Sstevel@tonic-gate int buflen; 1047c478bd9Sstevel@tonic-gate } host; 1057c478bd9Sstevel@tonic-gate struct { 1067c478bd9Sstevel@tonic-gate int port; 1077c478bd9Sstevel@tonic-gate const char *proto; 1087c478bd9Sstevel@tonic-gate char *buf; 1097c478bd9Sstevel@tonic-gate int buflen; 1107c478bd9Sstevel@tonic-gate } serv; 1117c478bd9Sstevel@tonic-gate } nss; 1127c478bd9Sstevel@tonic-gate } arg; 1137c478bd9Sstevel@tonic-gate }; 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate union nss_netdirbyaddr_out { 1167c478bd9Sstevel@tonic-gate struct nd_hostservlist **nd_hslist; 1177c478bd9Sstevel@tonic-gate union { 1187c478bd9Sstevel@tonic-gate struct { 1197c478bd9Sstevel@tonic-gate struct hostent *hent; 1207c478bd9Sstevel@tonic-gate int *herrno_p; 1217c478bd9Sstevel@tonic-gate } host; 1227c478bd9Sstevel@tonic-gate struct servent *serv; 1237c478bd9Sstevel@tonic-gate } nss; 1247c478bd9Sstevel@tonic-gate }; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate int __classic_netdir_getbyname(struct netconfig *, 1277c478bd9Sstevel@tonic-gate struct nd_hostserv *, struct nd_addrlist **); 1287c478bd9Sstevel@tonic-gate int __classic_netdir_getbyaddr(struct netconfig *, 1297c478bd9Sstevel@tonic-gate struct nd_hostservlist **, struct netbuf *); 1307c478bd9Sstevel@tonic-gate int _get_hostserv_inetnetdir_byname(struct netconfig *, 1317c478bd9Sstevel@tonic-gate struct nss_netdirbyname_in *, union nss_netdirbyname_out *); 1327c478bd9Sstevel@tonic-gate int _get_hostserv_inetnetdir_byaddr(struct netconfig *, 1337c478bd9Sstevel@tonic-gate struct nss_netdirbyaddr_in *, union nss_netdirbyaddr_out *); 1347c478bd9Sstevel@tonic-gate int __inet_netdir_options(struct netconfig *, 1357c478bd9Sstevel@tonic-gate int option, int fd, char *par); 1367c478bd9Sstevel@tonic-gate struct netbuf *__inet_uaddr2taddr(struct netconfig *, char *); 1377c478bd9Sstevel@tonic-gate char *__inet_taddr2uaddr(struct netconfig *, struct netbuf *); 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1407c478bd9Sstevel@tonic-gate } 1417c478bd9Sstevel@tonic-gate #endif 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate #endif /* _NSS_NETDIR_H */ 144