pEpCOMServerAdapter.idl
author Volker Birk <vb@pep-project.org>
Fri, 01 May 2015 00:24:12 +0200
changeset 15 b1c2c371379c
parent 13 d83d94f11e62
child 17 3288634317bb
permissions -rw-r--r--
implementing Message API
     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     [propget] HRESULT dir([out, retval] pEp_msg_direction *pVal);
    45     [propput] HRESULT dir([in] pEp_msg_direction newVal);
    46 
    47     [propget] HRESULT id([out, retval] BSTR *pVal);
    48     [propput] HRESULT id([in] BSTR newVal);
    49 
    50     [propget] HRESULT shortmsg([out, retval] BSTR *pVal);
    51     [propput] HRESULT shortmsg([in] BSTR newVal);
    52 
    53     [propget] HRESULT longmsg([out, retval] BSTR *pVal);
    54     [propput] HRESULT longmsg([in] BSTR newVal);
    55 
    56     [propget] HRESULT longmsg_formatted([out, retval] BSTR *pVal);
    57     [propput] HRESULT longmsg_formatted([in] BSTR newVal);
    58 
    59     HRESULT add_attachment([in] SAFEARRAY(BYTE) data, [in, optional] BSTR mime_type, [in, optional] BSTR filename);
    60     HRESULT has_attachments([out, retval] boolean *result);
    61     HRESULT next_attachment([out] SAFEARRAY(BYTE) * data, [out] BSTR * mime_type, [out] BSTR * filename, [out, retval] boolean *result);
    62 
    63     [propget] HRESULT sent([out, retval] hyper * result);
    64     [propput] HRESULT sent([in] hyper val);
    65 
    66     [propget] HRESULT recv([out, retval] hyper * result);
    67     [propput] HRESULT recv([in] hyper val);
    68 
    69     [propget] HRESULT from([out, retval] struct pEp_identity_s *pVal);
    70     [propput] HRESULT from([in] struct pEp_identity_s *newVal);
    71 
    72     [propget] HRESULT to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    73     [propput] HRESULT to([in] SAFEARRAY(struct pEp_identity_s) newVal);
    74 
    75     [propget] HRESULT recv_by([out, retval] struct pEp_identity_s *pVal);
    76     [propput] HRESULT recv_by([in] struct pEp_identity_s *newVal);
    77 
    78     [propget] HRESULT cc([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    79     [propput] HRESULT cc([in] SAFEARRAY(struct pEp_identity_s) newVal);
    80 
    81     [propget] HRESULT bcc([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    82     [propput] HRESULT bcc([in] SAFEARRAY(struct pEp_identity_s) newVal);
    83 
    84     [propget] HRESULT reply_to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    85     [propput] HRESULT reply_to([in] SAFEARRAY(struct pEp_identity_s) newVal);
    86 
    87     [propget] HRESULT references([out, retval] SAFEARRAY(BSTR) *pVal);
    88     [propput] HRESULT references([in] SAFEARRAY(BSTR) newVal);
    89 
    90     [propget] HRESULT keywords([out, retval] SAFEARRAY(BSTR) *pVal);
    91     [propput] HRESULT keywords([in] SAFEARRAY(BSTR) newVal);
    92 
    93     [propget] HRESULT comments([out, retval] BSTR *pVal);
    94     [propput] HRESULT comments([in] BSTR newVal);
    95 };
    96 
    97 [
    98     object,
    99     uuid(9A9F4422-CF0A-45D7-90CD-1D1B7B2A4540),
   100     oleautomation,
   101     nonextensible,
   102     pointer_default(unique)
   103 ]
   104 interface IpEpEngine : IUnknown {
   105     typedef enum _pEp_STATUS {
   106         pEp_STATUS_OK = 0,
   107 
   108         pEp_KEY_NOT_FOUND = 0x0201,
   109         pEp_KEY_HAS_AMBIG_NAME = 0x0202,
   110         pEp_GET_KEY_FAILED = 0x0203,
   111 
   112         pEp_UNENCRYPTED = 0x0400,
   113         pEp_VERIFIED = 0x0401,
   114         pEp_DECRYPTED = 0x0402,
   115         pEp_DECRYPTED_AND_VERIFIED = 0x0403,
   116         pEp_DECRYPT_WRONG_FORMAT = 0x0404,
   117         pEp_DECRYPT_NO_KEY = 0x0405,
   118         pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
   119         pEp_VERIFY_NO_KEY = 0x0407,
   120         pEp_VERIFIED_AND_TRUSTED = 0x0408,
   121 
   122         pEp_ILLEGAL_VALUE = -4,
   123         pEp_BUFFER_TOO_SMALL = -3,
   124         pEp_OUT_OF_MEMORY = -2,
   125         pEp_UNKNOWN_ERROR = -1
   126     } pEp_STATUS;
   127 
   128     HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
   129     HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   130     HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   131     HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   132     HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   133     HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * verify_status);
   134     HRESULT safeword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
   135     HRESULT safewords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
   136 
   137     typedef enum _pEp_comm_type {
   138         pEp_ct_unknown = 0,
   139 
   140         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   141 
   142         pEp_ct_no_encryption = 0x01,                // generic
   143         pEp_ct_no_encrypted_channel = 0x02,
   144         pEp_ct_key_not_found = 0x03,
   145         pEp_ct_key_expired = 0x04,
   146         pEp_ct_key_revoked = 0x05,
   147         pEp_ct_key_b0rken = 0x06,
   148         pEp_ct_my_key_not_included = 0x09,
   149 
   150         pEp_ct_security_by_obscurity = 0x0a,
   151         pEp_ct_b0rken_crypto = 0x0b,
   152         pEp_ct_key_too_short = 0x0e,
   153 
   154         pEp_ct_compromized = 0x0f,                  // known compromized connection
   155 
   156         // range 0x10 to 0x3f: unconfirmed encryption
   157 
   158         pEp_ct_unconfirmed_encryption = 0x10,       // generic
   159         pEp_ct_OpenPGP_1024_RSA_unconfirmed = 0x11,	// RSA 1024 is weak
   160         pEp_ct_OpenPGP_unconfirmed = 0x3f,          // key at least 2048 bit RSA
   161         // or 1024 bit DSA
   162 
   163         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   164 
   165         pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
   166         pEp_ct_pEp_unconfirmed = 0x7f,
   167 
   168         pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   169 
   170         // range 0x81 to 0x8f: reserved
   171         // range 0x90 to 0xbf: confirmed encryption
   172 
   173         pEp_ct_confirmed_encryption = 0x90,         // generic
   174         pEp_ct_OpenPGP_1024_RSA = 0x91, // RSA 1024 is weak
   175         pEp_ct_OpenPGP = 0xbf, // key at least 2048 bit RSA or 1024 bit DSA
   176 
   177         // range 0xc0 to 0xff: confirmed encryption and anonymization
   178 
   179         pEp_ct_confirmed_enc_anon = 0xc0,           // generic
   180         pEp_ct_pEp = 0xff
   181     } pEp_comm_type;
   182 
   183     [uuid(CAAC4CFB-4EE6-4C27-81F7-E5B4E0A46816)] struct pEp_identity_s {
   184         BSTR address;
   185         BSTR fpr;
   186         BSTR user_id;
   187         BSTR username;
   188         pEp_comm_type comm_type;
   189         BSTR lang;
   190     };
   191 
   192     HRESULT get_identity([in] BSTR address, [out, retval] struct pEp_identity_s * ident);
   193     HRESULT set_identity([in] struct pEp_identity_s * ident);
   194     HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   195     HRESULT delete_keypair([in] BSTR fpr);
   196     HRESULT import_key([in] BSTR key_data);
   197     HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   198     HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   199     HRESULT recv_key([in] BSTR pattern);
   200     HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   201     HRESULT send_key([in] BSTR pattern);
   202 
   203     HRESULT examine_identity([in] struct pEp_identity_s * ident);
   204     HRESULT examine_myself([in] struct pEp_identity_s * myself);
   205     HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   206     HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   207     HRESULT key_compromized([in] BSTR fpr);
   208 
   209     // Message API
   210 
   211     typedef enum _pEp_color {
   212         pEp_undefined = 0,
   213         pEp_unencrypted,
   214         pEp_unreliable,
   215         pEp_reliable,
   216         pEp_yellow = pEp_reliable,
   217         pEp_trusted,
   218         pEp_green = pEp_trusted,
   219         pEp_trusted_and_anonymized,
   220         pEp_fully_anonymous,
   221 
   222         pEp_under_attack = -1,
   223         pEp_red = pEp_under_attack,
   224         pEp_b0rken = -2
   225     } pEp_color;
   226 
   227     HRESULT message_encrypt([in] ITextMessage *src, [out] ITextMessage ** dst, [in, optional] SAFEARRAY(BSTR) extra);
   228     HRESULT message_decrypt([in] ITextMessage *src, [out] ITextMessage ** dst);
   229     HRESULT message_color([in] ITextMessage *msg, [out, retval] pEp_color * pVal);
   230 };
   231 
   232 [
   233     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   234     version(1.0),
   235 ]
   236 library pEpCOMServerAdapterLib
   237 {
   238     importlib("stdole2.tlb");
   239     [
   240         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   241     ]
   242     dispinterface _IpEpEngineEvents
   243     {
   244     properties:
   245     methods:
   246     };
   247     [
   248         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   249     ]
   250     coclass pEpEngine {
   251         [default] interface IpEpEngine;
   252         [default, source] dispinterface _IpEpEngineEvents;
   253     };
   254 	[
   255 		uuid(844B5363-4EF4-4A39-A030-16452783A6F7)		
   256 	]
   257 	dispinterface _ITextMessageEvents
   258 	{
   259 		properties:
   260 		methods:
   261 	};
   262 	[
   263 		uuid(B6CC444F-FE14-4DFE-8315-81E4EA16C1CC)		
   264 	]
   265 	coclass TextMessage
   266 	{
   267 		[default] interface ITextMessage;
   268 		[default, source] dispinterface _ITextMessageEvents;
   269 	};
   270 };