SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
control.h
Go to the documentation of this file.
1 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
2 // Copyright (C) 2015 Cherokees of Idaho.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
24 #ifndef _SIPWITCH_CONTROL_H_
25 #define _SIPWITCH_CONTROL_H_
26 
27 #ifndef _UCOMMON_LINKED_H_
28 #include <ucommon/linked.h>
29 #endif
30 
31 #ifndef _UCOMMON_THREAD_H_
32 #include <ucommon/thread.h>
33 #endif
34 
35 #ifndef _UCOMMON_SHELL_H
36 #include <ucommon/shell.h>
37 #endif
38 
39 #ifndef _UCOMMON_STRING_H_
40 #include <ucommon/string.h>
41 #endif
42 
43 #ifndef _SIPWITCH_NAMESPACE_H_
44 #include <sipwitch/namespace.h>
45 #endif
46 
47 namespace sipwitch {
48 
49 #define DEBUG1 shell::DEBUG0
50 #define DEBUG2 (shell::loglevel_t(((unsigned)shell::DEBUG0 + 1)))
51 #define DEBUG3 (shell::loglevel_t(((unsigned)shell::DEBUG0 + 2)))
52 
58 class __EXPORT control
59 {
60 private:
61  static shell *args;
62 
63 public:
72  static bool send(const char *format, ...) __PRINTF(1, 2);
73 
78  static char *receive(void);
79 
84  static void reply(const char *error = NULL);
85 
93  static size_t attach(shell_t *env);
94 
98  static void release(void);
99 
106  static bool state(const char *value);
107 
116  static bool libexec(const char *fmt, ...) __PRINTF(1, 2);
117 
123  static FILE *output(const char *id);
124 
131  inline static const char *env(const char *id)
132  {return args->getsym(id);}
133 
141  inline static String path(const char *id)
142  {return (String)(args->getsym(id));}
143 
144  inline static void config(shell *envp)
145  {args = envp;}
146 };
147 
148 } // namespace sipwitch
149 
150 #endif
static String path(const char *id)
Get a string from a server environment variable.
Definition: control.h:141
Server control interfaces and functions.
Definition: control.h:58
static void config(shell *envp)
Definition: control.h:144
GNU SIP Witch library namespace.
char * value[96]
Definition: cgiserver.cpp:90
static shell * args
Definition: control.h:61