pEpCOMServerAdapter.idl
author Volker Birk <vb@pep-project.org>
Sun, 21 Feb 2016 23:24:31 +0100
changeset 59 c03abab41702
parent 58 a0214629bc44
child 60 a91c51e4f42b
permissions -rw-r--r--
adding i18n functions
     1 // pEpCOMServerAdapter.idl : IDL source for pEpCOMServerAdapter
     2 //
     3 
     4 // This file will be processed by the MIDL tool to
     5 // produce the type library (pEpCOMServerAdapter.tlb) and marshalling code.
     6 
     7 import "oaidl.idl";
     8 import "ocidl.idl";
     9 
    10 [
    11     object,
    12     uuid(9A9F4422-CF0A-45D7-90CD-1D1B7B2A4540),
    13     oleautomation,
    14     nonextensible,
    15     pointer_default(unique)
    16 ]
    17 interface IpEpEngine : IUnknown {
    18     HRESULT verbose_logging([in] BOOL enable);
    19 
    20     typedef   enum _pEp_STATUS {
    21         pEp_STATUS_OK = 0,
    22 
    23         pEp_KEY_NOT_FOUND = 0x0201,
    24         pEp_KEY_HAS_AMBIG_NAME = 0x0202,
    25         pEp_GET_KEY_FAILED = 0x0203,
    26 
    27         pEp_UNENCRYPTED = 0x0400,
    28         pEp_VERIFIED = 0x0401,
    29         pEp_DECRYPTED = 0x0402,
    30         pEp_DECRYPTED_AND_VERIFIED = 0x0403,
    31         pEp_DECRYPT_WRONG_FORMAT = 0x0404,
    32         pEp_DECRYPT_NO_KEY = 0x0405,
    33         pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
    34         pEp_VERIFY_NO_KEY = 0x0407,
    35         pEp_VERIFIED_AND_TRUSTED = 0x0408,
    36 
    37         pEp_ILLEGAL_VALUE = -4,
    38         pEp_BUFFER_TOO_SMALL = -3,
    39         pEp_OUT_OF_MEMORY = -2,
    40         pEp_UNKNOWN_ERROR = -1
    41     } pEp_STATUS;
    42 
    43     HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
    44     HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
    45     HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
    46     HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
    47     HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
    48     HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * verify_status);
    49     HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
    50     HRESULT trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
    51     HRESULT get_crashdump_log([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
    52     HRESULT get_languagelist([out, retval] BSTR * languages);
    53     HRESULT get_phrase([in] BSTR lang, [in] LONG phrase_id, [out, retval] BSTR * phrase);
    54 
    55     typedef enum _pEp_comm_type {
    56         pEp_ct_unknown = 0,
    57 
    58         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    59 
    60         pEp_ct_no_encryption = 0x01,                // generic
    61         pEp_ct_no_encrypted_channel = 0x02,
    62         pEp_ct_key_not_found = 0x03,
    63         pEp_ct_key_expired = 0x04,
    64         pEp_ct_key_revoked = 0x05,
    65         pEp_ct_key_b0rken = 0x06,
    66         pEp_ct_my_key_not_included = 0x09,
    67 
    68         pEp_ct_security_by_obscurity = 0x0a,
    69         pEp_ct_b0rken_crypto = 0x0b,
    70         pEp_ct_key_too_short = 0x0e,
    71 
    72         pEp_ct_compromized = 0x0f,                  // known compromized connection
    73 
    74         // range 0x10 to 0x3f: unconfirmed encryption
    75 
    76         pEp_ct_unconfirmed_encryption = 0x10,       // generic
    77         pEp_ct_OpenPGP_1024_RSA_unconfirmed = 0x11,	// RSA 1024 is weak
    78         pEp_ct_OpenPGP_unconfirmed = 0x3f,          // key at least 2048 bit RSA
    79         // or 1024 bit DSA
    80 
    81         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
    82 
    83         pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
    84         pEp_ct_pEp_unconfirmed = 0x7f,
    85 
    86         pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
    87 
    88         // range 0x81 to 0x8f: reserved
    89         // range 0x90 to 0xbf: confirmed encryption
    90 
    91         pEp_ct_confirmed_encryption = 0x90,         // generic
    92         pEp_ct_OpenPGP_1024_RSA = 0x91, // RSA 1024 is weak
    93         pEp_ct_OpenPGP = 0xbf, // key at least 2048 bit RSA or 1024 bit DSA
    94 
    95         // range 0xc0 to 0xff: confirmed encryption and anonymization
    96 
    97         pEp_ct_confirmed_enc_anon = 0xc0,           // generic
    98         pEp_ct_pEp = 0xff
    99     } pEp_comm_type;
   100 
   101     [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEp_identity_s {
   102         BSTR address;
   103         BSTR fpr;
   104         BSTR user_id;
   105         BSTR username;
   106         pEp_comm_type comm_type;
   107         BSTR lang;
   108     };
   109 
   110     HRESULT get_identity([in] BSTR address, [out, retval] struct pEp_identity_s * ident);
   111     HRESULT set_identity([in] struct pEp_identity_s * ident);
   112     HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   113     HRESULT delete_keypair([in] BSTR fpr);
   114     HRESULT import_key([in] BSTR key_data);
   115     HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   116     HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   117     HRESULT recv_key([in] BSTR pattern);
   118     HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   119     HRESULT send_key([in] BSTR pattern);
   120 
   121     HRESULT start_keyserver_lookup();
   122     HRESULT stop_keyserver_lookup();
   123 
   124     HRESULT examine_identity([in] struct pEp_identity_s * ident);
   125     HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   126     HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   127     HRESULT key_compromized([in] struct pEp_identity_s *ident);
   128     HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
   129     HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   130 
   131     // Message API
   132 
   133     typedef enum _pEp_color {
   134         pEp_rating_undefined = 0,
   135         pEp_rating_cannot_decrypt,
   136         pEp_rating_have_no_key,
   137         pEp_rating_unencrypted,
   138         pEp_rating_unreliable,
   139         pEp_rating_reliable,
   140         pEp_rating_yellow = pEp_rating_reliable,
   141         pEp_rating_trusted,
   142         pEp_rating_green = pEp_rating_trusted,
   143         pEp_rating_trusted_and_anonymized,
   144         pEp_rating_fully_anonymous,
   145 
   146         pEp_rating_mistrust = -1,
   147         pEp_rating_red = pEp_rating_mistrust,
   148         pEp_rating_b0rken = -2,
   149         pEp_rating_under_attack = -3
   150     } pEp_color;
   151 
   152     typedef enum _pEp_text_format {
   153         pEp_text_format_plain = 0,
   154         pEp_text_format_html,
   155         pEp_text_format_other = 0xff
   156     } pEp_text_format;
   157 
   158     typedef  enum _pEp_msg_direction {
   159         pEp_dir_incoming = 0,
   160         pEp_dir_outgoing
   161     } pEp_msg_direction;
   162 
   163     typedef  enum _pEp_MIME_format {
   164         pEp_MIME_none = 0,                      // message is not MIME encoded
   165         pEp_MIME_fields_omitted,                // message content but no fields
   166         pEp_MIME                                // message is fully MIME encoded
   167     } pEp_MIME_format;
   168 
   169     typedef  enum _pEp_enc_format {
   170         pEp_enc_none = 0,                       // message is not encrypted
   171         pEp_enc_pieces,                         // inline PGP + PGP extensions
   172         pEp_enc_S_MIME,                         // RFC5751
   173         pEp_enc_PGP_MIME,                       // RFC3156
   174         pEp_enc_pEp                             // pEp encryption format
   175     } pEp_enc_format;
   176 
   177     [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct opt_field {
   178         BSTR name;
   179         BSTR value;
   180     };
   181 
   182     [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct blob {
   183         SAFEARRAY(BYTE) value;
   184         BSTR mime_type;
   185         BSTR filename;
   186     };
   187 
   188     [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct text_message {
   189         pEp_msg_direction dir;
   190         BSTR id;
   191         BSTR shortmsg;
   192         BSTR longmsg;
   193         BSTR longmsg_formatted;
   194         SAFEARRAY(struct blob) attachments;
   195         hyper sent;
   196         hyper recv;
   197         struct pEp_identity_s from;
   198         SAFEARRAY(struct pEp_identity_s) to;
   199         struct pEp_identity_s recv_by;
   200         SAFEARRAY(struct pEp_identity_s) cc;
   201         SAFEARRAY(struct pEp_identity_s) bcc;
   202         SAFEARRAY(struct pEp_identity_s) reply_to;
   203         SAFEARRAY(BSTR) references;
   204         SAFEARRAY(BSTR) keywords;
   205         BSTR comments;
   206         SAFEARRAY(struct opt_field) opt_fields;
   207     };
   208 
   209     HRESULT encrypt_message([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra);
   210     HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
   211     HRESULT outgoing_message_color([in] struct text_message *msg, [out, retval] pEp_color * pVal);
   212     HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
   213 };
   214 
   215 [
   216     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   217     version(1.0),
   218 ]
   219 library pEpCOMServerAdapterLib
   220 {
   221     importlib("stdole2.tlb");
   222     [
   223         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   224     ]
   225     dispinterface _IpEpEngineEvents
   226     {
   227     properties:
   228     methods:
   229     };
   230     [
   231         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   232     ]
   233     coclass pEpEngine {
   234         [default] interface IpEpEngine;
   235         [default, source] dispinterface _IpEpEngineEvents;
   236     };
   237 };