Logo ROOT   6.14/05
Reference Guide
TLDAPServer.h
Go to the documentation of this file.
1 // @(#)root/ldap:$Id$
2 // Author: Oleksandr Grebenyuk 21/09/2001
3 
4 /*************************************************************************
5  * For the licensing terms see $ROOTSYS/LICENSE. *
6  * For the list of contributors see $ROOTSYS/README/CREDITS. *
7  *************************************************************************/
8 
9 #ifndef ROOT_TLDAPServer
10 #define ROOT_TLDAPServer
11 
12 #include "TObject.h"
13 #include "TString.h"
14 #include "CintLDAP.h"
15 
16 class TList;
17 class TLDAPResult;
18 class TLDAPEntry;
19 
20 
21 class TLDAPServer : public TObject {
22 
23 private:
24  LDAP *fLd; // LDAP handle of current connection
25  TString fBinddn; // Bind name
26  TString fPassword; // Password
27  Bool_t fIsConnected; // Current connection state
28 
29  Int_t Bind();
30  void Unbind();
31 
32  static void DeleteMods(LDAPMod **mods);
33 
34 protected:
35  TLDAPServer(const TLDAPServer&);
37 
38 public:
39  TLDAPServer(const char *host, Int_t port = LDAP_PORT,
40  const char *binddn = 0, const char *password = 0,
41  Int_t version = LDAP_VERSION2);
42 
43  virtual ~TLDAPServer();
44 
45  Bool_t IsConnected() const { return fIsConnected; };
46  TLDAPResult *Search(const char *base = "",
47  Int_t scope = LDAP_SCOPE_BASE,
48  const char *filter = 0,
49  TList *attrs = 0,
50  Bool_t attrsonly = 0);
51  const char *GetNamingContexts();
52  const char *GetSubschemaSubentry();
55 
56  Int_t AddEntry(TLDAPEntry &entry);
57  Int_t ModifyEntry(TLDAPEntry &entry, Int_t mode = LDAP_MOD_REPLACE);
58  Int_t DeleteEntry(const char *dn);
59  Int_t RenameEntry(const char *dn, const char *newrdn,
60  Bool_t removeattr = kFALSE);
61 
62  ClassDef(TLDAPServer, 0) // Connection to LDAP server
63 };
64 
65 #endif
TLDAPResult * Search(const char *base="", Int_t scope=LDAP_SCOPE_BASE, const char *filter=0, TList *attrs=0, Bool_t attrsonly=0)
Performs searching at the LDAP directory.
TLDAPResult * GetAttributeTypes()
Calls GetSubschemaSubentry() and performs and LDAPSearch with the attribute "attributeTypes" to be re...
Bool_t IsConnected() const
Definition: TLDAPServer.h:45
const char * GetSubschemaSubentry()
Performs an LDAPSearch with the attribute "subschemaSubentry" to be returned with the result...
Basic string class.
Definition: TString.h:131
const char * GetNamingContexts()
Performs an LDAPSearch with the attribute "namingContexts" to be returned with the result...
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t RenameEntry(const char *dn, const char *newrdn, Bool_t removeattr=kFALSE)
Renames the entry with specified DN, the entry must be leaf Be sure that you are bound with the write...
TLDAPResult * GetObjectClasses()
Calls GetSubschemaSubentry() and performs and LDAPSearch with the attribute "objectClasses" to be ret...
Bool_t fIsConnected
Definition: TLDAPServer.h:27
#define ClassDef(name, id)
Definition: Rtypes.h:320
Int_t ModifyEntry(TLDAPEntry &entry, Int_t mode=LDAP_MOD_REPLACE)
Modifies specified entry.
Int_t DeleteEntry(const char *dn)
Deletes the entry with specified DN, the base entry must exist.
A doubly linked list.
Definition: TList.h:44
virtual ~TLDAPServer()
If the object is connected to the server, it disconnects.
Definition: TLDAPServer.cxx:86
TLDAPServer & operator=(const TLDAPServer &)
Equal operator.
Definition: TLDAPServer.cxx:72
const Bool_t kFALSE
Definition: RtypesCore.h:88
TString fPassword
Definition: TLDAPServer.h:26
void Unbind()
Unbinds from the server with specified binddn and password.
static void DeleteMods(LDAPMod **mods)
Deletes the array of LDAPMod structures and frees its memory.
Mother of all ROOT objects.
Definition: TObject.h:37
TString fBinddn
Definition: TLDAPServer.h:25
Int_t Bind()
Binds to the server with specified binddn and password.
Definition: TLDAPServer.cxx:95
LDAP * fLd
Definition: TLDAPServer.h:24
Int_t AddEntry(TLDAPEntry &entry)
Adds entry to the LDAP tree.
TLDAPServer(const TLDAPServer &)
Copy constructor.
Definition: TLDAPServer.cxx:60