tcp-fs.h

Go to the documentation of this file.
00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
00002 /*
00003  * Copyright (c) 1997 Regents of the University of California.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. All advertising materials mentioning features or use of this software
00015  *    must display the following acknowledgement:
00016  *  This product includes software developed by the Daedalus Research
00017  *  Group at the University of California Berkeley.
00018  * 4. Neither the name of the University nor of the Laboratory may be used
00019  *    to endorse or promote products derived from this software without
00020  *    specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  *
00034  * Contributed by the Daedalus Research Group, U.C.Berkeley
00035  * http://daedalus.cs.berkeley.edu
00036  */
00037 
00038 #ifndef ns_tcp_fs_h
00039 #define ns_tcp_fs_h
00040 
00041 #include "tcp.h"
00042 #include "ip.h"
00043 #include "flags.h"
00044 #include "random.h"
00045 #include "template.h"
00046 #include "tcp-fack.h"
00047 
00048 class ResetTimer : public TimerHandler {
00049 public: 
00050     ResetTimer(TcpAgent *a) : TimerHandler() { a_ = a; }
00051 protected:
00052     virtual void expire(Event *e);
00053     TcpAgent *a_;
00054 };
00055 
00056 /* TCP-FS with Tahoe */
00057 class TcpFsAgent : public virtual TcpAgent {
00058 public:
00059     TcpFsAgent() : t_exact_srtt_(0), t_exact_rttvar_(0), last_recv_time_(0), 
00060         fs_startseq_(0), fs_endseq_(0), fs_mode_(0), count_bytes_acked_(0),
00061         reset_timer_(this) 
00062     {
00063         bind_bool("fast_loss_recov_", &fast_loss_recov_);
00064         bind_bool("fast_reset_timer_", &fast_reset_timer_);
00065         bind_bool("count_bytes_acked_", &count_bytes_acked_);
00066         bind_bool("fs_enable_", &fs_enable_);
00067     }
00068 
00069     /* helper functions */
00070     virtual void output_helper(Packet* pkt);
00071     virtual void recv_helper(Packet* pkt);
00072     virtual void send_helper(int maxburst);
00073     virtual void send_idle_helper();
00074     virtual void recv_newack_helper(Packet* pkt);
00075     virtual void partialnewack_helper(Packet*) {};
00076 
00077     virtual void set_rtx_timer();
00078     virtual void cancel_rtx_timer();
00079     virtual void cancel_timers();
00080     virtual void timeout_nonrtx(int tno);
00081     virtual void timeout_nonrtx_helper(int tno);
00082     double rtt_exact_timeout() { return (t_exact_srtt_ + 4*t_exact_rttvar_);}
00083 protected:
00084     double t_exact_srtt_;
00085     double t_exact_rttvar_;
00086     double last_recv_time_;
00087     int fs_startseq_;
00088     int fs_endseq_;
00089     int fs_mode_;
00090     int fs_enable_;
00091     int fast_loss_recov_;
00092     int fast_reset_timer_;
00093     int count_bytes_acked_;
00094     ResetTimer reset_timer_;
00095 };
00096 
00097 /* TCP-FS with Reno */
00098 class RenoTcpFsAgent : public RenoTcpAgent, public TcpFsAgent {
00099 public:
00100     RenoTcpFsAgent() : RenoTcpAgent(), TcpFsAgent() {}
00101 
00102     /* helper functions */
00103     virtual void output_helper(Packet* pkt) {TcpFsAgent::output_helper(pkt);}
00104     virtual void recv_helper(Packet* pkt) {TcpFsAgent::recv_helper(pkt);}
00105     virtual void send_helper(int maxburst) {TcpFsAgent::send_helper(maxburst);}
00106     virtual void send_idle_helper() {TcpFsAgent::send_idle_helper();}
00107     virtual void recv_newack_helper(Packet* pkt) {TcpFsAgent::recv_newack_helper(pkt);}
00108 
00109     virtual void set_rtx_timer() {TcpFsAgent::set_rtx_timer();}
00110     virtual void cancel_rtx_timer() {TcpFsAgent::cancel_rtx_timer();}
00111     virtual void cancel_timers(){TcpFsAgent::cancel_timers();}
00112     virtual void timeout_nonrtx(int tno) {TcpFsAgent::timeout_nonrtx(tno);}
00113     virtual void timeout_nonrtx_helper(int tno);
00114 };
00115 
00116 /* TCP-FS with NewReno */
00117 class NewRenoTcpFsAgent : public virtual NewRenoTcpAgent, public TcpFsAgent {
00118 public:
00119     NewRenoTcpFsAgent() : NewRenoTcpAgent(), TcpFsAgent() {}
00120 
00121     /* helper functions */
00122     virtual void output_helper(Packet* pkt) {TcpFsAgent::output_helper(pkt);}
00123     virtual void recv_helper(Packet* pkt) {TcpFsAgent::recv_helper(pkt);}
00124     virtual void send_helper(int maxburst) {TcpFsAgent::send_helper(maxburst);}
00125     virtual void send_idle_helper() {TcpFsAgent::send_idle_helper();}
00126     virtual void recv_newack_helper(Packet* pkt) {TcpFsAgent::recv_newack_helper(pkt);}
00127     virtual void partialnewack_helper(Packet* pkt);
00128 
00129     virtual void set_rtx_timer() {TcpFsAgent::set_rtx_timer();}
00130     virtual void cancel_rtx_timer() {TcpFsAgent::cancel_rtx_timer();}
00131     virtual void cancel_timers(){TcpFsAgent::cancel_timers();}
00132     virtual void timeout_nonrtx(int tno) {TcpFsAgent::timeout_nonrtx(tno);}
00133     virtual void timeout_nonrtx_helper(int tno);
00134 };
00135 
00136 #ifdef USE_FACK
00137 /* TCP-FS with Fack */
00138 class FackTcpFsAgent : public FackTcpAgent, public TcpFsAgent {
00139 public:
00140     FackTcpFsAgent() : FackTcpAgent(), TcpFsAgent() {}
00141 
00142     /* helper functions */
00143     virtual void output_helper(Packet* pkt) {TcpFsAgent::output_helper(pkt);}
00144     virtual void recv_helper(Packet* pkt) {TcpFsAgent::recv_helper(pkt);}
00145     virtual void send_helper(int maxburst);
00146     virtual void send_idle_helper() {TcpFsAgent::send_idle_helper();}
00147     virtual void recv_newack_helper(Packet* pkt) {TcpFsAgent::recv_newack_helper(pkt);}
00148     virtual void set_rtx_timer() {TcpFsAgent::set_rtx_timer();}
00149     virtual void cancel_rtx_timer() {TcpFsAgent::cancel_rtx_timer();}
00150     virtual void cancel_timers(){TcpFsAgent::cancel_timers();}
00151     virtual void timeout_nonrtx(int tno) {TcpFsAgent::timeout_nonrtx(tno);}
00152     virtual void timeout_nonrtx_helper(int tno);
00153 };
00154 #endif
00155 
00156 #endif

Generated on Tue Mar 6 16:47:52 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6