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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <rpcsvc/nis.h>
35 
36 #include "ldap_parse.h"
37 #include "ldap_nisdbquery.h"
38 #include "ldap_structs.h"
39 #include "ldap_util.h"
40 
41 /* Exported functions */
42 void			freeRuleValue(__nis_rule_value_t *rv, int count);
43 __nis_rule_value_t	*initRuleValue(int count, __nis_rule_value_t *rvIn);
44 __nis_rule_value_t	*growRuleValue(int oldCount, int newCount,
45 				__nis_rule_value_t *old,
46 				__nis_rule_value_t *rvIn);
47 int			mergeRuleValue(__nis_rule_value_t *target,
48 				__nis_rule_value_t *source);
49 int			addAttr2RuleValue(__nis_value_type_t type, char *name,
50 				void *value, int valueLen,
51 				__nis_rule_value_t *rv);
52 int			addSAttr2RuleValue(char *name, char *value,
53 				__nis_rule_value_t *rv);
54 int			addCol2RuleValue(__nis_value_type_t type, char *name,
55 				void *value, int valueLen,
56 				__nis_rule_value_t *rv);
57 int			addSCol2RuleValue(char *name, char *value,
58 				__nis_rule_value_t *rv);
59 void			delAttrFromRuleValue(__nis_rule_value_t *rv,
60 				char *attrName);
61 void			delColFromRuleValue(__nis_rule_value_t *rv,
62 				char *colName);
63 __nis_rule_value_t	*buildNisPlusRuleValue(__nis_table_mapping_t *t,
64 				db_query *q, __nis_rule_value_t *rv);
65 __nis_mapping_item_t	*buildLvalue(__nis_mapping_rlhs_t *rl,
66 				__nis_value_t **rval, int *numItems);
67 __nis_value_t		*buildRvalue(__nis_mapping_rlhs_t *rl,
68 				__nis_mapping_item_type_t native,
69 				__nis_rule_value_t *rv, int *stat);
70 __nis_rule_value_t	*addLdapRuleValue(__nis_table_mapping_t *t,
71 				__nis_mapping_rule_t *r,
72 				__nis_mapping_item_type_t lnative,
73 				__nis_mapping_item_type_t rnative,
74 				__nis_rule_value_t *rv,
75 				int doAssign, int *stat);
76 __nis_rule_value_t	*addObjectClasses(__nis_rule_value_t *rv,
77 				char *objClassAttrs);
78 char			*rvId(__nis_rule_value_t *rv,
79 				__nis_mapping_item_type_t type);
80 char			*findVal(char *name, __nis_rule_value_t *rv,
81 				__nis_mapping_item_type_t type);
82 __nis_rule_value_t	*mergeRuleValueWithSameDN(__nis_rule_value_t *rv,
83 				int *numVals);
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif	/* _LDAP_RULEVAL_H */
90