summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2001-12-05 17:25:44 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2001-12-05 17:25:44 +0000
commitc393fd8a48c256b7d7cd087190a66dbc87c048e6 (patch)
tree64bca7e167b543c4af0e1cab92937a274e58deb0
parentc3bb0dca4238ef75893b00d73a883a8b3f2c7ce3 (diff)
downloadgnutls-c393fd8a48c256b7d7cd087190a66dbc87c048e6.tar.gz
Changes in function names concerning _db_ handling and _session_ handling.
-rw-r--r--NEWS2
-rw-r--r--configure.in3
-rw-r--r--doc/tex/ex1.tex14
-rw-r--r--doc/tex/serv1.tex4
-rw-r--r--lib/gnutls.h.in24
-rw-r--r--lib/gnutls_db.c40
-rw-r--r--lib/gnutls_db.h4
-rw-r--r--lib/gnutls_session.c16
-rw-r--r--lib/gnutls_session.h4
-rw-r--r--src/cli.c14
-rw-r--r--src/serv.c6
11 files changed, 68 insertions, 63 deletions
diff --git a/NEWS b/NEWS
index 14bd2db7be..817010628a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,8 +6,8 @@ Version ?.?.?
a list containing peer's certificate and issuers DER encoded.
- Added callback to select the server certificate
- Updated X.509 certificate handling API
-- More consistent function naming (changes in several function names)
- Buffer overflow checking in ASN.1 structures parser
+- More consistent function naming (changes several function names)
Version 0.2.11 (16/11/2001)
- Changed the meaning of GNUTLS_E_REHANDSHAKE value. If this value
diff --git a/configure.in b/configure.in
index 34e7121f2f..8526dce84e 100644
--- a/configure.in
+++ b/configure.in
@@ -14,6 +14,9 @@ GNUTLS_MAJOR_VERSION=0
GNUTLS_MINOR_VERSION=2
GNUTLS_MICRO_VERSION=90
GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
+GNUTLS_MAJOR_VERSION=0
+GNUTLS_MINOR_VERSION=3
+GNUTLS_MICRO_VERSION=0
AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION")
diff --git a/doc/tex/ex1.tex b/doc/tex/ex1.tex
index 2744a65b56..8757114919 100644
--- a/doc/tex/ex1.tex
+++ b/doc/tex/ex1.tex
@@ -70,7 +70,7 @@ int main()
gnutls_set_cred(state, GNUTLS_X509PKI, xcred);
if (t > 0) { /* if this is not the first time we connect */
- gnutls_set_current_session(state, session, session_size);
+ gnutls_session_set_data(state, session, session_size);
free(session);
}
@@ -90,26 +90,26 @@ int main()
if (t == 0) { /* the first time we connect */
/* get the session data size */
- gnutls_get_current_session(state, NULL, &session_size);
+ gnutls_session_get_data(state, NULL, &session_size);
session = malloc(session_size);
/* put session data to the session variable */
- gnutls_get_current_session(state, session, &session_size);
+ gnutls_session_get_data(state, session, &session_size);
/* keep the current session ID. This is only needed
* in order to check if the server actually resumed this
* connection.
*/
- gnutls_get_current_session_id(state, NULL, &session_id_size);
+ gnutls_session_get_id(state, NULL, &session_id_size);
session_id = malloc(session_id_size);
- gnutls_get_current_session_id(state, session_id, &session_id_size);
+ gnutls_session_get_id(state, session_id, &session_id_size);
} else { /* the second time we connect */
/* check if we actually resumed the previous session */
- gnutls_get_current_session_id(state, NULL, &tmp_session_id_size);
+ gnutls_session_get_id(state, NULL, &tmp_session_id_size);
tmp_session_id = malloc(tmp_session_id_size);
- gnutls_get_current_session_id(state, tmp_session_id, &tmp_session_id_size);
+ gnutls_session_get_id(state, tmp_session_id, &tmp_session_id_size);
if (memcmp(tmp_session_id, session_id, session_id_size) == 0) {
printf("- Previous session was resumed\n");
diff --git a/doc/tex/serv1.tex b/doc/tex/serv1.tex
index d8aed908bd..fc20046606 100644
--- a/doc/tex/serv1.tex
+++ b/doc/tex/serv1.tex
@@ -42,7 +42,7 @@ GNUTLS_STATE initialize_state()
/* in order to support session resuming:
*/
- if ((ret = gnutls_set_db_name(state, "gnutls-rsm.db")) < 0)
+ if ((ret = gnutls_db_set_name(state, "gnutls-rsm.db")) < 0)
fprintf(stderr, "*** DB error (%d)\n\n", ret);
gnutls_set_cipher_priority(state, GNUTLS_RIJNDAEL_CBC, GNUTLS_3DES_CBC, 0);
@@ -68,7 +68,7 @@ void print_info(GNUTLS_STATE state)
int sesid_size, i;
/* print session_id specific data */
- gnutls_get_current_session_id(state, sesid, &sesid_size);
+ gnutls_get_session_get_id(state, sesid, &sesid_size);
printf("\n- Session ID: ");
for (i = 0; i < sesid_size; i++)
printf("%.2X", sesid[i]);
diff --git a/lib/gnutls.h.in b/lib/gnutls.h.in
index 5a666f5f47..b3998bc868 100644
--- a/lib/gnutls.h.in
+++ b/lib/gnutls.h.in
@@ -127,14 +127,15 @@ int gnutls_set_protocol_priority( GNUTLS_STATE state, GNUTLS_LIST);
/* set our version - 0 for TLS 1.0 and 1 for SSL3 */
GNUTLS_Version gnutls_get_current_version(GNUTLS_STATE state);
+
const char *gnutls_version_get_name(GNUTLS_Version version);
/* get/set session */
-int gnutls_set_current_session( GNUTLS_STATE state, void* session, int session_size);
-int gnutls_get_current_session( GNUTLS_STATE state, void* session, int *session_size);
+int gnutls_session_set_data( GNUTLS_STATE state, void* session, int session_size);
+int gnutls_session_get_data( GNUTLS_STATE state, void* session, int *session_size);
/* returns the session ID */
-int gnutls_get_current_session_id( GNUTLS_STATE state, void* session, int *session_size);
+int gnutls_session_get_id( GNUTLS_STATE state, void* session, int *session_size);
typedef int (*DB_STORE_FUNC)(void*, gnutls_datum key, gnutls_datum data);
typedef int (*DB_REMOVE_FUNC)(void*, gnutls_datum key);
@@ -142,13 +143,14 @@ typedef gnutls_datum (*DB_RETR_FUNC)(void*, gnutls_datum key);
void gnutls_set_lowat( GNUTLS_STATE state, int num);
void gnutls_set_cache_expiration( GNUTLS_STATE state, int seconds);
-int gnutls_set_db_name( GNUTLS_STATE state, char* filename);
-int gnutls_clean_db( GNUTLS_STATE state);
-void gnutls_set_db_retrieve_func( GNUTLS_STATE, DB_RETR_FUNC);
-void gnutls_set_db_remove_func( GNUTLS_STATE, DB_REMOVE_FUNC);
-void gnutls_set_db_store_func( GNUTLS_STATE, DB_STORE_FUNC);
-void gnutls_set_db_ptr( GNUTLS_STATE, void* db_ptr);
-int gnutls_check_db_entry( GNUTLS_STATE state, gnutls_datum session_entry);
+
+int gnutls_db_set_name( GNUTLS_STATE state, char* filename);
+int gnutls_db_clean( GNUTLS_STATE state);
+void gnutls_db_set_retrieve_func( GNUTLS_STATE, DB_RETR_FUNC);
+void gnutls_db_set_remove_func( GNUTLS_STATE, DB_REMOVE_FUNC);
+void gnutls_db_set_store_func( GNUTLS_STATE, DB_STORE_FUNC);
+void gnutls_db_set_ptr( GNUTLS_STATE, void* db_ptr);
+int gnutls_db_check_entry( GNUTLS_STATE state, gnutls_datum session_entry);
void gnutls_set_max_handshake_data_buffer_size( GNUTLS_STATE state, int max);
@@ -165,7 +167,7 @@ int gnutls_set_cred( GNUTLS_STATE, CredType type, void* cred);
* TLS extension. (draft-ietf-tls-extensions)
*/
const void* gnutls_ext_get_name_ind( GNUTLS_STATE state, GNUTLS_NAME_IND ind);
-int gnutls_ext_set_name_ind( GNUTLS_STATE state, GNUTLS_NAME_IND ind, const void* name);
+ int gnutls_ext_set_name_ind( GNUTLS_STATE state, GNUTLS_NAME_IND ind, const void* name);
/* This will set the Common Name field in case of X509PKI
* authentication. This will be used while verifying the
diff --git a/lib/gnutls_db.c b/lib/gnutls_db.c
index 7e68afd101..5815a67dbb 100644
--- a/lib/gnutls_db.c
+++ b/lib/gnutls_db.c
@@ -38,7 +38,7 @@
#endif
/**
- * gnutls_set_db_retrieve_function - Sets the function that will be used to get data
+ * gnutls_db_set_retrieve_function - Sets the function that will be used to get data
* @state: is a &GNUTLS_STATE structure.
* @retr_func: is the function.
*
@@ -48,16 +48,16 @@
* This function should only be used if you do
* not plan to use the included gdbm backend.
*
- * The first argument to store_func() will be null unless gnutls_set_db_ptr()
+ * The first argument to store_func() will be null unless gnutls_db_set_ptr()
* has been called.
*
**/
-void gnutls_set_db_retrieve_function( GNUTLS_STATE state, DB_RETR_FUNC retr_func) {
+void gnutls_db_set_retrieve_function( GNUTLS_STATE state, DB_RETR_FUNC retr_func) {
state->gnutls_internals.db_retrieve_func = retr_func;
}
/**
- * gnutls_set_db_remove_function - Sets the function that will be used to remove data
+ * gnutls_db_set_remove_function - Sets the function that will be used to remove data
* @state: is a &GNUTLS_STATE structure.
* @rem_func: is the function.
*
@@ -66,16 +66,16 @@ void gnutls_set_db_retrieve_function( GNUTLS_STATE state, DB_RETR_FUNC retr_func
* This function should only be used if you do
* not plan to use the included gdbm backend.
*
- * The first argument to rem_func() will be null unless gnutls_set_db_ptr()
+ * The first argument to rem_func() will be null unless gnutls_db_set_ptr()
* has been called.
*
**/
-void gnutls_set_db_remove_function( GNUTLS_STATE state, DB_REMOVE_FUNC rem_func) {
+void gnutls_db_set_remove_function( GNUTLS_STATE state, DB_REMOVE_FUNC rem_func) {
state->gnutls_internals.db_remove_func = rem_func;
}
/**
- * gnutls_set_db_store_function - Sets the function that will be used to put data
+ * gnutls_db_set_store_function - Sets the function that will be used to put data
* @state: is a &GNUTLS_STATE structure.
* @store_func: is the function
*
@@ -84,16 +84,16 @@ void gnutls_set_db_remove_function( GNUTLS_STATE state, DB_REMOVE_FUNC rem_func)
* This function should only be used if you do
* not plan to use the included gdbm backend.
*
- * The first argument to store_func() will be null unless gnutls_set_db_ptr()
+ * The first argument to store_func() will be null unless gnutls_db_set_ptr()
* has been called.
*
**/
-void gnutls_set_db_store_function( GNUTLS_STATE state, DB_STORE_FUNC store_func) {
+void gnutls_db_set_store_function( GNUTLS_STATE state, DB_STORE_FUNC store_func) {
state->gnutls_internals.db_store_func = store_func;
}
/**
- * gnutls_set_db_ptr - Sets a pointer to be sent to db functions
+ * gnutls_db_set_ptr - Sets a pointer to be sent to db functions
* @state: is a &GNUTLS_STATE structure.
* @ptr: is the pointer
*
@@ -101,7 +101,7 @@ void gnutls_set_db_store_function( GNUTLS_STATE state, DB_STORE_FUNC store_func)
* the first argument. Should only be called if not using the gdbm backend.
*
**/
-void gnutls_set_db_ptr( GNUTLS_STATE state, void* ptr) {
+void gnutls_db_set_ptr( GNUTLS_STATE state, void* ptr) {
state->gnutls_internals.db_ptr = ptr;
}
@@ -118,7 +118,7 @@ void gnutls_set_cache_expiration( GNUTLS_STATE state, int seconds) {
}
/**
- * gnutls_set_db_name - Sets the name of the database that holds TLS sessions.
+ * gnutls_db_set_name - Sets the name of the database that holds TLS sessions.
* @state: is a &GNUTLS_STATE structure.
* @filename: is the filename for the database
*
@@ -126,10 +126,10 @@ void gnutls_set_cache_expiration( GNUTLS_STATE state, int seconds) {
* the sessions to be resumed. This function also creates the database
* - if it does not exist - and opens it for reading.
* You should not call this function if using an other backend
- * than gdbm (ie. called function gnutls_set_db_store_func() etc.)
+ * than gdbm (ie. called function gnutls_db_set_store_func() etc.)
*
**/
-int gnutls_set_db_name( GNUTLS_STATE state, char* filename) {
+int gnutls_db_set_name( GNUTLS_STATE state, char* filename) {
#ifdef HAVE_LIBGDBM
GDBM_FILE dbf;
@@ -166,7 +166,7 @@ GDBM_FILE dbf;
}
/**
- * gnutls_check_db_entry - checks if the given db entry has expired
+ * gnutls_db_check_entry - checks if the given db entry has expired
* @state: is a &GNUTLS_STATE structure.
* @session_entry: is the session data (not key)
*
@@ -177,7 +177,7 @@ GDBM_FILE dbf;
* backend.
*
**/
-int gnutls_check_db_entry( GNUTLS_STATE state, gnutls_datum session_entry) {
+int gnutls_db_check_entry( GNUTLS_STATE state, gnutls_datum session_entry) {
time_t timestamp;
timestamp = time(0);
@@ -190,7 +190,7 @@ time_t timestamp;
}
/**
- * gnutls_clean_db - removes expired and invalid sessions from the database
+ * gnutls_db_clean - removes expired and invalid sessions from the database
* @state: is a &GNUTLS_STATE structure.
*
* This function Deletes all expired records in the resumed sessions' database.
@@ -199,7 +199,7 @@ time_t timestamp;
* be called if using the gdbm backend.
*
**/
-int gnutls_clean_db( GNUTLS_STATE state) {
+int gnutls_db_clean( GNUTLS_STATE state) {
#ifdef HAVE_LIBGDBM
GDBM_FILE dbf;
int ret;
@@ -220,7 +220,7 @@ gnutls_datum _key;
_key.size = key.dsize;
while( _key.data != NULL) {
- if ( gnutls_check_db_entry( state, _key)==GNUTLS_E_EXPIRED) {
+ if ( gnutls_db_check_entry( state, _key)==GNUTLS_E_EXPIRED) {
/* delete expired entry */
gdbm_delete( dbf, key);
}
@@ -290,7 +290,7 @@ int ret;
}
/* expiration check is performed inside */
- ret = gnutls_set_current_session( state, data.data, data.size);
+ ret = gnutls_session_set_data( state, data.data, data.size);
/* Note: Data is not allocated with gnutls_malloc
*/
diff --git a/lib/gnutls_db.h b/lib/gnutls_db.h
index a547a49a2e..b62cd13161 100644
--- a/lib/gnutls_db.h
+++ b/lib/gnutls_db.h
@@ -19,10 +19,10 @@
*/
void gnutls_set_cache_expiration( GNUTLS_STATE state, int seconds);
-int gnutls_set_db_name( GNUTLS_STATE state, char* filename);
+int gnutls_db_set_name( GNUTLS_STATE state, char* filename);
int _gnutls_server_register_current_session( GNUTLS_STATE state);
int _gnutls_server_restore_session( GNUTLS_STATE state, uint8* session_id, int session_id_size);
-int gnutls_clean_db( GNUTLS_STATE state);
+int gnutls_db_clean( GNUTLS_STATE state);
int _gnutls_db_remove_session( GNUTLS_STATE state, uint8* session_id, int session_id_size);
int _gnutls_store_session( GNUTLS_STATE state, gnutls_datum session_id, gnutls_datum session_data);
gnutls_datum _gnutls_retrieve_session( GNUTLS_STATE state, gnutls_datum session_id);
diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c
index 8e98641e60..43cca3e1ab 100644
--- a/lib/gnutls_session.c
+++ b/lib/gnutls_session.c
@@ -25,19 +25,19 @@
#define SESSION_SIZE _gnutls_session_size( state)
/**
- * gnutls_get_current_session - Returns all session parameters.
+ * gnutls_session_get_data - Returns all session parameters.
* @state: is a &GNUTLS_STATE structure.
* @session: is a pointer to space to hold the session.
* @session_size: is the session's size, or it will be set by the function.
*
* Returns all session parameters - in order to support resuming.
* The client should call this - and keep the returned session - if he wants to
- * resume that current version later by calling gnutls_set_current_session()
+ * resume that current version later by calling gnutls_session_set_data()
* This function must be called after a successful handshake.
*
* Resuming sessions is really useful and speedups connections after a succesful one.
**/
-int gnutls_get_current_session( GNUTLS_STATE state, opaque* session, int *session_size) {
+int gnutls_session_get_data( GNUTLS_STATE state, opaque* session, int *session_size) {
gnutls_datum psession;
int ret;
@@ -67,7 +67,7 @@ int gnutls_get_current_session( GNUTLS_STATE state, opaque* session, int *sessio
/**
- * gnutls_get_current_session_id - Returns session id.
+ * gnutls_session_get_id - Returns session id.
* @state: is a &GNUTLS_STATE structure.
* @session: is a pointer to space to hold the session id.
* @session_size: is the session id's size, or it will be set by the function.
@@ -79,7 +79,7 @@ int gnutls_get_current_session( GNUTLS_STATE state, opaque* session, int *sessio
* Session id is some data set by the server, that identify the current session.
* In TLS 1.0 session id should not be more than 32 bytes.
**/
-int gnutls_get_current_session_id( GNUTLS_STATE state, void* session, int *session_size) {
+int gnutls_session_get_id( GNUTLS_STATE state, void* session, int *session_size) {
*session_size = state->security_parameters.session_id_size;
@@ -93,19 +93,19 @@ int gnutls_get_current_session_id( GNUTLS_STATE state, void* session, int *sessi
}
/**
- * gnutls_set_current_session - Sets all session parameters
+ * gnutls_session_set_data - Sets all session parameters
* @state: is a &GNUTLS_STATE structure.
* @session: is a pointer to space to hold the session.
* @session_size: is the session's size
*
* Sets all session parameters - in order to support resuming
- * session must be the one returned by gnutls_get_current_session();
+ * session must be the one returned by gnutls_session_get_data();
* This function should be called before gnutls_handshake().
* Keep in mind that session resuming is advisory. The server may
* choose not to resume the session, thus a full handshake will be
* performed.
**/
-int gnutls_set_current_session( GNUTLS_STATE state, opaque* session, int session_size) {
+int gnutls_session_set_data( GNUTLS_STATE state, opaque* session, int session_size) {
int ret;
gnutls_datum psession = { session, session_size };
diff --git a/lib/gnutls_session.h b/lib/gnutls_session.h
index ce456afefc..9ed5b5cbf5 100644
--- a/lib/gnutls_session.h
+++ b/lib/gnutls_session.h
@@ -18,5 +18,5 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-int gnutls_set_current_session( GNUTLS_STATE state, opaque* session, int session_size);
-int gnutls_get_current_session( GNUTLS_STATE state, opaque* session, int *session_size);
+int gnutls_session_set_data( GNUTLS_STATE state, opaque* session, int session_size);
+int gnutls_session_get_data( GNUTLS_STATE state, opaque* session, int *session_size);
diff --git a/src/cli.c b/src/cli.c
index 9545edb97f..a2e22a62db 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -253,13 +253,13 @@ int main(int argc, char** argv)
printf("- Handshake was completed\n");
}
- gnutls_get_current_session( state, NULL, &session_size);
+ gnutls_session_get_data( state, NULL, &session_size);
session = malloc(session_size);
- gnutls_get_current_session( state, session, &session_size);
+ gnutls_session_get_data( state, session, &session_size);
- gnutls_get_current_session_id( state, NULL, &session_id_size);
+ gnutls_session_get_id( state, NULL, &session_id_size);
session_id = malloc(session_id_size);
- gnutls_get_current_session_id( state, session_id, &session_id_size);
+ gnutls_session_get_id( state, session_id, &session_id_size);
/* print some information */
print_info( state);
@@ -299,7 +299,7 @@ int main(int argc, char** argv)
gnutls_set_mac_priority( state, GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0);
#ifdef RESUME
- gnutls_set_current_session( state, session, session_size);
+ gnutls_session_set_data( state, session, session_size);
free(session);
#endif
@@ -320,9 +320,9 @@ int main(int argc, char** argv)
}
/* check if we actually resumed the previous session */
- gnutls_get_current_session_id( state, NULL, &tmp_session_id_size);
+ gnutls_session_get_id( state, NULL, &tmp_session_id_size);
tmp_session_id = malloc(tmp_session_id_size);
- gnutls_get_current_session_id( state, tmp_session_id, &tmp_session_id_size);
+ gnutls_session_get_id( state, tmp_session_id, &tmp_session_id_size);
if (memcmp( tmp_session_id, session_id, session_id_size)==0) {
printf("- Previous session was resumed\n");
diff --git a/src/serv.c b/src/serv.c
index 93d07069c6..0c119fd5d4 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -77,7 +77,7 @@ GNUTLS_STATE initialize_state()
int ret;
gnutls_init(&state, GNUTLS_SERVER);
- if ((ret = gnutls_set_db_name(state, "gnutls-rsm.db")) < 0)
+ if ((ret = gnutls_db_set_name(state, "gnutls-rsm.db")) < 0)
fprintf(stderr, "*** DB error (%d). Resuming will not be possible.\n\n", ret);
/* null cipher is here only for debuging
@@ -113,7 +113,7 @@ void print_info(GNUTLS_STATE state)
int cert_list_size = 0;
/* print session_id specific data */
- gnutls_get_current_session_id( state, sesid, &sesid_size);
+ gnutls_session_get_id( state, sesid, &sesid_size);
printf("\n- Session ID: ");
for(i=0;i<sesid_size;i++)
printf("%.2X", sesid[i]);
@@ -215,7 +215,7 @@ void peer_print_info( GNUTLS_STATE state)
int sesid_size, i;
/* print session_id */
- gnutls_get_current_session_id( state, sesid, &sesid_size);
+ gnutls_session_get_id( state, sesid, &sesid_size);
sprintf(tmp2, "\n<p>Session ID: <i>");
for(i=0;i<sesid_size;i++)
sprintf(tmp2, "%.2X", sesid[i]);