Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

SendWindow.h

Go to the documentation of this file.
00001 #ifndef __SENDWINDOW_H
00002 #define __SENDWINDOW_H
00003 
00004 #include <deque>
00005 #include "ThreadMessageQueue.h"
00006 #include "WindowPosition.h"
00007 #include "TimeValue.h"
00008 
00009 class SendWindow;
00010 class SAR;
00011 
00012 class SendWindowThreadArg
00013 {
00014 public:
00015     SendWindowThreadArg(SendWindow* sw, WindowPosition num);
00016     SendWindow* sw;
00017     WindowPosition num;
00018 };
00019 
00020 class SendWindow : public BasicObject
00021 {
00022 public:
00023         SendWindow(int size, SAR* sar);
00024         ~SendWindow();
00025 
00026     TimeValue getRtt();
00027     int reliableSend(u_char* data, int dataLength); 
00028         void onAckRecvd(int numAcked, int credits, bool retrans); 
00029         void end();
00030 
00031     virtual void toStream(std::ostream& out);
00032 
00033 private:
00034         void removePacket(int seqNum);
00035         int addPacket(TpPacket* packet);
00036     ThreadMessageQueue<Packet>* initialSegmentation();
00037     TpPacket* segment();
00038     void sendEmptyPacket();
00039     bool windowFull();
00040         static void* sentPacketTimeout(void* arg);
00041     void sentPacketTimeoutImpl(WindowPosition);
00042     void computeEffectiveWindow();
00043     void dumpDebug();
00044 
00046     u_char* m_data;
00047 
00049     int m_dataLength;
00050 
00052     int m_currentPosition;
00053 
00055     CallbackTimer m_packetTimeoutCallbackTimer;
00056 
00058         vector<bool*> m_needSend;
00059 
00061         vector<TimeValue> m_timeStamp;
00062 
00064     vector<int> m_retries;
00065 
00067         SAR* m_sar;
00068 
00070         WindowPosition m_lastAckRecv;
00071 
00073         WindowPosition m_lastPacketSent;
00074 
00076     WindowPosition m_firstPacketSent;
00077 
00079     Counter m_packetSequenceNum;
00080 
00082         int m_effectiveWindow;
00083         
00085     bool m_sending;
00086         
00088     bool m_end;
00089 
00091     int m_credits;
00092 
00094     TimeValue m_rtt;
00095         
00097     Condition m_terminate;
00098 
00100     Condition m_ackSignal;
00101 
00103         int m_size;
00104 
00106     Mutex m_sendWindowLock;
00107 
00109     vector<TpPacket*> m_window;
00110 
00111 };
00112 
00113 #endif // __SEND_WINDOW_H

Generated at Thu Jul 11 13:31:52 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001