Sets
an application callback.
Format
#include <gskssl.h>
gsk_status gsk_user_set(
gsk_user_set_fid set_id,
void * set_data,
void * reserved)
Parameters
- set_id
- Specifies the set function identifier.
- set_data
- Specifies the address of the set data.
- reserved
- Specify NULL for this parameter.
Results
The function return value will be
0 (
GSK_OK) if no error is detected. Otherwise, it will be
one of the return codes listed in the
gskssl.h include file.
These are some possible errors:
- [GSK_BAD_PARAMETER]
- A parameter is not valid.
- [GSK_ERROR_BAD_STATE]
- The SSL environment has not been initialized.
Usage
The gsk_user_set() routine
will set or reset an application callback. The gsk_initialize() routine
must be called before the gsk_user_set() routine can be called.
These
set function identifiers are supported:
- [GSK_SET_SIDCACHE_CALLBACK]
- This function sets the session identifier cache callback. The
set data is the address of the gsk_sidcache_callback structure. The
application session identifier cache is used only for SSL servers
(the internal cache is always used for SSL clients). This sets the
session identifier cache for existing connections including new connections
created by the gsk_secure_soc_init() routine.
The routine
specified by the
Get entry is called to retrieve an entry from
the session identifier cache. The
session_id parameter is
the session identifier, the
session_id_length parameter is
the length of the session identifier, and the
ssl_version parameter
is the SSL protocol version number (GSK_SSLVERSION_V2 or GSK_SSLVERSION_V3).
The function return value is the address of the session data buffer
or NULL if an error is detected. The
FreeDataBuffer routine
will be called to release the session data buffer when it is no longer
needed by the SSL runtime.
gsk_data_buffer * Get (
const unsigned char * session_id,
unsigned int session_id_length,
gsk_sslversion ssl_version)
The
routine specified by the
Put entry is called to store an entry
in the session identifier cache. The
ssl_session_data parameter
is the session data, the
session_id parameter is the session
identifier, the
session_id_length parameter is the length of
the session identifier, and the
ssl_version parameter is the
SSL protocol version number (GSK_SSLVERSION_V2 or GSK_SSLVERSION_V3).
The function return value is ignored and can be a NULL address.
The callback routine must make its own copy of the session data since
the SSL structure will be released when the connection is closed.
gsk_data_buffer * Put (
gsk_data_buffer * ssl_session_data,
const unsigned char * session_id,
unsigned int session_id_length,
gsk_sslversion ssl_version)
The
routine specified by the
Delete entry is called to remove an
entry from the session identifier cache. The session_id parameter
is the session identifier, the
session_id_length parameter
is the length of the session identifier, and the
ssl_version parameter
is the SSL protocol version number (GSK_SSLVERSION_V2 or GSK_SSLVERSION_V3).
void Delete (
const unsigned char * session_id,
unsigned int session_id_length,
gsk_sslversion ssl_version)
The
routine specified by the
FreeDataBuffer entry is called to
release the data buffer returned by the
Get routine.
void FreeDataBuffer (
gsk_data_buffer * ssl_session_data)
- [GSK_RESET_SIDCACHE_CALLBACK]
- This function resets the session identifier cache callback. The
internal session identifier cache is used instead of an application
session identifier cache. This resets the session identifier cache
for existing connections including new connections created by the gsk_secure_soc_init() routine.
- [GSK_SET_GETPEER_CALLBACK]
- This function sets the peer identification callback. The peer
identification callback returns the 32-bit network identifier for
the remote partner. The fd parameter is the socket descriptor
specified when the connection was initialized. The peer identification
routine will be called for new connections created by gsk_secure_soc_init() but
will not be called for existing connections.
unsigned long io_getpeerid (
int fd)
- [GSK_RESET_GETPEER_CALLBACK]
- This function resets the peer identification callback. The internal
peer identification routine will be used instead of the application
routine. This applies to new connections created by gsk_secure_soc_init() and
does not affect existing connections.