101 static double sleep = 0.01;
135 return octstr_create(
"Avalanche has already started, too late to " 197 return octstr_create(GW_NAME
" isolated from message providers");
248 return octstr_create(
"Already in shutdown phase, restarting hard...");
251 return octstr_create(
"Unable to restart gracefully! Please check log file.");
263 return octstr_create(
"Suspend " GW_NAME
" before trying to flush DLR queue");
401 char *header, *footer;
406 reply = final_reply = NULL;
484 header =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n" 485 "<html>\n<title>" GW_NAME
"</title>\n<body>\n<p>";
486 footer =
"</p>\n</body></html>\n";
489 header =
"<?xml version=\"1.0\"?>\n" 490 "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" " 491 "\"http://www.wapforum.org/DTD/wml_1.1.xml\">\n" 492 "\n<wml>\n <card>\n <p>";
493 footer =
" </p>\n </card>\n</wml>\n";
496 header =
"<?xml version=\"1.0\"?>\n" 498 footer =
"</gateway>\n";
529 List *headers, *cgivars;
539 info(0,
"HTTP admin tried from denied host <%s>, disconnected",
562 Octstr *ssl_server_cert_file;
563 Octstr *ssl_server_key_file;
571 panic(0,
"Missing admin-port variable, cannot start HTTP admin");
576 panic(0,
"You MUST set HTTP admin-password");
593 if (ssl_server_cert_file != NULL && ssl_server_key_file != NULL) {
601 panic(0,
"You MUST specify cert and key files within core group for SSL-enabled HTTP servers!");
611 panic(0,
"Failed to start a new thread for HTTP admin");
static Octstr * httpd_resume(List *cgivars, int status_type)
int httpadmin_start(Cfg *cfg)
void info(int err, const char *fmt,...)
static Octstr * httpd_reload_lists(List *cgivars, int status_type)
static Octstr * ha_deny_ip
void http_header_add(List *headers, char *name, char *contents)
gw_assert(wtls_machine->packet_to_send !=NULL)
void http_close_client(HTTPClient *client)
char * bb_status_linebreak(int status_type)
static Octstr * httpd_flush_dlr(List *cgivars, int status_type)
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
static void client(int port)
static Octstr * ha_allow_ip
static Octstr * ha_status_pw
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
#define cfg_get(grp, varname)
static struct httpd_command httpd_commands[]
static Octstr * httpd_isolate(List *cgivars, int status_type)
Octstr * store_status(int status_type)
static volatile sig_atomic_t httpadmin_running
void octstr_append_cstr(Octstr *ostr, const char *cstr)
int bb_add_smsc(Octstr *id)
int bb_restart_smsc(Octstr *id)
#define octstr_get_cstr(ostr)
static Octstr * httpd_graceful_restart(List *cgivars, int status_type)
#define octstr_copy(ostr, from, len)
long octstr_search_char(const Octstr *ostr, int ch, long pos)
void gwthread_join_every(gwthread_func_t *func)
int is_allowed_ip(Octstr *allow_ip, Octstr *deny_ip, Octstr *ip)
Octstr * http_cgi_variable(List *list, char *name)
static Octstr * httpd_store_status(List *cgivars, int status_type)
void http_destroy_headers(List *headers)
static Octstr * httpd_status(List *cgivars, int status_type)
void http_destroy_cgiargs(List *args)
static Octstr * httpd_loglevel(List *cgivars, int status_type)
int bb_remove_smsc(Octstr *id)
static Octstr * ha_password
void http_send_reply(HTTPClient *client, int status, List *headers, Octstr *body)
Octstr * octstr_imm(const char *cstr)
static Octstr * httpd_restart_smsc(List *cgivars, int status_type)
HTTPClient * http_accept_request(int port, Octstr **client_ip, Octstr **url, List **headers, Octstr **body, List **cgivars)
void octstr_delete(Octstr *ostr1, long pos, long len)
void httpadmin_stop(void)
volatile sig_atomic_t bb_status
void log_set_log_level(enum output_level level)
static Octstr * httpd_remove_message(List *cgivars, int status_type)
int bb_reload_lists(void)
#define octstr_duplicate(ostr)
int bb_stop_smsc(Octstr *id)
int bb_graceful_restart(void)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
#define gwthread_create(func, arg)
#define octstr_create(cstr)
void gwthread_sleep(double seconds)
const char * content_type
static Octstr * ha_interface
static void httpd_serve(HTTPClient *client, Octstr *ourl, List *headers, Octstr *body, List *cgivars)
int http_open_port_if(int port, int ssl, Octstr *interface)
Octstr *(* function)(List *cgivars, int status_type)
void http_close_all_ports(void)
long octstr_len(const Octstr *ostr)
int cfg_get_bool(int *n, CfgGroup *grp, Octstr *varname)
static Octstr * httpd_check_status(void)
static Octstr * httpd_check_authorization(List *cgivars, int status)
int cfg_get_integer(long *n, CfgGroup *grp, Octstr *varname)
void gwthread_wakeup(long thread)
int octstr_str_compare(const Octstr *ostr, const char *str)
static Octstr * httpd_suspend(List *cgivars, int status_type)
void octstr_format_append(Octstr *os, const char *fmt,...)
int bb_remove_message(Octstr *message_id)
static Octstr * httpd_shutdown(List *cgivars, int status_type)
int http_type_accepted(List *headers, char *type)
CfgGroup * cfg_get_single_group(Cfg *cfg, Octstr *name)
static Octstr * httpd_restart(List *cgivars, int status_type)
int octstr_get_char(const Octstr *ostr, long pos)
void gwthread_wakeup_all(void)
static Octstr * httpd_add_smsc(List *cgivars, int status_type)
static Octstr * httpd_stop_smsc(List *cgivars, int status_type)
Octstr * bb_print_status(int status_type)
static void reply(HTTPClient *c, List *push_headers)
static Octstr * httpd_remove_smsc(List *cgivars, int status_type)
static void httpadmin_run(void *arg)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)