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