PgSQL logging module
[Logging modules]

Collaboration diagram for PgSQL logging module:


Functions

static int formatINET (struct log_pgsql_params *params, char *buffer, socklen_t buflen, const struct in6_addr *addr6, int use_ntohl)
G_MODULE_EXPORT gboolean unload_module_with_params (gpointer params_p)
static nu_error_t pgsql_close_open_user_sessions (struct log_pgsql_params *params)
 Close all open user sessions.
G_MODULE_EXPORT gboolean init_module_from_conf (module_t *module)
static PGconn * pgsql_conn_init (struct log_pgsql_params *params)
static char * quote_pgsql_string (char *text)
static gchar * generate_osname (gchar *Name, gchar *Version, gchar *Release)
static int pgsql_insert (PGconn *ld, connection_t *element, char *oob_prefix, tcp_state_t state, struct log_pgsql_params *params)
static int pgsql_update_close (PGconn *ld, connection_t *element, struct log_pgsql_params *params)
static int pgsql_update_state (PGconn *ld, struct accounted_connection *element, tcp_state_t old_state, tcp_state_t new_state, int reverse, struct log_pgsql_params *params)
static PGconn * get_pgsql_handler (struct log_pgsql_params *params)
G_MODULE_EXPORT gint user_packet_logs (void *element, tcp_state_t state, gpointer params_p)
G_MODULE_EXPORT int user_session_logs (user_session_t *c_session, session_state_t state, gpointer params_p)

Function Documentation

static int formatINET ( struct log_pgsql_params params,
char *  buffer,
socklen_t  buflen,
const struct in6_addr *  addr6,
int  use_ntohl 
) [static]

Convert an IPv6 address to PostgreSQL SQL format.

Returns:
Returns 0 on error, 1 otherwise.

Definition at line 62 of file pgsql.c.

References DEBUG_AREA_MAIN, is_ipv4(), log_message, and log_pgsql_params::pgsql_use_ipv4.

Referenced by pgsql_insert(), pgsql_update_close(), pgsql_update_state(), and user_session_logs().

Here is the call graph for this function:

static gchar* generate_osname ( gchar *  Name,
gchar *  Version,
gchar *  Release 
) [static]

Definition at line 252 of file pgsql.c.

References OSNAME_MAX_SIZE, and quote_pgsql_string().

Here is the call graph for this function:

static PGconn* get_pgsql_handler ( struct log_pgsql_params params  )  [static]

Definition at line 558 of file pgsql.c.

References DEBUG_AREA_MAIN, log_message, pgsql_conn_init(), and log_pgsql_params::pgsql_priv.

Referenced by user_packet_logs(), and user_session_logs().

Here is the call graph for this function:

G_MODULE_EXPORT gboolean init_module_from_conf ( module_t module  ) 

Definition at line 169 of file pgsql.c.

References DEBUG_AREA_MAIN, log_message, nuauth_is_reloading(), nubase_config_table_get_or_default(), nubase_config_table_get_or_default_int(), module_t::params, pgsql_close_open_user_sessions(), PGSQL_DB_NAME, log_pgsql_params::pgsql_db_name, PGSQL_PASSWD, log_pgsql_params::pgsql_passwd, log_pgsql_params::pgsql_priv, PGSQL_REQUEST_TIMEOUT, log_pgsql_params::pgsql_request_timeout, PGSQL_SERVER, log_pgsql_params::pgsql_server, PGSQL_SERVER_PORT, log_pgsql_params::pgsql_server_port, PGSQL_SSL, log_pgsql_params::pgsql_ssl, PGSQL_TABLE_NAME, log_pgsql_params::pgsql_table_name, PGSQL_USE_IPV4, log_pgsql_params::pgsql_use_ipv4, PGSQL_USER, log_pgsql_params::pgsql_user, PGSQL_USERS_TABLE_NAME, log_pgsql_params::pgsql_users_table_name, and TRUE.

Here is the call graph for this function:

static nu_error_t pgsql_close_open_user_sessions ( struct log_pgsql_params params  )  [static]

Close all open user sessions.

Returns:
A nu_error_t

Definition at line 128 of file pgsql.c.

References DEBUG_AREA_MAIN, INSERT_REQUEST_VALUES_SIZE, log_message, NU_EXIT_ERROR, NU_EXIT_OK, pgsql_conn_init(), log_pgsql_params::pgsql_users_table_name, and secure_snprintf().

Referenced by init_module_from_conf(), and unload_module_with_params().

Here is the call graph for this function:

static PGconn * pgsql_conn_init ( struct log_pgsql_params params  )  [static]

Definition at line 206 of file pgsql.c.

References DEBUG, DEBUG_AREA_MAIN, log_message, log_pgsql_params::pgsql_db_name, log_pgsql_params::pgsql_passwd, log_pgsql_params::pgsql_request_timeout, log_pgsql_params::pgsql_server, log_pgsql_params::pgsql_server_port, and log_pgsql_params::pgsql_user.

Referenced by get_pgsql_handler(), and pgsql_close_open_user_sessions().

static int pgsql_insert ( PGconn *  ld,
connection_t element,
char *  oob_prefix,
tcp_state_t  state,
struct log_pgsql_params params 
) [static]

Definition at line 267 of file pgsql.c.

References connection_t::app_name, APPNAME_MAX_SIZE, tracking_t::daddr, DEBUG_AREA_MAIN, tracking_t::dest, formatINET(), generate_osname(), INSERT_REQUEST_FIELDS_SIZE, INSERT_REQUEST_VALUES_SIZE, log_message, connection_t::log_prefix, connection_t::os_release, connection_t::os_sysname, connection_t::os_version, log_pgsql_params::pgsql_table_name, tracking_t::protocol, quote_pgsql_string(), tracking_t::saddr, secure_snprintf(), tracking_t::source, connection_t::timestamp, connection_t::tracking, connection_t::user_id, and connection_t::username.

Referenced by user_packet_logs().

Here is the call graph for this function:

static int pgsql_update_close ( PGconn *  ld,
connection_t element,
struct log_pgsql_params params 
) [static]

Definition at line 406 of file pgsql.c.

References DEBUG_AREA_MAIN, formatINET(), log_message, log_pgsql_params::pgsql_table_name, tracking_t::saddr, secure_snprintf(), SHORT_REQUEST_SIZE, tracking_t::source, TCP_STATE_CLOSE, connection_t::timestamp, and connection_t::tracking.

Referenced by user_packet_logs().

Here is the call graph for this function:

static int pgsql_update_state ( PGconn *  ld,
struct accounted_connection element,
tcp_state_t  old_state,
tcp_state_t  new_state,
int  reverse,
struct log_pgsql_params params 
) [static]

Definition at line 447 of file pgsql.c.

References accounted_connection::bytes_in, accounted_connection::bytes_out, tracking_t::daddr, DEBUG, DEBUG_AREA_MAIN, debug_log_message, tracking_t::dest, formatINET(), log_message, accounted_connection::packets_in, accounted_connection::packets_out, log_pgsql_params::pgsql_table_name, tracking_t::saddr, secure_snprintf(), SHORT_REQUEST_SIZE, tracking_t::source, TCP_STATE_CLOSE, TCP_STATE_ESTABLISHED, accounted_connection::timestamp, and accounted_connection::tracking.

Referenced by user_packet_logs().

Here is the call graph for this function:

static char* quote_pgsql_string ( char *  text  )  [static]

Definition at line 241 of file pgsql.c.

Referenced by generate_osname(), and pgsql_insert().

G_MODULE_EXPORT gboolean unload_module_with_params ( gpointer  params_p  ) 

Definition at line 96 of file pgsql.c.

References DEBUG_AREA_MAIN, log_message, NU_EXIT_OK, nuauth_is_reloading(), pgsql_close_open_user_sessions(), and TRUE.

Here is the call graph for this function:

G_MODULE_EXPORT gint user_packet_logs ( void *  element,
tcp_state_t  state,
gpointer  params_p 
)

Definition at line 574 of file pgsql.c.

References ACL_FLAGS_STRICT, get_pgsql_handler(), nuauth_params::log_users_strict, nuauthconf, pgsql_insert(), pgsql_update_close(), pgsql_update_state(), TCP_STATE_CLOSE, TCP_STATE_DROP, TCP_STATE_ESTABLISHED, and TCP_STATE_OPEN.

Here is the call graph for this function:

G_MODULE_EXPORT int user_session_logs ( user_session_t c_session,
session_state_t  state,
gpointer  params_p 
)

Definition at line 631 of file pgsql.c.

References user_session_t::addr, DEBUG_AREA_MAIN, formatINET(), get_pgsql_handler(), INSERT_REQUEST_VALUES_SIZE, log_message, log_pgsql_params::pgsql_users_table_name, user_session_t::release, secure_snprintf(), SESSION_CLOSE, SESSION_OPEN, user_session_t::socket, user_session_t::sysname, user_session_t::user_id, user_session_t::user_name, and user_session_t::version.

Here is the call graph for this function:


Generated on Sat Nov 22 04:01:01 2008 for NuFW by  doxygen 1.4.7