• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

sctp_stats.h

00001 /* 
00002  * $Id$
00003  * 
00004  * Copyright (C) 2009 iptelorg GmbH
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00013  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00014  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00016  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00017  */
00018 /*
00019  * sctp_stats.h - sctp statistics macros
00020  */
00021 /*
00022  * History:
00023  * --------
00024  *  2009-04-28  initial version (andrei)
00025 */
00026 
00027 #ifndef __sctp_stats_h
00028 #define __sctp_stats_h
00029 
00030 
00031 /* enable sctp stats by default */
00032 #ifndef NO_SCTP_STATS
00033 #define USE_SCTP_STATS
00034 #endif
00035 
00036 #ifndef USE_SCTP_STATS
00037 
00038 #define INIT_SCTP_STATS() 0 /* success */
00039 #define DESTROY_SCTP_STATS()
00040 
00041 #define SCTP_STATS_ESTABLISHED()
00042 #define SCTP_STATS_CONNECT_FAILED()
00043 #define SCTP_STATS_LOCAL_REJECT()
00044 #define SCTP_STATS_REMOTE_SHUTDOWN()
00045 #define SCTP_STATS_ASSOC_SHUTDOWN()
00046 #define SCTP_STATS_COMM_LOST()
00047 #define SCTP_STATS_SENDQ_FULL()
00048 #define SCTP_STATS_SEND_FAILED()
00049 #define SCTP_STATS_SEND_FORCE_RETRY()
00050 
00051 #else /* USE_SCTP_STATS */
00052 
00053 #include "counters.h"
00054 
00055 struct sctp_counters_h {
00056         counter_handle_t established;
00057         counter_handle_t connect_failed;
00058         counter_handle_t local_reject;
00059         counter_handle_t remote_shutdown;
00060         counter_handle_t assoc_shutdown;
00061         counter_handle_t comm_lost;
00062         counter_handle_t sendq_full;
00063         counter_handle_t send_failed;
00064         counter_handle_t send_force_retry;
00065 };
00066 
00067 extern struct sctp_counters_h sctp_cnts_h;
00068 
00069 int sctp_stats_init();
00070 void sctp_stats_destroy();
00071 
00072 #define INIT_SCTP_STATS() sctp_stats_init() /* success */
00073 
00074 #define DESTROY_SCTP_STATS() sctp_stats_destroy()
00075 
00076 
00080 #define SCTP_STATS_ESTABLISHED() \
00081         counter_inc(sctp_cnts_h.established)
00082 
00086 #define SCTP_STATS_CONNECT_FAILED() \
00087         counter_inc(sctp_cnts_h.connect_failed)
00088 
00090 #define SCTP_STATS_LOCAL_REJECT() \
00091         counter_inc(sctp_cnts_h.local_reject)
00092 
00093 
00097 #define SCTP_STATS_REMOTE_SHUTDOWN() \
00098         counter_inc(sctp_cnts_h.remote_shutdown)
00099 
00100 
00104 #define SCTP_STATS_ASSOC_SHUTDOWN() \
00105         counter_inc(sctp_cnts_h.assoc_shutdown)
00106 
00107 
00111 #define SCTP_STATS_COMM_LOST() \
00112         counter_inc(sctp_cnts_h.comm_lost)
00113 
00114 
00118 #define SCTP_STATS_SENDQ_FULL() \
00119         counter_inc(sctp_cnts_h.sendq_full)
00120 
00121 
00126 #define SCTP_STATS_SEND_FAILED() \
00127         counter_inc(sctp_cnts_h.send_failed)
00128 
00132 #define SCTP_STATS_SEND_FORCE_RETRY() \
00133         counter_inc(sctp_cnts_h.send_force_retry)
00134 
00135 #endif /* USE_SCTP_STATS */
00136 
00137 #endif /*__sctp_stats_h*/
00138 
00139 /* vi: set ts=4 sw=4 tw=79:ai:cindent: */

Generated on Tue May 22 2012 13:10:14 for SIP Router by  doxygen 1.7.1