Asterisk - The Open Source Telephony Project
21.4.1
|
STUN Network Monitor. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/sched.h"
#include "asterisk/config.h"
#include "asterisk/stun.h"
#include "asterisk/netsock2.h"
#include "asterisk/lock.h"
#include "asterisk/acl.h"
#include "asterisk/cli.h"
#include "asterisk/json.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_system.h"
#include "asterisk/astobj2.h"
#include <fcntl.h>
Go to the source code of this file.
Macros | |
#define | DATALN "%-25s %-5u %-7u %-8d %-7s %-16s %-d\n" |
#define | DEFAULT_MONITOR_REFRESH 30 |
#define | DEFAULT_RETRIES 3 |
#define | HEADER "%-25s %-5s %-7s %-8s %-7s %-16s %-s\n" |
Functions | |
static void | __reg_module (void) |
static int | __reload (int startup) |
static void | __unreg_module (void) |
static void | _stun_show_status (int fd) |
Execute stun show status command. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static char * | handle_cli_stun_show_status (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | load_config (int startup) |
static int | load_module (void) |
static int | reload (void) |
static int | setup_stunaddr (const char *value, int reload) |
static void | stun_close_sock (void) |
static int | stun_monitor_request (const void *blarg) |
called by scheduler to send STUN request | |
static int | stun_start_monitor (void) |
static void | stun_stop_monitor (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "STUN Network Monitor" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DEPEND } |
struct { | |
struct sockaddr_in external_addr | |
unsigned int external_addr_known:1 | |
ast_mutex_t lock | |
unsigned int monitor_enabled:1 | |
unsigned int refresh | |
const char * server_hostname | |
unsigned int stun_poll_failed_gripe:1 | |
unsigned int stun_port | |
int stun_sock | |
} | args |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_stun [] |
static struct ast_sched_context * | sched |
static const char | stun_conf_file [] = "res_stun_monitor.conf" |
STUN Network Monitor.
Definition in file res_stun_monitor.c.
#define DEFAULT_MONITOR_REFRESH 30 |
Default refresh period in seconds
Definition at line 47 of file res_stun_monitor.c.
#define DEFAULT_RETRIES 3 |
retries shown in stun show status matching static retries in stun.c
Definition at line 48 of file res_stun_monitor.c.
Referenced by _stun_show_status().
|
static |
Execute stun show status command.
we only have one stun server, but start to play well with more
Definition at line 374 of file res_stun_monitor.c.
References ast_inet_ntoa(), and DEFAULT_RETRIES.
|
static |
Register CLI commands
Definition at line 463 of file res_stun_monitor.c.
References ast_cli_entry::args, ast_cli_register_multiple, AST_MODULE_LOAD_DECLINE, and AST_MODULE_LOAD_SUCCESS.
|
static |
Unregister CLI commands
Definition at line 452 of file res_stun_monitor.c.
References ast_cli_entry::args, and ast_cli_unregister_multiple().
|
static |
Definition at line 426 of file res_stun_monitor.c.
struct sockaddr_in external_addr |
Current perceived external address.
Definition at line 59 of file res_stun_monitor.c.
unsigned int external_addr_known |
TRUE if the perceived external address is valid/known.
Definition at line 71 of file res_stun_monitor.c.
ast_mutex_t lock |
STUN monitor protection lock.
Definition at line 57 of file res_stun_monitor.c.
Referenced by __ast_bucket_scheme_register(), __ast_format_interface_register(), ast_aeap_connect(), ast_ari_add_handler(), ast_bridge_basic_set_flags(), ast_bridge_read_after_goto(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), ast_cdr_fork(), ast_channel_move(), ast_clear_mixmonitor_methods(), ast_config_engine_deregister(), ast_config_engine_register(), ast_endpoint_snapshot_create(), ast_format_cache_set(), ast_get_extension_for_mime_type(), ast_get_format_for_file_ext(), ast_realtime_is_mapping_defined(), ast_set_mixmonitor_methods(), ast_start_mixmonitor(), ast_stop_mixmonitor(), ast_taskprocessor_set_local(), ast_unreal_channel_push_to_bridge(), bridge_basic_change_personality(), bucket_file_wizard_retrieve(), bucket_wizard_retrieve(), clear_stimulus_queue(), conf_announce_channel_push(), event_session_shutdown(), find_engine(), get_park_common_datastore_copy(), load_task(), message_sink_cb(), one_protocol(), prometheus_callback_register(), prometheus_callback_unregister(), prometheus_last_scrape_time_get(), prometheus_metric_register(), prometheus_metric_registered_count(), prometheus_metric_unregister(), remove_hooks_on_personality_change(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), rtp_ioqueue_thread_get_or_create(), rtp_reload(), snoop_determine_format(), stasis_app_control_record(), stasis_app_playback_get_state(), stasis_app_playback_operation(), stasis_app_recording_operation(), stasis_message_sink_should_stay(), stasis_message_sink_wait_for(), stasis_message_sink_wait_for_count(), task(), and task_wait().
unsigned int monitor_enabled |
TRUE if the STUN monitor is enabled.
Definition at line 69 of file res_stun_monitor.c.
unsigned int refresh |
Number of seconds between polls to the STUN server for the external address.
Definition at line 65 of file res_stun_monitor.c.
Referenced by iax2_ack_registry(), and update_registry().
const char* server_hostname |
STUN server host name.
Definition at line 61 of file res_stun_monitor.c.
unsigned int stun_poll_failed_gripe |
TRUE if we have already griped about a STUN poll failing.
Definition at line 73 of file res_stun_monitor.c.
unsigned int stun_port |
Port of STUN server to use
Definition at line 63 of file res_stun_monitor.c.
int stun_sock |
Monitoring STUN socket.
Definition at line 67 of file res_stun_monitor.c.