src/v2l_vcard.c File Reference

XML vCard's to/from LDAP objects translation functions. Implementation. More...

#include <stdlib.h>
#include <jabberd.h>
#include <v2l_vcard.h>

Include dependency graph for v2l_vcard.c:

Go to the source code of this file.

Data Structures

struct  v2l_vCardItem
 vCard template item. SLL. All of relations tag<->LDAP attr read from template More...

Defines

#define LOG_ERROR_MEM   log_error (ZONE, "Unable to allocate memory")

Functions

static v2l_vCardItem_v2l_vcard_map (v2l_Config *self)
static int _v2l_create_fn (xmlnode vcard)
static v2l_LdapRequest_v2l_set_sn12 (v2l_LdapRequest *req)
static xmlnode _v2l_ldap2vcard_generic (v2l_vCardItem *item, const char **vals, xmlnode res)
static v2l_LdapRequest_v2l_vcard2ldap_generic (v2l_vCardItem *item, xmlnode data, v2l_LdapRequest *req)
static v2l_vCardItem_v2l_vcard_find_attr (v2l_vCardItem *item, const char *attr)
static int _v2l_vcard_attr_match (const char *attr, void **shrdata)
static void _v2l_vcard_attr_value (const char *attr, const char **vals, void *pointer, void *shrdata)
xmlnode v2l_vcard_get (v2l_Config *self, v2l_LdapConn *curr_conn)
int v2l_vcard_set (v2l_Config *self, v2l_LdapConn *curr_conn, xmlnode data)

Variables

static const char * _V2L_MAP_VCARD []


Detailed Description

XML vCard's to/from LDAP objects translation functions. Implementation.

Definition in file v2l_vcard.c.


Function Documentation

static int _v2l_create_fn ( xmlnode  vcard  )  [static]

Creates the FN tag Creates FN tag from GIVEN and FAMILY tags.

Parameters:
vcard The vCard.
Returns:
1 if no error, otherwise 0.

Definition at line 427 of file v2l_vcard.c.

References LOG_ERROR_MEM.

Referenced by v2l_vcard_get().

Here is the caller graph for this function:

static xmlnode _v2l_ldap2vcard_generic ( v2l_vCardItem item,
const char **  vals,
xmlnode  res 
) [static]

Map function from LDAP to XML vCard.

Parameters:
item Info about the tag (name, parent group and attribute associated)
vals array of values for the attribe.
[in,out] res The vCard, output is appended here.
Returns:
res + new tag or res if error.

Definition at line 477 of file v2l_vcard.c.

References v2l_vCardItem::group, and v2l_vCardItem::vcard.

Referenced by _v2l_vcard_attr_value().

Here is the caller graph for this function:

static v2l_LdapRequest * _v2l_set_sn12 ( v2l_LdapRequest req  )  [static]

Sets sn1 and sn2 from sn Hack. IrisPerson has two surnames: first surname and mother's maiden name. This function splits sn in two. Should be called when the list of request are complete and before program excutes them.

Parameters:
req The SLL of LDAP requests.

Definition at line 515 of file v2l_vcard.c.

References v2l_LdapRequest::attr, LOG_ERROR_MEM, v2l_LdapRequest::next, and v2l_add_attr_str().

Referenced by v2l_vcard_set().

Here is the call graph for this function:

Here is the caller graph for this function:

static v2l_LdapRequest * _v2l_vcard2ldap_generic ( v2l_vCardItem item,
xmlnode  data,
v2l_LdapRequest req 
) [static]

Map function from XML Vcard to LDAP.

Parameters:
item Info about the tag (name, parent group and attribute associated)
data Thhe vCard.
[in,out] req List of requests, the new request is appended here.
Returns:
req + new request or req if error.

Definition at line 504 of file v2l_vcard.c.

References v2l_vCardItem::ldap, and v2l_add_attr_str().

Referenced by v2l_vcard_set().

Here is the call graph for this function:

Here is the caller graph for this function:

static int _v2l_vcard_attr_match ( const char *  attr,
void **  shrdata 
) [static]

Is LDAP object attribute linked to any tag? Utility function.

Parameters:
attr The attribute.
[out] shrdata Contents the address of any map's node. NULL if no match
Returns:
true if attr is linked to any tag, otherwise false

Definition at line 403 of file v2l_vcard.c.

References _v2l_vcard_find_attr(), and _v2l_vcard_map().

Referenced by v2l_vcard_get().

Here is the call graph for this function:

Here is the caller graph for this function:

static void _v2l_vcard_attr_value ( const char *  attr,
const char **  vals,
void *  pointer,
void *  shrdata 
) [static]

Function applied to all attrs. Utility function, walker function.

Parameters:
attr The attribute.
vals Values of attribute.
pointer Deferenced pointer to vCard.
shrdata Data shared with the match function.

Definition at line 411 of file v2l_vcard.c.

References _v2l_ldap2vcard_generic(), and v2l_vCardItem::vcard.

Referenced by v2l_vcard_get().

Here is the call graph for this function:

Here is the caller graph for this function:

static v2l_vCardItem * _v2l_vcard_find_attr ( v2l_vCardItem item,
const char *  attr 
) [static]

Finds tag linked to attr Parses the translation map since 'item' node.

Parameters:
item Where the search starts.
attr The attribute;
Returns:
node with tag<->attr association or NULL if error or not found.

Definition at line 384 of file v2l_vcard.c.

References v2l_vCardItem::ldap, and v2l_vCardItem::next.

Referenced by _v2l_vcard_attr_match().

Here is the caller graph for this function:

static v2l_vCardItem * _v2l_vcard_map ( v2l_Config self  )  [static]

Gets the translation map. If it is not initilized yet, the function reads the template from disk and sets the map.

Parameters:
self Module config, if map is initialized can be NULL.
Returns:
The map, NULL if error.

Definition at line 288 of file v2l_vcard.c.

References _V2L_MAP_VCARD, v2l_Config::confpath, v2l_vCardItem::group, v2l_vCardItem::ldap, v2l_vCardItem::next, v2l_Config::poolref, and v2l_vCardItem::vcard.

Referenced by _v2l_vcard_attr_match(), v2l_vcard_get(), and v2l_vcard_set().

Here is the caller graph for this function:

xmlnode v2l_vcard_get ( v2l_Config self,
v2l_LdapConn curr_conn 
)

Gets user vCard in xml format.

Parameters:
self Module config
curr_conn user connection.
Returns:
vCard main node, NULL if error.

Definition at line 177 of file v2l_vcard.c.

References _v2l_create_fn(), _v2l_vcard_attr_match(), _v2l_vcard_attr_value(), _v2l_vcard_map(), v2l_ldap_for_all_attrs(), v2l_ldap_get_entry(), and v2l_vCardItem::vcard.

Referenced by _v2l_packets_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

int v2l_vcard_set ( v2l_Config self,
v2l_LdapConn curr_conn,
xmlnode  data 
)

Writes vCard to user LDAP directory entry.

Parameters:
self Module config
curr_conn user connection.
data the vCard
Returns:
1 if no error, otherwise 0

Definition at line 230 of file v2l_vcard.c.

References _v2l_set_sn12(), _v2l_vcard2ldap_generic(), _v2l_vcard_map(), v2l_vCardItem::group, v2l_Config::irishack, v2l_vCardItem::next, v2l_request_record(), and v2l_vCardItem::vcard.

Referenced by _v2l_packets_handler().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* _V2L_MAP_VCARD[] [static]

List of all XML vCard tags supported

Definition at line 123 of file v2l_vcard.c.

Referenced by _v2l_vcard_map().


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