/* dumpprocessor.h
****************************************************************************************************************
****************************************************************************************************************

    Copyright (C) 2021 Askar Almatov

    This file is part of Trafficmeter.

    Trafficmeter is free software: you can redistribute it and/or modify it under the terms of the GNU General
    Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    Trafficmeter 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 Trafficmeter. If not, see
    <http://www.gnu.org/licenses/>.
*/

#ifndef __DUMPPROCESSOR_H
#define __DUMPPROCESSOR_H 1

#include <string>
#include <vector>
#include <libiclass/task>

#include "source.h"

namespace trafficmeter
{
    /**********************************************************************************************************/
    class DumpProcessor : public iclass::taskt
    {
    public:
                                        DumpProcessor( Source* source, int nPacketsPrint, int nBytesPrint );
        virtual                         ~DumpProcessor();

        void                            addPattern( const std::string& );
        bool                            isContainsPatterns( const Source::Packet& ) const;

    protected:
        struct Pattern_;

        virtual void                    routine() override;

        Source*                         source_;
        int                             nPacketsPrint_;
        int                             nBytesPrint_;
        std::vector<Pattern_>           patterns_;
    };
}

#endif  // __DUMPPROCESSOR_H
