gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls-3_0_12-249-gfd77f20


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls-3_0_12-249-gfd77f20
Date: Fri, 17 Feb 2012 18:33:49 +0000

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 <address@hidden>
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
address@hidden is provided, which returns the time
+remaining until the next retransmission, or better the time until 
address@hidden should be called again.
 
 @showfuncdesc{gnutls_transport_set_pull_timeout_function}
address@hidden
 
 @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}.
 
address@hidden,gnutls_dtls_get_mtu,gnutls_dtls_get_data_mtu}
address@hidden,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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]