Move AIO manual pages to librt.
[dragonfly.git] / lib / libtcplay / tcplay_api_test.c
blob3be7ae6a8e34472c8fc3f51ccf78eb82e32153be
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <assert.h>
6 #include "tcplay_api.h"
8 int
9 main(void)
11 tc_api_opts api_opts;
12 int error;
14 error = tc_api_init(/* verbose */1);
15 assert(error == 0);
17 memset(&api_opts, 0, sizeof(api_opts));
18 api_opts.tc_device = "/dev/vn1s0";
19 api_opts.tc_passphrase = "apitest2";
20 api_opts.tc_keyfiles = NULL;
21 api_opts.tc_keyfiles_hidden = NULL;
22 api_opts.tc_size_hidden_in_bytes = 12000*512;
23 api_opts.tc_passphrase_hidden = "apihidden";
24 api_opts.tc_cipher = "AES-256-XTS,TWOFISH-256-XTS,SERPENT-256-XTS";
25 api_opts.tc_cipher_hidden = "SERPENT-256-XTS,TWOFISH-256-XTS";
26 api_opts.tc_prf_hash = "whirlpool";
27 api_opts.tc_prf_hash_hidden = "RIPEMD160";
29 error = tc_api_create_volume(&api_opts);
30 if (error)
31 printf("API ERROR: %s\n", tc_api_get_error_msg());
32 assert(error == 0);
34 error = tc_api_uninit();
35 assert(error == 0);
37 error = tc_api_init(/*verbose */ 1);
38 assert(error == 0);
40 api_opts.tc_passphrase = NULL;
41 api_opts.tc_map_name = "dragonfly-test";
42 api_opts.tc_password_retries = 5;
43 api_opts.tc_interactive_prompt = 1;
44 api_opts.tc_prompt_timeout = 5;
45 error = tc_api_map_volume(&api_opts);
46 if (error)
47 printf("API MAP ERROR: %s\n", tc_api_get_error_msg());
48 assert(error == 0);
50 system("dmsetup ls");
51 tc_api_unmap_volume(&api_opts);
53 error = tc_api_uninit();
54 assert(error == 0);
56 return 0;