mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
Move iosource code to zeek namespaces
This commit is contained in:
parent
45b5c6e619
commit
be92bd536f
35 changed files with 180 additions and 136 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "pcap.bif.h"
|
||||
|
||||
using namespace iosource::pcap;
|
||||
namespace zeek::iosource::pcap {
|
||||
|
||||
PcapDumper::PcapDumper(const std::string& path, bool arg_append)
|
||||
{
|
||||
|
@ -117,3 +117,5 @@ iosource::PktDumper* PcapDumper::Instantiate(const std::string& path, bool appen
|
|||
{
|
||||
return new PcapDumper(path, append);
|
||||
}
|
||||
|
||||
} // namespace zeek::iosource::pcap
|
||||
|
|
|
@ -8,8 +8,7 @@ extern "C" {
|
|||
|
||||
#include "../PktDumper.h"
|
||||
|
||||
namespace iosource {
|
||||
namespace pcap {
|
||||
namespace zeek::iosource::pcap {
|
||||
|
||||
class PcapDumper : public PktDumper {
|
||||
public:
|
||||
|
@ -32,5 +31,8 @@ private:
|
|||
pcap_t* pd;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace zeek::iosource::pcap
|
||||
|
||||
namespace iosource::pcap {
|
||||
using PcapDumper [[deprecated("Remove in v4.1. Use zeek::iosource::pcap::PcapDumper.")]] = zeek::iosource::pcap::PcapDumper;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,17 @@
|
|||
#include "plugin/Plugin.h"
|
||||
#include "iosource/Component.h"
|
||||
|
||||
namespace plugin {
|
||||
namespace Zeek_Pcap {
|
||||
namespace zeek::plugin::Zeek_Pcap {
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin {
|
||||
public:
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new ::iosource::PktSrcComponent("PcapReader", "pcap", ::iosource::PktSrcComponent::BOTH, ::iosource::pcap::PcapSource::Instantiate));
|
||||
AddComponent(new ::iosource::PktDumperComponent("PcapWriter", "pcap", ::iosource::pcap::PcapDumper::Instantiate));
|
||||
AddComponent(new zeek::iosource::PktSrcComponent(
|
||||
"PcapReader", "pcap", zeek::iosource::PktSrcComponent::BOTH,
|
||||
zeek::iosource::pcap::PcapSource::Instantiate));
|
||||
AddComponent(new zeek::iosource::PktDumperComponent(
|
||||
"PcapWriter", "pcap", zeek::iosource::pcap::PcapDumper::Instantiate));
|
||||
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "Zeek::Pcap";
|
||||
|
@ -22,5 +24,4 @@ public:
|
|||
}
|
||||
} plugin;
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace zeek::plugin::Zeek_Pcap
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <pcap-int.h>
|
||||
#endif
|
||||
|
||||
using namespace iosource::pcap;
|
||||
namespace zeek::iosource::pcap {
|
||||
|
||||
PcapSource::~PcapSource()
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ bool PcapSource::SetFilter(int index)
|
|||
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
zeek::detail::BPF_Program* code = GetBPFFilter(index);
|
||||
zeek::iosource::detail::BPF_Program* code = GetBPFFilter(index);
|
||||
|
||||
if ( ! code )
|
||||
{
|
||||
|
@ -342,3 +342,5 @@ iosource::PktSrc* PcapSource::Instantiate(const std::string& path, bool is_live)
|
|||
{
|
||||
return new PcapSource(path, is_live);
|
||||
}
|
||||
|
||||
} // namespace zeek::iosource::pcap
|
||||
|
|
|
@ -10,10 +10,9 @@ extern "C" {
|
|||
|
||||
#include <sys/types.h> // for u_char
|
||||
|
||||
namespace iosource {
|
||||
namespace pcap {
|
||||
namespace zeek::iosource::pcap {
|
||||
|
||||
class PcapSource : public iosource::PktSrc {
|
||||
class PcapSource : public zeek::iosource::PktSrc {
|
||||
public:
|
||||
PcapSource(const std::string& path, bool is_live);
|
||||
~PcapSource() override;
|
||||
|
@ -41,5 +40,8 @@ private:
|
|||
pcap_t *pd;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace zeek::iosource::pcap
|
||||
|
||||
namespace iosource::pcap {
|
||||
using PcapSource [[deprecated("Remove in v4.1. Use zeek::iosource::pcap::PcapSource.")]] = zeek::iosource::pcap::PcapSource;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ function precompile_pcap_filter%(id: PcapFilterID, s: string%): bool
|
|||
|
||||
bool success = true;
|
||||
|
||||
iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
|
||||
zeek::iosource::PktSrc* ps = zeek::iosource_mgr->GetPktSrc();
|
||||
if ( ps && ! ps->PrecompileFilter(id->ForceAsInt(), s->CheckString()) )
|
||||
success = false;
|
||||
|
||||
|
@ -68,7 +68,7 @@ function Pcap::install_pcap_filter%(id: PcapFilterID%): bool
|
|||
%{
|
||||
bool success = true;
|
||||
|
||||
iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
|
||||
zeek::iosource::PktSrc* ps = zeek::iosource_mgr->GetPktSrc();
|
||||
if ( ps && ! ps->SetFilter(id->ForceAsInt()) )
|
||||
success = false;
|
||||
|
||||
|
@ -91,7 +91,7 @@ function Pcap::install_pcap_filter%(id: PcapFilterID%): bool
|
|||
## uninstall_dst_net_filter
|
||||
function error%(%): string
|
||||
%{
|
||||
iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
|
||||
zeek::iosource::PktSrc* ps = zeek::iosource_mgr->GetPktSrc();
|
||||
if ( ps )
|
||||
{
|
||||
const char* err = ps->ErrorMsg();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue