/* This is the header file for the service providers
 * This is MY OWN (ie. made up) interface for IDirectPlay8ThreadPool_Internal.
 * Microsoft wont give out docs for it. sigh.
 * It is very much a work in progress!
 *
 * (April 2004):
 *  Since microsoft now provide an interface with the same name (gah!)
 *  i'm renaming all my stuff to DirectPlay8ThreadPool_Internal in order
 *  to avoid confusion. implements on the same class.
 *  (the 'real' DirectPlay8ThreadPool is useful for control, not what we
 *   use it for).
 */

#ifndef _WINE_DP8THREADPOOL_H__
#define _WINE_DP8THREADPOOL_H__

#include "ole2.h"

#ifdef __cplusplus
extern "C" {
#endif

#include "dplay8.h"

/* IID for DirectPlay8ThreadPool */
/* {12F40839-E7A3-499B-AB45-9E433D8B3196} */
DEFINE_GUID(IID_IDirectPlay8ThreadPool_Internal,
0x12f40839, 0xe7a3, 0x399b, 0xab, 0x45, 0x9e, 0x43, 0x3d, 0x8b, 0x31, 0x96);

/* interface pointers */

typedef struct IDirectPlay8ThreadPool_Internal IDirectPlay8ThreadPool_Internal, *PDIRECTPLAY8THREADPOOL_INTERNAL;

/* external types */

/* callback functions */
typedef void (*tpJobFunc)(void *, void *);

/* non structure/message datatypes */

/* message identifiers */

/* constants */

/* Flags */

/* non message structures */

typedef struct _DPTP_timerInfo
{
    tpJobFunc func; /* adds this function to the threadpool queue when timer goes off */
    void *arg1, *arg2;
    DWORD dwTimerWait; /* milliseconds */
    void *dpData; /* data used by the implementation, so it can be removed */
} DPTP_timerInfo;

/* message callback structures */

/* functions */

/******** Interfaces *******/

/* IDirectPlay8ThreadPool_Internal */
#define ICOM_INTERFACE IDirectPlay8ThreadPool_Internal
#define IDirectPlay8ThreadPool_Internal_METHODS \
    ICOM_METHOD2(HRESULT,Initialize,               DWORD, dwMaxThreads, DWORD, dwFlags) \
    ICOM_METHOD1(HRESULT,GetMaxThreads,            DWORD*, pdwMaxThreads) \
    ICOM_METHOD1(HRESULT,SetMaxThreads,            DWORD, dwMaxThreads) \
    ICOM_METHOD3(HRESULT,QueueWorkItem,            tpJobFunc, pjfCallback, void *, arg1, void*, arg2) \
    ICOM_METHOD1(HRESULT,QueueTimerItem,           DPTP_timerInfo *, newTimerInfo) \
    ICOM_METHOD1(HRESULT,DeleteTimerItem,          void *, pdpData) \
    ICOM_METHOD1(HRESULT,ResetTimerItem,           void *, pdpData)
#define IDirectPlay8ThreadPool_Internal_IMETHODS \
    IUnknown_IMETHODS \
    IDirectPlay8ThreadPool_Internal_METHODS
ICOM_DEFINE(IDirectPlay8ThreadPool_Internal, IUnknown)
#undef ICOM_INTERFACE

  /* IUnknown methods */
#define IDirectPlay8ThreadPool_Internal_QueryInterface(p,a,b)           ICOM_CALL2(QueryInterface,p,a,b)
#define IDirectPlay8ThreadPool_Internal_AddRef(p)                       ICOM_CALL (AddRef,p)
#define IDirectPlay8ThreadPool_Internal_Release(p)                      ICOM_CALL (Release,p)
  /* IDirectPlay8ThreadPool_Internal methods */
#define IDirectPlay8ThreadPool_Internal_Initialize(p,a,b)               ICOM_CALL2(Initialize,p,a,b)
#define IDirectPlay8ThreadPool_Internal_GetMaxThreads(p,a)              ICOM_CALL1(GetMaxThreads,p,a)
#define IDirectPlay8ThreadPool_Internal_SendToAddress(p,a)              ICOM_CALL4(SetMaxThreads,p,a)
#define IDirectPlay8ThreadPool_Internal_QueueWorkItem(p,a,b,c)          ICOM_CALL3(QueueWorkItem,p,a,b,c)
#define IDirectPlay8ThreadPool_Internal_QueueTimerItem(p,a)             ICOM_CALL1(QueueTimerItem,p,a)
#define IDirectPlay8ThreadPool_Internal_DeleteTimerItem(p,a)            ICOM_CALL1(DeleteTimerItem,p,a)
#define IDirectPlay8ThreadPool_Internal_ResetTimerItem(p,a)             ICOM_CALL1(ResetTimerItem,p,a)

#ifdef __cplusplus
}
#endif

#endif /* _WINE_DP8THREADPOOL_H__ */
