Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/connection_monitor.h @ 8362

Last change on this file since 8362 was 8362, checked in by bensch, 18 years ago

orxonox/trunk: removed stupid included in base_object.h
this should lead to faster compile-times

File size: 1.8 KB
RevLine 
[5523]1/*!
2 * @file connection_monitor.h
3    \brief provides information about the quality of a connection.
[5550]4 */
[5523]5
[5550]6#ifndef _CONNECTION_MONITOR_H
7#define _CONNECTION_MONITOR_H
[5523]8
[5581]9#include "base_object.h"
[5550]10#include "netdefs.h"
[5547]11
[7954]12#include <map>
[8362]13#include <list>
[7954]14
15#define N_PACKETS_FOR_PING 20
16#define MSECS_TO_CALC_BWIDTH 1000
17#define SECS_TO_TIMEOUT 10
18
[5581]19class ConnectionMonitor : virtual public BaseObject
[7954]20{
[5618]21  public:
[7954]22    ConnectionMonitor( int userId );
[6981]23    virtual ~ConnectionMonitor();
[5523]24
[8068]25    void processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId );
26    void processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState );
[8362]27
[8068]28    void processZippedOutgoingPacket( int tick, byte * data, int length, int stateId );
29    void processZippedIncomingPacket( int tick, byte * data, int length );
[8362]30
[7954]31    void calculatePing();
[8362]32
[7954]33    bool hasTimedOut();
[8362]34
[7954]35    void printStatis();
[8362]36
[5618]37  private:
[7954]38    float calculateBandWidth( std::map<int,int> packetHistory, int tick );
[5523]39
[8362]40    int userId;       //!< user's id
41
[7954]42    std::map<int,int>   sentStateTicks;
[8362]43
[7954]44    std::map<int,int>   incomingUnzippedPacketHistory;
45    std::map<int,int>   outgoingUnzippedPacketHistory;
[8362]46
[7954]47    std::map<int,int>   incomingZippedPacketHistory;
48    std::map<int,int>   outgoingZippedPacketHistory;
[8362]49
[7954]50    std::list<int>      ackDelay;
51    int                 ping;
[5581]52
[7954]53    float               incomingUnzippedBandWidth;
54    float               outgoingUnzippedBandWidth;
[8362]55
[7954]56    float               incomingZippedBandWidth;
57    float               outgoingZippedBandWidth;
[8362]58
[7954]59    int                 nIncomingPackets;
60    int                 nOutgoingPackets;
[8362]61
[7954]62    int                 nZIncomingPackets;
63    int                 nZOutgoingPackets;
[8362]64
[7954]65    int                 lastPacketTick;
[8362]66
[7954]67    int                 lastPrintTick;
[5618]68  };
[5550]69
70#endif
Note: See TracBrowser for help on using the repository browser.