Kannel: Open Source WAP and SMS gateway
svn-r5336
|
#include "gw-config.h"
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <termios.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
#include <libgen.h>
#include "gwlib.h"
Go to the source code of this file.
Macros | |
#define | PANIC_SCRIPT_MAX_LEN 4096 |
Functions | |
static void | fatal_handler (int sig, siginfo_t *info, void *secret) |
static void | parachute_sig_handler (int signum) |
static void | parachute_init_signals (int child) |
static int | is_executable (const char *filename) |
static int | become_daemon (void) |
static | PRINTFLIKE (2, 3) |
static void | parachute_start (const char *myname, const char *panic_script) |
static void | write_pid_file (void) |
static void | remove_pid_file (void) |
static int | change_user (const char *user) |
MultibyteInt | get_variable_value (Octet *source, int *len) |
int | write_variable_value (MultibyteInt value, Octet *dest) |
Octet | reverse_octet (Octet source) |
void | init_fatal_signals () |
void | report_versions (const char *boxname) |
Octstr * | version_report_string (const char *boxname) |
int | get_and_set_debugs (int argc, char **argv, int(*find_own)(int index, int argc, char **argv)) |
static int | pattern_matches_ip (Octstr *pattern, Octstr *ip) |
static int | pattern_list_matches_ip (Octstr *pattern_list, Octstr *ip) |
int | is_allowed_ip (Octstr *allow_ip, Octstr *deny_ip, Octstr *ip) |
int | connect_denied (Octstr *allow_ip, Octstr *ip) |
int | does_prefix_match (Octstr *prefix, Octstr *number) |
int | normalize_number (char *dial_prefixes, Octstr **number) |
long | decode_network_long (unsigned char *data) |
void | encode_network_long (unsigned char *data, unsigned long value) |
void | kannel_cfmakeraw (struct termios *tio) |
int | gw_isdigit (int c) |
int | gw_isxdigit (int c) |
int | roundup_div (int a, int b) |
unsigned long long | gw_generate_id (void) |
Variables | |
static pid_t | child_pid = -1 |
static pid_t | pidfile_owner_pid = -1 |
static struct sigaction | child_actions [32] |
static int | child_actions_init = 0 |
static char * | pid_file = NULL |
static volatile sig_atomic_t | parachute_shutdown = 0 |
#define PANIC_SCRIPT_MAX_LEN 4096 |
Definition at line 288 of file utils.c.
Referenced by PRINTFLIKE().
|
static |
|
static |
Definition at line 833 of file utils.c.
References allow_ip, octstr_imm(), and pattern_list_matches_ip().
Referenced by httpsmsc_receiver().
long decode_network_long | ( | unsigned char * | data | ) |
Definition at line 935 of file utils.c.
Referenced by conn_read_withlen(), parse_integer(), read_msg(), and smpp_pdu_read_len().
Definition at line 850 of file utils.c.
References gw_assert(), number, and octstr_get_cstr.
Referenced by check_allowed_translation(), smsbox_req_handle(), and smscconn_usable().
void encode_network_long | ( | unsigned char * | data, |
unsigned long | value | ||
) |
Definition at line 940 of file utils.c.
Referenced by append_integer(), conn_write_withlen(), and write_msg().
|
static |
Definition at line 146 of file utils.c.
References gw_backtrace(), and size.
Referenced by init_fatal_signals().
int get_and_set_debugs | ( | int | argc, |
char ** | argv, | ||
int(*)(int index, int argc, char **argv) | find_own | ||
) |
Definition at line 626 of file utils.c.
References become_daemon(), cfg_dump_all(), change_user(), GW_DEBUG, GW_NON_EXCL, info(), init_fatal_signals(), log_close_all(), log_open(), log_set_debug_places(), log_set_output_level(), log_set_syslog(), octstr_destroy(), octstr_get_cstr, panic, parachute_start(), pid_file, remove_pid_file(), version_report_string(), and write_pid_file().
Referenced by main().
MultibyteInt get_variable_value | ( | Octet * | source, |
int * | len | ||
) |
unsigned long long gw_generate_id | ( | void | ) |
int gw_isdigit | ( | int | c | ) |
Definition at line 988 of file utils.c.
Referenced by convert_addr_from_pdu(), date_parse_iso(), get_originator_type(), handle_dlr(), handle_pdu(), msg_to_cgwop(), msg_to_emimsg(), msg_to_pdu(), pack_parameter(), packet_check_header(), and packet_check_parameter().
int gw_isxdigit | ( | int | c | ) |
Definition at line 994 of file utils.c.
Referenced by octstr_hex_to_binary(), octstr_is_all_hex(), octstr_symbolize(), packet_check(), and packet_check_parameter().
void init_fatal_signals | ( | void | ) |
Install fatal signal handler. Usefull to receive backtrace if program crash with SEGFAULT.
Definition at line 527 of file utils.c.
References fatal_handler().
Referenced by get_and_set_debugs(), and parachute_init_signals().
Definition at line 815 of file utils.c.
References allow_ip, deny_ip, octstr_len(), and pattern_list_matches_ip().
Referenced by accept_boxc(), authorise_username(), cgw_listener(), check_login(), emi2_listener(), fake_listener(), get_data(), httpadmin_run(), main(), and udp_receiver().
|
static |
Definition at line 234 of file utils.c.
References error(), and filename.
Referenced by parachute_start().
void kannel_cfmakeraw | ( | struct termios * | tio | ) |
Definition at line 951 of file utils.c.
Referenced by at2_open_device(), at_dial(), and X28_open_data_link().
int normalize_number | ( | char * | dial_prefixes, |
Octstr ** | number | ||
) |
Definition at line 882 of file utils.c.
References gw_assert(), number, octstr_create_from_data, octstr_destroy(), octstr_get_cstr, octstr_insert_data(), octstr_len(), and start.
Referenced by bb_smscconn_receive(), radius_acct_get_msisdn(), smsc2_rout(), and smscconn_send().
|
static |
Definition at line 195 of file utils.c.
References child_actions, child_actions_init, init_fatal_signals(), panic, and parachute_sig_handler().
Referenced by parachute_start().
|
static |
Definition at line 175 of file utils.c.
References child_pid, info(), and parachute_shutdown.
Referenced by parachute_init_signals().
|
static |
Definition at line 315 of file utils.c.
References child_pid, debug(), error(), gwlib_shutdown(), gwthread_sleep(), info(), is_executable(), panic, parachute_init_signals(), and parachute_shutdown.
Referenced by get_and_set_debugs().
Definition at line 796 of file utils.c.
References gwlist_destroy(), gwlist_extract_first(), octstr_destroy(), octstr_destroy_item(), octstr_imm(), octstr_split(), and pattern_matches_ip().
Referenced by connect_denied(), and is_allowed_ip().
Definition at line 759 of file utils.c.
References octstr_get_char(), and octstr_len().
Referenced by pattern_list_matches_ip().
|
static |
|
static |
Definition at line 417 of file utils.c.
References error(), gwlib_init(), gwlib_initialized(), gwlib_shutdown(), log_set_syslog(), pid_file, and pidfile_owner_pid.
Referenced by get_and_set_debugs().
void report_versions | ( | const char * | boxname | ) |
Definition at line 539 of file utils.c.
References debug(), octstr_destroy(), octstr_get_cstr, and version_report_string().
Referenced by main().
int roundup_div | ( | int | a, |
int | b | ||
) |
Octstr* version_report_string | ( | const char * | boxname | ) |
Definition at line 549 of file utils.c.
References get_official_ip(), get_official_name(), octstr_format(), and octstr_get_cstr.
Referenced by bb_print_status(), get_and_set_debugs(), and report_versions().
|
static |
Definition at line 397 of file utils.c.
References file, panic, pid_file, and pidfile_owner_pid.
Referenced by get_and_set_debugs().
int write_variable_value | ( | MultibyteInt | value, |
Octet * | dest | ||
) |
Definition at line 490 of file utils.c.
Referenced by sema_encode_msg(), sema_submit_result(), and wbmp_create_stream().
|
static |
Definition at line 138 of file utils.c.
Referenced by parachute_init_signals().
|
static |
Definition at line 140 of file utils.c.
Referenced by parachute_init_signals().
|
static |
Definition at line 134 of file utils.c.
Referenced by parachute_sig_handler(), and parachute_start().
|
static |
Definition at line 143 of file utils.c.
Referenced by parachute_sig_handler(), and parachute_start().
|
static |
Definition at line 142 of file utils.c.
Referenced by get_and_set_debugs(), remove_pid_file(), and write_pid_file().
|
static |
Definition at line 136 of file utils.c.
Referenced by remove_pid_file(), and write_pid_file().