diff --git a/src/capwap/item.c b/src/capwap/item.c index 25bfe215..9f17b989 100644 --- a/src/capwap/item.c +++ b/src/capwap/item.c @@ -22,10 +22,11 @@ const char CW_ITEM_NONE[] = ""; +const char CW_ITEM_ANY[] = "*"; + struct cw_itemdef *cw_item_get_by_name(const char *id, struct cw_itemdef *table) { - int i; while (table->id != CW_ITEM_NONE) { if (!strcmp(table->id, id)) return table; @@ -42,6 +43,7 @@ static int cmp(const void *x1, const void *x2) cw_itemdef_t *i1, *i2; i1 = (cw_itemdef_t *) x1; i2 = (cw_itemdef_t *) x2; + int rc = strcmp(i1->id, i2->id); if (rc != 0) return rc; @@ -53,6 +55,7 @@ const cw_itemdef_t * cw_itemdef_get(cw_itemdefheap_t t, const char *id, const ch cw_itemdef_t idef; idef.id = id; idef.sub_id = !sub_id ? CW_ITEM_NONE : sub_id; + return mavl_get(t, &idef); } diff --git a/src/capwap/item.h b/src/capwap/item.h index a5f0b953..e26b6012 100644 --- a/src/capwap/item.h +++ b/src/capwap/item.h @@ -23,6 +23,8 @@ #include "mbag.h" extern const char CW_ITEM_NONE[]; +extern const char CW_ITEM_ANY[]; + /* Definitions for CAPWAP Items */ @@ -49,6 +51,6 @@ extern const cw_itemdef_t * cw_itemdef_get(cw_itemdefheap_t t, const char *id, struct cw_itemdef *cw_item_get_by_name(const char *name, struct cw_itemdef *table); -typedef const char *cw_item_t; - +typedef const char *cw_item_id_t; +// #endif