wickr-crypto-c

array.h
1 /*
2 * Copyright © 2012-2020 Wickr Inc. All rights reserved.
3 *
4 * This code is being released for EDUCATIONAL, ACADEMIC, AND CODE REVIEW PURPOSES
5 * ONLY. COMMERCIAL USE OF THE CODE IS EXPRESSLY PROHIBITED. For additional details,
6 * please see LICENSE
7 *
8 * THE CODE IS MADE AVAILABLE "AS-IS" AND WITHOUT ANY EXPRESS OR
9 * IMPLIED GUARANTEES AS TO FITNESS, MERCHANTABILITY, NON-
10 * INFRINGEMENT OR OTHERWISE. IT IS NOT BEING PROVIDED IN TRADE BUT ON
11 * A VOLUNTARY BASIS ON BEHALF OF THE AUTHOR’S PART FOR THE BENEFIT
12 * OF THE LICENSEE AND IS NOT MADE AVAILABLE FOR CONSUMER USE OR ANY
13 * OTHER USE OUTSIDE THE TERMS OF THIS LICENSE. ANYONE ACCESSING THE
14 * CODE SHOULD HAVE THE REQUISITE EXPERTISE TO SECURE THEIR SYSTEM
15 * AND DEVICES AND TO ACCESS AND USE THE CODE FOR REVIEW PURPOSES
16 * ONLY. LICENSEE BEARS THE RISK OF ACCESSING AND USING THE CODE. IN
17 * PARTICULAR, AUTHOR BEARS NO LIABILITY FOR ANY INTERFERENCE WITH OR
18 * ADVERSE EFFECT THAT MAY OCCUR AS A RESULT OF THE LICENSEE
19 * ACCESSING AND/OR USING THE CODE ON LICENSEE’S SYSTEM.
20 */
21
22 #ifndef array_h
23 #define array_h
24
25 #include <stdlib.h>
26 #include "buffer.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
34 struct wickr_array;
35 typedef struct wickr_array wickr_array_t;
36
37 typedef void *(*wickr_array_copy_func)(void*);
38 typedef void (*wickr_array_destroy_func)(void**);
39
51 wickr_array_t *wickr_array_new(uint32_t item_count,
52 uint8_t item_type,
53 wickr_array_copy_func item_copy_func,
54 wickr_array_destroy_func item_destroy_func);
55
56
67 uint32_t wickr_array_get_item_count(const wickr_array_t *array);
68
80 bool wickr_array_set_item(wickr_array_t *array, uint32_t index, void *item, bool copy);
81
82
94 void *wickr_array_fetch_item(const wickr_array_t *array, uint32_t index, bool copy);
95
106 wickr_array_t *wickr_array_copy(const wickr_array_t *array, bool deep_copy);
107
116 void wickr_array_destroy(wickr_array_t **array, bool destroy_items);
117
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #endif /* array_h */
wickr_array_copy
wickr_array_t * wickr_array_copy(const wickr_array_t *array, bool deep_copy)
wickr_array_fetch_item
void * wickr_array_fetch_item(const wickr_array_t *array, uint32_t index, bool copy)
wickr_array_set_item
bool wickr_array_set_item(wickr_array_t *array, uint32_t index, void *item, bool copy)
wickr_array_destroy
void wickr_array_destroy(wickr_array_t **array, bool destroy_items)
wickr_array_new
wickr_array_t * wickr_array_new(uint32_t item_count, uint8_t item_type, wickr_array_copy_func item_copy_func, wickr_array_destroy_func item_destroy_func)
wickr_array_get_item_count
uint32_t wickr_array_get_item_count(const wickr_array_t *array)