mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
bifcl: Move headers into include/ subdir
This avoids potential problems with libc++ 8+ on case-insensitive file systems due to inclusion of a new header called <version> which will end up conflicting with the VERSION file if the search path includes the project root.
This commit is contained in:
parent
3ce42f2f35
commit
a86b98bb9e
4 changed files with 93 additions and 3 deletions
|
@ -17,7 +17,7 @@ if ( MISSING_PREREQS )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include_directories(BEFORE
|
include_directories(BEFORE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ set(bifcl_SRCS
|
||||||
${BISON_BIFParser_OUTPUTS}
|
${BISON_BIFParser_OUTPUTS}
|
||||||
${FLEX_BIFScanner_OUTPUTS}
|
${FLEX_BIFScanner_OUTPUTS}
|
||||||
bif_arg.cc
|
bif_arg.cc
|
||||||
bif_arg.h
|
include/bif_arg.h
|
||||||
module_util.cc
|
module_util.cc
|
||||||
module_util.h
|
include/module_util.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(bifcl ${bifcl_SRCS})
|
add_executable(bifcl ${bifcl_SRCS})
|
||||||
|
|
51
tools/bifcl/include/bif_arg.h
Normal file
51
tools/bifcl/include/bif_arg.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef bif_arg_h
|
||||||
|
#define bif_arg_h
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
enum builtin_func_arg_type {
|
||||||
|
#define DEFINE_BIF_TYPE(id, bif_type, bro_type, c_type, accessor, constructor) \
|
||||||
|
id,
|
||||||
|
#include "bif_type.def"
|
||||||
|
#undef DEFINE_BIF_TYPE
|
||||||
|
/*
|
||||||
|
TYPE_ANY,
|
||||||
|
TYPE_BOOL,
|
||||||
|
TYPE_COUNT,
|
||||||
|
TYPE_INT,
|
||||||
|
TYPE_STRING,
|
||||||
|
TYPE_PATTERN,
|
||||||
|
TYPE_PORT,
|
||||||
|
TYPE_OTHER,
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const char* builtin_func_arg_type_bro_name[];
|
||||||
|
|
||||||
|
class BuiltinFuncArg {
|
||||||
|
public:
|
||||||
|
BuiltinFuncArg(const char* arg_name, int arg_type);
|
||||||
|
BuiltinFuncArg(const char* arg_name, const char* arg_type_str,
|
||||||
|
const char* arg_attr_str = "");
|
||||||
|
|
||||||
|
void SetAttrStr(const char* arg_attr_str)
|
||||||
|
{
|
||||||
|
attr_str = arg_attr_str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* Name() const { return name; }
|
||||||
|
int Type() const { return type; }
|
||||||
|
|
||||||
|
void PrintBro(FILE* fp);
|
||||||
|
void PrintCDef(FILE* fp, int n);
|
||||||
|
void PrintCArg(FILE* fp, int n);
|
||||||
|
void PrintBroValConstructor(FILE* fp);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const char* name;
|
||||||
|
int type;
|
||||||
|
const char* type_str;
|
||||||
|
const char* attr_str;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
22
tools/bifcl/include/bif_type.def
Normal file
22
tools/bifcl/include/bif_type.def
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// DEFINE_BIF_TYPE(id, bif_type, bro_type, c_type, accessor, constructor)
|
||||||
|
|
||||||
|
DEFINE_BIF_TYPE(TYPE_ADDR, "addr", "addr", "AddrVal*", "%s->AsAddrVal()", "%s")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_ANY, "any", "any", "Val*", "%s", "%s")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_BOOL, "bool", "bool", "int", "%s->AsBool()", "val_mgr->GetBool(%s)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_CONN_ID, "conn_id", "conn_id", "Val*", "%s", "%s")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_CONNECTION, "connection", "connection", "Connection*", "%s->AsRecordVal()->GetOrigin()", "%s->BuildConnVal()")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_COUNT, "count", "count", "bro_uint_t", "%s->AsCount()", "val_mgr->GetCount(%s)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_DOUBLE, "double", "double", "double", "%s->AsDouble()", "new Val(%s, TYPE_DOUBLE)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_FILE, "file", "file", "BroFile*", "%s->AsFile()", "new Val(%s)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_INT, "int", "int", "bro_int_t", "%s->AsInt()", "val_mgr->GetInt(%s)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_INTERVAL, "interval", "interval", "double", "%s->AsInterval()", "new IntervalVal(%s, Seconds)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_PACKET, "packet", "packet", "TCP_TracePacket*", "%s->AsRecordVal()->GetOrigin()", "%s->PacketVal()")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_PATTERN, "pattern", "pattern", "RE_Matcher*", "%s->AsPattern()", "new PatternVal(%s)")
|
||||||
|
// DEFINE_BIF_TYPE(TYPE_PORT, "port", "port", "uint32", "%s->AsPortVal()->Port()", "incomplete data")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_PORT, "port", "port", "PortVal*", "%s->AsPortVal()", "%s")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_PORTVAL, "portval", "port", "PortVal*", "%s->AsPortVal()", "%s")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_STRING, "string", "string", "StringVal*", "%s->AsStringVal()", "%s")
|
||||||
|
// DEFINE_BIF_TYPE(TYPE_STRING, "string", "string", "BroString*", "%s->AsString()", "new StringVal(%s)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_SUBNET, "subnet", "subnet", "SubNetVal*", "%s->AsSubNetVal()", "%s")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_TIME, "time", "time", "double", "%s->AsTime()", "new Val(%s, TYPE_TIME)")
|
||||||
|
DEFINE_BIF_TYPE(TYPE_OTHER, "", "", "Val*", "%s", "%s")
|
17
tools/bifcl/include/module_util.h
Normal file
17
tools/bifcl/include/module_util.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// These functions are used by both Zeek and bifcl.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
static const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
||||||
|
|
||||||
|
extern string extract_module_name(const char* name);
|
||||||
|
extern string extract_var_name(const char* name);
|
||||||
|
extern string normalized_module_name(const char* module_name); // w/o ::
|
||||||
|
|
||||||
|
// Concatenates module_name::var_name unless var_name is already fully
|
||||||
|
// qualified, in which case it is returned unmodified.
|
||||||
|
extern string make_full_var_name(const char* module_name, const char* var_name);
|
Loading…
Add table
Add a link
Reference in a new issue