include/v2l_conn.h File Reference

Handling the LDAP directory. Low-level tier. More...

#include <ldap.h>
#include <time.h>
#include <v2l_config.h>

Include dependency graph for v2l_conn.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  v2l_LdapConn
 Simple Linked List of connections to LDAP directory. More...
struct  v2l_LdapRequest
 Request (SLL) for LDAP directory. More...
struct  v2l_LdapEvt
 LDAP environment. Control struct for perform operations on the LDAP directory and retrieve results. More...

Typedefs

typedef int(*) v2l_AttrMatchFunction (const char *attr, void **shrdata)
typedef void(*) v2l_AttrValueFunction (const char *attr, const char **vals, void *pointer, void *shrdata)

Functions

v2l_LdapConnv2l_get_conn (v2l_Config *self, const char *user)
v2l_LdapConnv2l_get_master_conn (v2l_Config *self)
void v2l_free_allconn (void)
v2l_LdapEvtv2l_ldap_get_entry (v2l_Config *self, v2l_LdapConn *curr_conn)
int v2l_request_record (v2l_Config *self, v2l_LdapConn *curr_conn, v2l_LdapRequest *req)
v2l_LdapRequestv2l_add_attr_str (v2l_LdapRequest *req, const char *attr, const char *str)
void v2l_ldap_for_all_attrs (v2l_AttrValueFunction value_func, v2l_AttrMatchFunction match_func, void *pointer, v2l_LdapEvt *evt_res)


Detailed Description

Handling the LDAP directory. Low-level tier.

Definition in file v2l_conn.h.


Typedef Documentation

typedef int(*) v2l_AttrMatchFunction(const char *attr, void **shrdata)

Match function type Generic attribute matching routine.

Parameters:
attr The attribute.
[out] shrdata Generic deferenced pointer. Shared data with 'value function'
See also:
v2l_AttrValueFunction

v2l_ldap_for_all_attrs

Returns:
true if matching, otherwise false.

Definition at line 69 of file v2l_conn.h.

typedef void(*) v2l_AttrValueFunction(const char *attr, const char **vals, void *pointer, void *shrdata)

Values read function type Generic values handling routine.

Parameters:
attr The attribute.
vals Values of attribute.
pointer Generic multipurpose pointer.
shrdata Shared data with 'match function'
See also:
v2l_MatchValueFunction

v2l_ldap_for_all_attrs

Definition at line 80 of file v2l_conn.h.


Function Documentation

v2l_LdapRequest* v2l_add_attr_str ( v2l_LdapRequest req,
const char *  attr,
const char *  str 
)

Adds a new request to the list.

Parameters:
req The list of requests.
attr attribute name.
str attribute value.
Returns:
The list of requests + the last added. The list of request if error.

Definition at line 381 of file v2l_conn.c.

References _v2l_add_attr().

Referenced by _v2l_set_sn12(), and _v2l_vcard2ldap_generic().

Here is the call graph for this function:

Here is the caller graph for this function:

void v2l_free_allconn ( void   ) 

Frees and closes all connections (ephemeral or not) If connections doesn't exist does nothing.

Postcondition:
self->master_conn closed. Connections list empty.

Definition at line 240 of file v2l_conn.c.

References _v2l_free_walker(), and V2L_CONN_LIST.

Referenced by v2l_config_shutdown().

Here is the call graph for this function:

Here is the caller graph for this function:

v2l_LdapConn* v2l_get_conn ( v2l_Config self,
const char *  user 
)

Gets a (ephemeral) connection by name. Creates one if doesn't exist.

Warning:
The name defined by V2L_ADMIN is reserved for master conn.
Precondition:
self is valid, user is not null and exists.
Postcondition:
ephermeral connection for user is open.
Parameters:
self Module config.
user the username
See also:
V2L_ADMIN

v2l_get_master_conn

Returns:
the connection if no error, otherwise NULL.

Definition at line 189 of file v2l_conn.c.

References _v2l_create_conn(), _v2l_ldap_get_credentials(), LOG_ERROR_MEM, and V2L_CONN_LIST.

Referenced by _v2l_packets_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

v2l_LdapConn* v2l_get_master_conn ( v2l_Config self  ) 

Gets a connection master connection. Creates one if doesn't exist.

Precondition:
self is valid
Postcondition:
master connection is open.
Parameters:
self Module config.
Returns:
the connection if no error, otherwise NULL.

Definition at line 233 of file v2l_conn.c.

References _v2l_create_conn(), v2l_Config::binddn, v2l_Config::bindpw, v2l_Config::host, v2l_Config::port, and V2L_ADMIN.

Referenced by v2l_config_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void v2l_ldap_for_all_attrs ( v2l_AttrValueFunction  value_func,
v2l_AttrMatchFunction  match_func,
void *  pointer,
v2l_LdapEvt evt_res 
)

Applies a function to all LDAP object attributes.

Precondition:
evt_res should be a valid entry (ie. result of a search in directory)
Parameters:
value_func Walker function.
match_func Match function. If returns true we'll call to value_func
pointer Generic multipurpose pointer. It will be passed to value_func
evt_res LDAP descriptor, control code and result.

Definition at line 419 of file v2l_conn.c.

References v2l_LdapEvt::ld, and v2l_LdapEvt::result.

Referenced by v2l_vcard_get().

Here is the caller graph for this function:

v2l_LdapEvt* v2l_ldap_get_entry ( v2l_Config self,
v2l_LdapConn curr_conn 
)

Retrieves an user entry from the LDAP directory.

Note:
Allocated memory must be freed by the caller.
Parameters:
self Module config
curr_conn user connection.
Returns:
evt_res LDAP descriptor, control code and result. NULL if error.

Definition at line 247 of file v2l_conn.c.

References _v2l_ldap_search(), _v2l_ldap_sync(), v2l_LdapConn::entry, v2l_LdapConn::ld, v2l_LdapEvt::ld, LOG_ERROR_MEM, v2l_LdapEvt::result, and v2l_Config::suffix.

Referenced by v2l_vcard_get().

Here is the call graph for this function:

Here is the caller graph for this function:

int v2l_request_record ( v2l_Config self,
v2l_LdapConn curr_conn,
v2l_LdapRequest req 
)

Executes a list of changes on the LDAP directory.

Precondition:
req is not NULL
Parameters:
self Module config
curr_conn The user connection.
req list of changes.
Returns:
1 if no error, otherwise 0

Definition at line 285 of file v2l_conn.c.

References _v2l_count_attrs(), _v2l_ldap_modify(), _v2l_ldap_sync(), v2l_LdapRequest::attr, v2l_LdapConn::binddn, v2l_LdapConn::ld, v2l_LdapEvt::ld, LOG_ERROR_MEM, v2l_LdapRequest::next, v2l_LdapEvt::rc, v2l_LdapEvt::result, and v2l_LdapConn::user.

Referenced by v2l_vcard_set().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Oct 7 14:38:18 2007 for vCard2LDAP by  doxygen 1.5.1