ike_debug.h
Go to the documentation of this file.
1 /**
2  * @file ike_debug.h
3  * @brief Data logging functions for debugging purpose (IKEv2)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2022-2025 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneIPSEC 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.5.4
29  **/
30 
31 #ifndef _IKE_DEBUG_H
32 #define _IKE_DEBUG_H
33 
34 //Dependencies
35 #include "ike/ike.h"
36 #include "debug.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 
44 /**
45  * @brief Parameter value/name binding
46  **/
47 
48 typedef struct
49 {
51  const char_t *name;
52 } IkeParamName;
53 
54 
55 //IKEv2 related functions
56 #if (IKE_TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
57  void ikeDumpMessage(const uint8_t *message, size_t length);
58 #else
59  #define ikeDumpMessage(message, length)
60 #endif
61 
62 void ikeDumpHeader(const IkeHeader *header);
63 void ikeDumpFlags(uint8_t flags);
64 
65 void ikeDumpPayloads(const uint8_t *payloads, size_t length,
66  uint8_t nextPayload);
67 
68 void ikeDumpPayloadHeader(const IkePayloadHeader *header);
69 
70 void ikeDumpSaPayload(const IkeSaPayload *payload, size_t length);
71 
72 void ikeDumpKePayload(const IkeKePayload *payload, size_t length);
73 void ikeDumpProposal(const IkeProposal *proposal, size_t length);
74 void ikeDumpTransform(const IkeTransform *transform, size_t length);
75 
77  size_t *consumed);
78 
79 void ikeDumpIdPayload(const IkeIdPayload *payload, size_t length);
80 
81 void ikeDumpCertPayload(const IkeCertPayload *payload, size_t length);
82 
84 
85 void ikeDumpAuthPayload(const IkeAuthPayload *payload, size_t length);
86 
88 
90 
92 
93 void ikeDumpTsPayload(const IkeTsPayload *payload, size_t length);
94 void ikeDumpTs(const IkeTs *selector, size_t length);
95 
97 
99  size_t length);
100 
101 const char_t *ikeGetParamName(uint_t value, const IkeParamName *paramList,
102  size_t paramListLen);
103 
104 //C++ guard
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif
Parameter value/name binding.
Definition: ike_debug.h:49
void ikeDumpPayloadHeader(const IkePayloadHeader *header)
Dump generic payload header.
Definition: ike_debug.c:671
IkeCertReqPayload
Definition: ike.h:1547
void ikeDumpAuthPayload(const IkeAuthPayload *payload, size_t length)
Dump Authentication payload.
Definition: ike_debug.c:1186
void ikeDumpHeader(const IkeHeader *header)
Dump IKE header.
Definition: ike_debug.c:441
IkeKePayload
Definition: ike.h:1510
uint8_t message[]
Definition: chap.h:154
IkeNotifyPayload
Definition: ike.h:1596
IkePayloadHeader
Definition: ike.h:1441
void ikeDumpFlags(uint8_t flags)
Dump flags.
Definition: ike_debug.c:472
error_t ikeDumpTransformAttr(const IkeTransformAttr *attr, size_t length, size_t *consumed)
Dump transform attribute.
Definition: ike_debug.c:947
IkeTransform
Definition: ike.h:1485
void ikeDumpKePayload(const IkeKePayload *payload, size_t length)
Dump Key Exchange payload.
Definition: ike_debug.c:1024
void ikeDumpTransform(const IkeTransform *transform, size_t length)
Dump Transform substructure.
Definition: ike_debug.c:829
IkeAuthPayload
Definition: ike.h:1560
void ikeDumpCertPayload(const IkeCertPayload *payload, size_t length)
Dump Certificate payload.
Definition: ike_debug.c:1122
error_t
Error codes.
Definition: error.h:43
const char_t * ikeGetParamName(uint_t value, const IkeParamName *paramList, size_t paramListLen)
Convert a parameter to string representation.
Definition: ike_debug.c:1548
IkeIdPayload
Definition: ike.h:1523
void ikeDumpTsPayload(const IkeTsPayload *payload, size_t length)
Dump Traffic Selector payload.
Definition: ike_debug.c:1343
void ikeDumpDeletePayload(const IkeDeletePayload *payload, size_t length)
Dump Delete payload.
Definition: ike_debug.c:1301
IkeTsPayload
Definition: ike.h:1634
IkeTransformAttr
Definition: ike.h:1497
uint8_t length
Definition: tcp.h:375
void ikeDumpSaPayload(const IkeSaPayload *payload, size_t length)
Dump Security Association payload.
Definition: ike_debug.c:692
IkeHeader
Definition: ike.h:1423
IkeEncryptedPayload
Definition: ike.h:1660
void ikeDumpEncryptedPayload(const IkeEncryptedPayload *payload, size_t length)
Dump Encrypted payload.
Definition: ike_debug.c:1489
IkeDeletePayload
Definition: ike.h:1610
IKEv2 (Internet Key Exchange Protocol)
IkeTs
Definition: ike.h:1649
void ikeDumpTs(const IkeTs *selector, size_t length)
Dump Traffic Selector substructure.
Definition: ike_debug.c:1400
IkeProposal
Definition: ike.h:1469
char char_t
Definition: compiler_port.h:55
void ikeDumpNotifyPayload(const IkeNotifyPayload *payload, size_t length)
Dump Notify payload.
Definition: ike_debug.c:1241
void ikeDumpMessage(const uint8_t *message, size_t length)
Dump IKE message.
Definition: ike_debug.c:413
void ikeDumpIdPayload(const IkeIdPayload *payload, size_t length)
Dump Identification payload.
Definition: ike_debug.c:1061
void ikeDumpEncryptedFragPayload(const IkeEncryptedFragPayload *payload, size_t length)
Dump Encrypted Fragment payload.
Definition: ike_debug.c:1513
IkeCertPayload
Definition: ike.h:1535
uint8_t payload[]
Definition: ipv6.h:286
IkeEncryptedFragPayload
Definition: ike.h:1723
const char_t * name
Definition: ike_debug.h:51
uint8_t value[]
Definition: tcp.h:376
void ikeDumpPayloads(const uint8_t *payloads, size_t length, uint8_t nextPayload)
Dump IKE payloads.
Definition: ike_debug.c:545
uint8_t nextPayload
Definition: ike.h:1411
IkeNoncePayload
Definition: ike.h:1582
uint8_t flags
Definition: tcp.h:358
uint_t value
Definition: ike_debug.h:50
unsigned int uint_t
Definition: compiler_port.h:57
void ikeDumpProposal(const IkeProposal *proposal, size_t length)
Dump Proposal substructure.
Definition: ike_debug.c:741
void ikeDumpNoncePayload(const IkeNoncePayload *payload, size_t length)
Dump Nonce payload.
Definition: ike_debug.c:1218
void ikeDumpCertReqPayload(const IkeCertReqPayload *payload, size_t length)
Dump Certificate Request payload.
Definition: ike_debug.c:1154
Debugging facilities.
IkeSaPayload
Definition: ike.h:1452