Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/network_stream.h @ 6061

Last change on this file since 6061 was 6060, checked in by bwuest, 18 years ago

Network changes

File size: 1.5 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 <vector>
10#include <list>
11
12#include "data_stream.h"
13#include "network_protocol.h"
14#include "server_socket.h"
15#include "handshake.h"
16
17class Synchronizeable;
18class NetworkSocket;
19class ServerSocket;
20class ConnectionMonitor;
21class NetworkProtocol;
22
23typedef std::list<Synchronizeable*>  SynchronizeableList;
24typedef std::vector<NetworkSocket*>  NetworkSocketVector;
25typedef std::vector<Handshake*>      HandshakeVector;
26
27
28class NetworkStream : public DataStream
29{
30
31  public:
32    NetworkStream();
33    NetworkStream(IPaddress& address);
34    NetworkStream(unsigned int port);
35
36    ~NetworkStream();
37    void init();
38
39    void connectSynchronizeable(Synchronizeable& sync);
40    void disconnectSynchronizeable(Synchronizeable& sync);
41
42    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
43    inline bool isActive() const { return this->bActive; }
44
45    virtual void processData();
46
47  private:
48    NetworkProtocol*       networkProtocol;
49    ConnectionMonitor*     connectionMonitor;
50    SynchronizeableList    synchronizeables;
51    NetworkSocketVector    networkSockets;
52    HandshakeVector        handshakes;
53    ServerSocket*          serverSocket;
54    int                    type;
55    Header                 packetHeader;
56    bool                   bActive;
57    std::list<int>         freeSocketSlots;
58
59    int                    myHostId;
60
61    void updateConnectionList();
62};
63#endif /* _NETWORK_STREAM */
Note: See TracBrowser for help on using the repository browser.