1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #ifndef _NISDB_LDAP_H 30*7c478bd9Sstevel@tonic-gate #define _NISDB_LDAP_H 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <sys/time.h> 33*7c478bd9Sstevel@tonic-gate #include <thread.h> 34*7c478bd9Sstevel@tonic-gate #include <synch.h> 35*7c478bd9Sstevel@tonic-gate #include <pthread.h> 36*7c478bd9Sstevel@tonic-gate #include <rpcsvc/nis.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include "ldap_parse.h" 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 41*7c478bd9Sstevel@tonic-gate extern "C" { 42*7c478bd9Sstevel@tonic-gate #endif 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* Types supporting rpc.nisd configuration attributes */ 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* nisplusLDAPinitialUpdate */ 47*7c478bd9Sstevel@tonic-gate typedef enum { 48*7c478bd9Sstevel@tonic-gate ini_none, 49*7c478bd9Sstevel@tonic-gate from_ldap, 50*7c478bd9Sstevel@tonic-gate from_ldap_update_only, 51*7c478bd9Sstevel@tonic-gate to_ldap, 52*7c478bd9Sstevel@tonic-gate to_ldap_update_only 53*7c478bd9Sstevel@tonic-gate } __nis_initial_update_t; 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate /* nisplusLDAPretrieveError */ 56*7c478bd9Sstevel@tonic-gate typedef enum { 57*7c478bd9Sstevel@tonic-gate use_cached, 58*7c478bd9Sstevel@tonic-gate ret_retry, 59*7c478bd9Sstevel@tonic-gate try_again, 60*7c478bd9Sstevel@tonic-gate ret_unavail, 61*7c478bd9Sstevel@tonic-gate no_such_name, 62*7c478bd9Sstevel@tonic-gate fail 63*7c478bd9Sstevel@tonic-gate } __nis_retrieve_error_t; 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate /* nisplusLDAPstoreError */ 66*7c478bd9Sstevel@tonic-gate typedef enum { 67*7c478bd9Sstevel@tonic-gate sto_retry, 68*7c478bd9Sstevel@tonic-gate system_error, 69*7c478bd9Sstevel@tonic-gate sto_unavail, 70*7c478bd9Sstevel@tonic-gate sto_fail 71*7c478bd9Sstevel@tonic-gate } __nis_store_error_t; 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate /* nisplusLDAPstoreErrorDisp */ 74*7c478bd9Sstevel@tonic-gate typedef enum { 75*7c478bd9Sstevel@tonic-gate std_delete_entry, 76*7c478bd9Sstevel@tonic-gate abandon 77*7c478bd9Sstevel@tonic-gate } __nis_store_error_disp_t; 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate /* nisplusLDAPrefreshError */ 80*7c478bd9Sstevel@tonic-gate typedef enum { 81*7c478bd9Sstevel@tonic-gate continue_using, 82*7c478bd9Sstevel@tonic-gate ref_retry, 83*7c478bd9Sstevel@tonic-gate continue_using_retry, 84*7c478bd9Sstevel@tonic-gate cache_expired, 85*7c478bd9Sstevel@tonic-gate tryagain 86*7c478bd9Sstevel@tonic-gate } __nis_refresh_error_t; 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate /* nisplusLDAPthreadCreationError */ 89*7c478bd9Sstevel@tonic-gate typedef enum { 90*7c478bd9Sstevel@tonic-gate pass_error, 91*7c478bd9Sstevel@tonic-gate cre_retry 92*7c478bd9Sstevel@tonic-gate } __nis_thread_creation_error_t; 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate /* nisplusLDAPdumpError */ 95*7c478bd9Sstevel@tonic-gate typedef enum { 96*7c478bd9Sstevel@tonic-gate de_retry, 97*7c478bd9Sstevel@tonic-gate rollback, 98*7c478bd9Sstevel@tonic-gate rollback_retry 99*7c478bd9Sstevel@tonic-gate } __nis_dump_error_t; 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate /* nisplusLDAPresyncService */ 102*7c478bd9Sstevel@tonic-gate typedef enum { 103*7c478bd9Sstevel@tonic-gate from_copy, 104*7c478bd9Sstevel@tonic-gate directory_locked, 105*7c478bd9Sstevel@tonic-gate from_live 106*7c478bd9Sstevel@tonic-gate } __nis_resync_service_t; 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate /* nisplusLDAPupdateBatching */ 109*7c478bd9Sstevel@tonic-gate typedef enum { 110*7c478bd9Sstevel@tonic-gate accumulate, 111*7c478bd9Sstevel@tonic-gate bounded_accumulate, 112*7c478bd9Sstevel@tonic-gate upd_none 113*7c478bd9Sstevel@tonic-gate } __nis_update_batching_t; 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate /* nisplusLDAPexclusiveWaitMode */ 116*7c478bd9Sstevel@tonic-gate typedef enum { 117*7c478bd9Sstevel@tonic-gate block, 118*7c478bd9Sstevel@tonic-gate ewm_tryagain 119*7c478bd9Sstevel@tonic-gate } __nis_exclusive_wait_mode_t; 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* nisplusLDAPmatchFetch */ 122*7c478bd9Sstevel@tonic-gate typedef enum { 123*7c478bd9Sstevel@tonic-gate no_match_only, 124*7c478bd9Sstevel@tonic-gate mat_always, 125*7c478bd9Sstevel@tonic-gate mat_never 126*7c478bd9Sstevel@tonic-gate } __nis_match_fetch_t; 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate /* Keep track of desired number of attempts and timeout */ 129*7c478bd9Sstevel@tonic-gate typedef struct { 130*7c478bd9Sstevel@tonic-gate int attempts; 131*7c478bd9Sstevel@tonic-gate time_t timeout; 132*7c478bd9Sstevel@tonic-gate } __nisdb_retry_t; 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate /* Table mapping (and related) information */ 135*7c478bd9Sstevel@tonic-gate typedef struct { 136*7c478bd9Sstevel@tonic-gate time_t initTtlLo; /* Initial lo TTL for table */ 137*7c478bd9Sstevel@tonic-gate time_t initTtlHi; /* Initial hi TTL for table */ 138*7c478bd9Sstevel@tonic-gate time_t ttl; /* TTL for table entries */ 139*7c478bd9Sstevel@tonic-gate time_t *expire; /* Expire times for entries */ 140*7c478bd9Sstevel@tonic-gate time_t enumExpire; /* Enumeration expiration */ 141*7c478bd9Sstevel@tonic-gate bool_t fromLDAP; /* Get data from LDAP ? */ 142*7c478bd9Sstevel@tonic-gate bool_t toLDAP; /* Write data to LDAP ? */ 143*7c478bd9Sstevel@tonic-gate bool_t isMaster; /* Are we master for this ? */ 144*7c478bd9Sstevel@tonic-gate __nis_retrieve_error_t retrieveError; 145*7c478bd9Sstevel@tonic-gate __nisdb_retry_t retrieveErrorRetry; 146*7c478bd9Sstevel@tonic-gate __nis_store_error_t storeError; 147*7c478bd9Sstevel@tonic-gate __nisdb_retry_t storeErrorRetry; 148*7c478bd9Sstevel@tonic-gate __nis_store_error_disp_t 149*7c478bd9Sstevel@tonic-gate storeErrorDisp; 150*7c478bd9Sstevel@tonic-gate __nis_refresh_error_t refreshError; 151*7c478bd9Sstevel@tonic-gate __nisdb_retry_t refreshErrorRetry; 152*7c478bd9Sstevel@tonic-gate __nis_match_fetch_t matchFetch; 153*7c478bd9Sstevel@tonic-gate __nis_table_mapping_t *tm; 154*7c478bd9Sstevel@tonic-gate zotypes objType; 155*7c478bd9Sstevel@tonic-gate zotypes expireType; 156*7c478bd9Sstevel@tonic-gate char *objName; 157*7c478bd9Sstevel@tonic-gate bool_t isDeferredTable; 158*7c478bd9Sstevel@tonic-gate mutex_t enumLock; 159*7c478bd9Sstevel@tonic-gate pthread_t enumTid; 160*7c478bd9Sstevel@tonic-gate int enumStat; 161*7c478bd9Sstevel@tonic-gate int enumDeferred; 162*7c478bd9Sstevel@tonic-gate uint_t enumEntries; 163*7c478bd9Sstevel@tonic-gate ulong_t enumTime; /* Microseconds */ 164*7c478bd9Sstevel@tonic-gate } __nisdb_table_mapping_t; 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate /* 167*7c478bd9Sstevel@tonic-gate * Configuration data used by the rpc.nisd proper, but not in libnisdb. 168*7c478bd9Sstevel@tonic-gate */ 169*7c478bd9Sstevel@tonic-gate typedef struct { 170*7c478bd9Sstevel@tonic-gate __nis_initial_update_t initialUpdate; 171*7c478bd9Sstevel@tonic-gate __nis_thread_creation_error_t threadCreationError; 172*7c478bd9Sstevel@tonic-gate __nisdb_retry_t threadCreationErrorTimeout; 173*7c478bd9Sstevel@tonic-gate __nis_dump_error_t dumpError; 174*7c478bd9Sstevel@tonic-gate __nisdb_retry_t dumpErrorTimeout; 175*7c478bd9Sstevel@tonic-gate __nis_resync_service_t resyncService; 176*7c478bd9Sstevel@tonic-gate __nis_update_batching_t updateBatching; 177*7c478bd9Sstevel@tonic-gate __nisdb_retry_t updateBatchingTimeout; 178*7c478bd9Sstevel@tonic-gate __nis_exclusive_wait_mode_t exclusiveWaitMode; 179*7c478bd9Sstevel@tonic-gate int numberOfServiceThreads; 180*7c478bd9Sstevel@tonic-gate int emulate_yp; 181*7c478bd9Sstevel@tonic-gate int maxRPCRecordSize; 182*7c478bd9Sstevel@tonic-gate } __nis_config_t; 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate extern __nisdb_table_mapping_t ldapDBTableMapping; 185*7c478bd9Sstevel@tonic-gate extern __nis_config_t ldapConfig; 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 188*7c478bd9Sstevel@tonic-gate } 189*7c478bd9Sstevel@tonic-gate #endif /* __cplusplus */ 190*7c478bd9Sstevel@tonic-gate 191*7c478bd9Sstevel@tonic-gate #endif /* _NISDB_LDAP_H */ 192