Skip to content

Commit 926aceb

Browse files
committed
Proper indent file
1 parent 6fc1cf5 commit 926aceb

9 files changed

+138
-138
lines changed

Pcap++/src/KniDevice.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
// GCOVR_EXCL_START
22

3-
# define LOG_MODULE PcapLogModuleKniDevice
4-
5-
# include "KniDevice.h"
6-
# include "Logger.h"
7-
# include "SystemUtils.h"
8-
9-
# include <unistd.h>
10-
# include <time.h>
11-
# include <thread>
12-
# include <sys/ioctl.h>
13-
# include <net/if.h>
14-
# include <net/if_arp.h>
15-
16-
# include <rte_version.h>
17-
# include <rte_mempool.h>
18-
# include <rte_mbuf.h>
19-
# include <rte_lcore.h>
20-
# include <rte_kni.h>
21-
# include <rte_memory.h>
22-
# include <rte_branch_prediction.h>
23-
24-
# include <cerrno>
25-
# include <cstdio>
26-
# include <cstring>
27-
# include <algorithm>
28-
29-
# ifndef KNI_MEMPOOL_NAME_PREFIX
30-
# define KNI_MEMPOOL_NAME_PREFIX "kniMempool"
31-
# endif
32-
# ifndef MEMPOOL_CACHE_SIZE
33-
# define MEMPOOL_CACHE_SIZE 256
34-
# endif
35-
# ifndef MAX_BURST_SIZE
36-
# define MAX_BURST_SIZE 64
37-
# endif
38-
39-
# define CPP_VLA(TYPE, SIZE) (TYPE*)__builtin_alloca(sizeof(TYPE) * SIZE)
3+
#define LOG_MODULE PcapLogModuleKniDevice
4+
5+
#include "KniDevice.h"
6+
#include "Logger.h"
7+
#include "SystemUtils.h"
8+
9+
#include <unistd.h>
10+
#include <time.h>
11+
#include <thread>
12+
#include <sys/ioctl.h>
13+
#include <net/if.h>
14+
#include <net/if_arp.h>
15+
16+
#include <rte_version.h>
17+
#include <rte_mempool.h>
18+
#include <rte_mbuf.h>
19+
#include <rte_lcore.h>
20+
#include <rte_kni.h>
21+
#include <rte_memory.h>
22+
#include <rte_branch_prediction.h>
23+
24+
#include <cerrno>
25+
#include <cstdio>
26+
#include <cstring>
27+
#include <algorithm>
28+
29+
#ifndef KNI_MEMPOOL_NAME_PREFIX
30+
# define KNI_MEMPOOL_NAME_PREFIX "kniMempool"
31+
#endif
32+
#ifndef MEMPOOL_CACHE_SIZE
33+
# define MEMPOOL_CACHE_SIZE 256
34+
#endif
35+
#ifndef MAX_BURST_SIZE
36+
# define MAX_BURST_SIZE 64
37+
#endif
38+
39+
#define CPP_VLA(TYPE, SIZE) (TYPE*)__builtin_alloca(sizeof(TYPE) * SIZE)
4040

4141
namespace pcpp
4242
{
@@ -117,17 +117,17 @@ namespace pcpp
117117
{
118118
return oldState = KniDevice::LINK_ERROR;
119119
}
120-
# if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
120+
#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
121121
oldState = (KniDevice::KniLinkState)rte_kni_update_link(kni, state);
122122
if (oldState == KniDevice::LINK_ERROR)
123123
{ //? NOTE(echo-Mike): Not LOG_ERROR because will generate a lot of junk messages on some DPDK versions
124124
PCPP_LOG_DEBUG("DPDK KNI Failed to update links state for device '" << deviceName << "'");
125125
}
126-
# else
126+
#else
127127
// To avoid compiler warnings
128128
(void)kni;
129129
(void)deviceName;
130-
# endif
130+
#endif
131131
return oldState;
132132
}
133133

@@ -173,30 +173,30 @@ namespace pcpp
173173
kniConf.core_id = conf.kthreadCoreId;
174174
kniConf.mbuf_size = RTE_MBUF_DEFAULT_BUF_SIZE;
175175
kniConf.force_bind = conf.bindKthread ? 1 : 0;
176-
# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0)
176+
#if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0)
177177
if (conf.mac != MacAddress::Zero)
178178
conf.mac.copyTo((uint8_t*)kniConf.mac_addr);
179179
kniConf.mtu = conf.mtu;
180-
# endif
180+
#endif
181181

