4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
30 * @brief This file declares API of bundle library
34 * @addtogroup APPLICATION_FRAMEWORK
40 * @section Header to use them:
56 #define API __attribute__((visibility("default")))
60 * bundle is an opaque type pointing a bundle object
62 typedef struct _bundle_t bundle;
65 * bundle_raw is an encoded data type
66 * @see bundle_encode()
67 * @see bundle_decode()
69 typedef unsigned char bundle_raw;
73 * Each bundle keyval have a type.
75 enum bundle_type_property {
76 BUNDLE_TYPE_ARRAY = 0x0100,
77 BUNDLE_TYPE_PRIMITIVE = 0x0200,
78 BUNDLE_TYPE_MEASURABLE = 0x0400
82 BUNDLE_TYPE_NONE = -1,
84 BUNDLE_TYPE_STR = 1 | BUNDLE_TYPE_MEASURABLE, /* Default */
85 BUNDLE_TYPE_STR_ARRAY = BUNDLE_TYPE_STR | BUNDLE_TYPE_ARRAY | BUNDLE_TYPE_MEASURABLE,
87 BUNDLE_TYPE_BYTE_ARRAY = BUNDLE_TYPE_BYTE | BUNDLE_TYPE_ARRAY
91 * A keyval object in a bundle.
92 * @see bundle_iterator_t
94 typedef struct keyval_t bundle_keyval_t;
98 * bundle_iterator is a new iterator function type for bundle_foreach()
99 * @see bundle_foreach()
101 typedef void (*bundle_iterator_t) (
104 const bundle_keyval_t *kv,
110 * bundle_iterate_cb_t is an iterator function type for bundle_iterate()
111 * @see bundle_iterate()
112 * @remark This type is obsolete. Do not use this type any more.
114 typedef void (*bundle_iterate_cb_t) (const char *key, const char *val, void *data);
118 * @brief Create a bundle object.
122 * @return bundle object
123 * @retval NULL on failure creating an object
124 * @remark When NULL is returned, errno is set to one of the following values; \n
125 * ENOMEM : No memory to create an object
129 bundle *b = bundle_create(); // Create new bundle object
130 bundle_free(b); // free bundle
133 API bundle* bundle_create(void);
136 * @brief Free given bundle object with key/values in it
137 * @pre b must be a valid bundle object.
139 * @see bundle_create()
140 * @param[in] b bundle object to be freed
141 * @return Operation result;
147 bundle *b = bundle_create(); // Create new bundle object
148 bundle_free(b); // free bundle
151 API int bundle_free(bundle *b);
153 * @brief Add a string array type key-value pair into bundle.
154 * @pre b must be a valid bundle object.
156 * @see bundle_get_str_array()
157 * @see bundle_set_str_array_element()
158 * @param[in] b bundle object
160 * @param[in] str_array string type value. If NULL, empty array is created. You can change an item with
161 * @param[in] len Length of array.
162 * @return Operation result
166 * @remark When -1 is returned, errno is set to one of the following values; \n
167 EKEYREJECTED : key is rejected (NULL or sth) \n
168 EPERM : key is already exist, not permitted to overwrite value \n
169 EINVAL : b or val is not valid (NULL or sth) \n
172 char *sa = { "aaa", "bbb", "ccc" }; // A string array of length 3
173 bundle *b = bundle_create();
174 bundle_add_str_array(b, "foo", sa, 3); // add a key-val pair
178 API int bundle_add_str_array(bundle *b, const char *key, const char **str_array, const int len);
180 * @brief Add a string type key-value pair into bundle.
181 * @pre b must be a valid bundle object.
183 * @see bundle_add_str()
184 * @param[in] b bundle object
186 * @param[in] val value
187 * @return Operation result
191 * @remark When -1 is returned, errno is set to one of the following values; \n
192 EKEYREJECTED : key is rejected (NULL or sth) \n
193 EPERM : key is already exist, not permitted to overwrite value \n
194 EINVAL : b or val is not valid (NULL or sth) \n
197 bundle *b = bundle_create(); // Create new bundle object
198 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
203 API int bundle_add(bundle *b, const char *key, const char *val);
206 * @brief Delete val with given key
207 * @pre b must be a valid bundle object.
210 * @param[in] b bundle object
211 * @param[in] key given key
212 * @return Operation result
216 * @remark When -1 is returned, errno is set to one of the following values; \n
217 EINVAL : b is invalid (NULL or sth) \n
218 ENOKEY : No key exist \n
219 EKEYREJECTED : key is invalid (NULL or sth) \n
222 bundle *b = bundle_create(); // Create new bundle object
223 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
224 bundle_del(b, "foo_key"); // del "foo_key" from b
229 API int bundle_del(bundle *b, const char* key);
231 * @brief Get string array value from key
232 * @pre b must be a valid bundle object.
234 * @see bundle_add_str_array()
235 * @see bundle_set_str_array_element()
236 * @param[in] b bundle object
238 * @param[out] len array length
239 * @return Pointer to array of string
240 * @retval NULL If key is not found, returns NULL.
241 * @remark DO NOT free or modify returned string!
242 When NULL is returned, errno is set to one of the following values; \n
243 EINVAL : b is invalid \n
244 ENOKEY : No key exists \n
245 EKEYREJECTED : invalid key (NULL or sth) \n
248 bundle *b = bundle_create();
249 bundle_add_str_array(b, "foo", NULL, 3); // add a key-val pair
250 bundle_set_str_array_element(b, "foo", 0, "aaa");
251 bundle_set_str_array_element(b, "foo", 1, "bbb");
252 bundle_set_str_array_element(b, "foo", 2, "ccc");
254 char **str_array = NULL;
255 int len_str_array = 0;
257 str_array=bundle_get_str_array(b, "foo", &len_str_array);
258 // str_array = { "aaa", "bbb", "ccc" }, and len_str_array = 3
264 API const char** bundle_get_str_array(bundle *b, const char *key,int *len);
266 * @brief Get value from key
267 * @pre b must be a valid bundle object.
269 * @see bundle_get_str()
270 * @param[in] b bundle object
272 * @return Pointer for value string
273 * @retval NULL If key is not found, returns NULL.
274 * @remark DO NOT free or modify returned string!
275 When NULL is returned, errno is set to one of the following values; \n
276 EINVAL : b is invalid \n
277 ENOKEY : No key exists \n
278 EKEYREJECTED : invalid key (NULL or sth) \n
281 bundle *b = bundle_create(); // Create new bundle object
282 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
283 char *val = bundle_get_val(b, "foo_key"); // val = "bar_val"
285 bundle_free(b); // After freeing b, val becomes a dangling pointer.
289 API const char* bundle_get_val(bundle *b, const char *key);
292 * @brief Get the number of bundle items
293 * @pre b must be a valid bundle object.
296 * @param[in] b bundle object
297 * @return Number of bundle items
301 bundle *b = bundle_create(); // Create new bundle object
302 bundle_add(b, "key1", "val1"); // add a key-val pair
303 int count = bundle_get_count(b); // count=1
304 bundle_add(b, "key2", "val2"); // add another key-val pair
305 count = bundle_get_count(b); // count=2
310 API int bundle_get_count(bundle *b);
314 * @brief Get a type of a value with certain key
315 * @pre b must be a valid bundle object
318 * @param[in] b A bundle
319 * @param[in] key A key in bundle
320 * @return Type of a key in b
325 API int bundle_get_type(bundle *b, const char *key);
329 * @brief Duplicate given bundle object
330 * @pre b must be a valid bundle object.
333 * @param[in] b_from bundle object to be duplicated
334 * @return New bundle object
335 * @retval NULL Failure
339 bundle *b = bundle_create(); // Create new bundle object
340 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
341 bundle *b_dup = bundle_dup(b); // duplicate b
347 API bundle * bundle_dup(bundle *b_from);
350 * @brief iterate callback function with each key/val pairs in bundle. (NOTE: Only BUNDLE_TYPE_STR type values come!)
351 * @pre b must be a valid bundle object.
354 * @param[in] b bundle object
355 * @param[in] callback iteration callback function
356 * @param[in] data data for callback function
357 * @remark This function is obsolete, and does not give values whose types are not BUNDLE_TYPE_STR.
361 void sample_cb(const char *k, const char *v, void *data) {
362 printf("%s -> %s\n", k, v);
366 bundle *b = bundle_create(); // Create new bundle object
367 bundle_add(b, "k1", "v1"); // add a key-val pair
368 bundle_add(b, "k2", "v2"); // add a key-val pair
369 bundle_add(b, "k3", "v3"); // add a key-val pair
370 bundle_iterate(b, sample_cb, NULL); // iterate sample_cb for each key/val
375 API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
379 * @brief iterate callback function with each key/val pairs in bundle. (Supports all types of value)
380 * @pre b must be a valid bundle object.
382 * @see bundle_keyval_get_type bundle_keyval_type_is_array bundle_keyval_get_basic_val bundle_keyval_get_array_val
383 * @param[in] b bundle object
384 * @param[in] iter iteration callback function
385 * @param[in] user_data data for callback function
386 * @remark This function supports all types.
390 void sample_cb(const char *key, const int type, const bundle_keyval_t *kv, void *user_data) {
391 void *basic_val = NULL;
392 size_t basic_size = 0;
393 void **array_val = NULL;
395 size_t *array_elem_size = NULL;
397 printf("Key:%s, Type:%d\n", key, type);
398 if(bundle_keyval_type_is_array(kv)) {
399 bundle_keyval_get_array_val(kv, &array_val, &array_len, &array_elem_size);
403 bundle_keyval_get_basic_val(kv, &basic_val, &size);
409 bundle *b = bundle_create(); // Create new bundle object
410 bundle_add_str(b, "k1", "v1"); // add a key-val pair
411 bundle_add_byte(b, "k2", "v2", 3); // add a key-val pair
412 char *s_arr[] = {"abc", "bcd", "cde"};
413 bundle_add_str_array(b, "k3", s_arr, 3); // add a key-val pair
414 bundle_iterate(b, sample_cb, NULL); // iterate sample_cb for each key/val
419 API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data);
423 * @brief Get type for a bundle_keyval_t object.
424 * @pre kv must be a valid bundle_keyval_t object.
426 * @see bundle_foreach
427 * @param[in] kv A bundle_keyval_t object
429 * @retval -1 Operation failure. errno is set.
432 API int bundle_keyval_get_type(bundle_keyval_t *kv);
436 * @brief Determine if kv is array type or not.
437 * @pre kv must be a valid bundle_keyval_t object.
439 * @see bundle_foreach
440 * @param[in] kv A bundle_keyval_t object
441 * @return Operation result
442 * @retval 1 kv is an array.
443 * @retval 0 kv is not an array.
446 API int bundle_keyval_type_is_array(bundle_keyval_t *kv);
450 * @brief Get value and size of the value from kv of basic type.
451 * @pre kv must be a valid bundle_keyval_t object.
452 * @post val, size are set.
453 * @see bundle_foreach
454 * @param[in] kv A bundle_keyval_t object
455 * @param[out] val Value
456 * @param[out] size Size of val
457 * @return Operation result
459 * @remark Do not free val.
461 API int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *size);
465 * @brief Get value array, length of array, and size of each array item
466 * @pre kv must be a valid bundle_keyval_t object.
467 * @post array_val, array_len, array_item_size are set.
468 * @see bundle_foreach
469 * @param[in] kv A bundle_keyval_t object
470 * @param[out] array_val Array pointer of values
471 * @param[out] array_len Length of array_val
472 * @param[out] array_element_size Array of size of each array element
473 * @return Operation result
478 API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsigned int *array_len, size_t **array_element_size);
482 * @brief Encode bundle to bundle_raw format (uses base64 format)
483 * @pre b must be a valid bundle object.
486 * @param[in] b bundle object
487 * @param[out] r returned bundle_raw data(byte data)
488 * r MUST BE FREED by free(r).
489 * @param[out] len size of r (in bytes)
490 * @return size of raw data
496 bundle *b = bundle_create(); // Create new bundle object
497 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
500 bundle_encode(b, &r, &len); // encode b
502 bundle_free_encoded_rawdata(r);
506 API int bundle_encode(bundle *b, bundle_raw **r, int *len);
509 * @brief Free encoded rawdata from memory
510 * @pre r is a valid rawdata generated by bundle_encode().
513 * @param[in] r is a rawdata
514 * @return Operation result
519 API int bundle_free_encoded_rawdata(bundle_raw **r);
522 * @brief deserialize bundle_raw, and get bundle object
523 * @pre b must be a valid bundle object.
526 * @param[in] r bundle_raw data to be converted to bundle object
527 * @param[in] len size of r
528 * @return bundle object
529 * @retval NULL Failure
533 bundle *b = bundle_create(); // Create new bundle object
534 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
536 bundle_raw *encoded_b;
538 bundle_encode(b, &encoded_b, &len); // encode b
541 b_dup = bundle_decode(encoded_b, len); // decoded bundle object
548 API bundle * bundle_decode(const bundle_raw *r, const int len);
552 * @brief Export bundle to argv
553 * @pre b is a valid bundle object.
554 * @post argv is a pointer of newly allocated memory. It must be freed.
555 * Each item of argv points the string in the bundle object b. If b is freed, argv will have garbage pointers. DO NOT FREE b BEFORE ACCESSING argv!!
556 * @see bundle_import_from_argv
557 * @param[in] b bundle object
558 * @param[out] argv Pointer of string array.
559 * This array has NULL values for first and last item.
560 * First NULL is for argv[0], and last NULL is a terminator for execv().
561 * @return Number of item in argv. This value is equal to actual count of argv - 1. (Last NULL terminator is not counted.)
562 * @retval -1 Function failure. Check errno to get the reason.
566 bundle *b = bundle_create(); // Create new bundle object
567 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
571 argc = bundle_export_to_argv(b, &argv); // export to argv
572 if(0 > argc) error("export failure");
575 for(i=0; i < argc; i++) {
576 printf("%s\n", argv[i]); // print argv
578 bundle_free_exported_argv(argc, argv); // argv must be freed after being used.
583 API int bundle_export_to_argv(bundle *b, char ***argv);
586 * @brief Free exported argv
587 * @pre argv is a valid string array generated from bundle_export_to_argv().
589 * @see bundle_export_to_argv
590 * @param[in] argc number of args, which is the return value of bundle_export_to_argv().
591 * @param[in] argv array from bundle_export_to_argv().
592 * @return Operation result.
593 * @retval 0 on success
594 * @retval -1 on failure
595 * @remark You must not use this API when you use global argv.
597 bundle *b = bundle_create();
598 bundle_add_str(b, "foo", "bar");
602 argc = bundle_export_to_argv(b, &argv);
603 if(0 > argc) error("export failure");
607 bundle_free_export_argv(argc, argv);
613 API int bundle_free_exported_argv(int argc, char ***argv);
616 * @brief import a bundle from argv
617 * @pre argv is a valid string array, which is created by bundle_export_to_argv().
618 * @post Returned bundle b must be freed.
619 * @see bundle_export_to_argv
620 * @param[in] argc argument count
621 * @param[in] argv argument vector
622 * @return New bundle object
623 * @retval NULL Function failure
628 int main(int argc, char **argv) {
629 bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
630 char *val = bundle_get_val(b, "foo_key"); // value for "foo_key"
632 bundle_free(b); // After freeing b, val becomes a dangling pointer.
637 API bundle * bundle_import_from_argv(int argc, char **argv);
641 * @brief Add a string type key-value pair into bundle.
642 * @pre b must be a valid bundle object.
644 * @see bundle_get_str()
645 * @param[in] b bundle object
647 * @param[in] str string type value
648 * @return Operation result
652 * @remark When -1 is returned, errno is set to one of the following values; \n
653 EKEYREJECTED : key is rejected (NULL or sth) \n
654 EPERM : key is already exist, not permitted to overwrite value \n
655 EINVAL : b or val is not valid (NULL or sth) \n
658 bundle *b = bundle_create(); // Create new bundle object
659 bundle_add_str(b, "foo", "bar"); // add a key-val pair
664 API int bundle_add_str(bundle *b, const char *key, const char *str);
667 * @brief Set a value of string array element
668 * @pre b must be a valid bundle object.
670 * @see bundle_add_str_array()
671 * @see bundle_get_str_array()
672 * @param[in] b bundle object
674 * @param[in] idx index of array element to be changed
675 * @param[in] val string type value. If NULL, empty array is created. You can change an item with
676 * @return Operation result
680 * @remark When -1 is returned, errno is set to one of the following values; \n
681 EKEYREJECTED : key is rejected (NULL or sth) \n
682 EPERM : key is already exist, not permitted to overwrite value \n
683 EINVAL : b or val is not valid (NULL or sth) \n
686 bundle *b = bundle_create();
687 bundle_add_str_array(b, "foo", NULL, 3); // add a key-val pair
688 bundle_set_str_array_element(b, "foo", 0, "aaa");
689 bundle_set_str_array_element(b, "foo", 1, "bbb");
690 bundle_set_str_array_element(b, "foo", 2, "ccc");
692 char **str_array = NULL;
693 int len_str_array = 0;
695 str_array=bundle_get_str_array(b, "foo", &len_str_array);
696 // str_array = { "aaa", "bbb", "ccc" }, and len_str_array = 3
701 API int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int idx, const char *val);
704 * @brief Add a byte type key-value pair into bundle.
705 * @pre b must be a valid bundle object.
707 * @see bundle_get_byte()
708 * @param[in] b bundle object
710 * @param[in] byte string type value
711 * @param[in] size size of byte
712 * @return Operation result
716 * @remark When -1 is returned, errno is set to one of the following values; \n
717 EKEYREJECTED : key is rejected (NULL or sth) \n
718 EPERM : key is already exist, not permitted to overwrite value \n
719 EINVAL : b or val is not valid (NULL or sth) \n
722 bundle *b = bundle_create(); // Create new bundle object
723 bundle_add_byte(b, "foo", "bar\0", 4); // add a key-val pair
729 API int bundle_add_byte(bundle *b, const char *key, const void *byte, const size_t size);
732 * @brief Add a byte array type key-value pair into bundle.
733 * @pre b must be a valid bundle object.
735 * @see bundle_get_str_array()
736 * @see bundle_set_byte_array_element()
737 * @param[in] b bundle object
739 * @param[in] byte_array Not used.
740 * @param[in] len Length of array to be created
741 * @return Operation result
745 * @remark When -1 is returned, errno is set to one of the following values; \n
746 EKEYREJECTED : key is rejected (NULL or sth) \n
747 EPERM : key is already exist, not permitted to overwrite value \n
748 EINVAL : b or val is not valid (NULL or sth) \n
751 bundle *b = bundle_create();
752 bundle_add_byte_array(b, "foo", NULL, 3); // add a byte-array with length 3
754 bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4); array[0] = "aaa\0"
755 bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4); array[1] = "bbb\0"
756 bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4); array[2] = "ccc\0"
761 API int bundle_add_byte_array(bundle *b, const char *key, void **byte_array, const unsigned int len);
764 * @brief Set a value of byte array element
765 * @pre b must be a valid bundle object.
767 * @see bundle_add_str_array()
768 * @see bundle_get_str_array()
769 * @param[in] b bundle object
771 * @param[in] idx index of array element to be changed
772 * @param[in] val string type value. If NULL, empty array is created. You can change an item with
773 * @param[in] size Size of value in byte
774 * @return Operation result
778 * @remark When -1 is returned, errno is set to one of the following values; \n
779 EKEYREJECTED : key is rejected (NULL or sth) \n
780 EPERM : key is already exist, not permitted to overwrite value \n
781 EINVAL : b or val is not valid (NULL or sth) \n
784 bundle *b = bundle_create();
785 bundle_add_byte_array(b, "foo", NULL, 3); // add a key-val pair
786 bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
787 bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
788 bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
790 unsigned char **byte_array = NULL;
791 int len_byte_array = 0;
793 byte_array=bundle_get_str_array(b, "foo", &len_byte_array);
794 // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, and len_byte_array = 3
799 API int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int idx, const void *val, const size_t size);
802 * @brief Get string value from key
803 * @pre b must be a valid bundle object.
805 * @see bundle_add_str()
806 * @param[in] b bundle object
808 * @param[out] str returned value
809 * @return Operation result
810 * @retval 0 on success
811 * @retval -1 on failure
812 * @remark Do not free str!
813 When -1 is returned, errno is set to one of the following values; \n
814 EINVAL : b is invalid \n
815 ENOKEY : No key exists \n
816 EKEYREJECTED : invalid key (NULL or sth) \n
819 bundle *b = bundle_create(); // Create new bundle object
820 bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
823 bundle_get_str(b, "foo_key", &v); // v = "bar_val"
825 bundle_free(b); // After freeing b, v becomes a dangling pointer.
829 API int bundle_get_str(bundle *b, const char *key, char **str);
832 * @brief Get byte value from key
833 * @pre b must be a valid bundle object.
835 * @see bundle_add_byte()
836 * @param[in] b bundle object
838 * @param[out] byte returned value
839 * @param[out] size Size of byte
840 * @return Operation result
841 * @retval 0 on success
842 * @retval -1 on failure
843 * @remark Do not free str!
844 When -1 is returned, errno is set to one of the following values; \n
845 EINVAL : b is invalid \n
846 ENOKEY : No key exists \n
847 EKEYREJECTED : invalid key (NULL or sth) \n
850 bundle *b = bundle_create(); // Create new bundle object
851 bundle_add_byte(b, "foo", "bar\0", 4); // add a key-val pair
853 unsigned char *v = NULL;
854 bundle_get_str(b, "foo", &v); // v = "bar\0"
856 bundle_free(b); // After freeing b, v becomes a dangling pointer.
859 API int bundle_get_byte(bundle *b, const char *key, void **byte, size_t *size);
862 * @brief Get byte array value from key
863 * @pre b must be a valid bundle object.
865 * @see bundle_add_str_array()
866 * @see bundle_set_str_array_element()
867 * @param[in] b bundle object
869 * @param[out] byte_array returned value
870 * @param[out] len array length
871 * @param[out] array_element_size an array of sizes of each byte_array element
872 * @return Operation result
873 * @retval 0 on success
874 * @retval -1 on failure
875 * @remark Do not free str!
876 When -1 is returned, errno is set to one of the following values; \n
877 EINVAL : b is invalid \n
878 ENOKEY : No key exists \n
879 EKEYREJECTED : invalid key (NULL or sth) \n
882 bundle *b = bundle_create();
883 bundle_add_byte_array(b, "foo", NULL, 3);
884 bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
885 bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
886 bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
888 char **byte_array = NULL;
889 int len_byte_array = 0;
890 size_t *size_byte_array = NULL;
892 byte_array = bundle_get_str_array(b, "foo", &len_byte_array, &size_byte_array);
893 // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, len_byte_array = 3, and size_byte_array = { 4, 4, 4 }
898 API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size);
911 #endif /* __BUNDLE_H__ */