xref: /titanic_44/usr/src/lib/libnisdb/yptol/dit_access_utils.h (revision 3c112a2b34403220c06c3e2fcac403358cfba168)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _DIT_ACCESS_UTILS_H
28 #define	_DIT_ACCESS_UTILS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifndef ERROR
37 #define	ERROR	-1
38 #endif
39 
40 /* Keywords */
41 #define	N2LKEY			"rf_key"
42 #define	N2LIPKEY		"rf_ipkey"
43 #define	N2LSEARCHKEY		"rf_searchkey"
44 #define	N2LSEARCHIPKEY		"rf_searchipkey"
45 #define	N2LDOMAIN		"rf_domain"
46 #define	N2LCOMMENT		"rf_comment"
47 
48 /* libldap ignores usec. Hence using 1 sec timeout */
49 #define	SINGLE_ACCESS_TIMEOUT_SEC	1
50 #define	SINGLE_ACCESS_TIMEOUT_USEC	0
51 
52 extern __yp_domain_context_t	ypDomains;
53 
54 extern char			*getFullMapName(char *map, char *domain);
55 extern __nis_value_t		*stringToValue(char *dptr, int dsize);
56 extern __nis_rule_value_t	*processSplitField(__nis_table_mapping_t *sf,
57 				__nis_value_t *inVal, int *nv, int *statP);
58 extern __nis_rule_value_t	*datumToRuleValue(datum *key, datum *value,
59 				__nis_table_mapping_t *t, int *nv,
60 				char *domain, bool_t readonly, int *statP);
61 extern __nis_table_mapping_t	*mappingFromMap(char *map, char *domain,
62 				int *statP);
63 extern bool_t			singleReadFromDIT(char *map, char *domain,
64 				datum *key,
65 				datum *value, int *statP);
66 extern suc_code			singleWriteToDIT(char *map, char *domain,
67 				datum *key, datum *value, bool_t replace);
68 extern suc_code			buildNISRuleValue(__nis_table_mapping_t *t,
69 				__nis_rule_value_t *rv, char *domain);
70 extern suc_code			addSplitFieldValues(__nis_table_mapping_t *t,
71 				__nis_rule_value_t *rv, __nis_rule_value_t *trv,
72 				int numVals, char *domain);
73 extern datum			*ruleValueToDatum(__nis_table_mapping_t *t,
74 				__nis_rule_value_t *rv, int *statP);
75 extern datum 			*getKeyFromRuleValue(__nis_table_mapping_t *t,
76 				__nis_rule_value_t *rv, int *nv, int *statP);
77 extern const char		*getObjectClass(char *rdn);
78 extern suc_code			makeNISObject(char *domain, char *dn);
79 extern suc_code			addNISObject(char *domain, char *dn,
80 				int *ldap_rc);
81 extern suc_code			addParent(char *dn, char **attr);
82 extern bool_t			is_fatal_error(int res);
83 extern suc_code			alloc_temp_names(char *name,
84 				char **temp_entries, char **temp_ttl);
85 extern suc_code			collapseRuleValue(__nis_rule_value_t *rv);
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _DIT_ACCESS_UTILS_H */
92