PacketWriter.cpp: cstdlib header added draft
authorMarkus Bröker <mbroeker@largo.homelinux.org>
Sat, 13 Dec 2008 15:47:48 +0100
changeset 3 724e07a9f155
parent 2 62ddf5dd4db0
child 4 fdf04a93faeb
PacketWriter.cpp: cstdlib header added Source Base indented with GNU indent
PacketWriter.cpp
include/PacketParser.h
include/PacketReader.h
include/PacketWriter.h
include/monitor.h
include/readerthread.h
include/tools.h
include/version.h
--- a/PacketWriter.cpp
+++ b/PacketWriter.cpp
@@ -4,6 +4,7 @@
  */
 
 #include <PacketWriter.h>
+#include <cstdlib>
 
 extern "C" {
 #include <sys/socket.h>
--- a/include/PacketParser.h
+++ b/include/PacketParser.h
@@ -17,30 +17,26 @@
 #include <netinet/tcp.h>
 #include <netinet/udp.h>
 #include <netinet/ip_icmp.h>
-}
+} class PacketParser:public PacketReader {
+  public:
+    PacketParser (int tm = 500);
+      PacketParser (std::string);
+     ~PacketParser ();
+      std::string read ();
+      std::string getPacket ();
+    void setPort (unsigned short);
+    void setProtocol (int);
+      std::string getProtocol (int);
 
-class PacketParser : public PacketReader
-{
- public:
-	PacketParser ( int tm=500 );
-	PacketParser ( std::string );
-	~PacketParser ();
-	std::string read();
-	std::string getPacket();
-	void setPort(unsigned short);
-	void setProtocol(int);
-	std::string getProtocol(int);
+  private:
+      std::string str;
+    int protocol;
+    unsigned short port;
 
- private:
-	std::string str;
-	int protocol;
-	unsigned short port;
-
-	std::string shost;
-	std::string dhost;
-	unsigned short sport, dport;
-	struct protoent *proto;
+      std::string shost;
+      std::string dhost;
+    unsigned short sport, dport;
+    struct protoent *proto;
 };
 
 #endif
-
--- a/include/PacketReader.h
+++ b/include/PacketReader.h
@@ -11,27 +11,27 @@
 #include <iostream>
 
 extern "C" {
-	#include <sys/socket.h>
-	#include <netinet/if_ether.h>
-	#include <netinet/ip.h>
-	#include <sys/poll.h>
-	#include <fcntl.h>
-	#include <sys/types.h>
-	#include <unistd.h>
+#include <sys/socket.h>
+#include <netinet/if_ether.h>
+#include <netinet/ip.h>
+#include <sys/poll.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
 };
 
 class PacketReader {
-protected:
-	int p_socket;
- private:
-	int timeout;
-public:
-	PacketReader ( int tm = 500 );
-	PacketReader ( std::string );
-	~PacketReader();
-	std::string read();
-	bool ready();
-	bool dataAvailable();
+  protected:
+    int p_socket;
+  private:
+    int timeout;
+  public:
+      PacketReader (int tm = 500);
+      PacketReader (std::string);
+     ~PacketReader ();
+      std::string read ();
+    bool ready ();
+    bool dataAvailable ();
 };
 
 #endif
--- a/include/PacketWriter.h
+++ b/include/PacketWriter.h
@@ -12,17 +12,16 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 
-class PacketWriter : PacketReader {
-private:
-	struct sockaddr_in ca;
+class PacketWriter:PacketReader {
+  private:
+    struct sockaddr_in ca;
 
-public:
-	PacketWriter(char *, int);
-	~PacketWriter();
+  public:
+      PacketWriter (char *, int);
+     ~PacketWriter ();
 
-	void write(char *s, int);
-	bool ready();
+    void write (char *s, int);
+    bool ready ();
 };
 
 #endif
-
--- a/include/monitor.h
+++ b/include/monitor.h
@@ -12,26 +12,22 @@
 
 class readerThread;
 
-class Monitor : public QWidget, private Ui::qMonitor
-{
-	Q_OBJECT
-
-    public:
-	Monitor(QWidget *parent = 0);
-	virtual ~Monitor();
-	int getPort();
-	int getProtocol();
+class Monitor:public QWidget, private Ui::qMonitor {
+  Q_OBJECT public:
+    Monitor (QWidget * parent = 0);
+    virtual ~ Monitor ();
+    int getPort ();
+    int getProtocol ();
 
- protected:
-	virtual void customEvent( QEvent* );
-	std::map<QString, int> Protocol;
+  protected:
+    virtual void customEvent (QEvent *);
+    std::map < QString, int >Protocol;
 
- private:
-	readerThread *reader;
+  private:
+    readerThread * reader;
 
-     public slots:
-	virtual void startCapture();
-	virtual void stopCapture();
+    public slots:virtual void startCapture ();
+    virtual void stopCapture ();
 
 };
 
--- a/include/readerthread.h
+++ b/include/readerthread.h
@@ -15,26 +15,26 @@
 
 class Monitor;
 
-class DataChangeEvent : public QEvent {
- public:
-	DataChangeEvent(QString msg_)
-		: QEvent((QEvent::Type)MSG_EVENT)
-		{
-			msg = msg_;
+class DataChangeEvent:public QEvent {
+  public:
+    DataChangeEvent (QString msg_)
+    :QEvent ((QEvent::Type) MSG_EVENT) {
+        msg = msg_;
 
-		}
-
-	QString Text() const { return msg; }
- private:
-	QString msg;
+    }
+    QString Text () const {
+        return msg;
+    }
+  private:
+      QString msg;
 };
 
-class readerThread : public QThread {
- public:
-	readerThread(Monitor*);
-	virtual void run();
- private:
-	Monitor *handle;
+class readerThread:public QThread {
+  public:
+    readerThread (Monitor *);
+    virtual void run ();
+  private:
+      Monitor * handle;
 };
 
 #endif
--- a/include/tools.h
+++ b/include/tools.h
@@ -8,6 +8,6 @@
 
 #include <sstream>
 
-std::string itoa(const int& i);
+std::string itoa (const int &i);
 
 #endif
--- a/include/version.h
+++ b/include/version.h
@@ -8,4 +8,3 @@
 
 #define VERSION_STRING "qMonitor Revision 0.90"
 #endif
-