RSA BSAFE SSL-C

Security protocol components for C

Search

Diagnostic Callback Functions

This section describes the functions used to trace the state changes of the SSL handshake.

Typedefs

typedef void SSL_INFO_CB_T (SSL *ssl, int where, int ret)
 Type of callback function that reports on the SSL protocol state. More...

typedef void SSL_ALERT_INFO_CB_T (SSL *s, int where, int ret, char *arg)
 A type of callback function that reports on SSL protocol alerts. More...

typedef void SSL_APP_DATA_CB_T (SSL *s, int where, char *arg)
 A type of callback function that reports on application data. More...


Functions

void SSL_CTX_set_info_cb (SSL_CTX *ctx, SSL_INFO_CB_T *cb)
 Sets the information callback for the SSL_CTX structure ctx. More...

SSL_INFO_CB_TSSL_CTX_get_info_cb (SSL_CTX *ctx)
 Returns the information callback for the SSL_CTX structure ctx. More...

void SSL_CTX_set_alert_info_cb (SSL_CTX *ctx, SSL_ALERT_INFO_CB_T *cb, char *arg)
 Associates an alert_info callback and callback argument with the SSL_CTX ctx. More...

SSL_ALERT_INFO_CB_TSSL_CTX_get_alert_info_cb (SSL_CTX *ctx)
 Returns a reference to the alert_info callback associated with an SSL_CTX. More...

char* SSL_CTX_get_alert_info_cb_arg (SSL_CTX *ctx)
 Returns the reference to the user-defined callback argument that is passed to the alert_info callback associated with the SSL_CTX ctx. More...

SSL_ALERT_INFO_CB_TSSL_get_alert_info_cb (SSL *ssl)
 Returns a reference to the alert_info callback associated with the SSL structure ssl. More...

void SSL_set_alert_info_cb (SSL *ssl, SSL_ALERT_INFO_CB_T *cb, char *arg)
 Associates an alert_info callback and callback argument with the SSL structure ssl. More...

char* SSL_get_alert_info_cb_arg (SSL *ssl)
 Returns the user-defined callback argument for any alert_info callback function associated with the SSL structure ssl. More...

void SSL_set_info_cb (SSL *ssl, SSL_INFO_CB_T *info_cb)
 Sets the information callback for the SSL connection ssl. More...

SSL_INFO_CB_TSSL_get_info_cb (SSL *ssl)
 Returns a reference to the information callback. More...

void SSL_CTX_set_app_data_cb (SSL_CTX *ctx, SSL_APP_DATA_CB_T *cb, char *arg)
 Sets the application data callback against the SSL_CTX structure. More...

SSL_APP_DATA_CB_TSSL_CTX_get_app_data_cb (SSL_CTX *ctx)
 Returns the application data callback set against the SSL_CTX structure ctx. More...

char* SSL_CTX_get_app_data_cb_arg (SSL_CTX *ctx)
 Returns the application data callback argument set against the SSL_CTX structure ctx. More...

void SSL_set_app_data_cb (SSL *ssl, SSL_APP_DATA_CB_T *cb, char *arg)
 Sets the application data callback for the specified connection and associated user-defined arguments. More...

SSL_APP_DATA_CB_TSSL_get_app_data_cb (SSL *ssl)
 Returns the application data callback function pointer set against the SSL structure ssl. More...

char* SSL_get_app_data_cb_arg (SSL *ssl)
 Returns the application data callback argument set against the SSL structure ssl. More...


Typedef Documentation

typedef void SSL_ALERT_INFO_CB_T(SSL *s, int where, int ret, char *arg)
 

A type of callback function that reports on SSL protocol alerts.

Parameters:
ssl [In] An SSL reference.
where [In] The current SSL protocol state.
See Protocol State Identifiers for valid values.
ret [In] The current success flag. One of:
  • 0.
  • 1.
  • arg [In] A caller-defined pointer argument.
    See also:
    SSL_set_alert_info_cb(), SSL_get_alert_info_cb(), SSL_CTX_set_alert_info_cb(), SSL_CTX_get_alert_info_cb() and SSL_CTX_get_alert_info_cb_arg()

    typedef void SSL_APP_DATA_CB_T(SSL *s, int where, char *arg)
     

    A type of callback function that reports on application data.

    Parameters:
    ssl [In] An SSL reference.
    where [In] The current SSL protocol state.
    See Protocol State Identifiers for valid values.
    arg [In] A caller-defined pointer argument.
    See also:
    SSL_set_app_data_cb(), SSL_get_app_data_cb(), SSL_CTX_set_app_data_cb(), SSL_CTX_get_app_data_cb() and SSL_CTX_get_app_data_cb_arg()

    typedef void SSL_INFO_CB_T(SSL *ssl, int where, int ret)
     

    Type of callback function that reports on the SSL protocol state.

    Parameters:
    ssl [In] An SSL reference.
    where [In] The current SSL protocol state.
    See Protocol State Identifiers for valid values.
    ret [In] The current success flag. One of:
  • 0.
  • 1.
  • See also:
    SSL_set_info_cb(), SSL_get_info_cb(), SSL_CTX_set_info_cb() and SSL_CTX_get_info_cb().


    Function Documentation

    SSL_ALERT_INFO_CB_T* SSL_CTX_get_alert_info_cb SSL_CTX   ctx ;
     

    Returns a reference to the alert_info callback associated with an SSL_CTX.

    Parameters:
    ctx [In] The SSL_CTX reference where the alert information callback is stored.
    Returns:
    A reference to callback function if available.
    NULL indicates no function is associated with the SSL_CTX.
    See also:
    SSL_CTX_get_alert_info_cb_arg().
    Example:

    SSL_CTX *ctx;
    void (*cb)(SSL *s,int where,int ret,char *arg);
    void my_alert_info_cb(SSL *s, int where,int ret,char *arg);
    cb = SSL_CTX_get_alert_info_cb(ctx);
    
    /* Check for an existing alert info callback */
    
    if (cb == NULL)
    
    /* If there is no callback set a new one*/
    
    {
    /* Set a user-defined callback that does not use the argument */
    SSL_CTX_set_alert_info_cb(my_alert_info_cb,NULL);
    }
    
    /* Perform the handshake - alerts may be generated */
    

    char* SSL_CTX_get_alert_info_cb_arg SSL_CTX   ctx ;
     

    Returns the reference to the user-defined callback argument that is passed to the alert_info callback associated with the SSL_CTX ctx.

    Parameters:
    ctx [In] The SSL_CTX reference where the alert information callback argument is stored.
    Returns:
    A pointer to the user-defined argument for the callback.
    NULL indicates no user-defined argument has been set against the SSL_CTX.
    See also:
    SSL_CTX_get_alert_info_cb().
    Example:

    SSL_get_alert_info_cb_arg ------------------
    
    SSL *ssl;
    char *arg = NULL;
    void (*cb)(SSL *s,int where,int ret,char *arg);
    
    /* An argument with a specific type (not defined here) */
    
    AL_CB *new_arg = NULL;
    
    /* Check for an existing alert info callback argument */
    
    arg = SSL_get_alert_info_cb_arg(ssl);
    
    /* If there is no argument then add one pointing to the data
     *structure used by the alert_info callback */
    
    if (arg == NULL)
    
    {
    /* Initialize the argument */
    
    /* new_arg = (AL_CB *)malloc(...); */
    
    /* Retrieve the current callback */
    
    cb = SSL_get_alert_info_cb(ssl);
    
    /* Set both the existing callback and user-defined argument */
    
    SSL_set_alert_info_cb(cb,(char *)new_arg);
    }
    
    /* Perform the handshake - alerts may be generated */
    

    SSL_APP_DATA_CB_T* SSL_CTX_get_app_data_cb SSL_CTX   ctx ;
     

    Returns the application data callback set against the SSL_CTX structure ctx. The application data callback functions are used to trace encrypted application data when written or read by the SSL connection.

    Parameters:
    ctx [In] The SSL_CTX reference where the application data callback is stored.
    Returns:
    A pointer to callback function if available.
    NULL indicates no callback function has been set.
    See also:
    SSL_set_app_data_cb(), SSL_get_app_data_cb(), SSL_get_app_data_cb_arg(), SSL_CTX_set_app_data_cb() and SSL_CTX_get_app_data_cb_arg().
    Example:

    SSL_CTX *ssl_ctx = NULL;
    SSL *ssl = NULL;
    void (*callback)(SSL *, int, char *) = NULL;
    BIO *bio;
    
    /* Create a BIO for logging purposes */
    
    bio = BIO_new_fp(stdout,BIO_NOCLOSE);
    
    /* Create an SSL_CTX */
    
    /* ssl_ctx = SSL_CTX_new(); */
    
    /* Create an SSL */
    
    ssl = SSL_new(ssl_ctx);
    
    /* Add an application data callback to the context */
    
    SSL_CTX_set_app_data_cb(ssl_ctx,my_app_data_cb);
    
    /* Set the callback argument */
    
    SSL_CTX_set_app_data_cb_arg(ssl_ctx,(char *)bio);
    
    /* Query the SSL for its application data callback */
    
    callback = SSL_get_app_data_cb(ssl);
    
    /* The callback should be NULL as it was set on the SSL_CTX */
    
    if (callback != NULL)
    
    {
    BIO_printf(bio,"Application callback was set on the SSL\n");
    }
    
    /* Retrieve the application data callback from the SSL_CTX */
    
    callback = SSL_CTX_get_app_data_cb(ssl_ctx);
    
    /* The callback should exist */
    
    if (callback == NULL)
    
    {
    BIO_printf(bio,"SSL_CTX application callback is missing\n");
    /* Error condition */
    }
    
    /* Send application data on the SSL
    * SSL_CTX callback is used as default by the SSL callback
    */
    
    /* Application data callback */
    
    void my_app_data_cb(ssl,where,cb_arg)
    SSL *ssl;
    int where;
    char *cb_arg;
    
    {
    BIO *out;
    out = (BIO *)cb_arg;
    BIO_printf(out,"Application data callback set against SSL_CTX\n");
    return ;
    }
    

    char* SSL_CTX_get_app_data_cb_arg SSL_CTX   ctx ;
     

    Returns the application data callback argument set against the SSL_CTX structure ctx. The application data callback functions are used to trace encrypted application data when written or read by the SSL connection.

    Parameters:
    ctx [In] The SSL_CTX reference where the application data callback argument is stored.
    Returns:
    A reference to the application data callback argument if available.
    NULL indicates no callback argument is present.
    See also:
    SSL_set_app_data_cb(), SSL_get_app_data_cb(), SSL_get_app_data_cb_arg(), SSL_CTX_set_app_data_cb() and SSL_CTX_get_app_data_cb().
    Example:

    BIO *log;
    SSL_CTX *ssl_ctx;
    SSL *ssl;
    void (*my_app_data_cb)();
    char *app_data_arg;
    char *arg;
    
    /* Create a log BIO */
    
    log = BIO_new_fp(stderr,BIO_NOCLOSE);
    
    /* Create the SSL_CTX */
    
    ssl_ctx = SSL_CTX_new();
    
    /* Create the SSL */
    
    ssl = SSL_new(ssl_ctx);
    
    /* User definitions for callback and argument */
    
    my_app_data_cb = ;
    app_data_arg = ;
    
    /* Attach both a callback and an argument to SSL */
    
    SSL_set_app_data_cb(ssl,my_app_data_cb);
    SSL_set_app_data_cb_arg(ssl,app_data_cb_arg);
    
    /* Query the SSL_CTX for a callback argument */
    
    if (SSL_CTX_get_app_data_cb_arg(ssl_ctx) != NULL)
    
    {
    BIO_printf(log,"Unexpected application data callback argument for
    CTX\n");
    }
    
    /* Query the SSL for a callback argument */
    if ((arg=SSL_get_app_data_cb_arg(ssl)) == NULL)
    
    {
    BIO_printf(log,"Missing application data callback argument for
    SSL\n");
    }
    
    else
    
    {
    BIO_printf(log, "Address of callback argument is %d\n", arg);
    }
    
    /* Callback triggered by SSL sending/receiving application data */
    

    SSL_INFO_CB_T* SSL_CTX_get_info_cb SSL_CTX   ctx ;
     

    Returns the information callback for the SSL_CTX structure ctx.

    Parameters:
    ctx [In] An SSL_CTX reference from which the default information callback reference is retrieved.
    Returns:
    The callback function invoked at key points during the handshake.
    See also:
    SSL_CTX_set_info_cb() and SSL_get_info_cb().

    void SSL_CTX_set_alert_info_cb SSL_CTX   ctx,
    SSL_ALERT_INFO_CB_T   callback,
    char *    arg
    ;
     

    Associates an alert_info callback and callback argument with the SSL_CTX ctx. The alert info callback is provided mainly for diagnostic purposes and is invoked each time an alert is generated by the protocol.

    The callback argument is passed to each call of the alert_info callback. An alert_info callback associated with an SSL structure will override any default callback that may been set for the SSL_CTX. Argument values may be set to NULL to remove previous callbacks associated with the SSL structure.

    Parameters:
    ctx [In, Out] The SSL_CTX reference against which to set the callback.
    callback [In] The alert_info callback function.
    arg [In] A user-specified argument that is passed into the callback function.
    See also:
    SSL_set_alert_info_cb(), SSL_CTX_get_alert_info_cb() and SSL_CTX_get_alert_info_cb_arg().
    Example:

    SSL *ssl_ctx;
    
    void (*cb)(SSL *s,int where,int ret,char *arg);
    char *arg;
    
    SSL *ssl, *ssl2;
    ssl_ctx = SSL_CTX_new(sslv23_method());
    
    /* Select an alert callback and its argument for default calls */
    
    cb = prn_alert_info_cb;
    arg = "CTX-level default callback";
    
    /* Add the alert callback to the SSL_CTX */
    
    SSL_CTX_set_alert_info_cb(ssl,cb,arg);
    
    /* Once SSL structures are created do not change the SSL_CTX */
    
    /* Create a new SSL structure */
    
    ssl = SSL_new(ssl_ctx);
    
    /* SSL will use the ctx callback - alerts may be generated */
    
    /* Create a new SSL */
    
    ssl2 = SSL_new(ssl_ctx);
    
    /* Reuse the same callback and change the argument */
    
    cb = prn_alert_info_cb;
    arg = "SSL-level alert callback";
    
    /* Set the callback and argument for this specific SSL */
    
    SSL_set_alert_info_cb(ssl2,cb,arg);
    
    /* SSL will use its own callback - alerts may be generated */
    
    /* Example alert info callback function */
    
    void prn_alert_info_cb(ssl,where,ret,arg)
    SSL *ssl;
    int where;
    int ret;
    char *arg;
    
    {
    printf("ALERT INFO CALLBACK : %s\n",arg);
    return;
    }
    

    void SSL_CTX_set_app_data_cb SSL_CTX   ctx,
    SSL_APP_DATA_CB_T   callback,
    char *    arg
    ;
     

    Sets the application data callback against the SSL_CTX structure. This is the default application data callback for all SSL structures associated with the SSL_CTX. The application data callback functions are used to trace encrypted application data when written or read by the SSL connection.

    Parameters:
    ctx [In, Out] The SSL_CTX reference to set the application data callback against.
    callback [In] A reference to the application data callback function.
    arg [In] A user specified argument that is passed into the application data callback.
    note.gif
    All SSL structures associated with the SSL_CTX will use this callback unless they have explicitly defined their own callback with SSL_set_app_data_cb().
    See also:
    SSL_set_app_data_cb(), SSL_get_app_data_cb(), SSL_get_app_data_cb_arg(), SSL_CTX_get_app_data_cb() and SSL_CTX_get_app_data_cb_arg().
    Example:

    SSL_CTX *ssl_ctx;
    SSL *ssl1, *ssl2;
    BIO *bio_log;
    
    /* Open a BIO for logging to stderr */
    
    bio_log = BIO_new_fp(stderr, BIO_NOCLOSE);
    
    /* Create the SSL_CTX and an SSL */
    
    ssl_ctx = SSL_CTX_new(...);
    ssl1 = SSL_new(ssl_ctx);
    
    /* Define an application data callback for this SSL_CTX */
    
    SSL_CTX_set_app_data_cb(ssl_ctx, my_cb, (char *)bio_log);
    ssl2 = SSL_new(ssl_ctx);
    
    /* SSL1 and SSL2 use my_cb when they send or receive application data. */
    
    /* Application data callback to log when app data is sent or received. */
    
    void my_cb(s, where, arg)
    SSL *s,
    int where,
    char *arg;
    
    {
    BIO *bio_out;
    if (arg != NULL)
    {
    
    /* Cast the argument to a BIO */
    
    bio_out = (BIO *)arg;
    
    /* Output a diagnostic message */
    
    if (where == SSL_CB_WRITE)
    
    BIO_printf(bio_out, "LOG: Application data WRITE\n");
    else /* Where == SSL_CB_READ */
    BIO_printf(bio_out, "LOG: Application data READ\n");
    
    }
    return ;
    }
    

    void SSL_CTX_set_info_cb SSL_CTX   ctx,
    SSL_INFO_CB_T   cb
    ;
     

    Sets the information callback for the SSL_CTX structure ctx.

    Parameters:
    ctx [In] The SSL_CTX reference.
    cb [In] The callback function invoked at key points during handshake.
    note.gif
    This function is only used when no callback is defined via SSL_set_info_cb().
    See also:
    SSL_CTX_get_ex_new_index() and SSL_CTX_set_info_cb().
    Samples:
    bio_client.c, bio_server.c, cache_server.c, fips_client.c, nbio_client.c, nbio_server.c, PKCS11Client.c, sock_client.c, sock_server.c, ssl_client.c, and ssl_server.c.

    SSL_ALERT_INFO_CB_T* SSL_get_alert_info_cb SSL   ssl ;
     

    Returns a reference to the alert_info callback associated with the SSL structure ssl. The returned function pointer is NULL if no alert_info callback is associated with the SSL.

    Parameters:
    ssl [In] The SSL connection reference where the alert callback is stored.
    Returns:
    A reference to the callback function.
    NULL indicates error.
    See also:
    SSL_set_alert_info_cb() and SSL_get_alert_info_cb_arg().
    Example:

    SSL *ssl;
    void (*cb)(SSL *s,int where,int ret,char *arg);
    void my_alert_info_cb(SSL *s, int where,int ret,char *arg);
    
    /* Check for existing alert_info callback */
    
    cb = SSL_get_alert_info_cb(ssl);
    
    /* If no callback exists set a new one */
    
    if (cb == NULL)
    
    {
    /* Set user-defined callback that does not use the argument */
    SSL_set_alert_info_cb(alert_info_cb,NULL);
    }
    
    /* Perform handshake and check for alerts */
    

    char* SSL_get_alert_info_cb_arg SSL   ssl ;
     

    Returns the user-defined callback argument for any alert_info callback function associated with the SSL structure ssl.

    Parameters:
    ssl [In] The SSL connection reference where the alert callback argument is stored.
    Returns:
    A reference to the user-specified data if available.
    NULL indicates no callback argument is set.
    See also:
    SSL_get_alert_info_cb() and SSL_set_alert_info_cb().
    Example:

    SSL_CTX_get_alert_info_cb_arg ------------------
    SSL_CTX *ctx;
    
    char *arg = NULL;
    void (*cb)(SSL *s,int where,int ret,char *arg);
    
    /* An argument with a specific type (not defined here) */
    
    AL_CB *new_arg = NULL;
    
    /* Check for an existing alert info callback argumen t*/
    
    arg = SSL_CTX_get_alert_info_cb_arg(ctx);
    
    /* If there is no argument then add one pointing to the data
     *structure used by the alert_info callback */
    
    if (arg == NULL)
    
    {
    /* Initialize the argument */
    
    /* new_arg = (AL_CB *)malloc(...); */
    
    /* Retrieve the current callback */
    
    cb = SSL_CTX_get_alert_info_cb(ctx);
    
    /* Set the existing callback and user-defined argument */
    
    SSL_CTX_set_alert_info_cb(cb,(char *)new_arg);
    }
    
    /* Perform the handshake - alerts may be generated */
    

    SSL_APP_DATA_CB_T* SSL_get_app_data_cb SSL   ssl ;
     

    Returns the application data callback function pointer set against the SSL structure ssl. The application data callback functions are used to trace encrypted application data when written or read by the SSL connection.

    Parameters:
    ssl [In] The SSL connection reference where the application data callback is stored.
    Returns:
    A pointer to the callback function if one has been set.
    NULL indicates no callback present.
    note.gif
    This function will not look for an application data callback set against the SSL_CTX if there is no callback set for the SSL structure. However, when the application callback is activated it may run a callback attached to the SSL_CTX if no callback is set against the SSL structure.
    See also:
    SSL_set_app_data_cb(), SSL_get_app_data_cb_arg(), SSL_CTX_set_app_data_cb(), SSL_CTX_get_app_data_cb() and SSL_CTX_get_app_data_cb_arg().
    Example:

    SSL_CTX *ssl_ctx = NULL;
    SSL *ssl = NULL;
    void (*callback)(SSL *, int, char *) = NULL;
    BIO *bio;
    
    /* Create a BIO for logging purposes */
    
    bio = BIO_new_fp(stdout,BIO_NOCLOSE);
    
    /* Create an SSL_CTX */
    
    /* ssl_ctx = SSL_CTX_new(); */
    
    /* Create an SSL */
    
    ssl = SSL_new(ssl_ctx);
    
    /* Add an application data callback to the context */
    
    SSL_CTX_set_app_data_cb(ssl_ctx,my_app_data_cb);
    
    /* Set the callback argument */
    
    SSL_CTX_set_app_data_cb_arg(ssl_ctx,(char *)bio);
    
    /* Query the SSL for its application data callback */
    
    callback = SSL_get_app_data_cb(ssl);
    
    /* The callback should be NULL as it was set on the SSL_CTX */
    
    if (callback != NULL)
    
    {
    BIO_printf(bio,"Application callback was set on the SSL\n");
    }
    
    /* Retrieve the application data callback from the SSL_CTX */
    
    callback = SSL_CTX_get_app_data_cb(ssl_ctx);
    
    /* The callback should exist */
    
    if (callback == NULL)
    
    {
    BIO_printf(bio,"SSL_CTX application callback is missing\n");
    /* Error condition */
    }
    
    /* Send application data on the SSL
    * SSL_CTX callback is used as default by the SSL callback
    */
    
    /* Application data callback */
    
    void my_app_data_cb(ssl,where,cb_arg)
    SSL *ssl;
    int where;
    char *cb_arg;
    
    {
    BIO *out;
    out = (BIO *)cb_arg;
    BIO_printf(out,"Application data callback set against SSL_CTX\n");
    return ;
    }
    

    char* SSL_get_app_data_cb_arg SSL   ssl ;
     

    Returns the application data callback argument set against the SSL structure ssl. The application data callback functions are used to trace encrypted application data when written or read by the SSL connection.

    Parameters:
    ssl [In] The SSL connection reference where the application data callback argument has been set.
    Returns:
    A reference to the callback argument if one is available.
    NULL indicates no callback argument is present.
    See also:
    SSL_set_app_data_cb(), SSL_get_app_data_cb(), SSL_CTX_set_app_data_cb(), SSL_CTX_get_app_data_cb() and SSL_CTX_get_app_data_cb_arg().
    Example:

    BIO *log;
    SSL_CTX *ssl_ctx;
    SSL *ssl;
    void (*my_app_data_cb)();
    char *app_data_arg;
    char *arg;
    
    /* Create a log BIO */
    
    log = BIO_new_fp(stderr,BIO_NOCLOSE);
    
    /* Create the SSL_CTX */
    
    ssl_ctx = SSL_CTX_new();
    
    /* Create the SSL */
    
    ssl = SSL_new(ssl_ctx);
    
    /* User definitions for callback and argument */
    
    my_app_data_cb = ;
    app_data_arg = ;
    
    /* Attach both a callback and an argument to SSL */
    
    SSL_set_app_data_cb(ssl,my_app_data_cb);
    SSL_set_app_data_cb_arg(ssl,app_data_cb_arg);
    
    /* Query the SSL_CTX for a callback argument */
    
    if (SSL_CTX_get_app_data_cb_arg(ssl_ctx) != NULL)
    
    {
    BIO_printf(log,"Unexpected application data callback argument for
    CTX\n");
    }
    
    /* Query the SSL for a callback argument */
    if ((arg=SSL_get_app_data_cb_arg(ssl)) == NULL)
    
    {
    BIO_printf(log,"Missing application data callback argument for
    SSL\n");
    }
    
    else
    
    {
    BIO_printf(log, "Address of callback argument is %d\n", arg);
    }
    
    /* Callback triggered by SSL sending/receiving application data */
    

    SSL_INFO_CB_T* SSL_get_info_cb SSL   ssl ;
     

    Returns a reference to the information callback. The information callback is invoked during each handshake state.

    Parameters:
    ssl [In] The SSL connection reference from which to retrieve the information callback reference.
    Returns:
    Info_cb is NULL if not set.
    Otherwise has the form void (cb *)(SSL *, int, int).
    See also:
    SSL_set_info_cb() and SSL_CTX_get_ex_new_index().

    void SSL_set_alert_info_cb SSL   ssl,
    SSL_ALERT_INFO_CB_T   callback,
    char *    arg
    ;
     

    Associates an alert_info callback and callback argument with the SSL structure ssl. The alert callback is provided mainly for diagnostic purposes and is invoked each time an alert is generated by the protocol.

    The callback argument is passed to each call of the alert_info callback. An alert_info callback associated with an SSL structure will override any default callback that may been set for the SSL_CTX. Argument values may be set to NULL to remove previous callbacks associated with the SSL structure.

    Parameters:
    ssl [In, Out] The SSL connection reference against which to set the callback.
    callback [In] The alert_info callback function.
    arg [In] A user-specified argument that is passed into the callback function.
    See also:
    SSL_get_alert_info_cb() and SSL_get_alert_info_cb_arg().
    Example:

    SSL_set_alert_info_cb ----------------------
    
    SSL *ssl;
    SSL_CTX *ctx;
    
    void (*cb)(SSL *s,int where,int ret,char *arg);
    char *arg;
    ssl = SSL_new(ctx)
    
    /* Select an alert callback and argument */
    
    cb = my_alert_info_cb;
    arg = "ALERT TEST PROGRAM : ";
    
    /* Add the alert callback to the ssl */
    
    SSL_set_alert_info_cb(ssl,cb,arg);
    
    /* Prepare for an SSL handshake *
    
    /* Alerts may be generated during a handshake */
    

    void SSL_set_app_data_cb SSL   ssl,
    SSL_APP_DATA_CB_T   callback,
    char *    arg
    ;
     

    Sets the application data callback for the specified connection and associated user-defined arguments. The argument is passed to the callback when activated. The application data callback functions are used to trace encrypted application data when written or read by the SSL connection.

    Parameters:
    ssl [In, Out] The pointer to the SSL structure that holds that holds a reference to the application data callback.
    callback [In] The callback function reference to set against the SSL.
    arg [In] A user-defined argument that is passed into the callback function.
    note.gif
    This callback is unable to access application data associated with the SSL structure. Use a BIO callback attached to the SSL structure read/write BIOs to read application data.

    If no application callback is set for the SSL structure, it will use the application data callback of the SSL_CTX context, if one is set.

    Specify callback and arg values of NULL to remove the callback from the SSL structure.
    See also:
    BIO_set_cb(), SSL_get_app_data_cb(), SSL_CTX_set_app_data_cb() and SSL_CTX_get_app_data_cb().
    Example:

    SSL_CTX *ssl_ctx;
    SSL *ssl;
    BIO *bio_log;
    
    /* Open a BIO for logging to stderr */
    
    bio_log = BIO_new_fp(stderr,BIO_NOCLOSE);
    
    /* Create the SSL_CTX and SSL */
    
    ssl_ctx = SSL_CTX_new(...);
    ssl = SSL_new(ssl_ctx);
    
    /* Define an application data callback for this SSL */
    
    SSL_set_app_data_cb(ssl,my_cb,(char *)bio_log);
    
    /* Continue processing */
    
    /* Application data callback to log when application data is sent or received */
    
    void my_cb(s,where,arg)
    SSL *s,
    int where,
    char *arg;
    
    {
    BIO *bio_out;
    
    /* Cast the argument to a BIO */
    
    bio_out = (BIO *)arg;
    if (where == SSL_CB_WRITE)
    {
    
    BIO_printf(bio_out,"LOG: Application data WRITE\n");
    
    }
    else /* Where == SSL_CB_READ */
    {
    
    BIO_printf(bio_out,"LOG: Application data READ\n");
    
    }
    return ;
    }
    

    void SSL_set_info_cb SSL   ssl,
    SSL_INFO_CB_T   info_cb
    ;
     

    Sets the information callback for the SSL connection ssl. This callback can be used to report on the order and set of SSL states that are traversed during the ssl handshake.

    Parameters:
    ssl [In, Out] The SSL connection reference against which to set the information callback.
    info_cb [In] Has the form void (*cb)(SSL *, int, int). May also be NULL. The callback function is invoked at key points during the handshake.
    note.gif
    This function is also useful for generating execution traces when an alert is received (SSL_CB_READ_ALERT).
    See also:
    SSL_get_info_cb(), SSL_CTX_get_ex_new_index() and SSL_CTX_set_info_cb().


    Copyright (c) 1999-2004 RSA Security Inc. All rights reserved. 050-001001-2600-000-000 - 2.6