DTLS_SET_TIMER_CB(3SSL)

πŸ’… DTLS_set_timer_cb β€” bestie, let's talk DTLS timers (OpenSSL, 3SSL girlies)

okay so literally the whole point of this page: DTLS_timer_cb and DTLS_set_timer_cb β€” they're your ✨set callback for controlling DTLS timer duration✨ era. No cap. If you're doing DTLS and you want a say in how long the protocol waits between retransmits, this is the function for you. Main character energy.


✨ SYNOPSIS ✨

#include <openssl/ssl.h>

typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us);

void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb);

πŸŽ€ DESCRIPTION πŸŽ€

So DTLS_set_timer_cb() sets an optional callback function that controls the timeout interval on the DTLS protocol. πŸ• And the way that it works is β€” DTLS calls your callback every single time a new DTLS packet is sent. Every one. Obsessed with the dedication tbh.

Your callback's whole job? Return the timeout interval in micro seconds. That's it. That's the assignment. πŸ’…

The timer_us parameter of the callback is the last set timeout interval that was returned. So on the very first invocation of the callback, this value will be 0. Fresh start energy. 🌱

Now for the defaults, because ikyk y'all wanna know what happens if you don't show up:

  • At the beginning of the connection, if no timeout callback has been set via DTLS_set_timer_cb(), the default timeout value is 1 second.
  • For all subsequent timeouts, the default behavior is to double the duration up to a maximum of 1 minute. It's giving exponential backoff but make it dramatic. πŸ“ˆ

🫢 RETURN VALUES 🫢

Returns void. Nothing to see here, she gives nothing back, she's just here to set the vibe. πŸ’–


🌸 HISTORY 🌸

The DTLS_set_timer_cb() function was added in OpenSSL 1.1.1. Vintage but iconic, fr fr. ⭐


Copyright 2017-2025 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.

bestie, that link and that LICENSE file path are literally mandatory reading before you go using this, ok? Don't do crimes with the license. πŸ™ˆ

mwah πŸ’‹ that's the whole page. This one was chillin' in the OpenSSL 4.0.3 docs, dated 2026-09-29 β€” go slay your DTLS timers, queen. πŸ¦‹βœ¨

πŸ“¦ where this page comes from