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
26 #define WIN32_NO_STATUS
28 #define COM_NO_WINDOWS_H
41 #include <wine/list.h>
42 #include <wine/debug.h>
43 #include <wine/unicode.h>
45 WINE_DEFAULT_DEBUG_CHANNEL(qmgr
);
47 /* Background copy job vtbl and related data */
50 IBackgroundCopyJob3 IBackgroundCopyJob3_iface
;
51 IBackgroundCopyJobHttpOptions IBackgroundCopyJobHttpOptions_iface
;
58 BG_JOB_PROGRESS jobProgress
;
61 IBackgroundCopyCallback2
*callback
;
62 BOOL callback2
; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
63 /* Protects file list, and progress */
65 struct list entryFromQmgr
;
70 BG_AUTH_CREDENTIALS creds
[BG_AUTH_TARGET_PROXY
][BG_AUTH_SCHEME_PASSPORT
];
74 BG_ERROR_CONTEXT context
;
76 IBackgroundCopyFile2
*file
;
81 } BackgroundCopyJobImpl
;
83 /* Background copy file vtbl and related data */
86 IBackgroundCopyFile2 IBackgroundCopyFile2_iface
;
89 BG_FILE_PROGRESS fileProgress
;
90 WCHAR tempFileName
[MAX_PATH
];
91 struct list entryFromJob
;
92 BackgroundCopyJobImpl
*owner
;
94 } BackgroundCopyFileImpl
;
96 /* Background copy manager vtbl and related data */
99 IBackgroundCopyManager IBackgroundCopyManager_iface
;
100 /* Protects job list, job states, and jobEvent */
104 } BackgroundCopyManagerImpl
;
108 IClassFactory IClassFactory_iface
;
111 extern HANDLE stop_event DECLSPEC_HIDDEN
;
112 extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN
;
113 extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN
;
115 HRESULT
BackgroundCopyManagerConstructor(LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
116 HRESULT
BackgroundCopyJobConstructor(LPCWSTR displayName
, BG_JOB_TYPE type
,
117 GUID
*pJobId
, BackgroundCopyJobImpl
**job
) DECLSPEC_HIDDEN
;
118 HRESULT
enum_copy_job_create(BackgroundCopyManagerImpl
*qmgr
,
119 IEnumBackgroundCopyJobs
**enumjob
) DECLSPEC_HIDDEN
;
120 HRESULT
BackgroundCopyFileConstructor(BackgroundCopyJobImpl
*owner
,
121 LPCWSTR remoteName
, LPCWSTR localName
,
122 BackgroundCopyFileImpl
**file
) DECLSPEC_HIDDEN
;
123 HRESULT
EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl
*, IEnumBackgroundCopyFiles
**) DECLSPEC_HIDDEN
;
124 DWORD WINAPI
fileTransfer(void *param
) DECLSPEC_HIDDEN
;
125 void processJob(BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
126 BOOL
processFile(BackgroundCopyFileImpl
*file
, BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
127 BOOL
transitionJobState(BackgroundCopyJobImpl
*job
, BG_JOB_STATE from
, BG_JOB_STATE to
) DECLSPEC_HIDDEN
;
129 /* Little helper functions */
130 static inline WCHAR
*strdupW(const WCHAR
*src
)
132 WCHAR
*dst
= HeapAlloc(GetProcessHeap(), 0, (strlenW(src
) + 1) * sizeof(WCHAR
));
133 if (dst
) strcpyW(dst
, src
);
137 static inline WCHAR
*co_strdupW(const WCHAR
*src
)
139 WCHAR
*dst
= CoTaskMemAlloc((strlenW(src
) + 1) * sizeof(WCHAR
));
140 if (dst
) strcpyW(dst
, src
);
144 static inline HRESULT
return_strval(const WCHAR
*str
, WCHAR
**ret
)
148 if (!ret
) return E_INVALIDARG
;
151 *ret
= CoTaskMemAlloc((len
+1)*sizeof(WCHAR
));
152 if (!*ret
) return E_OUTOFMEMORY
;
157 #endif /* __QMGR_H__ */