dlist.h File Reference

USRLOC - List of registered domains. More...

#include <stdio.h>
#include "udomain.h"
#include "../../str.h"

Include dependency graph for dlist.h:

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

Go to the source code of this file.

Data Structures

struct  dlist

Typedefs

typedef struct dlist dlist_t
typedef int(* get_all_ucontacts_t )(void *buf, int len, unsigned int flags, unsigned int part_idx, unsigned int part_max)
 Get all contacts from the usrloc, in partitions if wanted.
typedef int(* register_udomain_t )(const char *_n, udomain_t **_d)
 Registers a new domain with usrloc.

Functions

int find_domain (str *_d, udomain_t **_p)
 Find a particular domain, small wrapper around find_dlist.
void free_all_udomains (void)
 Free all allocated memory for domains.
int get_all_ucontacts (void *, int, unsigned int, unsigned int part_idx, unsigned int part_max)
 Get all contacts from the usrloc, in partitions if wanted.
unsigned long get_number_of_users (void)
 Loops through all domains summing up the number of users.
void print_all_udomains (FILE *_f)
 Print all domains, just for debugging.
int register_udomain (const char *_n, udomain_t **_d)
 Registers a new domain with usrloc.
int synchronize_all_udomains (void)
 Run timer handler of all domains.

Variables

dlist_troot
 Global list of all registered domains.


Detailed Description

USRLOC - List of registered domains.

Definition in file dlist.h.


Typedef Documentation

typedef struct dlist dlist_t

List of all domains registered with usrloc

typedef int(* get_all_ucontacts_t)(void *buf, int len, unsigned int flags, unsigned int part_idx, unsigned int part_max)

Get all contacts from the usrloc, in partitions if wanted.

Return list of all contacts for all currently registered users in all domains. The caller must provide buffer of sufficient length for fitting all those contacts. In the case when buffer was exhausted, the function returns estimated amount of additional space needed, in this case the caller is expected to repeat the call using this value as the hint.

Information is packed into the buffer as follows:

+------------+----------+-----+------+-----+ |contact1.len|contact1.s|sock1|flags1|path1| +------------+----------+-----+------+-----+ |contact2.len|contact2.s|sock2|flags2|path1| +------------+----------+-----+------+-----+ |..........................................| +------------+----------+-----+------+-----+ |contactN.len|contactN.s|sockN|flagsN|pathN| +------------+----------+-----+------+-----+ |000000000000| +------------+

Parameters:
buf target buffer
len length of buffer
flags contact flags
part_idx part index
part_max maximal part
Returns:
0 on success, positive if buffer size was not sufficient, negative on failure

Definition at line 122 of file dlist.h.

typedef int(* register_udomain_t)(const char *_n, udomain_t **_d)

Registers a new domain with usrloc.

Registers a new domain with usrloc. If the domain exists, a pointer to existing structure will be returned, otherwise a new domain will be created

Parameters:
_n domain name
_d new created domain
Returns:
0 on success, -1 on failure

Definition at line 66 of file dlist.h.


Function Documentation

int find_domain ( str _d,
udomain_t **  _p 
)

Find a particular domain, small wrapper around find_dlist.

Parameters:
_d domain name
_p pointer to domain if found
Returns:
1 if domain was found, 0 otherwise

Definition at line 606 of file dlist.c.

References dlist::d, and find_dlist().

void free_all_udomains ( void   ) 

Free all allocated memory for domains.

Definition at line 521 of file dlist.c.

References dlist::d, free_udomain(), dlist::name, dlist::next, _str::s, and shm_free.

int get_all_ucontacts ( void *  buf,
int  len,
unsigned int  flags,
unsigned int  part_idx,
unsigned int  part_max 
)

Get all contacts from the usrloc, in partitions if wanted.

Return list of all contacts for all currently registered users in all domains. The caller must provide buffer of sufficient length for fitting all those contacts. In the case when buffer was exhausted, the function returns estimated amount of additional space needed, in this case the caller is expected to repeat the call using this value as the hint.

Information is packed into the buffer as follows:

+------------+----------+-----+------+-----+ |contact1.len|contact1.s|sock1|flags1|path1| +------------+----------+-----+------+-----+ |contact2.len|contact2.s|sock2|flags2|path1| +------------+----------+-----+------+-----+ |..........................................| +------------+----------+-----+------+-----+ |contactN.len|contactN.s|sockN|flagsN|pathN| +------------+----------+-----+------+-----+ |000000000000| +------------+

Parameters:
buf target buffer
len length of buffer
flags contact flags
part_idx part index
part_max maximal part
Returns:
0 on success, positive if buffer size was not sufficient, negative on failure

Definition at line 394 of file dlist.c.

References db_mode, DB_ONLY, get_all_db_ucontacts(), and get_all_mem_ucontacts().

Referenced by bind_usrloc().

unsigned long get_number_of_users ( void   ) 

Loops through all domains summing up the number of users.

Returns:
the number of users, could be zero

Definition at line 559 of file dlist.c.

References dlist::d, get_stat_val, dlist::next, and udomain::users.

void print_all_udomains ( FILE *  _f  ) 

Print all domains, just for debugging.

Parameters:
_f output file

Definition at line 540 of file dlist.c.

References dlist::d, dlist::next, and print_udomain().

int register_udomain ( const char *  _n,
udomain_t **  _d 
)

Registers a new domain with usrloc.

Registers a new domain with usrloc. If the domain exists, a pointer to existing structure will be returned, otherwise a new domain will be created

Parameters:
_n domain name
_d new created domain
Returns:
0 on success, -1 on failure

Definition at line 461 of file dlist.c.

References db_func::close, dlist::d, db_check_table_version(), db_mode, db_url, find_dlist(), free_udomain(), db_func::init, _str::len, LM_ERR, dlist::name, new_dlist(), dlist::next, NO_DB, _str::s, s, shm_free, testdb_udomain(), ul_dbf, UL_TABLE_VERSION, and ZSW.

Referenced by bind_usrloc().

int synchronize_all_udomains ( void   ) 

Run timer handler of all domains.

Returns:
0 if all timer return 0, != 0 otherwise

Definition at line 581 of file dlist.c.

References dlist::d, db_mode, DB_ONLY, db_timer_udomain(), get_act_time(), mem_timer_udomain(), and dlist::next.

Referenced by mi_usrloc_flush().


Variable Documentation

Global list of all registered domains.

Definition at line 54 of file dlist.c.


Generated on Tue May 22 16:00:39 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6