+
+bool tlv_get_uint8(const struct tlv *etlv, uint8_t *value)
+{
+ *value = 0;
+ if (etlv)
+ {
+ if (etlv->len == 0)
+ return true;
+
+ if (etlv->len == 1)
+ {
+ *value = etlv->value[0];
+ return true;
+ }
+ }
+ return false;
+}
+
+bool tlv_get_int(const struct tlv *etlv, int *value)
+{
+ *value = 0;
+ if (etlv)
+ {
+ if (etlv->len == 0)
+ return true;
+
+ if (etlv->len <= 4)
+ {
+ for (int i = 0; i < etlv->len; i++)
+ {
+ *value += etlv->value[i] * (1 << (i * 8));
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+bool tlvdb_get_uint8(struct tlvdb *tlvRoot, tlv_tag_t tag, uint8_t *value)
+{
+ const struct tlv *tlvelm = tlvdb_get(tlvRoot, tag, NULL);
+ return tlv_get_uint8(tlvelm, value);
+}