diff --git a/src/capwap/mbag.c b/src/capwap/mbag.c index 19888185..2e70f455 100644 --- a/src/capwap/mbag.c +++ b/src/capwap/mbag.c @@ -30,6 +30,17 @@ static int mbag_strstr(void *item,char *dst) return sprintf(dst, "%s", (char*)i->data); } +static struct mbag_item * mbag_fromstr(const char *src) +{ + struct mbag_item *i= malloc(sizeof(mbag_item_t)); + if (!i) + return NULL; + + i->type = MBAG_STR; + i->data = strdup(src); + return i; +} + const struct mbag_typedef mbag_type_byte = { @@ -57,7 +68,7 @@ const struct mbag_typedef mbag_type_bstr16 = { }; const struct mbag_typedef mbag_type_str = { - "str",free,mbag_strstr + "str",free,mbag_strstr,mbag_fromstr }; const struct mbag_typedef mbag_type_vendorstr = {