00001 /* 00002 * Copyright (c) 2006-2007 by the Protocol Engineering Lab, U of Delaware 00003 * All rights reserved. 00004 * 00005 * Protocol Engineering Lab web page : http://pel.cis.udel.edu/ 00006 * 00007 * Paul D. Amer <amer@@cis,udel,edu> 00008 * Janardhan R. Iyengar <iyengar@@cis,udel,edu> 00009 * Preethi Natarajan <nataraja@@cis,udel,edu> 00010 * Nasif Ekiz <nekiz@@cis,udel,edu> 00011 * 00012 * Redistribution and use in source and binary forms, with or without 00013 * modification, are permitted provided that the following conditions 00014 * are met: 00015 * 00016 * 1. Redistributions of source code must retain the above copyright 00017 * notice, this list of conditions and the following disclaimer. 00018 * 00019 * 2. Redistributions in binary form must reproduce the above copyright 00020 * notice, this list of conditions and the following disclaimer in the 00021 * documentation and/or other materials provided with the distribution. 00022 * 00023 * 3. Neither the name of the University nor of the Laboratory may be used 00024 * to endorse or promote products derived from this software without 00025 * specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00028 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00030 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00031 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00032 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00033 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00034 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00035 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00036 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00037 * SUCH DAMAGE. 00038 */ 00039 00040 /* Concurrent Multipath Transfer extension: To allow SCTP to correctly use 00041 * multiple paths available at the transport. 00042 */ 00043 00044 #ifndef ns_sctp_cmt_h 00045 #define ns_sctp_cmt_h 00046 00047 00048 #include "agent.h" 00049 #include "node.h" 00050 #include "packet.h" 00051 #include "sctp.h" 00052 00053 /* CMT rtx policies 00054 */ 00055 typedef enum CmtRtxPolicy_E 00056 { 00057 RTX_ASAP, 00058 RTX_TO_SAME, 00059 RTX_SSTHRESH, 00060 RTX_LOSSRATE, 00061 RTX_CWND 00062 }; 00063 00064 class SctpCMTAgent : public virtual SctpAgent 00065 { 00066 public: 00067 00068 SctpCMTAgent(); 00069 void Timeout(SctpChunkType_E, SctpDest_S*); 00070 void SackGenTimerExpiration(); 00071 00072 protected: 00073 00074 void delay_bind_init_all(); 00075 int delay_bind_dispatch(const char *varName, const char *localName, 00076 TclObject *tracer); 00077 00078 /* initialization stuff 00079 */ 00080 void OptionReset(); 00081 void Reset(); 00082 00083 /* tracing functions 00084 */ 00085 void TraceAll(); 00086 void TraceVar(const char*); 00087 void trace(TracedVar*); 00088 00089 /* sending functions 00090 */ 00091 void AddToSendBuffer(SctpDataChunkHdr_S *, int, u_int, SctpDest_S *); 00092 int GenChunk(SctpChunkType_E, u_char *); 00093 void SendBufferDequeueUpTo(u_int); 00094 void FastRtx(); 00095 Boolean_E AnyMarkedChunks(); 00096 void MarkChunkForRtx(SctpSendBufferNode_S *, MarkedForRtx_E); 00097 void RtxMarkedChunks(SctpRtxLimit_E); 00098 void recv(Packet *pkt, Handler*); 00099 void SendMuch(); 00100 00101 /* processing functions 00102 */ 00103 Boolean_E ProcessGapAckBlocks(u_char *, Boolean_E); 00104 void ProcessSackChunk(u_char *); 00105 int ProcessChunk(u_char *, u_char **); 00106 u_int GetHighestOutstandingTsn(SctpDest_S *); 00107 void HeartbeatGenTimerExpiration(double); 00108 00109 /* new CMT functions 00110 */ 00111 SctpDest_S* SelectRtxDest(SctpSendBufferNode_S*, SctpRtxLimit_E); 00112 void SetSharedCCParams(SctpDest_S*); 00113 char* PrintDestStatus(SctpDest_S*); 00114 00115 /* new CMT-PF function 00116 */ 00117 SctpDest_S* SelectFromPFDests(); 00118 00119 00120 /******* Variables *******/ 00121 00122 /* JRI-TODO: Take out options for SFR and CUC algos. 00123 */ 00124 Boolean_E eUseCmtReordering; // use CMT's reordering algo? (was CACC) 00125 Boolean_E eUseCmtCwnd; // use CMT's cwnd growth algo? 00126 Boolean_E eUseCmtDelAck; // use CMT's delayed ack algo? 00127 00128 /* Variables for CMT delayed ack algo 00129 */ 00130 u_int uiNumPacketsSacked; // number of packets acked by SACK (sack->flags) 00131 u_int uiNumDestsSacked; // number of dests acked by SACK (inferred) 00132 00133 CmtRtxPolicy_E eCmtRtxPolicy; 00134 00135 /* CMT-PF: Use the possibly failed state in RTX_SSTHRESH policy? 00136 */ 00137 Boolean_E eUseCmtPF; 00138 00139 /* CMT-PF: Value for Cwnd when PF path becomes ACTIVE again. 00140 */ 00141 u_int uiCmtPFCwnd; 00142 00143 /* CMT-PF: Track last adv rwnd 00144 */ 00145 u_int uiArwnd; 00146 00147 /* CMT-PF: Trace variables 00148 */ 00149 TracedInt tiCountPFToActiveNewData; // Count of PF->Active state changes 00150 // for new data (in SendMuch) 00151 TracedInt tiCountPFToActiveRtxms; // Count of PF->Active state changes 00152 // for retransmissions (in SelectRtxDest) 00153 }; 00154 00155 #endif