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

Server control interfaces and functions. More...

#include <control.h>

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

Static Public Member Functions

static bool send (const char *format,...) __PRINTF(1
 Send a printf-style message to the control fifo via the file system. More...
 
static bool static char * receive (void)
 Used by the server to pull pending fifo requests. More...
 
static void reply (const char *error=NULL)
 Used by the server to send replies back to control requests. More...
 
static size_t attach (shell_t *env)
 Creates the control fifo using server configuration. More...
 
static void release (void)
 Used by the server to destroy the control fifo. More...
 
static bool state (const char *value)
 Sets server run state configuration. More...
 
static bool libexec (const char *fmt,...) __PRINTF(1
 Execute an external shell command on behalf of the server. More...
 
static bool static FILE * output (const char *id)
 Used to open an output session for returning control data. More...
 
static const char * env (const char *id)
 Return the value of a server environment variable. More...
 
static String path (const char *id)
 Get a string from a server environment variable. More...
 
static void config (shell *envp)
 

Static Private Attributes

static shell * args = NULL
 

Detailed Description

Server control interfaces and functions.

This is an internal management class for the server control fifo and for other server control operations.

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

Definition at line 58 of file control.h.

Member Function Documentation

size_t sipwitch::control::attach ( shell_t *  env)
static

Creates the control fifo using server configuration.

This also attaches the shell environment and command line arguments to the current server instance so it can be accessed by other things.

Parameters
envof server.
Returns
size of longest control message supported.

Definition at line 61 of file control.cpp.

static void sipwitch::control::config ( shell *  envp)
inlinestatic

Definition at line 144 of file control.h.

static const char* sipwitch::control::env ( const char *  id)
inlinestatic

Return the value of a server environment variable.

This is commonly used by plugins to get access to the server environment.

Parameters
idof environment symbol.
Returns
value of symbol or NULL if not found.

Definition at line 131 of file control.h.

bool sipwitch::control::libexec ( const char *  fmt,
  ... 
)
static

Execute an external shell command on behalf of the server.

This might also be used by plugins to execute supporting processes. The function waits until the child process completes but does not return the child exit code.

Parameters
formatof shell command to execute.
Returns
true if successfully executed.

Definition at line 261 of file control.cpp.

FILE * sipwitch::control::output ( const char *  id)
static

Used to open an output session for returning control data.

Parameters
idof output type.
Returns
file handle to write to or NULL on failure.

Definition at line 380 of file control.cpp.

static String sipwitch::control::path ( const char *  id)
inlinestatic

Get a string from a server environment variable.

This is often used to get pathname variables which may then be further concatenated. This is commonly used by plugins to get paths.

Parameters
idof environment symbol.
Returns
string value of symbol requested.

Definition at line 141 of file control.h.

char * sipwitch::control::receive ( void  )
static

Used by the server to pull pending fifo requests.

Returns
string of next fifo input.

Definition at line 87 of file control.cpp.

void sipwitch::control::release ( void  )
static

Used by the server to destroy the control fifo.

Definition at line 81 of file control.cpp.

void sipwitch::control::reply ( const char *  error = NULL)
static

Used by the server to send replies back to control requests.

Parameters
errorstring to report or NULL for none.

Definition at line 218 of file control.cpp.

bool sipwitch::control::send ( const char *  format,
  ... 
)
static

Send a printf-style message to the control fifo via the file system.

While plugins can also use this to send control messages back into the server, we should create a method that does not require going to the external filesystem to do this.

Parameters
formatstring.
Returns
true if successful.

Definition at line 309 of file control.cpp.

bool sipwitch::control::state ( const char *  value)
static

Sets server run state configuration.

This is done by symlinking a state xml file when selecting a special running state.

Parameters
stateto select.
Returns
true if set to state.

Definition at line 354 of file control.cpp.

Field Documentation

shell_t * sipwitch::control::args = NULL
staticprivate

Definition at line 61 of file control.h.


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