/* HelloVerifyRequest DOS prevention cookie */
opaque cookie[DTLS_MAX_COOKIE_SIZE];
uint8_t cookie_len;
+ gnutls_dtls_flags_t flags;
} dtls_st;
return 0;
}
+/**
+ * gnutls_init_dtls - initialize the session like gnutls_init, but
+ * with a DTLS compatible transport.
+ * @con_end: indicate if this session is to be used for server or client.
+ * @session: is a pointer to a #gnutls_session_t structure.
+ * @flags: dtls flags for optional behavior.
+ *
+ * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
+ **/
+int
+gnutls_init_dtls (gnutls_session_t * session,
+ gnutls_connection_end_t con_end,
+ gnutls_dtls_flags_t flags)
+{
+ int ret;
+
+ /* FIXME, we should inhibit the allocation of many buffers that are
+ useless with datagram transport. */
+ ret = gnutls_init(session, con_end);
+
+ if(ret != 0)
+ return ret;
+
+ /* Flags do nothing, so just copy them into the struct for now. */
+ (*session)->internals.dtls.flags = flags;
+ (*session)->internals.transport = GNUTLS_DGRAM;
+
+ return 0;
+}
+
/* returns RESUME_FALSE or RESUME_TRUE.
*/
int
*
* Enumeration of different TLS alert severities.
*/
+ typedef enum
+ {
+ /* Nothing for now. There will be flags for transport-dependent
+ behavior (DCCP, SCTP) here in the future. */
+ GNUTLS_DTLS_DUMMY = 0
+ } gnutls_dtls_flags_t;
+
typedef enum
{
GNUTLS_AL_WARNING = 1,
int gnutls_init (gnutls_session_t * session,
gnutls_connection_end_t con_end);
+ int gnutls_init_dtls (gnutls_session_t * session,
+ gnutls_connection_end_t con_end,
+ gnutls_dtls_flags_t flags);
void gnutls_deinit (gnutls_session_t session);
#define _gnutls_deinit(x) gnutls_deinit(x)