summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp19
-rw-r--r--libopie2/opienet/opcap.h18
2 files changed, 36 insertions, 1 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 523be3e..bef9182 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -1046,12 +1046,31 @@ void OPacketCapturer::readyToReceive()
1046 OPacket* p = next(); 1046 OPacket* p = next();
1047 emit receivedPacket( p ); 1047 emit receivedPacket( p );
1048 // emit is synchronous - packet has been dealt with, now it's safe to delete 1048 // emit is synchronous - packet has been dealt with, now it's safe to delete
1049 delete p; 1049 delete p;
1050} 1050}
1051 1051
1052 1052
1053const QMap<QString,int>& OPacketCapturer::statistics() const 1053const QMap<QString,int>& OPacketCapturer::statistics() const
1054{ 1054{
1055 return _stats; 1055 return _stats;
1056} 1056}
1057 1057
1058
1059int OPacketCapturer::snapShot() const
1060{
1061 return pcap_snapshot( _pch );
1062}
1063
1064
1065bool OPacketCapturer::swapped() const
1066{
1067 return pcap_is_swapped( _pch );
1068}
1069
1070
1071QString OPacketCapturer::version() const
1072{
1073 return QString().sprintf( "%s.%s", pcap_major_version( _pch ), pcap_minor_version( _pch ) );
1074}
1075
1076
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index 5a50d9b..ad5b07c 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -555,25 +555,41 @@ class OPacketCapturer : public QObject
555 * Open the packet capturer to capture packets in live-mode from @a interface. 555 * Open the packet capturer to capture packets in live-mode from @a interface.
556 * If a @a filename is given, all captured packets are output to a tcpdump-compatible capture file. 556 * If a @a filename is given, all captured packets are output to a tcpdump-compatible capture file.
557 */ 557 */
558 bool open( const QString& interface, const QString& filename = QString::null ); 558 bool open( const QString& interface, const QString& filename = QString::null );
559 /** 559 /**
560 * Open the packet capturer to capture packets in offline-mode from @a file. 560 * Open the packet capturer to capture packets in offline-mode from @a file.
561 */ 561 */
562 bool open( const QFile& file ); 562 bool open( const QFile& file );
563 /** 563 /**
564 * @returns true if the packet capturer is open 564 * @returns true if the packet capturer is open
565 */ 565 */
566 bool isOpen() const; 566 bool isOpen() const;
567 567 /**
568 * @returns the snapshot length of this packet capturer
569 */
570 int snapShot() const;
571 /**
572 * @returns true if the input capture file has a different byte-order
573 * than the byte-order of the running system.
574 */
575 bool swapped() const;
576 /**
577 * @returns the libpcap version string used to write the input capture file.
578 */
579 QString version() const;
580 /**
581 * @returns the packet statistic database.
582 * @see QMap
583 */
568 const QMap<QString,int>& statistics() const; 584 const QMap<QString,int>& statistics() const;
569 585
570 signals: 586 signals:
571 /** 587 /**
572 * This signal is emitted, when a packet has been received. 588 * This signal is emitted, when a packet has been received.
573 */ 589 */
574 void receivedPacket( OPacket* ); 590 void receivedPacket( OPacket* );
575 591
576 protected slots: 592 protected slots:
577 void readyToReceive(); 593 void readyToReceive();
578 594
579 protected: 595 protected: