dtls_record.c File Reference

DTLS record protocol. More...

#include "tls.h"
#include "tls_common.h"
#include "tls_record.h"
#include "tls_record_encryption.h"
#include "tls_record_decryption.h"
#include "tls_misc.h"
#include "dtls_misc.h"
#include "dtls_record.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t dtlsWriteProtocolData (TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType)
 Write protocol data. More...
 
error_t dtlsReadProtocolData (TlsContext *context, uint8_t **data, size_t *length, TlsContentType *contentType)
 Read protocol data. More...
 
error_t dtlsWriteRecord (TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType)
 Send a DTLS record. More...
 
error_t dtlsReadRecord (TlsContext *context)
 Receive a DTLS record. More...
 
error_t dtlsProcessRecord (TlsContext *context)
 Process incoming DTLS record. More...
 
error_t dtlsSendFlight (TlsContext *context)
 Send the buffered flight of messages. More...
 
error_t dtlsFragmentHandshakeMessage (TlsContext *context, uint16_t version, TlsEncryptionEngine *encryptionEngine, const DtlsHandshake *message)
 Handshake message fragmentation. More...
 
error_t dtlsReassembleHandshakeMessage (TlsContext *context, const DtlsHandshake *message)
 Handshake message reassembly algorithm. More...
 
error_t dtlsReadDatagram (TlsContext *context, uint8_t *data, size_t size, size_t *length)
 Receive a datagram. More...
 
error_t dtlsTick (TlsContext *context)
 Manage retransmission timer. More...
 
void dtlsIncSequenceNumber (DtlsSequenceNumber *seqNum)
 Increment sequence number. More...
 

Detailed Description

DTLS record protocol.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneSSL Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file dtls_record.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file dtls_record.c.

Function Documentation

◆ dtlsFragmentHandshakeMessage()

error_t dtlsFragmentHandshakeMessage ( TlsContext context,
uint16_t  version,
TlsEncryptionEngine encryptionEngine,
const DtlsHandshake message 
)

Handshake message fragmentation.

Parameters
[in]contextPointer to the TLS context
[in]versionDTLS version to be used
[in]encryptionEnginePointer to the encryption engine
[in]messagePointer the handshake message to be fragmented
Returns
Error code

Definition at line 892 of file dtls_record.c.

◆ dtlsIncSequenceNumber()

void dtlsIncSequenceNumber ( DtlsSequenceNumber seqNum)

Increment sequence number.

Parameters
[in,out]seqNumPointer to the 48-bit sequence number

Definition at line 1309 of file dtls_record.c.

◆ dtlsProcessRecord()

error_t dtlsProcessRecord ( TlsContext context)

Process incoming DTLS record.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 423 of file dtls_record.c.

◆ dtlsReadDatagram()

error_t dtlsReadDatagram ( TlsContext context,
uint8_t *  data,
size_t  size,
size_t *  length 
)

Receive a datagram.

Parameters
[in]contextPointer to the TLS context
[out]dataBuffer where to store the incoming datagram
[in]sizeMaximum number of bytes that can be received
[out]lengthNumber of bytes that have been received
Returns
Error code

Definition at line 1177 of file dtls_record.c.

◆ dtlsReadProtocolData()

error_t dtlsReadProtocolData ( TlsContext context,
uint8_t **  data,
size_t *  length,
TlsContentType contentType 
)

Read protocol data.

Parameters
[in]contextPointer to the TLS context
[out]dataPointer to the received data
[out]lengthNumber of data bytes that were received
[out]contentTypeHigher level protocol
Returns
Error code

Definition at line 130 of file dtls_record.c.

◆ dtlsReadRecord()

error_t dtlsReadRecord ( TlsContext context)

Receive a DTLS record.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 321 of file dtls_record.c.

◆ dtlsReassembleHandshakeMessage()

error_t dtlsReassembleHandshakeMessage ( TlsContext context,
const DtlsHandshake message 
)

Handshake message reassembly algorithm.

Parameters
[in]contextPointer to the TLS context
[in]messagePointer the newly arrived fragment
Returns
Error code

Definition at line 1037 of file dtls_record.c.

◆ dtlsSendFlight()

error_t dtlsSendFlight ( TlsContext context)

Send the buffered flight of messages.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 725 of file dtls_record.c.

◆ dtlsTick()

error_t dtlsTick ( TlsContext context)

Manage retransmission timer.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 1256 of file dtls_record.c.

◆ dtlsWriteProtocolData()

error_t dtlsWriteProtocolData ( TlsContext context,
const uint8_t *  data,
size_t  length,
TlsContentType  contentType 
)

Write protocol data.

Parameters
[in]contextPointer to the TLS context
[in]dataPointer to the data buffer
[in]lengthNumber of data bytes to be written
[in]contentTypeHigher level protocol
Returns
Error code

Definition at line 58 of file dtls_record.c.

◆ dtlsWriteRecord()

error_t dtlsWriteRecord ( TlsContext context,
const uint8_t *  data,
size_t  length,
TlsContentType  contentType 
)

Send a DTLS record.

Parameters
[in]contextPointer to the TLS context
[in]dataPointer to the record data
[in]lengthLength of the record data
[in]contentTypeRecord type
Returns
Error code

Definition at line 227 of file dtls_record.c.