SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
sipwitch::service Class Reference

System configuration instance and service functions. More...

#include <service.h>

Inheritance diagram for sipwitch::service:
Inheritance graph
[legend]
Collaboration diagram for sipwitch::service:
Collaboration graph
[legend]

Data Structures

class  callback
 Callback methods for objects managed under the service thread. More...
 
struct  define
 Keyword and value pair definition lists. More...
 
class  instance
 The current singleton instance of the active xml configuration tree. More...
 
class  keyclone
 Used to splice new chains onto an existing xml tree. More...
 
class  keymap
 Linked list of named xml node locations. More...
 
class  pointer
 A pointer to a subtree in the xml configuration tree. More...
 
class  usernode
 Pointer to a provisioned user xml subtree. More...
 

Public Types

enum  dialmode_t { EXT_DIALING, USER_DIALING, ALL_DIALING }
 Dialing mode supported. More...
 
typedef treemap< char * > keynode
 Definition of a xml node. More...
 

Public Member Functions

 service (const char *name, size_t s=0)
 
virtual ~service ()
 
bool load (FILE *file, keynode *node=NULL)
 Load xml file into xml tree. More...
 
keynodegetPath (const char *path)
 
keynodegetNode (keynode *base, const char *id, const char *value)
 
keynodeaddNode (keynode *base, define *defs)
 
keynodeaddNode (keynode *base, const char *id, const char *value)
 
keynodegetNode (keynode *base, const char *grp, const char *attr, const char *value)
 
keynodegetList (const char *path)
 
keynodegetRoot (void)
 
void setContact (const char *text)
 
virtual void dump (FILE *fp)
 
virtual void confirm (void)
 
void commit (void)
 

Static Public Member Functions

static LinkedObjectgetModules (void)
 
static LinkedObjectgetGenerics (void)
 
static void publish (const char *addr)
 Set and publish public "appearing" address of the server. More...
 
static void published (struct sockaddr_storage *peer)
 
static const char * getValue (keynode *base, const char *id)
 
static void dump (FILE *fp, keynode *node, unsigned level)
 
static void snapshot (void)
 
static void dumpfile (void)
 
static bool period (long slice)
 
static void result (const char *value)
 
static void startup (void)
 
static void shutdown (void)
 
static long uptime (void)
 
static bool match (const char *digits, const char *pattern, bool partial)
 
static keynodeget (void)
 
static keynodegetProtected (const char *path)
 
static keynodegetUser (const char *uid)
 
static keynodepath (const char *p)
 
static keynodelist (const char *p)
 
static keynodegetEnviron (void)
 
static string_t getContact (void)
 
static const char * getInterface (void)
 
static unsigned short getPort (void)
 
static bool check (void)
 
static void release (keynode *node)
 

Static Public Attributes

static volatile dialmode_t dialmode = service::ALL_DIALING
 

Protected Member Functions

void addAttributes (keynode *node, char *attrib)
 Add attributes in a XML entity as child nodes of the xml node. More...
 

Protected Attributes

keynode root
 
stringbuf< 1024 > buffer
 
LinkedObjectkeys [177]
 
const char * contact
 

Static Protected Attributes

static servicecfg = NULL
 
static condlock_t locking
 

Friends

class instance
 

Detailed Description

System configuration instance and service functions.

This provides an instance of a system configuration compiled from xml configs. There is an active instance which represents the current configuration, and a new instance can be created without stopping the server. This also provides high level service functions in the runtime library for the server and plugins to use. The xml tree nodes are stored in a paged allocator.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 78 of file service.h.

Member Typedef Documentation

typedef treemap<char *> sipwitch::service::keynode

Definition of a xml node.

Definition at line 84 of file service.h.

Member Enumeration Documentation

Dialing mode supported.

Whether by extension, userid, or both.

Enumerator
EXT_DIALING 
USER_DIALING 
ALL_DIALING 

Definition at line 89 of file service.h.

Constructor & Destructor Documentation

sipwitch::service::service ( const char *  name,
size_t  s = 0 
)

Definition at line 248 of file service.cpp.

sipwitch::service::~service ( )
virtual

Definition at line 264 of file service.cpp.

Member Function Documentation

void sipwitch::service::addAttributes ( keynode node,
char *  attrib 
)
protected

Add attributes in a XML entity as child nodes of the xml node.

Parameters
nodein tree of our node.
attribstring we must decompose into child nodes.

Definition at line 523 of file service.cpp.

service::keynode * sipwitch::service::addNode ( keynode base,
define defs 
)

Definition at line 458 of file service.cpp.

service::keynode * sipwitch::service::addNode ( keynode base,
const char *  id,
const char *  value 
)

Definition at line 427 of file service.cpp.

bool sipwitch::service::check ( void  )
static

Definition at line 894 of file service.cpp.

void sipwitch::service::commit ( void  )

Definition at line 910 of file service.cpp.

