Thread-safe DB

Collaboration diagram for Thread-safe DB:

Classes

class  protlib::tsdb
 Thread-safe DB. More...

Namespaces

namespace  protlib

Functions

static void protlib::tsdb::init (bool noresolving=false)
 initialize netdb
static void protlib::tsdb::end ()
 cleanup netdb resources
static uint32 protlib::tsdb::get_new_id32 ()
 get new 32bit-ID
static uint64 protlib::tsdb::get_new_id64 ()
 get new 64bit-ID
static string protlib::tsdb::getprotobynumber (protocol_t proto, bool *res=NULL)
 get protocol name by number
static protocol_t protlib::tsdb::getprotobyname (const string &pname, bool *res=NULL)
 get protocol number by name
static protocol_t protlib::tsdb::getprotobyname (const char *pname, bool *res=NULL)
 get protocol number by name
static string protlib::tsdb::get_username (uid_t uid, bool *res=NULL)
 get user name
static uid_t protlib::tsdb::get_userid (const char *uname, bool *res=NULL)
 get user ID
static uid_t protlib::tsdb::get_userid (const string &uname, bool *res=NULL)
 get user ID
static string protlib::tsdb::get_portname (port_t port, protocol_t prot, bool *res=NULL)
 get port name
static port_t protlib::tsdb::get_portnumber (const char *pname, protocol_t prot, bool *res=NULL)
 get port number
static port_t protlib::tsdb::get_portnumber (const string &pname, protocol_t prot, bool *res=NULL)
 get port number
static string protlib::tsdb::get_hostname (const struct sockaddr *sa, bool *res)
 lookup host name
static string protlib::tsdb::get_hostname (const in_addr &in, bool *res=NULL)
static string protlib::tsdb::get_hostname (const in6_addr &in, bool *res=NULL)

Variables

static uint32 protlib::tsdb::id32 = 1
 last used IDs
static uint64 protlib::tsdb::id64 = 1
static bool protlib::tsdb::is_init = false
 init state
static bool protlib::tsdb::resolvenames = true
 enable/disable name resolving via DNS
static pthread_mutex_t protlib::tsdb::mutex
 netdb mutex
static protocol_t protlib::tsdb::udp_id = 17
static protocol_t protlib::tsdb::tcp_id = 6
static protocol_t protlib::tsdb::sctp_id = 132

Function Documentation

void protlib::tsdb::end (  )  [static, inherited]

cleanup netdb resources

Definition at line 94 of file threadsafe_db.cpp.

References protlib::log::ERROR_LOG, protlib::tsdb::is_init, Log, protlib::log::LOG_NORMAL, and protlib::tsdb::mutex.

Referenced by ariba::transport::tcpip::stop().

string protlib::tsdb::get_hostname ( const in6_addr &  in,
bool *  res = NULL 
) [static, inherited]

lookup of hostname for ipv6 address

Parameters:
in ipv6 address structure
res returns true if name lookup was successful, otherwise false
Returns:
in case that resolving is enabled it returns the host name corresponding to the given address or "UNKNOWN", otherwise it returns "disabled"

Definition at line 344 of file threadsafe_db.cpp.

References protlib::tsdb::get_hostname().

string protlib::tsdb::get_hostname ( const in_addr &  in,
bool *  res = NULL 
) [static, inherited]

lookup of hostname for an ipv4 address

Parameters:
in ipv4 address structure
res returns true if name lookup was successful, otherwise false
Returns:
in case that resolving is enabled it returns the host name corresponding to the given address or "UNKNOWN", otherwise it returns "disabled"

Definition at line 326 of file threadsafe_db.cpp.

References protlib::tsdb::get_hostname().

string protlib::tsdb::get_hostname ( const struct sockaddr *  sa,
bool *  res 
) [static, inherited]

uint32 protlib::tsdb::get_new_id32 (  )  [static, inherited]

uint64 protlib::tsdb::get_new_id64 (  )  [static, inherited]

string protlib::tsdb::get_portname ( port_t  port,
protocol_t  prot,
bool *  res = NULL 
) [static, inherited]

port_t protlib::tsdb::get_portnumber ( const string &  pname,
protocol_t  prot,
bool *  res = NULL 
) [static, inherited]

get port number

Definition at line 261 of file threadsafe_db.cpp.

References protlib::tsdb::get_portnumber().

port_t protlib::tsdb::get_portnumber ( const char *  pname,
protocol_t  prot,
bool *  res = NULL 
) [static, inherited]

uid_t protlib::tsdb::get_userid ( const string &  uname,
bool *  res = NULL 
) [static, inherited]

get user ID

Definition at line 208 of file threadsafe_db.cpp.

References protlib::tsdb::get_userid().

uid_t protlib::tsdb::get_userid ( const char *  uname,
bool *  res = NULL 
) [static, inherited]

string protlib::tsdb::get_username ( uid_t  uid,
bool *  res = NULL 
) [static, inherited]

protocol_t protlib::tsdb::getprotobyname ( const char *  pname,
bool *  res = NULL 
) [static, inherited]

protocol_t protlib::tsdb::getprotobyname ( const string &  pname,
bool *  res = NULL 
) [static, inherited]

string protlib::tsdb::getprotobynumber ( protocol_t  proto,
bool *  res = NULL 
) [static, inherited]

void protlib::tsdb::init ( bool  noresolving = false  )  [static, inherited]


Variable Documentation

uint32 protlib::tsdb::id32 = 1 [static, private, inherited]

last used IDs

Definition at line 70 of file threadsafe_db.h.

Referenced by protlib::tsdb::get_new_id32().

uint64 protlib::tsdb::id64 = 1 [static, private, inherited]

Definition at line 71 of file threadsafe_db.h.

Referenced by protlib::tsdb::get_new_id64().

bool protlib::tsdb::is_init = false [static, private, inherited]

pthread_mutex_t protlib::tsdb::mutex [static, private, inherited]

bool protlib::tsdb::resolvenames = true [static, private, inherited]

enable/disable name resolving via DNS

Definition at line 64 of file threadsafe_db.h.

Referenced by protlib::tsdb::get_hostname(), and protlib::tsdb::init().

protocol_t protlib::tsdb::sctp_id = 132 [static, private, inherited]

Definition at line 77 of file threadsafe_db.h.

Referenced by protlib::tsdb::get_sctp_id(), and protlib::tsdb::init().

protocol_t protlib::tsdb::tcp_id = 6 [static, private, inherited]

Definition at line 76 of file threadsafe_db.h.

Referenced by protlib::tsdb::get_tcp_id(), and protlib::tsdb::init().

protocol_t protlib::tsdb::udp_id = 17 [static, private, inherited]

Definition at line 75 of file threadsafe_db.h.

Referenced by protlib::tsdb::get_udp_id(), and protlib::tsdb::init().


Generated on Fri Aug 14 23:38:37 2009 for Ariba by  doxygen 1.5.8