FaxMachineInfo.h
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:8k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /* $Id: FaxMachineInfo.h,v 1.2 2007/08/17 14:54:26 faxguy Exp $ */
  2. /*
  3.  * Copyright (c) 1990-1996 Sam Leffler
  4.  * Copyright (c) 1991-1996 Silicon Graphics, Inc.
  5.  * HylaFAX is a trademark of Silicon Graphics
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26. #ifndef _FaxMachineInfo_
  27. #define _FaxMachineInfo_
  28. /*
  29.  * Fax Machine Information Database Support.
  30.  */
  31. #include "Str.h"
  32. #include "FaxConfig.h"
  33. #include <stdarg.h>
  34. class fxStackBuffer;
  35. /*
  36.  * Each remote machine the server sends a facsimile to
  37.  * has information that describes capabilities that are
  38.  * important in formatting outgoing documents, and, potentially,
  39.  * controls on what the server should do when presented
  40.  * with documents to send to the destination.  The capabilities
  41.  * are treated as a cache; information is initialized to
  42.  * be a minimal set of capabilities that all machines are
  43.  * required (by T.30) to support and then updated according
  44.  * to the DIS/DTC messages received during send operations.
  45.  */
  46. class FaxMachineInfo : public FaxConfig {
  47. private:
  48.     fxStr file; // pathname to info file
  49.     u_int locked; // bit vector of locked items
  50.     bool changed; // changed since restore
  51.     u_short supportsVRes; // VR support bitmask
  52.     bool supports2DEncoding; // handles Group 3 2D
  53.     bool supportsMMR; // handles Group 4
  54.     bool hasV34Trouble; // has difficulty with V.34
  55.     bool hasV17Trouble; // has difficulty with V.17
  56.     bool senderHasV17Trouble; // sender has difficulty with V.17
  57.     bool senderSkipsV29; // sender skips over V.29 usage
  58.     bool supportsPostScript; // handles Adobe NSF protocol
  59.     bool supportsBatching; // handles batching (EOM) protocol
  60.     bool calledBefore; // successfully called before
  61.     u_short maxPageWidth; // max capable page width
  62.     u_short maxPageLength; // max capable page length
  63.     u_short maxSignallingRate; // max capable signalling rate
  64.     u_short minScanlineTime; // min scanline time capable
  65.     fxStr csi; // last received CSI
  66.     fxStr nsf; // last received NSF
  67.     fxStr dis; // last received DIS
  68.     int sendFailures; // count of failed send attempts
  69.     int dialFailures; // count of failed dial attempts
  70.     fxStr lastSendFailure; // reason for last failed send attempt
  71.     fxStr lastDialFailure; // reason for last failed dial attempt
  72.     u_int pagerMaxMsgLength; // max text message length for pages
  73.     fxStr pagerPassword; // pager service password string
  74.     fxStr pagerTTYParity; // tty setting required by pager service
  75.     fxStr pagingProtocol; // Protocol spoken by paging central
  76.     fxStr pageSource; // String identifying page source
  77.     fxStr pagerSetupCmds; // atcmds to overwrite value in config
  78.     static const fxStr infoDir;
  79.     void writeConfig(fxStackBuffer&);
  80.     bool setConfigItem(const char* tag, const char* value);
  81.     void vconfigError(const char* fmt0, va_list ap);
  82.     void configError(const char* fmt0 ...);
  83.     void configTrace(const char* fmt0 ...);
  84.     void error(const char* fmt0 ...);
  85. public:
  86.     FaxMachineInfo();
  87.     FaxMachineInfo(const FaxMachineInfo& other);
  88.     virtual ~FaxMachineInfo();
  89.     virtual bool updateConfig(const fxStr& filename);
  90.     virtual void writeConfig();
  91.     virtual void resetConfig();
  92.     u_short getSupportsVRes() const;
  93.     bool getSupports2DEncoding() const;
  94.     bool getSupportsMMR() const;
  95.     bool getHasV34Trouble() const;
  96.     bool getHasV17Trouble() const;
  97.     bool getSenderHasV17Trouble() const;
  98.     bool getSenderSkipsV29() const;
  99.     bool getSupportsPostScript() const;
  100.     bool getSupportsBatching() const;
  101.     bool getCalledBefore() const;
  102.     u_short getMaxPageWidthInPixels() const;
  103.     u_short getMaxPageWidthInMM() const;
  104.     u_short getMaxPageLengthInMM() const;
  105.     u_short getMaxSignallingRate() const;
  106.     u_short getMinScanlineTime() const;
  107.     const fxStr& getCSI() const;
  108.     const fxStr& getNSF() const;
  109.     const fxStr& getDIS() const;
  110.     int getSendFailures() const;
  111.     int getDialFailures() const;
  112.     const fxStr& getLastSendFailure() const;
  113.     const fxStr& getLastDialFailure() const;
  114.     void setSupportsVRes(int);
  115.     void setSupports2DEncoding(bool);
  116.     void setSupportsMMR(bool);
  117.     void setHasV34Trouble(bool);
  118.     void setHasV17Trouble(bool);
  119.     void setSenderHasV17Trouble(bool);
  120.     void setSenderSkipsV29(bool);
  121.     void setSupportsPostScript(bool);
  122.     void setSupportsBatching(bool);
  123.     void setCalledBefore(bool);
  124.     void setMaxPageWidthInPixels(int);
  125.     void setMaxPageLengthInMM(int);
  126.     void setMaxSignallingRate(int);
  127.     void setMinScanlineTime(int);
  128.     void setCSI(const fxStr&);
  129.     void setNSF(const fxStr&);
  130.     void setDIS(const fxStr&);
  131.     void setSendFailures(int);
  132.     void setDialFailures(int);
  133.     void setLastSendFailure(const fxStr&);
  134.     void setLastDialFailure(const fxStr&);
  135.     u_int getPagerMaxMsgLength() const;
  136.     const fxStr& getPagerPassword() const;
  137.     const fxStr& getPagerTTYParity() const;
  138.     const fxStr& getPagingProtocol() const;
  139.     const fxStr& getPageSource() const;
  140.     const fxStr& getPagerSetupCmds() const;
  141. };
  142. inline u_short FaxMachineInfo::getSupportsVRes() const
  143.     { return supportsVRes; }
  144. inline bool FaxMachineInfo::getSupports2DEncoding() const
  145.     { return supports2DEncoding; }
  146. inline bool FaxMachineInfo::getSupportsMMR() const
  147.     { return supportsMMR; }
  148. inline bool FaxMachineInfo::getHasV34Trouble() const
  149.     { return hasV34Trouble; }
  150. inline bool FaxMachineInfo::getHasV17Trouble() const
  151.     { return hasV17Trouble; }
  152. inline bool FaxMachineInfo::getSenderHasV17Trouble() const
  153.     { return senderHasV17Trouble; }
  154. inline bool FaxMachineInfo::getSenderSkipsV29() const
  155.     { return senderSkipsV29; }
  156. inline bool FaxMachineInfo::getSupportsPostScript() const
  157.     { return supportsPostScript; }
  158. inline bool FaxMachineInfo::getSupportsBatching() const
  159.     { return supportsBatching; }
  160. inline bool FaxMachineInfo::getCalledBefore() const
  161.     { return calledBefore; }
  162. inline u_short FaxMachineInfo::getMaxPageWidthInPixels() const
  163.     { return maxPageWidth; }
  164. inline u_short FaxMachineInfo::getMaxPageLengthInMM() const
  165.     { return maxPageLength; }
  166. inline u_short FaxMachineInfo::getMaxSignallingRate() const
  167.     { return maxSignallingRate; }
  168. inline u_short FaxMachineInfo::getMinScanlineTime() const
  169.     { return minScanlineTime; }
  170. inline const fxStr& FaxMachineInfo::getCSI() const
  171.     { return csi; }
  172. inline const fxStr& FaxMachineInfo::getNSF() const
  173.     { return nsf; }
  174. inline const fxStr& FaxMachineInfo::getDIS() const
  175.     { return dis; }
  176. inline int FaxMachineInfo::getSendFailures() const
  177.     { return sendFailures; }
  178. inline int FaxMachineInfo::getDialFailures() const
  179.     { return dialFailures; }
  180. inline const fxStr& FaxMachineInfo::getLastSendFailure() const
  181.     { return lastSendFailure; }
  182. inline const fxStr& FaxMachineInfo::getLastDialFailure() const
  183.     { return lastDialFailure; }
  184. inline u_int FaxMachineInfo::getPagerMaxMsgLength() const
  185.     { return pagerMaxMsgLength; }
  186. inline const fxStr& FaxMachineInfo::getPagerPassword() const
  187.     { return pagerPassword; }
  188. inline const fxStr& FaxMachineInfo::getPagerTTYParity() const
  189.     { return pagerTTYParity; }
  190. inline const fxStr& FaxMachineInfo::getPagingProtocol() const
  191.     { return pagingProtocol; }
  192. inline const fxStr& FaxMachineInfo::getPageSource() const
  193.     { return pageSource; }
  194. inline const fxStr& FaxMachineInfo::getPagerSetupCmds() const
  195.     { return pagerSetupCmds; }
  196. #endif /* _FaxMachineInfo_ */