]> err.no Git - sope/blob - sope-ldap/NGLdap/NGLdapConnection.h
renamed packages as discussed in the developer list
[sope] / sope-ldap / NGLdap / NGLdapConnection.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGLdapConnection_H__
24 #define __NGLdapConnection_H__
25
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSDate.h>
28
29 @class NSString, NSArray, NSEnumerator;
30 @class EOQualifier;
31 @class NGLdapEntry;
32
33 @interface NGLdapConnection : NSObject
34 {
35   void           *handle;
36   NSString       *hostName;
37   int            port;
38   
39   NSTimeInterval cacheTimeout;
40   long           cacheMaxMemory; /* in bytes */
41   BOOL           isCacheEnabled;
42
43   struct {
44     BOOL isBound:1;
45   } flags;
46 }
47
48 - (id)initWithHostName:(NSString *)_hostName port:(int)_port; // designated init
49 - (id)initWithHostName:(NSString *)_hostName;
50
51 /* settings */
52
53 - (NSString *)hostName;
54 - (int)port;
55
56 /* binding */
57
58 - (BOOL)isBound;
59 - (void)unbind;
60
61 - (BOOL)bindWithMethod:(NSString *)_method
62   binddn:(NSString *)_login credentials:(NSString *)_cred;
63
64 /* running queries */
65
66 - (NSEnumerator *)flatSearchAtBaseDN:(NSString *)_base
67   qualifier:(EOQualifier *)_q
68   attributes:(NSArray *)_attributes;
69 - (NSEnumerator *)deepSearchAtBaseDN:(NSString *)_base
70   qualifier:(EOQualifier *)_q
71   attributes:(NSArray *)_attributes;
72 - (NSEnumerator *)baseSearchAtBaseDN:(NSString *)_base
73   qualifier:(EOQualifier *)_q
74   attributes:(NSArray *)_attributes;
75
76 - (NGLdapEntry *)entryAtDN:(NSString *)_dn attributes:(NSArray *)_attrs;
77
78 /* cache */
79
80 - (void)setCacheTimeout:(NSTimeInterval)_to;
81 - (NSTimeInterval)cacheTimeout;
82
83 - (void)setCacheMaxMemoryUsage:(long)_maxMem;
84 - (long)cacheMaxMemoryUsage;
85
86 - (void)setUseCache:(BOOL)_flag;
87 - (BOOL)doesUseCache;
88
89 - (void)flushCache;
90 - (void)destroyCache;
91
92 - (void)cacheForgetEntryWithDN:(NSString *)_dn;
93
94 /* modifications */
95
96 - (BOOL)addEntry:(NGLdapEntry *)_entry;
97 - (BOOL)removeEntryWithDN:(NSString *)_dn;
98 - (BOOL)modifyEntryWithDN:(NSString *)_dn changes:(NSArray *)_mods;
99
100 /* root DSE */
101
102 - (NGLdapEntry *)schemaEntry;
103 - (NGLdapEntry *)rootDSE;
104 - (NGLdapEntry *)configEntry;
105 - (NSArray *)namingContexts;
106
107 @end
108
109 @interface NGLdapConnection(PlainPasswordCheck)
110
111 /* specialized password check routine */
112
113 - (NSString *)dnForLogin:(NSString *)_login baseDN:(NSString *)_baseDN;
114
115 + (BOOL)checkPassword:(NSString *)_pwd ofLogin:(NSString *)_login
116   atBaseDN:(NSString *)_baseDN
117   onHost:(NSString *)_hostName port:(int)_port;
118
119 @end
120
121 #endif /* __NGLdapConnection_H__ */