/home/aaron/olsrd-current/olsrd/src/core/olsr_logging.h File Reference

#include "common/common_types.h"
#include "common/list.h"
#include "defs.h"
#include "olsr_logging_sources.h"
Include dependency graph for olsr_logging.h:

Go to the source code of this file.

Data Structures

struct  log_handler_entry

Defines

#define LOGBUFFER_SIZE   1024
#define OLSR_DEBUG(source, format, args...)   do { if (log_global_mask[SEVERITY_DEBUG][source]) olsr_log(SEVERITY_DEBUG, source, false, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_DEBUG_NH(source, format, args...)   do { if (log_global_mask[SEVERITY_DEBUG][source]) olsr_log(SEVERITY_DEBUG, source, true, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_INFO(source, format, args...)   do { if (log_global_mask[SEVERITY_INFO][source]) olsr_log(SEVERITY_INFO, source, false, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_INFO_NH(source, format, args...)   do { if (log_global_mask[SEVERITY_INFO][source]) olsr_log(SEVERITY_INFO, source, true, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_WARN(source, format, args...)   do { if (log_global_mask[SEVERITY_WARN][source]) olsr_log(SEVERITY_WARN, source, false, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_WARN_NH(source, format, args...)   do { if (log_global_mask[SEVERITY_WARN][source]) olsr_log(SEVERITY_WARN, source, true, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_ERROR(source, format, args...)   do { if (log_global_mask[SEVERITY_ERR][source]) olsr_log(SEVERITY_ERR, source, false, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_ERROR_NH(source, format, args...)   do { if (log_global_mask[SEVERITY_ERR][source]) olsr_log(SEVERITY_ERR, source, true, __FILE__, __LINE__, format, ##args); } while(0)

Enumerations

enum  log_severity {
  SEVERITY_DEBUG, SEVERITY_INFO, SEVERITY_WARN, SEVERITY_ERR,
  LOG_SEVERITY_COUNT
}

Functions

