////////////////////////////////////////////////////////////////////////////// // // faxdll.h // // Copyright(c) 1994,1995 Data Techniques, Inc. // ////////////////////////////////////////////////////////////////////////////// //$Header: /test/repos/ba/faxdll.h,v 1.1 1996-07-31 07:08:42 guy Exp $ //$History: FAXDLL.H $ // // ***************** Version 37 ***************** // User: Johnd Date: 3/05/96 Time: 10:00a // Updated in $/FaxMan/Server // Added FAXMODEMDONE Msg // // ***************** Version 36 ***************** // User: Johnd Date: 7/07/95 Time: 11:51a // Updated in $/FaxMan/Server // Fixed Bug #358, added FAXERR_PORTINIT to Fax Error enum // // ***************** Version 35 ***************** // User: Johnd Date: 5/25/95 Time: 2:28p // Updated in $/FaxMan/DLL // Added FAR to second parameter of FaxLogFind prototype. // // ***************** Version 34 ***************** // User: Johnd Date: 4/18/95 Time: 6:15p // Updated in $/FaxMan/Ole Control // Chgd some params from LPSTR to LPCSTRs. // // ***************** Version 30 ***************** // User: Johnd Date: 3/29/95 Time: 4:53p // Updated in $/FaxMan/Server // Added new FAXERR enums for Class 1. // // ***************** Version 29 ***************** // User: Timk Date: 3/10/95 Time: 3:22p // Updated in $/faxman/server // Added _ to SERVERCONFIG // // ***************** Version 28 ***************** // User: Timk Date: 3/10/95 Time: 3:06p // Updated in $/faxman/server // Added nMaxLen parameter to FaxGetConfig function. // // ***************** Version 27 ***************** // User: Timk Date: 3/09/95 Time: 6:56p // Updated in $/faxman/server // Added stuff for Setting/Getting server configuration. // #ifndef PORTABLE typedef short SHORT; typedef unsigned short USHORT; #endif #define SEND_FAX_STRUCT_REV 1 #define EXPORT_WINAPI WINAPI _export #define MAXLEN 128 #define MAXITERATORS 100 //max # of simultaneous iteratations #define FAXIDLEN 22 //len of FAXID fields (+2 for /0 and padding) #define MAXPATH 128 #define APPNAMESIZE 30 #define WM_FAXMSG WM_USER+1000 // These identifiers should be responded to by the client apps. #define FAXSENDMSG 0 #define FAXPRINTMSG 1 #define FAXGETFILENAME 2 #define FAXLOGADD 3 #define FAXLOGREMOVE 4 #define FAXCONFIGMSG 5 #define FAXMODEMMSG 6 #define FAXSERVERCONFIGMSG 7 #define FAXMODEMDONE 8 typedef enum { LOGERR_NOITERATORS = MAXITERATORS+1, LOGERR_OK, LOGERR_CONTINUEIT, //continue iteration LOGERR_ENDIT, //end of iteration - nothing else in list LOGERR_NOENTRIES, //no entries to iterate through } LOGERR; typedef enum { FAX_0 = 0, FAX_1, FAX_2, FAX_20 } FAXCLASS; typedef enum { FAXST_ERROR = 0, FAXST_OK, FAXST_INIT, FAXST_WAITFORSEND, FAXST_SEND_INIT, //initializing a send operation FAXST_SEND_DIALING, //we're dialing... FAXST_SEND_WAIT_FCON, //waiting for connect message FAXST_SEND_FCON, //Connected! FAXST_SEND_WAIT_FCSI, //waiting for FCSI FAXST_SEND_FCSI, //Receiver's ID string FAXST_SEND_WAIT_FDIS, //waiting for remote +FDIS FAXST_SEND_FDIS, //Remote T.30 parameters FAXST_SEND_WAIT_CONNECT, //wait for connect FAXST_SEND_FDCS, //negotiated T.30 parms FAXST_SENDING, //actually sending data - no longer in command mode FAXST_PAGE_END, //end of page FAXST_PORTSHUT, //comm port deleted FAXST_ABORT, //abort the current FAX operation and reset faxmodem FAXST_COMPLETE, //we're done, and can dismantle our faxing apparatus // Receiving fax states FAXST_INITRX, //initialize faxmodem for receive FAXST_WAITFORRX, //waiting for RING FAXST_ANSWERING, //answering the phone FAXST_RX_NEGOTIATE, //negotiating RX parms FAXST_RXDATA, //receiving fax data FAXST_RX_PAGE_END, //end of rx page } FAXSTATE; // FAXERROR is a list of error codes possible in FAXST_ERROR state typedef enum { FAXERR_OK, FAXERR_ACK, // Command wasn't acknowledged w/OK FAXERR_BADFAXMODEM, // Faxmodem doesn't support FaxModem-level ops FAXERR_INIT, // error initializing faxmodem FAXERR_FDIS, // bad FDIS settings FAXERR_FLID, // some kind of error setting local ID FAXERR_DIAL, // error dialing FAXERR_FCON_ERR, // error trying to connect to remote fax FAXERR_FCSI, // bad FCSI string FAXERR_NEG_FDIS, // error receiving Negotiated +FDIS FAXERR_BADSTATE, // tried to do something at wrong time FAXERR_BUSY, // line is busy FAXERR_NODIALTONE, // no dialtone found when dialing FAXERR_NOCONNECT, // didn't get expected CONNECT msg FAXERR_CANCEL, // user cancel FAXERR_FPTS, // bad or no FPTS when expected FAXERR_FHNG, // bad FHNG exit code or no FHNG when expected FAXERR_FDCS, // +FDCS: not found when expected FAXERR_ERROR, // general unspecific error w/faxmodem FAXERR_FILE, // invalid fax file or files specified FAXERR_VERSION, // incompatible DLL/Server versions FAXERR_TIMEOUT, // Timeout during fax send/recv FAXERR_NO_MPS_RESP, // Sent MPS 3 times w/o response FAXERR_NO_EOP_RESP, // Sent EOP 3 times w/o response FAXERR_NOTRAIN, // Unable to train with remote system FAXERR_PORTINIT, // Error Opening/Initializing Port } FAXERROR; typedef struct tagSendFaxStruct { // FaxMan uses these first 3 items for security // Don't change them unless you know what to do with 'em char sentinel[4]; //should be 'FMAN' WORD wStructRev; //revision # of structure WORD wStructSize; //size of structure, including variable strings LPSTR szDestName; //who the fax is to LPSTR szDestFax; //destination fax phone number LPSTR szSubject; //what the fax is about LPSTR szFromLine; //who the fax is from LPSTR szBanner; //defines the banner line for this fax LPSTR szCover; //file containing cover page LPSTR szComments; //String containing fax comments LPSTR szFromCompany; //company of the person sending the fax LPSTR szToCompany; //company of the fax recipient LPSTR szFromFax; //fax number of the sending fax LPSTR szFromPhone; //phone number to contact fax sender at LPSTR szUserDefined; //client-specific string char szLocalID[FAXIDLEN]; //Fax ID of sending station ***LocalID*** SHORT nTimeout; //Timeout val SHORT nRetries; //# of retries SHORT nRetryDelay; //seconds before a retry SHORT nYear; //year to send (1970-2038) SHORT nMonth; //month to send (1-12) SHORT nDay; //Day to send SHORT nHour; //hour to send (0-23) SHORT nMin; //minute to send (0-59) SHORT nSecond; //second to send (0-59) SHORT nSendRes; //requested resolution to send fax - 0=low, 1=high LPSTR szFileList; //list of files to fax // items below here are filled in by FaxMan - clients shouldn't change them. WORD hWndNotify; //notification window char szAppName[APPNAMESIZE]; //name of app that sent the fax char szRemoteID[FAXIDLEN]; //String ID of the fax we're connected to DWORD dwSpeed; //Connect speed SHORT nFaxRes; //Fax resolution (0 = LOW, 1 = HIGH) SHORT nTotPages; //# of pages in this fax (total) SHORT nTotCurPage; //current page (total) SHORT nCurPages; //# of pages in current file (faxfile) SHORT nCurPage; //currently sending page in current file SHORT nPagesSent; //actual # of pages sent (may be different from nTotPages) SHORT nPercent; //percent complete on current page DWORD dwID; //FaxMan Generated "handle" to this fax SHORT nHangCode; //+FHNG result (it's int 'cause it's initialized to -1) SHORT nPort; //comm port SHORT nRetryCnt; //actual # of retries attempted by server SHORT nSendYear; // time of actual transmission SHORT nSendMonth; // SHORT nSendDay; // SHORT nSendHour; // SHORT nSendMin; // SHORT nSendSecond; // DWORD dwDuration; //duration of send event FAXCLASS faxclass; //type of faxmodem we're dealin' with WORD wLog; //current log this fax is in FAXSTATE fs; //current fax state (dialing, waiting, connected, etc...) FAXERROR fe; //current fax error state (if applicable) char szStrs[1]; //strings } SEND_FAX, FAR *PSEND_FAX; typedef struct tagAppInfo { DWORD sentinel; char AppName[APPNAMESIZE]; WORD wndNotify; //notification window WORD wIterator; //iterator value WORD wDevIterator; //device iterator WORD fSubscribe; //subscribe flags } APPINFO, FAR *PAPPINFO; typedef enum { PRN_OK, //printing completed OK PRN_ABORT, //aborted by user PRN_DISKFULL, //full disk error PRN_ERROR, //undefined error } PRN_STATUS; typedef struct tagPrintStat { WORD nPages; //# of pages printed char FileName[MAXPATH]; //Name of file created by driver PRN_STATUS pStat; //status of print job } PRINTSTAT, FAR *PPRINTSTAT; #define PORT_SEND 0x01 #define PORT_RX 0x02 #define PORT_SENDING 0x04 #define PORT_RECEIVING 0x08 #define PORT_CLS1 0x10 #define PORT_CLS2 0x20 #define PORT_CLS20 0x40 #define PORT_BLOCKED 0x80 //some kind of error on this port... #define PORT_BUSY (PORT_RECEIVING | PORT_SENDING) #define MAXCOMMSTRLEN 128 typedef struct tagDevice { int nPort; //comm port this device is on WORD wFlags; //tells a little about the port... char szInit[MAXCOMMSTRLEN]; //init string for this device char szReset[MAXCOMMSTRLEN]; //reset string for this device } FAXDEVICE, FAR *PFAXDEVICE; // Subscription identifier flags // #define SUBSCRIBE_LOG_PENDING 0x01 // lParam == PSEND_FAX #define SUBSCRIBE_LOG_SENDING 0x02 // #define SUBSCRIBE_LOG_COMPLETE 0x04 #define SUBSCRIBE_LOG_FAILED 0x08 #define SUBSCRIBE_LOG_RECEIVE 0x10 #define SUBSCRIBE_LOG_ALL 0x1f //faxmodem initialization/configuration messages #define SUBSCRIBE_FAX_CONFIG 0x20 // lParam == PFAXDEVICE //faxmodem state changes #define SUBSCRIBE_FAXMODEM 0x40 // lParam == PFAXDEVICE #define SUBSCRIBE_SERVER_CONFIG 0x80 // lParam = PSERVERCONFIG typedef enum { FAXINIT_INIT, FAXINIT_TXCLASS, FAXINIT_RXCLASS, FAXINIT_DONE, FAXINIT_ERROPEN, //unable to open the comm port FAXINIT_ERRNOPORTS, //no ports were found! FAXINIT_ERRTIMEOUT, //timeout waiting for response from modem } FAXINIT_STEP; typedef struct tagFAX_INIT { FAXINIT_STEP fStep; //init step we're currently on WORD nPort; //faxmodem port we're initializing FAXCLASS fClass; //faxmodem class } FAX_INIT, FAR *PFAX_INIT; typedef struct tagSERVER_CONFIG { LPSTR lpKey; LPSTR lpValue; } SERVER_CONFIG, FAR *PSERVER_CONFIG; #ifdef __cplusplus extern "C" { #endif // FaxLog interface - these function are called by client apps PAPPINFO EXPORT_WINAPI FaxRegisterApp(LPCSTR lpAppName, WORD AppNotifyWnd); BOOL EXPORT_WINAPI FaxUnregisterApp(PAPPINFO); BOOL EXPORT_WINAPI FaxCloseServer(PAPPINFO); void EXPORT_WINAPI FaxInitSendStruct(PAPPINFO, PSEND_FAX); DWORD EXPORT_WINAPI FaxSchedule(PAPPINFO, PSEND_FAX); //returns dwID BOOL EXPORT_WINAPI FaxCancel(PAPPINFO, DWORD); int EXPORT_WINAPI FaxEnumDevices(PAPPINFO); int EXPORT_WINAPI FaxAddDevice(PAPPINFO, int); int EXPORT_WINAPI FaxRemoveDevice(PAPPINFO, int); int EXPORT_WINAPI FaxConfigureDevice(PAPPINFO, PFAXDEVICE); WORD EXPORT_WINAPI FaxLogFind(PAPPINFO, PSEND_FAX FAR *, DWORD); //find an item in the log WORD EXPORT_WINAPI FaxLogInit(PAPPINFO, WORD); //initialize log iteration WORD EXPORT_WINAPI FaxLogNext(PAPPINFO, PSEND_FAX); //find next item in log WORD EXPORT_WINAPI FaxLogDelete(PAPPINFO, DWORD, WORD); //delete fax w/dwID WORD EXPORT_WINAPI FaxSetConfig(PAPPINFO, LPCSTR, LPCSTR); WORD EXPORT_WINAPI FaxGetConfig(PAPPINFO, LPCSTR, LPSTR, WORD nLen); int EXPORT_WINAPI FaxSubscribe(PAPPINFO, WORD); //subscribe to specified fax events PSEND_FAX EXPORT_WINAPI FaxCopy(PSEND_FAX); WORD EXPORT_WINAPI FaxCreate(PAPPINFO, LPCSTR, LPCSTR, DWORD); #ifdef __cplusplus } #endif