ATTRIBUTE Cache-Expires 1170 date
ATTRIBUTE Cache-Created 1171 date
ATTRIBUTE Cache-TTL 1172 signed
-ATTRIBUTE Cache-Status-Only 1173 integer
-ATTRIBUTE Cache-Merge-New 1174 integer
+ATTRIBUTE Cache-Status-Only 1173 bool
+ATTRIBUTE Cache-Merge-New 1174 bool
ATTRIBUTE Cache-Entry-Hits 1175 integer
-ATTRIBUTE Cache-Allow-Merge 1176 integer
-ATTRIBUTE Cache-Allow-Insert 1177 integer
-
-VALUE Cache-Status-Only no 0
-VALUE Cache-Status-Only yes 1
-
-VALUE Cache-Merge-New no 0
-VALUE Cache-Merge-New yes 1
-
-VALUE Cache-Allow-Merge no 0
-VALUE Cache-Allow-Merge yes 1
-
-VALUE Cache-Allow-Insert no 0
-VALUE Cache-Allow-Insert yes 1
+ATTRIBUTE Cache-Allow-Merge 1176 bool
+ATTRIBUTE Cache-Allow-Insert 1177 bool
# 1178-1179 - unused
CONF_PARSER_TERMINATOR
};
+static fr_dict_t const *dict_freeradius;
+
+static fr_dict_attr_t const *attr_cache_merge_new;
+static fr_dict_attr_t const *attr_cache_status_only;
+static fr_dict_attr_t const *attr_cache_allow_merge;
+static fr_dict_attr_t const *attr_cache_allow_insert;
+static fr_dict_attr_t const *attr_cache_ttl;
+static fr_dict_attr_t const *attr_cache_entry_hits;
+
+extern fr_dict_attr_autoload_t rlm_cache_dict_attr[];
+fr_dict_attr_autoload_t rlm_cache_dict_attr[] = {
+ { .out = &attr_cache_merge_new, .name = "Cache-Merge-New", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
+ { .out = &attr_cache_status_only, .name = "Cache-Status-Only", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
+ { .out = &attr_cache_allow_merge, .name = "Cache-Allow-Merge", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
+ { .out = &attr_cache_allow_insert, .name = "Cache-Allow-Insert", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
+ { .out = &attr_cache_ttl, .name = "Cache-TTL", .type = FR_TYPE_INT32, .dict = &dict_freeradius },
+ { .out = &attr_cache_entry_hits, .name = "Cache-Entry-Hits", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
+ { NULL }
+};
+
+extern fr_dict_autoload_t rlm_cache_dict[];
+fr_dict_autoload_t rlm_cache_dict[] = {
+ { .out = &dict_freeradius, .proto = "freeradius" },
+ { NULL }
+};
+
/** Get exclusive use of a handle to access the cache
*
*/
if (inst->config.stats) {
rad_assert(request->packet != NULL);
- vp = fr_pair_find_by_num(request->packet->vps, 0, FR_CACHE_ENTRY_HITS, TAG_ANY);
- if (!vp) {
- vp = fr_pair_afrom_num(request->packet, 0, FR_CACHE_ENTRY_HITS);
- rad_assert(vp != NULL);
- fr_pair_add(&request->packet->vps, vp);
- }
+ vp = pair_update_request(attr_cache_entry_hits, TAG_ANY);
vp->vp_uint32 = c->hits;
}
/*
* Check to see if we need to merge the entry into the request
*/
- vp = fr_pair_find_by_num(request->control, 0, FR_CACHE_MERGE_NEW, TAG_ANY);
- if (vp && (vp->vp_uint32 > 0)) merge = true;
+ vp = fr_pair_find_by_da(request->control, attr_cache_merge_new, TAG_ANY);
+ if (vp && vp->vp_bool) merge = true;
if (merge) cache_merge(inst, request, c);
* If Cache-Status-Only == yes, only return whether we found a
* valid cache entry
*/
- vp = fr_pair_find_by_num(request->control, 0, FR_CACHE_STATUS_ONLY, TAG_ANY);
- if (vp && vp->vp_uint32) {
+ vp = fr_pair_find_by_da(request->control, attr_cache_status_only, TAG_ANY);
+ if (vp && vp->vp_bool) {
RINDENT();
RDEBUG3("status-only: yes");
REXDENT();
/*
* Figure out what operation we're doing
*/
- vp = fr_pair_find_by_num(request->control, 0, FR_CACHE_ALLOW_MERGE, TAG_ANY);
- if (vp) merge = (bool)vp->vp_uint32;
+ vp = fr_pair_find_by_da(request->control, attr_cache_allow_merge, TAG_ANY);
+ if (vp) merge = vp->vp_bool;
- vp = fr_pair_find_by_num(request->control, 0, FR_CACHE_ALLOW_INSERT, TAG_ANY);
- if (vp) insert = (bool)vp->vp_uint32;
+ vp = fr_pair_find_by_da(request->control, attr_cache_allow_insert, TAG_ANY);
+ if (vp) insert = vp->vp_bool;
- vp = fr_pair_find_by_num(request->control, 0, FR_CACHE_TTL, TAG_ANY);
+ vp = fr_pair_find_by_da(request->control, attr_cache_ttl, TAG_ANY);
if (vp) {
if (vp->vp_int32 == 0) {
expire = true;