Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

logging.h File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <time.h>

Go to the source code of this file.

Functions

char * dater ()
 Return the current date as Apache's standard. More...

void init_syslogger ()
 Initialize the logging system. More...

void logging_new_tag ()
 Increment the value of the current tag. More...

char * logger_last_error ()
 Return the last error message. More...

void activate_log_size_management ()
 Activate the log size management.

int my_syslog (const char *file, const char *fmt,...)
 Log one line in a given log file. More...

int my_syslog_skip_line (const char *file)
 Log 2 empty lines in a given log file. More...

void logger_set_gateway (const char *g)
 Set the gateway for 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...


Detailed Description

Header file for the logging module 'logging.c'.

Definition in file logging.h.


Function Documentation

char* dater  
 

Return the current date as Apache's standard.

Author:
Denis BEURIVE
Returns:
The function returns a pointer to a string of characters that contains the current date.
Warning:
The string is returned in a statically allocated buffer, which subsequent calls will overwrite.

Definition at line 213 of file logging.c.

References MAX_TIME_SIZE.

Referenced by log_profile(), my_syslog(), and packet_dump().

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.

Author:
Denis BEURIVE
Parameters:
mac  pointer to a zero terminated string of characters that represents the current MAC address.
vnode_id  Current node ID.
vshelf  Current shelf.
vslot  Current slot.
vport  Current port.
vvci  Current VCI.
vvlan_id  Current vlan_id.

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().

void init_syslogger  
 

Initialize the logging system.

Author:
Denis BEURIVE

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().

char* logger_last_error  
 

Return the last error message.

Returns:
The function returns a pointer to a statically alocated string of characters that represents the last error.

Definition at line 105 of file logging.c.

References last_error.

void logger_set_gateway const char *    g
 

Set the gateway for tag.

Parameters:
g  Pointer to a zero terminated string of characters that represents the gateway.

Definition at line 356 of file logging.c.

References gateway, and GATEWAY_IP_MAX_SIZE.

Referenced by main().

void logging_new_tag  
 

Increment the value of the current tag.

Author:
Denis BEURIVE

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().

int my_syslog const char *    file,
const char *    fmt,
...   
 

Log one line in a given log file.

Author:
Denis BEURIVE
Parameters:
file  Pointer to a zero terminated string of characters that represents the path to the log file.
ftm  Pointer to a zero terminated string of characters that defines the output formats (same as printf()).
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function returns the value 1.
Remarks:
This function behaves just like the function printf().

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().

int my_syslog_skip_line const char *    file
 

Log 2 empty lines in a given log file.

Author:
Denis BEURIVE
Parameters:
file  Pointer to a zero terminated string of characters that represents the path to the log file.
Returns:
Upon successful completion, the function returns the value 0. Otherwize, the function returns the value 1.

Definition at line 368 of file logging.c.

References clear_last_error(), and logger_set_last_error().

Referenced by main().


Generated on Mon Jun 19 12:31:06 2006 for MyDhcp_V2 by doxygen1.2.15