nts_debug.c File Reference

Data logging functions for debugging purpose (NTS) More...

#include "core/net.h"
#include "nts/nts_debug.h"
#include "aead/aead_algorithms.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NTS_TRACE_LEVEL
 

Functions

void ntsDumpNtsKeRecords (const uint8_t *records, size_t length)
 Dump NTS-KE records. More...
 
void ntsDumpNtsKeRecord (const NtsKeRecord *record, size_t length)
 Dump NTS-KE record. More...
 
void ntsDumpNtsNextProtoNegoRecord (const uint8_t *body, size_t length)
 Dump NTS Next Protocol Negotiation record. More...
 
void ntsDumpErrorRecord (const uint8_t *body, size_t length)
 Dump Error record. More...
 
void ntsDumpWarningRecord (const uint8_t *body, size_t length)
 Dump Warning record. More...
 
void ntsDumpAeadAlgoNegoRecord (const uint8_t *body, size_t length)
 Dump AEAD Algorithm Negotiation record. More...
 
void ntsDumpNtpv4ServerNegoRecord (const uint8_t *body, size_t length)
 Dump NTPv4 Server Negotiation record. More...
 
void ntsDumpNtpv4PortNegoRecord (const uint8_t *body, size_t length)
 Dump NTPv4 Port Negotiation record. More...
 
const char_tntsGetParamName (uint_t value, const NtsParamName *paramList, size_t paramListLen)
 Convert a parameter to string representation. More...
 

Variables

const NtsParamName ntsKeRecordTypeList []
 
const NtsParamName ntsProtocolIdList []
 
const NtsParamName ntsAeadAlgoList []
 
const NtsParamName ntsErrorCodeList []
 

Detailed Description

Data logging functions for debugging purpose (NTS)

License

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

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

This file is part of CycloneTCP 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 nts_debug.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NTS_TRACE_LEVEL

Definition at line 32 of file nts_debug.c.

Function Documentation

◆ ntsDumpAeadAlgoNegoRecord()

void ntsDumpAeadAlgoNegoRecord ( const uint8_t *  body,
size_t  length 
)

Dump AEAD Algorithm Negotiation record.

Parameters
[in]bodyPointer to the record body
[in]lengthLength of the record body, in bytes

Definition at line 286 of file nts_debug.c.

◆ ntsDumpErrorRecord()

void ntsDumpErrorRecord ( const uint8_t *  body,
size_t  length 
)

Dump Error record.

Parameters
[in]bodyPointer to the record body
[in]lengthLength of the record body, in bytes

Definition at line 233 of file nts_debug.c.

◆ ntsDumpNtpv4PortNegoRecord()

void ntsDumpNtpv4PortNegoRecord ( const uint8_t *  body,
size_t  length 
)

Dump NTPv4 Port Negotiation record.

Parameters
[in]bodyPointer to the record body
[in]lengthLength of the record body, in bytes

Definition at line 341 of file nts_debug.c.

◆ ntsDumpNtpv4ServerNegoRecord()

void ntsDumpNtpv4ServerNegoRecord ( const uint8_t *  body,
size_t  length 
)

Dump NTPv4 Server Negotiation record.

Parameters
[in]bodyPointer to the record body
[in]lengthLength of the record body, in bytes

Definition at line 315 of file nts_debug.c.

◆ ntsDumpNtsKeRecord()

void ntsDumpNtsKeRecord ( const NtsKeRecord record,
size_t  length 
)

Dump NTS-KE record.

Parameters
[in]recordPointer to the record
[in]lengthLength of the record, in bytes

Definition at line 121 of file nts_debug.c.

◆ ntsDumpNtsKeRecords()

void ntsDumpNtsKeRecords ( const uint8_t *  records,
size_t  length 
)

Dump NTS-KE records.

Parameters
[in]recordsPointer to the records
[in]lengthTotal length of the records, in bytes

Definition at line 83 of file nts_debug.c.

◆ ntsDumpNtsNextProtoNegoRecord()

void ntsDumpNtsNextProtoNegoRecord ( const uint8_t *  body,
size_t  length 
)

Dump NTS Next Protocol Negotiation record.

Parameters
[in]bodyPointer to the record body
[in]lengthLength of the record body, in bytes

Definition at line 204 of file nts_debug.c.

◆ ntsDumpWarningRecord()

