author | Markus Bröker <mbroeker@largo.homelinux.org> |
Tue, 02 Feb 2010 13:26:30 +0100 | |
changeset 8 | 6097dc1fe2cf |
parent 4 | fdf04a93faeb |
permissions | -rw-r--r-- |
0
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
1 |
/* |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
2 |
* $Id: PacketReader.h 2 2007-12-22 14:15:30Z mbroeker $ |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
3 |
* $URL: http://localhost/svn/cpp/qMonitor/trunk/include/PacketReader.h $ |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
4 |
*/ |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
5 |
|
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
6 |
#ifndef PacketReader_H |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
7 |
#define PacketReader_H |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
8 |
|
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
9 |
#include <string> |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
10 |
#include <stdexcept> |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
11 |
#include <iostream> |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
12 |
|
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
13 |
extern "C" { |
3
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
14 |
#include <sys/socket.h> |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
15 |
#include <netinet/if_ether.h> |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
16 |
#include <netinet/ip.h> |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
17 |
#include <sys/poll.h> |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
18 |
#include <fcntl.h> |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
19 |
#include <sys/types.h> |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
20 |
#include <unistd.h> |
0
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
21 |
}; |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
22 |
|
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
23 |
class PacketReader { |
3
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
24 |
protected: |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
25 |
int p_socket; |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
26 |
private: |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
27 |
int timeout; |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
28 |
public: |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
29 |
PacketReader (int tm = 500); |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
30 |
PacketReader (std::string); |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
31 |
~PacketReader (); |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
32 |
std::string read (); |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
33 |
bool ready (); |
724e07a9f155
PacketWriter.cpp: cstdlib header added
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
0
diff
changeset
|
34 |
bool dataAvailable (); |
0
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
35 |
}; |
826dd5531eb0
svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
36 |
#endif |