From ff7fb043ed265c5b34e25c3212c2b6342968d3cb Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Mon, 4 May 2015 05:37:19 +0000 Subject: [PATCH] Default items defined. FossilOrigin-Name: 1c8c514f88afc8b87be00b49e888aad6974c98b424d8f5f05f589ce967dc1cce --- src/capwap/item.c | 5 ++++- src/capwap/item.h | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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