tcp-asym.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  * $Header: /nfs/jade/vint/CVSROOT/ns-2/tcp/tcp-asym.h,v 1.4 2000/09/01 03:04:07 haoboy Exp $
00038  */
00039 
00040 #ifndef ns_tcp_asym_h
00041 #define ns_tcp_asym_h
00042 #include "tcp.h"
00043 #include "ip.h"
00044 #include "flags.h"
00045 #include "random.h"
00046 #include "template.h"
00047 
00048 /* 
00049  * The TCP asym header. The sender includes information that the receiver could
00050  * use to decide by how much to delay acks.
00051  * XXXX some of the fields may not be needed
00052  */ 
00053 struct hdr_tcpasym {
00054     int ackcount_;          /* the number of segments this ack represents */
00055     int win_;               /* the amount of window remaining */
00056     int highest_ack_;       /* the highest ack seen */
00057     int max_left_to_send_;  /* the max. amount of data that remains to be sent */
00058 
00059     static int offset_; // offset for this header
00060     inline static int& offset() { return offset_; }
00061     inline static hdr_tcpasym* access(const Packet* p) {
00062         return (hdr_tcpasym*) p->access(offset_);
00063     }
00064 
00065     int& ackcount() { return (ackcount_); }
00066     int& win() { return (win_); }
00067     int& highest_ack() { return (highest_ack_); }
00068     int& max_left_to_send() { return (max_left_to_send_); }
00069 };
00070 
00071 
00072 /* TCP Asym with Tahoe */
00073 class TcpAsymAgent : public virtual TcpAgent {
00074 public:
00075     TcpAsymAgent();
00076 
00077     /* helper functions */
00078     virtual void output_helper(Packet* p);
00079     virtual void send_helper(int maxburst);
00080     virtual void recv_helper(Packet* p);
00081     virtual void recv_newack_helper(Packet* pkt);
00082     virtual void traceAll();
00083     virtual void traceVar(TracedVar* v);
00084 protected:
00085     int ecn_to_echo_;
00086     TracedDouble t_exact_srtt_;
00087 /*  TracedDouble avg_win_; */
00088     double g_;      /* gain used for exact_srtt_ smoothing */
00089     int damp_;
00090 };
00091 
00092 /* TCP Asym with Reno */
00093 class TcpRenoAsymAgent : public RenoTcpAgent,
00094              public TcpAsymAgent {
00095 public:
00096      TcpRenoAsymAgent() : RenoTcpAgent(), TcpAsymAgent() { }
00097 
00098     /* helper functions */
00099     virtual void output_helper(Packet* p) { TcpAsymAgent::output_helper(p); }
00100     virtual void send_helper(int maxburst) { TcpAsymAgent::send_helper(maxburst); }
00101     virtual void recv_helper(Packet* p) { TcpAsymAgent::recv_helper(p); }
00102     virtual void recv_newack_helper(Packet* pkt) { TcpAsymAgent::recv_newack_helper(pkt); }
00103 
00104 };
00105 
00106 /* TCP Asym with New Reno */
00107 class NewRenoTcpAsymAgent : public virtual NewRenoTcpAgent,
00108                 public TcpAsymAgent {
00109 public:
00110      NewRenoTcpAsymAgent() : NewRenoTcpAgent(), TcpAsymAgent() { }
00111 
00112     /* helper functions */
00113     virtual void output_helper(Packet* p) { TcpAsymAgent::output_helper(p); }
00114     virtual void send_helper(int maxburst) { TcpAsymAgent::send_helper(maxburst); }
00115     virtual void recv_helper(Packet* p) { TcpAsymAgent::recv_helper(p); }
00116     virtual void recv_newack_helper(Packet* pkt) { TcpAsymAgent::recv_newack_helper(pkt); }
00117 
00118 };
00119 
00120 #endif

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