Server control interfaces and functions.
More...
#include <control.h>
Inheritance diagram for sipwitch::control:
Collaboration diagram for sipwitch::control:
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...
Creates the control fifo using server configuration.
More...
Used by the server to destroy the control fifo.
More...
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
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
-
env of server.
- Returns
- size of longest control message supported.
Definition at line 61 of file control.cpp.
static void sipwitch::control::config
(
shell *
envp )
inlinestatic
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
-
id of 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
-
format of 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
-
id of 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
-
id of 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
-
error string 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
-
format string.
- 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
-
state to select.
- Returns
- true if set to state.
Definition at line 354 of file control.cpp.
Field Documentation
shell_t * sipwitch::control::args = NULL
staticprivate
The documentation for this class was generated from the following files: