From: Russ Combs Date: Tue, 15 Jul 2014 14:16:15 +0000 (-0400) Subject: refactored module and stats X-Git-Tag: 3.0.0-233~1444^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38868245aab23b44fbe2c0a3d21c194be9f4e0bb;p=thirdparty%2Fsnort3.git refactored module and stats --- diff --git a/src/framework/counts.h b/src/framework/counts.h new file mode 100644 index 000000000..b8d64b107 --- /dev/null +++ b/src/framework/counts.h @@ -0,0 +1,37 @@ +/* +** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. +** Copyright (C) 2013-2013 Sourcefire, Inc. +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License Version 2 as +** published by the Free Software Foundation. You may not use, modify or +** distribute this program under any other version of the GNU General +** Public License. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +// counts.h author Russ Combs + +#ifndef COUNTS_H +#define COUNTS_H + +#include "main/snort_types.h" + +typedef uint64_t PegCount; + +struct SimpleStats +{ + PegCount total_packets; +}; + +#define array_size(a) (sizeof(a)/sizeof(a[0])) + +#endif + diff --git a/src/framework/module.cc b/src/framework/module.cc new file mode 100644 index 000000000..f08422d76 --- /dev/null +++ b/src/framework/module.cc @@ -0,0 +1,49 @@ +/* +** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License Version 2 as +** published by the Free Software Foundation. You may not use, modify or +** distribute this program under any other version of the GNU General +** Public License. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +// module.cc author Russ Combs + +#include "module.h" +#include "parameter.h" + +static const Parameter null_params[] = +{ + { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } +}; + +void Module::init(const char* s) +{ + name = s; + params = null_params; + list = false; + cmds = nullptr; + rules = nullptr; +} + +Module::Module(const char* s) +{ + init(s); +} + +Module::Module(const char* s, const Parameter* p, bool is_list) +{ + init(s); + params = p; + list = is_list; +} +