void ntsDumpWarningRecord ( const uint8_t *  body,
size_t  length 
)

Dump Warning record.

Parameters
[in]bodyPointer to the record body
[in]lengthLength of the record body, in bytes

Definition at line 262 of file nts_debug.c.

◆ ntsGetParamName()

const char_t* ntsGetParamName ( uint_t  value,
const NtsParamName paramList,
size_t  paramListLen 
)

Convert a parameter to string representation.

Parameters
[in]valueParameter value
[in]paramListList of acceptable parameters
[in]paramListLenNumber of entries in the list
Returns
NULL-terminated string describing the parameter

Definition at line 366 of file nts_debug.c.

Variable Documentation

◆ ntsAeadAlgoList

const NtsParamName ntsAeadAlgoList[]
Initial value:
=
{
{AEAD_AES_SIV_CMAC_256, "AEAD_AES_SIV_CMAC_256"}
}

Definition at line 63 of file nts_debug.c.

◆ ntsErrorCodeList

const NtsParamName ntsErrorCodeList[]
Initial value:
=
{
{NTS_ERROR_CODE_UNRECOGNIZED_CRITICAL_RECORD, "Unrecognized Critical Record"},
{NTS_ERROR_CODE_BAD_REQUEST, "Bad Request"},
{NTS_ERROR_CODE_INTERNAL_SERVER_ERROR, "Internal Server Error"}
}

Definition at line 69 of file nts_debug.c.

◆ ntsKeRecordTypeList

const NtsParamName ntsKeRecordTypeList[]
Initial value:
=
{
{NTS_KE_RECORD_TYPE_END_OF_MESSAGE, "End of Message"},
{NTS_KE_RECORD_TYPE_NTS_NEXT_PROTO_NEGO, "NTS Next Protocol Negotiation"},
{NTS_KE_RECORD_TYPE_AEAD_ALGO_NEGO, "AEAD Algorithm Negotiation"},
{NTS_KE_RECORD_TYPE_NEW_COOKIE_FOR_NTPV4, "New Cookie for NTPv4"},
{NTS_KE_RECORD_TYPE_NTPV4_SERVER_NEGO, "NTPv4 Server Negotiation"},
{NTS_KE_RECORD_TYPE_NTPV4_PORT_NEGO, "NTPv4 Port Negotiation"}
}

Definition at line 44 of file nts_debug.c.

◆ ntsProtocolIdList

const NtsParamName ntsProtocolIdList[]
Initial value:
=
{
}

Definition at line 57 of file nts_debug.c.

@ NTS_KE_RECORD_TYPE_NTPV4_SERVER_NEGO
NTPv4 Server Negotiation.
Definition: nts_common.h:63
@ NTS_KE_RECORD_TYPE_END_OF_MESSAGE
End of Message.
Definition: nts_common.h:57
@ NTS_ERROR_CODE_INTERNAL_SERVER_ERROR
Internal Server Error.
Definition: nts_common.h:86
@ NTS_KE_RECORD_TYPE_NTS_NEXT_PROTO_NEGO
NTS Next Protocol Negotiation.
Definition: nts_common.h:58
@ AEAD_AES_SIV_CMAC_256
RFC 5297.
@ NTS_ERROR_CODE_UNRECOGNIZED_CRITICAL_RECORD
Unrecognized Critical Record.
Definition: nts_common.h:84
@ NTS_KE_RECORD_TYPE_NEW_COOKIE_FOR_NTPV4
New Cookie for NTPv4.
Definition: nts_common.h:62
@ NTS_KE_RECORD_TYPE_AEAD_ALGO_NEGO
AEAD Algorithm Negotiation.
Definition: nts_common.h:61
@ NTS_PROTOCOL_ID_NTPV4
Network Time Protocol version 4 (NTPv4)
Definition: nts_common.h:74
@ NTS_KE_RECORD_TYPE_ERROR
Error.
Definition: nts_common.h:59
@ NTS_ERROR_CODE_BAD_REQUEST
Bad Request.
Definition: nts_common.h:85
@ NTS_KE_RECORD_TYPE_WARNING
Warning.
Definition: nts_common.h:60
@ NTS_KE_RECORD_TYPE_NTPV4_PORT_NEGO
NTPv4 Port Negotiation.
Definition: nts_common.h:64