1 #ifndef TRESSTATHANDLER_H
2 #define TRESSTATHANDLER_H
16 this->statisticHandler = statisticHandler;
17 this->storage = storage;
23 statisticHandler->
setValue(
"AdminSiteClearRequestCounter", 0ll);
24 statisticHandler->
setValue(
"AdminSiteClearResourceCounter", 0ll);
25 statisticHandler->
setValue(
"AdminResListDelRequestCounter", 0ll);
26 statisticHandler->
setValue(
"AdminResListDelResourceCounter", 0ll);
27 statisticHandler->
setValue(
"AdminResListRequestCounter", 0ll);
40 statisticHandler->
addToValue(
"AdminResListRequestCounter", 1ll);
42 char *
ret = (
char*)malloc(size +
sizeof(
int));
43 unsigned int *curSize = (
unsigned int*)ret;
46 u_int8_t *res = storage->getResourceList(count);
47 for(u_int32_t i = 0; i < count; i ++)
49 if(size < (
size_t)*curSize + 64)
52 ret = (
char*)realloc(ret, size);
53 curSize = (
unsigned int*)ret;
55 *curSize += sprintf(ret +
sizeof(
int) + *curSize,
"%llu %u ", *(u_int64_t*)(res + i * (
sizeof(u_int64_t) +
sizeof(u_int8_t))), (u_int32_t)(*(res + i * (
sizeof(u_int64_t) +
sizeof(u_int8_t)) +
sizeof(u_int64_t))));
58 ret[
sizeof(int) + *curSize] =
'\0';
64 statisticHandler->
addToValue(
"AdminResListDelRequestCounter", 1ll);
67 int *
ret = (
int*)malloc(
sizeof(
int));
69 char *resources = va_arg(list,
char*);
72 resources = (
char*)str.
c_str();
76 int len = strlen(resources) / 16;
80 u_int64_t *ids =
new u_int64_t[len];
81 while(*resources && count < len)
83 while(*resources && (*resources < '0' || *resources >
'9'))resources++;
86 ids[count++] = (u_int64_t)strtoull(resources, endptr, 10);
94 *ret = storage->delResourceList(ids, count);
95 statisticHandler->
addToValue(
"AdminResListDelResourceCounter", (
long long)(*ret));
139 statisticHandler->
addToValue(
"AdminSiteClearRequestCounter", 1ll);
141 va_start(list, code);
142 int *
ret = (
int*)malloc(
sizeof(
int));
143 u_int32_t siteId = va_arg(list, u_int32_t);
145 for(u_int32_t i = 0; i < queuePos; i++)
146 if(queue[i] == siteId)
153 if(queuePos == queueSize)
155 queueSize = queueSize == 0 ? 1: (queueSize << 1);
156 queue = (u_int32_t*)realloc(queue,
sizeof(u_int32_t) * queueSize);
158 queue[queuePos++] = siteId;
172 char *
ret = (
char*)malloc(128);
174 va_start(list, code);
175 u_int32_t siteId = va_arg(list, u_int32_t);
178 sprintf(ret,
"v1=%u&v2=%u&v3=%u", inProgress?1:0, queuePos, current);
183 u_int32_t foundPos = 0;
185 if(inProgress && current == siteId)find =
true;
188 for(u_int32_t i = 0; i < queuePos && !find; i++)
189 if(queue[i] == siteId)
196 sprintf(ret,
"v1=%u&v2=%u&v3=%u", find?1:0, foundPos, current);
202 bool *
ret = (
bool*)malloc(1);
204 va_start(list, code);
205 char *encodeExtendedTypes = va_arg(list,
char *);
206 if (!encodeExtendedTypes)
208 sprintf((
char *)ret,
"%c", 0);
212 String decodeString (encodeExtendedTypes);
214 if (decodeString.
c_str());
217 string s (decodeString.
c_str());
218 updateExtendedTypes.
parse (s);
250 siteId = u_int32_t(-1);
252 if(queuePos)siteId = queue[--queuePos];
254 if(siteId != u_int32_t(-1))
257 statisticHandler->
addToValue(
"AdminSiteClearResourceCounter", (
long long)storage->delBySite(siteId));
259 }
while(siteId != u_int32_t(-1));