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")))
57 #define likely(x) __builtin_expect(x,1)
58 #define unlikely(x) __builtin_expect(x,0)
61 * bundle is an opaque type pointing a bundle object
63 typedef struct _bundle_t bundle;
66 * bundle_raw is an encoded data type
67 * @see bundle_encode()
68 * @see bundle_decode()
70 typedef unsigned char bundle_raw;
74 * Each bundle keyval have a type.
76 enum bundle_type_property {
77 BUNDLE_TYPE_ARRAY = 0x0100,
78 BUNDLE_TYPE_PRIMITIVE = 0x0200,
79 BUNDLE_TYPE_MEASURABLE = 0x0400
83 BUNDLE_TYPE_NONE = -1,
85 BUNDLE_TYPE_STR = 1 | BUNDLE_TYPE_MEASURABLE, /* Default */
86 BUNDLE_TYPE_STR_ARRAY = BUNDLE_TYPE_STR | BUNDLE_TYPE_ARRAY | BUNDLE_TYPE_MEASURABLE,
88 BUNDLE_TYPE_BYTE_ARRAY = BUNDLE_TYPE_BYTE | BUNDLE_TYPE_ARRAY
92 * A keyval object in a bundle.
93 * @see bundle_iterator_t
95 typedef struct keyval_t bundle_keyval_t;
99 * bundle_iterator is a new iterator function type for bundle_foreach()
100 * @see bundle_foreach()
102 typedef void (*bundle_iterator_t) (
105 const bundle_keyval_t *kv,
111 * bundle_iterate_cb_t is an iterator function type for bundle_iterate()
112 * @see bundle_iterate()
113 * @remark This type is obsolete. Do not use this type any more.
115 typedef void (*bundle_iterate_cb_t) (const char *key, const char *val, void *data);
119 * @brief Create a bundle object.
123 * @return bundle object
124 * @retval NULL on failure creating an object
125 * @remark When NULL is returned, errno is set to one of the following values; \n
126 * ENOMEM : No memory to create an object
130 bundle *b = bundle_create(); // Create new bundle object
131 bundle_free(b); // free bundle
134 API bundle* bundle_create(void);
137 * @brief Free given bundle object with key/values in it
138 * @pre b must be a valid bundle object.
140 * @see bundle_create()
141 * @param[in] b bundle object to be freed
142 * @return Operation result;
148 bundle *b = bundle_create(); // Create new bundle object
149 bundle_free(b); // free bundle
152 API int bundle_free(bundle *b);
154 * @brief Add a string array type key-value pair into bundle.
155 * @pre b must be a valid bundle object.
157 * @see bundle_get_str_array()
158 * @see bundle_set_str_array_element()
159 * @param[in] b bundle object
161 * @param[in] str_array string type value. If NULL, empty array is created. You can change an item with
162 * @param[in] len Length of array.
163 * @return Operation result
167 * @remark When -1 is returned, errno is set to one of the following values; \n
168 EKEYREJECTED : key is rejected (NULL or sth) \n
169 EPERM : key is already exist, not permitted to overwrite value \n
170 EINVAL : b or val is not valid (NULL or sth) \n
173 char *sa = { "aaa", "bbb", "ccc" }; // A string array of length 3
174 bundle *b = bundle_create();
175 bundle_add_str_array(b, "foo", sa, 3); // add a key-val pair
179 API int bundle_add_str_array(bundle *b, const char *key, const char **str_array, const int len);
181 * @brief Add a string type key-value pair into bundle.
182 * @pre b must be a valid bundle object.
184 * @see bundle_add_str()
185 * @param[in] b bundle object
187 * @param[in] val value
188 * @return Operation result
192 * @remark When -1 is returned, errno is set to one of the following values; \n
193 EKEYREJECTED : key is rejected (NULL or sth) \n
194 EPERM : key is already exist, not permitted to overwrite value \n
195 EINVAL : b or val is not valid (NULL or sth) \n
198 bundle *b = bundle_create(); // Create new bundle object
199 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
204 API int bundle_add(bundle *b, const char *key, const char *val);
207 * @brief Delete val with given key
208 * @pre b must be a valid bundle object.
211 * @param[in] b bundle object
212 * @param[in] key given key
213 * @return Operation result
217 * @remark When -1 is returned, errno is set to one of the following values; \n
218 EINVAL : b is invalid (NULL or sth) \n
219 ENOKEY : No key exist \n
220 EKEYREJECTED : key is invalid (NULL or sth) \n
223 bundle *b = bundle_create(); // Create new bundle object
224 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
225 bundle_del(b, "foo_key"); // del "foo_key" from b
230 API int bundle_del(bundle *b, const char* key);
232 * @brief Get string array value from key
233 * @pre b must be a valid bundle object.
235 * @see bundle_add_str_array()
236 * @see bundle_set_str_array_element()
237 * @param[in] b bundle object
239 * @param[out] len array length
240 * @return Pointer to array of string
241 * @retval NULL If key is not found, returns NULL.
242 * @remark DO NOT free or modify returned string!
243 When NULL is returned, errno is set to one of the following values; \n
244 EINVAL : b is invalid \n
245 ENOKEY : No key exists \n
246 EKEYREJECTED : invalid key (NULL or sth) \n
249 bundle *b = bundle_create();
250 bundle_add_str_array(b, "foo", NULL, 3); // add a key-val pair
251 bundle_set_str_array_element(b, "foo", 0, "aaa");
252 bundle_set_str_array_element(b, "foo", 1, "bbb");
253 bundle_set_str_array_element(b, "foo", 2, "ccc");
255 char **str_array = NULL;
256 int len_str_array = 0;
258 str_array=bundle_get_str_array(b, "foo", &len_str_array);
259 // str_array = { "aaa", "bbb", "ccc" }, and len_str_array = 3
265 API const char** bundle_get_str_array(bundle *b, const char *key,int *len);
267 * @brief Get value from key
268 * @pre b must be a valid bundle object.
270 * @see bundle_get_str()
271 * @param[in] b bundle object
273 * @return Pointer for value string
274 * @retval NULL If key is not found, returns NULL.
275 * @remark DO NOT free or modify returned string!
276 When NULL is returned, errno is set to one of the following values; \n
277 EINVAL : b is invalid \n
278 ENOKEY : No key exists \n
279 EKEYREJECTED : invalid key (NULL or sth) \n
282 bundle *b = bundle_create(); // Create new bundle object
283 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
284 char *val = bundle_get_val(b, "foo_key"); // val = "bar_val"
286 bundle_free(b); // After freeing b, val becomes a dangling pointer.
290 API const char* bundle_get_val(bundle *b, const char *key);
293 * @brief Get the number of bundle items
294 * @pre b must be a valid bundle object.
297 * @param[in] b bundle object
298 * @return Number of bundle items
302 bundle *b = bundle_create(); // Create new bundle object
303 bundle_add(b, "key1", "val1"); // add a key-val pair
304 int count = bundle_get_count(b); // count=1
305 bundle_add(b, "key2", "val2"); // add another key-val pair
306 count = bundle_get_count(b); // count=2
311 API int bundle_get_count(bundle *b);
315 * @brief Get a type of a value with certain key
316 * @pre b must be a valid bundle object
319 * @param[in] b A bundle
320 * @param[in] key A key in bundle
321 * @return Type of a key in b
326 API int bundle_get_type(bundle *b, const char *key);
330 * @brief Duplicate given bundle object
331 * @pre b must be a valid bundle object.
334 * @param[in] b_from bundle object to be duplicated
335 * @return New bundle object
336 * @retval NULL Failure
340 bundle *b = bundle_create(); // Create new bundle object
341 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
342 bundle *b_dup = bundle_dup(b); // duplicate b
348 API bundle * bundle_dup(bundle *b_from);
351 * @brief iterate callback function with each key/val pairs in bundle. (NOTE: Only BUNDLE_TYPE_STR type values come!)
352 * @pre b must be a valid bundle object.
355 * @param[in] b bundle object
356 * @param[in] callback iteration callback function
357 * @param[in] data data for callback function
358 * @remark This function is obsolete, and does not give values whose types are not BUNDLE_TYPE_STR.
362 void sample_cb(const char *k, const char *v, void *data) {
363 printf("%s -> %s\n", k, v);
367 bundle *b = bundle_create(); // Create new bundle object
368 bundle_add(b, "k1", "v1"); // add a key-val pair
369 bundle_add(b, "k2", "v2"); // add a key-val pair
370 bundle_add(b, "k3", "v3"); // add a key-val pair
371 bundle_iterate(b, sample_cb, NULL); // iterate sample_cb for each key/val
376 API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
380 * @brief iterate callback function with each key/val pairs in bundle. (Supports all types of value)
381 * @pre b must be a valid bundle object.
383 * @see bundle_keyval_get_type bundle_keyval_type_is_array bundle_keyval_get_basic_val bundle_keyval_get_array_val
384 * @param[in] b bundle object
385 * @param[in] iter iteration callback function
386 * @param[in] user_data data for callback function
387 * @remark This function supports all types.
391 void sample_cb(const char *key, const int type, const bundle_keyval_t *kv, void *user_data) {
392 void *basic_val = NULL;
393 size_t basic_size = 0;
394 void **array_val = NULL;
396 size_t *array_elem_size = NULL;
398 printf("Key:%s, Type:%d\n", key, type);
399 if(bundle_keyval_type_is_array(kv)) {
400 bundle_keyval_get_array_val(kv, &array_val, &array_len, &array_elem_size);
404 bundle_keyval_get_basic_val(kv, &basic_val, &size);
410 bundle *b = bundle_create(); // Create new bundle object
411 bundle_add_str(b, "k1", "v1"); // add a key-val pair
412 bundle_add_byte(b, "k2", "v2", 3); // add a key-val pair
413 char *s_arr[] = {"abc", "bcd", "cde"};
414 bundle_add_str_array(b, "k3", s_arr, 3); // add a key-val pair
415 bundle_iterate(b, sample_cb, NULL); // iterate sample_cb for each key/val
420 API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data);
424 * @brief Get type for a bundle_keyval_t object.
425 * @pre kv must be a valid bundle_keyval_t object.
427 * @see bundle_foreach
428 * @param[in] kv A bundle_keyval_t object
430 * @retval -1 Operation failure. errno is set.
433 API int bundle_keyval_get_type(bundle_keyval_t *kv);
437 * @brief Determine if kv is array type or not.
438 * @pre kv must be a valid bundle_keyval_t object.
440 * @see bundle_foreach
441 * @param[in] kv A bundle_keyval_t object
442 * @return Operation result
443 * @retval 1 kv is an array.
444 * @retval 0 kv is not an array.
447 API int bundle_keyval_type_is_array(bundle_keyval_t *kv);
451 * @brief Get value and size of the value from kv of basic type.
452 * @pre kv must be a valid bundle_keyval_t object.
453 * @post val, size are set.
454 * @see bundle_foreach
455 * @param[in] kv A bundle_keyval_t object
456 * @param[out] val Value
457 * @param[out] size Size of val
458 * @return Operation result
460 * @remark Do not free val.
462 API int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *size);
466 * @brief Get value array, length of array, and size of each array item
467 * @pre kv must be a valid bundle_keyval_t object.
468 * @post array_val, array_len, array_item_size are set.
469 * @see bundle_foreach
470 * @param[in] kv A bundle_keyval_t object
471 * @param[out] array_val Array pointer of values
472 * @param[out] array_len Length of array_val
473 * @param[out] array_element_size Array of size of each array element
474 * @return Operation result
479 API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsigned int *array_len, size_t **array_element_size);
483 * @brief Encode bundle to bundle_raw format (uses base64 format)
484 * @pre b must be a valid bundle object.
487 * @param[in] b bundle object
488 * @param[out] r returned bundle_raw data(byte data)
489 * r MUST BE FREED by free(r).
490 * @param[out] len size of r (in bytes)
491 * @return size of raw data
497 bundle *b = bundle_create(); // Create new bundle object
498 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
501 bundle_encode(b, &r, &len); // encode b
503 bundle_free_encoded_rawdata(r);
507 API int bundle_encode(bundle *b, bundle_raw **r, int *len);
510 * @brief Free encoded rawdata from memory
511 * @pre r is a valid rawdata generated by bundle_encode().
514 * @param[in] r is a rawdata
515 * @return Operation result
520 API int bundle_free_encoded_rawdata(bundle_raw **r);
523 * @brief deserialize bundle_raw, and get bundle object
524 * @pre b must be a valid bundle object.
527 * @param[in] r bundle_raw data to be converted to bundle object
528 * @param[in] len size of r
529 * @return bundle object
530 * @retval NULL Failure
534 bundle *b = bundle_create(); // Create new bundle object
535 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
537 bundle_raw *encoded_b;
539 bundle_encode(b, &encoded_b, &len); // encode b
542 b_dup = bundle_decode(encoded_b, len); // decoded bundle object
549 API bundle * bundle_decode(const bundle_raw *r, const int len);
553 * @brief Export bundle to argv
554 * @pre b is a valid bundle object.
555 * @post argv is a pointer of newly allocated memory. It must be freed.
556 * 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!!
557 * @see bundle_import_from_argv
558 * @param[in] b bundle object
559 * @param[out] argv Pointer of string array.
560 * This array has NULL values for first and last item.
561 * First NULL is for argv[0], and last NULL is a terminator for execv().
562 * @return Number of item in argv. This value is equal to actual count of argv - 1. (Last NULL terminator is not counted.)
563 * @retval -1 Function failure. Check errno to get the reason.
567 bundle *b = bundle_create(); // Create new bundle object
568 bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
572 argc = bundle_export_to_argv(b, &argv); // export to argv
573 if(0 > argc) error("export failure");
576 for(i=0; i < argc; i++) {
577 printf("%s\n", argv[i]); // print argv
579 bundle_free_exported_argv(argc, argv); // argv must be freed after being used.
584 API int bundle_export_to_argv(bundle *b, char ***argv);
587 * @brief Free exported argv
588 * @pre argv is a valid string array generated from bundle_export_to_argv().
590 * @see bundle_export_to_argv
591 * @param[in] argc number of args, which is the return value of bundle_export_to_argv().
592 * @param[in] argv array from bundle_export_to_argv().
593 * @return Operation result.
594 * @retval 0 on success
595 * @retval -1 on failure
596 * @remark You must not use this API when you use global argv.
598 bundle *b = bundle_create();
599 bundle_add_str(b, "foo", "bar");
603 argc = bundle_export_to_argv(b, &argv);
604 if(0 > argc) error("export failure");
608 bundle_free_export_argv(argc, argv);
614 API int bundle_free_exported_argv(int argc, char ***argv);
617 * @brief import a bundle from argv
618 * @pre argv is a valid string array, which is created by bundle_export_to_argv().
619 * @post Returned bundle b must be freed.
620 * @see bundle_export_to_argv
621 * @param[in] argc argument count
622 * @param[in] argv argument vector
623 * @return New bundle object
624 * @retval NULL Function failure
629 int main(int argc, char **argv) {
630 bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
631 char *val = bundle_get_val(b, "foo_key"); // value for "foo_key"
633 bundle_free(b); // After freeing b, val becomes a dangling pointer.
638 API bundle * bundle_import_from_argv(int argc, char **argv);
642 * @brief Add a string type key-value pair into bundle.
643 * @pre b must be a valid bundle object.
645 * @see bundle_get_str()
646 * @param[in] b bundle object
648 * @param[in] str string type value
649 * @return Operation result
653 * @remark When -1 is returned, errno is set to one of the following values; \n
654 EKEYREJECTED : key is rejected (NULL or sth) \n
655 EPERM : key is already exist, not permitted to overwrite value \n
656 EINVAL : b or val is not valid (NULL or sth) \n
659 bundle *b = bundle_create(); // Create new bundle object
660 bundle_add_str(b, "foo", "bar"); // add a key-val pair
665 API int bundle_add_str(bundle *b, const char *key, const char *str);
668 * @brief Set a value of string array element
669 * @pre b must be a valid bundle object.
671 * @see bundle_add_str_array()
672 * @see bundle_get_str_array()
673 * @param[in] b bundle object
675 * @param[in] idx index of array element to be changed
676 * @param[in] val string type value. If NULL, empty array is created. You can change an item with
677 * @return Operation result
681 * @remark When -1 is returned, errno is set to one of the following values; \n
682 EKEYREJECTED : key is rejected (NULL or sth) \n
683 EPERM : key is already exist, not permitted to overwrite value \n
684 EINVAL : b or val is not valid (NULL or sth) \n
687 bundle *b = bundle_create();
688 bundle_add_str_array(b, "foo", NULL, 3); // add a key-val pair
689 bundle_set_str_array_element(b, "foo", 0, "aaa");
690 bundle_set_str_array_element(b, "foo", 1, "bbb");
691 bundle_set_str_array_element(b, "foo", 2, "ccc");
693 char **str_array = NULL;
694 int len_str_array = 0;
696 str_array=bundle_get_str_array(b, "foo", &len_str_array);
697 // str_array = { "aaa", "bbb", "ccc" }, and len_str_array = 3
702 API int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int idx, const char *val);
705 * @brief Add a byte type key-value pair into bundle.
706 * @pre b must be a valid bundle object.
708 * @see bundle_get_byte()
709 * @param[in] b bundle object
711 * @param[in] byte string type value
712 * @param[in] size size of byte
713 * @return Operation result
717 * @remark When -1 is returned, errno is set to one of the following values; \n
718 EKEYREJECTED : key is rejected (NULL or sth) \n
719 EPERM : key is already exist, not permitted to overwrite value \n
720 EINVAL : b or val is not valid (NULL or sth) \n
723 bundle *b = bundle_create(); // Create new bundle object
724 bundle_add_byte(b, "foo", "bar\0", 4); // add a key-val pair
730 API int bundle_add_byte(bundle *b, const char *key, const void *byte, const size_t size);
733 * @brief Add a byte array type key-value pair into bundle.
734 * @pre b must be a valid bundle object.
736 * @see bundle_get_str_array()
737 * @see bundle_set_byte_array_element()
738 * @param[in] b bundle object
740 * @param[in] byte_array Not used.
741 * @param[in] len Length of array to be created
742 * @return Operation result
746 * @remark When -1 is returned, errno is set to one of the following values; \n
747 EKEYREJECTED : key is rejected (NULL or sth) \n
748 EPERM : key is already exist, not permitted to overwrite value \n
749 EINVAL : b or val is not valid (NULL or sth) \n
752 bundle *b = bundle_create();
753 bundle_add_byte_array(b, "foo", NULL, 3); // add a byte-array with length 3
755 bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4); array[0] = "aaa\0"
756 bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4); array[1] = "bbb\0"
757 bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4); array[2] = "ccc\0"
762 API int bundle_add_byte_array(bundle *b, const char *key, void **byte_array, const unsigned int len);
765 * @brief Set a value of byte array element
766 * @pre b must be a valid bundle object.
768 * @see bundle_add_str_array()
769 * @see bundle_get_str_array()
770 * @param[in] b bundle object
772 * @param[in] idx index of array element to be changed
773 * @param[in] val string type value. If NULL, empty array is created. You can change an item with
774 * @param[in] size Size of value in byte
775 * @return Operation result
779 * @remark When -1 is returned, errno is set to one of the following values; \n
780 EKEYREJECTED : key is rejected (NULL or sth) \n
781 EPERM : key is already exist, not permitted to overwrite value \n
782 EINVAL : b or val is not valid (NULL or sth) \n
785 bundle *b = bundle_create();
786 bundle_add_byte_array(b, "foo", NULL, 3); // add a key-val pair
787 bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
788 bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
789 bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
791 unsigned char **byte_array = NULL;
792 int len_byte_array = 0;
794 byte_array=bundle_get_str_array(b, "foo", &len_byte_array);
795 // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, and len_byte_array = 3
800 API int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int idx, const void *val, const size_t size);
803 * @brief Get string value from key
804 * @pre b must be a valid bundle object.
806 * @see bundle_add_str()
807 * @param[in] b bundle object
809 * @param[out] str returned value
810 * @return Operation result
811 * @retval 0 on success
812 * @retval -1 on failure
813 * @remark Do not free str!
814 When -1 is returned, errno is set to one of the following values; \n
815 EINVAL : b is invalid \n
816 ENOKEY : No key exists \n
817 EKEYREJECTED : invalid key (NULL or sth) \n
820 bundle *b = bundle_create(); // Create new bundle object
821 bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
824 bundle_get_str(b, "foo_key", &v); // v = "bar_val"
826 bundle_free(b); // After freeing b, v becomes a dangling pointer.
830 API int bundle_get_str(bundle *b, const char *key, char **str);
833 * @brief Get byte value from key
834 * @pre b must be a valid bundle object.
836 * @see bundle_add_byte()
837 * @param[in] b bundle object
839 * @param[out] byte returned value
840 * @param[out] size Size of byte
841 * @return Operation result
842 * @retval 0 on success
843 * @retval -1 on failure
844 * @remark Do not free str!
845 When -1 is returned, errno is set to one of the following values; \n
846 EINVAL : b is invalid \n
847 ENOKEY : No key exists \n
848 EKEYREJECTED : invalid key (NULL or sth) \n
851 bundle *b = bundle_create(); // Create new bundle object
852 bundle_add_byte(b, "foo", "bar\0", 4); // add a key-val pair
854 unsigned char *v = NULL;
855 bundle_get_str(b, "foo", &v); // v = "bar\0"
857 bundle_free(b); // After freeing b, v becomes a dangling pointer.
860 API int bundle_get_byte(bundle *b, const char *key, void **byte, size_t *size);
863 * @brief Get byte array value from key
864 * @pre b must be a valid bundle object.
866 * @see bundle_add_str_array()
867 * @see bundle_set_str_array_element()
868 * @param[in] b bundle object
870 * @param[out] byte_array returned value
871 * @param[out] len array length
872 * @param[out] array_element_size an array of sizes of each byte_array element
873 * @return Operation result
874 * @retval 0 on success
875 * @retval -1 on failure
876 * @remark Do not free str!
877 When -1 is returned, errno is set to one of the following values; \n
878 EINVAL : b is invalid \n
879 ENOKEY : No key exists \n
880 EKEYREJECTED : invalid key (NULL or sth) \n
883 bundle *b = bundle_create();
884 bundle_add_byte_array(b, "foo", NULL, 3);
885 bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
886 bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
887 bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
889 char **byte_array = NULL;
890 int len_byte_array = 0;
891 size_t *size_byte_array = NULL;
893 byte_array = bundle_get_str_array(b, "foo", &len_byte_array, &size_byte_array);
894 // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, len_byte_array = 3, and size_byte_array = { 4, 4, 4 }
899 API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size);
912 #endif /* __BUNDLE_H__ */