diff options
author | Stef Walter <stef@memberwebs.com> | 2007-04-27 03:19:46 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2007-04-27 03:19:46 +0000 |
commit | 3d8ed01d2653c45e52821ba00ac72099a12600e1 (patch) | |
tree | ad13d6df465ef1a4f143109f04c35991ddb1efba /ckcapi-util.h |
Diffstat (limited to 'ckcapi-util.h')
-rw-r--r-- | ckcapi-util.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ckcapi-util.h b/ckcapi-util.h new file mode 100644 index 0000000..b37ea39 --- /dev/null +++ b/ckcapi-util.h @@ -0,0 +1,46 @@ + +#ifndef __CKCAPI_UTIL_H__ +#define __CKCAPI_UTIL_H__ + +#include <stdlib.h> + +/* -------------------------------------------------------------------------------- + * WINDOWS + */ + +CK_RV ckcapi_util_win_to_cryptoki_err (DWORD werr); + + +/* -------------------------------------------------------------------------------- + * ARRAYS + */ + +typedef struct _Array +{ + void* data; + size_t len; +} +Array; + +#define ckcapi_util_array_append(a,v) \ + ckcapi_util_array_append_vals(a, &(v), 1) +#define ckcapi_util_array_index(a,t,i) \ + (((t*) (a)->data) [(i)]) + +Array* ckcapi_util_array_new (int zero_terminated, int zero, + size_t element_size); + +Array* ckcapi_util_array_sized_new (int zero_terminated, int zero, + size_t element_size, size_t reserved_size); + +void* ckcapi_util_array_free (Array* array, int free_segment); + +int ckcapi_util_array_append_vals (Array* array, const void* data, + size_t num); + +void ckcapi_util_array_remove_index (Array* array, unsigned int index); + +void ckcapi_util_array_remove_range (Array* array, unsigned int index, + size_t count); + +#endif /* __CKCAPI_UTIL_H__ */
\ No newline at end of file |