pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Wed, 01 Feb 2017 21:37:07 +0100
changeset 232 4c6d44bed519
parent 231 fbe8c644918f
child 237 589b9cb32b07
permissions -rw-r--r--
COM-48 Implement timeout, and signal the app to poll inbox faster when waiting
on KeySync queue with a timeout.

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