mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Moving Pkt{Src,Dumper} a directory level up.
Also renaming PktSourceComponent to PktSrcComponent.
This commit is contained in:
parent
ecf1e32f60
commit
caa55ad352
23 changed files with 274 additions and 311 deletions
|
@ -3,11 +3,16 @@
|
|||
#ifndef IOSOURCE_PLUGIN_COMPONENT_H
|
||||
#define IOSOURCE_PLUGIN_COMPONENT_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "plugin/Component.h"
|
||||
|
||||
namespace iosource {
|
||||
|
||||
class IOSource;
|
||||
class PktSrc;
|
||||
class PktDumper;
|
||||
|
||||
/**
|
||||
* Component description for plugins providing IOSources.
|
||||
|
@ -38,6 +43,110 @@ protected:
|
|||
Component(plugin::component::Type type, const std::string& name);
|
||||
};
|
||||
|
||||
/**
|
||||
* Component description for plugins providing a PktSrc for packet input.
|
||||
*/
|
||||
class PktSrcComponent : public iosource::Component {
|
||||
public:
|
||||
enum InputType { LIVE, TRACE, BOTH };
|
||||
|
||||
typedef PktSrc* (*factory_callback)(const std::string& path, const std::string& filter, bool is_live);
|
||||
|
||||
/**
|
||||
* XXX
|
||||
*/
|
||||
PktSrcComponent(const std::string& name, const std::string& prefixes, InputType type, factory_callback factory);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~PktSrcComponent();
|
||||
|
||||
/**
|
||||
* Returns the prefix(es) passed to the constructor.
|
||||
*/
|
||||
const std::vector<std::string>& Prefixes() const;
|
||||
|
||||
/**
|
||||
* Returns true if the given prefix is among the one specified for the component.
|
||||
*/
|
||||
bool HandlesPrefix(const std::string& prefix) const;
|
||||
|
||||
/**
|
||||
* Returns true if packet source instantiated by the component handle
|
||||
* live traffic.
|
||||
*/
|
||||
bool DoesLive() const;
|
||||
|
||||
/**
|
||||
* Returns true if packet source instantiated by the component handle
|
||||
* offline traces.
|
||||
*/
|
||||
bool DoesTrace() const;
|
||||
|
||||
/**
|
||||
* Returns the source's factory function.
|
||||
*/
|
||||
factory_callback Factory() const;
|
||||
|
||||
/**
|
||||
* Generates a human-readable description of the component. This goes
|
||||
* into the output of \c "bro -NN".
|
||||
*/
|
||||
virtual void Describe(ODesc* d) const;
|
||||
|
||||
private:
|
||||
std::vector<std::string> prefixes;
|
||||
InputType type;
|
||||
factory_callback factory;
|
||||
};
|
||||
|
||||
/**
|
||||
* Component description for plugins providing a PktDumper for packet output.
|
||||
*
|
||||
* PktDumpers aren't IOSurces but we locate them here to keep them along with
|
||||
* the PktSrc.
|
||||
*/
|
||||
class PktDumperComponent : public plugin::Component {
|
||||
public:
|
||||
typedef PktDumper* (*factory_callback)(const std::string& path, bool append);
|
||||
|
||||
/**
|
||||
* XXX
|
||||
*/
|
||||
PktDumperComponent(const std::string& name, const std::string& prefixes, factory_callback factory);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~PktDumperComponent();
|
||||
|
||||
/**
|
||||
* Returns the prefix(es) passed to the constructor.
|
||||
*/
|
||||
const std::vector<std::string>& Prefixes() const;
|
||||
|
||||
/**
|
||||
* Returns true if the given prefix is among the one specified for the component.
|
||||
*/
|
||||
bool HandlesPrefix(const std::string& prefix) const;
|
||||
|
||||
/**
|
||||
* Returns the source's factory function.
|
||||
*/
|
||||
factory_callback Factory() const;
|
||||
|
||||
/**
|
||||
* Generates a human-readable description of the component. This goes
|
||||
* into the output of \c "bro -NN".
|
||||
*/
|
||||
virtual void Describe(ODesc* d) const;
|
||||
|
||||
private:
|
||||
std::vector<std::string> prefixes;
|
||||
factory_callback factory;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue