xdm_odbc.c File Reference

OpenXDAS loadable back-end logger for an odbc-based SQL database audit log. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sql.h>
#include <sqlext.h>

Go to the source code of this file.

Data Structures

struct  xdr_tag
 XDAS field data record structure. More...
struct  pa_tag
 Parameter table drives msg parser and SQLBindParameter calls. More...

Defines

#define SQL_Window   1
#define XDMAPI
#define XDMEXP
#define ARRAYSZ(x)   (sizeof(x)/sizeof(*(x)))
#define XDM_DEF_CONNSTR   "DSN=xdas;"
 Default ODBC SQLDriverConnect string.

Functions

static void logsqlerr (const char *fn, SQLHANDLE handle, SQLSMALLINT type, SQLRETURN rc)
 XDM logger function for odbc error data.
static int getmsgparam (const char *cp, const char *ep, SQLSMALLINT type, SQLPOINTER buf, SQLUINTEGER bufsz)
 Convert and copy a string field value into a typed buffer.
static int parsemsg (const char **msgflds)
 Process an XDAS record into XDR fields for insertion into database.
static void sql_disconnect (void)
 Disconnect from ODBC data source and clear global handles.
static int sql_connect (void)
 Connect to SQL server and and prepare a statement.
XDMEXP int XDMAPI xdm_append (const char **msgflds)
 XDM module append routine.
XDMEXP void XDMAPI xdm_exit (void)
 XDM module exit routine.
XDMEXP int XDMAPI xdm_init (void(*logmsg)(int level, const char *msg,...), char *(*getcnfstr)(const char *, char *, size_t *))
 XDM module initialization routine.

Variables

static void(* s_fplogmsg )(int level, const char *msg,...)=0
 A pointer to the xdasd logmsg function.
static char *(* s_fpgetcnfstr )(const char *, char *, size_t *)=0
 A pointer to the xdasd get_conf_string function.
static SQLHENV hsql = 0
 SQL variables.
static SQLHDBC hdbc = 0
static SQLHSTMT hstmt = 0
static SQLCHAR * primary_stmt
 SQL prepared INSERT statement.
static struct xdr_tag xdr
 XDAS field data record structure.
static struct pa_tag pa []
 Parameter table drives msg parser and SQLBindParameter calls.
static SQLINTEGER ind [ARRAYSZ(pa)]


Detailed Description

OpenXDAS loadable back-end logger for an odbc-based SQL database audit log.

Author:
John Calcote (jcalcote@novell.com)
Attention:
Please submit patches to http://openxdas.sourceforge.net

Definition in file xdm_odbc.c.


Generated on Thu Aug 20 22:33:07 2009 for OpenXDAS by  doxygen 1.5.6