com0com-cvs Mailing List for Null-modem emulator (Page 11)
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
You can subscribe to this list here.
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(10) |
Sep
(15) |
Oct
(6) |
Nov
(9) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(7) |
Jun
(11) |
Jul
(6) |
Aug
(9) |
Sep
(1) |
Oct
(27) |
Nov
(22) |
Dec
(3) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(2) |
Apr
(3) |
May
(7) |
Jun
(17) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(20) |
Nov
(18) |
Dec
(1) |
2008 |
Jan
|
Feb
(3) |
Mar
(46) |
Apr
(40) |
May
(4) |
Jun
(9) |
Jul
(7) |
Aug
(62) |
Sep
(25) |
Oct
(51) |
Nov
(67) |
Dec
(81) |
2009 |
Jan
(13) |
Feb
(31) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(10) |
Oct
|
Nov
(3) |
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
(12) |
Jun
(9) |
Jul
(12) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
|
Jul
(26) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(23) |
2012 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:51:02
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins Modified Files: plugins_api.h Log Message: Extended the number of possible IN options Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** plugins_api.h 11 Dec 2008 13:05:09 -0000 1.21 --- plugins_api.h 18 Dec 2008 16:50:51 -0000 1.22 *************** *** 91,106 **** #define PIN_STATE_BREAK 0x0100 #define HUB_MSG_TYPE_GET_IN_OPTS (6 | HUB_MSG_UNION_TYPE_PVAL) ! #define GO_O2V_MODEM_STATUS(o) ((BYTE)(o)) ! #define GO_V2O_MODEM_STATUS(v) ((DWORD)(BYTE)(v)) ! #define GO_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) ! #define GO_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define GO_RBR_STATUS ((DWORD)1 << 16) ! #define GO_RLC_STATUS ((DWORD)1 << 17) ! #define GO_BREAK_STATUS ((DWORD)1 << 18) ! #define GO_PURGE_TX_IN ((DWORD)1 << 19) ! #define GO_ESCAPE_MODE ((DWORD)1 << 24) ! #define GO_LBR_STATUS ((DWORD)1 << 25) ! #define GO_LLC_STATUS ((DWORD)1 << 26) ! #define HUB_MSG_TYPE_SET_OUT_OPTS (7 | HUB_MSG_UNION_TYPE_VAL) #define SO_O2V_PIN_STATE(o) ((WORD)(o)) #define SO_V2O_PIN_STATE(v) ((DWORD)(WORD)(v)) --- 91,109 ---- #define PIN_STATE_BREAK 0x0100 #define HUB_MSG_TYPE_GET_IN_OPTS (6 | HUB_MSG_UNION_TYPE_PVAL) ! #define GO_O2I(o) ((DWORD)(o) >> 30) ! #define GO_I2O(i) ((DWORD)i << 30) ! #define GO0_ESCAPE_MODE ((DWORD)1 << 0) ! #define GO0_LBR_STATUS ((DWORD)1 << 1) ! #define GO0_LLC_STATUS ((DWORD)1 << 2) ! #define GO1_O2V_MODEM_STATUS(o) ((BYTE)(o)) ! #define GO1_V2O_MODEM_STATUS(v) ((DWORD)(BYTE)(v)) ! #define GO1_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) ! #define GO1_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define GO1_RBR_STATUS ((DWORD)1 << 16) ! #define GO1_RLC_STATUS ((DWORD)1 << 17) ! #define GO1_BREAK_STATUS ((DWORD)1 << 18) ! #define GO1_PURGE_TX_IN ((DWORD)1 << 19) ! #define HUB_MSG_TYPE_FAIL_IN_OPTS (7 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_SET_OUT_OPTS (8 | HUB_MSG_UNION_TYPE_VAL) #define SO_O2V_PIN_STATE(o) ((WORD)(o)) #define SO_V2O_PIN_STATE(v) ((DWORD)(WORD)(v)) *************** *** 110,120 **** #define SO_SET_LC ((DWORD)1 << 25) #define SO_PURGE_TX ((DWORD)1 << 26) - #define HUB_MSG_TYPE_FAIL_IN_OPTS (8 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_RBR_STATUS (9 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_UINT) #define HUB_MSG_TYPE_RLC_STATUS (10 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_LC) #define HUB_MSG_TYPE_COUNT_REPEATS (11 | HUB_MSG_UNION_TYPE_PVAL | HUB_MSG_VAL_TYPE_MSG_TYPE) #define HUB_MSG_TYPE_GET_ESC_OPTS (12 | HUB_MSG_UNION_TYPE_PVAL) ! #define ESC_OPTS_MAP_EO2GO(eo) ((DWORD)(eo) & 0x00FFFFFF) ! #define ESC_OPTS_MAP_GO2EO(go) ((DWORD)(go) & 0x00FFFFFF) #define ESC_OPTS_O2V_ESCCHAR(o) ((BYTE)(o >> 24)) #define ESC_OPTS_V2O_ESCCHAR(v) ((DWORD)(BYTE)(v) << 24) --- 113,122 ---- #define SO_SET_LC ((DWORD)1 << 25) #define SO_PURGE_TX ((DWORD)1 << 26) #define HUB_MSG_TYPE_RBR_STATUS (9 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_UINT) #define HUB_MSG_TYPE_RLC_STATUS (10 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_LC) #define HUB_MSG_TYPE_COUNT_REPEATS (11 | HUB_MSG_UNION_TYPE_PVAL | HUB_MSG_VAL_TYPE_MSG_TYPE) #define HUB_MSG_TYPE_GET_ESC_OPTS (12 | HUB_MSG_UNION_TYPE_PVAL) ! #define ESC_OPTS_MAP_EO_2_GO1(e) ((DWORD)(e) & 0x00FFFFFF) ! #define ESC_OPTS_MAP_GO1_2_EO(g) ((DWORD)(g) & 0x00FFFFFF) #define ESC_OPTS_O2V_ESCCHAR(o) ((BYTE)(o >> 24)) #define ESC_OPTS_V2O_ESCCHAR(v) ((DWORD)(BYTE)(v) << 24) |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:51:01
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/telnet Modified Files: filter.cpp opt_comport.cpp opt_comport.h Log Message: Extended the number of possible IN options Index: opt_comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/opt_comport.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** opt_comport.cpp 12 Dec 2008 08:28:34 -0000 1.6 --- opt_comport.cpp 18 Dec 2008 16:50:52 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.6 2008/12/12 08:28:34 vfrolov * Partialy implemented handling SET-CONTROL commands 0-3 and 13-19 *************** *** 158,162 **** } /////////////////////////////////////////////////////////////// ! TelnetOptionComPort::TelnetOptionComPort(TelnetProtocol &_telnet, BOOL _isClient, DWORD &_goMask, DWORD &_soMask) : TelnetOption(_telnet, 44 /*COM-PORT-OPTION*/), isClient(_isClient), --- 161,165 ---- } /////////////////////////////////////////////////////////////// ! TelnetOptionComPort::TelnetOptionComPort(TelnetProtocol &_telnet, BOOL _isClient, DWORD (&_goMask)[2], DWORD &_soMask) : TelnetOption(_telnet, 44 /*COM-PORT-OPTION*/), isClient(_isClient), *************** *** 201,205 **** } /////////////////////////////////////////////////////////////// ! TelnetOptionComPortClient::TelnetOptionComPortClient(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask) : TelnetOptionComPort(_telnet, TRUE, _goMask, _soMask) { --- 204,208 ---- } /////////////////////////////////////////////////////////////// ! TelnetOptionComPortClient::TelnetOptionComPortClient(TelnetProtocol &_telnet, DWORD (&_goMask)[2], DWORD &_soMask) : TelnetOptionComPort(_telnet, TRUE, _goMask, _soMask) { *************** *** 303,307 **** return FALSE; ! if ((goMask & GO_LBR_STATUS) == 0) break; --- 306,310 ---- return FALSE; ! if ((goMask[0] & GO0_LBR_STATUS) == 0) break; *************** *** 324,328 **** return FALSE; ! if ((goMask & GO_LLC_STATUS) == 0) break; --- 327,331 ---- return FALSE; ! if ((goMask[0] & GO0_LLC_STATUS) == 0) break; *************** *** 347,351 **** return FALSE; ! if ((goMask & GO_LLC_STATUS) == 0) break; --- 350,354 ---- return FALSE; ! if ((goMask[0] & GO0_LLC_STATUS) == 0) break; *************** *** 370,374 **** return FALSE; ! if ((goMask & GO_LLC_STATUS) == 0) break; --- 373,377 ---- return FALSE; ! if ((goMask[0] & GO0_LLC_STATUS) == 0) break; *************** *** 413,417 **** return FALSE; ! BYTE mask = GO_O2V_LINE_STATUS(goMask); if (mask == 0) --- 416,420 ---- return FALSE; ! BYTE mask = GO1_O2V_LINE_STATUS(goMask[1]); if (mask == 0) *************** *** 436,440 **** return FALSE; ! BYTE mask = GO_O2V_MODEM_STATUS(goMask); if (mask == 0) --- 439,443 ---- return FALSE; ! BYTE mask = GO1_O2V_MODEM_STATUS(goMask[1]); if (mask == 0) *************** *** 477,481 **** } /////////////////////////////////////////////////////////////// ! TelnetOptionComPortServer::TelnetOptionComPortServer(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask) : TelnetOptionComPort(_telnet, FALSE, _goMask, _soMask), br(0), --- 480,484 ---- } /////////////////////////////////////////////////////////////// ! TelnetOptionComPortServer::TelnetOptionComPortServer(TelnetProtocol &_telnet, DWORD (&_goMask)[2], DWORD &_soMask) : TelnetOptionComPort(_telnet, FALSE, _goMask, _soMask), br(0), *************** *** 636,640 **** if (par != 0 && br != par) { ! if (goMask & GO_RBR_STATUS) { br = 0; --- 639,643 ---- if (par != 0 && br != par) { ! if (goMask[1] & GO1_RBR_STATUS) { br = 0; *************** *** 673,677 **** lc &= ~(VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE); ! if (goMask & GO_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); --- 676,680 ---- lc &= ~(VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE); ! if (goMask[1] & GO1_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); *************** *** 708,712 **** lc &= ~(VAL2LC_PARITY(-1)|LC_MASK_PARITY); ! if (goMask & GO_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); --- 711,715 ---- lc &= ~(VAL2LC_PARITY(-1)|LC_MASK_PARITY); ! if (goMask[1] & GO1_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); *************** *** 743,747 **** lc &= ~(VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS); ! if (goMask & GO_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); --- 746,750 ---- lc &= ~(VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS); ! if (goMask[1] & GO1_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); *************** *** 815,819 **** SetBreak(val == scSetBreakOn); ! if ((goMask & GO_BREAK_STATUS) == 0) return FALSE; --- 818,822 ---- SetBreak(val == scSetBreakOn); ! if ((goMask[1] & GO1_BREAK_STATUS) == 0) return FALSE; *************** *** 835,839 **** SetMCR(val == scSetDtrOn ? SPS_P2V_MCR(PIN_STATE_DTR) : 0, SPS_P2V_MCR(PIN_STATE_DTR)); ! if ((goMask & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) == 0) return FALSE; --- 838,842 ---- SetMCR(val == scSetDtrOn ? SPS_P2V_MCR(PIN_STATE_DTR) : 0, SPS_P2V_MCR(PIN_STATE_DTR)); ! if ((goMask[1] & GO1_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) == 0) return FALSE; *************** *** 856,860 **** SetMCR(val == scSetRtsOn ? SPS_P2V_MCR(PIN_STATE_RTS) : 0, SPS_P2V_MCR(PIN_STATE_RTS)); ! if ((goMask & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) == 0) return FALSE; --- 859,863 ---- SetMCR(val == scSetRtsOn ? SPS_P2V_MCR(PIN_STATE_RTS) : 0, SPS_P2V_MCR(PIN_STATE_RTS)); ! if ((goMask[1] & GO1_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) == 0) return FALSE; *************** *** 934,938 **** SendSubNegotiation(answer); ! if ((goMask & GO_PURGE_TX_IN) == 0) return FALSE; --- 937,941 ---- SendSubNegotiation(answer); ! if ((goMask[1] & GO1_PURGE_TX_IN) == 0) return FALSE; Index: opt_comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/opt_comport.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** opt_comport.h 11 Dec 2008 13:13:40 -0000 1.3 --- opt_comport.h 18 Dec 2008 16:50:52 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.3 2008/12/11 13:13:40 vfrolov * Implemented PURGE-DATA (RFC 2217) *************** *** 40,44 **** { public: ! TelnetOptionComPort(TelnetProtocol &_telnet, BOOL _isClient, DWORD &_goMask, DWORD &_soMask); void AddXoffXon(BOOL xoff); --- 43,47 ---- { public: ! TelnetOptionComPort(TelnetProtocol &_telnet, BOOL _isClient, DWORD (&_goMask)[2], DWORD &_soMask); void AddXoffXon(BOOL xoff); *************** *** 60,64 **** BOOL isClient; ! DWORD &goMask; DWORD &soMask; --- 63,67 ---- BOOL isClient; ! DWORD (&goMask)[2]; DWORD &soMask; *************** *** 70,74 **** { public: ! TelnetOptionComPortClient(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask); virtual void SetBR(DWORD br); --- 73,77 ---- { public: ! TelnetOptionComPortClient(TelnetProtocol &_telnet, DWORD (&_goMask)[2], DWORD &_soMask); virtual void SetBR(DWORD br); *************** *** 90,94 **** { public: ! TelnetOptionComPortServer(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask); virtual void SetBR(DWORD _br); --- 93,97 ---- { public: ! TelnetOptionComPortServer(TelnetProtocol &_telnet, DWORD (&_goMask)[2], DWORD &_soMask); virtual void SetBR(DWORD _br); Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** filter.cpp 11 Dec 2008 13:13:40 -0000 1.11 --- filter.cpp 18 Dec 2008 16:50:52 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.11 2008/12/11 13:13:40 vfrolov * Implemented PURGE-DATA (RFC 2217) *************** *** 98,106 **** pComPort(NULL), soMask(0), - goMask(0), pinState(0), br(0), lc(0) ! {} void SetProtocol(TelnetProtocol *_pTelnetProtocol) { --- 101,111 ---- pComPort(NULL), soMask(0), pinState(0), br(0), lc(0) ! { ! for (int iGo = 0 ; iGo < sizeof(goMask)/sizeof(goMask[0]) ; iGo++) ! goMask[iGo] = 0; ! } void SetProtocol(TelnetProtocol *_pTelnetProtocol) { *************** *** 118,122 **** TelnetOptionComPort *pComPort; DWORD soMask; ! DWORD goMask; WORD pinState; DWORD br; --- 123,127 ---- TelnetOptionComPort *pComPort; DWORD soMask; ! DWORD goMask[2]; WORD pinState; DWORD br; *************** *** 144,148 **** DWORD soMask; ! DWORD goMask; private: --- 149,153 ---- DWORD soMask; ! DWORD goMask[2]; private: *************** *** 225,231 **** SO_SET_BR|SO_SET_LC|SO_PURGE_TX; ! goMask = GO_V2O_LINE_STATUS(-1) | ! GO_V2O_MODEM_STATUS(-1) | ! GO_LBR_STATUS|GO_LLC_STATUS; break; case comport_server: --- 230,235 ---- SO_SET_BR|SO_SET_LC|SO_PURGE_TX; ! goMask[0] = GO0_LBR_STATUS|GO0_LLC_STATUS; ! goMask[1] = GO1_V2O_LINE_STATUS(-1) | GO1_V2O_MODEM_STATUS(-1); break; case comport_server: *************** *** 234,243 **** SO_SET_BR|SO_SET_LC; ! goMask = GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS|MODEM_STATUS_DSR) | ! GO_RBR_STATUS|GO_RLC_STATUS|GO_BREAK_STATUS|GO_PURGE_TX_IN; break; default: soMask = 0; ! goMask = 0; } } --- 238,249 ---- SO_SET_BR|SO_SET_LC; ! goMask[0] = 0; ! goMask[1] = GO1_V2O_MODEM_STATUS(MODEM_STATUS_CTS|MODEM_STATUS_DSR) | ! GO1_RBR_STATUS|GO1_RLC_STATUS|GO1_BREAK_STATUS|GO1_PURGE_TX_IN; break; default: soMask = 0; ! goMask[0] = 0; ! goMask[1] = 0; } } *************** *** 474,478 **** switch (pInMsg->type) { case HUB_MSG_TYPE_GET_IN_OPTS: { ! if (!((Filter *)hFilter)->goMask) break; --- 480,489 ---- switch (pInMsg->type) { case HUB_MSG_TYPE_GET_IN_OPTS: { ! int iGo = GO_O2I(pInMsg->u.pv.val); ! ! if (iGo != 0 && iGo != 1) ! break; ! ! if (!((Filter *)hFilter)->goMask[iGo == 0 ? 0 : 1]) break; *************** *** 484,488 **** // get interceptable options from subsequent filters separately ! DWORD interceptable_options = (pInMsg->u.pv.val & ((Filter *)hFilter)->goMask); pInMsg->u.pv.val &= ~interceptable_options; --- 495,499 ---- // get interceptable options from subsequent filters separately ! DWORD interceptable_options = (pInMsg->u.pv.val & ((Filter *)hFilter)->goMask[iGo == 0 ? 0 : 1]); pInMsg->u.pv.val &= ~interceptable_options; *************** *** 494,499 **** pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &pState->goMask; ! pInMsg->u.pv.val = interceptable_options; break; --- 505,511 ---- pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &pState->goMask[iGo == 0 ? 0 : 1]; ! _ASSERTE((interceptable_options & GO_I2O(-1)) == 0); ! pInMsg->u.pv.val = interceptable_options | GO_I2O(iGo); break; *************** *** 525,529 **** if (!pInMsg->u.val) { if (pState->pComPort) { ! if (pState->goMask & GO_BREAK_STATUS) { pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_BREAK_STATUS, FALSE); --- 537,541 ---- if (!pInMsg->u.val) { if (pState->pComPort) { ! if (pState->goMask[1] & GO1_BREAK_STATUS) { pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_BREAK_STATUS, FALSE); *************** *** 532,538 **** } ! if (pState->goMask & GO_V2O_MODEM_STATUS(-1)) { pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_MODEM_STATUS, ! 0 | VAL2MASK(GO_O2V_MODEM_STATUS(pState->goMask))); if (!pInMsg) --- 544,550 ---- } ! if (pState->goMask[1] & GO1_V2O_MODEM_STATUS(-1)) { pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_MODEM_STATUS, ! 0 | VAL2MASK(GO1_O2V_MODEM_STATUS(pState->goMask[1]))); if (!pInMsg) |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:51:00
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084 Modified Files: comhub.cpp Log Message: Extended the number of possible IN options Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** comhub.cpp 24 Nov 2008 16:30:56 -0000 1.13 --- comhub.cpp 18 Dec 2008 16:50:51 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2008/12/18 16:50:51 vfrolov + * Extended the number of possible IN options + * * Revision 1.13 2008/11/24 16:30:56 vfrolov * Removed pOnXoffXon *************** *** 119,123 **** for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { ! DWORD fail_options = 0; DWORD repeats = 0; --- 122,130 ---- for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { ! DWORD fail_options[GO_O2I(GO_I2O(-1)) + 1]; ! ! for (int iGo = 0 ; iGo < sizeof(fail_options)/sizeof(fail_options[0]) ; iGo++) ! fail_options[iGo] = 0; ! DWORD repeats = 0; *************** *** 134,157 **** do { ! HubMsg msg; ! msg.type = HUB_MSG_TYPE_GET_IN_OPTS; ! msg.u.pv.pVal = &fail_options; ! msg.u.pv.val = DWORD(-1); ! if (!OnFakeRead(*i, &msg)) ! return FALSE; } while (repeats--); ! if (fail_options) { ! cerr << (*i)->Name() << " WARNING: Requested option(s) 0x" ! << hex << fail_options << dec << " not supported" << endl; ! } - { HubMsg msg; msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = fail_options; if (!OnFakeRead(*i, &msg)) --- 141,168 ---- do { ! for (int iGo = 0 ; iGo < sizeof(fail_options)/sizeof(fail_options[0]) ; iGo++) { ! HubMsg msg; ! msg.type = HUB_MSG_TYPE_GET_IN_OPTS; ! msg.u.pv.pVal = &fail_options[iGo]; ! msg.u.pv.val = ~GO_I2O(-1) | GO_I2O(iGo); ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! } } while (repeats--); ! for (int iGo = 0 ; iGo < sizeof(fail_options)/sizeof(fail_options[0]) ; iGo++) { ! _ASSERTE((fail_options[iGo] & GO_I2O(-1)) == 0); ! ! if (fail_options[iGo]) { ! cerr << (*i)->Name() << " WARNING: Requested option(s) GO" << iGo << "_0x" ! << hex << fail_options << dec << " not supported" << endl; ! } HubMsg msg; msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = (fail_options[iGo] & ~GO_I2O(-1)) | GO_I2O(iGo); if (!OnFakeRead(*i, &msg)) |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:59
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/escparse Modified Files: filter.cpp Log Message: Extended the number of possible IN options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escparse/filter.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** filter.cpp 25 Nov 2008 16:40:40 -0000 1.8 --- filter.cpp 18 Dec 2008 16:50:51 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2008/12/18 16:50:51 vfrolov + * Extended the number of possible IN options + * * Revision 1.8 2008/11/25 16:40:40 vfrolov * Added assert for port handle *************** *** 109,120 **** void OptionsDel(DWORD opts) { _options &= ~opts; ! maskMst = GO_O2V_MODEM_STATUS(_options); ! maskLsr = GO_O2V_LINE_STATUS(_options); } void OptionsAdd(DWORD opts) { _options |= opts; ! maskMst = GO_O2V_MODEM_STATUS(_options); ! maskLsr = GO_O2V_LINE_STATUS(_options); } --- 112,123 ---- void OptionsDel(DWORD opts) { _options &= ~opts; ! maskMst = GO1_O2V_MODEM_STATUS(_options); ! maskLsr = GO1_O2V_LINE_STATUS(_options); } void OptionsAdd(DWORD opts) { _options |= opts; ! maskMst = GO1_O2V_MODEM_STATUS(_options); ! maskLsr = GO1_O2V_LINE_STATUS(_options); } *************** *** 197,201 **** } case 2: ! if (Options() & GO_BREAK_STATUS) { pMsg = Flush(pMsg); if (!pMsg) --- 200,204 ---- } case 2: ! if (Options() & GO1_BREAK_STATUS) { pMsg = Flush(pMsg); if (!pMsg) *************** *** 254,258 **** subState++; } else { ! if (Options() & GO_RBR_STATUS) { pMsg = Flush(pMsg); if (!pMsg) --- 257,261 ---- subState++; } else { ! if (Options() & GO1_RBR_STATUS) { pMsg = Flush(pMsg); if (!pMsg) *************** *** 279,283 **** subState++; } else { ! if (Options() & GO_RLC_STATUS) { pMsg = Flush(pMsg); if (!pMsg) --- 282,286 ---- subState++; } else { ! if (Options() & GO1_RLC_STATUS) { pMsg = Flush(pMsg); if (!pMsg) *************** *** 345,353 **** escapeChar(0xFF), acceptableOptions( ! GO_RBR_STATUS | ! GO_RLC_STATUS | ! GO_BREAK_STATUS | ! GO_V2O_MODEM_STATUS(-1) | ! GO_V2O_LINE_STATUS(-1)), pName(NULL) { --- 348,356 ---- escapeChar(0xFF), acceptableOptions( ! GO1_RBR_STATUS | ! GO1_RLC_STATUS | ! GO1_BREAK_STATUS | ! GO1_V2O_MODEM_STATUS(-1) | ! GO1_V2O_LINE_STATUS(-1)), pName(NULL) { *************** *** 494,528 **** break; case HUB_MSG_TYPE_GET_IN_OPTS: { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! if (!pEscParse) ! return FALSE; ! // if the subsequent filters require interceptable options then ! // accept the received options and request the escape mode ! pEscParse->OptionsAdd((pEscParse->intercepted_options & ((Filter *)hFilter)->acceptableOptions)); ! if (((Filter *)hFilter)->requestEscMode) { ! if (pEscParse->Options() && (pInMsg->u.pv.val & GO_ESCAPE_MODE)) { pEscParse->escMode = TRUE; - *pInMsg->u.pv.pVal |= GO_ESCAPE_MODE; // request the escape mode } ! } else { ! pEscParse->escMode = TRUE; } ! // get interceptable options from subsequent filters separately ! DWORD interceptable_options = (pInMsg->u.pv.val & (GO_ESCAPE_MODE | ((Filter *)hFilter)->acceptableOptions)); ! pInMsg->u.pv.val &= ~interceptable_options; ! pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); - if (pInMsg) { pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; pInMsg->u.pv.pVal = &pEscParse->intercepted_options; ! pInMsg->u.pv.val = interceptable_options; } --- 497,548 ---- break; case HUB_MSG_TYPE_GET_IN_OPTS: { ! int iGo = GO_O2I(pInMsg->u.pv.val); ! if (iGo == 0) { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! if (!pEscParse) ! return FALSE; ! // if the subsequent filters require interceptable options then ! // accept the received options and request the escape mode ! pEscParse->OptionsAdd((pEscParse->intercepted_options & ((Filter *)hFilter)->acceptableOptions)); ! ! if (((Filter *)hFilter)->requestEscMode) { ! if (pEscParse->Options() && (pInMsg->u.pv.val & GO0_ESCAPE_MODE)) { ! pEscParse->escMode = TRUE; ! *pInMsg->u.pv.pVal |= GO0_ESCAPE_MODE; // request the escape mode ! } ! } else { pEscParse->escMode = TRUE; } ! ! // the subsequent filters can't request the escape mode ! ! pInMsg->u.pv.val &= ~GO0_ESCAPE_MODE; } + else + if (iGo == 1) { + EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! if (!pEscParse) ! return FALSE; ! // get interceptable options from subsequent filters separately ! DWORD interceptable_options = (pInMsg->u.pv.val & ((Filter *)hFilter)->acceptableOptions); ! pInMsg->u.pv.val &= ~interceptable_options; ! ! pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); ! ! if (!pInMsg) ! return FALSE; pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; pInMsg->u.pv.pVal = &pEscParse->intercepted_options; ! _ASSERTE((interceptable_options & GO_I2O(-1)) == 0); ! pInMsg->u.pv.val = interceptable_options | GO_I2O(iGo); } *************** *** 535,539 **** return FALSE; ! *pInMsg->u.pv.pVal = ESC_OPTS_MAP_GO2EO(pEscParse->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); --- 555,559 ---- return FALSE; ! *pInMsg->u.pv.pVal = ESC_OPTS_MAP_GO1_2_EO(pEscParse->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); *************** *** 550,554 **** return FALSE; ! DWORD fail_options = (pInMsg->u.pv.val & ESC_OPTS_MAP_GO2EO(pEscParse->Options())); if (fail_options) { --- 570,574 ---- return FALSE; ! DWORD fail_options = (pInMsg->u.pv.val & ESC_OPTS_MAP_GO1_2_EO(pEscParse->Options())); if (fail_options) { *************** *** 558,563 **** << " not accepted (will try non escape mode option(s))" << endl; ! pEscParse->OptionsDel(ESC_OPTS_MAP_EO2GO(fail_options)); ! *pInMsg->u.pv.pVal |= ESC_OPTS_MAP_EO2GO(fail_options); } --- 578,583 ---- << " not accepted (will try non escape mode option(s))" << endl; ! pEscParse->OptionsDel(ESC_OPTS_MAP_EO_2_GO1(fail_options)); ! *pInMsg->u.pv.pVal |= ESC_OPTS_MAP_EO_2_GO1(fail_options); } *************** *** 569,572 **** --- 589,595 ---- } case HUB_MSG_TYPE_FAIL_IN_OPTS: { + if (GO_O2I(pInMsg->u.pv.val) != 0) + break; + EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); *************** *** 574,578 **** return FALSE; ! if ((pInMsg->u.val & GO_ESCAPE_MODE) && ((Filter *)hFilter)->requestEscMode) { cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() --- 597,601 ---- return FALSE; ! if ((pInMsg->u.val & GO0_ESCAPE_MODE) && ((Filter *)hFilter)->requestEscMode) { cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() *************** *** 583,587 **** } ! pInMsg->u.val &= ~GO_ESCAPE_MODE; // hide from subsequent filters break; --- 606,610 ---- } ! pInMsg->u.val &= ~GO0_ESCAPE_MODE; // hide from subsequent filters break; *************** *** 609,613 **** // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO_O2V_MODEM_STATUS(pEscParse->Options())); break; } --- 632,636 ---- // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO1_O2V_MODEM_STATUS(pEscParse->Options())); break; } *************** *** 619,623 **** // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO_O2V_LINE_STATUS(pEscParse->Options())); break; } --- 642,646 ---- // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO1_O2V_LINE_STATUS(pEscParse->Options())); break; } *************** *** 628,632 **** return FALSE; ! if (pEscParse->Options() & GO_RBR_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) --- 651,655 ---- return FALSE; ! if (pEscParse->Options() & GO1_RBR_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) *************** *** 641,645 **** return FALSE; ! if (pEscParse->Options() & GO_RLC_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) --- 664,668 ---- return FALSE; ! if (pEscParse->Options() & GO1_RLC_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) *************** *** 654,658 **** return FALSE; ! if (pEscParse->Options() & GO_BREAK_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) --- 677,681 ---- return FALSE; ! if (pEscParse->Options() & GO1_BREAK_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:59
|
Update of /cvsroot/com0com/hub4com/plugins/purge In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/purge Modified Files: filter.cpp Log Message: Extended the number of possible IN options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/purge/filter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filter.cpp 11 Dec 2008 13:16:59 -0000 1.1 --- filter.cpp 18 Dec 2008 16:50:52 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.1 2008/12/11 13:16:59 vfrolov * Initial revision *************** *** 70,74 **** Filter::Filter(int argc, const char *const argv[]) : soOutMask(SO_PURGE_TX), ! goInMask(GO_PURGE_TX_IN), pName(NULL) { --- 73,77 ---- Filter::Filter(int argc, const char *const argv[]) : soOutMask(SO_PURGE_TX), ! goInMask(GO1_PURGE_TX_IN), pName(NULL) { *************** *** 169,172 **** --- 172,178 ---- _ASSERTE(pOutMsg->u.pv.pVal != NULL); + if (GO_O2I(pOutMsg->u.pv.val) != 1) + break; + // or'e with the required mask to purge *pOutMsg->u.pv.pVal |= (((Filter *)hFilter)->goInMask & pOutMsg->u.pv.val); *************** *** 174,177 **** --- 180,186 ---- } case HUB_MSG_TYPE_FAIL_IN_OPTS: { + if (GO_O2I(pOutMsg->u.pv.val) != 1) + break; + DWORD fail_options = (pOutMsg->u.val & ((Filter *)hFilter)->goInMask); *************** *** 180,184 **** << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) ! << " option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; } --- 189,193 ---- << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) ! << " option(s) GO1_0x" << hex << fail_options << dec << " not accepted" << endl; } *************** *** 193,197 **** break; case HUB_MSG_TYPE_PURGE_TX_IN: ! if ((((Filter *)hFilter)->goInMask & GO_PURGE_TX_IN) == 0) break; --- 202,206 ---- break; case HUB_MSG_TYPE_PURGE_TX_IN: ! if ((((Filter *)hFilter)->goInMask & GO1_PURGE_TX_IN) == 0) break; |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:59
|
Update of /cvsroot/com0com/hub4com/plugins/linectl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/linectl Modified Files: filter.cpp Log Message: Extended the number of possible IN options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/filter.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** filter.cpp 25 Nov 2008 16:40:40 -0000 1.8 --- filter.cpp 18 Dec 2008 16:50:51 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2008/12/18 16:50:51 vfrolov + * Extended the number of possible IN options + * * Revision 1.8 2008/11/25 16:40:40 vfrolov * Added assert for port handle *************** *** 83,87 **** DWORD soOutMask; ! DWORD goInMask; private: --- 86,90 ---- DWORD soOutMask; ! DWORD goInMask[2]; private: *************** *** 93,99 **** Filter::Filter(int argc, const char *const argv[]) : soOutMask(0), - goInMask(0), pName(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); --- 96,103 ---- Filter::Filter(int argc, const char *const argv[]) : soOutMask(0), pName(NULL) { + goInMask[0] = goInMask[1] = 0; + for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); *************** *** 123,130 **** switch (tolower(*pParam)) { case 'l': ! goInMask |= GO_LBR_STATUS; break; case 'r': ! goInMask |= GO_RBR_STATUS; break; default: --- 127,134 ---- switch (tolower(*pParam)) { case 'l': ! goInMask[0] |= GO0_LBR_STATUS; break; case 'r': ! goInMask[1] |= GO1_RBR_STATUS; break; default: *************** *** 139,146 **** switch (tolower(*pParam)) { case 'l': ! goInMask |= GO_LLC_STATUS; break; case 'r': ! goInMask |= GO_RLC_STATUS; break; default: --- 143,150 ---- switch (tolower(*pParam)) { case 'l': ! goInMask[0] |= GO0_LLC_STATUS; break; case 'r': ! goInMask[1] |= GO1_RLC_STATUS; break; default: *************** *** 249,258 **** _ASSERTE(pOutMsg->u.pv.pVal != NULL); // or'e with the required mask to get baudrate and line control ! *pOutMsg->u.pv.pVal |= (((Filter *)hFilter)->goInMask & pOutMsg->u.pv.val); break; } case HUB_MSG_TYPE_FAIL_IN_OPTS: { ! DWORD fail_options = (pOutMsg->u.val & ((Filter *)hFilter)->goInMask); if (fail_options) { --- 253,272 ---- _ASSERTE(pOutMsg->u.pv.pVal != NULL); + int iGo = GO_O2I(pOutMsg->u.pv.val); + + if (iGo != 0 && iGo != 1) + break; + // or'e with the required mask to get baudrate and line control ! *pOutMsg->u.pv.pVal |= (((Filter *)hFilter)->goInMask[iGo == 0 ? 0 : 1] & pOutMsg->u.pv.val); break; } case HUB_MSG_TYPE_FAIL_IN_OPTS: { ! int iGo = GO_O2I(pOutMsg->u.pv.val); ! ! if (iGo != 0 && iGo != 1) ! break; ! ! DWORD fail_options = (pOutMsg->u.val & ((Filter *)hFilter)->goInMask[iGo == 0 ? 0 : 1]); if (fail_options) { *************** *** 260,264 **** << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) ! << " option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; } --- 274,278 ---- << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) ! << " option(s) GO" << iGo << "_0x" << hex << fail_options << dec << " not accepted" << endl; } *************** *** 280,284 **** break; case HUB_MSG_TYPE_LBR_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_LBR_STATUS) == 0) break; --- 294,298 ---- break; case HUB_MSG_TYPE_LBR_STATUS: ! if ((((Filter *)hFilter)->goInMask[0] & GO0_LBR_STATUS) == 0) break; *************** *** 289,293 **** break; case HUB_MSG_TYPE_RBR_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_RBR_STATUS) == 0) break; --- 303,307 ---- break; case HUB_MSG_TYPE_RBR_STATUS: ! if ((((Filter *)hFilter)->goInMask[1] & GO1_RBR_STATUS) == 0) break; *************** *** 298,302 **** break; case HUB_MSG_TYPE_LLC_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_LLC_STATUS) == 0) break; --- 312,316 ---- break; case HUB_MSG_TYPE_LLC_STATUS: ! if ((((Filter *)hFilter)->goInMask[0] & GO0_LLC_STATUS) == 0) break; *************** *** 307,311 **** break; case HUB_MSG_TYPE_RLC_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_RLC_STATUS) == 0) break; --- 321,325 ---- break; case HUB_MSG_TYPE_RLC_STATUS: ! if ((((Filter *)hFilter)->goInMask[1] & GO1_RLC_STATUS) == 0) break; |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:59
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/serial Modified Files: comio.cpp comport.cpp comport.h Log Message: Extended the number of possible IN options Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** comport.cpp 17 Dec 2008 11:52:35 -0000 1.22 --- comport.cpp 18 Dec 2008 16:50:52 -0000 1.23 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.23 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.22 2008/12/17 11:52:35 vfrolov * Replaced ComIo::dcb by serialBaudRate, serialLineControl, *************** *** 128,131 **** --- 131,279 ---- #include "import.h" /////////////////////////////////////////////////////////////// + struct FIELD2NAME { + DWORD field; + DWORD mask; + const char *name; + }; + #define TOFIELD2NAME2(p, s) { (ULONG)p##s, (ULONG)p##s, #s } + + static BOOL PrintFields( + ostream &tout, + const FIELD2NAME *pTable, + DWORD fields, + BOOL delimitNext = FALSE, + const char *pUnknownPrefix = "", + const char *pDelimiter = "|") + { + if (pTable) { + while (pTable->name) { + DWORD field = (fields & pTable->mask); + + if (field == pTable->field) { + fields &= ~pTable->mask; + if (delimitNext) + tout << pDelimiter; + else + delimitNext = TRUE; + + tout << pTable->name; + } + pTable++; + } + } + + if (fields) { + if (delimitNext) + tout << pDelimiter; + else + delimitNext = TRUE; + + tout << pUnknownPrefix << "0x" << hex << fields << dec; + } + + return delimitNext; + } + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableModemStatus[] = { + TOFIELD2NAME2(MODEM_STATUS_, DCTS), + TOFIELD2NAME2(MODEM_STATUS_, DDSR), + TOFIELD2NAME2(MODEM_STATUS_, TERI), + TOFIELD2NAME2(MODEM_STATUS_, DDCD), + TOFIELD2NAME2(MODEM_STATUS_, CTS), + TOFIELD2NAME2(MODEM_STATUS_, DSR), + TOFIELD2NAME2(MODEM_STATUS_, RI), + TOFIELD2NAME2(MODEM_STATUS_, DCD), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableLineStatus[] = { + TOFIELD2NAME2(LINE_STATUS_, DR), + TOFIELD2NAME2(LINE_STATUS_, OE), + TOFIELD2NAME2(LINE_STATUS_, PE), + TOFIELD2NAME2(LINE_STATUS_, FE), + TOFIELD2NAME2(LINE_STATUS_, BI), + TOFIELD2NAME2(LINE_STATUS_, THRE), + TOFIELD2NAME2(LINE_STATUS_, TEMT), + TOFIELD2NAME2(LINE_STATUS_, FIFOERR), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableGo0Options[] = { + TOFIELD2NAME2(GO0_, LBR_STATUS), + TOFIELD2NAME2(GO0_, LLC_STATUS), + TOFIELD2NAME2(GO0_, ESCAPE_MODE), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableGo1Options[] = { + TOFIELD2NAME2(GO1_, RBR_STATUS), + TOFIELD2NAME2(GO1_, RLC_STATUS), + TOFIELD2NAME2(GO1_, BREAK_STATUS), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableComEvents[] = { + TOFIELD2NAME2(EV_, CTS), + TOFIELD2NAME2(EV_, DSR), + TOFIELD2NAME2(EV_, RLSD), + TOFIELD2NAME2(EV_, RING), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableCommErrors[] = { + TOFIELD2NAME2(CE_, RXOVER), + TOFIELD2NAME2(CE_, OVERRUN), + TOFIELD2NAME2(CE_, RXPARITY), + TOFIELD2NAME2(CE_, FRAME), + TOFIELD2NAME2(CE_, BREAK), + TOFIELD2NAME2(CE_, TXFULL), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static BOOL PrintGoOptions( + ostream &tout, + DWORD fields, + BOOL delimitNext = FALSE) + { + int iGo = GO_O2I(fields); + + fields &= ~GO_I2O(-1); + + const FIELD2NAME *pTable; + + switch (iGo) { + case 0: + pTable = fieldNameTableGo0Options; + break; + case 1: + delimitNext = PrintFields(tout, fieldNameTableModemStatus, GO1_O2V_MODEM_STATUS(fields), delimitNext, "MST_"); + delimitNext = PrintFields(tout, fieldNameTableLineStatus, GO1_O2V_LINE_STATUS(fields), delimitNext, "LSR_"); + fields &= ~(GO1_V2O_MODEM_STATUS(-1) | GO1_V2O_LINE_STATUS(-1)); + pTable = fieldNameTableGo1Options; + break; + default: + pTable = NULL; + } + + stringstream buf; + + buf << "GO" << iGo << "_"; + + delimitNext = PrintFields(tout, pTable, fields, delimitNext, buf.str().c_str()); + + return delimitNext; + } + /////////////////////////////////////////////////////////////// + static BOOL PrintEscOptions( + ostream &tout, + DWORD fields, + BOOL delimitNext = FALSE) + { + PrintGoOptions(tout, ESC_OPTS_MAP_EO_2_GO1(fields) | GO_I2O(1), delimitNext); + PrintFields(tout, NULL, fields & ~ESC_OPTS_MAP_GO1_2_EO(-1), delimitNext); + + return delimitNext; + } + /////////////////////////////////////////////////////////////// ComPort::ComPort( const ComParams &comParams, *************** *** 135,140 **** countWaitCommEventOverlapped(0), countXoff(0), - intercepted_options(0), - inOptions(0), outOptions(0), writeQueueLimit(comParams.WriteQueueLimit()), --- 283,286 ---- *************** *** 147,150 **** --- 293,301 ---- lenWriteBuf(0) { + for (int iO = 0 ; iO < 2 ; iO++) { + intercepted_options[iO] = 0; + inOptions[iO] = 0; + } + writeQueueLimitSendXoff = (writeQueueLimit*2)/3; writeQueueLimitSendXon = writeQueueLimit/3; *************** *** 188,303 **** } - struct FIELD2NAME { - DWORD code; - DWORD mask; - const char *name; - }; - - static string FieldToName(const FIELD2NAME *pTable, DWORD mask, const char *pDelimiter = "|") - { - stringstream str; - int count = 0; - - if (pTable) { - while (pTable->name) { - DWORD m = (mask & pTable->mask); - - if (m == pTable->code) { - mask &= ~pTable->mask; - if (count) - str << pDelimiter; - str << pTable->name; - count++; - } - pTable++; - } - } - - if (mask) { - if (count) - str << pDelimiter; - str << "0x" << hex << (long)mask << dec; - } - - return str.str(); - } - - #define TOFIELD2NAME2(p, s) { (ULONG)p##s, (ULONG)p##s, #s } - - static FIELD2NAME codeNameTableModemStatus[] = { - TOFIELD2NAME2(MODEM_STATUS_, DCTS), - TOFIELD2NAME2(MODEM_STATUS_, DDSR), - TOFIELD2NAME2(MODEM_STATUS_, TERI), - TOFIELD2NAME2(MODEM_STATUS_, DDCD), - TOFIELD2NAME2(MODEM_STATUS_, CTS), - TOFIELD2NAME2(MODEM_STATUS_, DSR), - TOFIELD2NAME2(MODEM_STATUS_, RI), - TOFIELD2NAME2(MODEM_STATUS_, DCD), - {0, 0, NULL} - }; - - static FIELD2NAME codeNameTableLineStatus[] = { - TOFIELD2NAME2(LINE_STATUS_, DR), - TOFIELD2NAME2(LINE_STATUS_, OE), - TOFIELD2NAME2(LINE_STATUS_, PE), - TOFIELD2NAME2(LINE_STATUS_, FE), - TOFIELD2NAME2(LINE_STATUS_, BI), - TOFIELD2NAME2(LINE_STATUS_, THRE), - TOFIELD2NAME2(LINE_STATUS_, TEMT), - TOFIELD2NAME2(LINE_STATUS_, FIFOERR), - {0, 0, NULL} - }; - - static FIELD2NAME codeNameTableGoOptions[] = { - TOFIELD2NAME2(GO_, RBR_STATUS), - TOFIELD2NAME2(GO_, RLC_STATUS), - TOFIELD2NAME2(GO_, LBR_STATUS), - TOFIELD2NAME2(GO_, LLC_STATUS), - TOFIELD2NAME2(GO_, BREAK_STATUS), - TOFIELD2NAME2(GO_, ESCAPE_MODE), - {0, 0, NULL} - }; - - static void WarnIgnoredInOptions( - const char *pHead, - const char *pTail, - DWORD goOptions, - DWORD otherOptions) - { - if (GO_O2V_MODEM_STATUS(goOptions)) { - cerr << pHead << " WARNING: Changing of MODEM STATUS bit(s) [" - << FieldToName(codeNameTableModemStatus, GO_O2V_MODEM_STATUS(goOptions)) - << "] will be ignored by driver" << pTail << endl; - } - - if (GO_O2V_LINE_STATUS(goOptions)) { - cerr << pHead << " WARNING: Changing of LINE STATUS bit(s) [" - << FieldToName(codeNameTableLineStatus, GO_O2V_LINE_STATUS(goOptions)) - << "] will be ignored by driver" << pTail << endl; - } - - goOptions &= ~(GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); - - if (goOptions) { - cerr << pHead << " WARNING: Requested input option(s) [" - << FieldToName(codeNameTableGoOptions, goOptions) - << "] will be ignored by driver" << pTail << endl; - } - - if (otherOptions) { - cerr << pHead << " WARNING: Requested input option(s) [0x" - << hex << otherOptions << dec - << "] will be ignored by driver" << pTail << endl; - } - } - - static FIELD2NAME codeNameTableComEvents[] = { - TOFIELD2NAME2(EV_, CTS), - TOFIELD2NAME2(EV_, DSR), - TOFIELD2NAME2(EV_, RLSD), - TOFIELD2NAME2(EV_, RING), - {0, 0, NULL} - }; - BOOL ComPort::Start() { --- 339,342 ---- *************** *** 311,315 **** HUB_MSG msg; ! if (intercepted_options & GO_ESCAPE_MODE) { DWORD escapeOptions = 0; --- 350,354 ---- HUB_MSG msg; ! if (intercepted_options[0] & GO0_ESCAPE_MODE) { DWORD escapeOptions = 0; *************** *** 322,335 **** if (escapeOptions & ~ESC_OPTS_V2O_ESCCHAR(-1)) { ! WarnIgnoredInOptions(name.c_str(), " (requested for escape mode)", ! ESC_OPTS_MAP_EO2GO(escapeOptions), ! escapeOptions & ~(ESC_OPTS_MAP_GO2EO(-1) | ESC_OPTS_V2O_ESCCHAR(-1))); } if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { ! inOptions |= GO_ESCAPE_MODE; msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.pv.pVal = &intercepted_options; msg.u.pv.val = escapeOptions; pOnRead(hMasterPort, &msg); --- 361,374 ---- if (escapeOptions & ~ESC_OPTS_V2O_ESCCHAR(-1)) { ! cerr << name.c_str() << " WARNING: Requested for escape mode input option(s) ["; ! PrintEscOptions(cerr, escapeOptions & ~ESC_OPTS_V2O_ESCCHAR(-1)); ! cerr << "] will be ignored by driver" << endl; } if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { ! inOptions[0] |= GO0_ESCAPE_MODE; msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.pv.pVal = &intercepted_options[1]; msg.u.pv.val = escapeOptions; pOnRead(hMasterPort, &msg); *************** *** 337,360 **** } ! inOptions |= (intercepted_options & ( ! GO_RBR_STATUS | ! GO_RLC_STATUS | ! GO_LBR_STATUS | ! GO_LLC_STATUS | ! MODEM_STATUS_CTS | ! MODEM_STATUS_DSR | ! MODEM_STATUS_DCD | ! MODEM_STATUS_RI)); ! DWORD fail_options = (intercepted_options & ~inOptions); ! if (fail_options) ! WarnIgnoredInOptions(name.c_str(), "", fail_options, 0); ! msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = fail_options; ! pOnRead(hMasterPort, &msg); ! if (inOptions & GO_V2O_MODEM_STATUS( MODEM_STATUS_CTS | MODEM_STATUS_DSR | --- 376,412 ---- } ! for (int iO = 0 ; iO < 2 ; iO++) { ! inOptions[iO] |= ( ! intercepted_options[iO] & ( ! iO == 0 ? ( ! GO0_LBR_STATUS|GO0_LLC_STATUS ! ) : ( ! GO1_RBR_STATUS|GO1_RLC_STATUS | ! GO1_V2O_MODEM_STATUS( ! MODEM_STATUS_CTS | ! MODEM_STATUS_DSR | ! MODEM_STATUS_DCD | ! MODEM_STATUS_RI ! ) ! ) ! ) ! ); ! DWORD fail_options = (intercepted_options[iO] & ~inOptions[iO]); ! _ASSERTE((fail_options & GO_I2O(-1)) == 0); ! if (fail_options) { ! cerr << name.c_str() << " WARNING: Requested input option(s) ["; ! PrintGoOptions(cerr, fail_options | GO_I2O(iO == 0 ? 0 : 1)); ! cerr << "] will be ignored by driver" << endl; ! } ! msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = fail_options | GO_I2O(iO == 0 ? 0 : 1); ! pOnRead(hMasterPort, &msg); ! } ! ! if (inOptions[1] & GO1_V2O_MODEM_STATUS( MODEM_STATUS_CTS | MODEM_STATUS_DSR | *************** *** 364,377 **** DWORD events = 0; ! if (inOptions & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) events |= EV_CTS; ! if (inOptions & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) events |= EV_DSR; ! if (inOptions & GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)) events |= EV_RLSD; ! if (inOptions & GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)) events |= EV_RING; --- 416,429 ---- DWORD events = 0; ! if (inOptions[1] & GO1_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) events |= EV_CTS; ! if (inOptions[1] & GO1_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) events |= EV_DSR; ! if (inOptions[1] & GO1_V2O_MODEM_STATUS(MODEM_STATUS_DCD)) events |= EV_RLSD; ! if (inOptions[1] & GO1_V2O_MODEM_STATUS(MODEM_STATUS_RI)) events |= EV_RING; *************** *** 381,387 **** } ! cout << name << " Event(s) 0x" << hex << events << dec << " [" ! << FieldToName(codeNameTableComEvents, events) ! << "] will be monitired" << endl; } --- 433,439 ---- } ! cout << name << " Event(s) 0x" << hex << events << dec << " ["; ! PrintFields(cout, fieldNameTableComEvents, events); ! cout << "] will be monitired" << endl; } *************** *** 395,399 **** pOnRead(hMasterPort, &msg); ! if (inOptions & GO_LBR_STATUS) { msg.type = HUB_MSG_TYPE_LBR_STATUS; msg.u.val = pComIo->BaudRate(); --- 447,451 ---- pOnRead(hMasterPort, &msg); ! if (inOptions[0] & GO0_LBR_STATUS) { msg.type = HUB_MSG_TYPE_LBR_STATUS; msg.u.val = pComIo->BaudRate(); *************** *** 401,405 **** } ! if (inOptions & GO_LLC_STATUS) { msg.type = HUB_MSG_TYPE_LLC_STATUS; msg.u.val = pComIo->LineControl(); --- 453,457 ---- } ! if (inOptions[0] & GO0_LLC_STATUS) { msg.type = HUB_MSG_TYPE_LLC_STATUS; msg.u.val = pComIo->LineControl(); *************** *** 407,411 **** } ! if (inOptions & GO_RBR_STATUS) { cerr << name << " WARNING: Suppose remote baud rate is equal local settings" << endl; --- 459,463 ---- } ! if (inOptions[1] & GO1_RBR_STATUS) { cerr << name << " WARNING: Suppose remote baud rate is equal local settings" << endl; *************** *** 415,419 **** } ! if (inOptions & GO_RLC_STATUS) { cerr << name << " WARNING: Suppose remote byte size, parity and stop bits are equal local settings" << endl; --- 467,471 ---- } ! if (inOptions[1] & GO1_RLC_STATUS) { cerr << name << " WARNING: Suppose remote byte size, parity and stop bits are equal local settings" << endl; *************** *** 466,490 **** _ASSERTE(pInMsg != NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_IN_OPTS) { ! // get interceptable options from subsequent filters separately ! DWORD interceptable_options = (pInMsg->u.pv.val & ! GO_ESCAPE_MODE | ! GO_RBR_STATUS | ! GO_RLC_STATUS | ! GO_LBR_STATUS | ! GO_LLC_STATUS | ! GO_BREAK_STATUS | ! GO_V2O_MODEM_STATUS(-1) | ! GO_V2O_LINE_STATUS(-1)); ! pInMsg->u.pv.val &= ~interceptable_options; ! pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); ! if (pInMsg) { ! pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &intercepted_options; ! pInMsg->u.pv.val = interceptable_options; } } --- 518,552 ---- _ASSERTE(pInMsg != NULL); ! switch (pInMsg->type) { ! case HUB_MSG_TYPE_GET_IN_OPTS: { ! int iGo = GO_O2I(pInMsg->u.pv.val); ! if (iGo != 0 && iGo != 1) ! break; ! // get interceptable options from subsequent filters separately ! DWORD interceptable_options = ( ! pInMsg->u.pv.val & ( ! iGo == 0 ? ( ! GO0_ESCAPE_MODE|GO0_LBR_STATUS|GO0_LLC_STATUS ! ) : ( ! GO1_RBR_STATUS|GO1_RLC_STATUS|GO1_BREAK_STATUS | ! GO1_V2O_MODEM_STATUS(-1) | ! GO1_V2O_LINE_STATUS(-1) ! ) ! ) ! ); ! pInMsg->u.pv.val &= ~interceptable_options; ! ! pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); ! ! if (pInMsg) { ! pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &intercepted_options[iGo == 0 ? 0 : 1]; ! _ASSERTE((interceptable_options & GO_I2O(-1)) == 0); ! pInMsg->u.pv.val = interceptable_options | GO_I2O(iGo); ! } } } *************** *** 642,646 **** if (oldVal != curVal) { ! if (inOptions & GO_LBR_STATUS) { HUB_MSG msg; --- 704,708 ---- if (oldVal != curVal) { ! if (inOptions[0] & GO0_LBR_STATUS) { HUB_MSG msg; *************** *** 650,654 **** } ! if (inOptions & GO_RBR_STATUS) { HUB_MSG msg; --- 712,716 ---- } ! if (inOptions[1] & GO1_RBR_STATUS) { HUB_MSG msg; *************** *** 702,706 **** curVal &= ~(VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS); ! if (inOptions & GO_LLC_STATUS) { HUB_MSG msg; --- 764,768 ---- curVal &= ~(VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS); ! if (inOptions[0] & GO0_LLC_STATUS) { HUB_MSG msg; *************** *** 710,714 **** } ! if (inOptions & GO_RLC_STATUS) { HUB_MSG msg; --- 772,776 ---- } ! if (inOptions[1] & GO1_RLC_STATUS) { HUB_MSG msg; *************** *** 812,822 **** countWaitCommEventOverlapped++; - /* - cout << name << " Started WaitCommEvent " << countReadOverlapped - << " " << hex << events << dec << " [" - << FieldToName(codeNameTableComEvents, events) - << "] << endl; - */ - return TRUE; } --- 874,877 ---- *************** *** 878,886 **** //cout << name << " OnCommEvent " << ::GetCurrentThreadId() << endl; ! /* ! cout << name << " Event(s): 0x" << hex << eMask << dec << " [" ! << FieldToName(codeNameTableComEvents, eMask) ! << "]" << endl; ! */ CheckComEvents(eMask); --- 933,939 ---- //cout << name << " OnCommEvent " << ::GetCurrentThreadId() << endl; ! //cout << name << " Event(s): 0x" << hex << eMask << dec << " ["; ! //PrintFields(cout, fieldNameTableComEvents, eMask); ! //cout << "]" << endl; CheckComEvents(eMask); *************** *** 896,900 **** void ComPort::CheckComEvents(DWORD eMask) { ! if (GO_O2V_MODEM_STATUS(inOptions) && (eMask & (EV_CTS|EV_DSR|EV_RLSD|EV_RING)) != 0) { DWORD stat; --- 949,953 ---- void ComPort::CheckComEvents(DWORD eMask) { ! if (GO1_O2V_MODEM_STATUS(inOptions[1]) && (eMask & (EV_CTS|EV_DSR|EV_RLSD|EV_RING)) != 0) { DWORD stat; *************** *** 903,907 **** msg.type = HUB_MSG_TYPE_MODEM_STATUS; ! msg.u.val = ((DWORD)(BYTE)stat | VAL2MASK(GO_O2V_MODEM_STATUS(inOptions))); pOnRead(hMasterPort, &msg); --- 956,960 ---- msg.type = HUB_MSG_TYPE_MODEM_STATUS; ! msg.u.val = ((DWORD)(BYTE)stat | VAL2MASK(GO1_O2V_MODEM_STATUS(inOptions[1]))); pOnRead(hMasterPort, &msg); *************** *** 917,930 **** } - static FIELD2NAME codeNameTableCommErrors[] = { - TOFIELD2NAME2(CE_, RXOVER), - TOFIELD2NAME2(CE_, OVERRUN), - TOFIELD2NAME2(CE_, RXPARITY), - TOFIELD2NAME2(CE_, FRAME), - TOFIELD2NAME2(CE_, BREAK), - TOFIELD2NAME2(CE_, TXFULL), - {0, 0, NULL} - }; - void ComPort::LostReport() { --- 970,973 ---- *************** *** 940,944 **** if (errors) { ! cout << "Error " << name << ": " << FieldToName(codeNameTableCommErrors, errors, " "); errors = 0; --- 983,988 ---- if (errors) { ! cout << "Error " << name << ": "; ! PrintFields(cout, fieldNameTableCommErrors, errors, FALSE, "", " "); errors = 0; Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** comport.h 17 Dec 2008 11:52:35 -0000 1.16 --- comport.h 18 Dec 2008 16:50:52 -0000 1.17 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.17 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.16 2008/12/17 11:52:35 vfrolov * Replaced ComIo::dcb by serialBaudRate, serialLineControl, *************** *** 140,145 **** int countXoff; ! DWORD intercepted_options; ! DWORD inOptions; DWORD outOptions; --- 143,148 ---- int countXoff; ! DWORD intercepted_options[2]; ! DWORD inOptions[2]; DWORD outOptions; Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** comio.cpp 17 Dec 2008 11:52:35 -0000 1.14 --- comio.cpp 18 Dec 2008 16:50:52 -0000 1.15 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.15 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.14 2008/12/17 11:52:35 vfrolov * Replaced ComIo::dcb by serialBaudRate, serialLineControl, *************** *** 632,648 **** #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_V2O_MODEM_STATUS(MODEM_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_BREAK_STATUS)) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_V2O_LINE_STATUS(LINE_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_LSR; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_RBR_STATUS)) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_RLC_STATUS)) opts |= C0CE_INSERT_ENABLE_RLC; --- 635,651 ---- #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! if (escOptions & ESC_OPTS_MAP_GO1_2_EO(GO1_V2O_MODEM_STATUS(MODEM_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_MAP_GO1_2_EO(GO1_BREAK_STATUS)) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_MAP_GO1_2_EO(GO1_V2O_LINE_STATUS(LINE_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_LSR; ! if (escOptions & ESC_OPTS_MAP_GO1_2_EO(GO1_RBR_STATUS)) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_MAP_GO1_2_EO(GO1_RLC_STATUS)) opts |= C0CE_INSERT_ENABLE_RLC; *************** *** 713,729 **** if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_V2O_MODEM_STATUS(MODEM_STATUS_BITS)); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_BREAK_STATUS); if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_V2O_LINE_STATUS(LINE_STATUS_BITS)); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_RBR_STATUS); if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_RLC_STATUS); return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); --- 716,732 ---- if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_MAP_GO1_2_EO(GO1_V2O_MODEM_STATUS(MODEM_STATUS_BITS)); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_MAP_GO1_2_EO(GO1_BREAK_STATUS); if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_MAP_GO1_2_EO(GO1_V2O_LINE_STATUS(LINE_STATUS_BITS)); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_MAP_GO1_2_EO(GO1_RBR_STATUS); if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_MAP_GO1_2_EO(GO1_RLC_STATUS); return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:58
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/pin2con Modified Files: filter.cpp Log Message: Extended the number of possible IN options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** filter.cpp 25 Nov 2008 16:40:40 -0000 1.13 --- filter.cpp 18 Dec 2008 16:50:52 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.13 2008/11/25 16:40:40 vfrolov * Added assert for port handle *************** *** 129,141 **** DWORD val; } pin_names[] = { ! {"cts", GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)}, ! {"dsr", GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)}, ! {"dcd", GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, ! {"ring", GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, ! {"break", GO_BREAK_STATUS}, }; Filter::Filter(int argc, const char *const argv[]) ! : pin(GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)), negative(FALSE), pName(NULL) --- 132,144 ---- DWORD val; } pin_names[] = { ! {"cts", GO1_V2O_MODEM_STATUS(MODEM_STATUS_CTS)}, ! {"dsr", GO1_V2O_MODEM_STATUS(MODEM_STATUS_DSR)}, ! {"dcd", GO1_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, ! {"ring", GO1_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, ! {"break", GO1_BREAK_STATUS}, }; Filter::Filter(int argc, const char *const argv[]) ! : pin(GO1_V2O_MODEM_STATUS(MODEM_STATUS_DSR)), negative(FALSE), pName(NULL) *************** *** 298,305 **** --- 301,315 ---- case HUB_MSG_TYPE_GET_IN_OPTS: _ASSERTE(pInMsg->u.pv.pVal != NULL); + + if (GO_O2I(pInMsg->u.pv.val) != 1) + break; + // or'e with the required mask to get line status and modem status *pInMsg->u.pv.pVal |= (((Filter *)hFilter)->pin & pInMsg->u.pv.val); break; case HUB_MSG_TYPE_FAIL_IN_OPTS: { + if (GO_O2I(pInMsg->u.pv.val) != 1) + break; + DWORD fail_options = (pInMsg->u.val & ((Filter *)hFilter)->pin); *************** *** 307,311 **** cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() ! << " option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; } --- 317,321 ---- cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() ! << " option(s) GO1_0x" << hex << fail_options << dec << " not accepted" << endl; } *************** *** 320,324 **** WORD pin; ! pin = GO_O2V_MODEM_STATUS(((Filter *)hFilter)->pin); if ((pin & MASK2VAL(pInMsg->u.val)) == 0) --- 330,334 ---- WORD pin; ! pin = GO1_O2V_MODEM_STATUS(((Filter *)hFilter)->pin); if ((pin & MASK2VAL(pInMsg->u.val)) == 0) *************** *** 330,334 **** } case HUB_MSG_TYPE_BREAK_STATUS: ! if (((Filter *)hFilter)->pin & GO_BREAK_STATUS) pInMsg = InsertConnectState(*((Filter *)hFilter), hFromPort, pInMsg, pInMsg->u.val != 0); break; --- 340,344 ---- } case HUB_MSG_TYPE_BREAK_STATUS: ! if (((Filter *)hFilter)->pin & GO1_BREAK_STATUS) pInMsg = InsertConnectState(*((Filter *)hFilter), hFromPort, pInMsg, pInMsg->u.val != 0); break; |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:58
|
Update of /cvsroot/com0com/hub4com/plugins/trace In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/trace Modified Files: filter.cpp Log Message: Extended the number of possible IN options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/trace/filter.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** filter.cpp 11 Dec 2008 13:10:23 -0000 1.13 --- filter.cpp 18 Dec 2008 16:50:52 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.13 2008/12/11 13:10:23 vfrolov * Added PURGE_TX *************** *** 489,499 **** }; /////////////////////////////////////////////////////////////// ! static const FIELD2NAME fieldNameTableGoOptions[] = { ! TOFIELD2NAME2(GO_, RBR_STATUS), ! TOFIELD2NAME2(GO_, RLC_STATUS), ! TOFIELD2NAME2(GO_, LBR_STATUS), ! TOFIELD2NAME2(GO_, LLC_STATUS), ! TOFIELD2NAME2(GO_, BREAK_STATUS), ! TOFIELD2NAME2(GO_, ESCAPE_MODE), {0, 0, NULL} }; --- 492,506 ---- }; /////////////////////////////////////////////////////////////// ! static const FIELD2NAME fieldNameTableGo0Options[] = { ! TOFIELD2NAME2(GO0_, LBR_STATUS), ! TOFIELD2NAME2(GO0_, LLC_STATUS), ! TOFIELD2NAME2(GO0_, ESCAPE_MODE), ! {0, 0, NULL} ! }; ! /////////////////////////////////////////////////////////////// ! static const FIELD2NAME fieldNameTableGo1Options[] = { ! TOFIELD2NAME2(GO1_, RBR_STATUS), ! TOFIELD2NAME2(GO1_, RLC_STATUS), ! TOFIELD2NAME2(GO1_, BREAK_STATUS), {0, 0, NULL} }; *************** *** 521,530 **** ostream &tout, DWORD fields, ! BOOL delimitNext = FALSE, ! const char *pUnknownPrefix = "") { ! delimitNext = PrintFields(tout, fieldNameTableModemStatus, GO_O2V_MODEM_STATUS(fields), delimitNext, "MST_"); ! delimitNext = PrintFields(tout, fieldNameTableLineStatus, GO_O2V_LINE_STATUS(fields), delimitNext, "LSR_"); ! delimitNext = PrintFields(tout, fieldNameTableGoOptions, fields & ~(GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)), delimitNext, pUnknownPrefix); return delimitNext; --- 528,558 ---- ostream &tout, DWORD fields, ! BOOL delimitNext = FALSE) { ! int iGo = GO_O2I(fields); ! ! fields &= ~GO_I2O(-1); ! ! const FIELD2NAME *pTable; ! ! switch (iGo) { ! case 0: ! pTable = fieldNameTableGo0Options; ! break; ! case 1: ! delimitNext = PrintFields(tout, fieldNameTableModemStatus, GO1_O2V_MODEM_STATUS(fields), delimitNext, "MST_"); ! delimitNext = PrintFields(tout, fieldNameTableLineStatus, GO1_O2V_LINE_STATUS(fields), delimitNext, "LSR_"); ! fields &= ~(GO1_V2O_MODEM_STATUS(-1) | GO1_V2O_LINE_STATUS(-1)); ! pTable = fieldNameTableGo1Options; ! break; ! default: ! pTable = NULL; ! } ! ! stringstream buf; ! ! buf << "GO" << iGo << "_"; ! ! delimitNext = PrintFields(tout, pTable, fields, delimitNext, buf.str().c_str()); return delimitNext; *************** *** 536,541 **** BOOL delimitNext = FALSE) { ! PrintGoOptions(tout, ESC_OPTS_MAP_EO2GO(fields), delimitNext, "GO_"); ! PrintFields(tout, NULL, fields & ~ESC_OPTS_MAP_GO2EO(-1), delimitNext); return delimitNext; --- 564,569 ---- BOOL delimitNext = FALSE) { ! PrintGoOptions(tout, ESC_OPTS_MAP_EO_2_GO1(fields) | GO_I2O(1), delimitNext); ! PrintFields(tout, NULL, fields & ~ESC_OPTS_MAP_GO1_2_EO(-1), delimitNext); return delimitNext; *************** *** 679,683 **** case HUB_MSG_TYPE_GET_IN_OPTS: { tout << hex << "&" << pMsg->u.pv.pVal << "[" << dec; ! PrintGoOptions(tout, *pMsg->u.pv.pVal); tout << "] ["; PrintGoOptions(tout, pMsg->u.pv.val); --- 707,711 ---- case HUB_MSG_TYPE_GET_IN_OPTS: { tout << hex << "&" << pMsg->u.pv.pVal << "[" << dec; ! PrintGoOptions(tout, (*pMsg->u.pv.pVal & ~(GO_I2O(-1))) | (pMsg->u.pv.val & GO_I2O(-1))); tout << "] ["; PrintGoOptions(tout, pMsg->u.pv.val); *************** *** 700,704 **** case HUB_MSG_TYPE_FAIL_ESC_OPTS: { tout << hex << "&" << pMsg->u.pv.pVal << "[" << dec; ! PrintGoOptions(tout, *pMsg->u.pv.pVal); tout << "] ["; PrintEscOptions(tout, pMsg->u.pv.val & ~ESC_OPTS_V2O_ESCCHAR(-1)); --- 728,732 ---- case HUB_MSG_TYPE_FAIL_ESC_OPTS: { tout << hex << "&" << pMsg->u.pv.pVal << "[" << dec; ! PrintGoOptions(tout, (*pMsg->u.pv.pVal & ~(GO_I2O(-1))) | GO_I2O(1)); tout << "] ["; PrintEscOptions(tout, pMsg->u.pv.val & ~ESC_OPTS_V2O_ESCCHAR(-1)); |
From: Vyacheslav F. <vf...@us...> - 2008-12-18 16:50:58
|
Update of /cvsroot/com0com/hub4com/plugins/lsrmap In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5084/plugins/lsrmap Modified Files: filter.cpp Log Message: Extended the number of possible IN options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/lsrmap/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 25 Nov 2008 16:40:40 -0000 1.4 --- filter.cpp 18 Dec 2008 16:50:52 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/12/18 16:50:52 vfrolov + * Extended the number of possible IN options + * * Revision 1.4 2008/11/25 16:40:40 vfrolov * Added assert for port handle *************** *** 175,184 **** _ASSERTE(pOutMsg->u.pv.pVal != NULL); // or'e with the required mask to get line status ! *pOutMsg->u.pv.pVal |= (GO_V2O_LINE_STATUS(((Filter *)hFilter)->lsrMask) & pOutMsg->u.pv.val); break; } case HUB_MSG_TYPE_FAIL_IN_OPTS: { ! DWORD fail_options = (pOutMsg->u.val & GO_V2O_LINE_STATUS(((Filter *)hFilter)->lsrMask)); if (fail_options) { --- 178,193 ---- _ASSERTE(pOutMsg->u.pv.pVal != NULL); + if (GO_O2I(pOutMsg->u.pv.val) != 1) + break; + // or'e with the required mask to get line status ! *pOutMsg->u.pv.pVal |= (GO1_V2O_LINE_STATUS(((Filter *)hFilter)->lsrMask) & pOutMsg->u.pv.val); break; } case HUB_MSG_TYPE_FAIL_IN_OPTS: { ! if (GO_O2I(pOutMsg->u.pv.val) != 1) ! break; ! ! DWORD fail_options = (pOutMsg->u.val & GO1_V2O_LINE_STATUS(((Filter *)hFilter)->lsrMask)); if (fail_options) { *************** *** 186,190 **** << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) ! << " option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; } --- 195,199 ---- << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) ! << " option(s) GO1_0x" << hex << fail_options << dec << " not accepted" << endl; } |
From: Vyacheslav F. <vf...@us...> - 2008-12-17 12:16:41
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26794 Modified Files: comio.cpp comio.h comport.cpp comport.h Log Message: Replaced ComIo::dcb by serialBaudRate, serialLineControl, serialHandFlow and serialChars Replaced ComPort::filterX by ComIo::FilterX() Replaced SetManual*() by PinStateControlMask() Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** comport.cpp 11 Dec 2008 13:07:54 -0000 1.21 --- comport.cpp 17 Dec 2008 11:52:35 -0000 1.22 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.22 2008/12/17 11:52:35 vfrolov + * Replaced ComIo::dcb by serialBaudRate, serialLineControl, + * serialHandFlow and serialChars + * Replaced ComPort::filterX by ComIo::FilterX() + * Replaced SetManual*() by PinStateControlMask() + * * Revision 1.21 2008/12/11 13:07:54 vfrolov * Added PURGE_TX *************** *** 129,133 **** countWaitCommEventOverlapped(0), countXoff(0), - filterX(FALSE), intercepted_options(0), inOptions(0), --- 135,138 ---- *************** *** 145,149 **** writeQueueLimitSendXon = writeQueueLimit/3; - filterX = comParams.InX(); string path(pPath); name = path.substr(path.rfind('\\') + 1); --- 150,153 ---- *************** *** 393,397 **** if (inOptions & GO_LBR_STATUS) { msg.type = HUB_MSG_TYPE_LBR_STATUS; ! msg.u.val = pComIo->GetBaudRate(); pOnRead(hMasterPort, &msg); } --- 397,401 ---- if (inOptions & GO_LBR_STATUS) { msg.type = HUB_MSG_TYPE_LBR_STATUS; ! msg.u.val = pComIo->BaudRate(); pOnRead(hMasterPort, &msg); } *************** *** 399,403 **** if (inOptions & GO_LLC_STATUS) { msg.type = HUB_MSG_TYPE_LLC_STATUS; ! msg.u.val = pComIo->GetLineControl(); pOnRead(hMasterPort, &msg); } --- 403,407 ---- if (inOptions & GO_LLC_STATUS) { msg.type = HUB_MSG_TYPE_LLC_STATUS; ! msg.u.val = pComIo->LineControl(); pOnRead(hMasterPort, &msg); } *************** *** 407,411 **** msg.type = HUB_MSG_TYPE_RBR_STATUS; ! msg.u.val = pComIo->GetBaudRate(); pOnRead(hMasterPort, &msg); } --- 411,415 ---- msg.type = HUB_MSG_TYPE_RBR_STATUS; ! msg.u.val = pComIo->BaudRate(); pOnRead(hMasterPort, &msg); } *************** *** 415,419 **** msg.type = HUB_MSG_TYPE_RLC_STATUS; ! msg.u.val = pComIo->GetLineControl(); pOnRead(hMasterPort, &msg); } --- 419,423 ---- msg.type = HUB_MSG_TYPE_RLC_STATUS; ! msg.u.val = pComIo->LineControl(); pOnRead(hMasterPort, &msg); } *************** *** 553,565 **** } ! if (filterX) { BYTE *pSrc = pBuf; BYTE *pDst = pBuf; for (DWORD i = 0 ; i < len ; i++) { ! if (*pSrc == 0x11 || *pSrc == 0x13) pSrc++; ! else *pDst++ = *pSrc++; } --- 557,579 ---- } ! if (!pComIo) { ! writeLost += len; ! return FALSE; ! } ! ! BYTE xOn; ! BYTE xOff; ! ! if (pComIo->FilterX(xOn, xOff)) { BYTE *pSrc = pBuf; BYTE *pDst = pBuf; for (DWORD i = 0 ; i < len ; i++) { ! if (*pSrc == xOn || *pSrc == xOff) { pSrc++; ! writeLost++; ! } else { *pDst++ = *pSrc++; + } } *************** *** 570,578 **** return TRUE; - if (!pComIo) { - writeLost += len; - return FALSE; - } - if (writeQueued > writeQueueLimit) PurgeWrite(TRUE); --- 584,587 ---- *************** *** 608,621 **** } case HUB_MSG_TYPE_SET_PIN_STATE: if (!pComIo) return FALSE; ! pComIo->SetPinState((WORD)pMsg->u.val, MASK2VAL(pMsg->u.val) & SO_O2V_PIN_STATE(outOptions)); break; case HUB_MSG_TYPE_SET_BR: { if (!pComIo) return FALSE; ! DWORD oldVal = pComIo->GetBaudRate(); DWORD curVal = pComIo->SetBaudRate(pMsg->u.val); --- 617,634 ---- } case HUB_MSG_TYPE_SET_PIN_STATE: + _ASSERTE((~SO_O2V_PIN_STATE(outOptions) & MASK2VAL(pMsg->u.val)) == 0); + if (!pComIo) return FALSE; ! pComIo->SetPinState((WORD)pMsg->u.val, MASK2VAL(pMsg->u.val)); break; case HUB_MSG_TYPE_SET_BR: { + _ASSERTE(outOptions & SO_SET_BR); + if (!pComIo) return FALSE; ! DWORD oldVal = pComIo->BaudRate(); DWORD curVal = pComIo->SetBaudRate(pMsg->u.val); *************** *** 648,655 **** } case HUB_MSG_TYPE_SET_LC: { if (!pComIo) return FALSE; ! DWORD oldVal = pComIo->GetLineControl(); DWORD curVal = pComIo->SetLineControl(pMsg->u.val); --- 661,670 ---- } case HUB_MSG_TYPE_SET_LC: { + _ASSERTE(outOptions & SO_SET_LC); + if (!pComIo) return FALSE; ! DWORD oldVal = pComIo->LineControl(); DWORD curVal = pComIo->SetLineControl(pMsg->u.val); *************** *** 706,709 **** --- 721,726 ---- } case HUB_MSG_TYPE_PURGE_TX: + _ASSERTE(outOptions & SO_PURGE_TX); + if (!pComIo) return FALSE; *************** *** 712,716 **** FlowControlUpdate(); break; ! case HUB_MSG_TYPE_SET_OUT_OPTS: if (!pComIo) return FALSE; --- 729,733 ---- FlowControlUpdate(); break; ! case HUB_MSG_TYPE_SET_OUT_OPTS: { if (!pComIo) return FALSE; *************** *** 718,723 **** pMsg->u.val &= ~outOptions; if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_RTS)) { ! if (pComIo->SetManualRtsControl()) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_RTS); else --- 735,742 ---- pMsg->u.val &= ~outOptions; + WORD controlMask = pComIo->PinStateControlMask(); + if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_RTS)) { ! if (controlMask & PIN_STATE_RTS) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_RTS); else *************** *** 725,729 **** } if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_DTR)) { ! if (pComIo->SetManualDtrControl()) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_DTR); else --- 744,748 ---- } if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_DTR)) { ! if (controlMask & PIN_STATE_DTR) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_DTR); else *************** *** 731,735 **** } if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_OUT1)) { ! if (pComIo->SetManualOut1Control()) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_OUT1); else --- 750,754 ---- } if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_OUT1)) { ! if (controlMask & PIN_STATE_OUT1) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_OUT1); else *************** *** 737,741 **** } if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_OUT2)) { ! if (pComIo->SetManualOut2Control()) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_OUT2); else --- 756,760 ---- } if (pMsg->u.val & SO_V2O_PIN_STATE(PIN_STATE_OUT2)) { ! if (controlMask & PIN_STATE_OUT2) outOptions |= SO_V2O_PIN_STATE(PIN_STATE_OUT2); else *************** *** 757,760 **** --- 776,780 ---- } break; + } case HUB_MSG_TYPE_ADD_XOFF_XON: if (pMsg->u.val) { Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** comport.h 11 Dec 2008 13:07:54 -0000 1.15 --- comport.h 17 Dec 2008 11:52:35 -0000 1.16 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.16 2008/12/17 11:52:35 vfrolov + * Replaced ComIo::dcb by serialBaudRate, serialLineControl, + * serialHandFlow and serialChars + * Replaced ComPort::filterX by ComIo::FilterX() + * Replaced SetManual*() by PinStateControlMask() + * * Revision 1.15 2008/12/11 13:07:54 vfrolov * Added PURGE_TX *************** *** 133,137 **** int countWaitCommEventOverlapped; int countXoff; - BOOL filterX; DWORD intercepted_options; --- 139,142 ---- Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** comio.h 1 Dec 2008 17:06:29 -0000 1.10 --- comio.h 17 Dec 2008 11:52:35 -0000 1.11 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.11 2008/12/17 11:52:35 vfrolov + * Replaced ComIo::dcb by serialBaudRate, serialLineControl, + * serialHandFlow and serialChars + * Replaced ComPort::filterX by ComIo::FilterX() + * Replaced SetManual*() by PinStateControlMask() + * * Revision 1.10 2008/12/01 17:06:29 vfrolov * Improved write buffering *************** *** 82,85 **** --- 88,172 ---- class ComParams; /////////////////////////////////////////////////////////////// + struct SERIAL_BAUD_RATE { + ULONG BaudRate; + }; + /////////////////////////////////////////////////////////////// + struct SERIAL_LINE_CONTROL { + UCHAR StopBits; + UCHAR Parity; + UCHAR WordLength; + }; + /////////////////////////////////////////////////////////////// + struct SERIAL_HANDFLOW { + ULONG ControlHandShake; + + #define SERIAL_DTR_MASK ((ULONG)0x03) + #define SERIAL_DTR_CONTROL ((ULONG)0x01) + #define SERIAL_DTR_HANDSHAKE ((ULONG)0x02) + + #define SERIAL_CTS_HANDSHAKE ((ULONG)0x08) + #define SERIAL_DSR_HANDSHAKE ((ULONG)0x10) + #define SERIAL_DCD_HANDSHAKE ((ULONG)0x20) + #define SERIAL_DSR_SENSITIVITY ((ULONG)0x40) + #define SERIAL_ERROR_ABORT ((ULONG)0x80000000) + + ULONG FlowReplace; + + #define SERIAL_AUTO_TRANSMIT ((ULONG)0x01) + #define SERIAL_AUTO_RECEIVE ((ULONG)0x02) + #define SERIAL_ERROR_CHAR ((ULONG)0x04) + #define SERIAL_NULL_STRIPPING ((ULONG)0x08) + #define SERIAL_BREAK_CHAR ((ULONG)0x10) + + #define SERIAL_RTS_MASK ((ULONG)0xc0) + #define SERIAL_RTS_CONTROL ((ULONG)0x40) + #define SERIAL_RTS_HANDSHAKE ((ULONG)0x80) + #define SERIAL_TRANSMIT_TOGGLE ((ULONG)0xc0) + + #define SERIAL_XOFF_CONTINUE ((ULONG)0x80000000) + + LONG XonLimit; + LONG XoffLimit; + }; + + inline BOOL IsManualDtr(const SERIAL_HANDFLOW &serialHandFlow) + { + ULONG val = serialHandFlow.ControlHandShake & SERIAL_DTR_MASK; + + return (val == 0 || val == SERIAL_DTR_CONTROL); + } + + inline void SetHandFlowDtr(SERIAL_HANDFLOW &serialHandFlow, ULONG val) + { + _ASSERTE((val & ~SERIAL_DTR_MASK) == 0); + + serialHandFlow.ControlHandShake &= ~SERIAL_DTR_MASK; + serialHandFlow.ControlHandShake |= val; + } + + inline BOOL IsManualRts(const SERIAL_HANDFLOW &serialHandFlow) + { + ULONG val = serialHandFlow.FlowReplace & SERIAL_RTS_MASK; + + return (val == 0 || val == SERIAL_RTS_CONTROL); + } + + inline void SetHandFlowRts(SERIAL_HANDFLOW &serialHandFlow, ULONG val) + { + _ASSERTE((val & ~SERIAL_RTS_MASK) == 0); + + serialHandFlow.FlowReplace &= ~SERIAL_RTS_MASK; + serialHandFlow.FlowReplace |= val; + } + /////////////////////////////////////////////////////////////// + struct SERIAL_CHARS { + UCHAR EofChar; + UCHAR ErrorChar; + UCHAR BreakChar; + UCHAR EventChar; + UCHAR XonChar; + UCHAR XoffChar; + }; + /////////////////////////////////////////////////////////////// class ComIo { *************** *** 91,98 **** void Close(); ! BOOL SetManualRtsControl(); ! BOOL SetManualDtrControl(); ! BOOL SetManualOut1Control() { return hasExtendedModemControl; } ! BOOL SetManualOut2Control() { return hasExtendedModemControl; } BOOL SetComEvents(DWORD *pEvents); void SetPinState(WORD value, WORD mask); --- 178,197 ---- void Close(); ! WORD PinStateControlMask() const { ! return PIN_STATE_RTS| ! PIN_STATE_DTR| ! (hasExtendedModemControl ? PIN_STATE_OUT1|PIN_STATE_OUT2 : 0); ! } ! ! BOOL FilterX(BYTE &xOn, BYTE &xOff) const { ! if ((serialHandFlow.FlowReplace & SERIAL_AUTO_RECEIVE) == 0) ! return FALSE; ! ! xOn = serialChars.XonChar; ! xOff = serialChars.XoffChar; ! ! return TRUE; ! } ! BOOL SetComEvents(DWORD *pEvents); void SetPinState(WORD value, WORD mask); *************** *** 103,113 **** HANDLE Handle() const { return handle; } ! DWORD GetBaudRate() const { return dcb.BaudRate; } ! DWORD GetLineControl() const { ! return (VAL2LC_BYTESIZE(dcb.ByteSize) |LC_MASK_BYTESIZE ! |VAL2LC_PARITY(dcb.Parity) |LC_MASK_PARITY ! |VAL2LC_STOPBITS(dcb.StopBits) |LC_MASK_STOPBITS); } --- 202,212 ---- HANDLE Handle() const { return handle; } ! DWORD BaudRate() const { return serialBaudRate.BaudRate; } ! DWORD LineControl() const { ! return (VAL2LC_BYTESIZE(serialLineControl.WordLength) |LC_MASK_BYTESIZE ! |VAL2LC_PARITY(serialLineControl.Parity) |LC_MASK_PARITY ! |VAL2LC_STOPBITS(serialLineControl.StopBits) |LC_MASK_STOPBITS); } *************** *** 119,123 **** HANDLE handle; BOOL hasExtendedModemControl; ! DCB dcb; }; /////////////////////////////////////////////////////////////// --- 218,225 ---- HANDLE handle; BOOL hasExtendedModemControl; ! SERIAL_BAUD_RATE serialBaudRate; ! SERIAL_LINE_CONTROL serialLineControl; ! SERIAL_HANDFLOW serialHandFlow; ! SERIAL_CHARS serialChars; }; /////////////////////////////////////////////////////////////// Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** comio.cpp 1 Dec 2008 17:06:29 -0000 1.13 --- comio.cpp 17 Dec 2008 11:52:35 -0000 1.14 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.14 2008/12/17 11:52:35 vfrolov + * Replaced ComIo::dcb by serialBaudRate, serialLineControl, + * serialHandFlow and serialChars + * Replaced ComPort::filterX by ComIo::FilterX() + * Replaced SetManual*() by PinStateControlMask() + * * Revision 1.13 2008/12/01 17:06:29 vfrolov * Improved write buffering *************** *** 230,233 **** --- 236,279 ---- } /////////////////////////////////////////////////////////////// + #define IOCTL_SERIAL_GET_HANDFLOW CTL_CODE(FILE_DEVICE_SERIAL_PORT,24,METHOD_BUFFERED,FILE_ANY_ACCESS) + #define IOCTL_SERIAL_SET_HANDFLOW CTL_CODE(FILE_DEVICE_SERIAL_PORT,25,METHOD_BUFFERED,FILE_ANY_ACCESS) + + static BOOL GetHandFlow(HANDLE handle, SERIAL_HANDFLOW &serialHandFlow) + { + DWORD returned; + + if (!DeviceIoControl(handle, + IOCTL_SERIAL_GET_HANDFLOW, + NULL, 0, + &serialHandFlow, sizeof(serialHandFlow), &returned, + NULL)) + { + TraceError(GetLastError(), "IOCTL_SERIAL_GET_HANDFLOW"); + return FALSE; + } + + return TRUE; + } + + static void SetHandFlow(HANDLE handle, SERIAL_HANDFLOW &serialHandFlow) + { + DWORD returned; + + if (!DeviceIoControl(handle, + IOCTL_SERIAL_SET_HANDFLOW, + &serialHandFlow, sizeof(serialHandFlow), + NULL, 0, &returned, + NULL)) + { + TraceError(GetLastError(), "IOCTL_SERIAL_SET_HANDFLOW"); + } + + GetHandFlow(handle, serialHandFlow); + } + /////////////////////////////////////////////////////////////// + static BOOL GetChars(HANDLE handle, SERIAL_CHARS &serialChars); + static BOOL GetBaudRate(HANDLE handle, SERIAL_BAUD_RATE &serialBaudRate); + static BOOL GetLineControl(HANDLE handle, SERIAL_LINE_CONTROL &serialLineControl); + BOOL ComIo::Open(const char *pPath, const ComParams &comParams) { *************** *** 246,249 **** --- 292,297 ---- } + DCB dcb; + if (!myGetCommState(handle, &dcb)) { Close(); *************** *** 286,290 **** dcb.fErrorChar = FALSE; ! if (!mySetCommState(handle, &dcb)) { Close(); return FALSE; --- 334,343 ---- dcb.fErrorChar = FALSE; ! if (!mySetCommState(handle, &dcb) || ! !GetBaudRate(handle, serialBaudRate) || ! !GetLineControl(handle, serialLineControl) || ! !GetChars(handle, serialChars) || ! !GetHandFlow(handle, serialHandFlow)) ! { Close(); return FALSE; *************** *** 318,330 **** cout << "Open(" ! << "\"" << pPath << "\", baud=" << ComParams::BaudRateStr(dcb.BaudRate) ! << ", data=" << ComParams::ByteSizeStr(dcb.ByteSize) ! << ", parity=" << ComParams::ParityStr(dcb.Parity) ! << ", stop=" << ComParams::StopBitsStr(dcb.StopBits) ! << ", octs=" << ComParams::OutCtsStr(dcb.fOutxCtsFlow) ! << ", odsr=" << ComParams::OutDsrStr(dcb.fOutxDsrFlow) ! << ", ox=" << ComParams::OutXStr(dcb.fOutX) ! << ", ix=" << ComParams::InXStr(dcb.fInX) ! << ", idsr=" << ComParams::InDsrStr(dcb.fDsrSensitivity) << ", ito=" << ComParams::IntervalTimeoutStr(timeouts.ReadIntervalTimeout) << ") - OK" << endl; --- 371,383 ---- cout << "Open(" ! << "\"" << pPath << "\", baud=" << ComParams::BaudRateStr(serialBaudRate.BaudRate) ! << ", data=" << ComParams::ByteSizeStr(serialLineControl.WordLength) ! << ", parity=" << ComParams::ParityStr(serialLineControl.Parity) ! << ", stop=" << ComParams::StopBitsStr(serialLineControl.StopBits) ! << ", octs=" << ComParams::OutCtsStr((serialHandFlow.ControlHandShake & SERIAL_CTS_HANDSHAKE) != 0) ! << ", odsr=" << ComParams::OutDsrStr((serialHandFlow.ControlHandShake & SERIAL_DSR_HANDSHAKE) != 0) ! << ", ox=" << ComParams::OutXStr((serialHandFlow.FlowReplace & SERIAL_AUTO_TRANSMIT) != 0) ! << ", ix=" << ComParams::InXStr((serialHandFlow.FlowReplace & SERIAL_AUTO_RECEIVE) != 0) ! << ", idsr=" << ComParams::InDsrStr((serialHandFlow.ControlHandShake & SERIAL_DSR_SENSITIVITY) != 0) << ", ito=" << ComParams::IntervalTimeoutStr(timeouts.ReadIntervalTimeout) << ") - OK" << endl; *************** *** 343,368 **** } /////////////////////////////////////////////////////////////// - BOOL ComIo::SetManualRtsControl() - { - if (dcb.fRtsControl == RTS_CONTROL_DISABLE) - return TRUE; - - dcb.fRtsControl = RTS_CONTROL_DISABLE; - mySetCommState(handle, &dcb); - - return (dcb.fRtsControl == RTS_CONTROL_DISABLE); - } - /////////////////////////////////////////////////////////////// - BOOL ComIo::SetManualDtrControl() - { - if (dcb.fDtrControl == DTR_CONTROL_DISABLE) - return TRUE; - - dcb.fDtrControl = DTR_CONTROL_DISABLE; - mySetCommState(handle, &dcb); - - return (dcb.fDtrControl == DTR_CONTROL_DISABLE); - } - /////////////////////////////////////////////////////////////// BOOL ComIo::SetComEvents(DWORD *pEvents) { --- 396,399 ---- *************** *** 378,400 **** void ComIo::SetPinState(WORD value, WORD mask) { if (mask & SPS_V2P_MCR(-1)) { if (hasExtendedModemControl) { ! if (!SetModemControl(handle, SPS_P2V_MCR(value), SPS_P2V_MCR(mask))) cerr << port.Name() << " WARNING: can't change MCR state" << endl; } else { _ASSERTE((mask & SPS_V2P_MCR(-1) & ~(PIN_STATE_RTS|PIN_STATE_DTR)) == 0); if (mask & PIN_STATE_RTS) { ! if (!CommFunction(handle, (value & PIN_STATE_RTS) ? SETRTS : CLRRTS)) cerr << port.Name() << " WARNING: can't change RTS state" << endl; } if (mask & PIN_STATE_DTR) { ! if (!CommFunction(handle, (value & PIN_STATE_DTR) ? SETDTR : CLRDTR)) cerr << port.Name() << " WARNING: can't change DTR state" << endl; } } - } ! _ASSERTE((mask & ~SPS_V2P_MCR(-1) & ~(PIN_STATE_BREAK)) == 0); if (mask & PIN_STATE_BREAK) { --- 409,455 ---- void ComIo::SetPinState(WORD value, WORD mask) { + if (((mask & PIN_STATE_RTS) != 0 && !IsManualRts(serialHandFlow)) || + ((mask & PIN_STATE_DTR) != 0 && !IsManualDtr(serialHandFlow))) + { + if (mask & PIN_STATE_RTS) + SetHandFlowRts(serialHandFlow, (value & PIN_STATE_RTS) ? SERIAL_RTS_CONTROL : 0); + + if (mask & PIN_STATE_DTR) + SetHandFlowDtr(serialHandFlow, (value & PIN_STATE_DTR) ? SERIAL_DTR_CONTROL : 0); + + SetHandFlow(handle, serialHandFlow); + + mask &= ~(PIN_STATE_RTS|PIN_STATE_DTR); + } + if (mask & SPS_V2P_MCR(-1)) { if (hasExtendedModemControl) { ! if (!SetModemControl(handle, SPS_P2V_MCR(value), SPS_P2V_MCR(mask))) { cerr << port.Name() << " WARNING: can't change MCR state" << endl; + mask &= ~SPS_V2P_MCR(-1); + } } else { _ASSERTE((mask & SPS_V2P_MCR(-1) & ~(PIN_STATE_RTS|PIN_STATE_DTR)) == 0); if (mask & PIN_STATE_RTS) { ! if (!CommFunction(handle, (value & PIN_STATE_RTS) ? SETRTS : CLRRTS)) { cerr << port.Name() << " WARNING: can't change RTS state" << endl; + mask &= ~PIN_STATE_RTS; + } } if (mask & PIN_STATE_DTR) { ! if (!CommFunction(handle, (value & PIN_STATE_DTR) ? SETDTR : CLRDTR)) { cerr << port.Name() << " WARNING: can't change DTR state" << endl; + mask &= ~PIN_STATE_DTR; + } } } ! if (mask & PIN_STATE_RTS) ! SetHandFlowRts(serialHandFlow, (value & PIN_STATE_RTS) ? SERIAL_RTS_CONTROL : 0); ! ! if (mask & PIN_STATE_DTR) ! SetHandFlowDtr(serialHandFlow, (value & PIN_STATE_DTR) ? SERIAL_DTR_CONTROL : 0); ! } if (mask & PIN_STATE_BREAK) { *************** *** 404,427 **** } /////////////////////////////////////////////////////////////// #define IOCTL_SERIAL_SET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 1,METHOD_BUFFERED,FILE_ANY_ACCESS) #define IOCTL_SERIAL_GET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT,20,METHOD_BUFFERED,FILE_ANY_ACCESS) ! struct SERIAL_BAUD_RATE { ! ULONG BaudRate; ! }; DWORD ComIo::SetBaudRate(DWORD baudRate) { ! if (GetBaudRate() == baudRate) return baudRate; DWORD returned; ! SERIAL_BAUD_RATE serialBaudRate; ! serialBaudRate.BaudRate = baudRate; if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_BAUD_RATE, ! &serialBaudRate, sizeof(serialBaudRate), NULL, 0, &returned, NULL)) --- 459,514 ---- } /////////////////////////////////////////////////////////////// + #define IOCTL_SERIAL_GET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,22,METHOD_BUFFERED,FILE_ANY_ACCESS) + + static BOOL GetChars(HANDLE handle, SERIAL_CHARS &serialChars) + { + DWORD returned; + + if (!DeviceIoControl(handle, + IOCTL_SERIAL_GET_CHARS, + NULL, 0, + &serialChars, sizeof(serialChars), &returned, + NULL)) + { + TraceError(GetLastError(), "IOCTL_SERIAL_GET_CHARS"); + return FALSE; + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// #define IOCTL_SERIAL_SET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 1,METHOD_BUFFERED,FILE_ANY_ACCESS) #define IOCTL_SERIAL_GET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT,20,METHOD_BUFFERED,FILE_ANY_ACCESS) ! static BOOL GetBaudRate(HANDLE handle, SERIAL_BAUD_RATE &serialBaudRate) ! { ! DWORD returned; ! ! if (!DeviceIoControl(handle, ! IOCTL_SERIAL_GET_BAUD_RATE, ! NULL, 0, ! &serialBaudRate, sizeof(serialBaudRate), &returned, ! NULL)) ! { ! TraceError(GetLastError(), "IOCTL_SERIAL_GET_BAUD_RATE"); ! return FALSE; ! } ! ! return TRUE; ! } DWORD ComIo::SetBaudRate(DWORD baudRate) { ! if (BaudRate() == baudRate) return baudRate; DWORD returned; ! SERIAL_BAUD_RATE newSerialBaudRate; ! newSerialBaudRate.BaudRate = baudRate; if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_BAUD_RATE, ! &newSerialBaudRate, sizeof(newSerialBaudRate), NULL, 0, &returned, NULL)) *************** *** 430,455 **** } if (!DeviceIoControl(handle, ! IOCTL_SERIAL_GET_BAUD_RATE, NULL, 0, ! &serialBaudRate, sizeof(serialBaudRate), &returned, NULL)) { ! TraceError(GetLastError(), "IOCTL_SERIAL_GET_BAUD_RATE"); ! } else { ! dcb.BaudRate = serialBaudRate.BaudRate; } ! return GetBaudRate(); } - /////////////////////////////////////////////////////////////// - #define IOCTL_SERIAL_SET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT, 3,METHOD_BUFFERED,FILE_ANY_ACCESS) - #define IOCTL_SERIAL_GET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,21,METHOD_BUFFERED,FILE_ANY_ACCESS) - - struct SERIAL_LINE_CONTROL { - UCHAR StopBits; - UCHAR Parity; - UCHAR WordLength; - }; DWORD ComIo::SetLineControl(DWORD lineControl) --- 517,545 ---- } + if (GetBaudRate(handle, newSerialBaudRate)) + serialBaudRate = newSerialBaudRate; + + return BaudRate(); + } + /////////////////////////////////////////////////////////////// + #define IOCTL_SERIAL_SET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT, 3,METHOD_BUFFERED,FILE_ANY_ACCESS) + #define IOCTL_SERIAL_GET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,21,METHOD_BUFFERED,FILE_ANY_ACCESS) + + static BOOL GetLineControl(HANDLE handle, SERIAL_LINE_CONTROL &serialLineControl) + { + DWORD returned; + if (!DeviceIoControl(handle, ! IOCTL_SERIAL_GET_LINE_CONTROL, NULL, 0, ! &serialLineControl, sizeof(serialLineControl), &returned, NULL)) { ! TraceError(GetLastError(), "IOCTL_SERIAL_GET_LINE_CONTROL"); ! return FALSE; } ! return TRUE; } DWORD ComIo::SetLineControl(DWORD lineControl) *************** *** 459,486 **** |VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)) == 0); ! if (GetLineControl() == lineControl) return lineControl; DWORD returned; ! SERIAL_LINE_CONTROL serialLineControl; if (lineControl & LC_MASK_BYTESIZE) ! serialLineControl.WordLength = LC2VAL_BYTESIZE(lineControl); else ! serialLineControl.WordLength = dcb.ByteSize; if (lineControl & LC_MASK_PARITY) ! serialLineControl.Parity = LC2VAL_PARITY(lineControl); else ! serialLineControl.Parity = dcb.Parity; if (lineControl & LC_MASK_STOPBITS) ! serialLineControl.StopBits = LC2VAL_STOPBITS(lineControl); else ! serialLineControl.StopBits = dcb.StopBits; if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_LINE_CONTROL, ! &serialLineControl, sizeof(serialLineControl), NULL, 0, &returned, NULL)) --- 549,576 ---- |VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)) == 0); ! if (LineControl() == lineControl) return lineControl; DWORD returned; ! SERIAL_LINE_CONTROL newSerialLineControl = serialLineControl; if (lineControl & LC_MASK_BYTESIZE) ! newSerialLineControl.WordLength = LC2VAL_BYTESIZE(lineControl); else ! newSerialLineControl.WordLength = serialLineControl.WordLength; if (lineControl & LC_MASK_PARITY) ! newSerialLineControl.Parity = LC2VAL_PARITY(lineControl); else ! newSerialLineControl.Parity = serialLineControl.Parity; if (lineControl & LC_MASK_STOPBITS) ! newSerialLineControl.StopBits = LC2VAL_STOPBITS(lineControl); else ! newSerialLineControl.StopBits = serialLineControl.StopBits; if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_LINE_CONTROL, ! &newSerialLineControl, sizeof(newSerialLineControl), NULL, 0, &returned, NULL)) *************** *** 489,506 **** } ! if (!DeviceIoControl(handle, ! IOCTL_SERIAL_GET_LINE_CONTROL, ! NULL, 0, ! &serialLineControl, sizeof(serialLineControl), &returned, ! NULL)) ! { ! TraceError(GetLastError(), "IOCTL_SERIAL_GET_LINE_CONTROL"); ! } else { ! dcb.ByteSize = serialLineControl.WordLength; ! dcb.Parity = serialLineControl.Parity; ! dcb.StopBits = serialLineControl.StopBits; ! } ! return GetLineControl(); } /////////////////////////////////////////////////////////////// --- 579,586 ---- } ! if (GetLineControl(handle, newSerialLineControl)) ! serialLineControl = newSerialLineControl; ! return LineControl(); } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-12-15 11:00:14
|
Update of /cvsroot/com0com/com0com/sys In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2628 Modified Files: io.c Log Message: Fixed break char delay Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** io.c 30 Oct 2008 07:54:37 -0000 1.41 --- io.c 15 Dec 2008 11:00:00 -0000 1.42 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.42 2008/12/15 11:00:00 vfrolov + * Fixed break char delay + * * Revision 1.41 2008/10/30 07:54:37 vfrolov * Improved BREAK emulation *************** *** 623,626 **** --- 626,632 ---- pDataWrite->data.chr.isChr = FALSE; + + if (pDataWrite->data.chr.type == RW_DATA_TYPE_CHR_XCHR) + pReadIoPort->pIoPortRemote->sendXonXoff = 0; } } *************** *** 684,687 **** --- 690,696 ---- pDataWrite->data.chr.isChr = FALSE; + + if (pDataWrite->data.chr.type == RW_DATA_TYPE_CHR_XCHR) + pReadIoPort->pIoPortRemote->sendXonXoff = 0; } } *************** *** 893,896 **** --- 902,910 ---- break; case C0C_IO_TYPE_INSERT: + #if ENABLE_TRACING + if (C0C_BUFFER_BUSY(&pIoPort->readBuf)) + Trace0((PC0C_COMMON_EXTENSION)pIoPort->pDevExt, L"ERROR: direct INSERT with no empty buf"); + #endif /* ENABLE_TRACING */ + HALT_UNLESS(pParam); InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &doneCurrent); *************** *** 1168,1171 **** --- 1182,1194 ---- break; default: + if (pIoPortWrite->sendBreak) { + /* get BREAK char */ + + dataChar.data.chr.type = RW_DATA_TYPE_CHR_BREAK; + dataChar.data.chr.chr = 0; + dataChar.data.chr.isChr = TRUE; + break; + } + dataChar.data.chr.type = RW_DATA_TYPE_CHR_NONE; dataChar.data.chr.isChr = FALSE; *************** *** 1190,1193 **** --- 1213,1221 ---- while (dataIrpRead.data.irp.pIrp) { + #if ENABLE_TRACING + if (C0C_BUFFER_BUSY(&pIoPortRead->readBuf)) + Trace0((PC0C_COMMON_EXTENSION)pIoPortRead->pDevExt, L"ERROR: direct R/W with no empty buf"); + #endif /* ENABLE_TRACING */ + if (dataChar.data.chr.isChr) { if (!pWriteLimit || *pWriteLimit) { *************** *** 1415,1428 **** } - if (!dataChar.data.chr.isChr) { - /* complete special char sending */ - - switch (dataChar.data.chr.type) { - case RW_DATA_TYPE_CHR_XCHR: - pIoPortWrite->sendXonXoff = 0; - break; - } - } - while (dataIrpWrite.data.irp.pIrp) { PIO_STACK_LOCATION pIrpStackWrite = IoGetCurrentIrpStackLocation(dataIrpWrite.data.irp.pIrp); --- 1443,1446 ---- |
From: Vyacheslav F. <vf...@us...> - 2008-12-15 10:50:32
|
Update of /cvsroot/com0com/com0com/sys In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv445 Modified Files: version.h Log Message: Post-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** version.h 8 Dec 2008 10:49:07 -0000 1.16 --- version.h 15 Dec 2008 10:50:25 -0000 1.17 *************** *** 28,32 **** #define C0C_V2 2 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 28,32 ---- #define C0C_V2 2 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2008-12-12 08:28:40
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14777 Modified Files: opt_comport.cpp Log Message: Partialy implemented handling SET-CONTROL commands 0-3 and 13-19 Index: opt_comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/opt_comport.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** opt_comport.cpp 11 Dec 2008 13:13:40 -0000 1.5 --- opt_comport.cpp 12 Dec 2008 08:28:34 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/12/12 08:28:34 vfrolov + * Partialy implemented handling SET-CONTROL commands 0-3 and 13-19 + * * Revision 1.5 2008/12/11 13:13:40 vfrolov * Implemented PURGE-DATA (RFC 2217) *************** *** 64,76 **** --- 67,95 ---- /////////////////////////////////////////////////////////////// enum { + scReqFCO = 0, + scUseNoFCO = 1, + scUseXonXoffFCO = 2, + scUseHardwareFCO = 3, + scReqBreakState = 4, scSetBreakOn = 5, scSetBreakOff = 6, + scReqDtrState = 7, scSetDtrOn = 8, scSetDtrOff = 9, + scReqRtsState = 10, scSetRtsOn = 11, scSetRtsOff = 12, + + scReqFCI = 13, + scUseNoFCI = 14, + scUseXonXoffFCI = 15, + scUseHardwareFCI = 16, + + scUseDcdFCO = 17, + scUseDtrFCI = 18, + scUseDsrFCO = 19, }; /////////////////////////////////////////////////////////////// *************** *** 370,373 **** --- 389,395 ---- switch (params[1]) { + //case scUseNoFCO: + //case scUseXonXoffFCO: + //case scUseHardwareFCO: case scSetBreakOn: case scSetBreakOff: *************** *** 376,379 **** --- 398,407 ---- case scSetRtsOn: case scSetRtsOff: + //case scUseNoFCI: + //case scUseXonXoffFCI: + //case scUseHardwareFCI: + //case scUseDcdFCO: + //case scUseDtrFCI: + //case scUseDsrFCO: break; default: *************** *** 742,746 **** return FALSE; ! switch (params[1]) { case scReqBreakState: brkSend = TRUE; --- 770,809 ---- return FALSE; ! BYTE val = params[1]; ! ! switch (val) { ! case scReqFCO: ! case scUseNoFCO: ! case scUseXonXoffFCO: ! case scUseHardwareFCO: ! case scUseDcdFCO: ! case scUseDsrFCO: { ! BYTE_vector answer; ! ! answer.push_back((BYTE)(cpcSetControl + cpcServerBase)); ! answer.push_back(scUseNoFCO); ! SendSubNegotiation(answer); ! ! if (val != scReqFCO) ! return FALSE; ! ! break; ! } ! case scReqFCI: ! case scUseNoFCI: ! case scUseXonXoffFCI: ! case scUseHardwareFCI: ! case scUseDtrFCI: { ! BYTE_vector answer; ! ! answer.push_back((BYTE)(cpcSetControl + cpcServerBase)); ! answer.push_back(scUseNoFCI); ! SendSubNegotiation(answer); ! ! if (val != scReqFCI) ! return FALSE; ! ! break; ! } case scReqBreakState: brkSend = TRUE; *************** *** 750,754 **** case scSetBreakOff: brkSend = TRUE; ! SetBreak(params[1] == scSetBreakOn); if ((goMask & GO_BREAK_STATUS) == 0) --- 813,817 ---- case scSetBreakOff: brkSend = TRUE; ! SetBreak(val == scSetBreakOn); if ((goMask & GO_BREAK_STATUS) == 0) *************** *** 760,764 **** return FALSE; ! *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_BREAK_STATUS, params[1] == scSetBreakOn); break; --- 823,827 ---- return FALSE; ! *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_BREAK_STATUS, val == scSetBreakOn); break; *************** *** 770,774 **** case scSetDtrOff: mcrSend |= SPS_P2V_MCR(PIN_STATE_DTR); ! SetMCR(params[1] == scSetDtrOn ? SPS_P2V_MCR(PIN_STATE_DTR) : 0, SPS_P2V_MCR(PIN_STATE_DTR)); if ((goMask & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) == 0) --- 833,837 ---- case scSetDtrOff: mcrSend |= SPS_P2V_MCR(PIN_STATE_DTR); ! SetMCR(val == scSetDtrOn ? SPS_P2V_MCR(PIN_STATE_DTR) : 0, SPS_P2V_MCR(PIN_STATE_DTR)); if ((goMask & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) == 0) *************** *** 781,785 **** *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, ! (params[1] == scSetDtrOn ? MODEM_STATUS_DSR : 0) | VAL2MASK(MODEM_STATUS_DSR)); break; --- 844,848 ---- *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, ! (val == scSetDtrOn ? MODEM_STATUS_DSR : 0) | VAL2MASK(MODEM_STATUS_DSR)); break; *************** *** 791,795 **** case scSetRtsOff: mcrSend |= SPS_P2V_MCR(PIN_STATE_RTS); ! SetMCR(params[1] == scSetRtsOn ? SPS_P2V_MCR(PIN_STATE_RTS) : 0, SPS_P2V_MCR(PIN_STATE_RTS)); if ((goMask & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) == 0) --- 854,858 ---- case scSetRtsOff: mcrSend |= SPS_P2V_MCR(PIN_STATE_RTS); ! SetMCR(val == scSetRtsOn ? SPS_P2V_MCR(PIN_STATE_RTS) : 0, SPS_P2V_MCR(PIN_STATE_RTS)); if ((goMask & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) == 0) *************** *** 802,806 **** *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, ! (params[1] == scSetRtsOn ? MODEM_STATUS_CTS : 0) | VAL2MASK(MODEM_STATUS_CTS)); break; --- 865,869 ---- *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, ! (val == scSetRtsOn ? MODEM_STATUS_CTS : 0) | VAL2MASK(MODEM_STATUS_CTS)); break; |
From: Vyacheslav F. <vf...@us...> - 2008-12-12 08:04:54
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13861 Modified Files: static.cpp Log Message: Simplified adding new plugins Index: static.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/static.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** static.cpp 11 Dec 2008 13:25:20 -0000 1.2 --- static.cpp 12 Dec 2008 08:04:48 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/12/12 08:04:48 vfrolov + * Simplified adding new plugins + * * Revision 1.2 2008/12/11 13:25:20 vfrolov * Added FilterCrypt, FilterPurge, FilterTag, PortConnector *************** *** 42,79 **** #endif /////////////////////////////////////////////////////////////// ! INIT_DECLARE(FilterAwakSeq) ! INIT_DECLARE(FilterCrypt) ! INIT_DECLARE(FilterEcho) ! INIT_DECLARE(FilterEscInsert) ! INIT_DECLARE(FilterEscParse) ! INIT_DECLARE(FilterLineCtl) ! INIT_DECLARE(FilterLsrMap) ! INIT_DECLARE(FilterPin2Con) ! INIT_DECLARE(FilterPinMap) ! INIT_DECLARE(FilterPurge) ! INIT_DECLARE(FilterTag) ! INIT_DECLARE(FilterTelnet) ! INIT_DECLARE(FilterTrace) ! INIT_DECLARE(PortConnector) ! INIT_DECLARE(PortSerial) ! INIT_DECLARE(PortTcp) /////////////////////////////////////////////////////////////// static PLUGIN_INIT_A *const list[] = { ! INIT_INSERT(FilterAwakSeq) ! INIT_INSERT(FilterCrypt) ! INIT_INSERT(FilterEcho) ! INIT_INSERT(FilterEscInsert) ! INIT_INSERT(FilterEscParse) ! INIT_INSERT(FilterLineCtl) ! INIT_INSERT(FilterLsrMap) ! INIT_INSERT(FilterPin2Con) ! INIT_INSERT(FilterPinMap) ! INIT_INSERT(FilterPurge) ! INIT_INSERT(FilterTag) ! INIT_INSERT(FilterTelnet) ! INIT_INSERT(FilterTrace) ! INIT_INSERT(PortConnector) ! INIT_INSERT(PortSerial) ! INIT_INSERT(PortTcp) NULL, }; --- 45,70 ---- #endif /////////////////////////////////////////////////////////////// ! #define NAMESPACES(pattern) \ ! pattern(FilterAwakSeq) \ ! pattern(FilterCrypt) \ ! pattern(FilterEcho) \ ! pattern(FilterEscInsert) \ ! pattern(FilterEscParse) \ ! pattern(FilterLineCtl) \ ! pattern(FilterLsrMap) \ ! pattern(FilterPin2Con) \ ! pattern(FilterPinMap) \ ! pattern(FilterPurge) \ ! pattern(FilterTag) \ ! pattern(FilterTelnet) \ ! pattern(FilterTrace) \ ! pattern(PortConnector) \ ! pattern(PortSerial) \ ! pattern(PortTcp) \ ! /////////////////////////////////////////////////////////////// ! NAMESPACES(INIT_DECLARE) /////////////////////////////////////////////////////////////// static PLUGIN_INIT_A *const list[] = { ! NAMESPACES(INIT_INSERT) NULL, }; |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:25:25
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28418 Modified Files: static.cpp Log Message: Added FilterCrypt, FilterPurge, FilterTag, PortConnector Index: static.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/static.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** static.cpp 13 Nov 2008 08:03:24 -0000 1.1 --- static.cpp 11 Dec 2008 13:25:20 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/12/11 13:25:20 vfrolov + * Added FilterCrypt, FilterPurge, FilterTag, PortConnector + * * Revision 1.1 2008/11/13 08:03:24 vfrolov * Initial revision *************** *** 40,43 **** --- 43,47 ---- /////////////////////////////////////////////////////////////// INIT_DECLARE(FilterAwakSeq) + INIT_DECLARE(FilterCrypt) INIT_DECLARE(FilterEcho) INIT_DECLARE(FilterEscInsert) *************** *** 47,52 **** --- 51,59 ---- INIT_DECLARE(FilterPin2Con) INIT_DECLARE(FilterPinMap) + INIT_DECLARE(FilterPurge) + INIT_DECLARE(FilterTag) INIT_DECLARE(FilterTelnet) INIT_DECLARE(FilterTrace) + INIT_DECLARE(PortConnector) INIT_DECLARE(PortSerial) INIT_DECLARE(PortTcp) *************** *** 54,57 **** --- 61,65 ---- static PLUGIN_INIT_A *const list[] = { INIT_INSERT(FilterAwakSeq) + INIT_INSERT(FilterCrypt) INIT_INSERT(FilterEcho) INIT_INSERT(FilterEscInsert) *************** *** 61,66 **** --- 69,77 ---- INIT_INSERT(FilterPin2Con) INIT_INSERT(FilterPinMap) + INIT_INSERT(FilterPurge) + INIT_INSERT(FilterTag) INIT_INSERT(FilterTelnet) INIT_INSERT(FilterTrace) + INIT_INSERT(PortConnector) INIT_INSERT(PortSerial) INIT_INSERT(PortTcp) |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:23:16
|
Update of /cvsroot/com0com/hub4com/examples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28273 Modified Files: com2tcp-rfc2217.bat multiplexer.bat Log Message: Implemented handling PURGE-DATA for server mode (RFC 2217) Index: multiplexer.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/multiplexer.bat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** multiplexer.bat 10 Dec 2008 14:46:25 -0000 1.4 --- multiplexer.bat 11 Dec 2008 13:23:11 -0000 1.5 *************** *** 185,188 **** --- 185,189 ---- --create-filter=telnet,telnetC,telnet:--comport=client %%1%% --create-filter=trace,telnetC,TxM + #--create-filter=purge,telnetC,purge --create-filter=pinmap,telnetC,pinmap:--rts=cts --dtr=dsr --break=break --create-filter=linectl,telnetC,lc:--br=remote --lc=remote *************** *** 193,196 **** --- 194,198 ---- --create-filter=escparse,serialS,parse %%1%% --create-filter=trace,serialS,ExM + --create-filter=purge,serialS,purge --create-filter=pinmap,serialS,pinmap:--rts=cts --dtr=dsr --break=break --create-filter=linectl,serialS,lc:--br=remote --lc=remote Index: com2tcp-rfc2217.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/com2tcp-rfc2217.bat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** com2tcp-rfc2217.bat 5 Dec 2008 14:31:05 -0000 1.4 --- com2tcp-rfc2217.bat 11 Dec 2008 13:23:11 -0000 1.5 *************** *** 67,71 **** SHIFT /1 ! IF /I "%LC_CLIENT_MODE%"=="no" GOTO END_SET_LC_CLIENT_MODE SET LC_CLIENT_MODE=yes :END_SET_LC_CLIENT_MODE --- 67,71 ---- SHIFT /1 ! IF /I "%LC_CLIENT_MODE%" == "no" GOTO END_SET_LC_CLIENT_MODE SET LC_CLIENT_MODE=yes :END_SET_LC_CLIENT_MODE *************** *** 74,78 **** :END_PARSE_ARGS ! IF /I "%LC_CLIENT_MODE%"=="yes" GOTO SET_LC_CLIENT_MODE_OPTIONS SET TCP_TELNET_OPTIONS=:"--comport=server --suppress-echo=yes" --- 74,78 ---- :END_PARSE_ARGS ! IF /I "%LC_CLIENT_MODE%" == "yes" GOTO SET_LC_CLIENT_MODE_OPTIONS SET TCP_TELNET_OPTIONS=:"--comport=server --suppress-echo=yes" *************** *** 83,86 **** --- 83,87 ---- SET COM_PINMAP_OPTIONS=:"--rts=cts --dtr=dsr --break=break" SET COM_LC_OPTIONS=:"--br=remote --lc=remote" + SET COM_PURGE=--create-filter=purge,com,purge GOTO END_SET_LC_MODE_OPTIONS *************** *** 90,93 **** --- 91,95 ---- SET TCP_PINMAP_OPTIONS=:"--rts=cts --dtr=dsr --break=break" SET TCP_LC_OPTIONS=:"--br=remote --lc=remote" + :SET TCP_PURGE=--create-filter=purge,tcp,purge SET COM_PINMAP_OPTIONS=:"--rts=cts --dtr=dsr" *************** *** 99,102 **** --- 101,105 ---- SET OPTIONS=%OPTIONS% --create-filter=escparse,com,parse %TC% SET OPTIONS=%OPTIONS% --create-filter=trace,com,ExM + SET OPTIONS=%OPTIONS% %COM_PURGE% SET OPTIONS=%OPTIONS% %COM_PIN2CON% SET OPTIONS=%OPTIONS% --create-filter=pinmap,com,pinmap%COM_PINMAP_OPTIONS% *************** *** 109,112 **** --- 112,116 ---- SET OPTIONS=%OPTIONS% --create-filter=telnet,tcp,telnet%TCP_TELNET_OPTIONS% %TC% SET OPTIONS=%OPTIONS% --create-filter=trace,tcp,TxM + SET OPTIONS=%OPTIONS% %TCP_PURGE% SET OPTIONS=%OPTIONS% %TCP_LSRMAP% SET OPTIONS=%OPTIONS% --create-filter=pinmap,tcp,pinmap%TCP_PINMAP_OPTIONS% |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:18:27
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27963 Modified Files: hub4com.sln Log Message: Added filter-purge Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** hub4com.sln 5 Dec 2008 14:28:50 -0000 1.13 --- hub4com.sln 11 Dec 2008 13:18:21 -0000 1.14 *************** *** 34,37 **** --- 34,39 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-crypt", "plugins\crypt\crypt.vcproj", "{FEB9BD18-B0EA-460F-8404-C97BD2623227}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-purge", "plugins\purge\purge.vcproj", "{EAC5A50E-9D86-4EC0-B57D-CBEC0ABDCECC}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 104,107 **** --- 106,113 ---- {FEB9BD18-B0EA-460F-8404-C97BD2623227}.Release|Win32.ActiveCfg = Release|Win32 {FEB9BD18-B0EA-460F-8404-C97BD2623227}.Release|Win32.Build.0 = Release|Win32 + {EAC5A50E-9D86-4EC0-B57D-CBEC0ABDCECC}.Debug|Win32.ActiveCfg = Debug|Win32 + {EAC5A50E-9D86-4EC0-B57D-CBEC0ABDCECC}.Debug|Win32.Build.0 = Debug|Win32 + {EAC5A50E-9D86-4EC0-B57D-CBEC0ABDCECC}.Release|Win32.ActiveCfg = Release|Win32 + {EAC5A50E-9D86-4EC0-B57D-CBEC0ABDCECC}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:17:05
|
Update of /cvsroot/com0com/hub4com/plugins/purge In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27767 Added Files: .cvsignore filter.cpp precomp.cpp precomp.h purge.vcproj Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/12/11 13:16:59 vfrolov Exp $ * * Copyright (c) 2007-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: purge.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-purge" ProjectGUID="{EAC5A50E-9D86-4EC0-B57D-CBEC0ABDCECC}" RootNamespace="hub4com" Keyword="Win32Proj" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="2" UseOfMFC="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="2" PrecompiledHeaderThrough="precomp.h" PrecompiledHeaderFile="$(IntDir)\precomp.pch" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" OutputFile="..\..\$(OutDir)\plugins\$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile="..\plugins.def" GenerateDebugInformation="true" SubSystem="1" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="2" UseOfMFC="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="0" UsePrecompiledHeader="2" PrecompiledHeaderThrough="precomp.h" PrecompiledHeaderFile="$(IntDir)\precomp.pch" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" OutputFile="..\..\$(OutDir)\plugins\$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile="..\plugins.def" GenerateDebugInformation="true" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File RelativePath="..\plugins_api.h" > </File> <File RelativePath=".\precomp.h" > </File> </Filter> <Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File RelativePath=".\filter.cpp" > </File> <File RelativePath="..\plugins.def" > </File> <File RelativePath=".\precomp.cpp" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1" /> </FileConfiguration> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: .cvsignore --- *.user Release Debug --- NEW FILE: filter.cpp --- /* * $Id: filter.cpp,v 1.1 2008/12/11 13:16:59 vfrolov Exp $ * * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: filter.cpp,v $ * Revision 1.1 2008/12/11 13:16:59 vfrolov * Initial revision * */ #include "precomp.h" #include "../plugins_api.h" /////////////////////////////////////////////////////////////// namespace FilterPurge { /////////////////////////////////////////////////////////////// static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; static ROUTINE_PORT_NAME_A *pPortName = NULL; static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) { size_t lenPattern = strlen(pPattern); if (_strnicmp(pArg, pPattern, lenPattern) != 0) return NULL; return pArg + lenPattern; } /////////////////////////////////////////////////////////////// class Valid { public: Valid() : isValid(TRUE) {} void Invalidate() { isValid = FALSE; } BOOL IsValid() const { return isValid; } private: BOOL isValid; }; /////////////////////////////////////////////////////////////// class Filter : public Valid { public: Filter(int argc, const char *const argv[]); void SetFilterName(const char *_pName) { pName = _pName; } const char *FilterName() const { return pName; } DWORD soOutMask; DWORD goInMask; private: const char *pName; }; Filter::Filter(int argc, const char *const argv[]) : soOutMask(SO_PURGE_TX), goInMask(GO_PURGE_TX_IN), pName(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); if (!pArg) { cerr << "Unknown option " << *pArgs << endl; Invalidate(); continue; } { cerr << "Unknown option --" << pArg << endl; Invalidate(); } } } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "purge", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Purge mapping filter", }; static const PLUGIN_ABOUT_A * CALLBACK GetPluginAbout() { return &about; } /////////////////////////////////////////////////////////////// static void CALLBACK Help(const char *pProgPath) { cerr << "Usage:" << endl << " " << pProgPath << " ... --create-filter=" << GetPluginAbout()->pName << "[,<FID>][:<options>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl << endl << "Options:" << endl << endl << "Examples:" << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { Filter *pFilter = new Filter(argc, argv); if (!pFilter) return NULL; if (!pFilter->IsValid()) { delete pFilter; return NULL; } return (HFILTER)pFilter; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK Init( HFILTER hFilter, HMASTERFILTER hMasterFilter) { _ASSERTE(hFilter != NULL); _ASSERTE(hMasterFilter != NULL); ((Filter *)hFilter)->SetFilterName(pFilterName(hMasterFilter)); return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, HMASTERPORT hFromPort, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(hFromPort != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); switch (pOutMsg->type) { case HUB_MSG_TYPE_SET_OUT_OPTS: { // or'e with the required mask to purge pOutMsg->u.val |= ((Filter *)hFilter)->soOutMask; break; } case HUB_MSG_TYPE_GET_IN_OPTS: { _ASSERTE(pOutMsg->u.pv.pVal != NULL); // or'e with the required mask to purge *pOutMsg->u.pv.pVal |= (((Filter *)hFilter)->goInMask & pOutMsg->u.pv.val); break; } case HUB_MSG_TYPE_FAIL_IN_OPTS: { DWORD fail_options = (pOutMsg->u.val & ((Filter *)hFilter)->goInMask); if (fail_options) { cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) << " option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; } break; } case HUB_MSG_TYPE_PURGE_TX: // discard if controlled by this filter if (((Filter *)hFilter)->soOutMask & SO_PURGE_TX) { if (!pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } break; case HUB_MSG_TYPE_PURGE_TX_IN: if ((((Filter *)hFilter)->goInMask & GO_PURGE_TX_IN) == 0) break; if ((((Filter *)hFilter)->soOutMask & SO_PURGE_TX) == 0) break; pOutMsg = pMsgInsertNone(pOutMsg, HUB_MSG_TYPE_PURGE_TX); break; } return pOutMsg != NULL; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, Init, NULL, // InMethod OutMethod, }; static const PLUGIN_ROUTINES_A *const plugins[] = { (const PLUGIN_ROUTINES_A *)&routines, NULL }; /////////////////////////////////////////////////////////////// PLUGIN_INIT_A InitA; const PLUGIN_ROUTINES_A *const * CALLBACK InitA( const HUB_ROUTINES_A * pHubRoutines) { if (!ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; } pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; pMsgInsertNone = pHubRoutines->pMsgInsertNone; pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; return plugins; } /////////////////////////////////////////////////////////////// } // end namespace /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/12/11 13:17:00 vfrolov Exp $ * * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: precomp.h,v $ * Revision 1.1 2008/12/11 13:17:00 vfrolov * Initial revision * */ #ifndef _PRECOMP_H_ #define _PRECOMP_H_ #include <windows.h> #include <crtdbg.h> #include <iostream> using namespace std; #pragma warning(disable:4512) // assignment operator could not be generated #endif /* _PRECOMP_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:14:35
|
Update of /cvsroot/com0com/hub4com/plugins/purge In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27521/purge Log Message: Directory /cvsroot/com0com/hub4com/plugins/purge added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:14:00
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27439 Modified Files: filter.cpp import.h opt_comport.cpp opt_comport.h Log Message: Implemented PURGE-DATA (RFC 2217) Index: import.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/import.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** import.h 13 Nov 2008 07:44:12 -0000 1.3 --- import.h 11 Dec 2008 13:13:40 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/12/11 13:13:40 vfrolov + * Implemented PURGE-DATA (RFC 2217) + * * Revision 1.3 2008/11/13 07:44:12 vfrolov * Changed for staticaly linking *************** *** 39,42 **** --- 42,46 ---- extern ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf; extern ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; + extern ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; /////////////////////////////////////////////////////////////// Index: opt_comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/opt_comport.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** opt_comport.cpp 5 Dec 2008 14:10:33 -0000 1.4 --- opt_comport.cpp 11 Dec 2008 13:13:40 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/12/11 13:13:40 vfrolov + * Implemented PURGE-DATA (RFC 2217) + * * Revision 1.4 2008/12/05 14:10:33 vfrolov * Fixed return values of TelnetOptionComPortClient::OnSubNegotiation() *************** *** 72,75 **** --- 75,84 ---- }; /////////////////////////////////////////////////////////////// + enum { + pdRxBuf = 1, + pdTxBuf = 2, + pdRxTxBuf = 3, + }; + /////////////////////////////////////////////////////////////// inline BYTE p2v_dataSize(BYTE par) { *************** *** 245,248 **** --- 254,266 ---- } + void TelnetOptionComPortClient::PurgeTx() + { + BYTE_vector params; + + params.push_back((BYTE)(cpcPurgeData)); + params.push_back(pdTxBuf); + SendSubNegotiation(params); + } + BOOL TelnetOptionComPortClient::OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg) { *************** *** 833,841 **** } case cpcPurgeData: { ! BYTE_vector answer = params; ! answer[0] += cpcServerBase; SendSubNegotiation(answer); ! return FALSE; break; } --- 851,887 ---- } case cpcPurgeData: { ! if (params.size() != (1 + 1)) ! return FALSE; ! BYTE val = params[1]; ! ! switch (val) { ! case pdRxBuf: ! case pdTxBuf: ! case pdRxTxBuf: ! break; ! default: ! return FALSE; ! } ! ! BYTE_vector answer; ! ! answer.push_back((BYTE)(cpcPurgeData + cpcServerBase)); ! answer.push_back(val); SendSubNegotiation(answer); ! ! if ((goMask & GO_PURGE_TX_IN) == 0) ! return FALSE; ! ! if (val == pdRxBuf) ! return FALSE; ! ! *ppMsg = FlushDecodedStream(*ppMsg); ! ! if (!*ppMsg) ! return FALSE; ! ! *ppMsg = pMsgInsertNone(*ppMsg, HUB_MSG_TYPE_PURGE_TX_IN); ! break; } Index: opt_comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/opt_comport.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opt_comport.h 24 Nov 2008 16:39:58 -0000 1.2 --- opt_comport.h 11 Dec 2008 13:13:40 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/12/11 13:13:40 vfrolov + * Implemented PURGE-DATA (RFC 2217) + * * Revision 1.2 2008/11/24 16:39:58 vfrolov * Implemented FLOWCONTROL-SUSPEND and FLOWCONTROL-RESUME commands (RFC 2217) *************** *** 50,53 **** --- 53,58 ---- virtual void SetBreak(BOOL on) = 0; + virtual void PurgeTx() = 0; + protected: void OnSuspendResume(BOOL suspend, HUB_MSG **ppMsg); *************** *** 76,79 **** --- 81,86 ---- virtual void SetBreak(BOOL on); + virtual void PurgeTx(); + protected: virtual BOOL OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg); *************** *** 94,97 **** --- 101,106 ---- virtual void SetBreak(BOOL on); + virtual void PurgeTx() { _ASSERTE(FALSE); return; } + protected: virtual BOOL OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg); Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** filter.cpp 5 Dec 2008 14:12:04 -0000 1.10 --- filter.cpp 11 Dec 2008 13:13:40 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/12/11 13:13:40 vfrolov + * Implemented PURGE-DATA (RFC 2217) + * * Revision 1.10 2008/12/05 14:12:04 vfrolov * Fixed return values *************** *** 61,65 **** #include "opt_comport.h" /////////////////////////////////////////////////////////////// - static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; static ROUTINE_PORT_NAME_A *pPortName; static ROUTINE_FILTER_NAME_A *pFilterName; --- 64,67 ---- *************** *** 221,225 **** case comport_client: soMask = SO_V2O_PIN_STATE(PIN_STATE_DTR|PIN_STATE_RTS|PIN_STATE_BREAK) | ! SO_SET_BR|SO_SET_LC; goMask = GO_V2O_LINE_STATUS(-1) | --- 223,227 ---- case comport_client: soMask = SO_V2O_PIN_STATE(PIN_STATE_DTR|PIN_STATE_RTS|PIN_STATE_BREAK) | ! SO_SET_BR|SO_SET_LC|SO_PURGE_TX; goMask = GO_V2O_LINE_STATUS(-1) | *************** *** 233,237 **** goMask = GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS|MODEM_STATUS_DSR) | ! GO_RBR_STATUS|GO_RLC_STATUS|GO_BREAK_STATUS; break; default: --- 235,239 ---- goMask = GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS|MODEM_STATUS_DSR) | ! GO_RBR_STATUS|GO_RLC_STATUS|GO_BREAK_STATUS|GO_PURGE_TX_IN; break; default: *************** *** 752,755 **** --- 754,781 ---- break; } + case HUB_MSG_TYPE_PURGE_TX: { + State *pState = ((Filter *)hFilter)->GetState(hToPort); + + if (!pState) + return FALSE; + + _ASSERTE(((pState->soMask | ~((Filter *)hFilter)->soMask) & SO_PURGE_TX) != 0); + + if (pState->soMask & SO_PURGE_TX) { + _ASSERTE(pOutMsg->u.val == (BYTE)pOutMsg->u.val); + + // discard messages for supported options + if (!pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY)) + return FALSE; + + if (pState->pComPort) { + pState->pComPort->PurgeTx(); + _ASSERTE(pState->pTelnetProtocol != NULL); + pState->pTelnetProtocol->FlushEncodedStream(&pOutMsg); + } + } + + break; + } case HUB_MSG_TYPE_ADD_XOFF_XON: { State *pState = ((Filter *)hFilter)->GetState(hToPort); *************** *** 810,813 **** --- 836,840 ---- ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf; ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; + ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; /////////////////////////////////////////////////////////////// PLUGIN_INIT_A InitA; |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:10:30
|
Update of /cvsroot/com0com/hub4com/plugins/trace In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27095 Modified Files: filter.cpp Log Message: Added PURGE_TX Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/trace/filter.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** filter.cpp 5 Dec 2008 14:23:19 -0000 1.12 --- filter.cpp 11 Dec 2008 13:10:23 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2008/12/11 13:10:23 vfrolov + * Added PURGE_TX + * * Revision 1.12 2008/12/05 14:23:19 vfrolov * Output config in loadable format *************** *** 440,443 **** --- 443,448 ---- TOCODE2NAME(HUB_MSG_TYPE_, LOOP_TEST), TOCODE2NAME(HUB_MSG_TYPE_, ADD_XOFF_XON), + TOCODE2NAME(HUB_MSG_TYPE_, PURGE_TX_IN), + TOCODE2NAME(HUB_MSG_TYPE_, PURGE_TX), {0, NULL} }; |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:07:59
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26755 Modified Files: comport.cpp comport.h Log Message: Added PURGE_TX Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** comport.cpp 1 Dec 2008 17:06:29 -0000 1.20 --- comport.cpp 11 Dec 2008 13:07:54 -0000 1.21 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.21 2008/12/11 13:07:54 vfrolov + * Added PURGE_TX + * * Revision 1.20 2008/12/01 17:06:29 vfrolov * Improved write buffering *************** *** 513,521 **** } BOOL ComPort::Write(HUB_MSG *pMsg) { _ASSERTE(pMsg != NULL); ! if (pMsg->type == HUB_MSG_TYPE_LINE_DATA) { BYTE *pBuf = pMsg->u.buf.pBuf; DWORD len = pMsg->u.buf.size; --- 516,545 ---- } + void ComPort::PurgeWrite(BOOL withLost) + { + pComIo->PurgeWrite(); + + if (lenWriteBuf) { + _ASSERTE(pWriteBuf != NULL); + + if (withLost) + writeLost += lenWriteBuf; + + writeQueued -= lenWriteBuf; + lenWriteBuf = 0; + pBufFree(pWriteBuf); + pWriteBuf = NULL; + } + + if (!withLost) + writeLost -= writeQueued; // compensate + } + BOOL ComPort::Write(HUB_MSG *pMsg) { _ASSERTE(pMsg != NULL); ! switch (pMsg->type) { ! case HUB_MSG_TYPE_LINE_DATA: { BYTE *pBuf = pMsg->u.buf.pBuf; DWORD len = pMsg->u.buf.size; *************** *** 551,567 **** } ! if (writeQueued > writeQueueLimit) { ! pComIo->PurgeWrite(); ! ! if (lenWriteBuf) { ! _ASSERTE(pWriteBuf != NULL); ! ! writeLost += lenWriteBuf; ! writeQueued -= lenWriteBuf; ! lenWriteBuf = 0; ! pBufFree(pWriteBuf); ! pWriteBuf = NULL; ! } ! } if (writeOverlappedBuf.size()) { --- 575,580 ---- } ! if (writeQueued > writeQueueLimit) ! PurgeWrite(TRUE); if (writeOverlappedBuf.size()) { *************** *** 592,605 **** //cout << name << " Started Write " << len << " " << writeQueued << endl; } ! else ! if (pMsg->type == HUB_MSG_TYPE_SET_PIN_STATE) { if (!pComIo) return FALSE; pComIo->SetPinState((WORD)pMsg->u.val, MASK2VAL(pMsg->u.val) & SO_O2V_PIN_STATE(outOptions)); ! } ! else ! if (pMsg->type == HUB_MSG_TYPE_SET_BR) { if (!pComIo) return FALSE; --- 605,617 ---- //cout << name << " Started Write " << len << " " << writeQueued << endl; + break; } ! case HUB_MSG_TYPE_SET_PIN_STATE: if (!pComIo) return FALSE; pComIo->SetPinState((WORD)pMsg->u.val, MASK2VAL(pMsg->u.val) & SO_O2V_PIN_STATE(outOptions)); ! break; ! case HUB_MSG_TYPE_SET_BR: { if (!pComIo) return FALSE; *************** *** 633,639 **** } } } ! else ! if (pMsg->type == HUB_MSG_TYPE_SET_LC) { if (!pComIo) return FALSE; --- 645,651 ---- } } + break; } ! case HUB_MSG_TYPE_SET_LC: { if (!pComIo) return FALSE; *************** *** 691,697 **** } } } ! else ! if (pMsg->type == HUB_MSG_TYPE_SET_OUT_OPTS) { if (!pComIo) return FALSE; --- 703,716 ---- } } + break; } ! case HUB_MSG_TYPE_PURGE_TX: ! if (!pComIo) ! return FALSE; ! ! PurgeWrite(FALSE); ! FlowControlUpdate(); ! break; ! case HUB_MSG_TYPE_SET_OUT_OPTS: if (!pComIo) return FALSE; *************** *** 727,731 **** SO_V2O_PIN_STATE(PIN_STATE_BREAK) | SO_SET_BR | ! SO_SET_LC); pMsg->u.val &= ~outOptions; --- 746,751 ---- SO_V2O_PIN_STATE(PIN_STATE_BREAK) | SO_SET_BR | ! SO_SET_LC | ! SO_PURGE_TX); pMsg->u.val &= ~outOptions; *************** *** 736,742 **** << "] will be ignored by driver" << endl; } ! } ! else ! if (pMsg->type == HUB_MSG_TYPE_ADD_XOFF_XON) { if (pMsg->u.val) { countXoff++; --- 756,761 ---- << "] will be ignored by driver" << endl; } ! break; ! case HUB_MSG_TYPE_ADD_XOFF_XON: if (pMsg->u.val) { countXoff++; *************** *** 745,748 **** --- 764,768 ---- StartRead(); } + break; } Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** comport.h 1 Dec 2008 17:06:29 -0000 1.14 --- comport.h 11 Dec 2008 13:07:54 -0000 1.15 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.15 2008/12/11 13:07:54 vfrolov + * Added PURGE_TX + * * Revision 1.14 2008/12/01 17:06:29 vfrolov * Improved write buffering *************** *** 119,122 **** --- 122,126 ---- private: void FlowControlUpdate(); + void PurgeWrite(BOOL withLost); BOOL StartRead(); BOOL StartWaitCommEvent(); |
From: Vyacheslav F. <vf...@us...> - 2008-12-11 13:05:18
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26466 Modified Files: plugins_api.h Log Message: Added PURGE_TX Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** plugins_api.h 27 Nov 2008 16:19:16 -0000 1.20 --- plugins_api.h 11 Dec 2008 13:05:09 -0000 1.21 *************** *** 98,101 **** --- 98,102 ---- #define GO_RLC_STATUS ((DWORD)1 << 17) #define GO_BREAK_STATUS ((DWORD)1 << 18) + #define GO_PURGE_TX_IN ((DWORD)1 << 19) #define GO_ESCAPE_MODE ((DWORD)1 << 24) #define GO_LBR_STATUS ((DWORD)1 << 25) *************** *** 108,111 **** --- 109,113 ---- #define SO_SET_BR ((DWORD)1 << 24) #define SO_SET_LC ((DWORD)1 << 25) + #define SO_PURGE_TX ((DWORD)1 << 26) #define HUB_MSG_TYPE_FAIL_IN_OPTS (8 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_RBR_STATUS (9 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_UINT) *************** *** 126,129 **** --- 128,133 ---- #define HUB_MSG_TYPE_LOOP_TEST (20 | HUB_MSG_UNION_TYPE_HVAL) #define HUB_MSG_TYPE_ADD_XOFF_XON (21 | HUB_MSG_ROUTE_FLOW_CONTROL | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_BOOL) + #define HUB_MSG_TYPE_PURGE_TX_IN (22 | HUB_MSG_UNION_TYPE_NONE) + #define HUB_MSG_TYPE_PURGE_TX (23 | HUB_MSG_UNION_TYPE_NONE) /*******************************************************************/ typedef struct _HUB_MSG { |
From: Vyacheslav F. <vf...@us...> - 2008-12-10 14:46:38
|
Update of /cvsroot/com0com/hub4com/examples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23710 Modified Files: multiplexer.bat Log Message: Fixed typo Index: multiplexer.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/multiplexer.bat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** multiplexer.bat 5 Dec 2008 14:52:54 -0000 1.3 --- multiplexer.bat 10 Dec 2008 14:46:25 -0000 1.4 *************** *** 190,203 **** ################################################################ BEGIN_SERVER_FILTERS ! %%1%% --create-filter=trace,serialC,COM --create-filter=escparse,serialS,parse ! %%1%% --create-filter=trace,serialC,ExM --create-filter=pinmap,serialS,pinmap:--rts=cts --dtr=dsr --break=break --create-filter=linectl,serialS,lc:--br=remote --lc=remote ! %%1%% --create-filter=trace,serialC,CxB ! %%1%% --create-filter=trace,telnetC,muxB --create-filter=telnet,telnetS,telnet:--comport=server --suppress-echo=yes ! %%1%% --create-filter=trace,telnetC,BxM --create-filter=lsrmap,telnetS,lsrmap --create-filter=pinmap,telnetS,pinmap:--cts=cts --dsr=dsr --dcd=dcd --ring=ring --- 190,203 ---- ################################################################ BEGIN_SERVER_FILTERS ! %%1%% --create-filter=trace,serialS,COM --create-filter=escparse,serialS,parse ! %%1%% --create-filter=trace,serialS,ExM --create-filter=pinmap,serialS,pinmap:--rts=cts --dtr=dsr --break=break --create-filter=linectl,serialS,lc:--br=remote --lc=remote ! %%1%% --create-filter=trace,serialS,CxB ! %%1%% --create-filter=trace,telnetS,muxB --create-filter=telnet,telnetS,telnet:--comport=server --suppress-echo=yes ! %%1%% --create-filter=trace,telnetS,BxM --create-filter=lsrmap,telnetS,lsrmap --create-filter=pinmap,telnetS,pinmap:--cts=cts --dsr=dsr --dcd=dcd --ring=ring |