diff options
Diffstat (limited to 'accel-pptpd/radius/dict.c')
-rw-r--r-- | accel-pptpd/radius/dict.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/accel-pptpd/radius/dict.c b/accel-pptpd/radius/dict.c index 00f67af7..d76c2c39 100644 --- a/accel-pptpd/radius/dict.c +++ b/accel-pptpd/radius/dict.c @@ -210,7 +210,17 @@ struct rad_dict_attr_t *rad_dict_find_attr(const char *name) return NULL; } -struct rad_dict_value_t *rad_dict_find_val(struct rad_dict_attr_t *attr, const char *name) +struct rad_dict_attr_t *rad_dict_find_attr_id(int id) +{ + struct rad_dict_attr_t *attr; + + list_for_each_entry(attr, &dict->items, entry) + if (attr->id == id) + return attr; + + return NULL; +} +struct rad_dict_value_t *rad_dict_find_val_name(struct rad_dict_attr_t *attr, const char *name) { struct rad_dict_value_t *val; @@ -220,3 +230,17 @@ struct rad_dict_value_t *rad_dict_find_val(struct rad_dict_attr_t *attr, const c return NULL; } + +struct rad_dict_value_t *rad_dict_find_val(struct rad_dict_attr_t *attr, rad_value_t v) +{ + struct rad_dict_value_t *val; + + if (attr->type != ATTR_TYPE_INTEGER) + return NULL; + + list_for_each_entry(val, &attr->values, entry) + if (val->val.integer == v.integer) + return val; + + return NULL; +} |