diff --git a/src/cw/cw_ktv_std_types.c b/src/cw/cw_ktv_std_types.c
index cefbbbc4..e556ec23 100644
--- a/src/cw/cw_ktv_std_types.c
+++ b/src/cw/cw_ktv_std_types.c
@@ -8,5 +8,6 @@ const cw_Type_t * cw_ktv_std_types[] = {
CW_TYPE_IPADDRESS,
CW_TYPE_STR,
CW_TYPE_SYSPTR,
+ CW_TYPE_BOOL,
NULL
};
diff --git a/src/cw/cw_type_bool.c b/src/cw/cw_type_bool.c
new file mode 100644
index 00000000..a5ca29b6
--- /dev/null
+++ b/src/cw/cw_type_bool.c
@@ -0,0 +1,90 @@
+/*
+ This file is part of libcapwap.
+
+ libcapwap is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ libcapwap is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Foobar. If not, see .
+
+*/
+
+#include
+
+#include "cw.h"
+#include "ktv.h"
+
+static cw_KTV_t *get(cw_KTV_t * data, const uint8_t * src, int len)
+{
+ data->type = &cw_type_byte;
+ data->val.byte = cw_get_byte(src);
+ return data;
+}
+
+static int put(const cw_KTV_t *data, uint8_t * dst)
+{
+ return cw_put_byte(dst, data->val.byte);
+}
+
+static int to_str(const cw_KTV_t *data, char *dst, int max_len)
+{
+ /*if (max_len<3){
+ return 0;
+ }*/
+ if(data->val.boolean)
+ return sprintf(dst, "%s", "true");
+ else
+ return sprintf(dst, "%s", "false");
+}
+
+static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
+{
+ if (cw_stricmp(src,"true") == 0){
+ data->val.boolean=1;
+ return data;
+ }
+ if (cw_stricmp(src,"yes") == 0){
+ data->val.boolean=1;
+ return data;
+ }
+ if (cw_stricmp(src,"on") == 0){
+ data->val.boolean=1;
+ return data;
+ }
+ if (atoi(src)==1){
+ data->val.boolean=1;
+ return data;
+
+ }
+
+ data->val.boolean=0;
+ return data;
+}
+
+static int len (cw_KTV_t * data)
+{
+ return sizeof(int);
+}
+
+static void * data( cw_KTV_t * data)
+{
+ return & data->val.boolean;
+}
+
+const struct cw_Type cw_type_bool = {
+ "Bool", /* name */
+ NULL, /* del */
+ put, /* put */
+ get, /* get */
+ to_str, /* to_str */
+ from_str, /* from_str */
+ len, /* len */
+ data /* data */
+};
diff --git a/src/cw/ktv.h b/src/cw/ktv.h
index 092b7b99..bebe884b 100644
--- a/src/cw/ktv.h
+++ b/src/cw/ktv.h
@@ -101,6 +101,7 @@ extern const struct cw_Type cw_type_bstr16;
extern const struct cw_Type cw_type_str;
extern const struct cw_Type cw_type_ipaddress;
extern const struct cw_Type cw_type_sysptr;
+extern const struct cw_Type cw_type_bool;
#define CW_TYPE_BYTE (&cw_type_byte)
#define CW_TYPE_WORD (&cw_type_word)
@@ -109,7 +110,7 @@ extern const struct cw_Type cw_type_sysptr;
#define CW_TYPE_IPADDRESS (&cw_type_ipaddress)
#define CW_TYPE_SYSPTR (&cw_type_sysptr)
#define CW_TYPE_STR (&cw_type_str)
-
+#define CW_TYPE_BOOL (&cw_type_bool)
/*
void cw_kvstore_mavl_delete(const void *data);
*/