void EXPORT() olsr_log_init (void)
void EXPORT() olsr_log_cleanup (void)
void EXPORT() olsr_log_applyconfig (void)
struct log_handler_entry *EXPORT() olsr_log_addhandler (void(*handler)(enum log_severity, enum log_source, bool, const char *, int, char *, int, int), bool(*mask)[LOG_SEVERITY_COUNT][LOG_SOURCE_COUNT])
void EXPORT() olsr_log_removehandler (struct log_handler_entry *)
void EXPORT() olsr_log_updatemask (void)
void EXPORT() olsr_log (enum log_severity, enum log_source, bool, const char *, int, const char *,...) __attribute__((format(printf
void EXPORT() bool EXPORT (log_global_mask)[LOG_SEVERITY_COUNT][LOG_SOURCE_COUNT]

Variables

const char * LOG_SEVERITY_NAMES []

Define Documentation

#define LOGBUFFER_SIZE   1024

Definition at line 50 of file olsr_logging.h.

Referenced by olsr_log().

#define OLSR_DEBUG ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_DEBUG][source]) olsr_log(SEVERITY_DEBUG, source, false, __FILE__, __LINE__, format, ##args); } while(0)

these four macros should be used to generate OLSR logging output

OLSR_DEBUG should be used for all output that is only usefull for debugging a specific part of the code. This could be information about the internal progress of a function, state of variables, ...

OLSR_INFO should be used for all output that does not inform the user about a problem/error in OLSR. Examples would be "SPF run triggered" or "Hello package received from XXX.XXX.XXX.XXX".

OLSR_WARN should be used for all error messages that do not prevent OLSR from continue to work.

OLSR_ERROR is reserved for error output to the user just before the OLSR agent will be terminated.

Definition at line 88 of file olsr_logging.h.

Referenced by activate_tree_link(), add_link_entry(), add_lost_interface_ip(), add_signature(), AddInterface(), addObampNode4(), AddObampSniffingIf(), allowed_hostname_or_ip_in_service(), allowed_ip(), arproaming_client_add(), arproaming_client_update(), arproaming_exit(), bind_socket_to_device(), BmfEncapsulationPacketReceived(), BmfPacketCaptured(), BmfPError(), BmfTunPacketCaptured(), build_http_header(), calc_jitter(), check_auth(), check_gw(), check_interface_updates(), check_ping_result(), check_timestamp(), CheckDataFromTreeLink(), CheckDupData(), chk_if_changed(), CloseBmfNetworkInterfaces(), CoreElection(), create_packet(), CreateCaptureSocket(), CreateInterface(), CreateLocalEtherTunTap(), CreateObampSniffingInterfaces(), deactivate_tree_link(), decap_data(), decap_namemsg(), delete_outdated_tc_edges(), DoBmf(), EncapFlowInObamp(), EncapsulateAndForwardPacket(), FindNeighbors(), forward_obamp_data(), FriendlyNameToMiniIndex(), GetIntInfo(), hello_tap(), init_msg_seqno(), InitOBAMP(), insert_new_name_in_list(), InterfaceChange(), internal_delete_tc_edge_entry(), ipc_action(), join_mcast(), ListInterfaces(), lookup_link_entry(), lookup_timestamp_entry(), lq_etxff_packet_parser(), lq_etxff_timer(), manage_hello(), manage_tree_create(), mesh_create(), obamp_alive_gen(), ObampSignalling(), olsr_add_nbr2_entry(), olsr_add_nbr_entry(), olsr_add_tc_edge_entry(), olsr_add_tc_entry(), olsr_calculate_routing_table(), olsr_callback_add_object(), olsr_callback_change_object(), olsr_callback_cons_register(), olsr_callback_cons_unregister(), olsr_callback_prv_create(), olsr_callback_prv_destroy(), olsr_callback_remove_object(), olsr_com_build_httpheader(), olsr_com_handle_htmlsite(), olsr_com_handle_txtcommand(), olsr_com_parse_connection(), olsr_com_parse_http(), olsr_com_parse_request(), olsr_com_parse_txt(), olsr_delete_all_kernel_routes(), olsr_delete_link_entry_by_if(), olsr_delete_nbr2_entry(), olsr_delete_nbr_entry(), olsr_delete_revoked_tc_edges(), olsr_delete_routing_table(), olsr_delete_tc_edge_entry(), olsr_delete_tc_entry(), olsr_disable_plugin(), olsr_enable_plugin(), olsr_event(), olsr_event_doing_hna(), olsr_expire_buffer_timer(), olsr_expire_hna_net_entry(), olsr_expire_mid_entries(), olsr_expire_tc_edge_gc(), olsr_expire_tc_entry(), olsr_fixup_mid_main_addr(), olsr_flush_hna_nets(), olsr_flush_nbr2_duplicates(), olsr_forward_message(), olsr_input(), olsr_input_hna(), olsr_input_mid(), olsr_input_tc(), olsr_insert_mid_entry(), olsr_insert_routing_table(), olsr_is_duplicate_message(), olsr_load_legacy_plugin(), olsr_memcookie_free(), olsr_memcookie_malloc(), olsr_msg_statistics(), olsr_namesvc_delete_db_entry(), olsr_namesvc_gen(), olsr_obamp_gen(), olsr_output_lq_tc_internal(), olsr_parser(), olsr_process_changes(), olsr_socket_add(), olsr_socket_remove(), olsr_spf_add_cand_tree(), olsr_spf_add_path_list(), olsr_spf_del_cand_tree(), olsr_spf_relax(), olsr_tc_update_edge(), olsr_timer_change(), olsr_timer_start(), olsr_timer_stop(), olsr_timer_walk(), olsr_update_nbr_status(), olsr_update_rib_routes(), olsr_validate_address(), olsrd_plugin_init(), os_apm_printinfo(), os_cleanup(), os_cleanup_global_ifoptions(), os_getsocket4(), os_getsocket6(), os_init(), os_init_interface(), os_route_add_rtentry(), os_route_del_rtentry(), outer_tree_create(), PacketReceivedFromOLSR(), parse_challenge(), parse_cres(), parse_http_header(), parse_http_request(), parse_packet(), parse_rres(), ping_is_possible(), printObampNodesList(), purge_nodes(), read_key_from_file(), remove_lost_interface_ip(), reset_tree_links(), secure_preprocessor(), select_best_nameserver(), select_tree_anchor(), send_challenge(), send_cres(), send_destroy_tree_link(), send_rres(), send_sighup_to_pidfile(), SendOBAMPData(), timeout_timestamps(), tree_create(), tree_create_forward_to(), tree_create_gen(), tree_link_ack(), tree_link_req(), UdpServer(), update_name_entry(), validate_packet(), write_hosts_file(), write_resolv_file(), write_services_file(), and writeToProc().

#define OLSR_DEBUG_NH ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_DEBUG][source]) olsr_log(SEVERITY_DEBUG, source, true, __FILE__, __LINE__, format, ##args); } while(0)

Definition at line 89 of file olsr_logging.h.

#define OLSR_ERROR ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_ERR][source]) olsr_log(SEVERITY_ERR, source, false, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_ERROR_NH ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_ERR][source]) olsr_log(SEVERITY_ERR, source, true, __FILE__, __LINE__, format, ##args); } while(0)

Definition at line 113 of file olsr_logging.h.

#define OLSR_INFO ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_INFO][source]) olsr_log(SEVERITY_INFO, source, false, __FILE__, __LINE__, format, ##args); } while(0)

Definition at line 96 of file olsr_logging.h.

Referenced by __attribute__(), add_client_to_list(), add_interface(), check_client_list(), check_for_route(), check_ping_result(), chk_if_changed(), generate_hello(), generate_hna(), generate_mid(), init_interfaces(), init_lq_handler(), init_net(), join_mcast(), ListInterfaces(), main(), my_init(), name_destructor(), name_init(), olsr_add_invalid_address(), olsr_calculate_willingness(), olsr_deinit_parser(), olsr_disable_plugin(), olsr_enable_plugin(), olsr_init_duplicate_set(), olsr_init_export_route(), olsr_init_hna_set(), olsr_init_link_set(), olsr_init_mid_set(), olsr_init_neighbor_table(), olsr_init_parser(), olsr_init_plugin(), olsr_init_routing_table(), olsr_init_tc(), olsr_init_willingness(), olsr_input(), olsr_internal_unload_plugin(), olsr_output_lq_tc_internal(), olsr_packetparser_add_function(), olsr_parser(), olsr_parser_add_function(), olsr_plugins_enable(), olsr_plugins_init(), olsr_preprocessor_add_function(), olsr_print_duplicate_table(), olsr_print_hna_set(), olsr_print_link_set(), olsr_print_mid_set(), olsr_print_neighbor_table(), olsr_print_routing_table(), olsr_print_tc_table(), olsr_shutdown(), olsr_timer_init(), olsr_update_willingness(), olsrd_plugin_init(), os_apm_init(), os_apm_printinfo(), os_init_interface(), os_route_add_rtentry(), os_route_del_rtentry(), parse_packet(), ping_infinite(), remove_interface(), remove_nonvalid_names_from_list(), rtnetlink_read(), secure_plugin_init(), set_nameservice_float(), set_nameservice_host(), set_nameservice_name(), set_nameservice_server(), set_plugin_float(), set_plugin_int(), set_plugin_ipaddress(), set_plugin_port(), set_plugin_string(), set_plugin_test(), signal_reconfigure(), signal_shutdown(), single_hna(), spread_host(), and update_routes_now().

#define OLSR_INFO_NH ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_INFO][source]) olsr_log(SEVERITY_INFO, source, true, __FILE__, __LINE__, format, ##args); } while(0)
#define OLSR_WARN ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_WARN][source]) olsr_log(SEVERITY_WARN, source, false, __FILE__, __LINE__, format, ##args); } while(0)

Definition at line 104 of file olsr_logging.h.

Referenced by __attribute__(), AddMulticastRoute(), AddNonOlsrBmfIf(), allowed_hostname_or_ip_in_service(), apm_read_apm(), arproaming_init(), BmfEncapsulationPacketReceived(), BmfPacketCaptured(), BmfRun(), BmfTunPacketCaptured(), check_for_route(), check_gw(), check_ping_result(), chk_if_changed(), CloseBmf(), CreateBmfNetworkInterfaces(), CreateCaptureSocket(), CreateEncapsulateSocket(), CreateInterface(), CreateListeningSocket(), CreateLocalEtherTunTap(), DeactivateSpoofFilter(), DeleteMulticastRoute(), DoBmf(), dotdraw_enable(), encap_namemsg(), EncapsulateAndForwardPacket(), FriendlyNameToMiniIndex(), generate_mid(), get_http_socket(), GetIntInfo(), init_net(), InitBmf(), InterfaceChange(), ip_acl_plugin_parse(), ipc_action(), ipc_send(), is_at_least_linuxkernel_2_6_31(), join_mcast(), ListInterfaces(), looped_checks(), lq_etxff_packet_parser(), main(), mapwrite_init(), name_init(), net_os_restore_ifoption(), net_os_set_ifoptions(), net_output(), olsr_add_route(), olsr_arp_event(), olsr_calculate_willingness(), olsr_callback_add_object(), olsr_callback_change_object(), olsr_callback_cons_register(), olsr_callback_prv_create(), olsr_callback_remove_object(), olsr_clock_update(), olsr_com_parse_connection(), olsr_del_route(), olsr_enable_plugin(), olsr_forward_message(), olsr_input(), olsr_load_legacy_plugin(), olsr_log_applyconfig(), olsr_memcookie_add_custom(), olsr_memcookie_remove_custom(), olsr_namesvc_gen(), olsr_netlink_send(), olsr_new_netlink_route(), olsr_os_process_rt_entry(), olsr_parse_cfg(), olsr_parser(), olsr_plugins_enable(), olsr_plugins_init(), olsr_socket_add(), olsr_socket_handle(), olsr_watchdog_write_alivefile(), olsrd_plugin_init(), os_cleanup(), os_cleanup_global_ifoptions(), os_clear_console(), os_getsocket4(), os_getsocket6(), os_init(), os_init_global_ifoptions(), os_init_interface(), os_interface_set_state(), os_ip4_tunnel(), os_ip6_tunnel(), os_iptunnel_add_ipip(), os_is_interface_up(), os_route_add_rtentry(), os_route_del_rtentry(), os_socket_set_nonblocking(), os_socket_set_olsr_options(), parse_http_request(), parse_packet(), read_key_from_file(), remove_nonvalid_names_from_list(), RestoreSpoofFilter(), rtnetlink_read(), send_sighup_to_pidfile(), set_nameservice_float(), set_nameservice_host(), set_nameservice_name(), set_nameservice_server(), set_plugin_hna(), set_plugin_int(), set_plugin_ipaddress(), set_plugin_port(), set_plugin_string(), try_read(), update_name_entry(), write_hosts_file(), write_resolv_file(), write_services_file(), writeToProc(), and zebra_send_command().

#define OLSR_WARN_NH ( source,
format,
args...   )     do { if (log_global_mask[SEVERITY_WARN][source]) olsr_log(SEVERITY_WARN, source, true, __FILE__, __LINE__, format, ##args); } while(0)

Definition at line 105 of file olsr_logging.h.


Enumeration Type Documentation

defines the severity of a logging event

Enumerator:
SEVERITY_DEBUG 

SEVERITY_DEBUG.

SEVERITY_INFO 

SEVERITY_INFO.

SEVERITY_WARN 

SEVERITY_WARN.

SEVERITY_ERR 

SEVERITY_ERR.

LOG_SEVERITY_COUNT 

LOG_SEVERITY_COUNT.

Definition at line 55 of file olsr_logging.h.


Function Documentation

void EXPORT() bool EXPORT ( log_global_mask   ) 
void EXPORT() olsr_log ( enum log_severity  ,
enum log_source  ,
bool  ,
const char *  ,
int  ,
const char *  ,
  ... 
)
struct log_handler_entry* EXPORT() olsr_log_addhandler ( void(*)(enum log_severity, enum log_source, bool, const char *, int, char *, int, int)  handler,
bool(*)  mask[LOG_SEVERITY_COUNT][LOG_SOURCE_COUNT] 
) [read]

Registers a custom logevent handler

Parameters:
handler pointer to handler function
mask pointer to custom event filter or NULL if handler use filter from olsr_cnf

Definition at line 150 of file olsr_logging.c.

References log_handler_entry::bitmask_ptr, log_handler_entry::handler, list_add_tail(), log_handler_list, log_handler_entry::node, olsr_log_updatemask(), and olsr_malloc().

Referenced by debuginfo_log(), and olsr_log_applyconfig().

Here is the call graph for this function:

void EXPORT() olsr_log_applyconfig ( void   ) 

Configure logger according to olsr settings

Definition at line 126 of file olsr_logging.c.

References olsr_config::log_event, log_fileoutput, LOG_LOGGING, olsr_config::log_target_file, olsr_config::log_target_stderr, olsr_config::log_target_syslog, olsr_cnf, olsr_log_addhandler(), olsr_log_file(), olsr_log_stderr(), olsr_log_syslog(), and OLSR_WARN.

Referenced by main().

Here is the call graph for this function:

void EXPORT() olsr_log_cleanup ( void   ) 

Called just before olsr_shutdown finishes

Definition at line 106 of file olsr_logging.c.

References FOR_ALL_LOGHANDLERS, log_fileoutput, and olsr_log_removehandler().

Referenced by olsr_shutdown().

Here is the call graph for this function:

void EXPORT() olsr_log_init ( void   ) 

Called by main method just after configuration options have been parsed

Definition at line 84 of file olsr_logging.c.

References list_init_head(), log_global_mask, log_handler_list, LOG_SEVERITY_COUNT, LOG_SOURCE_COUNT, SEVERITY_INFO, and SEVERITY_WARN.

Referenced by main().

Here is the call graph for this function:

void EXPORT() olsr_log_removehandler ( struct log_handler_entry h  ) 

Call this function to remove a logevent handler

Parameters:
handler pointer to handler function

Definition at line 176 of file olsr_logging.c.

References list_remove(), log_handler_entry::node, and olsr_log_updatemask().

Referenced by debuginfo_stop_logging(), and olsr_log_cleanup().

Here is the call graph for this function:

void EXPORT() olsr_log_updatemask ( void   ) 

Recalculate the combination of the olsr_cnf log event mask and all (if any) custom masks of logfile handlers. Must be called every times a event mask changes.

Definition at line 190 of file olsr_logging.c.

References log_handler_entry::bitmask_ptr, FOR_ALL_LOGHANDLERS, log_handler_entry::int_bitmask, LOG_ALL, log_global_mask, LOG_SEVERITY_COUNT, and LOG_SOURCE_COUNT.

Referenced by olsr_log_addhandler(), and olsr_log_removehandler().


Variable Documentation

const char* LOG_SEVERITY_NAMES[]
Generated on Fri May 24 06:00:04 2013 for olsrd by  doxygen 1.6.3