author | mickeyl <mickeyl> | 2004-03-12 13:04:07 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-12 13:04:07 (UTC) |
commit | d38384a6edb0110117e0297864f813b379d52789 (patch) (side-by-side diff) | |
tree | 82929ccdea4c9e30e39971beea1a9f4a51bc7b57 /libopie2/opienet/opcap.h | |
parent | 36d9d18055dbed7a85ab2979d1e96dfb4017560b (diff) | |
download | opie-d38384a6edb0110117e0297864f813b379d52789.zip opie-d38384a6edb0110117e0297864f813b379d52789.tar.gz opie-d38384a6edb0110117e0297864f813b379d52789.tar.bz2 |
API change: OPacket::dumpStructure() now returns a QString and accepts void
API change: add QTextStream& operator<<( QTextStream& s, const OPacket& p );
-rw-r--r-- | libopie2/opienet/opcap.h | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index f5dc5c0..b873b49 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h @@ -26,42 +26,44 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OPCAP_H #define OPCAP_H -/* LINUX */ -extern "C" // work around a bpf/pcap conflict in recent headers -{ - #include <pcap.h> -} -#include <netinet/ether.h> -#include <netinet/ip.h> -#include <netinet/udp.h> -#include <netinet/tcp.h> -#include <time.h> +/* OPIE */ +#include <opie2/onetutils.h> /* QT */ #include <qevent.h> #include <qfile.h> #include <qhostaddress.h> #include <qobject.h> #include <qstring.h> +#include <qtextstream.h> #include <qmap.h> -/* OPIE */ -#include <opie2/onetutils.h> +/* STD */ +extern "C" // work around a bpf/pcap conflict in recent headers +{ + #include <pcap.h> +} +#include <netinet/ether.h> +#include <netinet/ip.h> +#include <netinet/udp.h> +#include <netinet/tcp.h> +#include <time.h> -/* Custom Network Includes */ +/* Custom Network Includes (must go here, don't reorder!) */ #include "802_11_user.h" #include "dhcp.h" + /* TYPEDEFS */ typedef struct timeval timevalstruct; typedef struct pcap_pkthdr packetheaderstruct; /* FORWARDS */ class OPacketCapturer; class QSocketNotifier; @@ -111,40 +113,43 @@ class QSocketNotifier; * */ class OPacket : public QObject { Q_OBJECT friend class OPacketCapturer; + friend QTextStream& operator<<( QTextStream& s, const OPacket& p ); public: OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); virtual ~OPacket(); timevalstruct timeval() const; int caplen() const; int len() const; QString dump( int = 32 ) const; void updateStats( QMap<QString,int>&, QObjectList* ); private: - void dumpStructure( QObjectList* ); - QString _dumpStructure( QObjectList* ); + QString dumpStructure() const; + QString _dumpStructure( QObjectList* ) const; private: const packetheaderstruct _hdr; // pcap packet header const unsigned char* _data; // pcap packet data const unsigned char* _end; // end of pcap packet data }; +QTextStream& operator<<( QTextStream& s, const OPacket& p ); + /*====================================================================================== * OEthernetPacket - DLT_EN10MB frame *======================================================================================*/ class OEthernetPacket : public QObject { Q_OBJECT |