src/pgp_gpg_internal.h
author vb
Mon, 01 Sep 2014 17:44:19 +0200
changeset 24 50887c6ab78f
child 28 7fc9fc3e680c
permissions -rw-r--r--
...
vb@24
     1
#include <gpgme.h>
vb@24
     2
vb@24
     3
// init
vb@24
     4
vb@24
     5
typedef const char * (*gpgme_check_version_t)(const char*);
vb@24
     6
typedef gpgme_error_t(*gpgme_set_locale_t)(gpgme_ctx_t CTX, int CATEGORY,
vb@24
     7
    const char *VALUE);
vb@24
     8
typedef gpgme_error_t(*gpgme_new_t)(gpgme_ctx_t *CTX);
vb@24
     9
typedef void(*gpgme_release_t)(gpgme_ctx_t CTX);
vb@24
    10
typedef gpgme_error_t(*gpgme_set_protocol_t)(gpgme_ctx_t CTX,
vb@24
    11
    gpgme_protocol_t PROTO);
vb@24
    12
typedef void(*gpgme_set_armor_t)(gpgme_ctx_t CTX, int YES);
vb@24
    13
vb@24
    14
// data
vb@24
    15
vb@24
    16
typedef gpgme_error_t(*gpgme_data_new_t)(gpgme_data_t *DH);
vb@24
    17
typedef gpgme_error_t(*gpgme_data_new_from_mem_t)(gpgme_data_t *DH,
vb@24
    18
    const char *BUFFER, size_t SIZE, int COPY);
vb@24
    19
typedef void(*gpgme_data_release_t)(gpgme_data_t DH);
vb@24
    20
typedef gpgme_data_type_t(*gpgme_data_identify_t)(gpgme_data_t DH);
vb@24
    21
typedef size_t(*gpgme_data_seek_t)(gpgme_data_t DH, size_t OFFSET,
vb@24
    22
    int WHENCE);
vb@24
    23
typedef size_t(*gpgme_data_read_t)(gpgme_data_t DH, void *BUFFER,
vb@24
    24
    size_t LENGTH);
vb@24
    25
vb@24
    26
// encrypt and decrypt
vb@24
    27
vb@24
    28
