dtls_record.h
Go to the documentation of this file.
1 /**
2  * @file dtls_record.h
3  * @brief DTLS record protocol
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSL Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _DTLS_RECORD_H
32 #define _DTLS_RECORD_H
33 
34 //Dependencies
35 #include "tls.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //DTLS related functions
44  const uint8_t *data, size_t length, TlsContentType contentType);
45 
47  uint8_t **data, size_t *length, TlsContentType *contentType);
48 
49 error_t dtlsWriteRecord(TlsContext *context, const uint8_t *data,
50  size_t length, TlsContentType contentType);
51 
54 
56 
58  TlsEncryptionEngine *encryptionEngine, const DtlsHandshake *message);
59 
61  const DtlsHandshake *message);
62 
63 error_t dtlsReadDatagram(TlsContext *context, uint8_t *data,
64  size_t size, size_t *length);
65 
66 error_t dtlsTick(TlsContext *context);
67 
69 
70 //C++ guard
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif
error_t dtlsFragmentHandshakeMessage(TlsContext *context, uint16_t version, TlsEncryptionEngine *encryptionEngine, const DtlsHandshake *message)
Handshake message fragmentation.
Definition: dtls_record.c:892
error_t dtlsProcessRecord(TlsContext *context)
Process incoming DTLS record.
Definition: dtls_record.c:423
error_t dtlsWriteProtocolData(TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType)
Write protocol data.
Definition: dtls_record.c:58
uint8_t message[]
Definition: chap.h:154
uint8_t data[]
Definition: ethernet.h:222
error_t dtlsSendFlight(TlsContext *context)
Send the buffered flight of messages.
Definition: dtls_record.c:725
error_t dtlsReadRecord(TlsContext *context)
Receive a DTLS record.
Definition: dtls_record.c:321
error_t dtlsReassembleHandshakeMessage(TlsContext *context, const DtlsHandshake *message)
Handshake message reassembly algorithm.
Definition: dtls_record.c:1037
uint8_t version
Definition: coap_common.h:177
error_t dtlsReadProtocolData(TlsContext *context, uint8_t **data, size_t *length, TlsContentType *contentType)
Read protocol data.
Definition: dtls_record.c:130
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:43
uint32_t seqNum
Definition: tcp.h:341
error_t dtlsReadDatagram(TlsContext *context, uint8_t *data, size_t size, size_t *length)
Receive a datagram.
Definition: dtls_record.c:1177
error_t dtlsTick(TlsContext *context)
Manage retransmission timer.
Definition: dtls_record.c:1256
uint8_t length
Definition: tcp.h:368
void dtlsIncSequenceNumber(DtlsSequenceNumber *seqNum)
Increment sequence number.
Definition: dtls_record.c:1309
TlsContentType
Content type.
Definition: tls.h:1022
DtlsHandshake
Definition: dtls_misc.h:195
DtlsSequenceNumber
Definition: dtls_misc.h:143
TLS (Transport Layer Security)
error_t dtlsWriteRecord(TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType)
Send a DTLS record.
Definition: dtls_record.c:227
#define TlsEncryptionEngine
Definition: tls.h:40