|
Last change
on this file since 5875 was
5822,
checked in by bensch, 20 years ago
|
|
orxonox/trunk: merged branches/network to the trunk
merged with command:
svn merge -r 5505:HEAD branches/network trunk
conflicts resolved in favor of the trunk (as always 
also fixed a typo in the #include "SDL_tread.h"
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | * @file network_stream.h |
|---|
| 3 | * implementation of a network pipe |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _NETWORK_STREAM |
|---|
| 7 | #define _NETWORK_STREAM |
|---|
| 8 | |
|---|
| 9 | #include "data_stream.h" |
|---|
| 10 | #include "network_protocol.h" |
|---|
| 11 | |
|---|
| 12 | class Synchronizeable; |
|---|
| 13 | class NetworkSocket; |
|---|
| 14 | class ConnectionMonitor; |
|---|
| 15 | class NetworkProtocol; |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | //<! The state of the NetworkStream |
|---|
| 19 | typedef enum NetStat { |
|---|
| 20 | NET_REC_HEADER = 0, //!< Waiting for header |
|---|
| 21 | NET_REC_DATA, //!< Waiting for data |
|---|
| 22 | |
|---|
| 23 | NUM_STATES //!< Number of states |
|---|
| 24 | }; |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | class NetworkStream : public DataStream |
|---|
| 28 | { |
|---|
| 29 | |
|---|
| 30 | public: |
|---|
| 31 | NetworkStream(); |
|---|
| 32 | NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type); |
|---|
| 33 | NetworkStream(unsigned int port, Synchronizeable& sync, NodeType type); |
|---|
| 34 | ~NetworkStream(); |
|---|
| 35 | |
|---|
| 36 | void init(); |
|---|
| 37 | |
|---|
| 38 | inline bool isServer() { return (this->type == NET_SERVER)? true:false; } |
|---|
| 39 | virtual void processData(); |
|---|
| 40 | |
|---|
| 41 | private: |
|---|
| 42 | NetworkProtocol* networkProtocol; |
|---|
| 43 | //NetworkSocket* networkSockets; |
|---|
| 44 | ConnectionMonitor* connectionMonitor; |
|---|
| 45 | // tList<Synchronizeable>* synchronizeables; |
|---|
| 46 | Synchronizeable* synchronizeables; |
|---|
| 47 | NetworkSocket* networkSocket; |
|---|
| 48 | int type; |
|---|
| 49 | int state; |
|---|
| 50 | Header packetHeader; |
|---|
| 51 | }; |
|---|
| 52 | #endif /* _NETWORK_STREAM */ |
|---|
| 53 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.