Skip to content

Commit c1465cd

Browse files
committed
fdsdump: wrap common components to fdsdump namespace
1 parent e8783f5 commit c1465cd

File tree

16 files changed

+62
-2
lines changed

16 files changed

+62
-2
lines changed

src/tools/fdsdump/src/common/common.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "common.hpp"
55

6+
namespace fdsdump {
7+
68
std::vector<std::string>
79
string_split(const std::string &str, const std::string &delimiter)
810
{
@@ -104,3 +106,5 @@ memcpy_bits(uint8_t *dst, uint8_t *src, unsigned int n_bits)
104106
dst[n_bytes - 1] &= (0xFF >> rem_bits) << rem_bits;
105107
}
106108
}
109+
110+
} // fdsdump

src/tools/fdsdump/src/common/common.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <libfds.h>
1515

16+
namespace fdsdump {
17+
1618
using unique_file = std::unique_ptr<fds_file_t, decltype(&fds_file_close)>;
1719
using unique_iemgr = std::unique_ptr<fds_iemgr_t, decltype(&fds_iemgr_destroy)>;
1820
using unique_filter = std::unique_ptr<fds_ipfix_filter, decltype(&fds_ipfix_filter_destroy)>;
@@ -64,3 +66,5 @@ string_trim_copy(std::string str);
6466
*/
6567
void
6668
memcpy_bits(uint8_t *dst, uint8_t *src, unsigned int n_bits);
69+
70+
} // fdsdump

src/tools/fdsdump/src/common/field.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "field.hpp"
66

7+
namespace fdsdump {
8+
79
Field::Field(std::string name, const shared_iemgr &iemgr)
810
: m_name(name), m_iemgr(iemgr)
911
{
@@ -172,3 +174,5 @@ Field::for_each_element(
172174

173175
return count;
174176
}
177+
178+
} // fdsdump

src/tools/fdsdump/src/common/field.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include "common.hpp"
1010

11+
namespace fdsdump {
12+
1113
/**
1214
* @brief Data type of a record field.
1315
*/
@@ -112,3 +114,5 @@ struct Field {
112114
FieldType get_type_of_element(const struct fds_iemgr_elem *elem) const;
113115
FieldType get_type_of_alias(const struct fds_iemgr_alias *alias) const;
114116
};
117+
118+
} // fdsdump

src/tools/fdsdump/src/common/fieldView.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "fieldView.hpp"
66

7+
namespace fdsdump {
8+
79
uint64_t
810
FieldView::as_uint() const
911
{
@@ -112,3 +114,5 @@ FieldView::as_ipaddr() const
112114

113115
throw std::invalid_argument("Conversion error (ipaddr)");
114116
}
117+
118+
} // fdsdump

src/tools/fdsdump/src/common/fieldView.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "ipaddr.hpp"
99

10+
namespace fdsdump {
11+
1012
class FieldView {
1113
public:
1214
FieldView(const struct fds_drec_field &field)
@@ -23,3 +25,5 @@ class FieldView {
2325
private:
2426
const struct fds_drec_field &m_field;
2527
};
28+
29+
} // fdsdump

src/tools/fdsdump/src/common/filelist.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444

4545
#include "filelist.hpp"
4646

47+
namespace fdsdump {
48+
4749
void
4850
FileList::add_files(const std::string &pattern)
4951
{
@@ -104,3 +106,5 @@ FileList::clear()
104106

105107
m_files.clear();
106108
}
109+
110+
} // fdsdump

src/tools/fdsdump/src/common/filelist.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#include <mutex>
4343
#include <vector>
4444

45+
namespace fdsdump {
46+
4547
/**
4648
* \brief A file list that allows thread safe retrieval of items;
4749
*/
@@ -97,3 +99,5 @@ class FileList {
9799
std::mutex m_mutex;
98100
std::vector<std::string> m_files;
99101
};
102+
103+
} // fdsdump

src/tools/fdsdump/src/common/flow.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
namespace fdsdump {
4+
35
/**
46
* @brief Direction of flow record to be considered when processing.
57
*
@@ -30,3 +32,5 @@ struct Flow {
3032
/** @brief Flow Data record */
3133
struct fds_drec rec;
3234
};
35+
36+
} // fdsdump

src/tools/fdsdump/src/common/flowProvider.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "fieldView.hpp"
77
#include "flowProvider.hpp"
88

9+
namespace fdsdump {
10+
911
FlowProvider::FlowProvider(const shared_iemgr &iemgr)
1012
: m_iemgr(iemgr)
1113
{
@@ -225,3 +227,5 @@ FlowProvider::next_record()
225227
return &m_flow;
226228
}
227229
}
230+
231+
} // fdsdump

0 commit comments

Comments
 (0)