"Fossies" - the Fresh Open Source Software Archive

Member "snort3_extra-3.1.51.0/src/loggers/log_null/log_null.cc" (20 Dec 2022, 2239 Bytes) of package /linux/misc/snort3_extra-3.1.51.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "log_null.cc" see the Fossies "Dox" file reference documentation.

    1 //--------------------------------------------------------------------------
    2 // Copyright (C) 2014-2022 Cisco and/or its affiliates. All rights reserved.
    3 // Copyright (C) 2002-2013 Sourcefire, Inc.
    4 // Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com>
    5 //
    6 // This program is free software; you can redistribute it and/or modify it
    7 // under the terms of the GNU General Public License Version 2 as published
    8 // by the Free Software Foundation.  You may not use, modify or distribute
    9 // this program under any other version of the GNU General Public License.
   10 //
   11 // This program is distributed in the hope that it will be useful, but
   12 // WITHOUT ANY WARRANTY; without even the implied warranty of
   13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14 // General Public License for more details.
   15 //
   16 // You should have received a copy of the GNU General Public License along
   17 // with this program; if not, write to the Free Software Foundation, Inc.,
   18 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   19 //--------------------------------------------------------------------------
   20 
   21 /* This module is a NULL placeholder for people that want to turn off
   22  * logging for whatever reason.  Please note that logging is separate from
   23  * alerting, they are completely separate output facilities within Snort.
   24  */
   25 
   26 #include "framework/logger.h"
   27 #include "framework/module.h"
   28 
   29 using namespace snort;
   30 
   31 #define s_name "log_null"
   32 #define s_help "disable logging of packets"
   33 
   34 //-------------------------------------------------------------------------
   35 // log_null module
   36 //-------------------------------------------------------------------------
   37 
   38 class NullLogger : public Logger
   39 {
   40 public:
   41     NullLogger() = default;
   42 };
   43 
   44 static Logger* null_ctor(Module*)
   45 { return new NullLogger; }
   46 
   47 static void null_dtor(Logger* p)
   48 { delete p; }
   49 
   50 static LogApi null_api
   51 {
   52     {
   53         PT_LOGGER,
   54         sizeof(LogApi),
   55         LOGAPI_VERSION,
   56         0,
   57         API_RESERVED,
   58         API_OPTIONS,
   59         s_name,
   60         s_help,
   61         nullptr, // mod_ctor,
   62         nullptr  //mod_dtor
   63     },
   64     OUTPUT_TYPE_FLAG__LOG,
   65     null_ctor,
   66     null_dtor
   67 };
   68 
   69 SO_PUBLIC const BaseApi* snort_plugins[] =
   70 {
   71     &null_api.base,
   72     nullptr
   73 };
   74