summaryrefslogtreecommitdiff
path: root/usr/src/lib/libnisdb/nisdb_ldap.h
blob: 8513599b5bda3783eafb0be7c4dc187a70a96e43 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
 * 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.
 */

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

#ifndef	_NISDB_LDAP_H
#define	_NISDB_LDAP_H

#include <sys/time.h>
#include <thread.h>
#include <synch.h>
#include <pthread.h>
#include <rpcsvc/nis.h>

#include "ldap_parse.h"

#ifdef	__cplusplus
extern "C" {
#endif

/* Types supporting rpc.nisd configuration attributes */

/* nisplusLDAPinitialUpdate */
typedef enum {
	ini_none,
	from_ldap,
	from_ldap_update_only,
	to_ldap,
	to_ldap_update_only
} __nis_initial_update_t;

/* nisplusLDAPretrieveError */
typedef enum {
	use_cached,
	ret_retry,
	try_again,
	ret_unavail,
	no_such_name,
	fail
} __nis_retrieve_error_t;

/* nisplusLDAPstoreError */
typedef enum {
	sto_retry,
	system_error,
	sto_unavail,
	sto_fail
} __nis_store_error_t;

/* nisplusLDAPstoreErrorDisp */
typedef enum {
	std_delete_entry,
	abandon
} __nis_store_error_disp_t;

/* nisplusLDAPrefreshError */
typedef enum {
	continue_using,
	ref_retry,
	continue_using_retry,
	cache_expired,
	tryagain
} __nis_refresh_error_t;

/* nisplusLDAPthreadCreationError */
typedef enum {
	pass_error,
	cre_retry
} __nis_thread_creation_error_t;

/* nisplusLDAPdumpError */
typedef enum {
	de_retry,
	rollback,
	rollback_retry
} __nis_dump_error_t;

/* nisplusLDAPresyncService */
typedef enum {
	from_copy,
	directory_locked,
	from_live
} __nis_resync_service_t;

/* nisplusLDAPupdateBatching */
typedef enum {
	accumulate,
	bounded_accumulate,
	upd_none
} __nis_update_batching_t;

/* nisplusLDAPexclusiveWaitMode */
typedef enum {
	block,
	ewm_tryagain
} __nis_exclusive_wait_mode_t;

/* nisplusLDAPmatchFetch */
typedef enum {
	no_match_only,
	mat_always,
	mat_never
} __nis_match_fetch_t;

/* Keep track of desired number of attempts and timeout */
typedef struct {
	int		attempts;
	time_t		timeout;
} __nisdb_retry_t;

/* Table mapping (and related) information */
typedef struct {
	time_t			initTtlLo;	/* Initial lo TTL for table */
	time_t			initTtlHi;	/* Initial hi TTL for table */
	time_t			ttl;		/* TTL for table entries */
	time_t			*expire;	/* Expire times for entries */
	time_t			enumExpire;	/* Enumeration expiration */
	bool_t			fromLDAP;	/* Get data from LDAP ? */
	bool_t			toLDAP;		/* Write data to LDAP ? */
	bool_t			isMaster;	/* Are we master for this ? */
	__nis_retrieve_error_t	retrieveError;
	__nisdb_retry_t		retrieveErrorRetry;
	__nis_store_error_t	storeError;
	__nisdb_retry_t		storeErrorRetry;
	__nis_store_error_disp_t
				storeErrorDisp;
	__nis_refresh_error_t	refreshError;
	__nisdb_retry_t		refreshErrorRetry;
	__nis_match_fetch_t	matchFetch;
	__nis_table_mapping_t	*tm;
	zotypes			objType;
	zotypes			expireType;
	char			*objName;
	bool_t			isDeferredTable;
	mutex_t			enumLock;
	pthread_t		enumTid;
	int			enumStat;
	int			enumDeferred;
	uint_t			enumEntries;
	ulong_t			enumTime;	/* Microseconds */
} __nisdb_table_mapping_t;

/*
 * Configuration data used by the rpc.nisd proper, but not in libnisdb.
 */
typedef struct {
	__nis_initial_update_t		initialUpdate;
	__nis_thread_creation_error_t	threadCreationError;
	__nisdb_retry_t			threadCreationErrorTimeout;
	__nis_dump_error_t		dumpError;
	__nisdb_retry_t			dumpErrorTimeout;
	__nis_resync_service_t		resyncService;
	__nis_update_batching_t		updateBatching;
	__nisdb_retry_t			updateBatchingTimeout;
	__nis_exclusive_wait_mode_t	exclusiveWaitMode;
	int				numberOfServiceThreads;
	int				emulate_yp;
	int				maxRPCRecordSize;
} __nis_config_t;

extern __nisdb_table_mapping_t	ldapDBTableMapping;
extern __nis_config_t		ldapConfig;

#ifdef	__cplusplus
}
#endif	/* __cplusplus */

#endif	/* _NISDB_LDAP_H */