Functions | Variables

modules_k/usrloc/dlist.c File Reference

USRLOC - List of registered domains

More...

#include "dlist.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "../../ut.h"
#include "../../lib/srdb1/db_ut.h"
#include "../../mem/shm_mem.h"
#include "../../dprint.h"
#include "../../ip_addr.h"
#include "../../socket_info.h"
#include "udomain.h"
#include "usrloc.h"
#include "utime.h"
#include "ul_mod.h"
Include dependency graph for modules_k/usrloc/dlist.c:

Go to the source code of this file.

Functions

Variables


Detailed Description

Definition in file modules_k/usrloc/dlist.c.


Function Documentation

static int find_dlist ( str _n,
dlist_t **  _d 
) [inline, static]
Parameters:
_n domain name
_d pointer to domain
Returns:
0 if the domain was found and 1 of not

Definition at line 64 of file modules_k/usrloc/dlist.c.

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

Referenced by find_domain(), get_udomain(), and register_udomain().

Here is the caller graph for this function:

int find_domain ( str _d,
udomain_t **  _p 
)
Parameters:
_d domain name
_p pointer to domain if found
Returns:
1 if domain was found, 0 otherwise

Definition at line 633 of file modules_k/usrloc/dlist.c.

static int get_all_db_ucontacts ( void *  buf,
int  len,
unsigned int  flags,
unsigned int  part_idx,
unsigned int  part_max 
) [inline, static]
See also:
get_all_ucontacts
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 93 of file modules_k/usrloc/dlist.c.

References contact_col, dlist::d, db_time2str(), expires_col, _str::len, udomain::name, dlist::next, parse_phostport(), path_col, received_col, RES_ROW_N, RES_ROWS, ROW_VALUES, _str::s, sock_col, VAL_BITMAP, VAL_NULL, and VAL_STRING.

Referenced by get_all_ucontacts().

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_all_mem_ucontacts ( void *  buf,
int  len,
unsigned int  flags,
unsigned int  part_idx,
unsigned int  part_max 
) [inline, static]
See also:
get_all_ucontacts
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 263 of file modules_k/usrloc/dlist.c.

References ucontact::c, ucontact::cflags, urecord::contacts, dlist::d, _str::len, lock_ulslot(), ucontact::next, urecord::next, dlist::next, ucontact::path, ucontact::received, _str::s, udomain::size, ucontact::sock, udomain::table, and unlock_ulslot().

Referenced by get_all_ucontacts().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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 398 of file modules_k/usrloc/dlist.c.

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

Here is the call graph for this function:

unsigned long get_number_of_users ( void   ) 
Returns:
the number of users, could be zero

Definition at line 586 of file modules_k/usrloc/dlist.c.

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

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

Find and return usrloc domain.

Find and return a usrloc domain (location table)

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

Definition at line 462 of file modules_k/usrloc/dlist.c.

References dlist::d, find_dlist(), _str::len, and _str::s.

Here is the call graph for this function:

static int new_dlist ( str _n,
dlist_t **  _d 
) [inline, static]
Returns:
0 if everything went OK, otherwise value < 0 is returned
Note:
The structure is NOT created in shared memory so the function must be called before the server forks if it should be available to all processes

Definition at line 417 of file modules_k/usrloc/dlist.c.

References dlist::d, _str::len, dlist::name, new_udomain(), and _str::s.

Referenced by register_udomain().

Here is the call graph for this function:

Here is the caller graph for this function:

void print_all_udomains ( FILE *  _f  ) 
Parameters:
_f output file

Definition at line 567 of file modules_k/usrloc/dlist.c.

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

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 488 of file modules_k/usrloc/dlist.c.

References dlist::d, db_check_table_version(), db_mode, find_dlist(), free_udomain(), _str::len, dlist::name, new_dlist(), dlist::next, NO_DB, _str::s, and testdb_udomain().

Here is the call graph for this function:

int synchronize_all_udomains ( int  istart,
int  istep 
)
Returns:
0 if all timer return 0, != 0 otherwise

Definition at line 608 of file modules_k/usrloc/dlist.c.

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

Here is the call graph for this function: