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

#include <server.h>

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

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

 server (const char *id)
 
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)
 
keynodegetNode (keynode *base, const char *grp, const char *attr, const char *value)
 
keynodeaddNode (keynode *base, define *defs)
 
keynodeaddNode (keynode *base, const char *id, const char *value)
 
keynodegetList (const char *path)
 
keynodegetRoot (void)
 
void setContact (const char *text)
 
void commit (void)
 

Static Public Member Functions

static bool check (void)
 
static profile_tgetProfile (const char *id)
 
static keynodegetRouting (const char *id)
 
static void getProvision (const char *id, usernode &user)
 
static void getDialing (const char *id, usernode &user)
 
static keynodegetConfig (void)
 
static void listPolicy (FILE *fp)
 
static stack::subnetgetPolicy (const struct sockaddr *addr)
 
static stack::subnetgetSubnet (const char *id)
 
static bool isLocal (const struct sockaddr *addr)
 
static void release (stack::subnet *access)
 
static void release (keynode *node)
 
static void release (usernode &user)
 
static void reload (void)
 
static Socket::address * getContact (const char *id)
 
static void plugins (const char *argv0, const char *names)
 
static void run (void)
 
static void stop (void)
 
static void * allocate (size_t size, LinkedObject **list, volatile unsigned *count=NULL)
 
static unsigned allocate (void)
 
static bool announce (MappedRegistry *rr, const char *msgtype, const char *event, const char *expires, const char *body)
 
static void activate (MappedRegistry *rr)
 
static void expire (MappedRegistry *rr)
 
static void logging (MappedRegistry *rr, const char *reason)
 
static void registration (voip::reg_t id, modules::regmode_t mode)
 
static bool authenticate (voip::reg_t id, const char *realm)
 
static const char * referLocal (MappedRegistry *rr, const char *target, char *buffer, size_t size)
 
static const char * referRemote (MappedRegistry *rr, const char *target, char *buffer, size_t size)
 
static bool checkId (const char *id)
 
static void printlog (const char *fmt,...) __PRINTF(1
 
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 Public Attributes

static shell::logmode_t logmode = shell::SYSTEM_LOG
 
static unsigned uid = 1000
 
static const char * sipusers = "sipusers"
 
static const char * sipadmin = "wheel"
 
static int exit_code = 0
 
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
 

Private Types

typedef linked_value
< profile_t, LinkedObject
profile
 

Private Member Functions

bool create (const char *id, keynode *node)
 
keynodefind (const char *id)
 
void confirm (void)
 
void dump (FILE *fp)
 

Private Attributes

cidr::policy * acl
 
keynode ** extmap
 
keynodeprovision
 
LinkedObjectprofiles
 

Detailed Description

Definition at line 477 of file server.h.

Member Typedef Documentation

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

Definition of a xml node.

Definition at line 84 of file service.h.

typedef linked_value<profile_t, LinkedObject> sipwitch::server::profile
private

Definition at line 480 of file server.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::server::server ( const char *  id)

Definition at line 80 of file server.cpp.

Member Function Documentation

void sipwitch::server::activate ( MappedRegistry rr)
static

Definition at line 149 of file server.cpp.

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

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 
)
inherited

Definition at line 458 of file service.cpp.

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

Definition at line 427 of file service.cpp.

void * sipwitch::server::allocate ( size_t  size,
LinkedObject **  list,
volatile unsigned *  count = NULL 
)
static

Definition at line 1030 of file server.cpp.

unsigned sipwitch::server::allocate ( void  )
static

Definition at line 1025 of file server.cpp.

bool sipwitch::server::announce ( MappedRegistry rr,
const char *  msgtype,
const char *  event,
const char *  expires,
const char *  body 
)
static

Definition at line 181 of file server.cpp.

bool sipwitch::server::authenticate ( voip::reg_t  id,
const char *  realm 
)
static

Definition at line 127 of file server.cpp.

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

Definition at line 877 of file server.cpp.

bool sipwitch::server::checkId ( const char *  id)
static

Definition at line 796 of file server.cpp.

void sipwitch::service::commit ( void  )
inherited

Definition at line 910 of file service.cpp.

void sipwitch::server::confirm ( void  )
privatevirtual

Reimplemented from sipwitch::service.

Definition at line 225 of file server.cpp.

bool sipwitch::server::create ( const char *  id,
keynode node 
)
private

Definition at line 208 of file server.cpp.

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

Definition at line 735 of file service.cpp.

void sipwitch::server::dump ( FILE *  fp)
privatevirtual

Reimplemented from sipwitch::service.

Definition at line 891 of file server.cpp.

void sipwitch::service::dumpfile ( void  )
staticinherited

Definition at line 773 of file service.cpp.

void sipwitch::server::expire ( MappedRegistry rr)
static

Definition at line 162 of file server.cpp.

service::keynode * sipwitch::server::find ( const char *  id)
private

Definition at line 193 of file server.cpp.

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

Definition at line 387 of file service.cpp.

service::keynode * sipwitch::server::getConfig ( void  )
static

Definition at line 733 of file server.cpp.

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

Definition at line 792 of file service.cpp.

Socket::address * sipwitch::server::getContact ( const char *  id)
static

