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-2019 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 1.9.6
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
uint8_t length
Definition: dtls_misc.h:149
error_t dtlsFragmentHandshakeMessage(TlsContext *context, uint16_t version, TlsEncryptionEngine *encryptionEngine, const DtlsHandshake *message)
Handshake message fragmentation.
Definition: dtls_record.c:874
error_t dtlsProcessRecord(TlsContext *context)
Process incoming DTLS record.
Definition: dtls_record.c:425
error_t dtlsWriteProtocolData(TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType)
Write protocol data.
Definition: dtls_record.c:60
__start_packed struct @59 DtlsHandshake
DTLS handshake message.
uint16_t version
Definition: dtls_misc.h:172
error_t dtlsSendFlight(TlsContext *context)
Send the buffered flight of messages.
Definition: dtls_record.c:713
error_t dtlsReadRecord(TlsContext *context)
Receive a DTLS record.
Definition: dtls_record.c:323
error_t dtlsReassembleHandshakeMessage(TlsContext *context, const DtlsHandshake *message)
Handshake message reassembly algorithm.
Definition: dtls_record.c:1018
error_t dtlsReadProtocolData(TlsContext *context, uint8_t **data, size_t *length, TlsContentType *contentType)
Read protocol data.
Definition: dtls_record.c:132
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:42
error_t dtlsReadDatagram(TlsContext *context, uint8_t *data, size_t size, size_t *length)
Receive a datagram.
Definition: dtls_record.c:1158
error_t dtlsTick(TlsContext *context)
Manage retransmission timer.
Definition: dtls_record.c:1237
__start_packed struct @55 DtlsSequenceNumber
Sequence number.
Encryption engine.
Definition: tls.h:1942
void dtlsIncSequenceNumber(DtlsSequenceNumber *seqNum)
Increment sequence number.
Definition: dtls_record.c:1290
TlsContentType
Content type.
Definition: tls.h:914
uint8_t message[]
Definition: chap.h:152
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:229
DtlsSequenceNumber seqNum
Definition: dtls_misc.h:174
uint8_t data[]
Definition: dtls_misc.h:176