]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
refactored module and stats
authorRuss Combs <rucombs@cisco.com>
Tue, 15 Jul 2014 14:16:15 +0000 (10:16 -0400)
committerRuss Combs <rucombs@cisco.com>
Tue, 15 Jul 2014 14:16:15 +0000 (10:16 -0400)
src/framework/counts.h [new file with mode: 0644]
src/framework/module.cc [new file with mode: 0644]

diff --git a/src/framework/counts.h b/src/framework/counts.h
new file mode 100644 (file)
index 0000000..b8d64b1
--- /dev/null
@@ -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 <rucombs@cisco.com>
+
+#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 (file)
index 0000000..f08422d
--- /dev/null
@@ -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 <rucombs@cisco.com>
+
+#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;
+}
+