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