Anope IRC Services  Version 2.0
Public Types | Public Member Functions | Data Fields | Private Member Functions | Private Attributes
LDAPService Class Reference
Inheritance diagram for LDAPService:
Inheritance graph
[legend]
Collaboration diagram for LDAPService:
Collaboration graph
[legend]

Public Types

typedef std::map< LDAPQuery,
std::pair< time_t,
LDAPInterface * > > 
query_queue
 
typedef std::vector< std::pair
< LDAPInterface *, LDAPResult * > > 
result_queue
 

Public Member Functions

 LDAPService (Module *o, const Anope::string &n, const Anope::string &s, int po, const Anope::string &b, const Anope::string &p, time_t t)
 
 ~LDAPService ()
 
LDAPQuery BindAsAdmin (LDAPInterface *i)
 
LDAPQuery Bind (LDAPInterface *i, const Anope::string &who, const Anope::string &pass) anope_override
 
LDAPQuery Search (LDAPInterface *i, const Anope::string &base, const Anope::string &filter) anope_override
 
LDAPQuery Add (LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) anope_override
 
LDAPQuery Del (LDAPInterface *i, const Anope::string &dn) anope_override
 
LDAPQuery Modify (LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) anope_override
 
void Run () anope_override
 
- Public Member Functions inherited from LDAPProvider
 LDAPProvider (Module *c, const Anope::string &n)
 
- Public Member Functions inherited from Service
 Service (Module *o, const Anope::string &t, const Anope::string &n)
 
virtual ~Service ()
 
void Register ()
 
void Unregister ()
 
- Public Member Functions inherited from Base
 Base ()
 
virtual ~Base ()
 
void AddReference (ReferenceBase *r)
 
void DelReference (ReferenceBase *r)
 
- Public Member Functions inherited from Thread
 Thread ()
 
virtual ~Thread ()
 
void Join ()
 
void SetExitState ()
 
void Exit ()
 
void Start ()
 
bool GetExitState () const
 
void OnNotify ()
 
- Public Member Functions inherited from Pipe
 Pipe ()
 
 ~Pipe ()
 
bool ProcessRead () anope_override
 
void Write (const char *data, size_t sz)
 
void Write (const Anope::string &data)
 
int Read (char *data, size_t sz)
 
bool SetWriteBlocking (bool state)
 
void Notify ()
 
- Public Member Functions inherited from Socket
 Socket ()
 
 Socket (int sock, bool ipv6=false, int type=SOCK_STREAM)
 
virtual ~Socket ()
 
int GetFD () const
 
bool IsIPv6 () const
 
bool SetBlocking (bool state)
 
void Bind (const Anope::string &ip, int port=0)
 
virtual bool Process ()
 
virtual bool ProcessWrite ()
 
virtual void ProcessError ()
 
- Public Member Functions inherited from Extensible
virtual ~Extensible ()
 
template<typename T >
T * GetExt (const Anope::string &name) const
 
bool HasExt (const Anope::string &name) const
 
template<typename T >
T * Extend (const Anope::string &name, const T &what)
 
template<typename T >
T * Extend (const Anope::string &name)
 
template<typename T >
T * Require (const Anope::string &name)
 
template<typename T >
void Shrink (const Anope::string &name)
 
template<>
bool * Extend (const Anope::string &name, const bool &what)
 
- Public Member Functions inherited from Condition
 Condition ()
 
 ~Condition ()
 
void Wakeup ()
 
void Wait ()
 
- Public Member Functions inherited from Mutex
 Mutex ()
 
 ~Mutex ()
 
void Lock ()
 
void Unlock ()
 
bool TryLock ()
 

Data Fields

query_queue queries
 
result_queue results
 
- Data Fields inherited from Service
Moduleowner
 
Anope::string type
 
Anope::string name
 
- Data Fields inherited from Thread
pthread_t handle
 
- Data Fields inherited from Pipe
int write_pipe
 
- Data Fields inherited from Socket
std::bitset< SF_SIZEflags
 
sockaddrs bindaddr
 
SocketIOio
 
- Data Fields inherited from Extensible
std::set< ExtensibleBase * > extension_items
 

Private Member Functions

LDAPMod ** BuildMods (const LDAPMods &attributes)
 
void FreeMods (LDAPMod **mods)
 
void Reconnect ()
 
void Timeout ()
 

Private Attributes

Anope::string server
 
int port
 
Anope::string admin_binddn
 
Anope::string admin_pass
 
time_t timeout
 
LDAP * con
 
time_t last_connect
 

Additional Inherited Members

- Static Public Member Functions inherited from Service
static ServiceFindService (const Anope::string &t, const Anope::string &n)
 
static std::vector< Anope::stringGetServiceKeys (const Anope::string &t)
 
static void AddAlias (const Anope::string &t, const Anope::string &n, const Anope::string &v)
 
static void DelAlias (const Anope::string &t, const Anope::string &n)
 
- Static Public Member Functions inherited from Extensible
static void ExtensibleSerialize (const Extensible *, const Serializable *, Serialize::Data &data)
 
static void ExtensibleUnserialize (Extensible *, Serializable *, Serialize::Data &data)
 
- Protected Attributes inherited from Socket
int sock
 
bool ipv6
 
- Protected Attributes inherited from Mutex
pthread_mutex_t mutex
 

Detailed Description

Definition at line 10 of file m_ldap.cpp.

Member Typedef Documentation

typedef std::map<LDAPQuery, std::pair<time_t, LDAPInterface *> > LDAPService::query_queue

Definition at line 75 of file m_ldap.cpp.

typedef std::vector<std::pair<LDAPInterface *, LDAPResult *> > LDAPService::result_queue

Definition at line 76 of file m_ldap.cpp.

Constructor & Destructor Documentation

LDAPService::LDAPService ( Module o,
const Anope::string n,
const Anope::string s,
int  po,
const Anope::string b,
const Anope::string p,
time_t  t 
)
inline

Definition at line 80 of file m_ldap.cpp.

References Anope::string::c_str(), and Service::name.

LDAPService::~LDAPService ( )
inline

Member Function Documentation

LDAPQuery LDAPService::Add ( LDAPInterface i,
const Anope::string dn,
LDAPMods attributes 
)
inlinevirtual

Add an entry to LDAP

Parameters
iThe LDAPInterface the result is sent to
dnThe dn of the entry to add
attributesThe attributes
Returns
The query ID

Implements LDAPProvider.

Definition at line 192 of file m_ldap.cpp.

References BuildMods(), Anope::CurTime, FreeMods(), Mutex::Lock(), Reconnect(), Mutex::Unlock(), and Condition::Wakeup().

LDAPQuery LDAPService::Bind ( LDAPInterface i,
const Anope::string who,
const Anope::string pass 
)
inlinevirtual

Bind to LDAP

Parameters
iThe LDAPInterface the result is sent to
whoThe binddn
passThe password
Returns
The query ID

Implements LDAPProvider.

Definition at line 135 of file m_ldap.cpp.

References Anope::CurTime, Mutex::Lock(), Reconnect(), Mutex::Unlock(), and Condition::Wakeup().

Referenced by BindAsAdmin().

LDAPQuery LDAPService::BindAsAdmin ( LDAPInterface i)
inlinevirtual

Attempt to bind to the LDAP server as an admin

Parameters
iThe LDAPInterface the result is sent to
Returns
The query ID

Implements LDAPProvider.

Definition at line 130 of file m_ldap.cpp.

References Bind().

LDAPMod** LDAPService::BuildMods ( const LDAPMods attributes)
inlineprivate
LDAPQuery LDAPService::Del ( LDAPInterface i,
const Anope::string dn 
)
inlinevirtual

Delete an entry from LDAP

Parameters
iThe LDAPInterface the result is sent to
dnThe dn of the entry to delete
Returns
The query ID

Implements LDAPProvider.

Definition at line 221 of file m_ldap.cpp.

References Anope::CurTime, Mutex::Lock(), Reconnect(), Mutex::Unlock(), and Condition::Wakeup().

void LDAPService::FreeMods ( LDAPMod **  mods)
inlineprivate

Definition at line 49 of file m_ldap.cpp.

Referenced by Add(), and Modify().

LDAPQuery LDAPService::Modify ( LDAPInterface i,
const Anope::string base,
LDAPMods attributes 
)
inlinevirtual

Modify an existing entry in LDAP

Parameters
iThe LDAPInterface the result is sent to
baseThe base DN to modify
attributesThe attributes to modify
Returns
The query ID

Implements LDAPProvider.

Definition at line 248 of file m_ldap.cpp.

References BuildMods(), Anope::CurTime, FreeMods(), Mutex::Lock(), Reconnect(), Mutex::Unlock(), and Condition::Wakeup().

void LDAPService::Reconnect ( )
inlineprivate

Definition at line 61 of file m_ldap.cpp.

References Anope::string::c_str(), Anope::CurTime, and Service::name.

Referenced by Add(), Bind(), Del(), Modify(), and Search().

void LDAPService::Run ( )
inlinevirtual
LDAPQuery LDAPService::Search ( LDAPInterface i,
const Anope::string base,
const Anope::string filter 
)
inlinevirtual

Search ldap for the specified filter

Parameters
iThe LDAPInterface the result is sent to
baseThe base DN to search
filterThe filter to apply
Returns
The query ID

Implements LDAPProvider.

Definition at line 166 of file m_ldap.cpp.

References Anope::CurTime, Mutex::Lock(), Reconnect(), Mutex::Unlock(), and Condition::Wakeup().

void LDAPService::Timeout ( )
inlineprivate

Field Documentation

Anope::string LDAPService::admin_binddn
private

Definition at line 14 of file m_ldap.cpp.

Anope::string LDAPService::admin_pass
private

Definition at line 15 of file m_ldap.cpp.

LDAP* LDAPService::con
private

Definition at line 18 of file m_ldap.cpp.

time_t LDAPService::last_connect
private

Definition at line 20 of file m_ldap.cpp.

int LDAPService::port
private

Definition at line 13 of file m_ldap.cpp.

query_queue LDAPService::queries

Definition at line 77 of file m_ldap.cpp.

Referenced by ModuleLDAP::OnModuleUnload().

result_queue LDAPService::results

Definition at line 78 of file m_ldap.cpp.

Referenced by ModuleLDAP::OnModuleUnload(), and ModuleLDAP::OnNotify().

Anope::string LDAPService::server
private

Definition at line 12 of file m_ldap.cpp.

time_t LDAPService::timeout
private

Definition at line 16 of file m_ldap.cpp.


The documentation for this class was generated from the following file: