]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added new function gnutls_handshake_check_direction(), which returns the state where...
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 15 Aug 2002 21:49:59 +0000 (21:49 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 15 Aug 2002 21:49:59 +0000 (21:49 +0000)
lib/gnutls.h.in.in
lib/gnutls_handshake.c
lib/gnutls_int.h

index a1d1119056ced4436e307e041cfdc9818f081ac1..f2473bfaf15332771c095e03116397e68a14643e 100644 (file)
@@ -120,6 +120,7 @@ int gnutls_bye( GNUTLS_STATE state, GNUTLS_CloseRequest how);
 int gnutls_handshake( GNUTLS_STATE state);
 int gnutls_rehandshake( GNUTLS_STATE state);
 
+int gnutls_handshake_check_direction(GNUTLS_STATE state);
 
 GNUTLS_AlertDescription gnutls_alert_get( GNUTLS_STATE state);
 int             gnutls_alert_send( GNUTLS_STATE, GNUTLS_AlertLevel, GNUTLS_AlertDescription);
index da9aca55810d767ec8d47de4e63aa086dbb3d1ab..b9acc18c7c633104ba02e1cc8e6c25d665631703 100644 (file)
@@ -717,6 +717,10 @@ int _gnutls_send_handshake(GNUTLS_STATE state, void *i_data,
        uint32 datasize;
        int pos = 0;
 
+       /* to know where the procedure was interrupted.
+        */
+       state->gnutls_internals.handshake_direction = 1; /* write */
+
        if (i_data == NULL && i_datasize == 0) {
                /* we are resuming a previously interrupted
                 * send.
@@ -960,6 +964,10 @@ int _gnutls_recv_handshake(GNUTLS_STATE state, uint8 ** data,
        opaque *dataptr = NULL;
        HandshakeType recv_type;
 
+       /* to know where the procedure was interrupted.
+        */
+       state->gnutls_internals.handshake_direction = 0; /* read */
+
        ret = _gnutls_recv_handshake_header(state, type, &recv_type);
        if (ret < 0) {
                if (ret == GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET
@@ -1767,6 +1775,22 @@ int gnutls_rehandshake(GNUTLS_STATE state)
        return 0;
 }
 
+/**
+  * gnutls_handshake_check_direction - This function will return the state of the handshake protocol
+  * @state: is a a &GNUTLS_STATE structure.
+  *
+  * This function provides information about the handshake procedure, and
+  * is only useful if the gnutls_handshake() call was interrupted for some
+  * reason.
+  *
+  * Returns 0 if the function was interrupted while receiving data, and 
+  * 1 otherwise. 
+  *
+  **/
+int gnutls_handshake_check_direction(GNUTLS_STATE state) {
+       return state->gnutls_internals.handshake_direction;
+}
+
 static int _gnutls_abort_handshake( GNUTLS_STATE state, int ret) {
        if ( ((ret==GNUTLS_E_WARNING_ALERT_RECEIVED) && 
                ( gnutls_alert_get(state) == GNUTLS_A_NO_RENEGOTIATION))
index e6e44144b5c65196536878b0a4834188aaca4925..e4d0546897860dd346fe1f5e1496c4edcc96514c 100644 (file)
@@ -569,6 +569,12 @@ typedef struct {
                                                * enable cipher suites
                                                * which have 0xFF status.
                                                */
+       
+       /* Holds 0 if the handshake procedure was interrupted while
+        * receiving, and non zero otherwise.
+        */
+       int                     handshake_direction;
+
        /* If you add anything here, check _gnutls_handshake_internal_state_clear().
         */
 } GNUTLS_INTERNALS;