xref: /titanic_50/usr/src/lib/libnisdb/ldap_val.h (revision e07d9cb85217949d497b02d7211de8a197d2f2eb)
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_VAL_H
28 #define	_LDAP_VAL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <rpcsvc/nis.h>
37 
38 #include "ldap_parse.h"
39 #include "ldap_ruleval.h"
40 
41 /*
42  * If we got values for the columns in the ruleval struct (from LDAP
43  * or got from the query itself) then we assign the status to
44  * NP_LDAP_MAP_SUCCESS. If we have enough NIS+ columns for the
45  * rules to produce a value, but none of the rules produce a
46  * value, then we pass NP_LDAP_RULES_NO_VALUE from
47  * createLdapRequest() as an indication to proceed to the next
48  * table mapping. NP_LDAP_NO_VALUE is used to indicate that
49  * the element didn't have an entry in the LDAP.
50  */
51 #define	NP_LDAP_MAP_SUCCESS 1
52 #define	NP_LDAP_RULES_NO_VALUE 2
53 #define	NP_LDAP_NO_VALUE 3
54 
55 /* Exported functions */
56 __nis_mapping_format_t	*cloneMappingFormat(__nis_mapping_format_t *m);
57 void			freeMappingFormat(__nis_mapping_format_t *m);
58 void			copyIndex(__nis_index_t *old, __nis_index_t *nnew,
59 				int *err);
60 __nis_index_t		*cloneIndex(__nis_index_t *old);
61 void			freeIndex(__nis_index_t *old, bool_t doFree);
62 char			**cloneName(char **name, int numNames);
63 void			freeValue(__nis_value_t *val, int count);
64 __nis_value_t		*cloneValue(__nis_value_t *val, int count);
65 __nis_value_t		*getMappingItemVal(__nis_mapping_item_t *i,
66 				__nis_mapping_item_type_t native,
67 				__nis_rule_value_t *rv, char *berstring,
68 				int *np_ldap_stat);
69 __nis_value_t		*getMappingFormat(__nis_mapping_format_t *f,
70 				__nis_rule_value_t *rv, __nis_format_arg_t at,
71 				void *a, int *numArg);
72 __nis_value_t		*explodeValues(__nis_value_t *v1, __nis_value_t *v2);
73 __nis_value_t		*getMappingFormatArray(__nis_mapping_format_t *a,
74 				__nis_rule_value_t *rv, __nis_format_arg_t at,
75 				int numArgs, void *arg);
76 char			*getIndex(__nis_index_t *i, int *len);
77 char			*getObjSpec(__nis_obj_spec_t *o, int *len);
78 char			*getScope(int scope);
79 char			*getSearchTriple(__nis_search_triple_t *s, int *len);
80 __nis_value_t		*getMappingItem(__nis_mapping_item_t *i,
81 				__nis_mapping_item_type_t native,
82 				__nis_rule_value_t *rv, char *berstring,
83 				int *np_ldap_stat);
84 void			copyObjSpec(__nis_obj_spec_t *old,
85 				__nis_obj_spec_t *nnew, int *err);
86 __nis_obj_spec_t	*cloneObjSpec(__nis_obj_spec_t *old);
87 void			freeObjSpec(__nis_obj_spec_t *old, bool_t doFree);
88 void			copySearchTriple(__nis_search_triple_t *old,
89 				__nis_search_triple_t *nnew, int *err);
90 __nis_search_triple_t	*cloneSearchTriple(__nis_search_triple_t *old);
91 void			freeSearchTriple(__nis_search_triple_t *old,
92 				bool_t doFree);
93 void			copyTripleOrObj(__nis_mapping_item_type_t type,
94 				__nis_triple_or_obj_t *old,
95 				__nis_triple_or_obj_t *nnew, int *err);
96 __nis_triple_or_obj_t	*cloneTripleOrObj(__nis_mapping_item_type_t type,
97 				__nis_triple_or_obj_t *old);
98 void			freeTripleOrObj(__nis_mapping_item_type_t type,
99 				__nis_triple_or_obj_t *old,
100 				bool_t doFree);
101 void			copyItem(__nis_mapping_item_t *old,
102 				__nis_mapping_item_t *nnew, int *err);
103 __nis_mapping_item_t	*cloneItem(__nis_mapping_item_t *old);
104 void			freeMappingItem(__nis_mapping_item_t *item,
105 				int numItems);
106 __nis_mapping_item_t	*concatenateMappingItem(__nis_mapping_item_t *old,
107 				int numItems, __nis_mapping_item_t *cat);
108 __nis_value_t		*concatenateValues(__nis_value_t *v1,
109 				__nis_value_t *v2);
110 __nis_value_t		*splitMappingItem(__nis_mapping_item_t *item,
111 				char delim, __nis_rule_value_t *rv);
112 char			*scanMappingFormat(__nis_mapping_format_t *f,
113 				int curf, int nf, char *str, char **val,
114 				char **fmtstart, char *sepset);
115 int			verifyMappingMatch(__nis_mapping_format_t *f,
116 				char *str);
117 __nis_value_t		**matchMappingItem(__nis_mapping_format_t *f,
118 				__nis_value_t *inVal, int *numVals,
119 				char *sepset, char **outstr);
120 __nis_value_t		*extractMappingItem(__nis_mapping_item_t *item,
121 				__nis_mapping_format_t *f,
122 				__nis_rule_value_t *rv, int *np_ldap_stat);
123 void			stringElide(__nis_value_t *val, char elide);
124 __nis_value_t		*getMappingSubElement(__nis_mapping_sub_element_t *e,
125 				__nis_rule_value_t *rv, int *np_ldap_stat);
126 __nis_value_t		*getMappingElement(__nis_mapping_element_t *e,
127 				__nis_mapping_item_type_t native,
128 				__nis_rule_value_t *rv, int *stat);
129 
130 #ifdef	__cplusplus
131 }
132 #endif
133 
134 #endif	/* _LDAP_VAL_H */
135