]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Changes in function names concerning _db_ handling and _session_ handling.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 5 Dec 2001 17:25:44 +0000 (17:25 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 5 Dec 2001 17:25:44 +0000 (17:25 +0000)
NEWS
configure.in
doc/tex/ex1.tex
doc/tex/serv1.tex
lib/gnutls.h.in
lib/gnutls_db.c
lib/gnutls_db.h
lib/gnutls_session.c
lib/gnutls_session.h
src/cli.c
src/serv.c

diff --git a/NEWS b/NEWS
index 14bd2db7bef2e2d7df66ab7bd48bf39add45414c..817010628a531cafaa57ae5c0e5bdb855a7764e3 100644 (file)
--- 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
index 34e7121f2f36273679c9125ea4ab8d6167aefeff..8526dce84e3e88ecdc2c8153a841a4315860d381 100644 (file)
@@ -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")
 
index 2744a65b560899ffbb8100953f6c6b275b2637b5..87571149191d5bad0ea6d9f976f13ece30d58fe0 100644 (file)
@@ -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");
index d8aed908bd935f1b82b50825362cf4809628e2ba..fc20046606b1a26c2ae783d5e8bd9a50034eb001 100644 (file)
@@ -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]);
index 5a666f5f47a2b8aa05d12a0415a996b5001ad226..b3998bc868c7a1c9d5e87e331a07bc2d93507eaa 100644 (file)
@@ -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
index 7e68afd1011b9a1e9b1958ac05d8f9aa36fa37a3..5815a67dbb734581a88f024a5f4e2886c4d12d48 100644 (file)
@@ -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.
   *
   * 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
         */
index a547a49a2e8e40a48986817148db9ec18126e4cf..b62cd13161fc8efa4257e0018f1ff2a0c3ba51f1 100644 (file)
  */
 
 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);
index 8e98641e608ae76e1590cdeb6d4246234cbe209e..43cca3e1ab4c030be4e37e82b3e427ad07b4fe71 100644 (file)
 #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 };
 
index ce456afefccc1058157708bca0178bb16dc30898..9ed5b5cbf5e92e651e8ece0038850bf028358a2d 100644 (file)
@@ -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);
index 9545edb97fe1e68c1c78e3622223f22f39fe1326..a2e22a62db443295b846603b496d3b42a4925f7c 100644 (file)
--- 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");
index 93d07069c6e9caab5bcf9c32c4e53cb1fce03db4..0c119fd5d4fa666243e5d41c4573598b59f87f26 100644 (file)
@@ -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]);