00001 /* 00002 * Copyright (c) 2001-2004 by the Protocol Engineering Lab, U of Delaware 00003 * All rights reserved. 00004 * 00005 * Armando L. Caro Jr. <acaro@@cis,udel,edu> 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the distribution. 00017 * 00018 * 3. 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 * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/sctp/sctp-timestamp.h,v 1.3 2005/10/07 05:58:29 tomh Exp $ (UD/PEL) 00035 */ 00036 00037 /* Timestamp extension adds a TIMESTAMP chunk into every packet with DATA 00038 * or SACK chunk(s). The timestamps allow RTT measurements to be made per 00039 * packet on both original transmissiosn and retransmissions. Thus, Karn's 00040 * algorithm is no longer needed. 00041 */ 00042 00043 #ifndef ns_sctp_timestamp_h 00044 #define ns_sctp_timestamp_h 00045 00046 #include "sctp.h" 00047 00048 /* Timestamp Specific Flags 00049 */ 00050 #define SCTP_TIMESTAMP_FLAG_TS 0x01 // indicates a timestamp in the chunk 00051 #define SCTP_TIMESTAMP_FLAG_ECHO 0x02 // indicates a timestamp echo in chunk 00052 00053 typedef struct SctpTimestampChunk_S 00054 { 00055 SctpChunkHdr_S sHdr; 00056 float fTimestamp; 00057 float fEcho; 00058 }; 00059 00060 class TimestampSctpAgent : public virtual SctpAgent 00061 { 00062 public: 00063 TimestampSctpAgent(); 00064 00065 protected: 00066 virtual void delay_bind_init_all(); 00067 virtual int delay_bind_dispatch(const char *varName, const char *localName, 00068 TclObject *tracer); 00069 00070 /* initialization stuff 00071 */ 00072 virtual void OptionReset(); 00073 virtual u_int ControlChunkReservation(); 00074 00075 /* chunk generation functions 00076 */ 00077 virtual int BundleControlChunks(u_char *); 00078 00079 /* sending functions 00080 */ 00081 virtual void AddToSendBuffer(SctpDataChunkHdr_S *, int, u_int, SctpDest_S *); 00082 virtual void SendBufferDequeueUpTo(u_int); 00083 virtual void RtxMarkedChunks(SctpRtxLimit_E); 00084 00085 /* process functions 00086 */ 00087 virtual Boolean_E ProcessGapAckBlocks(u_char *, Boolean_E); 00088 virtual void ProcessOptionChunk(u_char *); 00089 void ProcessTimestampChunk(SctpTimestampChunk_S *); 00090 00091 Boolean_E eNeedTimestampEcho; // does next pkt need timestamp echo? 00092 float fOutTimestampEcho; // outgoing timestamp chunk will carry this echo 00093 float fInTimestampEcho; // incoming timestamp echoed back to sender 00094 }; 00095 00096 #endif
1.4.6