• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/sctp/sctpDebug.h

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  * Armando L. Caro Jr. <acaro@@cis,udel,edu>
00009  *
00010  * Armando's debugging output system. 
00011  * Based on a previous version written by Phill Conrad and Ed Golden.
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions
00015  * are met:
00016  *
00017  * 1. Redistributions of source code must retain the above copyright
00018  *    notice, this list of conditions and the following disclaimer.
00019  *
00020  * 2. Redistributions in binary form must reproduce the above copyright
00021  *    notice, this list of conditions and the following disclaimer in the
00022  *    documentation and/or other materials provided with the distribution.
00023  *
00024  * 3. Neither the name of the University nor of the Laboratory may be used
00025  *    to endorse or promote products derived from this software without
00026  *    specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00029  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00032  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00034  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00035  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00036  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00037  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00038  * SUCH DAMAGE.
00039  *
00040  * @(#) $Header: /cvsroot/nsnam/ns-2/sctp/sctpDebug.h,v 1.5 2007/06/17 21:44:46 tom_henderson Exp $ (UD/PEL)
00041  */
00042 
00043 #ifndef ns_sctpDebug_h
00044 #define ns_sctpDebug_h
00045 
00046 void sctpDebugEmptyPrintf (char const *format, ...);
00047 
00048 #if(DEBUG)
00049 
00050 /* debug variable format:  __dbg_FunctionName
00051  */
00052 #define __dbg_command                          0x00000001
00053 #define __dbg_Reset                            0x00000001
00054 #define __dbg_OptionReset                      0x00000001
00055 #define __dbg_ControlChunkReservation          0x00000001
00056 
00057 #define __dbg_recv                             0x00000002
00058 
00059 #define __dbg_sendmsg                          0x00000004
00060 
00061 #define __dbg_GenChunk                         0x00000008
00062 
00063 #define __dbg_GetNextDataChunkSize             0x00000010
00064 #define __dbg_GenOneDataChunk                  0x00000010
00065 #define __dbg_GenMultipleDataChunks            0x00000010
00066 #define __dbg_BundleControlChunks              0x00000010
00067 
00068 #define __dbg_GetHighestOutstandingTsn         0x00000020
00069 #define __dbg_FastRtx                          0x00000020
00070 #define __dbg_StartT3RtxTimer                  0x00000020
00071 #define __dbg_StopT3RtxTimer                   0x00000020
00072 #define __dbg_Timeout                          0x00000020
00073 #define __dbg_TimeoutRtx                       0x00000020
00074 #define __dbg_T1InitTimerExpiration            0x00000020
00075 #define __dbg_T1CookieTimerExpiration          0x00000020
00076 #define __dbg_SackGenTimerExpiration           0x00000020
00077 #define __dbg_MarkChunkForRtx                  0x00000020
00078 #define __dbg_AnyMarkedChunks                  0x00000020
00079 #define __dbg_RtxMarkedChunks                  0x00000020
00080 
00081 #define __dbg_AddToSendBuffer                  0x00000040
00082 
00083 #define __dbg_RttUpdate                        0x00000080
00084 
00085 #define __dbg_SendBufferDequeueUpTo            0x00000100
00086 
00087 #define __dbg_AdjustCwnd                       0x00000200
00088 
00089 #define __dbg_UpdateHighestTsn                 0x00000400
00090 #define __dbg_IsDuplicateChunk                 0x00000400
00091 #define __dbg_InsertDuplicateTsn               0x00000400
00092 
00093 #define __dbg_UpdateCumAck                     0x00000800
00094 #define __dbg_UpdateRecvTsnBlocks              0x00000800
00095 
00096 #define __dbg_AdvancePeerAckPoint              0x00001000
00097 #define __dbg_ProcessForwardTsnChunk           0x00001000
00098 
00099 #define __dbg_ProcessInitChunk                 0x00002000
00100 #define __dbg_ProcessInitAckChunk              0x00002000
00101 
00102 #define __dbg_ProcessDataChunk                 0x00004000
00103 #define __dbg_ProcessGapAckBlocks              0x00004000
00104 #define __dbg_ProcessSackChunk                 0x00004000
00105 
00106 #define __dbg_ProcessChunk                     0x00008000
00107 #define __dbg_ProcessOptionChunk               0x00008000
00108 
00109 #define __dbg_NextChunk                        0x00010000
00110 
00111 #define __dbg_SetSource                        0x00020000
00112 #define __dbg_SetDestination                   0x00020000
00113 #define __dbg_SendPacket                       0x00020000
00114 #define __dbg_TotalOutstanding                 0x00020000
00115 #define __dbg_SendMuch                         0x00020000
00116 
00117 #define __dbg_PassToUpperLayer                 0x00040000
00118 
00119 #define __dbg_InsertInStreamBuffer             0x00080000
00120 #define __dbg_PassToStream                     0x00080000
00121 #define __dbg_UpdateAllStreams                 0x00080000
00122 
00123 #define __dbg_AddInterface                     0x00100000
00124 #define __dbg_AddDestination                   0x00100000
00125 #define __dbg_SetPrimary                       0x00100000
00126 #define __dbg_ForceSource                      0x00100000
00127 
00128 #define __dbg_GetNextDest                      0x00200000
00129 
00130 #define __dbg_CwndDegradeTimerExpiration       0x00400000
00131 #define __dbg_CalcHeartbeatTime                0x00400000
00132 #define __dbg_SendHeartbeat                    0x00400000
00133 #define __dbg_HeartbeatGenTimerExpiration      0x00400000
00134 #define __dbg_ProcessHeartbeatAckChunk         0x00400000
00135 
00136 #define __dbg_Close                            0x00800000
00137 
00138 /* functions which process optional chunks
00139  */
00140 #define __dbg_ProcessTimestampChunk            0x01000000
00141 
00142 /* optional functions for simulated reactive routing protocols (for MANETs, etc)
00143  */
00144 #define __dbg_RouteCacheFlushTimerExpiration   0x02000000
00145 #define __dbg_RouteCalcDelayTimerExpiration    0x02000000
00146 
00147 /* CMT debugging
00148  */
00149 #define __dbg_SelectRtxDest                    0x04000000
00150 
00151 /* verbose debugging functions
00152  */
00153 #define __dbg_DumpSendBuffer                   0x80000000
00154 
00155 /* CMT-PF debugging
00156  */
00157 #define __dbg_SelectFromPFDests                0x10000000
00158 
00159 /**************************** DEBUGGING MACROS **************************/
00160 
00161 /* For Function Entry 
00162  *
00163  * example usage:   DBG_I(SomeFunctionName);
00164  */
00165 #define DBG_I(funcName) \
00166         if(fhpDebugFile != NULL) /* make sure output file is open! */ \
00167           if (uiDebugMask & __dbg_##funcName) \
00168             {fprintf(fhpDebugFile, "[%s] <I> \n", #funcName);}
00169 
00170 /* For Printing Details
00171  *
00172  * example usage:
00173  *          DBG_PL(SomeFunctionName, "testing") DBG_PR;
00174  *          DBG_PL(SomeFunctionName, "current someValue=%d"), someValue DBG_PR;
00175  */
00176 #define DBG_PL(funcName, format) \
00177         if(fhpDebugFile != NULL) /* make sure output file is open! */ \
00178           if (uiDebugMask & __dbg_##funcName) \
00179             fprintf(fhpDebugFile, "[%s] " format "\n", #funcName
00180 #define DBG_PR )
00181 
00182 /* For Calling Debugging Functions
00183  * 
00184  * example usage:
00185  *          DBG_F(SomeFunctionName, SomeDebugFunction(param1, parm2, ...) );
00186  *
00187  * Note: both SomeFunctionName and SomeDebugFunction debug bits must be set
00188  */
00189 #define DBG_F(funcName, debugFuncCall) \
00190         if(fhpDebugFile != NULL) /* make sure output file is open! */ \
00191           if (uiDebugMask & __dbg_##funcName) \
00192             debugFuncCall
00193 
00194 /* For executing blocks of code only if debug bit is set
00195  *
00196  * example usage:
00197  *          DBG_IF(SomeFunctionName)
00198  *            {
00199  *              // block of code goes here
00200  *            }
00201  */
00202 #define DBG_IF(funcName) \
00203         if(fhpDebugFile != NULL) /* make sure output file is open! */ \
00204           if (uiDebugMask & __dbg_##funcName)
00205 
00206 /* For Function Exit
00207  *
00208  * example usage:    DBG_X(SomeFunctionName);
00209  */
00210 #define DBG_X(funcName) \
00211         if(fhpDebugFile != NULL) /* make sure output file is open! */ \
00212           if (uiDebugMask & __dbg_##funcName) \
00213             {fprintf(fhpDebugFile, "[%s] <X> \n", #funcName);}
00214 
00215 #define DBG_FOPEN() \
00216         if(fhpDebugFile == NULL) /* only open file once! */ \
00217           { \
00218              if(iDebugFileIndex >= 0) \
00219                { \
00220                  char cpFileName[256]; \
00221                  sprintf(cpFileName, "debug.SctpAgent.%d", iDebugFileIndex); \
00222                  fhpDebugFile = fopen(cpFileName, "w"); \
00223                } \
00224              else \
00225                fhpDebugFile = stdout; \
00226           }
00227 
00228 #else  /* DEBUG is not defined, then preprocess these macros out! */
00229 
00230 #define DBG_I(bitmask)            { /* empty */ }
00231 
00232 /* This is a HACK!!! ...but who cares, it's only debugging and gcc should strip
00233  * it out anyway.
00234  */
00235 #define DBG_PL(funcName, format)  if(0) sctpDebugEmptyPrintf (""
00236 #define DBG_PR                    )
00237 
00238 #define DBG_F(funcName, debugFuncCall)  { /* empty */ }
00239 
00240 #define DBG_IF(funcName)          if(0)
00241 
00242 #define DBG_X(funcName)           { /* empty */ }
00243 
00244 #define DBG_FOPEN()               { /* empty */ }
00245 
00246 #endif
00247 #endif

Generated on Tue Aug 10 2010 16:16:08 for ns-2.33 by  doxygen 1.7.1