void sipwitch::service::confirm ( void  )
virtual

Reimplemented in sipwitch::server.

Definition at line 890 of file service.cpp.

void sipwitch::service::dump ( FILE *  fp,
service::keynode root,
unsigned  level 
)
static

Definition at line 735 of file service.cpp.

void sipwitch::service::dump ( FILE *  fp)
virtual

Reimplemented in sipwitch::server.

Definition at line 765 of file service.cpp.

void sipwitch::service::dumpfile ( void  )
static

Definition at line 773 of file service.cpp.

service::keynode * sipwitch::service::get ( void  )
static

Definition at line 387 of file service.cpp.

string_t sipwitch::service::getContact ( void  )
static

Definition at line 792 of file service.cpp.

static keynode* sipwitch::service::getEnviron ( void  )
inlinestatic

Definition at line 301 of file service.h.

static LinkedObject* sipwitch::service::getGenerics ( void  )
inlinestatic

Definition at line 273 of file service.h.

static const char* sipwitch::service::getInterface ( void  )
inlinestatic

Definition at line 312 of file service.h.

service::keynode * sipwitch::service::getList ( const char *  path)

Definition at line 376 of file service.cpp.

static LinkedObject* sipwitch::service::getModules ( void  )
inlinestatic

Definition at line 270 of file service.h.

service::keynode * sipwitch::service::getNode ( keynode base,
const char *  id,
const char *  value 
)

Definition at line 503 of file service.cpp.

service::keynode * sipwitch::service::getNode ( keynode base,
const char *  grp,
const char *  attr,
const char *  value 
)

Definition at line 478 of file service.cpp.

service::keynode * sipwitch::service::getPath ( const char *  path)

Definition at line 400 of file service.cpp.

static unsigned short sipwitch::service::getPort ( void  )
inlinestatic

Definition at line 315 of file service.h.

service::keynode * sipwitch::service::getProtected ( const char *  path)
static

Definition at line 360 of file service.cpp.

keynode* sipwitch::service::getRoot ( void  )
inline

Definition at line 304 of file service.h.

service::keynode * sipwitch::service::getUser ( const char *  uid)
static

Definition at line 335 of file service.cpp.

const char * sipwitch::service::getValue ( keynode base,
const char *  id 
)
static

Definition at line 446 of file service.cpp.

service::keynode * sipwitch::service::list ( const char *  p)
static

Definition at line 320 of file service.cpp.

bool sipwitch::service::load ( FILE *  file,
keynode node = NULL 
)

Load xml file into xml tree.

This may load into the root node, or to a subnode. The <provision> xml files for users are all loaded into the <provision> subtree this way.

Parameters
fileto load from.
nodeto load to or NULL to make a root node for master config.

Definition at line 565 of file service.cpp.

bool sipwitch::service::match ( const char *  digits,
const char *  pattern,
bool  partial 
)
static

Definition at line 954 of file service.cpp.

service::keynode * sipwitch::service::path ( const char *  p)
static

Definition at line 310 of file service.cpp.

bool sipwitch::service::period ( long  slice)
static

Definition at line 828 of file service.cpp.

void sipwitch::service::publish ( const char *  addr)
static

Set and publish public "appearing" address of the server.

This probably should also appear in the events system.

Parameters
addrwe are appearing as (dns name or ip addr).

Definition at line 272 of file service.cpp.

void sipwitch::service::published ( struct sockaddr_storage *  peer)
static

Definition at line 295 of file service.cpp.

void sipwitch::service::release ( keynode node)
static

Definition at line 394 of file service.cpp.

static void sipwitch::service::result ( const char *  value)
static
void sipwitch::service::setContact ( const char *  text)
inline

Definition at line 309 of file service.h.

void sipwitch::service::shutdown ( void  )
static

Definition at line 719 of file service.cpp.

void sipwitch::service::snapshot ( void  )
static

Definition at line 861 of file service.cpp.

void sipwitch::service::startup ( void  )
static

Definition at line 700 of file service.cpp.

long sipwitch::service::uptime ( void  )
static

Definition at line 300 of file service.cpp.

Friends And Related Function Documentation

friend class instance
friend

Definition at line 326 of file service.h.

Field Documentation

stringbuf<1024> sipwitch::service::buffer
protected

Definition at line 339 of file service.h.

service * sipwitch::service::cfg = NULL
staticprotected

Definition at line 343 of file service.h.

const char* sipwitch::service::contact
protected

Definition at line 341 of file service.h.

volatile service::dialmode_t sipwitch::service::dialmode = service::ALL_DIALING
static

Definition at line 252 of file service.h.

LinkedObject* sipwitch::service::keys[177]
protected

Definition at line 340 of file service.h.

condlock_t sipwitch::service::locking
staticprotected

Definition at line 344 of file service.h.

keynode sipwitch::service::root
protected

Definition at line 338 of file service.h.


The documentation for this class was generated from the following files: