RSA Security logo

RSA BSAFE Cert-C
API Reference

LOG_FUNCS Reference

Use the LOG_FUNCS structure to store pointers to the status log service provider functions in Cert-C.

In this case, there is one implementation, the Cert-C Status Log service provider. Use S_InitializeFileLog() to initialize the funcs log function pointer to the Cert-C Status Log service provider implementation of LOG_FUNCS.

#include <logspi.h>

00034 typedef struct log_funcs {
00047   void (*Finalize) (
00048     CERTC_CTX ctx,                /* Cert-C context  */
00049     POINTER   handle);            /* provider handle */
00050 
00138   void (*GetFormatStr) (
00139     CERTC_CTX   ctx,             /* Cert-C context                  */
00140     POINTER     handle,          /* provider handle                 */
00141     int         status,          /* status code being reported      */
00142     int         statusType,      /* warning, error, or info         */
00143     char      **format);         /* where format ptr will be stored */
00144 
00169   void (*Log) (
00170     CERTC_CTX  ctx,               /* Cert-C context        */
00171     POINTER    handle,            /* provider handle       */
00172     char      *msg);              /* formatted log message */
00173 } LOG_FUNCS;

Data Fields

void(* Finalize )(CERTC_CTX ctx, POINTER handle)
 Frees any resources associated with the service provider's handle, including freeing memory allocated during the service provider's initialization. More...

void(* GetFormatStr )(CERTC_CTX ctx, POINTER handle, int status, int statusType, char **format)
 Returns the status log message format control string corresponding to the indicated status and status type. More...

void(* Log )(CERTC_CTX ctx, POINTER handle, char *msg)
 Prints a formatted, status log message to the log file. More...


Field Documentation (alphabetical)

void(* log_funcs::Finalize)( CERTC_CTX ctx, POINTER handle)
 

Frees any resources associated with the service provider's handle, including freeing memory allocated during the service provider's initialization. Cert-C calls Finalize when a service provider's instance is unregistered.

This function is implemented by the Cert-C Status Log Service Provider.

void(* log_funcs::GetFormatStr)( CERTC_CTX ctx, POINTER handle, int status, int statusType, char **format)
 

Returns the status log message format control string corresponding to the indicated status and status type. If a corresponding format string cannot be found, the function returns the f(l) : ? string. This string prints the file name and line number that calls the C_Log() function, followed by a question mark (?).

A format control string is a text string containing zero or more argument format controls and additional text. An argument format control consists of a percent character (%), optionally followed by an argument type indicator (s or n), followed by an argument index (0-9, f, or l). Cert-C replaces the format control with the corresponding C_Log() input parameter. If text in the format string is not part of a control sequence, Cert-C copies it unchanged into the log file. Placing a sequence of two percent characters (%%) in the format string places a percent character (%) into the log message.

The argument type indicators are used to specify the type of one of the optional C_Log() arguments. The default type of string (char *) is assumed if no type indicator precedes the argument index. No type indicator is permitted for the source file f or source line l format controls. A type indicator of s specifies that the argument is a string (char *). A type indicator of n specifies that the argument is an unsigned integer (unsigned int). The f argument is always a string. The l argument is always an unsigned integer.

The argument index is used to specify which C_Log() input parameter should be substituted in place of the argument format control sequence. The f control is replaced by the sourceName parameter of the C_Log() function. The l control is replaced by the sourceLine parameter of the C_Log() function. The %[sn]0 - %[sn]9 controls are replaced by the first through tenth C_Log() input parameters following the sourceLine parameter, respectively.

This function is implemented by the Cert-C Status Log service provider.

Parameters:
ctx This input parameter points to an initialized Cert-C context handle.
handle This input parameter points to a copy of the Cert-C Status Log service provider handle.
status This input parameter contains the status code to be reported. Usually, this is one of the E_* constants. The Cert-C Status Log service provider uses the value of this parameter, along with the status type, to select an appropriate format string.
statusType This input parameter determines the severity of the status to be reported. Depending on the severity reported, a different message may be logged for a given status code. The Cert-C Status Log service provider uses the value of this parameter, along with the status, to select an appropriate format string.
format This output parameter contains a status log message format control string returned by the Cert-C Status Log service provider.
Returns:
None.

void(* log_funcs::Log)( CERTC_CTX ctx, POINTER handle, char *msg)
 

Prints a formatted, status log message to the log file. The log file is passed to S_InitializeFileLog() from the logName field of the FILE_LOG_PARAMS structure. This function appends a newline to the message.

This function is implemented by the Cert-C Status Log service provider.

Parameters:
ctx This input parameter points to an initialized Cert-C context handle.
handle This input parameter points to a copy of the Cert-C Status Log service provider handle.
msg This input parameter points to a formatted, status log message. The Cert-C Status Log service provider appends this string to its log.
Returns:
None.


The documentation for this struct was generated from the following file:


RSA BSAFE® Cert-C 2.7 API Reference