Diff between 44d3f67277f83983e1e9697eda7b9aeb40ca231d and 3f7d81e906e09e881ca2d3f024230cae3a27ba64

Changed Files

File Additions Deletions Status
src/shared/util.c +10 -1 modified
src/shared/util.h +3 -1 modified

Full Patch

diff --git a/src/shared/util.c b/src/shared/util.c
index c0c2c4a..74d4367 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4,7 +4,7 @@
  *  BlueZ - Bluetooth protocol stack for Linux
  *
  *  Copyright (C) 2012-2014  Intel Corporation. All rights reserved.
- *  Copyright 2023 NXP
+ *  Copyright 2023-2024 NXP
  *
  *
  */
@@ -218,6 +218,15 @@ bool util_ltv_foreach(const uint8_t *data, uint8_t len, uint8_t *type,
 	return true;
 }
 
+/* Helper to add l,t,v data in an iovec struct */
+void util_ltv_push(struct iovec *output, uint8_t l, uint8_t t, void *v)
+{
+	output->iov_base = realloc(output->iov_base, output->iov_len + l + 2);
+	util_iov_push_u8(output, l + 1);
+	util_iov_push_u8(output, t);
+	util_iov_push_mem(output, l, v);
+}
+
 /* Helper to print debug information of LTV entries */
 bool util_debug_ltv(const uint8_t *data, uint8_t len,
 			const struct util_ltv_debugger *debugger, size_t num,
diff --git a/src/shared/util.h b/src/shared/util.h
index 6322b13..accacc7 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -4,7 +4,7 @@
  *  BlueZ - Bluetooth protocol stack for Linux
  *
  *  Copyright (C) 2012-2014  Intel Corporation. All rights reserved.
- *  Copyright 2023 NXP
+ *  Copyright 2023-2024 NXP
  *
  *
  */
@@ -134,6 +134,8 @@ struct util_ltv_debugger {
 			util_debug_func_t func, void *user_data);
 };
 
+void util_ltv_push(struct iovec *output, uint8_t l, uint8_t t, void *v);
+
 bool util_debug_ltv(const uint8_t *data, uint8_t len,
 			const struct util_ltv_debugger *debugger, size_t num,
 			util_debug_func_t function, void *user_data);