sctp-timestamp.h
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
源码类别:

通讯编程

开发平台:

Visual C++

  1. /*
  2.  * Copyright (c) 2006-2007 by the Protocol Engineering Lab, U of Delaware
  3.  * All rights reserved.
  4.  *
  5.  * Protocol Engineering Lab web page : http://pel.cis.udel.edu/
  6.  *
  7.  * Paul D. Amer        <amer@@cis,udel,edu>
  8.  * Armando L. Caro Jr. <acaro@@cis,udel,edu>
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  *
  14.  * 1. Redistributions of source code must retain the above copyright
  15.  *    notice, this list of conditions and the following disclaimer.
  16.  *
  17.  * 2. Redistributions in binary form must reproduce the above copyright
  18.  *    notice, this list of conditions and the following disclaimer in the
  19.  *    documentation and/or other materials provided with the distribution.
  20.  *
  21.  * 3. Neither the name of the University nor of the Laboratory may be used
  22.  *    to endorse or promote products derived from this software without
  23.  *    specific prior written permission.
  24.  *
  25.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35.  * SUCH DAMAGE.
  36.  *
  37.  * @(#) $Header: /cvsroot/nsnam/ns-2/sctp/sctp-timestamp.h,v 1.4 2007/06/17 21:44:44 tom_henderson Exp $ (UD/PEL)
  38.  */
  39. /* Timestamp extension adds a TIMESTAMP chunk into every packet with DATA
  40.  * or SACK chunk(s). The timestamps allow RTT measurements to be made per
  41.  * packet on both original transmissiosn and retransmissions. Thus, Karn's
  42.  * algorithm is no longer needed.
  43.  */
  44. #ifndef ns_sctp_timestamp_h
  45. #define ns_sctp_timestamp_h
  46. #include "sctp.h"
  47. /* Timestamp Specific Flags
  48.  */
  49. #define SCTP_TIMESTAMP_FLAG_TS    0x01  // indicates a timestamp in the chunk
  50. #define SCTP_TIMESTAMP_FLAG_ECHO  0x02  // indicates a timestamp echo in chunk
  51. typedef struct SctpTimestampChunk_S
  52. {
  53.   SctpChunkHdr_S  sHdr;
  54.   float           fTimestamp;
  55.   float           fEcho;
  56. };
  57. class TimestampSctpAgent : public virtual SctpAgent 
  58. {
  59. public:
  60.   TimestampSctpAgent();
  61. protected:
  62.   virtual void  delay_bind_init_all();
  63.   virtual int   delay_bind_dispatch(const char *varName, const char *localName,
  64.     TclObject *tracer);
  65.   /* initialization stuff
  66.    */
  67.   virtual void   OptionReset();
  68.   virtual u_int  ControlChunkReservation();
  69.   /* chunk generation functions
  70.    */
  71.   virtual int        BundleControlChunks(u_char *);
  72.   /* sending functions
  73.    */
  74.   virtual void  AddToSendBuffer(SctpDataChunkHdr_S *, int, u_int, SctpDest_S *);
  75.   virtual void  SendBufferDequeueUpTo(u_int);
  76.   virtual void  RtxMarkedChunks(SctpRtxLimit_E);
  77.   /* process functions
  78.    */
  79.   virtual Boolean_E  ProcessGapAckBlocks(u_char *, Boolean_E);
  80.   virtual void       ProcessOptionChunk(u_char *);
  81.   void               ProcessTimestampChunk(SctpTimestampChunk_S *);
  82.   Boolean_E  eNeedTimestampEcho; // does next pkt need timestamp echo?
  83.   float      fOutTimestampEcho; // outgoing timestamp chunk will carry this echo
  84.   float      fInTimestampEcho;  // incoming timestamp echoed back to sender
  85. };
  86. #endif