2 * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 #include "bundle_internal.h"
27 #include "bundle_log.h"
28 #include "bundle_private.h"
30 #include "keyval_array.h"
31 #include "keyval_type.h"
33 #define CHECKSUM_LENGTH 32
34 #define TAG_IMPORT_EXPORT_CHECK "`zaybxcwdveuftgsh`"
42 * Find a kv from bundle
44 static keyval_t *_bundle_find_kv(bundle *b, const char *key)
49 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
54 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
60 if (strcmp(key, kv->key) == 0) {
61 set_last_result(BUNDLE_ERROR_NONE);
67 set_last_result(BUNDLE_ERROR_KEY_NOT_AVAILABLE);
72 * Append kv into bundle
74 static int _bundle_append_kv(bundle *b, keyval_t *new_kv)
78 if (b->kv_head == NULL) {
87 return BUNDLE_ERROR_NONE;
90 static int _bundle_add_kv(bundle *b, const char *key, const void *val,
91 const size_t size, const int type, const unsigned int len)
97 /* basic value check */
99 return BUNDLE_ERROR_INVALID_PARAMETER;
101 return BUNDLE_ERROR_INVALID_PARAMETER;
102 if (strlen(key) == 0)
103 return BUNDLE_ERROR_INVALID_PARAMETER;
105 kv = _bundle_find_kv(b, key);
106 if (kv) /* Key already exists */
107 return BUNDLE_ERROR_KEY_EXISTS;
109 if (keyval_type_is_array(type)) {
111 kva = keyval_array_new(NULL, key, type,
112 (const void **) val, len);
113 new_kv = (keyval_t *)kva;
116 new_kv = keyval_new(NULL, key, type, val, size);
120 return BUNDLE_ERROR_OUT_OF_MEMORY;
122 _bundle_append_kv(b, new_kv);
124 return BUNDLE_ERROR_NONE;
127 static int _bundle_get_val(bundle *b, const char *key, const int type,
128 void **val, size_t *size, unsigned int *len,
129 size_t **array_element_size)
134 kv = _bundle_find_kv(b, key);
135 if (!kv) /* Key doesn't exist */
136 return get_last_result();
138 if (BUNDLE_TYPE_ANY != type && type != kv->type)
139 return BUNDLE_ERROR_INVALID_PARAMETER;
141 if (keyval_type_is_array(type)) {
142 kva = (keyval_array_t *)kv;
143 keyval_array_get_data(kva, NULL, (void ***)val,
144 len, array_element_size);
146 keyval_get_data(kv, NULL, val, size);
149 return BUNDLE_ERROR_NONE;
153 * global initialization
156 static void _bundle_global_init(void)
163 /* Run init functions */
171 API bundle *bundle_create(void)
175 _bundle_global_init();
177 b = calloc(1, sizeof(bundle)); /* fill mem with NULL */
179 BUNDLE_EXCEPTION_PRINT(
180 "Unable to allocate memory for bundle\n");
181 set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY);
185 set_last_result(BUNDLE_ERROR_NONE);
192 API int bundle_free(bundle *b)
198 BUNDLE_EXCEPTION_PRINT("Bundle is already freed\n");
199 return BUNDLE_ERROR_INVALID_PARAMETER;
202 /* Free keyval list */
207 tmp_kv->method->free(tmp_kv, 1);
213 return BUNDLE_ERROR_NONE;
216 API int bundle_add_str(bundle *b, const char *key, const char *str)
219 return BUNDLE_ERROR_INVALID_PARAMETER;
220 return _bundle_add_kv(b, key, str, strlen(str) + 1, BUNDLE_TYPE_STR, 1);
223 API int bundle_get_str(bundle *b, const char *key, char **str)
225 return _bundle_get_val(b, key, BUNDLE_TYPE_STR, (void **)str,
229 API int bundle_add(bundle *b, const char *key, const char *val)
231 return bundle_add_str(b, key, val);
234 API int bundle_del(bundle *b, const char *key)
237 keyval_t *prev_kv = NULL;
239 /* basic value check */
241 return BUNDLE_ERROR_INVALID_PARAMETER;
243 return BUNDLE_ERROR_INVALID_PARAMETER;
244 if (strlen(key) == 0)
245 return BUNDLE_ERROR_INVALID_PARAMETER;
249 if (strcmp(key, kv->key) == 0)
256 return BUNDLE_ERROR_KEY_NOT_AVAILABLE;
259 prev_kv->next = kv->next;
260 if (kv == b->kv_head)
261 b->kv_head = kv->next;
262 kv->method->free(kv, 1);
265 return BUNDLE_ERROR_NONE;
268 API const char *bundle_get_val(bundle *b, const char *key)
271 int ret = BUNDLE_ERROR_NONE;
273 ret = bundle_get_str(b, key, &val);
274 set_last_result(ret);
280 * @brief used by bundle_get_count() API, to count number of items in a bundle
282 static void _bundle_get_count_iter(const char *k, const int type,
283 const bundle_keyval_t *kv, void *user_data)
285 int *count = (int *)user_data;
289 API int bundle_get_count(bundle *b)
295 bundle_foreach(b, _bundle_get_count_iter, &count);
299 API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *data)
303 if (b == NULL || callback == NULL) {
304 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
310 callback(kv->key, kv->val, data);
314 set_last_result(BUNDLE_ERROR_NONE);
317 API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data)
321 if (b == NULL || iter == NULL) {
322 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
323 return; /* TC_FIX if b = NULL- error handling */
328 iter(kv->key, kv->type, kv, user_data);
332 set_last_result(BUNDLE_ERROR_NONE);
335 /* keyval functions */
336 API int bundle_keyval_get_type(bundle_keyval_t *kv)
339 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
342 set_last_result(BUNDLE_ERROR_NONE);
346 API int bundle_keyval_type_is_array(bundle_keyval_t *kv)
349 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
352 set_last_result(BUNDLE_ERROR_NONE);
353 return keyval_type_is_array(kv->type);
356 API int bundle_keyval_type_is_measurable(bundle_keyval_t *kv)
359 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
362 set_last_result(BUNDLE_ERROR_NONE);
363 return keyval_type_is_measurable(kv->type);
366 API int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val,
369 return keyval_get_data(kv, NULL, val, size);
372 API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val,
373 unsigned int *array_len, size_t **array_item_size)
375 return keyval_array_get_data((keyval_array_t *)kv, NULL,
376 array_val, array_len, array_item_size);
379 API bundle_keyval_t *bundle_keyval_dup(const bundle_keyval_t *kv)
381 bundle_keyval_t *ret_kv = NULL;
389 if (keyval_type_is_array(kv->type)) {
390 len = keyval_array_encode(
391 (keyval_array_t *)kv, &byte, &byte_len);
394 len = keyval_array_decode(byte,
395 (keyval_array_t **)&ret_kv, byte_len);
400 len = keyval_encode((keyval_t *)kv,
401 (unsigned char **)&byte, &byte_len);
405 (unsigned char *)byte, (keyval_t **)&ret_kv, byte_len);
413 API bundle *bundle_dup(bundle *b_from)
418 keyval_array_t *kva_from;
421 if (b_from == NULL) {
422 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
426 b_to = bundle_create();
430 kv_from = b_from->kv_head;
431 while (kv_from != NULL) {
432 if (keyval_type_is_array(kv_from->type)) {
433 kva_from = (keyval_array_t *)kv_from;
434 kv_to = (keyval_t *)keyval_array_new(NULL, kv_from->key,
435 kv_from->type, NULL, kva_from->len);
439 for (i = 0; i < kva_from->len; i++) {
440 if (((keyval_array_t *)kv_from)->array_val[i]) {
441 keyval_array_set_element(
442 (keyval_array_t *)kv_to, i,
443 ((keyval_array_t *)kv_from)->array_val[i],
444 ((keyval_array_t *)kv_from)->array_element_size[i]);
448 _bundle_append_kv(b_to, kv_to);
450 if (_bundle_add_kv(b_to, kv_from->key,
451 kv_from->val, kv_from->size, kv_from->type, 0))
455 kv_from = kv_from->next;
465 API int bundle_encode(bundle *b, bundle_raw **r, int *len)
475 if (b == NULL || r == NULL || len == NULL)
476 return BUNDLE_ERROR_INVALID_PARAMETER;
478 /* calculate memory size */
481 msize += kv->method->get_encoded_size(kv);
485 m = calloc(msize + CHECKSUM_LENGTH, sizeof(unsigned char));
486 if (unlikely(m == NULL))
487 return BUNDLE_ERROR_OUT_OF_MEMORY;
489 p_m = m + CHECKSUM_LENGTH; /* temporary pointer */
496 kv->method->encode(kv, &byte, &byte_len);
497 memcpy(p_m, byte, byte_len);
505 /* compute checksum from the data */
506 chksum_val = g_compute_checksum_for_string(G_CHECKSUM_MD5,
507 (const char *)(m + CHECKSUM_LENGTH), msize);
508 /* prefix checksum to the data */
509 memcpy(m, chksum_val, CHECKSUM_LENGTH);
511 /* base64 encode for whole string checksum and data */
512 *r = (unsigned char *)g_base64_encode(m, msize + CHECKSUM_LENGTH);
514 *len = strlen((char *)*r);
517 g_free(chksum_val); /* free checksum string */
519 return BUNDLE_ERROR_NONE;
522 API int bundle_free_encoded_rawdata(bundle_raw **r)
525 return BUNDLE_ERROR_INVALID_PARAMETER; /* TC_FIX - double free sigabrt handling */
529 return BUNDLE_ERROR_NONE;
532 API bundle *bundle_decode(const bundle_raw *r, const int data_size)
536 unsigned char *d_str;
539 unsigned int d_len_raw;
543 gchar *compute_cksum;
550 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
554 extract_cksum = calloc(CHECKSUM_LENGTH + 1, sizeof(char));
555 if (unlikely(extract_cksum == NULL)) {
556 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
561 * base 64 decode of input string
562 * Since base64 encodes 3 bytes in 4 chars (+3 may be needed in case of non-zero state)
563 * refer to: https://developer.gnome.org/glib/stable/glib-Base64-Encoding.html#g-base64-decode-step
565 d_str = malloc((data_size / 4) * 3 + 3);
566 if (unlikely(d_str == NULL)) {
567 set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY);
572 d_len_raw = g_base64_decode_step((char *)r, data_size, d_str, &state, &save);
573 if (d_len_raw < CHECKSUM_LENGTH) {
574 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
580 /* extract checksum from the received string */
581 strncpy(extract_cksum, (const char *)d_str, CHECKSUM_LENGTH);
582 /* compute checksum for the data */
583 compute_cksum = g_compute_checksum_for_string(G_CHECKSUM_MD5,
584 (const char *)(d_str + CHECKSUM_LENGTH),
585 d_len_raw - CHECKSUM_LENGTH);
587 * compare checksum values- extracted from the received
588 * string and computed from the data
590 if (strcmp(extract_cksum, compute_cksum) != 0) {
593 g_free(compute_cksum);
596 d_r = d_str + CHECKSUM_LENGTH;
597 d_len = d_len_raw - CHECKSUM_LENGTH;
599 /* re-construct bundle */
604 g_free(compute_cksum);
608 p_r = (bundle_raw *)d_r;
609 while (p_r < d_r + d_len - 1) {
610 kv = NULL; /* To get a new kv */
612 byte_size = d_r + d_len - 1 - p_r;
613 if (byte_size < sizeof(size_t))
616 /* Find type, and use decode function according to type */
617 type = keyval_get_type_from_encoded_byte(p_r);
618 if (keyval_type_is_array(type)) {
619 bytes_read = keyval_array_decode(p_r,
620 (keyval_array_t **)&kv, byte_size + 1);
622 bytes_read = keyval_decode(p_r, &kv, byte_size + 1);
626 _bundle_append_kv(b, kv);
633 g_free(compute_cksum);
636 set_last_result(BUNDLE_ERROR_NONE);
646 API int bundle_encode_raw(bundle *b, bundle_raw **r, int *len)
649 unsigned char *m = NULL;
650 unsigned char *p_m = NULL;
651 unsigned char *byte = NULL;
653 gchar *chksum_val = NULL;
656 if (b == NULL || r == NULL)
657 return BUNDLE_ERROR_INVALID_PARAMETER;
659 /* calculate memory size */
662 msize += kv->method->get_encoded_size(kv);
666 m = calloc(msize+CHECKSUM_LENGTH, sizeof(unsigned char));
667 if (unlikely(m == NULL))
668 return BUNDLE_ERROR_OUT_OF_MEMORY;
670 p_m = m + CHECKSUM_LENGTH; /* temporary pointer */
677 kv->method->encode(kv, &byte, &byte_len);
678 memcpy(p_m, byte, byte_len);
686 /* compute checksum from the data */
687 chksum_val = g_compute_checksum_for_string(G_CHECKSUM_MD5,
688 (const char *)(m + CHECKSUM_LENGTH), msize);
689 /* prefix checksum to the data */
690 memcpy(m, chksum_val, CHECKSUM_LENGTH);
693 *len = msize + CHECKSUM_LENGTH;
694 g_free(chksum_val); /* free checksum string */
696 return BUNDLE_ERROR_NONE;
699 API bundle *bundle_decode_raw(const bundle_raw *r, const int data_size)
702 bundle_raw *p_r = NULL;
703 unsigned char *d_str = NULL;
704 unsigned int d_len_raw;
705 unsigned char *d_r = NULL;
708 gchar *compute_cksum = NULL;
715 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
719 extract_cksum = calloc(CHECKSUM_LENGTH + 1, sizeof(char));
720 if (unlikely(extract_cksum == NULL)) {
721 set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY);
725 /* base 64 decode of input string*/
726 /* d_str = g_base64_decode((char*)r, &d_len_raw); */
727 d_str = (unsigned char *)r;
728 d_len_raw = data_size;
729 /* extract checksum from the received string */
730 strncpy(extract_cksum, (const char *)d_str, CHECKSUM_LENGTH);
731 /* compute checksum for the data */
732 compute_cksum = g_compute_checksum_for_string(G_CHECKSUM_MD5,
733 (const char *)(d_str + CHECKSUM_LENGTH),
734 d_len_raw - CHECKSUM_LENGTH);
736 * compare checksum values- extracted from the received
737 * string and computed from the data
739 if (strcmp(extract_cksum, compute_cksum) != 0) {
741 g_free(compute_cksum);
742 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
745 d_r = d_str + CHECKSUM_LENGTH;
746 d_len = d_len_raw - CHECKSUM_LENGTH;
748 /* re-construct bundle */
752 g_free(compute_cksum);
756 p_r = (bundle_raw *)d_r;
757 while (p_r < d_r + d_len - 1) {
758 kv = NULL; /* To get a new kv */
760 byte_size = d_r + d_len - 1 - p_r;
761 if (byte_size < sizeof(size_t))
764 /* Find type, and use decode function according to type */
765 type = keyval_get_type_from_encoded_byte(p_r);
766 if (keyval_type_is_array(type)) {
767 bytes_read = keyval_array_decode(p_r,
768 (keyval_array_t **)&kv, byte_size + 1);
770 bytes_read = keyval_decode(p_r, &kv, byte_size + 1);
774 _bundle_append_kv(b, kv);
781 g_free(compute_cksum);
782 set_last_result(BUNDLE_ERROR_NONE);
787 void _iter_export_to_argv(const char *key, const int type, const keyval_t *kv,
790 struct _argv_idx *vi = (struct _argv_idx *)user_data;
791 unsigned char *byte = NULL;
792 unsigned char *encoded_byte = NULL;
795 vi->argv[vi->idx] = strdup(key);
796 if (kv->method->encode((struct keyval_t *)kv, &byte, &byte_len) == 0) {
797 /* TODO: encode FAILED! */
798 BUNDLE_EXCEPTION_PRINT("bundle: FAILED to encode keyval: %s\n",
803 encoded_byte = (unsigned char *)g_base64_encode(byte, byte_len);
804 if (encoded_byte == NULL) {
805 BUNDLE_EXCEPTION_PRINT("bundle: failed to encode byte\n");
809 vi->argv[vi->idx + 1] = (char *)encoded_byte;
815 API int bundle_export_to_argv(bundle *b, char ***argv)
821 if (b == NULL || argv == NULL) {
822 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
826 item_count = bundle_get_count(b);
827 argc = 2 * item_count + 2;
828 /* 2 more count for argv[0] and arv[1] = encoded */
829 *argv = calloc(argc + 1, sizeof(char *));
831 set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY);
837 vi.idx = 2; /* start from index 2*/
838 vi.argv[1] = TAG_IMPORT_EXPORT_CHECK; /* set argv[1] as encoded*/
839 /* BUNDLE_LOG_PRINT("\nargument 1 is %s",vi.argv[1]); */
841 bundle_foreach(b, _iter_export_to_argv, &vi);
843 set_last_result(BUNDLE_ERROR_NONE);
847 API int bundle_free_exported_argv(int argc, char ***argv)
852 return BUNDLE_ERROR_INVALID_PARAMETER;
854 if (!*argv || argc < 2)
855 return BUNDLE_ERROR_INVALID_PARAMETER;
857 for (i = 2; i < argc; i++)
862 return BUNDLE_ERROR_NONE;
865 API bundle *bundle_import_from_argv(int argc, char **argv)
873 unsigned int byte_size;
877 set_last_result(BUNDLE_ERROR_INVALID_PARAMETER);
878 return NULL; /* TC_FIX error handling for argv =NULL*/
883 set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY);
888 set_last_result(BUNDLE_ERROR_NONE);
892 if (!argv[1] || strcmp(argv[1], TAG_IMPORT_EXPORT_CHECK)) {
893 /* start idx from one as argv[1] is user given argument */
894 for (idx = 1; idx + 1 < argc; idx = idx + 2)
895 bundle_add(b, argv[idx], argv[idx + 1]);
900 /* start idx from 2 as argv[1] is encoded */
901 for (idx = 2; idx + 1 < argc; idx = idx + 2) {
905 encoded_byte = argv[idx+1];
908 byte = g_base64_decode(encoded_byte, (gsize *)&byte_size);
911 set_last_result(bundle_free(b));
915 if (byte_size < sizeof(size_t)) {
922 type = keyval_get_type_from_encoded_byte(byte);
923 if (keyval_type_is_array(type)) {
924 if (keyval_array_decode(byte, &kva, byte_size + 1) == 0) /* TODO: error! */
925 BUNDLE_EXCEPTION_PRINT("Unable to Decode array\n");
926 kv = (keyval_t *)kva;
928 if (keyval_decode(byte, &kv, byte_size + 1) == 0) /* TODO: error! */
929 BUNDLE_EXCEPTION_PRINT("Unable to Decode\n");
931 _bundle_append_kv(b, kv);
938 set_last_result(BUNDLE_ERROR_NONE);
942 API int bundle_get_type(bundle *b, const char *key)
944 keyval_t *kv = _bundle_find_kv(b, key);
949 set_last_result(BUNDLE_ERROR_KEY_NOT_AVAILABLE);
950 return BUNDLE_TYPE_NONE;
955 * Get length of an array
957 /* LCOV_EXCL_START */
958 unsigned int bundle_get_array_len(bundle *b, const char *key)
960 return BUNDLE_ERROR_NONE;
965 * Get size of an item in byte, of given pointer
967 /* LCOV_EXCL_START */
968 size_t bundle_get_array_val_size(bundle *b, const char *key,
971 return BUNDLE_ERROR_NONE;
975 static int bundle_set_array_val(bundle *b, const char *key, const int type,
976 const unsigned int idx, const void *val, const size_t size)
981 kv = _bundle_find_kv(b, key);
983 return get_last_result();
985 if (type != kv->type)
986 return BUNDLE_ERROR_INVALID_PARAMETER;
988 /* TODO: Is this needed? */
989 if (!keyval_type_is_array(kv->type))
990 return BUNDLE_ERROR_INVALID_PARAMETER;
992 kva = (keyval_array_t *)kv;
993 if (!keyval_array_is_idx_valid(kva, idx))
994 return BUNDLE_ERROR_ARRAY_INDEX_OUT_OF_BOUNDS;
996 /* NULL value test (TODO: is this needed?) */
998 return BUNDLE_ERROR_INVALID_PARAMETER;
1000 return keyval_array_set_element(kva, idx, (void *)val, size);
1003 API int bundle_add_str_array(bundle *b, const char *key, const char **str_array,
1006 return _bundle_add_kv(b, key, str_array, 0, BUNDLE_TYPE_STR_ARRAY, len);
1009 /* LCOV_EXCL_START */
1010 int bundle_get_val_array(bundle *b, const char *key, char ***str_array,
1013 return _bundle_get_val(b, key, BUNDLE_TYPE_STR_ARRAY,
1014 (void **)str_array, NULL, (unsigned int *)len, NULL);
1016 /* LCOV_EXCL_STOP */
1018 API const char **bundle_get_str_array(bundle *b, const char *key, int *len)
1020 int ret = BUNDLE_ERROR_NONE;
1021 const char **arr_val = NULL;
1023 ret = bundle_get_val_array(b, key, (char ***)&arr_val, len);
1024 set_last_result(ret);
1029 /* LCOV_EXCL_START */
1030 API int bundle_compare(bundle *b1, bundle *b2)
1038 if (bundle_get_count(b1) != bundle_get_count(b2))
1041 for (kv1 = b1->kv_head; kv1 != NULL; kv1 = kv1->next) {
1042 kv2 = _bundle_find_kv(b2, kv1->key);
1045 if (kv1->method->compare(kv1, kv2))
1051 /* LCOV_EXCL_STOP */
1053 API int bundle_set_str_array_element(bundle *b, const char *key,
1054 const unsigned int idx, const char *val)
1057 return BUNDLE_ERROR_INVALID_PARAMETER;
1059 return bundle_set_array_val(b, key, BUNDLE_TYPE_STR_ARRAY,
1060 idx, val, strlen(val) + 1);
1063 API int bundle_add_byte(bundle *b, const char *key, const void *bytes,
1066 return _bundle_add_kv(b, key, bytes, size, BUNDLE_TYPE_BYTE, 1);
1069 API int bundle_get_byte(bundle *b, const char *key, void **bytes, size_t *size)
1071 return _bundle_get_val(b, key, BUNDLE_TYPE_BYTE, (void **)bytes,
1075 API int bundle_add_byte_array(bundle *b, const char *key,
1076 const unsigned int len)
1078 return bundle_init_byte_array(b, key, len);
1081 API int bundle_init_byte_array(bundle *b, const char *key,
1082 const unsigned int len)
1084 return _bundle_add_kv(b, key, NULL, 0, BUNDLE_TYPE_BYTE_ARRAY, len);
1087 API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array,
1088 unsigned int *len, unsigned int **array_element_size)
1092 ret = _bundle_get_val(b, key, BUNDLE_TYPE_BYTE_ARRAY,
1093 (void **)byte_array, NULL, len,
1094 (size_t **)array_element_size);
1098 API int bundle_set_byte_array_element(bundle *b, const char *key,
1099 const unsigned int idx, const void *bytes, const size_t size)
1101 return bundle_set_array_val(b, key, BUNDLE_TYPE_BYTE_ARRAY,