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-2024 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.4.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:637
IkeCertReqPayload
Definition: ike.h:1390
void ikeDumpAuthPayload(const IkeAuthPayload *payload, size_t length)
Dump Authentication payload.
Definition: ike_debug.c:1152
void ikeDumpHeader(const IkeHeader *header)
Dump IKE header.
Definition: ike_debug.c:407
IkeKePayload
Definition: ike.h:1353
uint8_t message[]
Definition: chap.h:154
IkeNotifyPayload
Definition: ike.h:1439
IkePayloadHeader
Definition: ike.h:1284
void ikeDumpFlags(uint8_t flags)
Dump flags.
Definition: ike_debug.c:438
error_t ikeDumpTransformAttr(const IkeTransformAttr *attr, size_t length, size_t *consumed)
Dump transform attribute.
Definition: ike_debug.c:913
IkeTransform
Definition: ike.h:1328
void ikeDumpKePayload(const IkeKePayload *payload, size_t length)
Dump Key Exchange payload.
Definition: ike_debug.c:990
void ikeDumpTransform(const IkeTransform *transform, size_t length)
Dump Transform substructure.
Definition: ike_debug.c:795
IkeAuthPayload
Definition: ike.h:1403
void ikeDumpCertPayload(const IkeCertPayload *payload, size_t length)
Dump Certificate payload.
Definition: ike_debug.c:1088
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:1514
IkeIdPayload
Definition: ike.h:1366
void ikeDumpTsPayload(const IkeTsPayload *payload, size_t length)
Dump Traffic Selector payload.
Definition: ike_debug.c:1309
void ikeDumpDeletePayload(const IkeDeletePayload *payload, size_t length)
Dump Delete payload.
Definition: ike_debug.c:1267
IkeTsPayload
Definition: ike.h:1477
IkeTransformAttr
Definition: ike.h:1340
uint8_t length
Definition: tcp.h:368
void ikeDumpSaPayload(const IkeSaPayload *payload, size_t length)
Dump Security Association payload.
Definition: ike_debug.c:658
IkeHeader
Definition: ike.h:1266
IkeEncryptedPayload
Definition: ike.h:1503
void ikeDumpEncryptedPayload(const IkeEncryptedPayload *payload, size_t length)
Dump Encrypted payload.
Definition: ike_debug.c:1455
IkeDeletePayload
Definition: ike.h:1453
IKEv2 (Internet Key Exchange Protocol)
IkeTs
Definition: ike.h:1492
void ikeDumpTs(const IkeTs *selector, size_t length)
Dump Traffic Selector substructure.
Definition: ike_debug.c:1366
uint8_t flags
Definition: tcp.h:351
IkeProposal
Definition: ike.h:1312
char char_t
Definition: compiler_port.h:48
void ikeDumpNotifyPayload(const IkeNotifyPayload *payload, size_t length)
Dump Notify payload.
Definition: ike_debug.c:1207
void ikeDumpMessage(const uint8_t *message, size_t length)
Dump IKE message.
Definition: ike_debug.c:379
void ikeDumpIdPayload(const IkeIdPayload *payload, size_t length)
Dump Identification payload.
Definition: ike_debug.c:1027
void ikeDumpEncryptedFragPayload(const IkeEncryptedFragPayload *payload, size_t length)
Dump Encrypted Fragment payload.
Definition: ike_debug.c:1479
IkeCertPayload
Definition: ike.h:1378
uint8_t payload[]
Definition: ipv6.h:286
IkeEncryptedFragPayload
Definition: ike.h:1566
const char_t * name
Definition: ike_debug.h:51
uint8_t value[]
Definition: tcp.h:369
void ikeDumpPayloads(const uint8_t *payloads, size_t length, uint8_t nextPayload)
Dump IKE payloads.
Definition: ike_debug.c:511
uint8_t nextPayload
Definition: ike.h:1254
IkeNoncePayload
Definition: ike.h:1425
uint_t value
Definition: ike_debug.h:50
unsigned int uint_t
Definition: compiler_port.h:50
void ikeDumpProposal(const IkeProposal *proposal, size_t length)
Dump Proposal substructure.
Definition: ike_debug.c:707
void ikeDumpNoncePayload(const IkeNoncePayload *payload, size_t length)
Dump Nonce payload.
Definition: ike_debug.c:1184
void ikeDumpCertReqPayload(const IkeCertReqPayload *payload, size_t length)
Dump Certificate Request payload.
Definition: ike_debug.c:1120
Debugging facilities.
IkeSaPayload
Definition: ike.h:1295