Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include <netinet/in.h>
#include <pjsip.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include "asterisk/cli.h"
#include "asterisk/netsock2.h"
#include "asterisk/acl.h"
Go to the source code of this file.
Data Structures | |
struct | pcap_ethernet_header |
PCAP Ethernet Header. More... | |
struct | pcap_header |
PCAP Header. More... | |
struct | pcap_ipv4_header |
PCAP IPv4 Header. More... | |
struct | pcap_ipv6_header |
PCAP IPv6 Header. More... | |
struct | pcap_record_header |
PCAP Packet Record Header. More... | |
struct | pcap_udp_header |
PCAP UDP Header. More... | |
struct | pjsip_logger_session |
PJSIP Logging Session. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | check_debug (void) |
static void | global_reloaded (const char *object_type) |
static int | load_module (void) |
static pj_bool_t | logging_on_rx_msg (pjsip_rx_data *rdata) |
static pj_status_t | logging_on_tx_msg (pjsip_tx_data *tdata) |
static char * | pjsip_disable_logger (int fd) |
static char * | pjsip_enable_logger_all (int fd) |
static char * | pjsip_enable_logger_host (int fd, const char *arg, unsigned int add_host) |
static int | pjsip_log_test_addr (const struct pjsip_logger_session *session, const char *address, int port) |
See if we pass debug IP filter. More... | |
static struct pjsip_logger_session * | pjsip_logger_session_alloc (void) |
Allocator for logger session. More... | |
static void | pjsip_logger_session_destroy (void *obj) |
Destructor for logger session. More... | |
static void | pjsip_logger_write_to_pcap (struct pjsip_logger_session *session, const char *msg, size_t msg_len, pj_sockaddr *source, pj_sockaddr *destination) |
static char * | pjsip_set_logger (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | pjsip_set_logger_pcap (int fd, const char *arg) |
static char * | pjsip_set_logger_verbose (int fd, const char *arg) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Packet Logger" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_pjsip [] |
static struct pjsip_logger_session * | default_logger |
The default logger session. More... | |
static const struct ast_sorcery_observer | global_observer |
static pjsip_module | logging_module |
|
static |
Definition at line 586 of file res_pjsip_logger.c.
|
static |
Definition at line 586 of file res_pjsip_logger.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 586 of file res_pjsip_logger.c.
|
static |
Definition at line 514 of file res_pjsip_logger.c.
References ast_false(), ast_free, ast_log, ast_sip_get_debug(), ast_true(), CLI_SUCCESS, debug, LOG_WARNING, pjsip_disable_logger(), pjsip_enable_logger_all(), pjsip_enable_logger_host(), and RAII_VAR.
Referenced by global_reloaded(), and load_module().
|
static |
|
static |
Definition at line 543 of file res_pjsip_logger.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_sip_get_sorcery(), ast_sip_register_service(), ast_sorcery_observer_add(), ast_sorcery_observer_remove(), check_debug(), LOG_WARNING, and pjsip_logger_session_alloc().
Referenced by unload_module().
|
static |
Definition at line 296 of file res_pjsip_logger.c.
References ao2_rdlock, ao2_unlock, AST_SOCKADDR_BUFLEN, ast_verbose(), pjsip_logger_session::log_to_pcap, pjsip_logger_session::log_to_verbose, NULL, pjsip_log_test_addr(), and pjsip_logger_write_to_pcap().
|
static |
Definition at line 268 of file res_pjsip_logger.c.
References ao2_rdlock, ao2_unlock, AST_SOCKADDR_BUFLEN, ast_verbose(), pjsip_logger_session::log_to_pcap, pjsip_logger_session::log_to_verbose, NULL, pjsip_log_test_addr(), and pjsip_logger_write_to_pcap().
|
static |
Definition at line 396 of file res_pjsip_logger.c.
References ao2_unlock, ao2_wrlock, ast_cli(), ast_free_ha(), CLI_SUCCESS, pjsip_logger_session::enabled, pjsip_logger_session::log_all_traffic, pjsip_logger_session::log_to_pcap, pjsip_logger_session::log_to_verbose, pjsip_logger_session::matches, NULL, pjsip_logger_session::pcap_file, and pjsip_logger_session::pcap_filename.
Referenced by check_debug(), and pjsip_set_logger().
|
static |
Definition at line 337 of file res_pjsip_logger.c.
References ao2_unlock, ao2_wrlock, ast_cli(), CLI_SUCCESS, pjsip_logger_session::enabled, and pjsip_logger_session::log_all_traffic.
Referenced by check_debug(), and pjsip_set_logger().
|
static |
Definition at line 351 of file res_pjsip_logger.c.
References ao2_unlock, ao2_wrlock, AST_AF_UNSPEC, ast_append_ha_with_port(), ast_cli(), ast_free_ha(), ast_sockaddr_parse(), ast_sockaddr_resolve_first_af(), ast_sockaddr_stringify(), ast_sockaddr_stringify_addr(), CLI_SHOWUSAGE, CLI_SUCCESS, pjsip_logger_session::enabled, error(), host, pjsip_logger_session::matches, and NULL.
Referenced by check_debug(), and pjsip_set_logger().
|
inlinestatic |
See if we pass debug IP filter.
Definition at line 152 of file res_pjsip_logger.c.
References ast_apply_ha(), AST_SENSE_ALLOW, ast_sockaddr_parse(), ast_sockaddr_set_port, ast_strlen_zero, pjsip_logger_session::enabled, pjsip_logger_session::log_all_traffic, pjsip_logger_session::matches, and PARSE_PORT_IGNORE.
Referenced by logging_on_rx_msg(), and logging_on_tx_msg().
|
static |
Allocator for logger session.
Definition at line 136 of file res_pjsip_logger.c.
References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_alloc_options, pjsip_logger_session::log_to_verbose, NULL, pjsip_logger_session_destroy(), and session.
Referenced by load_module().
|
static |
Destructor for logger session.
Definition at line 124 of file res_pjsip_logger.c.
References ast_free_ha(), pjsip_logger_session::matches, pjsip_logger_session::pcap_file, and session.
Referenced by pjsip_logger_session_alloc().
|
static |
Definition at line 180 of file res_pjsip_logger.c.
References ao2_unlock, ao2_wrlock, ast_log, ast_tvnow(), pcap_udp_header::dst, errno, pcap_record_header::incl_len, pcap_ipv6_header::ip6_ctlun, pcap_ipv6_header::ip6_dst, pcap_ipv6_header::ip6_src, pcap_ipv6_header::ip6_un1, pcap_ipv6_header::ip6_un2_vfc, pcap_ipv4_header::ip_dst, pcap_ipv4_header::ip_len, pcap_ipv4_header::ip_protocol, pcap_ipv4_header::ip_src, pcap_udp_header::length, LOG_WARNING, pcap_record_header::orig_len, pjsip_logger_session::pcap_file, pcap_udp_header::src, pcap_record_header::ts_sec, pcap_ethernet_header::type, and pcap_ipv4_header::ver_ihl.
Referenced by logging_on_rx_msg(), and logging_on_tx_msg().
|
static |
Definition at line 470 of file res_pjsip_logger.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, ast_cli_entry::command, ast_cli_args::fd, NULL, pjsip_disable_logger(), pjsip_enable_logger_all(), pjsip_enable_logger_host(), pjsip_set_logger_pcap(), pjsip_set_logger_verbose(), and ast_cli_entry::usage.
|
static |
Definition at line 436 of file res_pjsip_logger.c.
References ao2_unlock, ao2_wrlock, ast_cli(), ast_copy_string(), CLI_SUCCESS, pjsip_logger_session::log_to_pcap, pcap_header::magic_number, NULL, pjsip_logger_session::pcap_file, and pjsip_logger_session::pcap_filename.
Referenced by pjsip_set_logger().
|
static |
Definition at line 425 of file res_pjsip_logger.c.
References ao2_unlock, ao2_wrlock, ast_cli(), ast_true(), CLI_SUCCESS, and pjsip_logger_session::log_to_verbose.
Referenced by pjsip_set_logger().
|
static |
Definition at line 566 of file res_pjsip_logger.c.
References ao2_cleanup, ARRAY_LEN, ast_cli_unregister_multiple(), AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ast_sip_get_sorcery(), ast_sip_unregister_service(), ast_sorcery_observer_remove(), ASTERISK_GPL_KEY, load_module(), and NULL.
|
static |
Definition at line 586 of file res_pjsip_logger.c.
|
static |
Definition at line 586 of file res_pjsip_logger.c.
|
static |
Definition at line 510 of file res_pjsip_logger.c.
|
static |
The default logger session.
Definition at line 121 of file res_pjsip_logger.c.
|
static |
Definition at line 539 of file res_pjsip_logger.c.
|
static |
Definition at line 328 of file res_pjsip_logger.c.