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);
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.
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
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))
* 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;