[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/ksniffer
From: Giovanni Venturi <gventuri73 () tiscali ! it>
Date: 2008-12-08 16:20:36
Message-ID: 1228753236.011270.6467.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 894430 by gianni:
more doxygen stuff
M +4 -9 packetmanager.cpp
M +181 -62 packetmanager.h
--- trunk/playground/network/ksniffer/packetmanager.cpp #894429:894430
@@ -222,15 +222,7 @@
QString PacketManager::strTimeStamp() const
{
- // we assume that the standard time stamp is a relative time stamp
- return strRelativeTimeStamp();
-}
-
-
-// we get the relative time in seconds and 1/1'000'000 seconds when the packet \
capture started
-// first packet has relative time 0.0
-QString PacketManager::strRelativeTimeStamp() const
-{
+ // we assume that the standard time stamp is a time stamp relative to the first \
frame return strDiffTimeFirst();
}
@@ -258,6 +250,9 @@
QString PacketManager::strDiffTimeFirst() const
{
+ // we get the relative time in seconds and 1/1'000'000 seconds when the packet \
capture started + // first packet has relative time 0.0
+
time_t sec = 0;
suseconds_t usec = 0;
double diffTime;
--- trunk/playground/network/ksniffer/packetmanager.h #894429:894430
@@ -39,82 +39,201 @@
{
Q_OBJECT
-public:
- PacketManager( QObject *parent, const char *name, PortNumberNameList *pnnl );
- ~PacketManager();
+ public:
+ /**
+ * Constructor
+ */
+ PacketManager( QObject *parent, const char *name, PortNumberNameList *pnnl );
- /**
- * Set the frame number reference to get all needed information
- */
- void setFrameNumber( const long& num );
- long getFrameNumber() const;
+ /**
+ * Destructor
+ */
+ ~PacketManager();
- void setFilePath( const QString& tmp );
- void setFilename( const QString& tmpFile );
- QString tmpFilePath() const;
+ /**
+ * Set the frame number reference to get all needed information
+ *
+ * @param num is the frame number where to move in the pcap file
+ */
+ void setFrameNumber( const long& num );
- bpf_u_int32 frameCapturedLength();
- bpf_u_int32 frameLength();
- QString strTimeStamp() const;
- QString strAbsoluteTimeStamp() const;
- QString strRelativeTimeStamp() const;
- QString strDiffTimePrevious() const;
- QString strDiffTimeFirst() const;
- QString strDetailTimeStamp() const;
+ /**
+ * @returns the frame number where the Packet Manager reference is now
+ */
+ long getFrameNumber() const;
- QString strSourceAddress();
- QString strDestinationAddress();
- QString strProtocol();
- QString strProtocolServiceName();
- QString strInfo();
- int getFrameHType();
- int getFrameHLength() const;
- ptrPacketType getPacket();
- int packetSize() const;
+ /**
+ * Set the pcap file path where to get the packets data
+ *
+ * @param tmp is the file path
+ */
+ void setFilePath( const QString& tmp );
- /**
- * Clean the packet vector.
- */
- void clearList();
+ /**
+ * Set the pcap file name where to get the packets data
+ *
+ * @param tmpFile is the filename
+ */
+ void setFilename( const QString& tmpFile );
- /**
- * Did we get any packets?
- * @return true if there are any packets into the packet vector.
- */
- bool packetAvailable();
+ /**
+ * @returns the pcap file path where the Packet Manager is using to get the \
packets data + */
+ QString tmpFilePath() const;
- /**
- * @return number of available packets.
- */
- long numberOfPackets();
+ /**
+ * @returns the current frame captured lenght
+ */
+ bpf_u_int32 frameCapturedLength();
-protected slots:
- /**
- * Use this slot to save a new packet
- */
- void savePacket( ptrPacketType p, struct pcap_pkthdr packetHeader, long ord, int \
frameType, int frameLen ); + /**
+ * @returns the current frame lenght
+ */
+ bpf_u_int32 frameLength();
-signals:
- /**
- * A packet was saved
- */
- void savedPacket( long ord, PacketManager *packetManager );
+ /**
+ * @returns the current frame timestamp
+ */
+ QString strTimeStamp() const;
-private:
- Packet m_packet;
- Packet m_lastPacket; // you need it to give a value to strDiffTimePrevious(): \
difference time between a packet and its previous one
- Packet m_firstPacket;
+ /**
+ * @returns the current frame timestamp delay related to the previous frame
+ */
+ QString strDiffTimePrevious() const;
- long m_frameNumber; // the current frame number you got the packet detailed \
information + /**
+ * @returns the current frame timestamp delay related to the first frame
+ */
+ QString strDiffTimeFirst() const;
- QString m_strFilePath;
- bool m_bPacketAvailable;
- int m_packetSize;
+ /**
+ * @returns the current frame timestamp
+ */
+ QString strDetailTimeStamp() const;
- PortNumberNameList *m_portNumberNameList;
+ /**
+ * @returns the source address from the current frame
+ */
+ QString strSourceAddress();
-private:
- void setHeaderData(pcap_t *pHandler, int &frameType, int &hdrLen);
+ /**
+ * @returns the destination address from the current frame
+ */
+ QString strDestinationAddress();
+
+ /**
+ * @returns the protocol from the current frame (IP protocol or ARP)
+ */
+ QString strProtocol();
+
+ /**
+ * @returns the protocol from the current frame (IP protocol from /etc/services \
or ARP) + */
+ QString strProtocolServiceName();
+
+ /**
+ * @returns string for the 'information' column in the view
+ */
+ QString strInfo();
+
+ /**
+ * @returns the frame header type
+ */
+ int getFrameHType();
+
+ /**
+ * @returns the frame header length
+ */
+ int getFrameHLength() const;
+
+ /**
+ * @returns the reference to the current packet
+ */
+ ptrPacketType getPacket();
+
+ /**
+ * @returns the current packet length
+ */
+ int packetSize() const;
+
+ /**
+ * Clean the packet vector.
+ */
+ void clearList();
+
+ /**
+ * Did we get any packets?
+ * @return true if there are any packets available
+ */
+ bool packetAvailable();
+
+ /**
+ * @return number of available packets.
+ */
+ long numberOfPackets();
+
+ protected slots:
+ /**
+ * Use this slot to save a new packet
+ */
+ void savePacket( ptrPacketType p, struct pcap_pkthdr packetHeader, long ord, int \
frameType, int frameLen ); +
+ signals:
+ /**
+ * A packet was saved
+ */
+ void savedPacket( long ord, PacketManager *packetManager );
+
+ private:
+ /**
+ * The current Packet
+ */
+ Packet m_packet;
+
+ /**
+ * The last packet: you need it to give a value to strDiffTimePrevious(): \
difference time between a packet and its previous one + */
+ Packet m_lastPacket;
+
+ /**
+ * The first packet
+ */
+ Packet m_firstPacket;
+
+ /**
+ * the current frame number from where you can get the packet detailed \
information + */
+ long m_frameNumber;
+
+ /**
+ * The file path from where you get packets data
+ */
+ QString m_strFilePath;
+
+ /**
+ * True if packet available
+ */
+ bool m_bPacketAvailable;
+
+ /**
+ * The current packet size
+ */
+ int m_packetSize;
+
+ /**
+ * A reference to the /etc/services data
+ */
+ PortNumberNameList *m_portNumberNameList;
+
+ private:
+ /**
+ * Set the header data
+ *
+ * @param pHandler is the packet handler
+ * @param frameType is the frame type
+ * @param hdrLen is the header length
+ */
+ void setHeaderData(pcap_t *pHandler, int &frameType, int &hdrLen);
};
#endif // PACKETMANAGER_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic