author | mickeyl <mickeyl> | 2003-05-06 23:01:10 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-06 23:01:10 (UTC) |
commit | de62ac94791a969d950fc471b465d4f03267ae01 (patch) (unidiff) | |
tree | a43fa025de468c92d0705657fc950cfcf8151518 | |
parent | 9490e91d3876a8280f3f9a3839fddf95b957b879 (diff) | |
download | opie-de62ac94791a969d950fc471b465d4f03267ae01.zip opie-de62ac94791a969d950fc471b465d4f03267ae01.tar.gz opie-de62ac94791a969d950fc471b465d4f03267ae01.tar.bz2 |
add two minor functions in the pcap interface
-rw-r--r-- | libopie2/opienet/opcap.cpp | 19 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 20 |
2 files changed, 37 insertions, 2 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 | |||
@@ -1054,4 +1054,23 @@ const QMap<QString,int>& OPacketCapturer::statistics() const | |||
1054 | { | 1054 | { |
1055 | return _stats; | 1055 | return _stats; |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | |||
1059 | int OPacketCapturer::snapShot() const | ||
1060 | { | ||
1061 | return pcap_snapshot( _pch ); | ||
1062 | } | ||
1063 | |||
1064 | |||
1065 | bool OPacketCapturer::swapped() const | ||
1066 | { | ||
1067 | return pcap_is_swapped( _pch ); | ||
1068 | } | ||
1069 | |||
1070 | |||
1071 | QString 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 | |||
@@ -541,9 +541,9 @@ class OPacketCapturer : public QObject | |||
541 | * @see <pcap.h> for possible values. | 541 | * @see <pcap.h> for possible values. |
542 | */ | 542 | */ |
543 | int dataLink() const; | 543 | int dataLink() const; |
544 | /** | 544 | /** |
545 | * @returns the filedescriptor of the packet capturer. This is only useful, if | 545 | * @returns the file descriptor of the packet capturer. This is only useful, if |
546 | * not using the socket notifier, e.g. without an application object. | 546 | * not using the socket notifier, e.g. without an application object. |
547 | */ | 547 | */ |
548 | int fileno() const; | 548 | int fileno() const; |
549 | /** | 549 | /** |
@@ -563,9 +563,25 @@ class OPacketCapturer : public QObject | |||
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 | /** |