sctpDebug.h

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

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