zuluCrypt  5.7.1
About: zuluCrypt is a simple but feature rich solution for hard drives encryption. It can manage PLAIN dm-crypt, LUKS, TrueCrypt and VeraCrypt encrypted volumes.
  Fossies Dox: zuluCrypt-5.7.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

zuluplay_api.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Alex Hornung <alex@alexhornung.com>.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 #ifndef _TCPLAY_API_H
31 #define _TCPLAY_API_H
32 
33 #include <stddef.h>
34 #include <sys/types.h>
35 
36 #define TC_OK 0
37 #define TC_ERR -1
38 #define TC_ERR_UNIMPL -255
39 
40 #define TC_STATE_ENTER 1
41 #define TC_STATE_EXIT 0
42 
43 struct _tc_api_task;
44 
45 typedef struct _tc_api_task *tc_api_task;
46 
47 typedef int (*tc_api_cipher_iterator_fn)(void *, const char *, int /* klen */, int /* length */);
48 typedef int (*tc_api_prf_iterator_fn)(void *, const char *);
49 typedef int (*tc_api_state_change_fn)(void *, const char *, int);
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #define TCPLAY_VOLUME_INFO_FIELD_SIZE 64
56 
57 typedef struct{
58 
59  const char *device;
60  const char *status;
61 
67 
68  void (*format_offset)(u_int64_t, char *, size_t);
69 
71 
72  struct{
73  const char *dm_key;
74  const char *cipher;
75  }crypto[3];
76 
78 
79 int tc_api_init(int verbose);
80 int tc_api_uninit(void);
81 
82 int tc_api_has(const char *feature);
83 
85 int tc_api_prf_iterate(tc_api_prf_iterator_fn fn, void *priv);
86 
87 tc_api_task tc_api_task_init(const char *op);
89 int tc_api_task_set(tc_api_task task, const char *key, ...);
90 int tc_api_task_do(tc_api_task task);
91 
92 int tc_api_task_info_get(tc_api_task task, const char *key, ...);
93 const char *tc_api_task_get_error(tc_api_task task);
94 
95 void tc_api_get_volume_type(char *buffer, size_t size, const char*);
96 int tc_api_close_mapper(const char*);
97 
98 static inline int tc_api_initialize(void)
99 {
100  return tc_api_init(0) == TC_OK;
101 }
102 
103 static inline int tc_api_task_initialize(tc_api_task *task, const char *op)
104 {
105  *task = tc_api_task_init(op);
106  return *task != 0;
107 }
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif
tc_api_task_initialize
static int tc_api_task_initialize(tc_api_task *task, const char *op)
Definition: zuluplay_api.h:103
tc_api_initialize
static int tc_api_initialize(void)
Definition: zuluplay_api.h:98
tc_api_task_do
int tc_api_task_do(tc_api_task task)
Definition: tcplay_api.c:778
tc_api_get_volume_type
void tc_api_get_volume_type(char *buffer, size_t size, const char *)
Definition: tcplay_api.c:235
_tc_api_task::op
tc_api_op op
Definition: tcplay_api_internal.h:47
tc_api_task_get_error
const char * tc_api_task_get_error(tc_api_task task)
Definition: tcplay_api.c:129
tc_api_prf_iterate
int tc_api_prf_iterate(tc_api_prf_iterator_fn fn, void *priv)
Definition: tcplay_api.c:110
tc_api_prf_iterator_fn
int(* tc_api_prf_iterator_fn)(void *, const char *)
Definition: zuluplay_api.h:48
tcplay_volume_info::device
const char * device
Definition: zuluplay_api.h:59
tc_api_task_uninit
int tc_api_task_uninit(tc_api_task task)
Definition: tcplay_api.c:187
tc_api_cipher_iterator_fn
int(* tc_api_cipher_iterator_fn)(void *, const char *, int, int)
Definition: zuluplay_api.h:47
tc_api_has
int tc_api_has(const char *feature)
Definition: tcplay_api.c:70
tcplay_volume_info::cipher
const char * cipher
Definition: zuluplay_api.h:74
TC_OK
#define TC_OK
Definition: zuluplay_api.h:36
tc_api_cipher_iterate
int tc_api_cipher_iterate(tc_api_cipher_iterator_fn fn, void *priv)
Definition: tcplay_api.c:84
tcplay_volume_info::status
const char * status
Definition: zuluplay_api.h:60
tc_api_task_info_get
int tc_api_task_info_get(tc_api_task task, const char *key,...)
Definition: tcplay_api.c:916
tc_api_task
struct _tc_api_task * tc_api_task
Definition: zuluplay_api.h:45
tcplay_volume_info
Definition: zuluplay_api.h:57
tcplay_volume_info::dm_key
const char * dm_key
Definition: zuluplay_api.h:73
tc_api_uninit
int tc_api_uninit(void)
Definition: tcplay_api.c:57
tc_api_state_change_fn
int(* tc_api_state_change_fn)(void *, const char *, int)
Definition: zuluplay_api.h:49
tc_api_init
int tc_api_init(int verbose)
Definition: tcplay_api.c:44
tcplay_volume_info::crypto_count
int crypto_count
Definition: zuluplay_api.h:70
_tc_api_task
Definition: tcplay_api_internal.h:46
tc_api_task_set
int tc_api_task_set(tc_api_task task, const char *key,...)
Definition: tcplay_api.c:312
TCPLAY_VOLUME_INFO_FIELD_SIZE
#define TCPLAY_VOLUME_INFO_FIELD_SIZE
Definition: zuluplay_api.h:55
tc_api_task_init
tc_api_task tc_api_task_init(const char *op)
Definition: tcplay_api.c:138
tc_api_close_mapper
int tc_api_close_mapper(const char *)
Definition: tcplay.c:2142