diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-05-11 16:20:55 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-05-11 16:20:55 +0000 |
commit | 3d279f6302689247cfaca011a8cb8e1ddf538132 (patch) | |
tree | fd8b7b0f91576694452e2794bad60eedb19f61fe | |
parent | b1f8ee05e596472f87f5c713236cd8b110063de1 (diff) | |
download | gnutls-3d279f6302689247cfaca011a8cb8e1ddf538132.tar.gz |
Added gnutls_state_set_ptr() and gnutls_state_get_ptr() functions, to
assist in callback functions.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | lib/gnutls.h.in.in | 5 | ||||
-rw-r--r-- | lib/gnutls_state.c | 27 |
3 files changed, 34 insertions, 0 deletions
@@ -5,6 +5,8 @@ Version ?.?.? version check in RSA premaster secret. - Added gnutls_session_is_resumed() function, which reports if a session is a resumpted one. +- Added gnutls_state_set_ptr() and gnutls_state_get_ptr() functions, to + assist in callback functions. Version 0.4.1 (7/04/2002) - Now uses alloca() for temporary variables diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index 053f94b0f4..7744e5fbba 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -287,6 +287,11 @@ typedef void (*GNUTLS_LOG_FUNC)( const char*); void gnutls_transport_set_push_func( GNUTLS_STATE, GNUTLS_PUSH_FUNC push_func); void gnutls_transport_set_pull_func( GNUTLS_STATE, GNUTLS_PULL_FUNC pull_func); +/* state specific */ +void gnutls_state_set_ptr(GNUTLS_STATE state, void* ptr); +void* gnutls_state_get_ptr(GNUTLS_STATE state); + +/* record layer */ size_t gnutls_record_get_max_size( GNUTLS_STATE state); ssize_t gnutls_record_set_max_size( GNUTLS_STATE state, size_t size); diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 498f39a5df..74f6629ee1 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -619,3 +619,30 @@ int gnutls_session_is_resumed(GNUTLS_STATE state) return 0; } + +/** + * gnutls_state_get_ptr - Used to get the user pointer from the state structure + * @state: is a &GNUTLS_STATE structure. + * + * This function will return the user given pointer from the state structure. + * This is the pointer set with gnutls_state_set_ptr(). + * + **/ +void* gnutls_state_get_ptr(GNUTLS_STATE state) +{ + return state->gnutls_internals.user_ptr; +} + +/** + * gnutls_state_set_ptr - Used to set the user pointer to the state structure + * @state: is a &GNUTLS_STATE structure. + * @ptr: is the user pointer + * + * This function will set (assosiate) the user given pointer to the state structure. + * This is pointer can be accessed with gnutls_state_get_ptr(). + * + **/ +void gnutls_state_set_ptr(GNUTLS_STATE state, void* ptr) +{ + state->gnutls_internals.user_ptr = ptr; +} |