]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
replaced gnutls_handshake_get_direction() with gnutls_record_get_direction().
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 16 Sep 2002 17:03:46 +0000 (17:03 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 16 Sep 2002 17:03:46 +0000 (17:03 +0000)
lib/gnutls.h.in.in
lib/gnutls_buffers.c
lib/gnutls_handshake.c
lib/gnutls_int.h
lib/gnutls_int_compat.c
lib/gnutls_state.c

index 28420151c76b6e56bb67dd2f91e05d1958de83d7..7d2bf526ed23e7fdf79200ce7717c0f5ab97f802 100644 (file)
@@ -133,7 +133,7 @@ int gnutls_bye( gnutls_session session, gnutls_close_request how);
 int gnutls_handshake( gnutls_session session);
 int gnutls_rehandshake( gnutls_session session);
 
-int gnutls_handshake_get_direction(gnutls_session session);
+int gnutls_record_get_direction(gnutls_session session);
 
 gnutls_alert_description gnutls_alert_get( gnutls_session session);
 int             gnutls_alert_send( gnutls_session, gnutls_alert_level, gnutls_alert_description);
index 3faa2e6ce045104a7e258488c00ba2e0c804e984..a6d7df580282c8ae128fa3e71800d0e2ff4abde3 100644 (file)
@@ -205,6 +205,8 @@ static ssize_t _gnutls_read( gnutls_session session, void *iptr, size_t sizeOfPt
 #ifdef READ_DEBUG
        int j,x, sum=0;
 #endif
+       session->internals.direction = 0;
+
        gnutls_transport_ptr fd = session->internals.transport_recv_ptr;
 
        left = sizeOfPtr;
@@ -523,7 +525,11 @@ ssize_t _gnutls_io_write_buffered( gnutls_session session, const void *iptr, siz
        const opaque * ptr;
        int ret;
        gnutls_transport_ptr fd = session->internals.transport_send_ptr;
-       
+
+       /* to know where the procedure was interrupted.
+        */
+       session->internals.direction = 1;
+
        ptr = iptr;
 
        /* In case the previous write was interrupted, check if the
index 2bf54d9659bc8d682a3aa108cd3904443e2e0b4c..77033eebcebb99e1990194c9bc2e66d065f3ed91 100644 (file)
@@ -719,10 +719,6 @@ int _gnutls_send_handshake(gnutls_session session, void *i_data,
        uint32 datasize;
        int pos = 0;
 
-       /* to know where the procedure was interrupted.
-        */
-       session->internals.handshake_direction = 1; /* write */
-
        if (i_data == NULL && i_datasize == 0) {
                /* we are resuming a previously interrupted
                 * send.
@@ -966,10 +962,6 @@ int _gnutls_recv_handshake(gnutls_session session, uint8 ** data,
        opaque *dataptr = NULL;
        HandshakeType recv_type;
 
-       /* to know where the procedure was interrupted.
-        */
-       session->internals.handshake_direction = 0; /* read */
-
        ret = _gnutls_recv_handshake_header(session, type, &recv_type);
        if (ret < 0) {
                if (ret == GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET
@@ -1769,22 +1761,6 @@ int gnutls_rehandshake(gnutls_session session)
        return 0;
 }
 
-/**
-  * gnutls_handshake_get_direction - This function will return the session of the handshake protocol
-  * @session: is a a &gnutls_session 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_get_direction(gnutls_session session) {
-       return session->internals.handshake_direction;
-}
-
 static int _gnutls_abort_handshake( gnutls_session session, int ret) {
        if ( ((ret==GNUTLS_E_WARNING_ALERT_RECEIVED) && 
                ( gnutls_alert_get(session) == GNUTLS_A_NO_RENEGOTIATION))
@@ -2027,10 +2003,6 @@ static int _gnutls_send_handshake_final(gnutls_session session, int init)
 {
        int ret = 0;
 
-       /* to know where the procedure was interrupted.
-        */
-       session->internals.handshake_direction = 1; /* write */
-
        /* Send the CHANGE CIPHER SPEC PACKET */
 
        switch (STATE) {
@@ -2087,10 +2059,6 @@ static int _gnutls_recv_handshake_final(gnutls_session session, int init)
        int ret = 0;
        uint8 ch;
 
-       /* to know where the procedure was interrupted.
-        */
-       session->internals.handshake_direction = 0; /* recv */
-
        switch (STATE) {
        case STATE0:
        case STATE30:
index cc97b8c1327f0cc38402c500a5f7ef658f5aec38..ace4ce16ef59b98d9a9dd67ef0c55fbadb7fcbb8 100644 (file)
@@ -552,10 +552,10 @@ typedef struct {
                                                * which have 0xFF status.
                                                */
        
-       /* Holds 0 if the handshake procedure was interrupted while
+       /* Holds 0 if the last called function was interrupted while
         * receiving, and non zero otherwise.
         */
-       int                     handshake_direction;
+       int                     direction;
 
        /* If you add anything here, check _gnutls_handshake_internal_state_clear().
         */
index 5f338bf1fdf36a51ff0d3ad42655733a68917b86..c81cbb98d124310ad7a0291ec9b9a7f9264a308b 100644 (file)
@@ -107,6 +107,11 @@ int gnutls_certificate_allocate_cred( gnutls_certificate_credentials *sc)
        return gnutls_certificate_allocate_credentials( sc);
 }
 
+#undef gnutls_handshake_get_direction
+int gnutls_handshake_get_direction(gnutls_session session) {
+       return gnutls_record_get_direction( session);
+}
+
 /* nothing here */
 
 #endif /* GNUTLS_BACKWARDS_COMPATIBLE */
index afa9b56691f707a6f4aba03ec6c169de6e8d1411..cf473fdb6368d111b7eebf14249c83f1beac383b 100644 (file)
@@ -740,3 +740,20 @@ void gnutls_session_set_ptr(gnutls_session session, void* ptr)
 {
        session->internals.user_ptr = ptr;
 }
+
+
+/**
+  * gnutls_record_get_direction - This function will return the direction of the last interrupted function call
+  * @session: is a a &gnutls_session structure.
+  *
+  * This function provides information about the internals of the record
+  * protocol and is only useful if any gnutls function call was 
+  * interrupted for some reason.
+  *
+  * Returns 0 if the function was interrupted while receiving data, and 
+  * 1 otherwise. 
+  *
+  **/
+int gnutls_record_get_direction(gnutls_session session) {
+       return session->internals.direction;
+}