src/pgp_gpg_internal.h
author Volker Birk <vb@pep.foundation>
Thu, 01 Sep 2016 17:55:03 +0200
branchkeysync
changeset 1111 3c46dc58096d
parent 728 80b966277620
child 1387 cc339b22d690
permissions -rw-r--r--
merging
vb@259
     1
#pragma once
vb@259
     2
vb@259
     3
#include <gpgme.h>
vb@259
     4
vb@259
     5
// init
vb@259
     6
vb@259
     7
typedef const char * (*gpgme_check_version_t)(const char*);
vb@507
     8
typedef gpgme_error_t (*gpgme_get_engine_info_t)(gpgme_engine_info_t *INFO);
vb@259
     9
typedef gpgme_error_t(*gpgme_set_locale_t)(gpgme_ctx_t CTX, int CATEGORY,
vb@259
    10
    const char *VALUE);
vb@259
    11
typedef gpgme_error_t(*gpgme_new_t)(gpgme_ctx_t *CTX);
vb@259
    12
typedef void(*gpgme_release_t)(gpgme_ctx_t CTX);
vb@259
    13
typedef gpgme_error_t(*gpgme_set_protocol_t)(gpgme_ctx_t CTX,
vb@259
    14
    gpgme_protocol_t PROTO);
vb@259
    15
typedef void(*gpgme_set_armor_t)(gpgme_ctx_t CTX, int YES);
vb@259
    16
vb@259
    17
// data
vb@259
    18
vb@259
    19
typedef gpgme_error_t(*gpgme_data_new_t)(gpgme_data_t *DH);
vb@259
    20
typedef gpgme_error_t(*gpgme_data_new_from_mem_t)(gpgme_data_t *DH,
vb@259
    21
    const char *BUFFER, size_t SIZE, int COPY);
vb@259
    22
typedef gpgme_error_t (*gpgme_data_new_from_cbs_t)(gpgme_data_t *DH,
vb@259
    23
        gpgme_data_cbs_t CBS, void *HANDLE);
vb@259
    24
typedef void(*gpgme_data_release_t)(gpgme_data_t DH);
vb@259
    25
typedef gpgme_data_type_t(*gpgme_data_identify_t)(gpgme_data_t DH);
vb@259
    26
typedef size_t(*gpgme_data_seek_t)(gpgme_data_t DH, size_t OFFSET,
vb@259
    27
    int WHENCE);
vb@259
    28
typedef size_t(*gpgme_data_read_t)(gpgme_data_t DH, void *BUFFER,
vb@259
    29
    size_t LENGTH);
vb@259
    30
vb@259
    31
// encrypt and decrypt
vb@259
    32
vb@259
    33
