Skip to content

Commit 72e52fb

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
++
1 parent 68f39bc commit 72e52fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+280
-205
lines changed

src/plugins/process/basicPlus/src/basicPlus.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static const PluginManifest basicPlusPluginManifest = {
3232
.apiVersion = "1.0.0",
3333
.usage =
3434
[]() {
35+
std::cout << "Extend basic fields with TTL, TCP window, options, MSS and SYN size" << std::endl;
3536
/*OptionsParser parser(
3637
"basicplus",
3738
"Extend basic fields with TTL, TCP window, options, MSS and SYN size");

src/plugins/process/bstats/src/burstStats.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ PluginInitResult BurstStatsPlugin::onInit(const FlowContext& flowContext, void*
8888
auto* pluginData = std::construct_at(reinterpret_cast<BurstStatsData*>(pluginContext));
8989

9090
std::optional<Burst> burst = pluginData->push(Direction::Forward);
91-
updateBursts(*burst, flowContext.flowRecord, flowContext.packet);
91+
updateBursts(*burst, flowContext.packet);
9292

9393
return {
9494
.constructionState = ConstructionState::Constructed,
@@ -97,8 +97,7 @@ PluginInitResult BurstStatsPlugin::onInit(const FlowContext& flowContext, void*
9797
};
9898
}
9999

100-
void BurstStatsPlugin::updateBursts(Burst& burst, FlowRecord& flowRecord,
101-
const Packet& packet) noexcept
100+
void BurstStatsPlugin::updateBursts(Burst& burst, const Packet& packet) noexcept
102101
{
103102
burst.packets++;
104103
burst.bytes += packet.ip_payload_len;
@@ -123,15 +122,15 @@ PluginUpdateResult BurstStatsPlugin::onUpdate(const FlowContext& flowContext, vo
123122
};
124123
}
125124

126-
updateBursts(*burst, flowContext.flowRecord, flowContext.packet);
125+
updateBursts(*burst, flowContext.packet);
127126

128127
return {
129128
.updateRequirement = UpdateRequirement::RequiresUpdate,
130129
.flowAction = FlowAction::NoAction,
131130
};
132131
}
133132

134-
PluginExportResult BurstStatsPlugin::onExport(const FlowRecord& flowRecord, void* pluginContext)
133+
PluginExportResult BurstStatsPlugin::onExport(const FlowRecord& flowRecord, [[maybe_unused]] void* pluginContext)
135134
{
136135
const uint32_t packetsTotal
137136
= static_cast<uint32_t>(

src/plugins/process/bstats/src/burstStats.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class BurstStatsPlugin : public ProcessPlugin {
9191
private:
9292
constexpr static std::size_t MINIMAL_PACKETS_COUNT = 3; ///< Minimal number of packets to consider the flow valid.
9393

94-
void updateBursts(Burst& burst, FlowRecord& flowRecord, const Packet& packet) noexcept;
94+
void updateBursts(Burst& burst, const Packet& packet) noexcept;
9595
void makeAllFieldsUnavailable(FlowRecord& flowRecord) noexcept;
9696

9797
FieldHandlers<BurstStatsFields> m_fieldHandlers;

src/plugins/process/common/dnsParser/dnsName.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ constexpr static std::size_t calculateElementsLength(auto&& container) noexcept
3838
});
3939
}
4040

41-
constexpr
4241
std::optional<DNSName> DNSName::createFrom(
4342
std::span<const std::byte> payload,
4443
std::span<const std::byte> fullDNSpayload) noexcept

src/plugins/process/common/dnsParser/dnsName.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace ipxp
1717
class DNSName {
1818
public:
1919

20-
constexpr static
20+
static
2121
std::optional<DNSName> createFrom(
2222
std::span<const std::byte> payload,
2323
std::span<const std::byte> fullDNSpayload) noexcept;
@@ -34,7 +34,7 @@ class DNSName {
3434
* @return Length of DNS name excluding length of data pointed by DNS pointer
3535
* i.e after that count of bytes there is DNS question type field
3636
*/
37-
constexpr std::size_t length() const noexcept;
37+
std::size_t length() const noexcept;
3838

3939
bool operator==(const DNSName& other) const noexcept;
4040

src/plugins/process/common/dnsParser/dnsParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ std::optional<DNSHeader> parseHeader(std::span<const std::byte> payload) noexcep
7777
return *reinterpret_cast<const DNSHeader*>(payload.data());
7878
}
7979

80-
constexpr bool DNSParser::parse(
80+
bool DNSParser::parse(
8181
std::span<const std::byte> payload, const bool isDNSOverTCP,
8282
const std::function<bool(const DNSQuestion& query)>& queryCallback,
8383
const std::function<bool(const DNSRecord& answer)>& answerCallback,

src/plugins/process/common/dnsParser/dnsParser.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ namespace ipxp {
2727
* @brief DNS parser class
2828
*/
2929
class DNSParser {
30-
30+
constexpr static auto EMPTY_QUERY_CALLBACK = [](const DNSQuestion&) { return true; };
31+
constexpr static auto EMPTY_RECORD_CALLBACK = [](const DNSRecord&) { return true; };
3132
public:
3233
/**
3334
* @brief Parse given DNS packet
3435
* @param dnsData DNS packet data
3536
* @param isDnsOverTCP Flag indicating if the DNS packet is over TCP
3637
* @return True of parsed successfully, false otherwise
3738
*/
38-
constexpr bool parse(
39-
std::span<const std::byte> payload, const bool isDnsOverTCP,
40-
const std::function<bool(const DNSQuestion& query)>& queryCallback,
41-
const std::function<bool(const DNSRecord& answer)>& answerCallback,
42-
const std::function<bool(const DNSRecord& authorityRecord)>& authorityCallback,
43-
const std::function<bool(const DNSRecord& additionalRecord)>& additionalCallback) noexcept;
39+
bool parse(std::span<const std::byte> payload, const bool isDnsOverTCP,
40+
const std::function<bool(const DNSQuestion& query)>& queryCallback = EMPTY_QUERY_CALLBACK,
41+
const std::function<bool(const DNSRecord& answer)>& answerCallback = EMPTY_RECORD_CALLBACK,
42+
const std::function<bool(const DNSRecord& authorityRecord)>& authorityCallback = EMPTY_RECORD_CALLBACK,
43+
const std::function<bool(const DNSRecord& additionalRecord)>& additionalCallback = EMPTY_RECORD_CALLBACK) noexcept;
4444

4545
uint16_t answersCount;
4646
uint16_t id;
@@ -50,7 +50,6 @@ class DNSParser {
5050
std::optional<OPTRecord> firstOPTRecord;
5151
std::span<const std::byte> fullDNSPayload;
5252

53-
5453
private:
5554

5655
constexpr std::optional<std::size_t> parseQuestionSection(

src/plugins/process/common/dnsParser/dnsQuestion.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#pragma once
22

3+
#include <cstdint>
4+
35
#include "dnsQueryType.hpp"
6+
#include "dnsName.hpp"
47

58
namespace ipxp
69
{

src/plugins/process/common/dnsParser/dnsRecordPayloadTypes/dnsHINFORecord.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct DNSHINFORecord {
1616
DNSName cpu;
1717
DNSName operatingSystem;
1818

19-
constexpr static std::optional<DNSHINFORecord> createFrom(
19+
static std::optional<DNSHINFORecord> createFrom(
2020
std::span<const std::byte> payload,
2121
std::span<const std::byte> fullDNSPayload) noexcept
2222
{

src/plugins/process/common/dnsParser/dnsRecordPayloadTypes/dnsISDNRecord.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct DNSISDNRecord {
1616
DNSName isdnAddress;
1717
DNSName subaddress;
1818

19-
constexpr static std::optional<DNSISDNRecord> createFrom(
19+
static std::optional<DNSISDNRecord> createFrom(
2020
std::span<const std::byte> payload,
2121
std::span<const std::byte> fullDNSPayload) noexcept
2222
{

0 commit comments

Comments
 (0)