Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | // ICoder.h |
michael@0 | 2 | |
michael@0 | 3 | #ifndef __ICODER_H |
michael@0 | 4 | #define __ICODER_H |
michael@0 | 5 | |
michael@0 | 6 | #include "IStream.h" |
michael@0 | 7 | |
michael@0 | 8 | // "23170F69-40C1-278A-0000-000400xx0000" |
michael@0 | 9 | #define CODER_INTERFACE(i, x) \ |
michael@0 | 10 | DEFINE_GUID(IID_ ## i, \ |
michael@0 | 11 | 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x04, 0x00, x, 0x00, 0x00); \ |
michael@0 | 12 | struct i: public IUnknown |
michael@0 | 13 | |
michael@0 | 14 | CODER_INTERFACE(ICompressProgressInfo, 0x04) |
michael@0 | 15 | { |
michael@0 | 16 | STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize) PURE; |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | CODER_INTERFACE(ICompressCoder, 0x05) |
michael@0 | 20 | { |
michael@0 | 21 | STDMETHOD(Code)(ISequentialInStream *inStream, |
michael@0 | 22 | ISequentialOutStream *outStream, |
michael@0 | 23 | const UInt64 *inSize, |
michael@0 | 24 | const UInt64 *outSize, |
michael@0 | 25 | ICompressProgressInfo *progress) PURE; |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | CODER_INTERFACE(ICompressCoder2, 0x18) |
michael@0 | 29 | { |
michael@0 | 30 | STDMETHOD(Code)(ISequentialInStream **inStreams, |
michael@0 | 31 | const UInt64 **inSizes, |
michael@0 | 32 | UInt32 numInStreams, |
michael@0 | 33 | ISequentialOutStream **outStreams, |
michael@0 | 34 | const UInt64 **outSizes, |
michael@0 | 35 | UInt32 numOutStreams, |
michael@0 | 36 | ICompressProgressInfo *progress) PURE; |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | namespace NCoderPropID |
michael@0 | 40 | { |
michael@0 | 41 | enum EEnum |
michael@0 | 42 | { |
michael@0 | 43 | kDictionarySize = 0x400, |
michael@0 | 44 | kUsedMemorySize, |
michael@0 | 45 | kOrder, |
michael@0 | 46 | kPosStateBits = 0x440, |
michael@0 | 47 | kLitContextBits, |
michael@0 | 48 | kLitPosBits, |
michael@0 | 49 | kNumFastBytes = 0x450, |
michael@0 | 50 | kMatchFinder, |
michael@0 | 51 | kMatchFinderCycles, |
michael@0 | 52 | kNumPasses = 0x460, |
michael@0 | 53 | kAlgorithm = 0x470, |
michael@0 | 54 | kMultiThread = 0x480, |
michael@0 | 55 | kNumThreads, |
michael@0 | 56 | kEndMarker = 0x490 |
michael@0 | 57 | }; |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | CODER_INTERFACE(ICompressSetCoderProperties, 0x20) |
michael@0 | 61 | { |
michael@0 | 62 | STDMETHOD(SetCoderProperties)(const PROPID *propIDs, |
michael@0 | 63 | const PROPVARIANT *properties, UInt32 numProperties) PURE; |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | /* |
michael@0 | 67 | CODER_INTERFACE(ICompressSetCoderProperties, 0x21) |
michael@0 | 68 | { |
michael@0 | 69 | STDMETHOD(SetDecoderProperties)(ISequentialInStream *inStream) PURE; |
michael@0 | 70 | }; |
michael@0 | 71 | */ |
michael@0 | 72 | |
michael@0 | 73 | CODER_INTERFACE(ICompressSetDecoderProperties2, 0x22) |
michael@0 | 74 | { |
michael@0 | 75 | STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size) PURE; |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | CODER_INTERFACE(ICompressWriteCoderProperties, 0x23) |
michael@0 | 79 | { |
michael@0 | 80 | STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStreams) PURE; |
michael@0 | 81 | }; |
michael@0 | 82 | |
michael@0 | 83 | CODER_INTERFACE(ICompressGetInStreamProcessedSize, 0x24) |
michael@0 | 84 | { |
michael@0 | 85 | STDMETHOD(GetInStreamProcessedSize)(UInt64 *value) PURE; |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | CODER_INTERFACE(ICompressSetCoderMt, 0x25) |
michael@0 | 89 | { |
michael@0 | 90 | STDMETHOD(SetNumberOfThreads)(UInt32 numThreads) PURE; |
michael@0 | 91 | }; |
michael@0 | 92 | |
michael@0 | 93 | CODER_INTERFACE(ICompressGetSubStreamSize, 0x30) |
michael@0 | 94 | { |
michael@0 | 95 | STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value) PURE; |
michael@0 | 96 | }; |
michael@0 | 97 | |
michael@0 | 98 | CODER_INTERFACE(ICompressSetInStream, 0x31) |
michael@0 | 99 | { |
michael@0 | 100 | STDMETHOD(SetInStream)(ISequentialInStream *inStream) PURE; |
michael@0 | 101 | STDMETHOD(ReleaseInStream)() PURE; |
michael@0 | 102 | }; |
michael@0 | 103 | |
michael@0 | 104 | CODER_INTERFACE(ICompressSetOutStream, 0x32) |
michael@0 | 105 | { |
michael@0 | 106 | STDMETHOD(SetOutStream)(ISequentialOutStream *outStream) PURE; |
michael@0 | 107 | STDMETHOD(ReleaseOutStream)() PURE; |
michael@0 | 108 | }; |
michael@0 | 109 | |
michael@0 | 110 | CODER_INTERFACE(ICompressSetInStreamSize, 0x33) |
michael@0 | 111 | { |
michael@0 | 112 | STDMETHOD(SetInStreamSize)(const UInt64 *inSize) PURE; |
michael@0 | 113 | }; |
michael@0 | 114 | |
michael@0 | 115 | CODER_INTERFACE(ICompressSetOutStreamSize, 0x34) |
michael@0 | 116 | { |
michael@0 | 117 | STDMETHOD(SetOutStreamSize)(const UInt64 *outSize) PURE; |
michael@0 | 118 | }; |
michael@0 | 119 | |
michael@0 | 120 | CODER_INTERFACE(ICompressFilter, 0x40) |
michael@0 | 121 | { |
michael@0 | 122 | STDMETHOD(Init)() PURE; |
michael@0 | 123 | STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) PURE; |
michael@0 | 124 | // Filter return outSize (UInt32) |
michael@0 | 125 | // if (outSize <= size): Filter have converted outSize bytes |
michael@0 | 126 | // if (outSize > size): Filter have not converted anything. |
michael@0 | 127 | // and it needs at least outSize bytes to convert one block |
michael@0 | 128 | // (it's for crypto block algorithms). |
michael@0 | 129 | }; |
michael@0 | 130 | |
michael@0 | 131 | CODER_INTERFACE(ICryptoProperties, 0x80) |
michael@0 | 132 | { |
michael@0 | 133 | STDMETHOD(SetKey)(const Byte *data, UInt32 size) PURE; |
michael@0 | 134 | STDMETHOD(SetInitVector)(const Byte *data, UInt32 size) PURE; |
michael@0 | 135 | }; |
michael@0 | 136 | |
michael@0 | 137 | CODER_INTERFACE(ICryptoSetPassword, 0x90) |
michael@0 | 138 | { |
michael@0 | 139 | STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size) PURE; |
michael@0 | 140 | }; |
michael@0 | 141 | |
michael@0 | 142 | CODER_INTERFACE(ICryptoSetCRC, 0xA0) |
michael@0 | 143 | { |
michael@0 | 144 | STDMETHOD(CryptoSetCRC)(UInt32 crc) PURE; |
michael@0 | 145 | }; |
michael@0 | 146 | |
michael@0 | 147 | ////////////////////// |
michael@0 | 148 | // It's for DLL file |
michael@0 | 149 | namespace NMethodPropID |
michael@0 | 150 | { |
michael@0 | 151 | enum EEnum |
michael@0 | 152 | { |
michael@0 | 153 | kID, |
michael@0 | 154 | kName, |
michael@0 | 155 | kDecoder, |
michael@0 | 156 | kEncoder, |
michael@0 | 157 | kInStreams, |
michael@0 | 158 | kOutStreams, |
michael@0 | 159 | kDescription |
michael@0 | 160 | }; |
michael@0 | 161 | } |
michael@0 | 162 | |
michael@0 | 163 | #endif |