#import "LUDictionary.h"
#import "LUAgent.h"
#import <NetInfo/syslock.h>
#import <lber.h>
#import <ldap.h>
#ifdef DEBUG
#define logDebug(msg) [lookupLog syslogDebug:msg]
#else
#define logDebug(msg)
#define NDEBUG
#endif DEBUG
#ifdef OIDTABLE
typedef id oid_name_t;
#else
typedef char *oid_name_t;
#endif OIDTABLE
#define NameForKey(o) (o)
@class FFParser;
#define CONFIG_KEY_LDAPHOST "host"
#define CONFIG_KEY_BASEDN "suffix"
#define CONFIG_KEY_BINDDN "binddn"
#define CONFIG_KEY_BINDPW "bindpw"
#define CONFIG_KEY_TIMELIMIT "timelimit"
#define CONFIG_KEY_TIMEOUT "Timeout"
#define CONFIG_KEY_SCOPE "scope"
#define CONFIG_KEY_DEREF "deref"
#define CONFIG_KEY_PORT "port"
#define CONFIG_KEY_LATENCY "ValidationLatency"
#define LDAP_SLEEPTIME 4
#define LDAP_MAXSLEEPTIME 64
#define LDAP_MAXCONNTRIES 2
#define LDAP_DEFAULT_LATENCY 15
@interface LDAPAgent : LUAgent
{
LUDictionary *stats;
LUDictionary *configuration;
FFParser *parser;
syslock *threadLock;
time_t validationLatency;
int port;
int scope;
int timelimit;
int deref;
struct timeval timeout;
char *defaultBase;
char *bindName;
char *bindCredentials;
LDAP *ld;
int rebindTries;
int sleepTime;
char **nisAttributes[NCATEGORIES];
char *nisClasses[NCATEGORIES];
char *searchBases[NCATEGORIES];
#ifdef OIDTABLE
LUDictionary *schema;
#endif
}
+ (oid_name_t)oidNameForKey:(char *)key category:(LUCategory)cat;
- (void)initValidationLatency;
- (void)initSearchBases;
- reInit;
- (LUDictionary *)configuration;
- (LDAP *)session;
- (void)rebind;
- (int)openConnection;
- (void)closeConnection;
- (BOOL)getConfiguration;
- (char *)searchBaseForCategory:(LUCategory)cat;
- (LUDictionary *)itemWithAttributes:(oid_name_t *)aKey
values:(char **)aVal
category:(LUCategory)cat;
- (LUDictionary *)itemWithAttribute:(oid_name_t)aKey
value:(char *)aVal
category:(LUCategory)cat;
- (LUArray *)allItemsWithCategory:(LUCategory)cat;
- (LDAPMessage *)search:(char *)base
filter:(char *)filter
attributes:(char **)attrs
sizelimit:(int)sizelimit;
- (time_t)currentModifyTimestampForEntry:(LUDictionary *)entry;
- (char *)filterWithClass:(char *)clazz;
- (char *)filterWithClass:(char *)clazz
attributes:(oid_name_t *)attributes
values:(char **)values;
- (void)lock;
- (void)unlock;
- (int)config:(LUDictionary *)configuration scope:(char *)key default:(int)def;
- (int)config:(LUDictionary *)configuration deref:(char *)key default:(int)def;
- (LUDictionary *)getDNSConfiguration;
- (char *)dnsDomainToDn:(char *)domain;
@end