190                 panic(0, 
"Cannot die by its own will");
   214     struct sigaction act;
   217     sigemptyset(&act.sa_mask);
   219     sigaction(SIGINT, &act, NULL);
   220     sigaction(SIGTERM, &act, NULL);
   221     sigaction(SIGQUIT, &act, NULL);
   222     sigaction(SIGHUP, &act, NULL);
   223     sigaction(SIGPIPE, &act, NULL);
   224     sigaction(SIGUSR2, &act, NULL);
   237     static int started = 0;
   243         error(0, 
"Unable to start smsbox module.");
   248         error(0, 
"Unable to start smsc module.");
   287     static int started = 0;
   294     debug(
"bb", 0, 
"starting WDP router");
   296         panic(0, 
"Failed to start a new thread for WDP routing");
   305     static int started = 0;
   337     if (smsp != -1 && grp == NULL) {
   338         error(0, 
"No 'smsbox' group in configuration, but smsbox-port set");
   342     warning(0, 
"Kannel was compiled without SMS support");
   347     if (wapp != -1 && grp == NULL) {
   348         error(0, 
"No 'wapbox' group in configuration, but wapbox-port set");
   352     warning(0, 
"Kannel was compiled without WAP support");
   364     if (strcmp(argv[i], 
"-S")==0 || strcmp(argv[i], 
"--suspended")==0)
   366     else if (strcmp(argv[i], 
"-I")==0 || strcmp(argv[i], 
"--isolated")==0)
   379     long loglevel, store_dump_freq, value;
   382     Octstr *ssl_server_cert_file;
   383     Octstr *ssl_server_key_file;
   386     Octstr *http_proxy_host = NULL;
   387     long http_proxy_port = -1;
   388     int http_proxy_ssl = 0;
   389     List *http_proxy_exceptions = NULL;
   390     Octstr *http_proxy_username = NULL;
   391     Octstr *http_proxy_password = NULL;
   392     Octstr *http_proxy_exceptions_regex = NULL;
   424         panic(0, 
"Cannot start with corrupted configuration");
   449         store_dump_freq = -1;
   454         warning(0, 
"'store-file' option deprecated, please use 'store-location' and 'store-type' instead.");
   461         panic(0, 
"Could not start with store init failed.");
   472     http_proxy_username = 
cfg_get(grp, 
   474     http_proxy_password = 
cfg_get(grp, 
   478     http_proxy_exceptions_regex = 
cfg_get(grp,
   493     if (ssl_server_cert_file != NULL && ssl_server_key_file != NULL) {
   499            panic(0, 
"You MUST specify cert and key files within core group for SSL-enabled inter-box connections!");
   552         warning(0, 
"Option 'maximum-queue-length' is deprecated! Please use"   553                           " 'sms-incoming-queue-limit' instead!");
   558                                   octstr_imm(
"sms-incoming-queue-limit")) == -1)
   562                                   octstr_imm(
"sms-outgoing-queue-limit")) == -1)
   578                panic(0, 
"Unable to start SMSCs.");
   596     if (http_proxy_host != NULL && http_proxy_port > 0) {
   598                http_proxy_exceptions, http_proxy_username,
   599                        http_proxy_password, http_proxy_exceptions_regex);
   618         warning(0, 
"Remaining WDP: %ld incoming, %ld outgoing",
   621     info(0, 
"Total WDP messages: received %ld, sent %ld",
   640         debug(
"bb", 0, 
"Remaining SMS: %ld incoming, %ld outgoing",
   643     info(0, 
"Total SMS messages: received %ld, dlr %ld, sent %ld, dlr %ld",
   672     switch (
msg->sms.sms_type) {
   684             error(0, 
"Not handled sms_type %ld within store for message ID %s",
   685                   msg->sms.sms_type, 
id);
   692 int main(
int argc, 
char **argv)
   709     if (argv[cf_index] == NULL)
   725         panic(0, 
"Initialization failed.");
   727     info(0, 
"----------------------------------------");
   728     info(0, GW_NAME 
" bearerbox II version %s starting", GW_VERSION);
   733         panic(0, 
"Cannot start with store-file failing");
   735     info(0, 
"MAIN: Start-up done, entering mainloop");
   737         info(0, 
"Gateway is now SUSPENDED by startup arguments");
   739         info(0, 
"Gateway is now ISOLATED by startup arguments");
   765             warning(0, 
"SIGHUP received, re-opening logs and gracefully restarting.");
   773             warning(0, 
"SIGUSR2 received, re-opening logs.");
   780             warning(0, 
"SIGQUIT received, reporting memory usage.");
   787         warning(0, 
"Killing signal or HTTP admin command received, shutting down...");
   799     info(0, 
"All flow threads have died, killing core");
   834     static int called = 0;
   842     debug(
"bb", 0, 
"Shutting down " GW_NAME 
"...");
   849     debug(
"bb", 0, 
"shutting down smsc");
   853     debug(
"bb", 0, 
"shutting down udp");
   961         error(0, 
"Error processing configuration resource `%s'. Continue with existing configuration.",
   983     msg->ack.time = time(NULL);
   995 #define append_status(r, s, f, x) { s = f(x); octstr_append(r, s); \  1001     char *frmt, *footer;
  1002     Octstr *ret, *str, *version;
  1025                " <p>Status: %s, uptime %ldd %ldh %ldm %lds</p>\n\n"  1026                " <p>WDP: received %ld (%ld queued), sent %ld "  1027                "(%ld queued)</p>\n\n"  1028                " <p>SMS: received %ld (%ld queued), sent %ld "  1029                "(%ld queued), store size %ld<br>\n"  1030                " SMS: inbound (%.2f,%.2f,%.2f) msg/sec, "  1031                "outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"  1032                " <p>DLR: received %ld, sent %ld<br>\n"  1033                " DLR: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec<br>\n"  1034                " DLR: %ld queued, using %s storage</p>\n\n";
  1038                "   <p>Status: %s, uptime %ldd %ldh %ldm %lds</p>\n\n"  1039                "   <p>WDP: received %ld (%ld queued)<br/>\n"  1040                "      WDP: sent %ld (%ld queued)</p>\n\n"  1041                "   <p>SMS: received %ld (%ld queued)<br/>\n"  1042                "      SMS: sent %ld (%ld queued)<br/>\n"  1043                "      SMS: store size %ld<br/>\n"  1044                "      SMS: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"  1045                "      SMS: outbound (%.2f,%.2f,%.2f) msg/sec</p>\n"  1046                "   <p>DLR: received %ld<br/>\n"  1047                "      DLR: sent %ld<br/>\n"  1048                "      DLR: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"  1049                "      DLR: outbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"  1050                "      DLR: %ld queued<br/>\n"  1051                "      DLR: using %s storage</p>\n\n";
  1054         frmt = 
"<version>%s</version>\n"  1055                "<status>%s, uptime %ldd %ldh %ldm %lds</status>\n"  1056                "\t<wdp>\n\t\t<received><total>%ld</total><queued>%ld</queued>"  1057                "</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>"  1058                "</sent>\n\t</wdp>\n"  1059                "\t<sms>\n\t\t<received><total>%ld</total><queued>%ld</queued>"  1060                "</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>"  1061                "</sent>\n\t\t<storesize>%ld</storesize>\n\t\t"  1062                "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t"  1063                "<outbound>%.2f,%.2f,%.2f</outbound>\n\t\t"  1065                "\t<dlr>\n\t\t<received><total>%ld</total></received>\n\t\t"  1066                "<sent><total>%ld</total></sent>\n\t\t"  1067                "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t"  1068                "<outbound>%.2f,%.2f,%.2f</outbound>\n\t\t"  1069                "<queued>%ld</queued>\n\t\t<storage>%s</storage>\n\t</dlr>\n";
  1072         frmt = 
"%s\n\nStatus: %s, uptime %ldd %ldh %ldm %lds\n\n"  1073                "WDP: received %ld (%ld queued), sent %ld (%ld queued)\n\n"  1074                "SMS: received %ld (%ld queued), sent %ld (%ld queued), store size %ld\n"  1075                "SMS: inbound (%.2f,%.2f,%.2f) msg/sec, "  1076                "outbound (%.2f,%.2f,%.2f) msg/sec\n\n"  1077                "DLR: received %ld, sent %ld\n"  1078                "DLR: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec\n"  1079                "DLR: %ld queued, using %s storage\n\n";
  1085         s, t/3600/24, t/3600%24, t/60%60, t%60,
  1111     switch (status_type) {
 volatile sig_atomic_t bb_status
 
Counter * incoming_dlr_counter
 
static void wdp_router(void *arg)
 
void error(int err, const char *fmt,...)
 
int httpadmin_start(Cfg *cfg)
 
void info(int err, const char *fmt,...)
 
int boxc_incoming_wdp_queue(void)
 
static int start_wap(Cfg *cfg)
 
int smsc2_add_smsc(Octstr *id)
 
static void dispatch_into_queue(Msg *msg)
 
Counter * incoming_wdp_counter
 
static void set_shutdown_status(void)
 
gw_assert(wtls_machine->packet_to_send !=NULL)
 
void counter_destroy(Counter *counter)
 
void gwlist_append(List *list, void *item)
 
int smsc2_restart_smsc(Octstr *id)
 
char * bb_status_linebreak(int status_type)
 
static int check_config(Cfg *cfg)
 
int smsc2_graceful_restart(Cfg *cfg)
 
List * cfg_get_list(CfgGroup *grp, Octstr *varname)
 
static void empty_msg_lists(void)
 
static int check_args(int i, int argc, char **argv)
 
long gwlist_len(List *list)
 
int restart_box(char **argv)
 
int smsc2_reload_lists(void)
 
long(* store_messages)(void)
 
Msg * msg_unpack_wrapper(Octstr *os)
 
int load_add_interval(Load *load, int interval)
 
#define cfg_get(grp, varname)
 
static Mutex * status_mutex
 
void uuid_unparse(const uuid_t uu, char *out)
 
static volatile sig_atomic_t bb_todo
 
int gwthread_shouldhandlesignal(int signal)
 
void octstr_append_cstr(Octstr *ostr, const char *cstr)
 
double load_get(Load *load, int pos)
 
int bb_add_smsc(Octstr *id)
 
int udp_outgoing_queue(void)
 
int bb_restart_smsc(Octstr *id)
 
#define octstr_get_cstr(ostr)
 
void bb_alog_init(const Octstr *format)
 
Cfg * cfg_create(Octstr *filename)
 
int smsc2_remove_smsc(Octstr *id)
 
int uuid_parse(const char *in, uuid_t uu)
 
void msg_destroy_item(void *msg)
 
void bb_alog_shutdown(void)
 
int bb_remove_smsc(Octstr *id)
 
long max_outgoing_sms_qlength
 
Octstr * octstr_imm(const char *cstr)
 
#define DEFAULT_OUTGOING_SMS_QLENGTH
 
Counter * counter_create(void)
 
void cfg_destroy(Cfg *cfg)
 
int smsc2_stop_smsc(Octstr *id)
 
void * gwlist_extract_first(List *list)
 
void conn_config_ssl(CfgGroup *grp)
 
void gwlist_remove_producer(List *list)
 
void httpadmin_stop(void)
 
static void signal_handler(int signum)
 
long max_incoming_sms_qlength
 
const char * dlr_type(void)
 
int store_init(Cfg *cfg, const Octstr *type, const Octstr *fname, long dump_freq, void *pack_func, void *unpack_func)
 
int bb_reload_lists(void)
 
List * cfg_get_multi_group(Cfg *cfg, Octstr *name)
 
Counter * outgoing_sms_counter
 
int smsbox_start(Cfg *cfg)
 
int bb_stop_smsc(Octstr *id)
 
void msg_destroy(Msg *msg)
 
static int start_smsc(Cfg *cfg)
 
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
 
int main(int argc, char **argv)
 
void warning(int err, const char *fmt,...)
 
void log_set_syslog_facility(char *facility)
 
void alog_open(char *fname, int use_localtm, int use_markers)
 
int bb_graceful_restart(void)
 
Octstr * octstr_format(const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
volatile sig_atomic_t restart
 
Counter * incoming_sms_counter
 
#define gwthread_create(func, arg)
 
#define octstr_create(cstr)
 
void octstr_destroy_item(void *os)
 
unsigned long counter_value(Counter *counter)
 
void gwthread_sleep(double seconds)
 
void log_set_syslog(const char *ident, int syslog_level)
 
void mutex_destroy(Mutex *mutex)
 
Counter * outgoing_dlr_counter
 
int smsbox_restart(Cfg *cfg)
 
void(* store_shutdown)(void)
 
void report_versions(const char *boxname)
 
int log_open(char *filename, int level, enum excl_state excl)
 
long octstr_len(const Octstr *ostr)
 
#define append_status(r, s, f, x)
 
int cfg_get_bool(int *n, CfgGroup *grp, Octstr *varname)
 
void * gwlist_consume(List *list)
 
void http_use_proxy(Octstr *hostname, int port, int ssl, List *exceptions, Octstr *username, Octstr *password, Octstr *exceptions_regex)
 
void debug(const char *place, int err, const char *fmt,...)
 
int cfg_get_integer(long *n, CfgGroup *grp, Octstr *varname)
 
static void setup_signal_handlers(void)
 
int wapbox_start(Cfg *cfg)
 
int(* store_load)(void(*receive_msg)(Msg *))
 
void load_destroy(Load *load)
 
long octstr_parse_long(long *nump, Octstr *ostr, long pos, int base)
 
void gwlib_shutdown(void)
 
Octstr * msg_pack(Msg *msg)
 
int bb_remove_message(Octstr *message_id)
 
Octstr * boxc_status(int status_type)
 
Counter * outgoing_wdp_counter
 
int(* store_save)(Msg *msg)
 
Octstr * version_report_string(const char *boxname)
 
void smsc2_resume(int is_init)
 
Octstr * smsc2_status(int status_type)
 
CfgGroup * cfg_get_single_group(Cfg *cfg, Octstr *name)
 
void gwlist_add_producer(List *list)
 
int smsc2_start(Cfg *cfg)
 
void http_set_client_timeout(long timeout)
 
int get_and_set_debugs(int argc, char **argv, int(*find_own)(int index, int argc, char **argv))
 
void gwthread_wakeup_all(void)
 
static XMLRPCDocument * msg
 
static int start_udp(Cfg *cfg)
 
static Cfg * init_bearerbox(Cfg *cfg)
 
Octstr * bb_print_status(int status_type)
 
int gwlist_producer_count(List *list)
 
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
 
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)