|
PTLib
Version 2.14.3
|
This class will create an LDAP client to access a remote LDAP server. More...
#include <pldap.h>


Classes | |
| class | BinaryModAttrib |
| class | ModAttrib |
| class | SearchContext |
| class | StringModAttrib |
Public Types | |
| enum | AuthenticationMethod { AuthSimple, AuthSASL, AuthKerberos, NumAuthenticationMethod } |
| enum | SearchScope { ScopeBaseOnly, ScopeSingleLevel, ScopeSubTree, NumSearchScope } |
Public Types inherited from PObject | |
| enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
Public Member Functions | |
| PLDAPSession (const PString &defaultBaseDN=PString::Empty()) | |
| Create a LDAP client. More... | |
| ~PLDAPSession () | |
| Close the sesison on destruction. More... | |
| PBoolean | Open (const PString &server, WORD port=0) |
| Open the LDAP session to the specified server. More... | |
| PBoolean | Close () |
| Close the LDAP session. More... | |
| PBoolean | IsOpen () const |
| Determine of session is open. More... | |
| PBoolean | SetOption (int optcode, int value) |
| Set LDAP option parameter (OpenLDAp specific values) More... | |
| PBoolean | SetOption (int optcode, void *value) |
| Set LDAP option parameter (OpenLDAP specific values) More... | |
| PBoolean | StartTLS () |
| Start encrypted connection. More... | |
| PBoolean | Bind (const PString &who=PString::Empty(), const PString &passwd=PString::Empty(), AuthenticationMethod authMethod=AuthSimple) |
| Bind to the remote LDAP server. More... | |
| PBoolean | Add (const PString &dn, const PArray< ModAttrib > &attributes) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Add (const PString &dn, const PStringToString &attributes) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Add (const PString &dn, const PStringArray &attributes) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Add (const PString &dn, const PLDAPStructBase &data) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Modify (const PString &dn, const PArray< ModAttrib > &attributes) |
| Modify an existing distringuished name to LDAP dirctory. More... | |
| PBoolean | Modify (const PString &dn, const PStringToString &attributes) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Modify (const PString &dn, const PStringArray &attributes) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Modify (const PString &dn, const PLDAPStructBase &data) |
| Add a new distringuished name to LDAP dirctory. More... | |
| PBoolean | Delete (const PString &dn) |
| Delete the distinguished name from LDAP directory. More... | |
| PBoolean | Search (SearchContext &context, const PString &filter, const PStringArray &attributes=PStringList(), const PString &base=PString::Empty(), SearchScope scope=ScopeSubTree) |
| Start search for specified information. More... | |
| PBoolean | GetSearchResult (SearchContext &context, PStringToString &data) |
| Get the current search result entry. More... | |
| PBoolean | GetSearchResult (SearchContext &context, const PString &attribute, PString &data) |
| Get an attribute of the current search result entry. More... | |
| PBoolean | GetSearchResult (SearchContext &context, const PString &attribute, PStringArray &data) |
| Get an attribute of the current search result entry. More... | |
| PBoolean | GetSearchResult (SearchContext &context, const PString &attribute, PArray< PBYTEArray > &data) |
| Get an attribute of the current search result entry. More... | |
| PBoolean | GetSearchResult (SearchContext &context, PLDAPStructBase &data) |
| Get all attributes of the current search result entry. More... | |
| PString | GetSearchResultDN (SearchContext &context) |
| Get the current search result distinguished name entry. More... | |
| PBoolean | GetNextSearchResult (SearchContext &context) |
| Get the next search result. More... | |
| PList< PStringToString > | Search (const PString &filter, const PStringArray &attributes=PStringList(), const PString &base=PString::Empty(), SearchScope scope=ScopeSubTree) |
| Search for specified information, returning all matches. More... | |
| void | SetBaseDN (const PString &dn) |
| Set the default base DN for use if not specified for searches. More... | |
| const PString & | GetBaseDN () const |
| Set the default base DN for use if not specified for searches. More... | |
| int | GetErrorNumber () const |
| Get the last OpenLDAP error code. More... | |
| PString | GetErrorText () const |
| Get the last OpenLDAP error as text string. More... | |
| struct ldap * | GetOpenLDAP () const |
| Get the OpenLDAP context structure. More... | |
| const PTimeInterval & | GetTimeout () const |
| Get the timeout for LDAP operations. More... | |
| void | SetTimeout (const PTimeInterval &t) |
| Set the timeout for LDAP operations. More... | |
| void | SetSearchLimit (const unsigned s) |
| Set a limit on the number of results to return. More... | |
Public Member Functions inherited from PObject | |
| unsigned | GetTraceContextIdentifier () const |
| Get PTRACE context identifier. More... | |
| void | SetTraceContextIdentifier (unsigned id) |
| void | GetTraceContextIdentifier (PObject &obj) |
| void | GetTraceContextIdentifier (PObject *obj) |
| void | SetTraceContextIdentifier (const PObject &obj) |
| void | SetTraceContextIdentifier (const PObject *obj) |
| virtual | ~PObject () |
| virtual PObject * | Clone () const |
| Create a copy of the class on the heap. More... | |
| template<class CLS > | |
| CLS * | CloneAs () const |
| As for Clone() but converts to specified type. More... | |
| virtual PINDEX | HashFunction () const |
This function yields a hash value required by the PDictionary class. More... | |
| virtual Comparison | Compare (const PObject &obj) const |
| Compare the two objects and return their relative rank. More... | |
| virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const |
| Determine the byte wise comparison of two objects. More... | |
| bool | operator== (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator!= (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator< (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator> (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator<= (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator>= (const PObject &obj) const |
| Compare the two objects. More... | |
| virtual const char * | GetClass (unsigned ancestor=0) const |
| Get the current dynamic type of the object instance. More... | |
| PBoolean | IsClass (const char *cls) const |
| virtual PBoolean | InternalIsDescendant (const char *clsName) const |
| Determine if the dynamic type of the current instance is a descendent of the specified class. More... | |
| __inline const PObject * | PTraceObjectInstance () const |
| virtual void | PrintOn (ostream &strm) const |
| Output the contents of the object to the stream. More... | |
| virtual void | ReadFrom (istream &strm) |
| Input the contents of the object from the stream. More... | |
Protected Attributes | |
| struct ldap * | ldapContext |
| int | errorNumber |
| unsigned | protocolVersion |
| PString | defaultBaseDN |
| unsigned | searchLimit |
| PTimeInterval | timeout |
| PString | multipleValueSeparator |
Protected Attributes inherited from PObject | |
| unsigned | m_traceContextIdentifier |
Additional Inherited Members | |
Static Public Member Functions inherited from PObject | |
| static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
| Internal function caled from CompareObjectMemoryDirect() More... | |
| static const char * | Class () |
| Get the name of the class as a C string. More... | |
| static __inline const PObject * | PTraceObjectInstance (const char *) |
| static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
Protected Member Functions inherited from PObject | |
| PObject () | |
| Constructor for PObject, made protected so cannot ever create one on its own. More... | |
Friends inherited from PObject | |
This class will create an LDAP client to access a remote LDAP server.
| PLDAPSession::PLDAPSession | ( | const PString & | defaultBaseDN = PString::Empty() | ) |
Create a LDAP client.
| PLDAPSession::~PLDAPSession | ( | ) |
Close the sesison on destruction.
Add a new distringuished name to LDAP dirctory.
| PBoolean PLDAPSession::Add | ( | const PString & | dn, |
| const PStringToString & | attributes | ||
| ) |
Add a new distringuished name to LDAP dirctory.
| PBoolean PLDAPSession::Add | ( | const PString & | dn, |
| const PStringArray & | attributes | ||
| ) |
Add a new distringuished name to LDAP dirctory.
The attributes list is a string array of the form attr=value
| PBoolean PLDAPSession::Add | ( | const PString & | dn, |
| const PLDAPStructBase & | data | ||
| ) |
Add a new distringuished name to LDAP dirctory.
The attributes list is a string array of the form attr=value
| PBoolean PLDAPSession::Bind | ( | const PString & | who = PString::Empty(), |
| const PString & | passwd = PString::Empty(), |
||
| AuthenticationMethod | authMethod = AuthSimple |
||
| ) |
Bind to the remote LDAP server.
| PBoolean PLDAPSession::Close | ( | ) |
Close the LDAP session.
Delete the distinguished name from LDAP directory.
|
inline |
Set the default base DN for use if not specified for searches.
References defaultBaseDN.
|
inline |
Get the last OpenLDAP error code.
References errorNumber.
| PString PLDAPSession::GetErrorText | ( | ) | const |
Get the last OpenLDAP error as text string.
| PBoolean PLDAPSession::GetNextSearchResult | ( | SearchContext & | context | ) |
Get the next search result.
|
inlineread |
Get the OpenLDAP context structure.
References ldapContext.
| PBoolean PLDAPSession::GetSearchResult | ( | SearchContext & | context, |
| PStringToString & | data | ||
| ) |
Get the current search result entry.
| PBoolean PLDAPSession::GetSearchResult | ( | SearchContext & | context, |
| const PString & | attribute, | ||
| PString & | data | ||
| ) |
Get an attribute of the current search result entry.
| PBoolean PLDAPSession::GetSearchResult | ( | SearchContext & | context, |
| const PString & | attribute, | ||
| PStringArray & | data | ||
| ) |
Get an attribute of the current search result entry.
| PBoolean PLDAPSession::GetSearchResult | ( | SearchContext & | context, |
| const PString & | attribute, | ||
| PArray< PBYTEArray > & | data | ||
| ) |
Get an attribute of the current search result entry.
| PBoolean PLDAPSession::GetSearchResult | ( | SearchContext & | context, |
| PLDAPStructBase & | data | ||
| ) |
Get all attributes of the current search result entry.
| PString PLDAPSession::GetSearchResultDN | ( | SearchContext & | context | ) |
Get the current search result distinguished name entry.
|
inline |
Get the timeout for LDAP operations.
References timeout.
|
inline |
Determine of session is open.
References ldapContext.
Modify an existing distringuished name to LDAP dirctory.
| PBoolean PLDAPSession::Modify | ( | const PString & | dn, |
| const PStringToString & | attributes | ||
| ) |
Add a new distringuished name to LDAP dirctory.
| PBoolean PLDAPSession::Modify | ( | const PString & | dn, |
| const PStringArray & | attributes | ||
| ) |
Add a new distringuished name to LDAP dirctory.
The attributes list is a string array of the form attr=value
| PBoolean PLDAPSession::Modify | ( | const PString & | dn, |
| const PLDAPStructBase & | data | ||
| ) |
Add a new distringuished name to LDAP dirctory.
The attributes list is a string array of the form attr=value
Open the LDAP session to the specified server.
The server name string is of the form hostip[:port] where hostip is a host name or IP address and the :port is an optional port number. If not present then the port variable is used. If that is also zero then the default port of 369 is used.
| PBoolean PLDAPSession::Search | ( | SearchContext & | context, |
| const PString & | filter, | ||
| const PStringArray & | attributes = PStringList(), |
||
| const PString & | base = PString::Empty(), |
||
| SearchScope | scope = ScopeSubTree |
||
| ) |
Start search for specified information.
| PList<PStringToString> PLDAPSession::Search | ( | const PString & | filter, |
| const PStringArray & | attributes = PStringList(), |
||
| const PString & | base = PString::Empty(), |
||
| SearchScope | scope = ScopeSubTree |
||
| ) |
Search for specified information, returning all matches.
This can be used for simple LDAP databases where all attributes are represented by a string.
|
inline |
Set the default base DN for use if not specified for searches.
References defaultBaseDN.
| PBoolean PLDAPSession::SetOption | ( | int | optcode, |
| int | value | ||
| ) |
Set LDAP option parameter (OpenLDAp specific values)
| PBoolean PLDAPSession::SetOption | ( | int | optcode, |
| void * | value | ||
| ) |
Set LDAP option parameter (OpenLDAP specific values)
|
inline |
Set a limit on the number of results to return.
References searchLimit.
|
inline |
Set the timeout for LDAP operations.
References timeout.
| PBoolean PLDAPSession::StartTLS | ( | ) |
Start encrypted connection.
|
protected |
Referenced by GetBaseDN(), and SetBaseDN().
|
protected |
Referenced by GetErrorNumber().
|
protected |
Referenced by GetOpenLDAP(), and IsOpen().
|
protected |
|
protected |
|
protected |
Referenced by SetSearchLimit().
|
protected |
Referenced by GetTimeout(), and SetTimeout().