Definition at line 744 of file server.cpp.

void sipwitch::server::getDialing ( const char *  id,
usernode user 
)
static

Definition at line 816 of file server.cpp.

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

Definition at line 301 of file service.h.

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

Definition at line 273 of file service.h.

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

Definition at line 312 of file service.h.

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

Definition at line 376 of file service.cpp.

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

Definition at line 270 of file service.h.

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

Definition at line 503 of file service.cpp.

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

Definition at line 478 of file service.cpp.

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

Definition at line 400 of file service.cpp.

stack::subnet * sipwitch::server::getPolicy ( const struct sockaddr *  addr)
static

Definition at line 686 of file server.cpp.

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

Definition at line 315 of file service.h.

profile_t * sipwitch::server::getProfile ( const char *  id)
static

Definition at line 703 of file server.cpp.

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

Definition at line 360 of file service.cpp.

void sipwitch::server::getProvision ( const char *  id,
usernode user 
)
static

Definition at line 850 of file server.cpp.

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

Definition at line 304 of file service.h.

service::keynode * sipwitch::server::getRouting ( const char *  id)
static

Definition at line 764 of file server.cpp.

stack::subnet * sipwitch::server::getSubnet ( const char *  id)
static

Definition at line 614 of file server.cpp.

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

Definition at line 335 of file service.cpp.

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

Definition at line 446 of file service.cpp.

bool sipwitch::server::isLocal ( const struct sockaddr *  addr)
static

Definition at line 600 of file server.cpp.

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

Definition at line 320 of file service.cpp.

void sipwitch::server::listPolicy ( FILE *  fp)
static

Definition at line 629 of file server.cpp.

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

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.

void sipwitch::server::logging ( MappedRegistry rr,
const char *  reason 
)
static

Definition at line 175 of file server.cpp.

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

Definition at line 954 of file service.cpp.

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

Definition at line 310 of file service.cpp.

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

Definition at line 828 of file service.cpp.

void sipwitch::server::plugins ( const char *  argv0,
const char *  names 
)
static

Definition at line 1053 of file server.cpp.

void sipwitch::server::printlog ( const char *  fmt,
  ... 
)
static

Definition at line 1373 of file server.cpp.

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

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)
staticinherited

Definition at line 295 of file service.cpp.

const char * sipwitch::server::referLocal ( MappedRegistry rr,
const char *  target,
char *  buffer,
size_t  size 
)
static

Definition at line 108 of file server.cpp.

const char * sipwitch::server::referRemote ( MappedRegistry rr,
const char *  target,
char *  buffer,
size_t  size 
)
static

Definition at line 89 of file server.cpp.

void sipwitch::server::registration ( voip::reg_t  id,
modules::regmode_t  mode 
)
static

Definition at line 139 of file server.cpp.

void sipwitch::server::release ( stack::subnet access)
static

Definition at line 594 of file server.cpp.

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

Definition at line 577 of file server.cpp.

void sipwitch::server::release ( usernode user)
static

Definition at line 583 of file server.cpp.

void sipwitch::server::reload ( void  )
static

Definition at line 912 of file server.cpp.

static void sipwitch::service::result ( const char *  value)
staticinherited
void sipwitch::server::run ( void  )
static

Definition at line 1100 of file server.cpp.

void sipwitch::service::setContact ( const char *  text)
inlineinherited

Definition at line 309 of file service.h.

void sipwitch::service::shutdown ( void  )
staticinherited

Definition at line 719 of file service.cpp.

void sipwitch::service::snapshot ( void  )
staticinherited

Definition at line 861 of file service.cpp.

void sipwitch::service::startup ( void  )
staticinherited

Definition at line 700 of file service.cpp.

void sipwitch::server::stop ( void  )
static

Definition at line 1095 of file server.cpp.

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

Definition at line 300 of file service.cpp.

Field Documentation

cidr::policy* sipwitch::server::acl
private

Definition at line 482 of file server.h.

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

Definition at line 339 of file service.h.

service * sipwitch::service::cfg = NULL
staticprotectedinherited

Definition at line 343 of file service.h.

const char* sipwitch::service::contact
protectedinherited

Definition at line 341 of file service.h.

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

Definition at line 252 of file service.h.

int sipwitch::server::exit_code = 0
static

Definition at line 498 of file server.h.

keynode** sipwitch::server::extmap
private

Definition at line 483 of file server.h.

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

Definition at line 340 of file service.h.

condlock_t sipwitch::service::locking
staticprotectedinherited

Definition at line 344 of file service.h.

shell::logmode_t sipwitch::server::logmode = shell::SYSTEM_LOG
static

Definition at line 494 of file server.h.

LinkedObject* sipwitch::server::profiles
private

Definition at line 485 of file server.h.

keynode* sipwitch::server::provision
private

Definition at line 484 of file server.h.

keynode sipwitch::service::root
protectedinherited

Definition at line 338 of file service.h.

const char * sipwitch::server::sipadmin = "wheel"
static

Definition at line 497 of file server.h.

const char * sipwitch::server::sipusers = "sipusers"
static

Definition at line 496 of file server.h.

unsigned sipwitch::server::uid = 1000
static

Definition at line 495 of file server.h.


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