smp->data.type = SMP_T_BOOL;
smp->data.u.sint = !!ts;
smp->flags = SMP_F_VOL_TEST;
+ stktable_release(t, ts);
return 1;
}
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_IN_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
+ t->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
- t->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CNT);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, conn_cnt);
- smp->data.u.sint = stktable_data_cast(ptr, conn_cnt);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, conn_cur);
- smp->data.u.sint = stktable_data_cast(ptr, conn_cur);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+ t->data_arg[STKTABLE_DT_CONN_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
- t->data_arg[STKTABLE_DT_CONN_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_OUT_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
+ t->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
- t->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPT0);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, gpt0);
- smp->data.u.sint = stktable_data_cast(ptr, gpt0);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC0);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, gpc0);
- smp->data.u.sint = stktable_data_cast(ptr, gpc0);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC0_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
+ t->data_arg[STKTABLE_DT_GPC0_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
- t->data_arg[STKTABLE_DT_GPC0_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC1);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, gpc1);
- smp->data.u.sint = stktable_data_cast(ptr, gpc1);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC1_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc1_rate),
+ t->data_arg[STKTABLE_DT_GPC1_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc1_rate),
- t->data_arg[STKTABLE_DT_GPC1_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_ERR_CNT);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, http_err_cnt);
- smp->data.u.sint = stktable_data_cast(ptr, http_err_cnt);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_ERR_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+ t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
- t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, http_req_cnt);
- smp->data.u.sint = stktable_data_cast(ptr, http_req_cnt);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
+ t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
- t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_IN_CNT);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
- smp->data.u.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_OUT_CNT);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
- smp->data.u.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_ID);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, server_id);
- smp->data.u.sint = stktable_data_cast(ptr, server_id);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_SESS_CNT);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = stktable_data_cast(ptr, sess_cnt);
- smp->data.u.sint = stktable_data_cast(ptr, sess_cnt);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
return 1;
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_SESS_RATE);
- if (!ptr)
- return 0; /* parameter not stored */
+ if (ptr)
+ smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+ t->data_arg[STKTABLE_DT_SESS_RATE].u);
- smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
- t->data_arg[STKTABLE_DT_SESS_RATE].u);
- return 1;
+ stktable_release(t, ts);
+ return !!ptr;
}
/* Casts sample <smp> to the type of the table specified in arg(0), and looks
if (ts)
smp->data.u.sint = ts->ref_cnt;
+ stktable_release(t, ts);
return 1;
}