#include "logging.h"
Go to the source code of this file.
Defines | |
#define | MAX_TIME_SIZE 512 |
Maximum number of characters for a date. | |
#define | MAXLOGFILESIZE 2147381248 |
Maximum size (in bytes) fir the log file. More... | |
#define | MAC_ADDRESS_DOTED_SIZE 18 |
Maximum number of characters (including the final zero) for a MAC address written with ':' separators. Example: "00:11:22:33:44:55". | |
#define | GATEWAY_IP_MAX_SIZE 16 |
Maximum number of characters (including the final zero) for the gateway IP address. | |
#define | NODE_ID_MAX_SIZE 20 |
Maximum number of characters (including the final zero) for a node ID. | |
#define | ERROR_SIZE 2048 |
Maximum number of characters for the error message. | |
Functions | |
void | activate_log_size_management () |
Activate the log size management. | |
char * | logger_last_error () |
Return the last error message. More... | |
void | logger_set_last_error (const char *fmt,...) |
Set the last error message. More... | |
void | clear_last_error () |
Clear the last error (set all zeros). | |
void | logging_new_tag () |
Increment the value of the current tag. More... | |
void | init_client_ids (char *mac, char *vnode_id, unsigned long int vshelf, unsigned long int vslot, unsigned long int vport, unsigned short int vvci, unsigned short int vvlan_id) |
Initialize the client's identifier. More... | |
void | init_syslogger () |
Initialize the logging system. More... | |
char * | log_tag () |
Return the current tag. More... | |
char * | dater () |
Return the current date as Apache's standard. More... | |
char * | filetimestamp () |
Return a timestamp usable for file name. More... | |
unsigned long int | get_file_size (const char *file) |
Get the size of a given file (in bytes). More... | |
int | my_syslog (const char *file, const char *fmt,...) |
Log one line in a given log file. More... | |
void | logger_set_gateway (const char *g) |
Set the gateway for tag. More... | |
int | my_syslog_skip_line (const char *file) |
Log 2 empty lines in a given log file. More... | |
Variables | |
char | current_mac_address [MAC_ADDRESS_DOTED_SIZE] |
Current MAC address. | |
char | gateway [GATEWAY_IP_MAX_SIZE] |
Current gateway. | |
char | node_id [NODE_ID_MAX_SIZE] |
Current node ID. | |
unsigned long int | shelf = 0 |
Current shelf number. | |
unsigned long int | slot = 0 |
Current slot number. | |
unsigned long int | port = 0 |
Current port number. | |
unsigned short int | vci = 0 |
Current VCI. | |
unsigned short int | vlan_id = 0 |
Current VLAN id. | |
unsigned int | current_tag = 0 |
Numerical value of the current tag. | |
int | logsize = 0 |
This flag defines if the server should manage the size of the log file. | |
char | last_error [ERROR_SIZE] |
Last error for this module. |
Definition in file logging.c.
|
Maximum size (in bytes) fir the log file.
Definition at line 16 of file logging.c. Referenced by my_syslog(). |
|
Return the current date as Apache's standard.
Definition at line 213 of file logging.c. References MAX_TIME_SIZE. Referenced by log_profile(), my_syslog(), and packet_dump(). |
|
Return a timestamp usable for file name.
Definition at line 230 of file logging.c. References MAX_TIME_SIZE. Referenced by my_syslog(). |
|
Get the size of a given file (in bytes).
Definition at line 252 of file logging.c. References clear_last_error(), and logger_set_last_error(). Referenced by my_syslog(). |
|
Initialize the client's identifier.
Definition at line 160 of file logging.c. References current_mac_address, gateway, GATEWAY_IP_MAX_SIZE, MAC_ADDRESS_DOTED_SIZE, node_id, NODE_ID_MAX_SIZE, port, shelf, slot, vci, and vlan_id. Referenced by main(). |
|
Initialize the logging system.
Definition at line 182 of file logging.c. References current_mac_address, gateway, GATEWAY_IP_MAX_SIZE, MAC_ADDRESS_DOTED_SIZE, node_id, and NODE_ID_MAX_SIZE. Referenced by main(). |
|
Return the current tag.
Definition at line 195 of file logging.c. References current_tag. Referenced by my_syslog(). |
|
Return the last error message.
Definition at line 105 of file logging.c. References last_error. |
|
Set the gateway for tag.
Definition at line 356 of file logging.c. References gateway, and GATEWAY_IP_MAX_SIZE. Referenced by main(). |
|
Set the last error message.
Definition at line 111 of file logging.c. References ERROR_SIZE, and last_error. Referenced by get_file_size(), my_syslog(), and my_syslog_skip_line(). |
|
Increment the value of the current tag.
Definition at line 131 of file logging.c. References current_mac_address, current_tag, gateway, GATEWAY_IP_MAX_SIZE, MAC_ADDRESS_DOTED_SIZE, node_id, NODE_ID_MAX_SIZE, port, shelf, slot, vci, and vlan_id. Referenced by main(). |
|
Log one line in a given log file.
Definition at line 277 of file logging.c. References clear_last_error(), current_mac_address, dater(), filetimestamp(), gateway, get_file_size(), log_tag(), logger_set_last_error(), MAXLOGFILESIZE, node_id, port, shelf, slot, vci, and vlan_id. Referenced by add_option_to_profile(), ascii_to_binary(), connect_to_mysql(), context2profile(), create_socket(), dump_packet_hexa(), find_ip_and_reply(), get_unix_timestamp(), haddr_to_hexa(), hexa_to_binary(), ip_to_network_byte_order(), load_mysql_configuration_from_file(), look_up_logistic(), main(), packet_dump(), packets_parse_options(), packets_send_ack(), packets_send_dummy_nak(), packets_send_nack(), packets_send_offer(), remove_option_from_profile(), reply_to_inform(), sql_select(), standard_query(), uint16_to_network_byte_order(), and uint32_to_network_byte_order(). |
|
Log 2 empty lines in a given log file.
Definition at line 368 of file logging.c. References clear_last_error(), and logger_set_last_error(). Referenced by main(). |