summaryrefslogtreecommitdiff
path: root/usr/src/lib/libnisdb/ldap_val.h
blob: 08644c97a4845c1a7726765918009c7eb3c65a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_LDAP_VAL_H
#define	_LDAP_VAL_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#include <rpcsvc/nis.h>

#include "ldap_parse.h"
#include "ldap_ruleval.h"

/*
 * If we got values for the columns in the ruleval struct (from LDAP
 * or got from the query itself) then we assign the status to
 * NP_LDAP_MAP_SUCCESS. If we have enough NIS+ columns for the
 * rules to produce a value, but none of the rules produce a
 * value, then we pass NP_LDAP_RULES_NO_VALUE from
 * createLdapRequest() as an indication to proceed to the next
 * table mapping. NP_LDAP_NO_VALUE is used to indicate that
 * the element didn't have an entry in the LDAP.
 */
#define	NP_LDAP_MAP_SUCCESS 1
#define	NP_LDAP_RULES_NO_VALUE 2
#define	NP_LDAP_NO_VALUE 3

/* Exported functions */
__nis_mapping_format_t	*cloneMappingFormat(__nis_mapping_format_t *m);
void			freeMappingFormat(__nis_mapping_format_t *m);
void			copyIndex(__nis_index_t *old, __nis_index_t *nnew,
				int *err);
__nis_index_t		*cloneIndex(__nis_index_t *old);
void			freeIndex(__nis_index_t *old, bool_t doFree);
char			**cloneName(char **name, int numNames);
void			freeValue(__nis_value_t *val, int count);
__nis_value_t		*cloneValue(__nis_value_t *val, int count);
__nis_value_t		*getMappingItemVal(__nis_mapping_item_t *i,
				__nis_mapping_item_type_t native,
				__nis_rule_value_t *rv, char *berstring,
				int *np_ldap_stat);
__nis_value_t		*getMappingFormat(__nis_mapping_format_t *f,
				__nis_rule_value_t *rv, __nis_format_arg_t at,
				void *a, int *numArg);
__nis_value_t		*explodeValues(__nis_value_t *v1, __nis_value_t *v2);
__nis_value_t		*getMappingFormatArray(__nis_mapping_format_t *a,
				__nis_rule_value_t *rv, __nis_format_arg_t at,
				int numArgs, void *arg);
char			*getIndex(__nis_index_t *i, int *len);
char			*getObjSpec(__nis_obj_spec_t *o, int *len);
char			*getScope(int scope);
char			*getSearchTriple(__nis_search_triple_t *s, int *len);
__nis_value_t		*getMappingItem(__nis_mapping_item_t *i,
				__nis_mapping_item_type_t native,
				__nis_rule_value_t *rv, char *berstring,
				int *np_ldap_stat);
void			copyObjSpec(__nis_obj_spec_t *old,
				__nis_obj_spec_t *nnew, int *err);
__nis_obj_spec_t	*cloneObjSpec(__nis_obj_spec_t *old);
void			freeObjSpec(__nis_obj_spec_t *old, bool_t doFree);
void			copySearchTriple(__nis_search_triple_t *old,
				__nis_search_triple_t *nnew, int *err);
__nis_search_triple_t	*cloneSearchTriple(__nis_search_triple_t *old);
void			freeSearchTriple(__nis_search_triple_t *old,
				bool_t doFree);
void			copyTripleOrObj(__nis_mapping_item_type_t type,
				__nis_triple_or_obj_t *old,
				__nis_triple_or_obj_t *nnew, int *err);
__nis_triple_or_obj_t	*cloneTripleOrObj(__nis_mapping_item_type_t type,
				__nis_triple_or_obj_t *old);
void			freeTripleOrObj(__nis_mapping_item_type_t type,
				__nis_triple_or_obj_t *old,
				bool_t doFree);
void			copyItem(__nis_mapping_item_t *old,
				__nis_mapping_item_t *nnew, int *err);
__nis_mapping_item_t	*cloneItem(__nis_mapping_item_t *old);
void			freeMappingItem(__nis_mapping_item_t *item,
				int numItems);
__nis_mapping_item_t	*concatenateMappingItem(__nis_mapping_item_t *old,
				int numItems, __nis_mapping_item_t *cat);
__nis_value_t		*concatenateValues(__nis_value_t *v1,
				__nis_value_t *v2);
__nis_value_t		*splitMappingItem(__nis_mapping_item_t *item,
				char delim, __nis_rule_value_t *rv);
char			*scanMappingFormat(__nis_mapping_format_t *f,
				int curf, int nf, char *str, char **val,
				char **fmtstart, char *sepset);
int			verifyMappingMatch(__nis_mapping_format_t *f,
				char *str);
__nis_value_t		**matchMappingItem(__nis_mapping_format_t *f,
				__nis_value_t *inVal, int *numVals,
				char *sepset, char **outstr);
__nis_value_t		*extractMappingItem(__nis_mapping_item_t *item,
				__nis_mapping_format_t *f,
				__nis_rule_value_t *rv, int *np_ldap_stat);
void			stringElide(__nis_value_t *val, char elide);
__nis_value_t		*getMappingSubElement(__nis_mapping_sub_element_t *e,
				__nis_rule_value_t *rv, int *np_ldap_stat);
__nis_value_t		*getMappingElement(__nis_mapping_element_t *e,
				__nis_mapping_item_type_t native,
				__nis_rule_value_t *rv, int *stat);

#ifdef	__cplusplus
}
#endif

#endif	/* _LDAP_VAL_H */