pEpCOMServerAdapter.idl
author Volker Birk <vb@pep-project.org>
Fri, 29 May 2015 13:08:51 +0200
changeset 24 ef134b3fa18a
parent 23 720af5e728bc
child 30 5c5f423e79e6
permissions -rw-r--r--
start/stop semantics for keyserver lookup
     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 [
    12     object,
    13     uuid(161538F9-53C8-4D9C-8BA4-0FB43AEC7106),
    14     oleautomation,
    15     nonextensible,
    16     pointer_default(unique)
    17 ]
    18 interface ITextMessage : IUnknown {
    19     typedef enum _pEp_text_format {
    20         pEp_text_format_plain = 0,
    21         pEp_text_format_html,
    22         pEp_text_format_other = 0xff
    23     } pEp_text_format;
    24 
    25     typedef enum _pEp_msg_direction {
    26         pEp_dir_incoming = 0,
    27         pEp_dir_outgoing
    28     } pEp_msg_direction;
    29 
    30     typedef enum _pEp_MIME_format {
    31         pEp_MIME_none = 0,                      // message is not MIME encoded
    32         pEp_MIME_fields_omitted,                // message content but no fields
    33         pEp_MIME                                // message is fully MIME encoded
    34     } pEp_MIME_format;
    35 
    36     typedef enum _pEp_enc_format {
    37         pEp_enc_none = 0,                       // message is not encrypted
    38         pEp_enc_pieces,                         // inline PGP + PGP extensions
    39         pEp_enc_S_MIME,                         // RFC5751
    40         pEp_enc_PGP_MIME,                       // RFC3156
    41         pEp_enc_pEp                             // pEp encryption format
    42     } pEp_enc_format;
    43 
    44     [uuid(1292C31A-6486-427F-B29F-7F03607836DC)] struct opt_field {
    45         BSTR name;
    46         BSTR value;
    47     };
    48 
    49     [propget] HRESULT dir([out, retval] pEp_msg_direction *pVal);
    50     [propput] HRESULT dir([in] pEp_msg_direction newVal);
    51 
    52     [propget] HRESULT id([out, retval] BSTR *pVal);
    53     [propput] HRESULT id([in] BSTR newVal);
    54 
    55     [propget] HRESULT shortmsg([out, retval] BSTR *pVal);
    56     [propput] HRESULT shortmsg([in] BSTR newVal);
    57 
    58     [propget] HRESULT longmsg([out, retval] BSTR *pVal);
    59     [propput] HRESULT longmsg([in] BSTR newVal);
    60 
    61     [propget] HRESULT longmsg_formatted([out, retval] BSTR *pVal);
    62     [propput] HRESULT longmsg_formatted([in] BSTR newVal);
    63 
    64     HRESULT add_attachment([in] SAFEARRAY(BYTE) data, [in] BSTR mime_type, [in] BSTR filename);
    65     HRESULT has_attachments([out, retval] boolean *result);
    66     HRESULT next_attachment([out] SAFEARRAY(BYTE) * data, [out] BSTR * mime_type, [out] BSTR * filename, [out, retval] boolean *result);
    67 
    68     [propget] HRESULT sent([out, retval] hyper * result);
    69     [propput] HRESULT sent([in] hyper val);
    70 
    71     [propget] HRESULT recv([out, retval] hyper * result);
    72     [propput] HRESULT recv([in] hyper val);
    73 
    74     [propget] HRESULT from([out, retval] struct pEp_identity_s *pVal);
    75     [propput] HRESULT from([in] struct pEp_identity_s *newVal);
    76 
    77     [propget] HRESULT to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    78     [propput] HRESULT to([in] SAFEARRAY(struct pEp_identity_s) newVal);
    79 
    80     [propget] HRESULT recv_by([out, retval] struct pEp_identity_s *pVal);
    81     [propput] HRESULT recv_by([in] struct pEp_identity_s *newVal);
    82 
    83     [propget] HRESULT cc([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    84     [propput] HRESULT cc([in] SAFEARRAY(struct pEp_identity_s) newVal);
    85 
    86     [propget] HRESULT bcc([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    87     [propput] HRESULT bcc([in] SAFEARRAY(struct pEp_identity_s) newVal);
    88 
    89     [propget] HRESULT reply_to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    90     [propput] HRESULT reply_to([in] SAFEARRAY(struct pEp_identity_s) newVal);
    91 
    92     [propget] HRESULT references([out, retval] SAFEARRAY(BSTR) *pVal);
    93     [propput] HRESULT references([in] SAFEARRAY(BSTR) newVal);
    94 
    95     [propget] HRESULT keywords([out, retval] SAFEARRAY(BSTR) *pVal);
    96     [propput] HRESULT keywords([in] SAFEARRAY(BSTR) newVal);
    97 
    98     [propget] HRESULT comments([out, retval] BSTR *pVal);
    99     [propput] HRESULT comments([in] BSTR newVal);
   100 
   101     [propget] HRESULT opt_fields([out, retval] SAFEARRAY(struct opt_field) *pVal);
   102     [propput] HRESULT opt_fields([in] SAFEARRAY(struct opt_field) newVal);
   103 };
   104 
   105 [
   106     object,
   107     uuid(9A9F4422-CF0A-45D7-90CD-1D1B7B2A4540),
   108     oleautomation,
   109     nonextensible,
   110     pointer_default(unique)
   111 ]
   112 interface IpEpEngine : IUnknown {
   113     typedef enum _pEp_STATUS {
   114         pEp_STATUS_OK = 0,
   115 
   116         pEp_KEY_NOT_FOUND = 0x0201,
   117         pEp_KEY_HAS_AMBIG_NAME = 0x0202,
   118         pEp_GET_KEY_FAILED = 0x0203,
   119 
   120         pEp_UNENCRYPTED = 0x0400,
   121         pEp_VERIFIED = 0x0401,
   122         pEp_DECRYPTED = 0x0402,
   123         pEp_DECRYPTED_AND_VERIFIED = 0x0403,
   124         pEp_DECRYPT_WRONG_FORMAT = 0x0404,
   125         pEp_DECRYPT_NO_KEY = 0x0405,
   126         pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
   127         pEp_VERIFY_NO_KEY = 0x0407,
   128         pEp_VERIFIED_AND_TRUSTED = 0x0408,
   129 
   130         pEp_ILLEGAL_VALUE = -4,
   131         pEp_BUFFER_TOO_SMALL = -3,
   132         pEp_OUT_OF_MEMORY = -2,
   133         pEp_UNKNOWN_ERROR = -1
   134     } pEp_STATUS;
   135 
   136     HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
   137     HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   138     HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   139     HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   140     HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   141     HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * verify_status);
   142     HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
   143     HRESULT trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
   144 
   145     typedef enum _pEp_comm_type {
   146         pEp_ct_unknown = 0,
   147 
   148         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   149 
   150         pEp_ct_no_encryption = 0x01,                // generic
   151         pEp_ct_no_encrypted_channel = 0x02,
   152         pEp_ct_key_not_found = 0x03,
   153         pEp_ct_key_expired = 0x04,
   154         pEp_ct_key_revoked = 0x05,
   155         pEp_ct_key_b0rken = 0x06,
   156         pEp_ct_my_key_not_included = 0x09,
   157 
   158         pEp_ct_security_by_obscurity = 0x0a,
   159         pEp_ct_b0rken_crypto = 0x0b,
   160         pEp_ct_key_too_short = 0x0e,
   161 
   162         pEp_ct_compromized = 0x0f,                  // known compromized connection
   163 
   164         // range 0x10 to 0x3f: unconfirmed encryption
   165 
   166         pEp_ct_unconfirmed_encryption = 0x10,       // generic
   167         pEp_ct_OpenPGP_1024_RSA_unconfirmed = 0x11,	// RSA 1024 is weak
   168         pEp_ct_OpenPGP_unconfirmed = 0x3f,          // key at least 2048 bit RSA
   169         // or 1024 bit DSA
   170 
   171         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   172 
   173         pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
   174         pEp_ct_pEp_unconfirmed = 0x7f,
   175 
   176         pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   177 
   178         // range 0x81 to 0x8f: reserved
   179         // range 0x90 to 0xbf: confirmed encryption
   180 
   181         pEp_ct_confirmed_encryption = 0x90,         // generic
   182         pEp_ct_OpenPGP_1024_RSA = 0x91, // RSA 1024 is weak
   183         pEp_ct_OpenPGP = 0xbf, // key at least 2048 bit RSA or 1024 bit DSA
   184 
   185         // range 0xc0 to 0xff: confirmed encryption and anonymization
   186 
   187         pEp_ct_confirmed_enc_anon = 0xc0,           // generic
   188         pEp_ct_pEp = 0xff
   189     } pEp_comm_type;
   190 
   191     [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEp_identity_s {
   192         BSTR address;
   193         BSTR fpr;
   194         BSTR user_id;
   195         BSTR username;
   196         pEp_comm_type comm_type;
   197         BSTR lang;
   198     };
   199 
   200     HRESULT get_identity([in] BSTR address, [out, retval] struct pEp_identity_s * ident);
   201     HRESULT set_identity([in] struct pEp_identity_s * ident);
   202     HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   203     HRESULT delete_keypair([in] BSTR fpr);
   204     HRESULT import_key([in] BSTR key_data);
   205     HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   206     HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   207     HRESULT recv_key([in] BSTR pattern);
   208     HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   209     HRESULT send_key([in] BSTR pattern);
   210 
   211     HRESULT start_keyserver_lookup();
   212     HRESULT stop_keyserver_lookup();
   213 
   214     HRESULT examine_identity([in] struct pEp_identity_s * ident);
   215     HRESULT examine_myself([in] struct pEp_identity_s * myself);
   216     HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   217     HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   218     HRESULT key_compromized([in] BSTR fpr);
   219 
   220     // Message API
   221 
   222     typedef enum _pEp_color {
   223         pEp_rating_undefined = 0,
   224         pEp_rating_cannot_decrypt,
   225         pEp_rating_have_no_key,
   226         pEp_rating_unencrypted,
   227         pEp_rating_unreliable,
   228         pEp_rating_reliable,
   229         pEp_rating_yellow = pEp_rating_reliable,
   230         pEp_rating_trusted,
   231         pEp_rating_green = pEp_rating_trusted,
   232         pEp_rating_trusted_and_anonymized,
   233         pEp_rating_fully_anonymous,
   234 
   235         pEp_rating_under_attack = -1,
   236         pEp_rating_red = pEp_rating_under_attack,
   237         pEp_rating_b0rken = -2
   238     } pEp_color;
   239 
   240     HRESULT encrypt_message([in] ITextMessage *src, [out] ITextMessage ** dst, [in] SAFEARRAY(BSTR) extra);
   241     HRESULT decrypt_message([in] ITextMessage *src, [out] ITextMessage ** dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
   242     HRESULT outgoing_message_color([in] ITextMessage *msg, [out, retval] pEp_color * pVal);
   243     HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
   244 };
   245 
   246 [
   247     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   248     version(1.0),
   249 ]
   250 library pEpCOMServerAdapterLib
   251 {
   252     importlib("stdole2.tlb");
   253     [
   254         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   255     ]
   256     dispinterface _IpEpEngineEvents
   257     {
   258     properties:
   259     methods:
   260     };
   261     [
   262         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   263     ]
   264     coclass pEpEngine {
   265         [default] interface IpEpEngine;
   266         [default, source] dispinterface _IpEpEngineEvents;
   267     };
   268 	[
   269 		uuid(844B5363-4EF4-4A39-A030-16452783A6F7)		
   270 	]
   271 	dispinterface _ITextMessageEvents
   272 	{
   273 		properties:
   274 		methods:
   275 	};
   276 	[
   277 		uuid(B6CC444F-FE14-4DFE-8315-81E4EA16C1CC)		
   278 	]
   279 	coclass TextMessage
   280 	{
   281 		[default] interface ITextMessage;
   282 		[default, source] dispinterface _ITextMessageEvents;
   283 	};
   284 };