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"
35 /* Background copy job vtbl and related data */
38 IBackgroundCopyJob4 IBackgroundCopyJob4_iface
;
39 IBackgroundCopyJobHttpOptions IBackgroundCopyJobHttpOptions_iface
;
46 BG_JOB_PROGRESS jobProgress
;
49 IBackgroundCopyCallback2
*callback
;
50 BOOL callback2
; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
51 /* Protects file list, and progress */
53 struct list entryFromQmgr
;
58 BG_AUTH_CREDENTIALS creds
[BG_AUTH_TARGET_PROXY
][BG_AUTH_SCHEME_PASSPORT
];
62 BG_ERROR_CONTEXT context
;
64 IBackgroundCopyFile2
*file
;
69 } BackgroundCopyJobImpl
;
71 /* Background copy file vtbl and related data */
74 IBackgroundCopyFile2 IBackgroundCopyFile2_iface
;
77 BG_FILE_PROGRESS fileProgress
;
78 WCHAR tempFileName
[MAX_PATH
];
79 struct list entryFromJob
;
80 BackgroundCopyJobImpl
*owner
;
82 } BackgroundCopyFileImpl
;
84 /* Background copy manager vtbl and related data */
87 IBackgroundCopyManager IBackgroundCopyManager_iface
;
88 /* Protects job list, job states, and jobEvent */
92 } BackgroundCopyManagerImpl
;
96 IClassFactory IClassFactory_iface
;
99 extern HANDLE stop_event DECLSPEC_HIDDEN
;
100 extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN
;
101 extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN
;
103 HRESULT
BackgroundCopyManagerConstructor(LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
104 HRESULT
BackgroundCopyJobConstructor(LPCWSTR displayName
, BG_JOB_TYPE type
,
105 GUID
*pJobId
, BackgroundCopyJobImpl
**job
) DECLSPEC_HIDDEN
;
106 HRESULT
enum_copy_job_create(BackgroundCopyManagerImpl
*qmgr
,
107 IEnumBackgroundCopyJobs
**enumjob
) DECLSPEC_HIDDEN
;
108 HRESULT
BackgroundCopyFileConstructor(BackgroundCopyJobImpl
*owner
,
109 LPCWSTR remoteName
, LPCWSTR localName
,
110 BackgroundCopyFileImpl
**file
) DECLSPEC_HIDDEN
;
111 HRESULT
EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl
*, IEnumBackgroundCopyFiles
**) DECLSPEC_HIDDEN
;
112 DWORD WINAPI
fileTransfer(void *param
) DECLSPEC_HIDDEN
;
113 void processJob(BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
114 BOOL
processFile(BackgroundCopyFileImpl
*file
, BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
115 BOOL
transitionJobState(BackgroundCopyJobImpl
*job
, BG_JOB_STATE from
, BG_JOB_STATE to
) DECLSPEC_HIDDEN
;
117 /* Little helper functions */
118 static inline WCHAR
*strdupW(const WCHAR
*src
)
120 WCHAR
*dst
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src
) + 1) * sizeof(WCHAR
));
121 if (dst
) lstrcpyW(dst
, src
);
125 static inline WCHAR
*co_strdupW(const WCHAR
*src
)
127 WCHAR
*dst
= CoTaskMemAlloc((lstrlenW(src
) + 1) * sizeof(WCHAR
));
128 if (dst
) lstrcpyW(dst
, src
);
132 static inline HRESULT
return_strval(const WCHAR
*str
, WCHAR
**ret
)
136 if (!ret
) return E_INVALIDARG
;
139 *ret
= CoTaskMemAlloc((len
+1)*sizeof(WCHAR
));
140 if (!*ret
) return E_OUTOFMEMORY
;
145 #endif /* __QMGR_H__ */