From: Lee Howard Date: Tue, 27 Sep 2005 18:26:43 +0000 (+0000) Subject: Bug 663: various session logging improvements X-Git-Tag: HYLAFAX-4_2_3BETA1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=253093b846600a2877dbf2abec5ca0fef970b317;p=thirdparty%2FHylaFAX.git Bug 663: various session logging improvements --- diff --git a/CHANGES b/CHANGES index 0012fa2a..3386e4bc 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ Changelog for HylaFAX +* session logging improvements (27 Sep 2005) * add Retransmit-Ignore RTNHandlingMethod (27 Sep 2005) Changelog for HylaFAX 4.2.2 diff --git a/faxd/Class1.c++ b/faxd/Class1.c++ index 21b71ba7..51b9f56b 100644 --- a/faxd/Class1.c++ +++ b/faxd/Class1.c++ @@ -903,7 +903,7 @@ Class1Modem::recvECMFrame(HDLCFrame& frame) break; case ETX: if (frame.getLength() > 0) - traceHDLCFrame("-->", frame); + traceHDLCFrame("-->", frame, true); if (frame.getLength() < 5) { // RCP frame size protoTrace("HDLC frame too short (%u bytes)", frame.getLength()); return (false); @@ -1008,7 +1008,7 @@ Class1Modem::recvECMFrame(HDLCFrame& frame) bit = getModemBit(0); // trailing bit on flag if (!rcpframe) { if (frame.getLength() > 0) - traceHDLCFrame("-->", frame); + traceHDLCFrame("-->", frame, true); if (bit) { // should have been zero protoTrace("Bad HDLC terminating flag received."); return (false); @@ -1065,10 +1065,13 @@ Class1Modem::endECMBlock() * Log an HLDC frame along with a time stamp (secs.10ms). */ void -Class1Modem::traceHDLCFrame(const char* direction, const HDLCFrame& frame) +Class1Modem::traceHDLCFrame(const char* direction, const HDLCFrame& frame, bool isecm) { - if (!getHDLCTracing()) - return; + if (!isecm) { + if (!getHDLCTracing()) return; + } else { + if (!getECMTracing()) return; + } const char* hexdigits = "0123456789ABCDEF"; fxStackBuffer buf; for (u_int i = 0; i < frame.getLength(); i++) { diff --git a/faxd/Class1.h b/faxd/Class1.h index 900df161..7116c813 100644 --- a/faxd/Class1.h +++ b/faxd/Class1.h @@ -189,7 +189,7 @@ protected: bool blockFrame(const u_char* bitrev, bool lastframe, u_int ppmcmd, fxStr& emsg); bool endECMBlock(); void abortReceive(); - void traceHDLCFrame(const char* direction, const HDLCFrame& frame); + void traceHDLCFrame(const char* direction, const HDLCFrame& frame, bool isecm = false); // class 1 command support routines bool class1Query(const fxStr& queryCmd, Class1Cap caps[]); bool parseQuery(const char*, Class1Cap caps[]); diff --git a/faxd/Class1Send.c++ b/faxd/Class1Send.c++ index 2b233c91..c06c9241 100644 --- a/faxd/Class1Send.c++ +++ b/faxd/Class1Send.c++ @@ -981,7 +981,7 @@ Class1Modem::blockFrame(const u_char* bitrev, bool lastframe, u_int ppmcmd, fxSt ecmframe.put(fcs1); ecmframe.put(fcs2); blockData(fcs1, false); blockData(fcs2, false); - traceHDLCFrame("<--", ecmframe); + traceHDLCFrame("<--", ecmframe, true); protoTrace("SEND send frame number %u", fnum); if (!useV34) { @@ -1006,7 +1006,7 @@ Class1Modem::blockFrame(const u_char* bitrev, bool lastframe, u_int ppmcmd, fxSt blockData(firstframe[i], false); } ecmframe.put(firstframe, (frameSize + 6)); - traceHDLCFrame("<--", ecmframe); + traceHDLCFrame("<--", ecmframe, true); protoTrace("SEND send frame number %u", frameRev[firstframe[3]]); if (!useV34) blockData(0x7e, true); } @@ -1016,7 +1016,7 @@ Class1Modem::blockFrame(const u_char* bitrev, bool lastframe, u_int ppmcmd, fxSt for (u_short k = 0; k < 3; k++) { // three RCP frames for (u_short j = 0; j < 5; j++) blockData(rcpframe[j], false); - traceHDLCFrame("<--", rcpframe); + traceHDLCFrame("<--", rcpframe, true); // separate frames with a 0x7e flag if (!useV34) blockData(0x7e, true); diff --git a/faxd/FaxModem.c++ b/faxd/FaxModem.c++ index 36042e71..44e05938 100644 --- a/faxd/FaxModem.c++ +++ b/faxd/FaxModem.c++ @@ -655,6 +655,8 @@ bool FaxModem::isFaxModem() const { return true; } bool FaxModem::getHDLCTracing() { return (server.getSessionTracing() & FAXTRACE_HDLC) != 0; } +bool FaxModem::getECMTracing() + { return (server.getSessionTracing() & FAXTRACE_ECM) != 0; } FaxSendStatus FaxModem::sendSetupParams(TIFF* tif, Class2Params& params, diff --git a/faxd/FaxModem.h b/faxd/FaxModem.h index 768b56a0..7744d510 100644 --- a/faxd/FaxModem.h +++ b/faxd/FaxModem.h @@ -120,6 +120,7 @@ protected: void tracePPM(const char* dir, u_int ppm); // server-related stuff bool getHDLCTracing(); + bool getECMTracing(); FaxSendStatus sendSetupParams(TIFF*, Class2Params&, FaxMachineInfo&, fxStr&); void recvTSI(const fxStr&); diff --git a/faxd/FaxSend.c++ b/faxd/FaxSend.c++ index 1b3b0f91..a9ebdd30 100644 --- a/faxd/FaxSend.c++ +++ b/faxd/FaxSend.c++ @@ -61,11 +61,14 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, FaxAcctInfo& ai, } } fax.commid = getCommID(); // set by beginSession - traceServer("SEND FAX: JOB %s DEST %s COMMID %s DEVICE '%s'" + traceServer("SEND FAX: JOB %s DEST %s COMMID %s DEVICE '%s' FROM '%s <%s>' USER %s" , (const char*) fax.jobid , (const char*) fax.external , (const char*) fax.commid , (const char*) getModemDevice() + , (const char*) fax.sender + , (const char*) fax.mailaddr + , (const char*) fax.owner ); /* Dispatcher already did setupModem() */ diff --git a/faxd/FaxTrace.h b/faxd/FaxTrace.h index 49729884..e7cbdb2e 100644 --- a/faxd/FaxTrace.h +++ b/faxd/FaxTrace.h @@ -47,6 +47,7 @@ const int FAXTRACE_MODEMSTATE = 0x08000; // modem state changes const int FAXTRACE_DIALRULES = 0x10000; // dialstring processing const int FAXTRACE_DOCREFS = 0x20000; // document reference handling const int FAXTRACE_TIFF = 0x40000; // TIFF library msgs +const int FAXTRACE_ECM = 0x80000; // ECM HDLC image data frames const int FAXTRACE_ANY = 0xffffffff; const int FAXTRACE_MASK = 0xfffff; diff --git a/faxd/faxGettyApp.c++ b/faxd/faxGettyApp.c++ index dbbfee4b..0decb68c 100644 --- a/faxd/faxGettyApp.c++ +++ b/faxd/faxGettyApp.c++ @@ -339,10 +339,12 @@ faxGettyApp::answerPhone(AnswerType atype, CallType ctype, const CallID& callid, callResolved = false; advanceRotary = false; } else { + fxStr callid_formatted = ""; + for (u_int i = 0; i < callid.size(); i++) + callid_formatted.append(quote | callid.id(i) | enquote); + if (callid_formatted.length()) traceProtocol("CallID:%s", (const char*) callid_formatted); if (dynamicConfig.length()) { - fxStr cmd(dynamicConfig | quote | getModemDevice() | enquote); - for (u_int i = 0; i < callid.size(); i++) - cmd.append(quote | callid.id(i) | enquote); + fxStr cmd(dynamicConfig | quote | getModemDevice() | enquote | callid_formatted); fxStr localid = ""; int pipefd[2], idlength, status; char line[1024]; diff --git a/man/hylafax-config.4f b/man/hylafax-config.4f index 2afe36f5..331f38c8 100644 --- a/man/hylafax-config.4f +++ b/man/hylafax-config.4f @@ -1407,6 +1407,8 @@ form the value for this tag. 32768 (0x08000) Modem State Transitions modem state changes (down, busy, ready) 65536 (0x10000) Dial Rules dialstring rules parsing and execution 131072 (0x20000) Docq Changes document reference handling +262144 (0x40000) TIFF library any messages produced by the TIFF library +524288 (0x80000) ECM Frames binary \s-1T.30-A HDLC\s+1 ECM frames .sp .5 .fi For example, to enable tracing of server operations and