00001 //--------------------------------------------------------------------------
00002 // Copyright (C) 2014-2017 Cisco and/or its affiliates. All rights reserved.
00003 //
00004 // This program is free software; you can redistribute it and/or modify it
00005 // under the terms of the GNU General Public License Version 2 as published
00006 // by the Free Software Foundation. You may not use, modify or distribute
00007 // this program under any other version of the GNU General Public License.
00008 //
00009 // This program is distributed in the hope that it will be useful, but
00010 // WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License along
00015 // with this program; if not, write to the Free Software Foundation, Inc.,
00016 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 //--------------------------------------------------------------------------
00018 // cd_default.cc author Josh Rosenbaum <jrosenba@cisco.com>
00019
00020 #ifdef HAVE_CONFIG_H
00021 #include "config.h"
00022 #endif
00023
00024 #include "framework/codec.h"
00025
00026 #define CD_DEFAULT_NAME "unknown"
00027 #define CD_DEFAULT_HELP "support for unknown protocols"
00028
00029 namespace
00030 {
00031 class DefaultCodec : public Codec
00032 {
00033 public:
00034 DefaultCodec() : Codec(CD_DEFAULT_NAME) { }
00035
00036 void get_protocol_ids(std::vector<ProtocolId>& v) override
00037 { v.push_back(ProtocolId::FINISHED_DECODE); }
00038
00039 bool decode(const RawData&, CodecData&, DecodeData&) override
00040 { return false; }
00041 };
00042 } // namespace
00043
00044 //-------------------------------------------------------------------------
00045 // api
00046 //-------------------------------------------------------------------------
00047
00048 static Codec* ctor(Module*)
00049 { return new DefaultCodec(); }
00050
00051 static void dtor(Codec* cd)
00052 { delete cd; }
00053
00054 static const CodecApi default_api =
00055 {
00056 {
00057 PT_CODEC,
00058 sizeof(CodecApi),
00059 CDAPI_VERSION,
00060 0,
00061 API_RESERVED,
00062 API_OPTIONS,
00063 CD_DEFAULT_NAME,
00064 CD_DEFAULT_HELP,
00065 nullptr,
00066 nullptr,
00067 },
00068 nullptr, // pinit
00069 nullptr, // pterm
00070 nullptr, // tinit
00071 nullptr, // tterm
00072 ctor, // ctor
00073 dtor, // dtor
00074 };
00075
00076 const CodecApi* default_codec[] =
00077 {
00078 &default_api,
00079 nullptr
00080 };
00081
END OF CODE