2016-09-06 08:20:08 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2016 Srivats P.
|
|
|
|
|
|
|
|
This file is part of "Ostinato"
|
|
|
|
|
|
|
|
This 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.
|
|
|
|
|
|
|
|
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, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PCAP_TRANSMITTER_H
|
|
|
|
#define _PCAP_TRANSMITTER_H
|
|
|
|
|
|
|
|
#include "abstractport.h"
|
2016-10-19 08:22:35 -05:00
|
|
|
#include "pcaptxstats.h"
|
2016-09-13 08:35:24 -05:00
|
|
|
#include "pcaptxthread.h"
|
2016-10-19 08:22:35 -05:00
|
|
|
#include "statstuple.h"
|
2016-09-06 08:20:08 -05:00
|
|
|
|
2016-11-11 09:52:07 -06:00
|
|
|
class PcapTransmitter : QObject
|
2016-09-06 08:20:08 -05:00
|
|
|
{
|
2016-11-11 09:52:07 -06:00
|
|
|
Q_OBJECT
|
2016-09-06 08:20:08 -05:00
|
|
|
public:
|
2016-11-11 09:52:07 -06:00
|
|
|
PcapTransmitter(const char *device, StreamStats &portStreamStats);
|
2016-10-19 08:22:35 -05:00
|
|
|
~PcapTransmitter();
|
2016-09-06 08:20:08 -05:00
|
|
|
|
|
|
|
bool setRateAccuracy(AbstractPort::Accuracy accuracy);
|
|
|
|
|
|
|
|
void clearPacketList();
|
|
|
|
void loopNextPacketSet(qint64 size, qint64 repeats,
|
2016-09-13 08:35:24 -05:00
|
|
|
long repeatDelaySec, long repeatDelayNsec);
|
2016-09-06 08:20:08 -05:00
|
|
|
bool appendToPacketList(long sec, long usec, const uchar *packet,
|
2016-09-13 08:35:24 -05:00
|
|
|
int length);
|
|
|
|
void setPacketListLoopMode(bool loop, quint64 secDelay, quint64 nsecDelay);
|
|
|
|
|
2016-09-06 08:20:08 -05:00
|
|
|
void setHandle(pcap_t *handle);
|
|
|
|
void useExternalStats(AbstractPort::PortStats *stats);
|
2016-09-13 08:35:24 -05:00
|
|
|
|
2016-09-06 08:20:08 -05:00
|
|
|
void start();
|
|
|
|
void stop();
|
|
|
|
bool isRunning();
|
2016-11-11 09:52:07 -06:00
|
|
|
private slots:
|
|
|
|
void updateTxThreadStreamStats();
|
2016-09-13 08:35:24 -05:00
|
|
|
private:
|
2016-11-11 09:52:07 -06:00
|
|
|
StreamStats &streamStats_;
|
2016-09-13 08:35:24 -05:00
|
|
|
PcapTxThread txThread_;
|
2016-10-19 08:22:35 -05:00
|
|
|
PcapTxStats txStats_;
|
|
|
|
StatsTuple stats_;
|
2016-09-06 08:20:08 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|