ul_mi.c File Reference

USRLOC - Usrloc MI functions

More...

#include <string.h>
#include <stdio.h>
#include "../../mi/mi.h"
#include "../../dprint.h"
#include "../../ut.h"
#include "../../qvalue.h"
#include "../../ip_addr.h"
#include "ul_mi.h"
#include "dlist.h"
#include "udomain.h"
#include "utime.h"
#include "ul_mod.h"

Include dependency graph for ul_mi.c:

Go to the source code of this file.

Defines

#define MI_UL_CSEQ   1

Functions

static int mi_add_aor_node (struct mi_node *parent, urecord_t *r, time_t t, int short_dump)
 Add a node for a address of record.
static udomain_tmi_find_domain (str *table)
 Search a domain in the global domain list.
static int mi_fix_aor (str *aor)
 Convert address of record.
struct mi_rootmi_usrloc_add (struct mi_root *cmd, void *param)
 Add a new contact for an address of record.
struct mi_rootmi_usrloc_dump (struct mi_root *cmd, void *param)
 Dump the content of the usrloc.
struct mi_rootmi_usrloc_flush (struct mi_root *cmd, void *param)
 Flush the usrloc memory cache to DB.
struct mi_rootmi_usrloc_rm_aor (struct mi_root *cmd, void *param)
 Delete a address of record including its contacts.
struct mi_rootmi_usrloc_rm_contact (struct mi_root *cmd, void *param)
 Delete a contact from an AOR record.
struct mi_rootmi_usrloc_show_contact (struct mi_root *cmd, void *param)
 Dumps the contacts of an AOR.

Variables

static str mi_ul_cid = str_init("dfjrewr12386fd6-343@openser.mi")
static str mi_ul_ua = str_init("Kamailio MI Server")


Detailed Description

USRLOC - Usrloc MI functions

Definition in file ul_mi.c.


Define Documentation

#define MI_UL_CSEQ   1

CSEQ nr used

Definition at line 50 of file ul_mi.c.

Referenced by mi_usrloc_add(), and mi_usrloc_rm_contact().


Function Documentation

static int mi_add_aor_node ( struct mi_node parent,
urecord_t r,
time_t  t,
int  short_dump 
) [inline, static]

Add a node for a address of record.

Parameters:
parent parent node
r printed record
t actual time
short_dump 0 means that all informations will be included, 1 that only the AOR is printed
Returns:
0 on success, -1 on failure

Definition at line 111 of file ul_mi.c.

References add_mi_attr(), add_mi_node_child(), urecord::aor, ucontact::c, ucontact::callid, ucontact::cflags, urecord::contacts, CS_DIRTY, CS_NEW, CS_SYNC, ucontact::cseq, ucontact::expires, ucontact::flags, int2str(), _str::len, len, ucontact::methods, MI_DUP_VALUE, ucontact::next, ucontact::path, ucontact::q, q2str(), ucontact::received, _str::s, ucontact::sock, socket_info::sock_str, ucontact::state, UL_EXPIRED_TIME, and ucontact::user_agent.

Referenced by mi_usrloc_dump().

static udomain_t* mi_find_domain ( str table  )  [inline, static]

Search a domain in the global domain list.

Parameters:
table domain (table) name
Returns:
pointer to domain if found, 0 if not found

Definition at line 64 of file ul_mi.c.

References dlist::d, _str::len, dlist::name, dlist::next, root, and _str::s.

Referenced by mi_usrloc_add(), mi_usrloc_rm_aor(), mi_usrloc_rm_contact(), and mi_usrloc_show_contact().

static int mi_fix_aor ( str aor  )  [inline, static]

Convert address of record.

Convert an address of record string to lower case, and truncate it when use_domain is not set.

Parameters:
aor address of record
Returns:
0 on success, -1 on error

Definition at line 85 of file ul_mi.c.

References _str::len, NULL, _str::s, strlower(), and use_domain.

Referenced by mi_usrloc_add(), mi_usrloc_rm_aor(), mi_usrloc_rm_contact(), and mi_usrloc_show_contact().

struct mi_root* mi_usrloc_add ( struct mi_root cmd,
void *  param 
) [read]

struct mi_root* mi_usrloc_dump ( struct mi_root cmd,
void *  param 
) [read]

struct mi_root* mi_usrloc_flush ( struct mi_root cmd,
void *  param 
) [read]

Flush the usrloc memory cache to DB.

Parameters:
cmd mi_root containing the parameter
param not used
Returns:
mi_root with the result or 0 on failure

Definition at line 429 of file ul_mi.c.

References init_mi_tree(), MI_OK_LEN, MI_OK_S, NULL, and synchronize_all_udomains().

struct mi_root* mi_usrloc_rm_aor ( struct mi_root cmd,
void *  param 
) [read]

Delete a address of record including its contacts.

Parameters:
cmd mi_root containing the parameter
param not used
Note:
expects 2 nodes: the table name and the AOR
Returns:
mi_root with the result

Definition at line 244 of file ul_mi.c.

References delete_urecord(), init_mi_tree(), mi_node::kids, lock_udomain(), mi_find_domain(), mi_fix_aor(), MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, mi_node::next, mi_root::node, NULL, unlock_udomain(), and mi_node::value.

struct mi_root* mi_usrloc_rm_contact ( struct mi_root cmd,
void *  param 
) [read]

Delete a contact from an AOR record.

Parameters:
cmd mi_root containing the parameter
param not used
Note:
expects 3 nodes: the table name, the AOR and contact
Returns:
mi_root with the result or 0 on failure

Definition at line 282 of file ul_mi.c.

References delete_ucontact(), get_ucontact(), get_urecord(), init_mi_tree(), mi_node::kids, lock_udomain(), mi_find_domain(), mi_fix_aor(), MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, MI_UL_CSEQ, mi_node::next, mi_root::node, NULL, release_urecord(), unlock_udomain(), and mi_node::value.

struct mi_root* mi_usrloc_show_contact ( struct mi_root cmd,
void *  param 
) [read]


Variable Documentation

str mi_ul_cid = str_init("dfjrewr12386fd6-343@openser.mi") [static]

call-id used for ul_add and ul_rm_contact

Definition at line 52 of file ul_mi.c.

str mi_ul_ua = str_init("Kamailio MI Server") [static]

user agent used for ul_add

Definition at line 54 of file ul_mi.c.


Generated on Thu May 24 22:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6