** libgnutls: Depend on p11-kit 0.11.
** API and ABI modifications:
+gnutls_dtls_get_timeout: Added
gnutls_verify_stored_pubkey: Added
gnutls_store_pubkey: Added
gnutls_store_commitment: Added
transport functions with functions that emulate the operation
of @code{recvfrom} and @code{sendto}. In addition
@acronym{DTLS} requires timers during the receive of a handshake
-message. This requires the @funcref{gnutls_transport_set_pull_timeout_function} function to be used.
+message, set using the @funcref{gnutls_transport_set_pull_timeout_function}
+function. To check the retransmission timers the function
+@funcref{gnutls_dtls_get_timeout} is provided, which returns the time
+remaining until the next retransmission, or better the time until
+@funcref{gnutls_handshake} should be called again.
@showfuncdesc{gnutls_transport_set_pull_timeout_function}
+@showfuncdesc{gnutls_dtls_get_timeout}
@menu
* Asynchronous operation::
transport layer. The ``correct'' maximum transfer unit can be obtained through
a path MTU discovery mechanism @xcite{RFC4821}.
-@showfuncC{gnutls_dtls_set_mtu,gnutls_dtls_get_mtu,gnutls_dtls_get_data_mtu}
+@showfuncD{gnutls_dtls_set_mtu,gnutls_dtls_get_mtu,gnutls_dtls_get_data_mtu}
@node TLS handshake
return session->internals.dtls.mtu;
}
+/**
+ * gnutls_dtls_get_timeout:
+ * @session: is a #gnutls_session_t structure.
+ *
+ * This function will return the milliseconds remaining
+ * for a retransmission of the previously sent handshake
+ * message. This function is useful when DTLS is used in
+ * non-blocking mode, to estimate when to call gnutls_handshake()
+ * if no packets have been received.
+ *
+ * Returns: the remaining time in milliseconds.
+ *
+ * Since: 3.0.0
+ **/
+unsigned int gnutls_dtls_get_timeout (gnutls_session_t session)
+{
+struct timespec now;
+unsigned int diff;
+
+ gettime(&now);
+
+ diff = timespec_sub_ms(&now, &session->internals.dtls.last_retransmit);
+ if (diff >= session->internals.dtls.actual_retrans_timeout_ms)
+ return 0;
+ else
+ return session->internals.dtls.actual_retrans_timeout_ms - diff;
+}
+
#define COOKIE_SIZE 16
#define COOKIE_MAC_SIZE 16
unsigned int gnutls_dtls_get_mtu (gnutls_session_t session);
unsigned int gnutls_dtls_get_data_mtu (gnutls_session_t session);
- void gnutls_dtls_set_mtu (gnutls_session_t session, unsigned int mtu);
+void gnutls_dtls_set_mtu (gnutls_session_t session, unsigned int mtu);
+
+unsigned int gnutls_dtls_get_timeout (gnutls_session_t session);
/**
* gnutls_dtls_prestate_st:
gnutls_verify_stored_pubkey;
gnutls_store_commitment;
gnutls_store_pubkey;
+ gnutls_dtls_get_timeout;
} GNUTLS_2_12;
GNUTLS_PRIVATE {