182182
kniOps.port_id = conf.portId;
183-
# if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0)
183+
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0)
184184
if (conf.callbacks != nullptr)
185185
{
186186
kniOps.change_mtu = conf.callbacks->change_mtu;
187187
kniOps.config_network_if = conf.callbacks->config_network_if;
188-
# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0)
188+
# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0)
189189
kniOps.config_mac_address = conf.callbacks->config_mac_address;
190190
kniOps.config_promiscusity = conf.callbacks->config_promiscusity;
191-
# endif
191+
# endif
192192
}
193-
# else
193+
#else
194194
if (conf.oldCallbacks != nullptr)
195195
{
196196
kniOps.change_mtu = conf.oldCallbacks->change_mtu;
197197
kniOps.config_network_if = conf.oldCallbacks->config_network_if;
198198
}
199-
# endif
199+
#endif
200200

201201
m_Device = rte_kni_alloc(m_MBufMempool, &kniConf, &kniOps);
202202
if (m_Device == nullptr)

Pcap++/src/KniDeviceList.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// GCOVR_EXCL_START
22

3-
# define LOG_MODULE PcapLogModuleKniDevice
3+
#define LOG_MODULE PcapLogModuleKniDevice
44

5-
# include <inttypes.h>
6-
# include <algorithm>
5+
#include <inttypes.h>
6+
#include <algorithm>
77

8-
# include "KniDeviceList.h"
9-
# include "Logger.h"
10-
# include "SystemUtils.h"
8+
#include "KniDeviceList.h"
9+
#include "Logger.h"
10+
#include "SystemUtils.h"
1111

12-
# include <rte_version.h>
13-
# include <rte_kni.h>
12+
#include <rte_version.h>
13+
#include <rte_kni.h>
1414

15-
# ifndef MAX_KNI_DEVICES
15+
#ifndef MAX_KNI_DEVICES
1616
// This value have no meaning in current DPDK implementation (ver >= 18.11)
1717
// In older versions have literal meaning
18-
# define MAX_KNI_DEVICES 4
19-
# endif
18+
# define MAX_KNI_DEVICES 4
19+
#endif
2020

2121
namespace pcpp
2222
{
@@ -52,15 +52,15 @@ namespace pcpp
5252
m_Initialized = false;
5353
return;
5454
}
55-
# if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
55+
#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
5656
if (rte_kni_init(MAX_KNI_DEVICES) < 0)
5757
{
5858
PCPP_LOG_ERROR("Failed to initialize DPDK KNI module");
5959
m_Initialized = false;
6060
}
61-
# else
61+
#else
6262
rte_kni_init(MAX_KNI_DEVICES);
63-
# endif
63+
#endif
6464
}
6565

6666
KniDeviceList::~KniDeviceList()
@@ -141,11 +141,11 @@ namespace pcpp
141141

142142
KniDeviceList::KniCallbackVersion KniDeviceList::callbackVersion()
143143
{
144-
# if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0)
144+
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0)
145145
return KniDeviceList::CALLBACKS_NEW;
146-
# else
146+
#else
147147
return KniDeviceList::CALLBACKS_OLD;
148-
# endif
148+
#endif
149149
}
150150

151151
bool KniDeviceList::isCallbackSupported(const KniCallbackType cbType)
@@ -159,11 +159,11 @@ namespace pcpp
159159
case KniDeviceList::CALLBACK_MAC:
160160
/* fall through */
161161
case KniDeviceList::CALLBACK_PROMISC:
162-
# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0)
162+
#if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0)
163163
return true;
164-
# else
164+
#else
165165
return false;
166-
# endif
166+
#endif
167167
}
168168
return false;
169169
}

Pcap++/src/LinuxNicInformationSocket.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# define LOG_MODULE UndefinedLogModule
1+
#define LOG_MODULE UndefinedLogModule
22

3-
# include "Logger.h"
4-
# include "LinuxNicInformationSocket.h"
3+
#include "Logger.h"
4+
#include "LinuxNicInformationSocket.h"
55

6-
# include <sys/types.h>
7-
# include <unistd.h>
8-
# include <sys/socket.h>
9-
# include <sys/ioctl.h>
10-
# include <net/if.h>
6+
#include <sys/types.h>
7+
#include <unistd.h>
8+
#include <sys/socket.h>
9+
#include <sys/ioctl.h>
10+
#include <net/if.h>
1111

12-
# include <cerrno>
13-
# include <cstdio>
14-
# include <cstring>
12+
#include <cerrno>
13+
#include <cstdio>
14+
#include <cstring>
1515

16-
# define INVALID_SOCKET_VALUE (-1)
16+
#define INVALID_SOCKET_VALUE (-1)
1717

1818
namespace pcpp
1919
{

Pcap++/src/MBufRawPacket.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
// GCOVR_EXCL_START
22

3-
# define LOG_MODULE PcapLogModuleMBufRawPacket
3+
#define LOG_MODULE PcapLogModuleMBufRawPacket
44

5-
# define __STDC_LIMIT_MACROS
6-
# define __STDC_FORMAT_MACROS
5+
#define __STDC_LIMIT_MACROS
6+
#define __STDC_FORMAT_MACROS
77

8-
# include "rte_mbuf.h"
9-
# include "rte_mempool.h"
10-
# include "rte_errno.h"
8+
#include "rte_mbuf.h"
9+
#include "rte_mempool.h"
10+
#include "rte_errno.h"
1111

12-
# include "MBufRawPacket.h"
13-
# include "Logger.h"
14-
# include "DpdkDevice.h"
15-
# ifdef USE_DPDK_KNI
16-
# include "KniDevice.h"
17-
# endif
12+
#include "MBufRawPacket.h"
13+
#include "Logger.h"
14+
#include "DpdkDevice.h"
15+
#ifdef USE_DPDK_KNI
16+
# include "KniDevice.h"
17+
#endif
1818

19-
# include <string>
20-
# include <stdint.h>
21-
# include <unistd.h>
19+
#include <string>
20+
#include <stdint.h>
21+
#include <unistd.h>
2222

2323
namespace pcpp
2424
{
@@ -68,12 +68,12 @@ namespace pcpp
6868
return init(device->m_MBufMempool);
6969
}
7070

71-
# ifdef USE_DPDK_KNI
71+
#ifdef USE_DPDK_KNI
7272
bool MBufRawPacket::init(KniDevice* device)
7373
{
7474
return init(device->m_MBufMempool);
7575
}
76-
# endif
76+
#endif
7777

7878
bool MBufRawPacket::initFromRawPacket(const RawPacket* rawPacket, struct rte_mempool* mempool)
7979
{
@@ -102,12 +102,12 @@ namespace pcpp
102102
return initFromRawPacket(rawPacket, device->m_MBufMempool);
103103
}
104104

105-
# ifdef USE_DPDK_KNI
105+
#ifdef USE_DPDK_KNI
106106
bool MBufRawPacket::initFromRawPacket(const RawPacket* rawPacket, KniDevice* device)
107107
{
108108
return initFromRawPacket(rawPacket, device->m_MBufMempool);
109109
}
110-
# endif
110+
#endif
111111

112112
MBufRawPacket::MBufRawPacket(const MBufRawPacket& other)
113113
{

Pcap++/src/PcapRemoteDevice.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# define LOG_MODULE PcapLogModuleRemoteDevice
1+
#define LOG_MODULE PcapLogModuleRemoteDevice
22

3-
# include "PcapRemoteDevice.h"
4-
# include "Logger.h"
5-
# include "pcap.h"
3+
#include "PcapRemoteDevice.h"
4+
#include "Logger.h"
5+
#include "pcap.h"
66

77
namespace pcpp
88
{

Pcap++/src/PcapRemoteDeviceList.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# define LOG_MODULE PcapLogModuleRemoteDevice
2-
3-
# include "PcapRemoteDeviceList.h"
4-
# include "Logger.h"
5-
# include "IpUtils.h"
6-
# include "PcapUtils.h"
7-
# include "IpAddressUtils.h"
8-
# include "pcap.h"
9-
# include <array>
10-
# include <ws2tcpip.h>
1+
#define LOG_MODULE PcapLogModuleRemoteDevice
2+
3+
#include "PcapRemoteDeviceList.h"
4+
#include "Logger.h"
5+
#include "IpUtils.h"
6+
#include "PcapUtils.h"
7+
#include "IpAddressUtils.h"
8+
#include "pcap.h"
9+
#include <array>
10+
#include <ws2tcpip.h>
1111

1212
namespace pcpp
1313
{

Pcap++/src/PfRingDevice.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// GCOVR_EXCL_START
22

3-
# define LOG_MODULE PcapLogModulePfRingDevice
3+
#define LOG_MODULE PcapLogModulePfRingDevice
44

5-
# include "PfRingDevice.h"
6-
# include "EthLayer.h"
7-
# include "VlanLayer.h"
8-
# include "Logger.h"
9-
# include <errno.h>
10-
# include <pfring.h>
11-
# include <pthread.h>
12-
# include <chrono>
5+
#include "PfRingDevice.h"
6+
#include "EthLayer.h"
7+
#include "VlanLayer.h"
8+
#include "Logger.h"
9+
#include <errno.h>
10+
#include <pfring.h>
11+
#include <pthread.h>
12+
#include <chrono>
1313

14-
# define DEFAULT_PF_RING_SNAPLEN 1600
14+
#define DEFAULT_PF_RING_SNAPLEN 1600
1515

1616
namespace pcpp
1717
{
@@ -758,7 +758,7 @@ namespace pcpp
758758

759759
uint8_t flushTxAsUint = (flushTxQueues ? 1 : 0);
760760

761-
# define MAX_TRIES 5
761+
#define MAX_TRIES 5
762762

763763
int tries = 0;
764764
int res = 0;

0 commit comments

Comments
 (0)