typedef gpgme_error_t(*gpgme_op_decrypt_t)(gpgme_ctx_t CTX,
vb@24
    29
    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
vb@24
    30
typedef gpgme_error_t(*gpgme_op_verify_t)(gpgme_ctx_t CTX, gpgme_data_t SIG,
vb@24
    31
    gpgme_data_t SIGNED_TEXT, gpgme_data_t PLAIN);
vb@24
    32
typedef gpgme_error_t(*gpgme_op_decrypt_verify_t)(gpgme_ctx_t CTX,
vb@24
    33
    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
vb@24
    34
typedef gpgme_decrypt_result_t(*gpgme_op_decrypt_result_t)(gpgme_ctx_t CTX);
vb@24
    35
typedef gpgme_error_t(*gpgme_op_encrypt_sign_t)(gpgme_ctx_t CTX,
vb@24
    36
    gpgme_key_t RECP[], gpgme_encrypt_flags_t FLAGS, gpgme_data_t PLAIN,
vb@24
    37
    gpgme_data_t CIPHER);
vb@24
    38
typedef gpgme_verify_result_t(*gpgme_op_verify_result_t)(gpgme_ctx_t CTX);
vb@24
    39
typedef void(*gpgme_signers_clear_t)(gpgme_ctx_t CTX);
vb@24
    40
typedef gpgme_error_t(*gpgme_signers_add_t)(gpgme_ctx_t CTX, const gpgme_key_t KEY);
vb@24
    41
vb@24
    42
// keys
vb@24
    43
vb@24
    44
typedef gpgme_error_t(*gpgme_get_key_t)(gpgme_ctx_t CTX, const char *FPR,
vb@24
    45
    gpgme_key_t *R_KEY, int SECRET);
vb@24
    46
typedef gpgme_error_t(*gpgme_op_genkey_t)(gpgme_ctx_t CTX, const char *PARMS,
vb@24
    47
    gpgme_data_t PUBLIC, gpgme_data_t SECRET);
vb@24
    48
typedef gpgme_genkey_result_t(*gpgme_op_genkey_result_t)(gpgme_ctx_t CTX);
vb@24
    49
typedef gpgme_error_t(*gpgme_op_delete_t)(gpgme_ctx_t CTX,
vb@24
    50
    const gpgme_key_t KEY, int ALLOW_SECRET);
vb@24
    51
typedef gpgme_error_t(*gpgme_op_import_t)(gpgme_ctx_t CTX,
vb@24
    52
    gpgme_data_t KEYDATA);
vb@24
    53
typedef gpgme_error_t(*gpgme_op_export_t)(gpgme_ctx_t CTX,
vb@24
    54
    const char *PATTERN, gpgme_export_mode_t MODE, gpgme_data_t KEYDATA);
vb@24
    55
typedef gpgme_error_t(*gpgme_set_keylist_mode_t)(gpgme_ctx_t CTX,
vb@24
    56
    gpgme_keylist_mode_t MODE);
vb@24
    57
typedef gpgme_keylist_mode_t(*gpgme_get_keylist_mode_t)(gpgme_ctx_t CTX);
vb@24
    58
typedef gpgme_error_t(*gpgme_op_keylist_start_t)(gpgme_ctx_t CTX,
vb@24
    59
    const char *PATTERN, int SECRET_ONLY);
vb@24
    60
typedef gpgme_error_t(*gpgme_op_keylist_next_t)(gpgme_ctx_t CTX,
vb@24
    61
    gpgme_key_t *R_KEY);
vb@24
    62
typedef gpgme_error_t(*gpgme_op_keylist_end_t)(gpgme_ctx_t CTX);
vb@24
    63
typedef gpgme_error_t(*gpgme_op_import_keys_t)(gpgme_ctx_t CTX,
vb@24
    64
    gpgme_key_t *KEYS);
vb@24
    65
typedef void(*gpgme_key_ref_t)(gpgme_key_t KEY);
vb@24
    66
typedef void(*gpgme_key_unref_t)(gpgme_key_t KEY);
vb@24
    67
vb@24
    68
struct gpg_s {
vb@24
    69
    gpgme_check_version_t gpgme_check;
vb@24
    70
    gpgme_set_locale_t gpgme_set_locale;
vb@24
    71
    gpgme_new_t gpgme_new;
vb@24
    72
    gpgme_release_t gpgme_release;
vb@24
    73
    gpgme_set_protocol_t gpgme_set_protocol;
vb@24
    74
    gpgme_set_armor_t gpgme_set_armor;
vb@24
    75
vb@24
    76
    gpgme_data_new_t gpgme_data_new;
vb@24
    77
    gpgme_data_new_from_mem_t gpgme_data_new_from_mem;
vb@24
    78
    gpgme_data_release_t gpgme_data_release;
vb@24
    79
    gpgme_data_identify_t gpgme_data_identify;
vb@24
    80
    gpgme_data_seek_t gpgme_data_seek;
vb@24
    81
    gpgme_data_read_t gpgme_data_read;
vb@24
    82
vb@24
    83
    gpgme_op_decrypt_t gpgme_op_decrypt;
vb@24
    84
    gpgme_op_verify_t gpgme_op_verify;
vb@24
    85
    gpgme_op_decrypt_verify_t gpgme_op_decrypt_verify;
vb@24
    86
    gpgme_op_decrypt_result_t gpgme_op_decrypt_result;
vb@24
    87
    gpgme_op_encrypt_sign_t gpgme_op_encrypt_sign;
vb@24
    88
    gpgme_op_verify_result_t gpgme_op_verify_result;
vb@24
    89
    gpgme_signers_clear_t gpgme_signers_clear;
vb@24
    90
    gpgme_signers_add_t gpgme_signers_add;
vb@24
    91
vb@24
    92
    gpgme_get_key_t gpgme_get_key;
vb@24
    93
    gpgme_op_genkey_t gpgme_op_genkey;
vb@24
    94
    gpgme_op_genkey_result_t gpgme_op_genkey_result;
vb@24
    95
    gpgme_op_delete_t gpgme_op_delete;
vb@24
    96
    gpgme_op_import_t gpgme_op_import;
vb@24
    97
    gpgme_op_export_t gpgme_op_export;
vb@24
    98
    gpgme_set_keylist_mode_t gpgme_set_keylist_mode;
vb@24
    99
    gpgme_get_keylist_mode_t gpgme_get_keylist_mode;
vb@24
   100
    gpgme_op_keylist_start_t gpgme_op_keylist_start;
vb@24
   101
    gpgme_op_keylist_next_t gpgme_op_keylist_next;
vb@24
   102
    gpgme_op_keylist_end_t gpgme_op_keylist_end;
vb@24
   103
    gpgme_op_import_keys_t gpgme_op_import_keys;
vb@24
   104
    gpgme_key_ref_t gpgme_key_ref;
vb@24
   105
    gpgme_key_unref_t gpgme_key_unref;
vb@24
   106
};