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);
#ifdef READ_DEBUG
int j,x, sum=0;
#endif
+ session->internals.direction = 0;
+
gnutls_transport_ptr fd = session->internals.transport_recv_ptr;
left = sizeOfPtr;
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
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.
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
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))
{
int ret = 0;
- /* to know where the procedure was interrupted.
- */
- session->internals.handshake_direction = 1; /* write */
-
/* Send the CHANGE CIPHER SPEC PACKET */
switch (STATE) {
int ret = 0;
uint8 ch;
- /* to know where the procedure was interrupted.
- */
- session->internals.handshake_direction = 0; /* recv */
-
switch (STATE) {
case STATE0:
case STATE30:
* 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().
*/
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 */
{
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;
+}