Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/fieldClassifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ module takes the following parameters:
* Specify if the geolocation should be done for source, destination or both IP addresses. Possible
values are `src`, `dst` or `both`. Default is `both`.

* `-c`, `--cacheCapacity` number

* Specify the capacity of the internal cache (number of entries). Default is `4000`.

## Geolite parameters

* `--pathGeolite` path
Expand Down
12 changes: 3 additions & 9 deletions modules/fieldClassifier/src/fieldClassifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "plugins/plugin.hpp"
#include <stdexcept>

extern int g_debug_level;

namespace NFieldClassifier {
void FieldClassifier::handleParams(int argc, char** argv, argparse::ArgumentParser& parser)
{
Expand Down Expand Up @@ -412,13 +410,9 @@ void FieldClassifier::fillInputFieldsToOutput(
break;
}
case DataType::BYTES: {
// Nemea::UnirecArray<std::byte> const arr
// = input->getFieldAsUnirecArray<std::byte>(fieldId);
// output->setFieldFromUnirecArray<std::byte>(arr, fieldId);

// std::byte value = input->getFieldAsType<std::byte>(fieldId);
// output->setFieldFromType<std::byte>(value, fieldId);

Nemea::UnirecArray<std::byte> const arr
= input->getFieldAsUnirecArray<std::byte>(fieldId);
output->setFieldFromUnirecArray<std::byte>(arr, fieldId);
break;
}
case DataType::A_INT8: {
Expand Down
4 changes: 2 additions & 2 deletions modules/fieldClassifier/src/plugins/asn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void ASN::storeParameters(argparse::ArgumentParser& parser)
FieldDefinition ASN::defineFields()
{
// list of all fields provided by this plugin
FieldDefinition allFields = {{"ASN", DataType::UINT16}, {"ASO", DataType::STRING}};
FieldDefinition allFields = {{"ASN", DataType::UINT32}, {"ASO", DataType::STRING}};

return allFields;
}
Expand All @@ -53,7 +53,7 @@ bool ASN::getData(DataMap& dataMap, std::string& ipAddr)
}
if (dataMap.find("ASN") != dataMap.end()) {
err = MMDB_get_value(&result.entry, &entryData, "autonomous_system_number", NULL);
dataMap.at("ASN") = checkEntryData() ? entryData.uint16 : EMPTY_UINT16;
dataMap.at("ASN") = checkEntryData() ? entryData.uint32 : EMPTY_UINT16;
}
if (dataMap.find("ASO") != dataMap.end()) {
err = MMDB_get_value(&result.entry, &entryData, "autonomous_system_organization", NULL);
Expand Down
Loading