typedef gpgme_error_t(*gpgme_op_decrypt_t)(gpgme_ctx_t CTX,
vb@259
    34
    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
vb@259
    35
typedef gpgme_error_t(*gpgme_op_verify_t)(gpgme_ctx_t CTX, gpgme_data_t SIG,
vb@259
    36
    gpgme_data_t SIGNED_TEXT, gpgme_data_t PLAIN);
vb@259
    37
typedef gpgme_error_t(*gpgme_op_decrypt_verify_t)(gpgme_ctx_t CTX,
vb@259
    38
    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
vb@259
    39
typedef gpgme_decrypt_result_t(*gpgme_op_decrypt_result_t)(gpgme_ctx_t CTX);
vb@259
    40
typedef gpgme_error_t(*gpgme_op_encrypt_sign_t)(gpgme_ctx_t CTX,
vb@259
    41
    gpgme_key_t RECP[], gpgme_encrypt_flags_t FLAGS, gpgme_data_t PLAIN,
vb@259
    42
    gpgme_data_t CIPHER);
vb@259
    43
typedef gpgme_verify_result_t(*gpgme_op_verify_result_t)(gpgme_ctx_t CTX);
vb@259
    44
typedef void(*gpgme_signers_clear_t)(gpgme_ctx_t CTX);
vb@259
    45
typedef gpgme_error_t(*gpgme_signers_add_t)(gpgme_ctx_t CTX, const gpgme_key_t KEY);
vb@259
    46
vb@259
    47
// keys
vb@259
    48
vb@259
    49
typedef gpgme_error_t(*gpgme_get_key_t)(gpgme_ctx_t CTX, const char *FPR,
vb@259
    50
    gpgme_key_t *R_KEY, int SECRET);
vb@259
    51
typedef gpgme_error_t(*gpgme_op_genkey_t)(gpgme_ctx_t CTX, const char *PARMS,
vb@259
    52
    gpgme_data_t PUBLIC, gpgme_data_t SECRET);
vb@259
    53
typedef gpgme_genkey_result_t(*gpgme_op_genkey_result_t)(gpgme_ctx_t CTX);
vb@259
    54
typedef gpgme_error_t(*gpgme_op_delete_t)(gpgme_ctx_t CTX,
vb@259
    55
    const gpgme_key_t KEY, int ALLOW_SECRET);
vb@259
    56
typedef gpgme_error_t(*gpgme_op_import_t)(gpgme_ctx_t CTX,
vb@259
    57
    gpgme_data_t KEYDATA);
Edouard@728
    58
typedef gpgme_import_result_t(*gpgme_op_import_result_t)(gpgme_ctx_t CTX);
vb@259
    59
typedef gpgme_error_t(*gpgme_op_export_t)(gpgme_ctx_t CTX,
vb@259
    60
    const char *PATTERN, gpgme_export_mode_t MODE, gpgme_data_t KEYDATA);
vb@259
    61
typedef gpgme_error_t(*gpgme_set_keylist_mode_t)(gpgme_ctx_t CTX,
vb@259
    62
    gpgme_keylist_mode_t MODE);
vb@259
    63
typedef gpgme_keylist_mode_t(*gpgme_get_keylist_mode_t)(gpgme_ctx_t CTX);
vb@259
    64
typedef gpgme_error_t(*gpgme_op_keylist_start_t)(gpgme_ctx_t CTX,
vb@259
    65
    const char *PATTERN, int SECRET_ONLY);
vb@259
    66
typedef gpgme_error_t(*gpgme_op_keylist_next_t)(gpgme_ctx_t CTX,
vb@259
    67
    gpgme_key_t *R_KEY);
vb@259
    68
typedef gpgme_error_t(*gpgme_op_keylist_end_t)(gpgme_ctx_t CTX);
vb@259
    69
typedef gpgme_error_t(*gpgme_op_import_keys_t)(gpgme_ctx_t CTX,
vb@259
    70
    gpgme_key_t *KEYS);
vb@259
    71
typedef void(*gpgme_key_ref_t)(gpgme_key_t KEY);
vb@259
    72
typedef void(*gpgme_key_unref_t)(gpgme_key_t KEY);
vb@259
    73
typedef gpgme_error_t (*gpgme_op_edit_t)(gpgme_ctx_t CTX, gpgme_key_t KEY,
vb@259
    74
        gpgme_edit_cb_t FNC, void *HANDLE, gpgme_data_t OUT);
vb@223
    75
typedef gpgme_ssize_t (*gpgme_io_write_t)(int fd, const void *buffer,
vb@223
    76
        size_t count);
vb@259
    77
vb@259
    78
struct gpg_s {
vb@259
    79
    const char * version;
vb@259
    80
    gpgme_check_version_t gpgme_check;
vb@507
    81
    gpgme_get_engine_info_t gpgme_get_engine_info;
vb@259
    82
    gpgme_set_locale_t gpgme_set_locale;
vb@259
    83
    gpgme_new_t gpgme_new;
vb@259
    84
    gpgme_release_t gpgme_release;
vb@259
    85
    gpgme_set_protocol_t gpgme_set_protocol;
vb@259
    86
    gpgme_set_armor_t gpgme_set_armor;
vb@259
    87
vb@259
    88
    gpgme_data_new_t gpgme_data_new;
vb@259
    89
    gpgme_data_new_from_mem_t gpgme_data_new_from_mem;
vb@259
    90
    gpgme_data_new_from_cbs_t gpgme_data_new_from_cbs;
vb@259
    91
    gpgme_data_release_t gpgme_data_release;
vb@259
    92
    gpgme_data_identify_t gpgme_data_identify;
vb@259
    93
    gpgme_data_seek_t gpgme_data_seek;
vb@259
    94
    gpgme_data_read_t gpgme_data_read;
vb@259
    95
vb@259
    96
    gpgme_op_decrypt_t gpgme_op_decrypt;
vb@259
    97
    gpgme_op_verify_t gpgme_op_verify;
vb@259
    98
    gpgme_op_decrypt_verify_t gpgme_op_decrypt_verify;
vb@259
    99
    gpgme_op_decrypt_result_t gpgme_op_decrypt_result;
vb@259
   100
    gpgme_op_encrypt_sign_t gpgme_op_encrypt_sign;
vb@259
   101
    gpgme_op_verify_result_t gpgme_op_verify_result;
vb@259
   102
    gpgme_signers_clear_t gpgme_signers_clear;
vb@259
   103
    gpgme_signers_add_t gpgme_signers_add;
vb@259
   104
vb@259
   105
    gpgme_get_key_t gpgme_get_key;
vb@259
   106
    gpgme_op_genkey_t gpgme_op_genkey;
vb@259
   107
    gpgme_op_genkey_result_t gpgme_op_genkey_result;
vb@259
   108
    gpgme_op_delete_t gpgme_op_delete;
vb@259
   109
    gpgme_op_import_t gpgme_op_import;
Edouard@728
   110
    gpgme_op_import_result_t gpgme_op_import_result;
vb@259
   111
    gpgme_op_export_t gpgme_op_export;
vb@259
   112
    gpgme_set_keylist_mode_t gpgme_set_keylist_mode;
vb@259
   113
    gpgme_get_keylist_mode_t gpgme_get_keylist_mode;
vb@259
   114
    gpgme_op_keylist_start_t gpgme_op_keylist_start;
vb@259
   115
    gpgme_op_keylist_next_t gpgme_op_keylist_next;
vb@259
   116
    gpgme_op_keylist_end_t gpgme_op_keylist_end;
vb@259
   117
    gpgme_op_import_keys_t gpgme_op_import_keys;
vb@259
   118
    gpgme_key_ref_t gpgme_key_ref;
vb@259
   119
    gpgme_key_unref_t gpgme_key_unref;
vb@259
   120
    gpgme_op_edit_t gpgme_op_edit;
vb@259
   121
    gpgme_io_write_t gpgme_io_write;
vb@259
   122
};
vb@259
   123