1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 use shared::basetsd::UINT64;
7 use shared::guiddef::{GUID, REFGUID};
8 use shared::minwindef::{BOOL, DWORD, FILETIME, ULONG};
9 use um::bits::{
10     IBackgroundCopyCallback, IBackgroundCopyCallbackVtbl, IBackgroundCopyFile, IBackgroundCopyJob,
11 };
12 use um::bits2_0::{
13     BG_FILE_RANGE, IBackgroundCopyFile2, IBackgroundCopyFile2Vtbl, IBackgroundCopyJob3,
14     IBackgroundCopyJob3Vtbl,
15 };
16 use um::unknwnbase::{IUnknown, IUnknownVtbl};
17 use um::winnt::{HRESULT, LPCWSTR, LPWSTR};
18 RIDL!{#[uuid(0x659cdeaf, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
19 interface IBitsPeerCacheRecord(IBitsPeerCacheRecordVtbl): IUnknown(IUnknownVtbl) {
20     fn GetId(
21         pVal: *mut GUID,
22     ) -> HRESULT,
23     fn GetOriginUrl(
24         pVal: *mut LPWSTR,
25     ) -> HRESULT,
26     fn GetFileSize(
27         pVal: *mut UINT64,
28     ) -> HRESULT,
29     fn GetFileModificationTime(
30         pVal: *mut FILETIME,
31     ) -> HRESULT,
32     fn GetLastAccessTime(
33         pVal: *mut FILETIME,
34     ) -> HRESULT,
35     fn IsFileValidated() -> HRESULT,
36     fn GetFileRanges(
37         pRangeCount: *mut DWORD,
38         ppRanges: *mut *mut BG_FILE_RANGE,
39     ) -> HRESULT,
40 }}
41 RIDL!{#[uuid(0x659cdea4, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
42 interface IEnumBitsPeerCacheRecords(IEnumBitsPeerCacheRecordsVtbl): IUnknown(IUnknownVtbl) {
43     fn Next(
44         celt: ULONG,
45         rgelt: *mut *mut IBitsPeerCacheRecord,
46         pceltFetched: *mut ULONG,
47     ) -> HRESULT,
48     fn Skip(
49         celt: ULONG,
50     ) -> HRESULT,
51     fn Reset() -> HRESULT,
52     fn Clone(
53         ppenum: *mut *mut IEnumBitsPeerCacheRecords,
54     ) -> HRESULT,
55     fn GetCount(
56         puCount: *mut ULONG,
57     ) -> HRESULT,
58 }}
59 RIDL!{#[uuid(0x659cdea2, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
60 interface IBitsPeer(IBitsPeerVtbl): IUnknown(IUnknownVtbl) {
61     fn GetPeerName(
62         pName: *mut LPWSTR,
63     ) -> HRESULT,
64     fn IsAuthenticated(
65         pAuth: *mut BOOL,
66     ) -> HRESULT,
67     fn IsAvailable(
68         pOnline: *mut BOOL,
69     ) -> HRESULT,
70 }}
71 RIDL!{#[uuid(0x659cdea5, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
72 interface IEnumBitsPeers(IEnumBitsPeersVtbl): IUnknown(IUnknownVtbl) {
73     fn Next(
74         celt: ULONG,
75         rgelt: *mut *mut IBitsPeer,
76         pceltFetched: *mut ULONG,
77     ) -> HRESULT,
78     fn Skip(
79         celt: ULONG,
80     ) -> HRESULT,
81     fn Reset() -> HRESULT,
82     fn Clone(
83         ppenum: *mut *mut IEnumBitsPeers,
84     ) -> HRESULT,
85     fn GetCount(
86         puCount: *mut ULONG,
87     ) -> HRESULT,
88 }}
89 pub const BG_ENABLE_PEERCACHING_CLIENT: DWORD = 0x0001;
90 pub const BG_ENABLE_PEERCACHING_SERVER: DWORD = 0x0002;
91 pub const BG_DISABLE_BRANCH_CACHE: DWORD = 0x0004;
92 RIDL!{#[uuid(0x659cdead, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
93 interface IBitsPeerCacheAdministration(IBitsPeerCacheAdministrationVtbl): IUnknown(IUnknownVtbl) {
94     fn GetMaximumCacheSize(
95         pBytes: *mut DWORD,
96     ) -> HRESULT,
97     fn SetMaximumCacheSize(
98         Bytes: DWORD,
99     ) -> HRESULT,
100     fn GetMaximumContentAge(
101         pSeconds: *mut ULONG,
102     ) -> HRESULT,
103     fn SetMaximumContentAge(
104         Seconds: ULONG,
105     ) -> HRESULT,
106     fn GetConfigurationFlags(
107         pFlags: *mut DWORD,
108     ) -> HRESULT,
109     fn SetConfigurationFlags(
110         Flags: DWORD,
111     ) -> HRESULT,
112     fn EnumRecords(
113         ppEnum: *mut *mut IEnumBitsPeerCacheRecords,
114     ) -> HRESULT,
115     fn GetRecord(
116         ppRecord: *mut *mut IBitsPeerCacheRecord,
117     ) -> HRESULT,
118     fn ClearRecords() -> HRESULT,
119     fn DeleteRecord(
120         id: REFGUID,
121     ) -> HRESULT,
122     fn DeleteUrl(
123         url: LPCWSTR,
124     ) -> HRESULT,
125     fn EnumPeers(
126         ppEnum: *mut *mut IEnumBitsPeers,
127     ) -> HRESULT,
128     fn ClearPeers() -> HRESULT,
129     fn DiscoverPeers() -> HRESULT,
130 }}
131 pub const BG_JOB_ENABLE_PEERCACHING_CLIENT: DWORD = 0x0001;
132 pub const BG_JOB_ENABLE_PEERCACHING_SERVER: DWORD = 0x0002;
133 pub const BG_JOB_DISABLE_BRANCH_CACHE: DWORD = 0x0004;
134 RIDL!{#[uuid(0x659cdeae, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
135 interface IBackgroundCopyJob4(IBackgroundCopyJob4Vtbl):
136     IBackgroundCopyJob3(IBackgroundCopyJob3Vtbl) {
137     fn SetPeerCachingFlags(
138         Flags: DWORD,
139     ) -> HRESULT,
140     fn GetPeerCachingFlags(
141         pFlags: *mut DWORD,
142     ) -> HRESULT,
143     fn GetOwnerIntegrityLevel(
144         pLevel: *mut ULONG,
145     ) -> HRESULT,
146     fn GetOwnerElevationState(
147         pElevated: *mut BOOL,
148     ) -> HRESULT,
149     fn SetMaximumDownloadTime(
150         Timeout: ULONG,
151     ) -> HRESULT,
152     fn GetMaximumDownloadTime(
153         pTimeout: *mut ULONG,
154     ) -> HRESULT,
155 }}
156 RIDL!{#[uuid(0x659cdeaa, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
157 interface IBackgroundCopyFile3(IBackgroundCopyFile3Vtbl):
158     IBackgroundCopyFile2(IBackgroundCopyFile2Vtbl) {
159     fn GetTemporaryName(
160         pFilename: *mut LPWSTR,
161     ) -> HRESULT,
162     fn SetValidationState(
163         state: BOOL,
164     ) -> HRESULT,
165     fn GetValidationState(
166         pState: *mut BOOL,
167     ) -> HRESULT,
168     fn IsDownloadedFromPeer(
169         pVal: *mut BOOL,
170     ) -> HRESULT,
171 }}
172 RIDL!{#[uuid(0x659cdeac, 0x489e, 0x11d9, 0xa9, 0xcd, 0x00, 0x0d, 0x56, 0x96, 0x52, 0x51)]
173 interface IBackgroundCopyCallback2(IBackgroundCopyCallback2Vtbl):
174     IBackgroundCopyCallback(IBackgroundCopyCallbackVtbl) {
175     fn FileTransferred(
176         pJob: *mut IBackgroundCopyJob,
177         pFile: *mut IBackgroundCopyFile,
178     ) -> HRESULT,
179 }}
180