2 * Queue Manager definitions
4 * Copyright 2007 Google (Roy Shea)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/list.h"
34 #include "wine/unicode.h"
36 /* Background copy job vtbl and related data */
39 IBackgroundCopyJob3 IBackgroundCopyJob3_iface
;
40 IBackgroundCopyJobHttpOptions IBackgroundCopyJobHttpOptions_iface
;
47 BG_JOB_PROGRESS jobProgress
;
50 IBackgroundCopyCallback2
*callback
;
51 BOOL callback2
; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
52 /* Protects file list, and progress */
54 struct list entryFromQmgr
;
59 BG_AUTH_CREDENTIALS creds
[BG_AUTH_TARGET_PROXY
][BG_AUTH_SCHEME_PASSPORT
];
63 BG_ERROR_CONTEXT context
;
65 IBackgroundCopyFile2
*file
;
70 } BackgroundCopyJobImpl
;
72 /* Background copy file vtbl and related data */
75 IBackgroundCopyFile2 IBackgroundCopyFile2_iface
;
78 BG_FILE_PROGRESS fileProgress
;
79 WCHAR tempFileName
[MAX_PATH
];
80 struct list entryFromJob
;
81 BackgroundCopyJobImpl
*owner
;
83 } BackgroundCopyFileImpl
;
85 /* Background copy manager vtbl and related data */
88 IBackgroundCopyManager IBackgroundCopyManager_iface
;
89 /* Protects job list, job states, and jobEvent */
93 } BackgroundCopyManagerImpl
;
97 IClassFactory IClassFactory_iface
;
100 extern HANDLE stop_event DECLSPEC_HIDDEN
;
101 extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN
;
102 extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN
;
104 HRESULT
BackgroundCopyManagerConstructor(LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
105 HRESULT
BackgroundCopyJobConstructor(LPCWSTR displayName
, BG_JOB_TYPE type
,
106 GUID
*pJobId
, BackgroundCopyJobImpl
**job
) DECLSPEC_HIDDEN
;
107 HRESULT
enum_copy_job_create(BackgroundCopyManagerImpl
*qmgr
,
108 IEnumBackgroundCopyJobs
**enumjob
) DECLSPEC_HIDDEN
;
109 HRESULT
BackgroundCopyFileConstructor(BackgroundCopyJobImpl
*owner
,
110 LPCWSTR remoteName
, LPCWSTR localName
,
111 BackgroundCopyFileImpl
**file
) DECLSPEC_HIDDEN
;
112 HRESULT
EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl
*, IEnumBackgroundCopyFiles
**) DECLSPEC_HIDDEN
;
113 DWORD WINAPI
fileTransfer(void *param
) DECLSPEC_HIDDEN
;
114 void processJob(BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
115 BOOL
processFile(BackgroundCopyFileImpl
*file
, BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
116 BOOL
transitionJobState(BackgroundCopyJobImpl
*job
, BG_JOB_STATE from
, BG_JOB_STATE to
) DECLSPEC_HIDDEN
;
118 /* Little helper functions */
119 static inline WCHAR
*strdupW(const WCHAR
*src
)
121 WCHAR
*dst
= HeapAlloc(GetProcessHeap(), 0, (strlenW(src
) + 1) * sizeof(WCHAR
));
122 if (dst
) strcpyW(dst
, src
);
126 static inline WCHAR
*co_strdupW(const WCHAR
*src
)
128 WCHAR
*dst
= CoTaskMemAlloc((strlenW(src
) + 1) * sizeof(WCHAR
));
129 if (dst
) strcpyW(dst
, src
);
133 static inline HRESULT
return_strval(const WCHAR
*str
, WCHAR
**ret
)
137 if (!ret
) return E_INVALIDARG
;
140 *ret
= CoTaskMemAlloc((len
+1)*sizeof(WCHAR
));
141 if (!*ret
) return E_OUTOFMEMORY
;
146 #endif /* __QMGR_H__ */