#ifndef _FAXDEV_H
#define _FAXDEV_H

/* FAX device provider API definitions */

#include <commctrl.h>

#ifdef __cplusplus
extern "C" {
#endif

#define FS_INITIALIZING  0x20000000
#define FS_DIALING  0x20000001
#define FS_TRANSMITTING  0x20000002
#define FS_RECEIVING  0x20000004
#define FS_COMPLETED  0x20000008
#define FS_HANDLED  0x20000010
#define FS_LINE_UNAVAILABLE  0x20000020
#define FS_BUSY  0x20000040
#define FS_NO_ANSWER  0x20000080
#define FS_BAD_ADDRESS  0x20000100
#define FS_NO_DIAL_TONE  0x20000200
#define FS_DISCONNECTED  0x20000400
#define FS_FATAL_ERROR  0x20000800
#define FS_NOT_FAX_CALL  0x20001000
#define FS_CALL_DELAYED  0x20002000
#define FS_CALL_BLACKLISTED  0x20004000
#define FS_USER_ABORT  0x20200000
#define FS_ANSWERED  0x20800000

#define FAXDEVRECEIVE_SIZE  4096
#define FAXDEVREPORTSTATUS_SIZE  4096

typedef struct _FAX_SEND {
    DWORD SizeOfStruct;
    LPWSTR FileName;
    LPWSTR CallerName;
    LPWSTR CallerNumber;
    LPWSTR ReceiverName;
    LPWSTR ReceiverNumber;
    BOOL Branding;
    HCALL CallHandle;
    DWORD Reserved[3];
} FAX_SEND, *PFAX_SEND;

typedef struct _FAX_RECEIVE {
    DWORD SizeOfStruct;
    LPWSTR FileName;
    LPWSTR ReceiverName;
    LPWSTR ReceiverNumber;
    DWORD Reserved[4];
} FAX_RECEIVE, *PFAX_RECEIVE;

typedef struct _FAX_DEV_STATUS {
    DWORD SizeOfStruct;
    DWORD StatusId;
    DWORD StringId;
    DWORD PageCount;
    LPWSTR CSI;
    LPWSTR CallerId;
    LPWSTR RoutingInfo;
    DWORD ErrorCode;
    DWORD Reserved[3];
} FAX_DEV_STATUS, *PFAX_DEV_STATUS;


typedef BOOL (CALLBACK *PFAX_SERVICE_CALLBACK)(HANDLE,DWORD,DWORD_PTR,DWORD_PTR,DWORD_PTR);
typedef void (CALLBACK *PFAX_LINECALLBACK)(HANDLE,DWORD,DWORD,DWORD_PTR,DWORD_PTR,DWORD_PTR,DWORD_PTR);
typedef BOOL (CALLBACK *PFAX_SEND_CALLBACK)(HANDLE,HCALL,DWORD,DWORD);

typedef BOOL (WINAPI *PFAXDEVINITIALIZE)(HLINEAPP,HANDLE,PFAX_LINECALLBACK*,PFAX_SERVICE_CALLBACK);
typedef BOOL (WINAPI *PFAXDEVVIRTUALDEVICECREATION)(LPDWORD,LPWSTR,LPDWORD,HANDLE,ULONG_PTR);
typedef BOOL (WINAPI *PFAXDEVSTARTJOB)(HLINE,DWORD,PHANDLE,HANDLE,ULONG_PTR);
typedef BOOL (WINAPI *PFAXDEVENDJOB)(HANDLE);
typedef BOOL (WINAPI *PFAXDEVSEND)(HANDLE,PFAX_SEND,PFAX_SEND_CALLBACK);
typedef BOOL (WINAPI *PFAXDEVRECEIVE)(HANDLE,HCALL,PFAX_RECEIVE);
typedef BOOL (WINAPI *PFAXDEVREPORTSTATUS)(HANDLE,PFAX_DEV_STATUS,DWORD,LPDWORD);
typedef BOOL (WINAPI *PFAXDEVABORTOPERATION)(HANDLE);
typedef BOOL (WINAPI *PFAXDEVCONFIGURE)(HPROPSHEETPAGE*);

BOOL WINAPI FaxDevInitialize(HLINEAPP,HANDLE,PFAX_LINECALLBACK*,PFAX_SERVICE_CALLBACK);
BOOL WINAPI FaxDevVirtualDeviceCreation(LPDWORD,LPWSTR,LPDWORD,HANDLE,ULONG_PTR);
BOOL WINAPI FaxDevStartJob(HLINE,DWORD,PHANDLE,HANDLE,ULONG_PTR);
BOOL WINAPI FaxDevEndJob(HANDLE);
BOOL WINAPI FaxDevSend(HANDLE,PFAX_SEND,PFAX_SEND_CALLBACK);
BOOL WINAPI FaxDevReceive(HANDLE,HCALL,PFAX_RECEIVE);
BOOL WINAPI FaxDevReportStatus(HANDLE,PFAX_DEV_STATUS,DWORD,LPDWORD);
BOOL WINAPI FaxDevAbortOperation(HANDLE);
BOOL WINAPI FaxDevConfigure(HPROPSHEETPAGE*);

#ifdef __cplusplus
}
#endif

#endif /* _FAXDEV_H */
