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 2001, 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_LDAP_STRUCTS_H
28 #define	_LDAP_STRUCTS_H
29 
30 #include <sys/time.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Some functions accept a pointer to either a __nis_mapping_item_t, or
38  * a __nis_value_t. This enum tells us which it is.
39  */
40 typedef enum {fa_any, fa_item, fa_value} __nis_format_arg_t;
41 
42 /*
43  * A __nis_value_t contains either string (vt_string) or non-string
44  * (vt_ber) values.
45  */
46 typedef enum {vt_any, vt_string, vt_ber} __nis_value_type_t;
47 
48 /* A single value. If the value is a (char *), the length includes the NUL */
49 typedef struct {
50 	int			length;
51 	void			*value;
52 } __nis_single_value_t;
53 
54 /*
55  * Holds multiple values of the specified type.
56  */
57 typedef struct {
58 	__nis_value_type_t	type;
59 	int			repeat;		/* Should value be repeated ? */
60 	int			numVals;
61 	__nis_single_value_t	*val;
62 } __nis_value_t;
63 
64 /* Structure used to build rule values */
65 typedef struct {
66 	int			numColumns;	/* Number of col names/vals */
67 	char			**colName;	/* Column names */
68 	__nis_value_t		*colVal;	/* Column values */
69 	int			numAttrs;	/* Number of attr names vals */
70 	char			**attrName;	/* Attribute names */
71 	__nis_value_t		*attrVal;	/* Attribute values */
72 } __nis_rule_value_t;
73 
74 /* Structure containing information that ldap_search_s() wants */
75 typedef struct {
76 	unsigned char	useCon;	/* Should we use existing connection ? */
77 	char		*base;
78 	int		scope;
79 	int		numFilterComps;
80 	char		**filterComp;
81 	char		*filter;
82 	int		numAttrs;
83 	char		**attrs;
84 	int		attrsonly;
85 	int		isDN;
86 	struct timeval	timeout;
87 } __nis_ldap_search_t;
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif	/* _LDAP_STRUCTS_H */
94