gnutls\_dtls\_cookie\_send(3) gnutls gnutls\_dtls\_cookie\_send(3)

# [NAME](#NAME)

gnutls\_dtls\_cookie\_send - API function

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;gnutls/dtls.h&gt;**

**int gnutls\_dtls\_cookie\_send(gnutls\_datum\_t * key, void * client\_data, size\_t client\_data\_size, gnutls\_dtls\_prestate\_st * prestate, gnutls\_transport\_ptr\_t ptr, gnutls\_push\_func push\_func);**

# [ARGUMENTS](#ARGUMENTS)

[gnutls\_datum\_t * key](#gnutls_datum_t)

is a random key to be used at cookie generation

[void * client\_data](#void)

contains data identifying the client (i.e. address)

[size\_t client\_data\_size](#size_t)

The size of client's data

[gnutls\_dtls\_prestate\_st * prestate](#gnutls_dtls_prestate_st)

The previous cookie returned by **gnutls\_dtls\_cookie\_verify()**

[gnutls\_transport\_ptr\_t ptr](#gnutls_transport_ptr_t)

A transport pointer to be used by *push\_func*

[gnutls\_push\_func push\_func](#gnutls_push_func)

A function that will be used to reply

# [DESCRIPTION](#DESCRIPTION)

This function can be used to prevent denial of service attacks to a DTLS server by requiring the client to reply using a cookie sent by this function. That way it can be ensured that a client we allocated resources for (i.e. **gnutls\_session\_t**) is the one that the original incoming packet was originated from.

This function must be called at the first incoming packet, prior to allocating any resources and must be succeeded by **gnutls\_dtls\_cookie\_verify()**.

# [RETURNS](#RETURNS)

the number of bytes sent, or a negative error code.

# [SINCE](#SINCE)

3.0

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;bugs@gnutls.org&gt;.  
Home page: https://www.gnutls.org

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2001-2023 Free Software Foundation, Inc., and others.  
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

# [SEE ALSO](#SEE_ALSO)

The full documentation for **gnutls** is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form visit

[https://www.gnutls.org/manual/](https://www.gnutls.org/manual/)

3.8.13 gnutls

---

Document: gnutls_dtls_cookie_send(3) from gnutls 3.8.13-r3 (Chainguard OS)
Source: https://gitlab.com/gnutls/gnutls
