pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Tue, 04 Oct 2016 23:07:42 +0200
branchkeysync
changeset 178 9f30e2a5f72c
parent 177 4d197f1c3abb
child 180 51f843f18dd2
permissions -rw-r--r--
COM-30 COM-24: Refactorings
Drop unused enum.
     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 Log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
    51     HRESULT TrustWords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG maxWords, [out, retval] BSTR * words);
    52     HRESULT GetCrashdumpLog([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
    53     HRESULT GetEngineVersion([out, retval] BSTR * engineVersion);
    54     HRESULT GetLanguageList([out, retval] BSTR * languages);
    55 
    56     typedef [v1_enum] enum pEpComType {
    57         pEpCtUnknown = 0,
    58 
    59         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    60 
    61         pEpCtNoEncryption = 0x01,                // generic
    62         pEpCtNoEncryptedChannel = 0x02,
    63         pEpCtKeyNotFound = 0x03,
    64         pEpCtKeyExpired = 0x04,
    65         pEpCtKeyRevoked = 0x05,
    66         pEpCtKeyB0rken = 0x06,
    67         pEpCtMyKeyNotIncluded = 0x09,
    68 
    69         pEpCtSecurityByObscurity = 0x0a,
    70         pEpCtB0rkenCrypto = 0x0b,
    71         pEpCtKeyTooShort = 0x0c,
    72 
    73         pEpCtCompromised = 0x0e,                 // known compromized connection
    74         pEpCtMistrusted = 0x0f,                  // known mistrusted key
    75 
    76         // range 0x10 to 0x3f: unconfirmed encryption
    77 
    78         pEpCtUnconfirmedEncryption = 0x10,       // generic
    79         pEpCtOpenPGPWeakUnconfirmed = 0x11,      // RSA 1024 is weak
    80 
    81         pEpCtToBeChecked = 0x20,                 // generic
    82         pEpCtSMIMEUnconfirmed = 0x21,
    83         pEpCtCMSUnconfirmed = 0x22,
    84 
    85         pEpCtStrongButUnconfirmed = 0x30,        // generic
    86         pEpCtOpenPGPUnconfirmed = 0x38,          // key at least 2048 bit RSA or EC
    87         pEpCtOTRUnconfirmed = 0x3a,
    88 
    89         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
    90 
    91         pEpCtUnconfirmedEncAnon = 0x40,          // generic
    92         pEpCtpEpUnconfirmed = 0x7f,
    93 
    94         pEpCtConfirmed = 0x80,                   // this bit decides if trust is confirmed
    95 
    96         // range 0x81 to 0x8f: reserved
    97         // range 0x90 to 0xbf: confirmed encryption
    98 
    99         pEpCtConfirmedEncryption = 0x90,         // generic
   100         pEpCtOpenPGPWeak = 0x91,                 // RSA 1024 is weak
   101 
   102         pEpCtToBeCheckedConfirmed = 0xa0,        // generic
   103         pEpCtSMIME = 0xa1,
   104         pEpCtCMS = 0xa2,
   105 
   106         pEpCtStrongEncryption = 0xb0,            // generic
   107         pEpCtOpenPGP = 0xb8,                     // key at least 2048 bit RSA or EC
   108         pEpCtOTR = 0xba,
   109 
   110         // range 0xc0 to 0xff: confirmed encryption and anonymization
   111 
   112         pEpCtConfirmedEncAnon = 0xc0,            // generic
   113         pEpCtpEp = 0xff
   114     } pEpComType;
   115 
   116     [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEpIdentity {
   117         BSTR address;
   118         BSTR fpr;
   119         BSTR userId;
   120         BSTR username;
   121         pEpComType commType;
   122         BSTR lang;
   123     };
   124     
   125     // Keymanagement API
   126     HRESULT StartKeyserverLookup();
   127     HRESULT StopKeyserverLookup();
   128 
   129     HRESULT Myself([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   130     HRESULT UpdateIdentity([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   131     HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
   132     HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
   133     HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   134 
   135     // Blacklist API
   136 
   137     HRESULT BlacklistAdd([in] BSTR fpr);
   138     HRESULT BlacklistDelete([in] BSTR fpr);
   139     HRESULT BlacklistIsListed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   140     HRESULT BlacklistRetreive([out, retval] SAFEARRAY(BSTR) *blacklist);
   141 
   142 	// PGP compatibility functions
   143 
   144 	HRESULT OpenPGPListKeyinfo([in] BSTR searchPattern, [out, retval] SAFEARRAY(struct StringPair)* keyinfoList);
   145 
   146     // Message API
   147 
   148 	typedef [v1_enum] enum pEpRating {
   149 		pEpRatingUndefined = 0,
   150 		pEpRatingCannotDecrypt,
   151 		pEpRatingHaveNoKey,
   152 		pEpRatingUnencrypted,
   153 		pEpRatingUnencryptedForSome,
   154 		pEpRatingUnreliable,
   155 		pEpRatingReliable,
   156 		pEpRatingTrusted,
   157 		pEpRatingTrustedAndAnonymized,
   158 		pEpRatingFullyAnonymous,
   159 
   160 		pEpRatingMistrust = -1,
   161 		pEpRatingB0rken = -2,
   162 		pEpRatingUnderAttack = -3
   163 	} pEpRating;
   164 
   165 	typedef [v1_enum] enum pEpColor {
   166 		pEpColorNoColor = 0,
   167 		pEpColorYellow,
   168 		pEpColorGreen,
   169 		pEpColorRed = -1,
   170 	} pEpColor;
   171 
   172 	typedef [v1_enum] enum pEpEncryptFlags {
   173 		pEpEncryptFlagsNone = 0,
   174 		pEpEncryptFlagForceEncryption = 0x1,
   175 	} pEpEncryptFlags;
   176 
   177 	typedef [v1_enum] enum pEpDecryptFlags {
   178 		pEpDecryptFlagsNone = 0,
   179 		pEpDecryptFlagOwnPrivateKey = 0x1
   180 	} pEpDecryptFlags;
   181 
   182     typedef [v1_enum] enum pEpMsgDirection {
   183         pEpDirIncoming = 0,
   184         pEpDirOutgoing
   185     } pEpMsgDirection;
   186 
   187     [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct StringPair {
   188         BSTR name;
   189         BSTR value;
   190     };
   191 
   192     [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct Blob {
   193         SAFEARRAY(BYTE) value;
   194         BSTR mimeType;
   195         BSTR filename;
   196     };
   197 
   198     [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct TextMessage {
   199         pEpMsgDirection dir;
   200         BSTR id;
   201         BSTR shortmsg;
   202         BSTR longmsg;
   203         BSTR longmsgFormatted;
   204         SAFEARRAY(struct Blob) attachments;
   205         hyper sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   206         hyper recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   207         struct pEpIdentity from;
   208         SAFEARRAY(struct pEpIdentity) to;
   209         struct pEpIdentity recvBy;
   210         SAFEARRAY(struct pEpIdentity) cc;
   211         SAFEARRAY(struct pEpIdentity) bcc;
   212         SAFEARRAY(struct pEpIdentity) replyTo;
   213         SAFEARRAY(BSTR) references;
   214         SAFEARRAY(BSTR) keywords;
   215         BSTR comments;
   216         SAFEARRAY(struct StringPair) optFields;
   217     };
   218 
   219     HRESULT EncryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
   220     HRESULT DecryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEpRating *rating);
   221 
   222     HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
   223     HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
   224 	HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
   225 
   226     // callback / keysync API
   227 	HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* newCallback);
   228 	HRESULT UnregisterCallbacks([in] IpEpEngineCallbacks* obsoleteCallback);
   229 };
   230 
   231 [
   232     uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
   233     version(1.0),
   234 ]
   235 library pEpCOMServerAdapterLib
   236 {
   237     importlib("stdole2.tlb");
   238     
   239     [
   240         uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
   241     ]
   242     coclass pEpEngine {
   243         [default] interface IpEpEngine;
   244     };
   245 };