Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _I_REC_DEFS_H_
00025 #define _I_REC_DEFS_H_
00026
00027 #include "Compatability.h"
00028 #include "ink_mutex.h"
00029 #include "ink_rwlock.h"
00030 #include "I_RecMutex.h"
00031
00032 #define STAT_PROCESSOR
00033
00034
00035
00036
00037
00038 enum RecErrT
00039 {
00040 REC_ERR_FAIL = -1,
00041 REC_ERR_OKAY = 0
00042 };
00043
00044
00045
00046
00047
00048 #define RecStringNull NULL
00049
00050 typedef int64_t RecInt;
00051 typedef float RecFloat;
00052 typedef char *RecString;
00053 typedef const char *RecStringConst;
00054 typedef int64_t RecCounter;
00055 typedef int8_t RecByte;
00056 typedef bool RecBool;
00057
00058 enum RecT
00059 {
00060 RECT_NULL = 0x00,
00061 RECT_CONFIG = 0x01,
00062 RECT_PROCESS = 0x02,
00063 RECT_NODE = 0x04,
00064 RECT_CLUSTER = 0x08,
00065 RECT_LOCAL = 0x10,
00066 RECT_PLUGIN = 0x20,
00067 RECT_ALL = 0x3F
00068 };
00069
00070 enum RecDataT
00071 {
00072 RECD_NULL = 0,
00073 RECD_INT,
00074 RECD_FLOAT,
00075 RECD_STRING,
00076 RECD_COUNTER,
00077
00078 #if defined(STAT_PROCESSOR)
00079 RECD_CONST,
00080 RECD_FX,
00081 #endif
00082 RECD_MAX
00083 };
00084
00085 enum RecPersistT
00086 {
00087 RECP_NULL,
00088 RECP_PERSISTENT,
00089 RECP_NON_PERSISTENT
00090 };
00091
00092
00093
00094
00095
00096 namespace rec {
00097 namespace detail {
00098 template <RecPersistT>
00099 struct is_valid_persistence;
00100
00101 template<>
00102 struct is_valid_persistence<RECP_PERSISTENT>
00103 {
00104 static const RecPersistT value = RECP_PERSISTENT;
00105 };
00106
00107 template<>
00108 struct is_valid_persistence<RECP_NON_PERSISTENT>
00109 {
00110 static const RecPersistT value = RECP_NON_PERSISTENT;
00111 };
00112
00113 }}
00114
00115 #define REC_PERSISTENCE_TYPE(P) rec::detail::is_valid_persistence<P>::value
00116
00117 enum RecUpdateT
00118 {
00119 RECU_NULL,
00120 RECU_DYNAMIC,
00121 RECU_RESTART_TS,
00122 RECU_RESTART_TM,
00123 RECU_RESTART_TC
00124 };
00125
00126 enum RecCheckT
00127 {
00128 RECC_NULL,
00129 RECC_STR,
00130 RECC_INT,
00131 RECC_IP
00132 };
00133
00134 enum RecModeT
00135 {
00136 RECM_NULL,
00137 RECM_CLIENT,
00138 RECM_SERVER,
00139 RECM_STAND_ALONE
00140 };
00141
00142 enum RecAccessT
00143 {
00144 RECA_NULL,
00145 RECA_NO_ACCESS,
00146 RECA_READ_ONLY
00147 };
00148
00149
00150
00151
00152
00153 union RecData
00154 {
00155 RecInt rec_int;
00156 RecFloat rec_float;
00157 RecString rec_string;
00158 RecCounter rec_counter;
00159 };
00160
00161
00162
00163
00164
00165 struct RecRawStat
00166 {
00167 int64_t sum;
00168 int64_t count;
00169
00170
00171
00172 int64_t last_sum;
00173 int64_t last_count;
00174 uint32_t version;
00175 };
00176
00177
00178
00179
00180 struct RecRawStatBlock
00181 {
00182 off_t ethr_stat_offset;
00183 RecRawStat **global;
00184 int num_stats;
00185 int max_stats;
00186 ink_mutex mutex;
00187 };
00188
00189
00190
00191
00192
00193 typedef int (*RecConfigUpdateCb) (const char *name, RecDataT data_type, RecData data, void *cookie);
00194 typedef int (*RecStatUpdateFunc) (const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id, void *cookie);
00195 typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
00196
00197
00198
00199
00200
00201 #define REC_VAR_NAME_DELIMITOR '.'
00202 #define REC_VAR_NAME_WILDCARD '*'
00203
00204 #endif