summaryrefslogtreecommitdiff
path: root/src/packetSource.h
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2010-01-13 00:35:15 +0000
committerChristian Pointner <equinox@anytun.org>2010-01-13 00:35:15 +0000
commit6db69370bd4a1ba3a54bcef9e2b7c03da2bd435b (patch)
tree0a48338d0e5a89d97ee21a24009ceeb79ada0b1c /src/packetSource.h
parentbetter speration of waitForScript and waitAndDestroy() (diff)
added mutli socket recv to packet source
Diffstat (limited to 'src/packetSource.h')
-rw-r--r--src/packetSource.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/packetSource.h b/src/packetSource.h
index ffc14bf..ceac34b 100644
--- a/src/packetSource.h
+++ b/src/packetSource.h
@@ -35,6 +35,7 @@
#include <boost/asio.hpp>
#include <list>
+#include <queue>
#include "datatypes.h"
#include "threadUtils.hpp"
@@ -72,9 +73,27 @@ public:
void onError(const std::runtime_error& e);
private:
-
boost::asio::io_service io_service_;
- std::list<proto::socket*> sockets_;
+
+ typedef struct {
+ u_int8_t* buf_;
+ u_int32_t len_;
+ proto::socket* sock_;
+ } sockets_element_t;
+ std::list<sockets_element_t> sockets_;
+
+ typedef struct {
+ u_int8_t* buf_;
+ u_int32_t len_;
+ proto::socket* sock_;
+ PacketSourceEndpoint remote_;
+ } thread_result_t;
+ std::queue<thread_result_t> thread_result_queue_;
+ Mutex thread_result_mutex_;
+ Semaphore thread_result_sem_;
+ sockets_element_t last_recv_sock_;
+
+ void recv_thread(thread_result_t result);
};
#endif