2 * This file is part of buxton.
4 * Copyright (C) 2013 Intel Corporation
6 * buxton is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1
9 * of the License, or (at your option) any later version.
21 #include "buxtondata.h"
25 * Represents daemon's reply to client
27 typedef struct BuxtonArray {
28 void **data; /**<Dynamic array contents */
29 uint len; /**<Length of the array */
34 * Valid function prototype for 'free' method
35 * @param p Pointer to free
37 typedef void (*buxton_free_func) (void* p);
40 * Create a new BuxtonArray
41 * @returns BuxtonArray a newly allocated BuxtonArray
43 BuxtonArray *buxton_array_new(void)
44 __attribute__((warn_unused_result));
47 * Append data to BuxtonArray
48 * @param array Valid BuxtonArray
49 * @param data Pointer to add to this array
50 * @returns bool true if the data was added to the array
52 bool buxton_array_add(BuxtonArray *array,
54 __attribute__((warn_unused_result));
57 * Free an array, and optionally its members
58 * @param array valid BuxtonArray reference
59 * @param free_func Function to call to free all members, or NULL to leave allocated
61 void buxton_array_free(BuxtonArray **array,
62 buxton_free_func free_method);
66 * Retrieve a BuxtonData from the array by index
67 * @param array valid BuxtonArray reference
68 * @param index index of the element in the array
69 * @return a data pointer refered to by index, or NULL
71 void *buxton_array_get(BuxtonArray *array, uint16_t index)
72 __attribute__((warn_unused_result));
75 * Editor modelines - http://www.wireshark.org/tools/modelines.html
83 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
84 * :indentSize=8:tabSize=8:noTabs=false: