pEpCOMServerAdapter.idl
author Volker Birk <vb@pep-project.org>
Wed, 23 Nov 2016 20:22:17 +0100
changeset 219 03531c4d3fda
parent 218 ef80732697e6
child 227 5bc3d8cb9415
permissions -rw-r--r--
switch to pEpIdentityFlags data type
     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(4DA92647-A858-448E-B01F-BE4DCB8C86A1),
    13     oleautomation,
    14     nonextensible,
    15     pointer_default(unique)
    16 ]
    17 interface IpEpEngineCallbacks : IUnknown {
    18 
    19     typedef [v1_enum] enum SyncHandshakeResult {
    20         SyncHandshakeCancel = -1,
    21         SyncHandshakeAccepted = 0,
    22         SyncHandshakeRejected = 1
    23     } SyncHandshakeResult;
    24 
    25     [id(1)] HRESULT MessageToSend([in] struct TextMessage * msg);
    26     [id(2)] HRESULT ShowHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [out, retval] SyncHandshakeResult * result);
    27 };
    28 
    29 
    30 [
    31     object,
    32     uuid(045E49AF-0975-4876-A53B-8CA5AB28C0F8),
    33     oleautomation,
    34     nonextensible,
    35     pointer_default(unique)
    36 ]
    37 interface IpEpEngine : IUnknown {
    38 
    39     // runtime config of the adapter
    40 
    41     HRESULT VerboseLogging([in] VARIANT_BOOL enable);
    42 
    43     // runtime config of the engine
    44 
    45     HRESULT PassiveMode([in] VARIANT_BOOL enable);
    46     HRESULT UnencryptedSubject([in] VARIANT_BOOL enable);
    47 
    48     // basic API
    49 
    50     HRESULT ExportKey([in] BSTR fpr, [out, retval] BSTR * keyData);
    51     HRESULT Log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
    52     HRESULT Trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG maxWords, [out, retval] BSTR * words);
    53     HRESULT GetTrustwords([in] struct pEpIdentity * id1, [in] struct pEpIdentity * id2, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] VARIANT_BOOL full, [out, retval] BSTR * words);
    54     HRESULT GetCrashdumpLog([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
    55     HRESULT GetEngineVersion([out, retval] BSTR * engineVersion);
    56     HRESULT GetLanguageList([out, retval] BSTR * languages);
    57 
    58     typedef [v1_enum] enum pEpComType {
    59         pEpCtUnknown = 0,
    60 
    61         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    62 
    63         pEpCtNoEncryption = 0x01,                // generic
    64         pEpCtNoEncryptedChannel = 0x02,
    65         pEpCtKeyNotFound = 0x03,
    66         pEpCtKeyExpired = 0x04,
    67         pEpCtKeyRevoked = 0x05,
    68         pEpCtKeyB0rken = 0x06,
    69         pEpCtMyKeyNotIncluded = 0x09,
    70 
    71         pEpCtSecurityByObscurity = 0x0a,
    72         pEpCtB0rkenCrypto = 0x0b,
    73         pEpCtKeyTooShort = 0x0c,
    74 
    75         pEpCtCompromised = 0x0e,                 // known compromized connection
    76         pEpCtMistrusted = 0x0f,                  // known mistrusted key
    77 
    78         // range 0x10 to 0x3f: unconfirmed encryption
    79 
    80         pEpCtUnconfirmedEncryption = 0x10,       // generic
    81         pEpCtOpenPGPWeakUnconfirmed = 0x11,      // RSA 1024 is weak
    82 
    83         pEpCtToBeChecked = 0x20,                 // generic
    84         pEpCtSMIMEUnconfirmed = 0x21,
    85         pEpCtCMSUnconfirmed = 0x22,
    86 
    87         pEpCtStrongButUnconfirmed = 0x30,        // generic
    88         pEpCtOpenPGPUnconfirmed = 0x38,          // key at least 2048 bit RSA or EC
    89         pEpCtOTRUnconfirmed = 0x3a,
    90 
    91         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
    92 
    93         pEpCtUnconfirmedEncAnon = 0x40,          // generic
    94         pEpCtpEpUnconfirmed = 0x7f,
    95 
    96         pEpCtConfirmed = 0x80,                   // this bit decides if trust is confirmed
    97 
    98         // range 0x81 to 0x8f: reserved
    99         // range 0x90 to 0xbf: confirmed encryption
   100 
   101         pEpCtConfirmedEncryption = 0x90,         // generic
   102         pEpCtOpenPGPWeak = 0x91,                 // RSA 1024 is weak
   103 
   104         pEpCtToBeCheckedConfirmed = 0xa0,        // generic
   105         pEpCtSMIME = 0xa1,
   106         pEpCtCMS = 0xa2,
   107 
   108         pEpCtStrongEncryption = 0xb0,            // generic
   109         pEpCtOpenPGP = 0xb8,                     // key at least 2048 bit RSA or EC
   110         pEpCtOTR = 0xba,
   111 
   112         // range 0xc0 to 0xff: confirmed encryption and anonymization
   113 
   114         pEpCtConfirmedEncAnon = 0xc0,            // generic
   115         pEpCtpEp = 0xff
   116     } pEpComType;
   117 
   118 	typedef [v1_enum] enum pEpIdentityFlags {
   119 		pEpIdfNone = 0,
   120 		pEpIdfNotForSync = 0x0001,
   121 		pEpIdfList = 0x0002,
   122 		pEpIdfDevicegroup = 0x0100
   123 	} pEpIdentityFlags;
   124 
   125     [uuid(C3A3814E-567F-4D1C-9F44-9B1DA3957A89)] struct pEpIdentity {
   126         BSTR Address;
   127         BSTR Fpr;
   128         BSTR UserId;
   129         BSTR UserName;
   130         pEpComType CommType;
   131         BSTR Lang;
   132 		pEpIdentityFlags Flags;
   133     };
   134 
   135 	HRESULT SetIdentityFlags([in] struct pEpIdentity *identity, [in] pEpIdentityFlags flags);
   136 	HRESULT UnsetIdentityFlags([in] struct pEpIdentity *identity, [in] pEpIdentityFlags flags);
   137 
   138     // Keymanagement API
   139 
   140     HRESULT StartKeyserverLookup();
   141     HRESULT StopKeyserverLookup();
   142 
   143     HRESULT Myself([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   144     HRESULT UpdateIdentity([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   145     HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
   146     HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
   147     HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   148 	HRESULT OwnIdentitiesRetrieve([out, retval] SAFEARRAY(struct pEpIdentity)* own_identities);
   149 
   150     // Blacklist API
   151 
   152     HRESULT BlacklistAdd([in] BSTR fpr);
   153     HRESULT BlacklistDelete([in] BSTR fpr);
   154     HRESULT BlacklistIsListed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   155     HRESULT BlacklistRetrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
   156 
   157     // PGP compatibility functions
   158 
   159     HRESULT OpenPGPListKeyinfo([in] BSTR searchPattern, [out, retval] SAFEARRAY(struct StringPair)* keyinfoList);
   160 
   161     // Message API
   162 
   163     typedef [v1_enum] enum pEpRating {
   164         pEpRatingUndefined = 0,
   165         pEpRatingCannotDecrypt,
   166         pEpRatingHaveNoKey,
   167         pEpRatingUnencrypted,
   168         pEpRatingUnencryptedForSome,
   169         pEpRatingUnreliable,
   170         pEpRatingReliable,
   171         pEpRatingTrusted,
   172         pEpRatingTrustedAndAnonymized,
   173         pEpRatingFullyAnonymous,
   174 
   175         pEpRatingMistrust = -1,
   176         pEpRatingB0rken = -2,
   177         pEpRatingUnderAttack = -3
   178     } pEpRating;
   179 
   180     typedef [v1_enum] enum pEpColor {
   181         pEpColorNoColor = 0,
   182         pEpColorYellow,
   183         pEpColorGreen,
   184         pEpColorRed = -1,
   185     } pEpColor;
   186 
   187     typedef [v1_enum] enum pEpEncryptFlags {
   188         pEpEncryptFlagsNone = 0,
   189         pEpEncryptFlagForceEncryption = 0x1,
   190     } pEpEncryptFlags;
   191 
   192     typedef [v1_enum] enum pEpDecryptFlags {
   193         pEpDecryptFlagsNone = 0,
   194         pEpDecryptFlagOwnPrivateKey = 0x1,
   195         pEpDecryptFlagConsumed = 0x2,
   196         pEpDecryptFlagDiscarded = 0x4
   197     } pEpDecryptFlags;
   198 
   199     typedef [v1_enum] enum pEpMsgDirection {
   200         pEpDirIncoming = 0,
   201         pEpDirOutgoing
   202     } pEpMsgDirection;
   203 
   204     [uuid(47FB0795-6B64-455C-BB0E-54998CAB8ACB)] struct StringPair {
   205         BSTR Name;
   206         BSTR Value;
   207     };
   208 
   209     [uuid(634EB7CE-99AA-460D-BDF8-F7CDA7232CA6)] struct Blob {
   210         SAFEARRAY(BYTE) value;
   211         BSTR MimeType;
   212         BSTR Filename;
   213     };
   214 
   215     [uuid(B6F40887-E761-4A47-B204-A0193EE0284D)] struct TextMessage {
   216         pEpMsgDirection Dir;
   217         BSTR Id;
   218         BSTR ShortMsg;
   219         BSTR LongMsg;
   220         BSTR LongMsgFormatted;
   221         SAFEARRAY(struct Blob) Attachments;
   222         hyper Sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   223         hyper Recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   224         struct pEpIdentity From;
   225         SAFEARRAY(struct pEpIdentity) To;
   226         struct pEpIdentity RecvBy;
   227         SAFEARRAY(struct pEpIdentity) Cc;
   228         SAFEARRAY(struct pEpIdentity) Bcc;
   229         SAFEARRAY(struct pEpIdentity) ReplyTo;
   230         SAFEARRAY(BSTR) References;
   231         SAFEARRAY(BSTR) Keywords;
   232         BSTR Comments;
   233         SAFEARRAY(struct StringPair) OptFields;
   234     };
   235 
   236     HRESULT EncryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
   237     HRESULT DecryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEpRating *rating);
   238 
   239     HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
   240     HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
   241     HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
   242 
   243     // callback / keysync API
   244     HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* newCallback);
   245     HRESULT UnregisterCallbacks();
   246 };
   247 
   248 [
   249     uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
   250     version(1.0),
   251 ]
   252 library pEpCOMServerAdapterLib
   253 {
   254     importlib("stdole2.tlb");
   255 
   256     [
   257         uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
   258     ]
   259     coclass pEpEngine {
   260         [default] interface IpEpEngine;
   261         interface IpEpEngineCallbacks;
   262     };
   263 };