* JBIG library support
*/
@HAVE_JBIG@
+@HAVE_JBIGTIFF@
#endif
HAVE_PAM
PAMLIBS
HAVE_JBIG
+HAVE_JBIGTIFF
LIBJBIG"
VAR2="MACHDEPLIBS
Note "Using TIFF binary files from $TIFFBIN"
fi
+HAVE_JBIGTIFF="/*#define HAVE_JBIGTIFF 1*/"
+if [ "$DISABLE_JBIG" != "yes" ]; then
+ Note "Checking JBIG-in-TIFF conversion support."
+ if [ -z "`$TIFFBIN/tiffcp -c g4 misc/jbig.tif misc/foo.tif 2>&1`" ]; then
+ $TIFFBIN/tiffcp misc/jbig.tif misc/foo.tif
+ if [ -n "`$TIFFBIN/tiffinfo misc/foo.tif | grep 'Fax DCS'`" ]; then
+ HAVE_JBIGTIFF="#define HAVE_JBIGTIFF 1"
+ Note "JBIG-in-TIFF conversion support found."
+ else
+ Note "JBIG-in-TIFF fax support not found."
+ fi
+ else
+ Note "JBIG-in-TIFF conversion support not found."
+ fi
+ rm -f misc/foo.tif
+fi
+
Note "Done checking TIFF support."
# NB: only check if we have the MLA tools
}
bool
-Class0Modem::setupModem()
+Class0Modem::setupModem(bool isSetup)
{
if (!selectBaudRate(conf.maxRate, conf.flowControl, conf.flowControl))
return (false);
Class0Modem(ModemServer&, const ModemConfig&);
~Class0Modem();
- bool setupModem();
+ bool setupModem(bool isSend = true);
virtual bool setupFlowControl(FlowControl fc);
CallStatus dial(const char* number, fxStr& emsg);
CallStatus dialResponse(fxStr& emsg);
* if so, configure it for use.
*/
bool
-Class1Modem::setupModem()
+Class1Modem::setupModem(bool isSend)
{
if (!selectBaudRate(conf.maxRate, conf.flowControl, conf.flowControl))
return (false);
modemParams.df = BIT(DF_1DMH) | BIT(DF_2DMR);
modemParams.bf = BF_DISABLE;
modemParams.st = ST_ALL;
- pokeConfig();
+ pokeConfig(isSend);
traceModemParams();
/*
* Receive capabilities are maintained separately from
* These are potentially dynamic modem settings that can be altered on-the-fly.
*/
void
-Class1Modem::pokeConfig()
+Class1Modem::pokeConfig(bool isSend)
{
modemParams.vr = conf.class1Resolutions; // bitmapped by configuration
if (conf.class1ECMSupport) {
modemParams.ec = BIT(EC_DISABLE) | BIT(EC_ENABLE64) | BIT(EC_ENABLE256);
modemParams.df |= BIT(DF_2DMMR);
- if (conf.class1JBIGSupport) modemParams.df |= BIT(DF_JBIG);
+ switch (conf.class1JBIGSupport) {
+ case FaxModem::JBIG_FULL:
+ jbigSupported = true;
+ break;
+ case FaxModem::JBIG_SEND:
+ jbigSupported = isSend;
+ break;
+ case FaxModem::JBIG_RECV:
+ jbigSupported = !isSend;
+ break;
+ default:
+ jbigSupported = false;
+ break;
+ }
+ if (jbigSupported) modemParams.df |= BIT(DF_JBIG);
} else
modemParams.ec = BIT(EC_DISABLE);
}
/*
* Place the modem into the appropriate state
- * for sending/received facsimile.
+ * for sending facsimile.
*/
bool
Class1Modem::faxService(bool enableV34)
if (conf.class1ECMSupport) {
// JBIG
- if (conf.class1JBIGSupport) {
+ if (jbigSupported) {
dis_caps.setBit(FaxParams::BITNUM_JBIG_BASIC, true);
dis_caps.setBit(FaxParams::BITNUM_JBIG_L0, true); // JBIG library can handle L0 = 1-Yd
}
bool hadV34Trouble; // indicates failure due to V.34 restrictions
bool hadV17Trouble; // indicates failure due to V.17 problems
bool batchingError; // indicates failure due to batching protocol
+ bool jbigSupported; // whether or not JBIG is supported in this mode
const u_char* frameRev; // HDLC frame bit reversal table
fxStr lid; // encoded local id string
fxStr pwd; // transmit password
fxStr ctrlFrameRcvd; // unexpected control channel frame received
// modem setup stuff
- virtual bool setupModem();
+ virtual bool setupModem(bool isSend = true);
virtual bool setupClass1Parameters();
virtual bool setupFlowControl(FlowControl fc);
// transmission support
bool recvPage(TIFF*, u_int& ppm, fxStr& emsg, const fxStr& id);
bool recvEnd(fxStr& emsg);
void recvAbort();
- void pokeConfig();
+ void pokeConfig(bool isSend);
// polling support
bool requestToPoll(fxStr&);
fxStr& emsg);
// miscellaneous
- bool faxService(bool enableV34); // switch to fax mode
+ bool faxService(bool enableV34); // switch to fax mode (send)
bool reset(long ms); // reset modem
- bool ready(long ms); // ready modem
+ bool ready(long ms); // ready modem for receive
void setLID(const fxStr& number); // set local id string
bool supportsPolling() const; // modem capability
};
* the remainder of the Class 2 support fairly generic.
*/
bool
-Class2Modem::setupModem()
+Class2Modem::setupModem(bool isSend)
{
if (!selectBaudRate(conf.maxRate, conf.flowControl, conf.flowControl))
return (false);
}
void
-Class2Modem::pokeConfig()
+Class2Modem::pokeConfig(bool isSend)
{
}
/*
* Place the modem into the appropriate state
- * for sending/received facsimile.
+ * for sending facsimile.
*/
bool
Class2Modem::faxService(bool enableV34)
fxStr lid; // prepared local identifier string
// modem setup stuff
- virtual bool setupModem();
+ virtual bool setupModem(bool isSend = true);
virtual bool setupModel(fxStr& model);
virtual bool setupRevision(fxStr& rev);
virtual bool setupDCC();
bool recvPage(TIFF*, u_int& ppm, fxStr& emsg, const fxStr& id);
bool recvEnd(fxStr& emsg);
void recvAbort();
- void pokeConfig();
+ void pokeConfig(bool isSend);
// polling support
bool requestToPoll(fxStr& emsg);
fxStr& emsg);
// miscellaneous
- bool faxService(bool enableV34); // switch to fax mode
+ bool faxService(bool enableV34); // switch to fax mode (send)
bool reset(long ms); // reset modem
void setLID(const fxStr& number); // set local id string
bool supportsPolling() const; // modem capability
public:
virtual ~ClassModem();
- virtual bool setupModem() = 0;
+ virtual bool setupModem(bool isSend = true) = 0;
virtual bool isFaxModem() const = 0; // XXX safe to cast
virtual bool sync(long ms = 0); // synchronize (wait for "OK")
// NB: these would be enums in the FaxModem class
// if there were a portable way to refer to them!
typedef unsigned int RTNHandling; // RTN signal handling method
+typedef unsigned int JBIGSupport; // JBIG support available
/*
* This is an abstract class that defines the interface to
RTN_IGNORE = 2, // ignore error and send next page
RTN_RETRANSMITIGNORE = 3 // retransmit but ignore error instead of hanging up
};
+ enum { // FaxModem::JBIGSupport
+ JBIG_NONE = 0, // no JBIG support
+ JBIG_RECV = 1, // receive-only JBIG support
+ JBIG_SEND = 2, // send-only JBIG support
+ JBIG_FULL = 3 // full JBIG support
+ };
virtual ~FaxModem();
virtual bool recvEnd(fxStr& emsg) = 0;
virtual void recvAbort() = 0;
virtual void recvSucceeded();
- virtual void pokeConfig() = 0;
+ virtual void pokeConfig(bool isSend) = 0;
// query interfaces for optional state
virtual bool getRecvPWD(fxStr&);
virtual bool getRecvTSI(fxStr&);
* config file before hooking up the new modem.
*/
bool
-FaxServer::setupModem()
+FaxServer::setupModem(bool isSend)
{
modem = NULL;
- if (!ModemServer::setupModem())
+ if (!ModemServer::setupModem(isSend))
return (false);
if (getModem()->isFaxModem()) {
modem = (FaxModem*) ModemServer::getModem();
* driver class.
*/
ClassModem*
-FaxServer::deduceModem()
+FaxServer::deduceModem(bool isSend)
{
fxStr h(type);
h.raisecase();
if (h == "UNKNOWN"){
modem = new Class0Modem(*this, *this);
if (modem) {
- if (modem->setupModem()){
+ if (modem->setupModem(isSend)){
modemServices = modem->getModemServices();
fxStr mfr = modem->getManufacturer();
mfr.raisecase();
if (modemServices & SERVICE_CLASS21) {
modem = new Class21Modem(*this, *this);
if (modem) {
- if (modem->setupModem())
+ if (modem->setupModem(isSend))
return modem;
delete modem;
}
if (modemServices & SERVICE_CLASS20) {
modem = new Class20Modem(*this, *this);
if (modem) {
- if (modem->setupModem())
+ if (modem->setupModem(isSend))
return modem;
delete modem;
}
if (modemServices & SERVICE_CLASS2) {
modem = new Class2ErsatzModem(*this, *this);
if (modem) {
- if (modem->setupModem())
+ if (modem->setupModem(isSend))
return modem;
delete modem;
}
if (modemServices & SERVICE_CLASS10) {
modem = new Class10Modem(*this, *this);
if (modem) {
- if (modem->setupModem())
+ if (modem->setupModem(isSend))
return modem;
delete modem;
}
if (modemServices & SERVICE_CLASS1) {
modem = new Class1ErsatzModem(*this, *this);
if (modem) {
- if (modem->setupModem())
+ if (modem->setupModem(isSend))
return modem;
delete modem;
}
protected:
FaxServer(const fxStr& deviceName, const fxStr& devID);
- bool setupModem();
- ClassModem* deduceModem();
+ bool setupModem(bool isSend = true);
+ ClassModem* deduceModem(bool isSend = true);
void discardModem(bool dropDTR);
fxStr getModemCapabilities() const;
class1GreyJPEGSupport = false; // support for greyscale JPEG
class1ColorJPEGSupport = false; // support for full color JPEG
#ifdef HAVE_JBIG
- class1JBIGSupport = true; // support for monochrome JBIG
+#ifdef HAVE_JBIGTIFF
+ class1JBIGSupport = FaxModem::JBIG_FULL; // full support for monochrome JBIG
#else
- class1JBIGSupport = false; // support for monochrome JBIG
+ class1JBIGSupport = FaxModem::JBIG_SEND; // send support for monochrome JBIG
+#endif
+#else
+#ifdef HAVE_JBIGTIFF
+ class1JBIGSupport = FaxModem::JBIG_RECV; // receive support for monochrome JBIG
+#else
+ class1JBIGSupport = FaxModem::JBIG_NONE; // no support for monochrome JBIG
+#endif
#endif
class1Resolutions = VR_ALL; // resolutions support
class1PersistentECM = true; // continue to correct
return (rh);
}
+u_int
+ModemConfig::getJBIGSupport(const char* cp)
+{
+ JBIGSupport js;
+ if (valeq(cp, "FULL")) {
+ js = FaxModem::JBIG_FULL;
+ } else if (valeq(cp, "YES")) {
+ js = FaxModem::JBIG_FULL;
+ } else if (valeq(cp, "TRUE")) {
+ js = FaxModem::JBIG_FULL;
+ } else if (valeq(cp, "NONE")) {
+ js = FaxModem::JBIG_NONE;
+ } else if (valeq(cp, "NO")) {
+ js = FaxModem::JBIG_NONE;
+ } else if (valeq(cp, "FALSE")) {
+ js = FaxModem::JBIG_NONE;
+ } else if (valeq(cp, "SEND")) {
+ js = FaxModem::JBIG_SEND;
+ } else if (valeq(cp, "RECEIVE")) {
+ js = FaxModem::JBIG_RECV;
+ } else if (valeq(cp, "RECV")) {
+ js = FaxModem::JBIG_RECV;
+ } else {
+#ifdef HAVE_JBIG
+#ifdef HAVE_JBIGTIFF
+ js = FaxModem::JBIG_FULL;
+#else
+ js = FaxModem::JBIG_SEND;
+#endif
+#else
+#ifdef HAVE_JBIGTIFF
+ js = FaxModem::JBIG_RECV;
+#else
+ js = FaxModem::JBIG_NONE;
+#endif
+#endif
+ }
+ return (js);
+}
+
void
ModemConfig::parseCallID(const char* rbuf, CallID& callid) const
{
class1GreyJPEGSupport = getBoolean(value);
else if (streq(tag, "class1colorjpegsupport"))
class1ColorJPEGSupport = getBoolean(value);
-#ifdef HAVE_JBIG
else if (streq(tag, "class1jbigsupport"))
- class1JBIGSupport = getBoolean(value);
-#endif
+ class1JBIGSupport = getJBIGSupport(value);
else if (streq(tag, "class1persistentecm"))
class1PersistentECM = getBoolean(value);
else if (streq(tag, "class1extendedres"))
u_int getSpeed(const char* value);
u_int getDataFormat(const char* value);
u_int getRTNHandling(const char* cp);
+ u_int getJBIGSupport(const char* cp);
ECMType getECMType(const char* cp);
static bool findRate(const char*, BaudRate&);
u_int class1ECMFrameSize; // ECM frame size for transmission
bool class1GreyJPEGSupport; // Greyscale JPEG support
bool class1ColorJPEGSupport; // Full-color JPEG support
- bool class1JBIGSupport; // monochrome JBIG support
bool class1ECMSupport; // support T.30-A ECM
bool class1PersistentECM; // continue to correct
bool class1TCFRecvHack; // deliberately look for V.21 disconnect
u_int recvDataFormat; // received facsimile data format
RTNHandling rtnHandling; // RTN signal handling method
+ JBIGSupport class1JBIGSupport; // monochrome JBIG support
bool saveUnconfirmedPages; // don't delete unconfirmed pages
// Distinctive ring data as sequences of DRON/DROF intervals
* Setup the modem; if needed.
*/
bool
-ModemServer::setupModem()
+ModemServer::setupModem(bool isSend)
{
if (!modem) {
const char* dev = modemDevice;
* The deduceComplain cruft is just to reduce the
* noise in the log file when probing for a modem.
*/
- modem = deduceModem();
+ modem = deduceModem(isSend);
if (!modem) {
discardModem(true);
if (deduceComplain) {
* driver class.
*/
ClassModem*
-ModemServer::deduceModem()
+ModemServer::deduceModem(bool isSend)
{
ClassModem* modem = new Class0Modem(*this, *this);
if (modem) {
- if (modem->setupModem())
+ if (modem->setupModem(isSend))
return modem;
delete modem;
}
ModemServer(const fxStr& deviceName, const fxStr& devID);
// modem driver setup+teardown interfaces
- virtual bool setupModem();
+ virtual bool setupModem(bool isSend = true);
virtual bool readyModem();
virtual void discardModem(bool dropDTR);
- virtual ClassModem* deduceModem();
+ virtual ClassModem* deduceModem(bool isSend = true);
// low-level modem interfaces
int getModemFd(); // XXX
BaudRate getModemRate() const;
bool faxGettyApp::isModemLocked() { return modemLock->isLocked(); }
bool
-faxGettyApp::setupModem()
+faxGettyApp::setupModem(bool isSend)
{
/*
* Reread the configuration file if it has been
*/
if (updateConfig(getConfigFile()))
sendModemStatus("N" | getModemNumber());
- if (FaxServer::setupModem() && ModemServer::readyModem()) {
+ if (FaxServer::setupModem(false) && ModemServer::readyModem()) {
/*
* Setup modem for receiving.
*/
}
// modem settings may have changed...
FaxModem* modem = (FaxModem*) ModemServer::getModem();
- modem->pokeConfig();
+ modem->pokeConfig(false);
}
Sys::close(pipefd[0]);
break;
bool isSetup;
if (isModemLocked() || lockModem()) {
- isSetup = setupModem();
+ isSetup = setupModem(false);
unlockModem();
} else
isSetup = false;
bool canLockModem();
bool lockModem();
void unlockModem();
- bool setupModem();
+ bool setupModem(bool isSend);
void discardModem(bool dropDTR);
// inbound call handling
bool processCall(CallType ctype, fxStr& emsg, const CallID& callid);
if (info.getPagerTTYParity() != "")
pagerTTYParity = info.getPagerTTYParity();
// NB: may need to set tty baud rate here XXX
- if (!(batched & BATCH_FIRST) || setupModem()) {
+ if (!(batched & BATCH_FIRST) || setupModem(true)) {
changeState(SENDING);
setServerStatus("Sending page " | req.jobid);
/*
* Modem and TTY setup
*/
bool
-pageSendApp::setupModem()
+pageSendApp::setupModem(bool isSend)
{
- return (ModemServer::setupModem() &&
+ return (ModemServer::setupModem(isSend) &&
setParity((Parity) getConfigParity(pagerTTYParity)));
}
bool canLockModem();
bool lockModem();
void unlockModem();
- bool setupModem();
+ bool setupModem(bool isSend);
// notification interfaces used by ModemServer
void notifyModemReady();
void notifyModemWedged();
Class1HFLOCmd string \- Class 1/1.0: command to set hardware flow control
Class1FrameOverhead integer \s-14\s+1 Class 1/1.0: extra bytes in a received \s-1HDLC\s+1 frame
Class1GreyJPEGSupport boolean \s-1No\s+1 Class 1/1.0: to enable grey JPEG fax support
-Class1JBIGSupport boolean \s-1\fIsee below\fP\s+1 Class 1/1.0: to enable monochrome JBIG fax support
+Class1JBIGSupport string \s-1\fIsee below\fP\s+1 Class 1/1.0: to enable monochrome JBIG fax support
Class1NFLOCmd string \- Class 1/1.0: command to set no flow control
Class1RecvAbortOK integer \s-1200\s+1 Class 1/1.0: max wait (ms) for ``\s-1OK\s+1'' after recv abort
Class1RecvIdentTimer integer \s-140000\s+1 Class 1/1.0: max wait (ms) for initial ident frame
.TP
.B Class1JBIGSupport
Whether or not to enable support for T.85 monochrome facsimile
-with JBIG compression. This defaults to true if, during the build process
-a compatible JBIG library was found; otherwise
-.B Class1JBIGSupport
-defaults to false.
+with JBIG compression. Options are ``true'' for support in both
+sending and receiving, ``false'' for no support, ``send'' for
+support only in sending, and ``receive'' for support only in
+receiving. If, during the build process a compatible JBIG library
+was found then send support is enabled by default. If, during
+the build process the TIFF tools are found to support JBIG then
+receive support is enabled by default.
.TP
.B Class1HFLOCmd
The command to setup hardware (\s-1RTS/CTS\s+1)