xref: /illumos-gate/usr/src/lib/libnisdb/ldap_ruleval.h (revision 4de2612967d06c4fdbf524a62556a1e8118a006f)
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_RULEVAL_H
28 #define	_LDAP_RULEVAL_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_nisdbquery.h"
40 #include "ldap_structs.h"
41 #include "ldap_util.h"
42 
43 /* Exported functions */
44 void			freeRuleValue(__nis_rule_value_t *rv, int count);
45 __nis_rule_value_t	*initRuleValue(int count, __nis_rule_value_t *rvIn);
46 __nis_rule_value_t	*growRuleValue(int oldCount, int newCount,
47 				__nis_rule_value_t *old,
48 				__nis_rule_value_t *rvIn);
49 int			mergeRuleValue(__nis_rule_value_t *target,
50 				__nis_rule_value_t *source);
51 int			addAttr2RuleValue(__nis_value_type_t type, char *name,
52 				void *value, int valueLen,
53 				__nis_rule_value_t *rv);
54 int			addSAttr2RuleValue(char *name, char *value,
55 				__nis_rule_value_t *rv);
56 int			addCol2RuleValue(__nis_value_type_t type, char *name,
57 				void *value, int valueLen,
58 				__nis_rule_value_t *rv);
59 int			addSCol2RuleValue(char *name, char *value,
60 				__nis_rule_value_t *rv);
61 void			delAttrFromRuleValue(__nis_rule_value_t *rv,
62 				char *attrName);
63 void			delColFromRuleValue(__nis_rule_value_t *rv,
64 				char *colName);
65 __nis_rule_value_t	*buildNisPlusRuleValue(__nis_table_mapping_t *t,
66 				db_query *q, __nis_rule_value_t *rv);
67 __nis_mapping_item_t	*buildLvalue(__nis_mapping_rlhs_t *rl,
68 				__nis_value_t **rval, int *numItems);
69 __nis_value_t		*buildRvalue(__nis_mapping_rlhs_t *rl,
70 				__nis_mapping_item_type_t native,
71 				__nis_rule_value_t *rv, int *stat);
72 __nis_rule_value_t	*addLdapRuleValue(__nis_table_mapping_t *t,
73 				__nis_mapping_rule_t *r,
74 				__nis_mapping_item_type_t lnative,
75 				__nis_mapping_item_type_t rnative,
76 				__nis_rule_value_t *rv,
77 				int doAssign, int *stat);
78 __nis_rule_value_t	*addObjectClasses(__nis_rule_value_t *rv,
79 				char *objClassAttrs);
80 char			*rvId(__nis_rule_value_t *rv,
81 				__nis_mapping_item_type_t type);
82 char			*findVal(char *name, __nis_rule_value_t *rv,
83 				__nis_mapping_item_type_t type);
84 __nis_rule_value_t	*mergeRuleValueWithSameDN(__nis_rule_value_t *rv,
85 				int *numVals);
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _LDAP_RULEVAL_H */
92