[SCM] GNU gnutls branch, master, updated. gnutls-3_0_12-249-gfd77f20
"Nikos Mavrogiannopoulos" <[email protected]>
| Newsgroups | gmane.comp.encryption.gpg.gnutls.cvs |
|---|---|
| Message-ID | <[email protected]> |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".
http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=fd77f201312a4bebb8e1b3ce393cc0d98f963d26
The branch, master has been updated
via fd77f201312a4bebb8e1b3ce393cc0d98f963d26 (commit)
from bc9d8d467861bf1f49dc0789f2e02d1a78c7d6f8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fd77f201312a4bebb8e1b3ce393cc0d98f963d26
Author: Nikos Mavrogiannopoulos <[email protected]>
Date: Fri Feb 17 09:00:28 2012 +0100
Added gnutls_dtls_get_timeout()
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
doc/cha-gtls-app.texi | 9 +++++++--
lib/gnutls_dtls.c | 28 ++++++++++++++++++++++++++++
lib/includes/gnutls/dtls.h | 4 +++-
lib/libgnutls.map | 1 +
5 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 72d12af..51675e2 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,7 @@ a fork (if PKCS #11 functionality is desirable).
** 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
diff --git a/doc/cha-gtls-app.texi b/doc/cha-gtls-app.texi
index 9207c26..06802df 100644
--- a/doc/cha-gtls-app.texi
+++ b/doc/cha-gtls-app.texi
@@ -579,9 +579,14 @@ In the case of DTLS it is also desirable to override the generic
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::
@@ -645,7 +650,7 @@ of DTLS messages and prevent messages from being silently discarded by the
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
diff --git a/lib/gnutls_dtls.c b/lib/gnutls_dtls.c
index f91ea71..a2c2261 100644
--- a/lib/gnutls_dtls.c
+++ b/lib/gnutls_dtls.c
@@ -596,6 +596,34 @@ unsigned int gnutls_dtls_get_mtu (gnutls_session_t session)
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
diff --git a/lib/includes/gnutls/dtls.h b/lib/includes/gnutls/dtls.h
index e25f622..f65c009 100644
--- a/lib/includes/gnutls/dtls.h
+++ b/lib/includes/gnutls/dtls.h
@@ -43,7 +43,9 @@ void gnutls_dtls_set_timeouts (gnutls_session_t session,
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:
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 82f39c4..ee8c480 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -774,6 +774,7 @@ GNUTLS_3_0_0 {
gnutls_verify_stored_pubkey;
gnutls_store_commitment;
gnutls_store_pubkey;
+ gnutls_dtls_get_timeout;
} GNUTLS_2_12;
GNUTLS_PRIVATE {
hooks/post-receive
--
GNU gnutls