com0com-cvs Mailing List for Null-modem emulator (Page 16)
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-10-24 06:51:43
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29131 Added Files: opt_comport.cpp opt_comport.h opt_termtype.cpp opt_termtype.h Log Message: Initial revision --- NEW FILE: opt_termtype.cpp --- /* * $Id: opt_termtype.cpp,v 1.1 2008/10/24 06:51:23 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: opt_termtype.cpp,v $ * Revision 1.1 2008/10/24 06:51:23 vfrolov * Initial revision * */ #include "precomp.h" #include "opt_termtype.h" /////////////////////////////////////////////////////////////// enum { ttIs = 0, ttSend = 1, }; TelnetOptionTerminalType::TelnetOptionTerminalType( TelnetProtocol &_telnet, const char *pTerminalType) : TelnetOption(_telnet, 24 /*TERMINAL-TYPE*/) { if (!pTerminalType) pTerminalType = "UNKNOWN"; while (*pTerminalType) terminalType.push_back(*pTerminalType++); } BOOL TelnetOptionTerminalType::OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG ** /*ppMsg*/) { if (params.empty()) return FALSE; switch (params[0]) { case ttIs: return FALSE; case ttSend: { BYTE_vector answer; answer.push_back(ttIs); answer.insert(answer.end(), terminalType.begin(), terminalType.end()); SendSubNegotiation(answer); break; } default: return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// --- NEW FILE: opt_comport.cpp --- /* * $Id: opt_comport.cpp,v 1.1 2008/10/24 06:51:23 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: opt_comport.cpp,v $ * Revision 1.1 2008/10/24 06:51:23 vfrolov * Initial revision * */ #include "precomp.h" #include "import.h" #include "opt_comport.h" /////////////////////////////////////////////////////////////// enum { cpcSignature = 0, cpcSetBaudRate = 1, cpcSetDataSize = 2, cpcSetParity = 3, cpcSetStopSize = 4, cpcSetControl = 5, cpcNotifyLineState = 6, cpcNotifyModemState = 7, cpcFlowControlSuspend = 8, cpcFlowControlResume = 9, cpcSetLineStateMask = 10, cpcSetModemStateMask = 11, cpcPurgeData = 12, cpcServerBase = 100, }; /////////////////////////////////////////////////////////////// enum { scReqBreakState = 4, scSetBreakOn = 5, scSetBreakOff = 6, scReqDtrState = 7, scSetDtrOn = 8, scSetDtrOff = 9, scReqRtsState = 10, scSetRtsOn = 11, scSetRtsOff = 12, }; /////////////////////////////////////////////////////////////// inline BYTE p2v_dataSize(BYTE par) { return par; } inline BYTE v2p_dataSize(BYTE val) { return val; } inline BYTE p2v_parity(BYTE par) { switch (par) { case 1: return NOPARITY; case 2: return ODDPARITY; case 3: return EVENPARITY; case 4: return MARKPARITY; case 5: return SPACEPARITY; } return NOPARITY; } inline BYTE v2p_parity(BYTE val) { switch (val) { case NOPARITY: return 1; case ODDPARITY: return 2; case EVENPARITY: return 3; case MARKPARITY: return 4; case SPACEPARITY: return 5; } return 1; } inline BYTE p2v_stopSize(BYTE par) { switch (par) { case 1: return ONESTOPBIT; case 2: return TWOSTOPBITS; case 3: return ONE5STOPBITS; } return ONESTOPBIT; } inline BYTE v2p_stopSize(BYTE val) { switch (val) { case ONESTOPBIT: return 1; case TWOSTOPBITS: return 2; case ONE5STOPBITS: return 3; } return 1; } /////////////////////////////////////////////////////////////// TelnetOptionComPort::TelnetOptionComPort(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask) : TelnetOption(_telnet, 44 /*COM-PORT-OPTION*/), goMask(_goMask), soMask(_soMask) { } /////////////////////////////////////////////////////////////// TelnetOptionComPortClient::TelnetOptionComPortClient(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask) : TelnetOptionComPort(_telnet, _goMask, _soMask) { } void TelnetOptionComPortClient::SetBR(DWORD br) { BYTE_vector params; params.push_back((BYTE)(cpcSetBaudRate)); params.push_back((BYTE)(br >> 24)); params.push_back((BYTE)(br >> 16)); params.push_back((BYTE)(br >> 8)); params.push_back((BYTE)(br)); SendSubNegotiation(params); } void TelnetOptionComPortClient::SetLC(DWORD lc) { if (lc & LC_MASK_BYTESIZE) { BYTE_vector params; params.push_back((BYTE)(cpcSetDataSize)); params.push_back(v2p_dataSize(LC2VAL_BYTESIZE(lc))); SendSubNegotiation(params); } if (lc & LC_MASK_PARITY) { BYTE_vector params; params.push_back((BYTE)(cpcSetParity)); params.push_back(v2p_parity(LC2VAL_PARITY(lc))); SendSubNegotiation(params); } if (lc & LC_MASK_STOPBITS) { BYTE_vector params; params.push_back((BYTE)(cpcSetStopSize)); params.push_back(v2p_stopSize(LC2VAL_STOPBITS(lc))); SendSubNegotiation(params); } } void TelnetOptionComPortClient::SetMCR(BYTE mcr, BYTE mask) { if (mask & SPS_P2V_MCR(PIN_STATE_DTR)) { BYTE_vector params; params.push_back((BYTE)(cpcSetControl)); params.push_back((BYTE)((mcr & SPS_P2V_MCR(PIN_STATE_DTR)) ? scSetDtrOn : scSetDtrOff)); SendSubNegotiation(params); } if (mask & SPS_P2V_MCR(PIN_STATE_RTS)) { BYTE_vector params; params.push_back((BYTE)(cpcSetControl)); params.push_back((BYTE)((mcr & SPS_P2V_MCR(PIN_STATE_RTS)) ? scSetRtsOn : scSetRtsOff)); SendSubNegotiation(params); } } void TelnetOptionComPortClient::SetBreak(BOOL on) { BYTE_vector params; params.push_back((BYTE)(cpcSetControl)); params.push_back((BYTE)(on ? scSetBreakOn : scSetBreakOff)); SendSubNegotiation(params); } BOOL TelnetOptionComPortClient::OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg) { if (params.empty()) return FALSE; switch (params[0]) { case cpcSignature: return FALSE; break; case cpcSetBaudRate + cpcServerBase: { if (params.size() != (1 + 4)) return FALSE; DWORD par = ((DWORD)params[1] << 24) | ((DWORD)params[2] << 16) | ((DWORD)params[3] << 8) | ((DWORD)params[4]); if (par == 0) return FALSE; if ((goMask & GO_LBR_STATUS) == 0) return FALSE; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_LBR_STATUS, par); break; } case cpcSetDataSize + cpcServerBase: { if (params.size() != (1 + 1)) return FALSE; BYTE par = params[1]; if (par == 0) return FALSE; if ((goMask & GO_LLC_STATUS) == 0) return FALSE; DWORD lcVal = (VAL2LC_BYTESIZE(p2v_dataSize(par))|LC_MASK_BYTESIZE); *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_LLC_STATUS, lcVal); break; } case cpcSetParity + cpcServerBase: { if (params.size() != (1 + 1)) return FALSE; BYTE par = params[1]; if (par == 0) return FALSE; if ((goMask & GO_LLC_STATUS) == 0) return FALSE; DWORD lcVal = (VAL2LC_PARITY(p2v_parity(par))|LC_MASK_PARITY); *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_LLC_STATUS, lcVal); break; } case cpcSetStopSize + cpcServerBase: { if (params.size() != (1 + 1)) return FALSE; BYTE par = params[1]; if (par == 0) return FALSE; if ((goMask & GO_LLC_STATUS) == 0) return FALSE; DWORD lcVal = (VAL2LC_STOPBITS(p2v_stopSize(par))|LC_MASK_STOPBITS); *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_LLC_STATUS, lcVal); break; } case cpcSetControl + cpcServerBase: if (params.size() != (1 + 1)) return FALSE; switch (params[1]) { case scSetBreakOn: case scSetBreakOff: case scSetDtrOn: case scSetDtrOff: case scSetRtsOn: case scSetRtsOff: break; default: return FALSE; } break; case cpcNotifyLineState + cpcServerBase: { if (params.size() != (1 + 1)) return FALSE; BYTE mask = GO_O2V_LINE_STATUS(goMask); if (mask == 0) return FALSE; BYTE par = params[1]; if ((par & mask) == 0) break; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_LINE_STATUS, par | VAL2MASK(mask)); break; } case cpcNotifyModemState + cpcServerBase: { if (params.size() != (1 + 1)) return FALSE; BYTE mask = GO_O2V_MODEM_STATUS(goMask); if (mask == 0) return FALSE; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, params[1] | VAL2MASK(mask)); break; } default: return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// TelnetOptionComPortServer::TelnetOptionComPortServer(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask) : TelnetOptionComPort(_telnet, _goMask, _soMask), br(0), brSend(FALSE), lc(0), lcSend(0), mst(0), mstMask(255 & SPS_P2V_MST(SO_O2V_PIN_STATE(soMask))), lsrMask(0), mcr(0), mcrMask(0), mcrSend(0), brk(0), brkSend(0) { } void TelnetOptionComPortServer::SetBR(DWORD _br) { br = _br; if (br != 0 && brSend) { BYTE_vector params; params.push_back((BYTE)(cpcSetBaudRate + cpcServerBase)); params.push_back((BYTE)(br >> 24)); params.push_back((BYTE)(br >> 16)); params.push_back((BYTE)(br >> 8)); params.push_back((BYTE)(br)); SendSubNegotiation(params); brSend = FALSE; } } void TelnetOptionComPortServer::SetLC(DWORD _lc) { lc = _lc; if (lc & lcSend & LC_MASK_BYTESIZE) { BYTE_vector params; params.push_back((BYTE)(cpcSetDataSize + cpcServerBase)); params.push_back(v2p_dataSize(LC2VAL_BYTESIZE(lc))); SendSubNegotiation(params); lcSend &= ~LC_MASK_BYTESIZE; } if (lc & lcSend & LC_MASK_PARITY) { BYTE_vector params; params.push_back((BYTE)(cpcSetParity + cpcServerBase)); params.push_back(v2p_parity(LC2VAL_PARITY(lc))); SendSubNegotiation(params); lcSend &= ~LC_MASK_PARITY; } if (lc & lcSend & LC_MASK_STOPBITS) { BYTE_vector params; params.push_back((BYTE)(cpcSetStopSize + cpcServerBase)); params.push_back(v2p_stopSize(LC2VAL_STOPBITS(lc))); SendSubNegotiation(params); lcSend &= ~LC_MASK_STOPBITS; } } void TelnetOptionComPortServer::NotifyMST(BYTE _mst) { if ((mst ^ _mst) & mstMask) { mst = (_mst & mstMask); BYTE_vector params; params.push_back((BYTE)(cpcNotifyModemState + cpcServerBase)); params.push_back(mst); SendSubNegotiation(params); } } void TelnetOptionComPortServer::NotifyLSR(BYTE lsr) { lsr &= lsrMask; if (lsr) { BYTE_vector params; params.push_back((BYTE)(cpcNotifyLineState + cpcServerBase)); params.push_back(lsr); SendSubNegotiation(params); } } void TelnetOptionComPortServer::SetMCR(BYTE _mcr, BYTE mask) { mcr = ((mcr & ~mask) | (_mcr & mask)); mcrMask |= mask; if (mcrMask & mcrSend & SPS_P2V_MCR(PIN_STATE_DTR)) { BYTE_vector params; params.push_back((BYTE)(cpcSetControl + cpcServerBase)); params.push_back((BYTE)((mcr & SPS_P2V_MCR(PIN_STATE_DTR)) ? scSetDtrOn : scSetDtrOff)); SendSubNegotiation(params); mcrSend &= ~SPS_P2V_MCR(PIN_STATE_DTR); } if (mcrMask & mcrSend & SPS_P2V_MCR(PIN_STATE_RTS)) { BYTE_vector params; params.push_back((BYTE)(cpcSetControl + cpcServerBase)); params.push_back((BYTE)((mcr & SPS_P2V_MCR(PIN_STATE_RTS)) ? scSetRtsOn : scSetRtsOff)); SendSubNegotiation(params); mcrSend &= ~SPS_P2V_MCR(PIN_STATE_RTS); } } void TelnetOptionComPortServer::SetBreak(BOOL on) { brk = on; if (brkSend) { BYTE_vector params; params.push_back((BYTE)(cpcSetControl + cpcServerBase)); params.push_back((BYTE)(brk ? scSetBreakOn : scSetBreakOff)); SendSubNegotiation(params); brkSend = FALSE; } } BOOL TelnetOptionComPortServer::OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg) { if (params.empty()) return FALSE; switch (params[0]) { case cpcSignature: return FALSE; break; case cpcSetBaudRate: { if (params.size() != (1 + 4)) return FALSE; DWORD par = ((DWORD)params[1] << 24) | ((DWORD)params[2] << 16) | ((DWORD)params[3] << 8) | ((DWORD)params[4]); brSend = TRUE; if (par != 0 && br != par) { if (goMask & GO_RBR_STATUS) { br = 0; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_RBR_STATUS, par); if (!*ppMsg || (soMask & SO_SET_BR) == 0) { SetBR(par); return FALSE; } } else { SetBR(par); return FALSE; } } else { SetBR(br); } break; } case cpcSetDataSize: { if (params.size() != (1 + 1)) return FALSE; BYTE par = params[1]; DWORD lcVal = VAL2LC_BYTESIZE(p2v_dataSize(par))|LC_MASK_BYTESIZE; lcSend |= LC_MASK_BYTESIZE; if (par != 0 && (lc & (VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE)) != lcVal) { lc &= ~(VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE); if (goMask & GO_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_RLC_STATUS, lcVal); if (!*ppMsg || (soMask & SO_SET_LC) == 0) { SetLC(lcVal); return FALSE; } } else { SetLC(lcVal); return FALSE; } } else { SetLC(lc); } break; } case cpcSetParity: { if (params.size() != (1 + 1)) return FALSE; BYTE par = params[1]; DWORD lcVal = VAL2LC_PARITY(p2v_parity(par))|LC_MASK_PARITY; lcSend |= LC_MASK_PARITY; if (par != 0 && (lc & (VAL2LC_PARITY(-1)|LC_MASK_PARITY)) != lcVal) { lc &= ~(VAL2LC_PARITY(-1)|LC_MASK_PARITY); if (goMask & GO_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_RLC_STATUS, lcVal); if (!*ppMsg || (soMask & SO_SET_LC) == 0) { SetLC(lcVal); return FALSE; } } else { SetLC(lcVal); return FALSE; } } else { SetLC(lc); } break; } case cpcSetStopSize: { if (params.size() != (1 + 1)) return FALSE; BYTE par = params[1]; DWORD lcVal = VAL2LC_STOPBITS(p2v_stopSize(par))|LC_MASK_STOPBITS; lcSend |= LC_MASK_STOPBITS; if (par != 0 && (lc & (VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)) != lcVal) { lc &= ~(VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS); if (goMask & GO_RLC_STATUS) { *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_RLC_STATUS, lcVal); if (!*ppMsg || (soMask & SO_SET_LC) == 0) { SetLC(lcVal); return FALSE; } } else { SetLC(lcVal); return FALSE; } } else { SetLC(lc); } break; } case cpcSetControl: { if (params.size() != (1 + 1)) return FALSE; switch (params[1]) { case scReqBreakState: brkSend = TRUE; SetBreak(brk); break; case scSetBreakOn: case scSetBreakOff: brkSend = TRUE; SetBreak(params[1] == scSetBreakOn); if ((goMask & GO_BREAK_STATUS) == 0) return FALSE; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_BREAK_STATUS, params[1] == scSetBreakOn); break; case scReqDtrState: mcrSend |= SPS_P2V_MCR(PIN_STATE_DTR); SetMCR(mcr, mcrMask); break; case scSetDtrOn: 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) return FALSE; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, (params[1] == scSetDtrOn ? MODEM_STATUS_DSR : 0) | VAL2MASK(MODEM_STATUS_DSR)); break; case scReqRtsState: mcrSend |= SPS_P2V_MCR(PIN_STATE_RTS); SetMCR(mcr, mcrMask); break; case scSetRtsOn: 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) return FALSE; *ppMsg = FlushDecodedStream(*ppMsg); if (!*ppMsg) return FALSE; *ppMsg = pMsgInsertVal(*ppMsg, HUB_MSG_TYPE_MODEM_STATUS, (params[1] == scSetRtsOn ? MODEM_STATUS_CTS : 0) | VAL2MASK(MODEM_STATUS_CTS)); break; default: return FALSE; } break; } case cpcFlowControlSuspend: return FALSE; break; case cpcFlowControlResume: return FALSE; break; case cpcSetLineStateMask: { if (params.size() != (1 + 1)) return FALSE; lsrMask = (params[1] & SO_O2V_LINE_STATUS(soMask)); BYTE_vector answer; answer.push_back((BYTE)(cpcSetLineStateMask + cpcServerBase)); answer.push_back(lsrMask); SendSubNegotiation(answer); break; } case cpcSetModemStateMask: { if (params.size() != (1 + 1)) return FALSE; mstMask = (params[1] & SPS_P2V_MST(SO_O2V_PIN_STATE(soMask))); BYTE_vector answer; answer.push_back((BYTE)(cpcSetModemStateMask + cpcServerBase)); answer.push_back(mstMask); SendSubNegotiation(answer); break; } case cpcPurgeData: { BYTE_vector answer = params; answer[0] += cpcServerBase; SendSubNegotiation(answer); return FALSE; break; } default: return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// --- NEW FILE: opt_comport.h --- /* * $Id: opt_comport.h,v 1.1 2008/10/24 06:51:23 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: opt_comport.h,v $ * Revision 1.1 2008/10/24 06:51:23 vfrolov * Initial revision * */ #ifndef _OPT_COMPORT_H #define _OPT_COMPORT_H #include "telnet.h" /////////////////////////////////////////////////////////////// class TelnetOptionComPort : public TelnetOption { public: TelnetOptionComPort(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask); virtual void SetBR(DWORD br) = 0; virtual void SetLC(DWORD lc) = 0; virtual void NotifyMST(BYTE mst) = 0; virtual void NotifyLSR(BYTE lsr) = 0; virtual void SetMCR(BYTE mcr, BYTE mask) = 0; virtual void SetBreak(BOOL on) = 0; protected: DWORD &goMask; DWORD &soMask; }; /////////////////////////////////////////////////////////////// class TelnetOptionComPortClient : public TelnetOptionComPort { public: TelnetOptionComPortClient(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask); virtual void SetBR(DWORD br); virtual void SetLC(DWORD lc); virtual void NotifyMST(BYTE /*mst*/) { _ASSERTE(FALSE); return; } virtual void NotifyLSR(BYTE /*lsr*/) { _ASSERTE(FALSE); return; } virtual void SetMCR(BYTE mcr, BYTE mask); virtual void SetBreak(BOOL on); protected: virtual BOOL OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg); }; /////////////////////////////////////////////////////////////// class TelnetOptionComPortServer : public TelnetOptionComPort { public: TelnetOptionComPortServer(TelnetProtocol &_telnet, DWORD &_goMask, DWORD &_soMask); virtual void SetBR(DWORD _br); virtual void SetLC(DWORD _lc); virtual void NotifyMST(BYTE _mst); virtual void NotifyLSR(BYTE lsr); virtual void SetMCR(BYTE _mcr, BYTE mask); virtual void SetBreak(BOOL on); protected: virtual BOOL OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg); protected: DWORD br; BOOL brSend; DWORD lc; DWORD lcSend; BYTE mst; BYTE mstMask; BYTE lsrMask; BYTE mcr; BYTE mcrMask; BYTE mcrSend; BOOL brk; BOOL brkSend; }; /////////////////////////////////////////////////////////////// #endif // _OPT_COMPORT_H --- NEW FILE: opt_termtype.h --- /* * $Id: opt_termtype.h,v 1.1 2008/10/24 06:51:23 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: opt_termtype.h,v $ * Revision 1.1 2008/10/24 06:51:23 vfrolov * Initial revision * */ #ifndef _OPT_TERMTYPE_H #define _OPT_TERMTYPE_H #include "telnet.h" /////////////////////////////////////////////////////////////// class TelnetOptionTerminalType : public TelnetOption { public: TelnetOptionTerminalType(TelnetProtocol &_telnet, const char *pTerminalType); protected: virtual BOOL OnSubNegotiation(const BYTE_vector ¶ms, HUB_MSG **ppMsg); BYTE_vector terminalType; }; /////////////////////////////////////////////////////////////// #endif // _OPT_TERMTYPE_H |
From: Vyacheslav F. <vf...@us...> - 2008-10-22 15:31:47
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32631 Modified Files: comio.cpp comio.h comport.cpp Log Message: Fixed race condition Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comport.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comport.cpp 6 Oct 2008 12:15:14 -0000 1.5 --- comport.cpp 22 Oct 2008 15:31:38 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/10/22 15:31:38 vfrolov + * Fixed race condition + * * Revision 1.5 2008/10/06 12:15:14 vfrolov * Added --reconnect option *************** *** 68,72 **** if (!pOverlapped->StartWaitEvent()) { ! delete pOverlapped; return FALSE; } --- 71,75 ---- if (!pOverlapped->StartWaitEvent()) { ! pOverlapped->Delete(); return FALSE; } *************** *** 379,383 **** if (!pOverlapped->StartWaitEvent()) { ! delete pOverlapped; return FALSE; } --- 382,386 ---- if (!pOverlapped->StartWaitEvent()) { ! pOverlapped->Delete(); return FALSE; } *************** *** 479,483 **** } ! delete pOverlapped; return FALSE; } --- 482,486 ---- } ! pOverlapped->Delete(); return FALSE; } *************** *** 487,491 **** OnConnect(); } else { ! delete pOverlapped; return FALSE; } --- 490,494 ---- OnConnect(); } else { ! pOverlapped->Delete(); return FALSE; } Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comio.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comio.h 26 Aug 2008 14:07:01 -0000 1.2 --- comio.h 22 Oct 2008 15:31:38 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/10/22 15:31:38 vfrolov + * Fixed race condition + * * Revision 1.2 2008/08/26 14:07:01 vfrolov * Execute OnEvent() in main thread context *************** *** 77,85 **** }; /////////////////////////////////////////////////////////////// ! class WaitEventOverlapped { public: WaitEventOverlapped(ComPort &_port, SOCKET hSockWait); ! ~WaitEventOverlapped(); BOOL StartWaitEvent(); --- 80,125 ---- }; /////////////////////////////////////////////////////////////// ! class SafeDelete ! { ! protected: ! SafeDelete() : deleted(FALSE), locked(0) {} ! ! virtual ~SafeDelete() {} ! ! void Delete() { ! _ASSERTE(locked >= 0); ! ! if (locked <= 0) ! delete this; ! else ! deleted = TRUE; ! } ! ! void LockDelete() { locked++; } ! BOOL UnockDelete() { ! locked--; ! ! _ASSERTE(locked >= 0); ! ! if (deleted) { ! if (locked <= 0) ! delete this; ! ! return FALSE; ! } ! ! return TRUE; ! } ! ! private: ! BOOL deleted; ! int locked; ! }; ! /////////////////////////////////////////////////////////////// ! class WaitEventOverlapped : public SafeDelete { public: WaitEventOverlapped(ComPort &_port, SOCKET hSockWait); ! void Delete(); BOOL StartWaitEvent(); *************** *** 96,106 **** HANDLE hWait; HANDLE hEvent; }; /////////////////////////////////////////////////////////////// ! class ListenOverlapped { public: ListenOverlapped(Listener &_listener, SOCKET hSockWait); ! ~ListenOverlapped(); BOOL StartWaitEvent(); --- 136,151 ---- HANDLE hWait; HANDLE hEvent; + + #ifdef _DEBUG + private: + ~WaitEventOverlapped() {} + #endif /* _DEBUG */ }; /////////////////////////////////////////////////////////////// ! class ListenOverlapped : public SafeDelete { public: ListenOverlapped(Listener &_listener, SOCKET hSockWait); ! void Delete(); BOOL StartWaitEvent(); *************** *** 117,120 **** --- 162,170 ---- HANDLE hWait; HANDLE hEvent; + + #ifdef _DEBUG + private: + ~ListenOverlapped() {} + #endif /* _DEBUG */ }; /////////////////////////////////////////////////////////////// Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comio.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comio.cpp 6 Oct 2008 12:12:29 -0000 1.3 --- comio.cpp 22 Oct 2008 15:31:38 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/10/22 15:31:38 vfrolov + * Fixed race condition + * * Revision 1.3 2008/10/06 12:12:29 vfrolov * Duplicated code moved to SetThread() *************** *** 339,343 **** } ! WaitEventOverlapped::~WaitEventOverlapped() { if (hSock != INVALID_SOCKET) { --- 342,346 ---- } ! void WaitEventOverlapped::Delete() { if (hSock != INVALID_SOCKET) { *************** *** 374,377 **** --- 377,382 ---- } } + + SafeDelete::Delete(); } *************** *** 380,384 **** BOOLEAN /*timerOrWaitFired*/) { ! ::QueueUserAPC(OnEvent, hThread, (ULONG_PTR)pOverlapped); } --- 385,390 ---- BOOLEAN /*timerOrWaitFired*/) { ! if (::QueueUserAPC(OnEvent, hThread, (ULONG_PTR)pOverlapped)) ! ((WaitEventOverlapped *)pOverlapped)->LockDelete(); } *************** *** 387,390 **** --- 393,399 ---- WaitEventOverlapped *pOver = (WaitEventOverlapped *)pOverlapped; + if (!pOver->UnockDelete()) + return; + WSANETWORKEVENTS events; *************** *** 460,464 **** } ! ListenOverlapped::~ListenOverlapped() { if (hSock != INVALID_SOCKET) { --- 469,473 ---- } ! void ListenOverlapped::Delete() { if (hSock != INVALID_SOCKET) { *************** *** 492,495 **** --- 501,506 ---- } } + + SafeDelete::Delete(); } *************** *** 498,502 **** BOOLEAN /*timerOrWaitFired*/) { ! ::QueueUserAPC(OnEvent, hThread, (ULONG_PTR)pOverlapped); } --- 509,514 ---- BOOLEAN /*timerOrWaitFired*/) { ! if (::QueueUserAPC(OnEvent, hThread, (ULONG_PTR)pOverlapped)) ! ((ListenOverlapped *)pOverlapped)->LockDelete(); } *************** *** 505,508 **** --- 517,523 ---- ListenOverlapped *pOver = (ListenOverlapped *)pOverlapped; + if (!pOver->UnockDelete()) + return; + WSANETWORKEVENTS events; |
From: Vyacheslav F. <vf...@us...> - 2008-10-22 09:17:34
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1797/serial Modified Files: comio.cpp comio.h comport.cpp Log Message: Added ability to set bytesize, parity and stopbits separately Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** comport.cpp 16 Oct 2008 16:04:39 -0000 1.13 --- comport.cpp 22 Oct 2008 08:27:26 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2008/10/22 08:27:26 vfrolov + * Added ability to set bytesize, parity and stopbits separately + * * Revision 1.13 2008/10/16 16:04:39 vfrolov * Added LBR_STATUS and LLC_STATUS *************** *** 559,570 **** return FALSE; ! DWORD oldVal = pComIo->GetLineControl();; DWORD curVal = pComIo->SetLineControl(pMsg->u.val); ! if (curVal != pMsg->u.val) { cerr << name << " WARNING: can't change" << hex << " line control 0x" << oldVal ! << " to 0x" << pMsg->u.val << " (current=0x" << curVal << ")" << dec --- 562,584 ---- return FALSE; ! DWORD oldVal = pComIo->GetLineControl(); DWORD curVal = pComIo->SetLineControl(pMsg->u.val); ! DWORD mask = (pMsg->u.val & (LC_MASK_BYTESIZE|LC_MASK_PARITY|LC_MASK_STOPBITS)); ! ! if (mask & LC_MASK_BYTESIZE) ! mask |= VAL2LC_BYTESIZE(-1); ! ! if (mask & LC_MASK_PARITY) ! mask |= VAL2LC_PARITY(-1); ! ! if (mask & LC_MASK_STOPBITS) ! mask |= VAL2LC_STOPBITS(-1); ! ! if ((curVal & mask) != (pMsg->u.val & mask)) { cerr << name << " WARNING: can't change" << hex << " line control 0x" << oldVal ! << " to 0x" << (pMsg->u.val | (oldVal & ~mask)) << " (current=0x" << curVal << ")" << dec *************** *** 572,576 **** } ! if (oldVal != curVal) { if (inOptions & GO_LLC_STATUS) { HUB_MSG msg; --- 586,601 ---- } ! DWORD changes = (oldVal ^ curVal); ! ! if (changes) { ! if ((changes & (VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE)) == 0) ! curVal &= ~(VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE); ! ! if ((changes & (VAL2LC_PARITY(-1)|LC_MASK_PARITY)) == 0) ! curVal &= ~(VAL2LC_PARITY(-1)|LC_MASK_PARITY); ! ! if ((changes & (VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)) == 0) ! curVal &= ~(VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS); ! if (inOptions & GO_LLC_STATUS) { HUB_MSG msg; Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comio.h 30 Sep 2008 08:28:32 -0000 1.7 --- comio.h 22 Oct 2008 08:27:26 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/10/22 08:27:26 vfrolov + * Added ability to set bytesize, parity and stopbits separately + * * Revision 1.7 2008/09/30 08:28:32 vfrolov * Added ability to control OUT1 and OUT2 pins *************** *** 99,104 **** DWORD GetLineControl() const { return (VAL2LC_BYTESIZE(dcb.ByteSize) |VAL2LC_PARITY(dcb.Parity) ! |VAL2LC_STOPBITS(dcb.StopBits)); } --- 102,110 ---- 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); } Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** comio.cpp 7 Oct 2008 09:26:00 -0000 1.10 --- comio.cpp 22 Oct 2008 08:27:26 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/10/22 08:27:26 vfrolov + * Added ability to set bytesize, parity and stopbits separately + * * Revision 1.10 2008/10/07 09:26:00 vfrolov * Fixed reseting MCR by setting BR or LC *************** *** 443,447 **** DWORD ComIo::SetLineControl(DWORD lineControl) { ! _ASSERTE((lineControl & ~(VAL2LC_BYTESIZE(-1)|VAL2LC_PARITY(-1)|VAL2LC_STOPBITS(-1))) == 0); if (GetLineControl() == lineControl) --- 446,452 ---- DWORD ComIo::SetLineControl(DWORD lineControl) { ! _ASSERTE((lineControl & ~(VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE ! |VAL2LC_PARITY(-1)|LC_MASK_PARITY ! |VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)) == 0); if (GetLineControl() == lineControl) *************** *** 451,457 **** SERIAL_LINE_CONTROL serialLineControl; ! serialLineControl.WordLength = LC2VAL_BYTESIZE(lineControl); ! serialLineControl.Parity = LC2VAL_PARITY(lineControl); ! serialLineControl.StopBits = LC2VAL_STOPBITS(lineControl); if (!DeviceIoControl(handle, --- 456,473 ---- 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, |
From: Vyacheslav F. <vf...@us...> - 2008-10-22 08:31:55
|
Update of /cvsroot/com0com/hub4com/plugins/escinsert In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1797/escinsert Modified Files: filter.cpp Log Message: Added ability to set bytesize, parity and stopbits separately Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escinsert/filter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.cpp 16 Oct 2008 09:24:23 -0000 1.3 --- filter.cpp 22 Oct 2008 08:27:26 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/10/22 08:27:26 vfrolov + * Added ability to set bytesize, parity and stopbits separately + * * Revision 1.3 2008/10/16 09:24:23 vfrolov * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL *************** *** 63,75 **** State() : isConnected(FALSE), ! mstVal(0), ! lsrVal(0), ! br(CBR_19200), ! lc(VAL2LC_BYTESIZE(8)|VAL2LC_PARITY(NOPARITY)|VAL2LC_STOPBITS(ONESTOPBIT)) {} BOOL isConnected; ! BYTE mstVal; ! BYTE lsrVal; DWORD br; DWORD lc; --- 66,78 ---- State() : isConnected(FALSE), ! soMask(0), ! pinState(0), ! br(0), ! lc(0) {} BOOL isConnected; ! DWORD soMask; ! WORD pinState; DWORD br; DWORD lc; *************** *** 92,97 **** Filter::Filter(int argc, const char *const argv[]) ! : soMask(SO_V2O_PIN_STATE(PIN_STATE_CTS|PIN_STATE_DSR|PIN_STATE_DCD|PIN_STATE_RI|PIN_STATE_BREAK) | ! SO_V2O_LINE_STATUS(LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) | SO_SET_BR|SO_SET_LC), escapeChar(0xFF) --- 95,100 ---- Filter::Filter(int argc, const char *const argv[]) ! : soMask(SO_V2O_PIN_STATE(SPS_V2P_MST(-1)|PIN_STATE_BREAK) | ! SO_V2O_LINE_STATUS(-1) | SO_SET_BR|SO_SET_LC), escapeChar(0xFF) *************** *** 195,199 **** /////////////////////////////////////////////////////////////// static void InsertStatus( ! Filter &filter, BYTE code, BYTE val, --- 198,202 ---- /////////////////////////////////////////////////////////////// static void InsertStatus( ! BYTE escapeChar, BYTE code, BYTE val, *************** *** 202,206 **** BYTE insert[3]; ! insert[0] = filter.escapeChar; insert[1] = code; insert[2] = val; --- 205,209 ---- BYTE insert[3]; ! insert[0] = escapeChar; insert[1] = code; insert[2] = val; *************** *** 213,217 **** /////////////////////////////////////////////////////////////// static void InsertRBR( ! Filter &filter, ULONG rbr, HUB_MSG **ppMsg) --- 216,220 ---- /////////////////////////////////////////////////////////////// static void InsertRBR( ! BYTE escapeChar, ULONG rbr, HUB_MSG **ppMsg) *************** *** 219,223 **** BYTE insert[2 + sizeof(ULONG)]; ! insert[0] = filter.escapeChar; insert[1] = C0CE_INSERT_RBR; *(ULONG *)&insert[2] = rbr; --- 222,226 ---- BYTE insert[2 + sizeof(ULONG)]; ! insert[0] = escapeChar; insert[1] = C0CE_INSERT_RBR; *(ULONG *)&insert[2] = rbr; *************** *** 230,234 **** /////////////////////////////////////////////////////////////// static void InsertRLC( ! Filter &filter, DWORD rlc, HUB_MSG **ppMsg) --- 233,237 ---- /////////////////////////////////////////////////////////////// static void InsertRLC( ! BYTE escapeChar, DWORD rlc, HUB_MSG **ppMsg) *************** *** 236,240 **** BYTE insert[2 + 3]; ! insert[0] = filter.escapeChar; insert[1] = C0CE_INSERT_RLC; insert[2] = LC2VAL_BYTESIZE(rlc); --- 239,243 ---- BYTE insert[2 + 3]; ! insert[0] = escapeChar; insert[1] = C0CE_INSERT_RLC; insert[2] = LC2VAL_BYTESIZE(rlc); *************** *** 275,290 **** } ! // init state ! if (((Filter *)hFilter)->soMask & SO_V2O_PIN_STATE(SPS_V2P_MST(-1))) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_MST, pState->mstVal, ppEchoMsg); ! if (((Filter *)hFilter)->soMask & (SO_V2O_LINE_STATUS(-1) | SO_V2O_PIN_STATE(PIN_STATE_BREAK))) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, pState->lsrVal, ppEchoMsg); ! if (((Filter *)hFilter)->soMask & SO_SET_BR) ! InsertRBR(*(Filter *)hFilter, pState->br, ppEchoMsg); ! if (((Filter *)hFilter)->soMask & SO_SET_LC) ! InsertRLC(*(Filter *)hFilter, pState->lc, ppEchoMsg); break; --- 278,300 ---- } ! // Insert current state ! if ((pState->soMask & SO_SET_BR) && pState->br != 0) ! InsertRBR(((Filter *)hFilter)->escapeChar, pState->br, ppEchoMsg); ! if ((pState->soMask & SO_SET_LC) && ! (pState->lc & (LC_MASK_BYTESIZE|LC_MASK_PARITY|LC_MASK_STOPBITS)) == (LC_MASK_BYTESIZE|LC_MASK_PARITY|LC_MASK_STOPBITS)) ! { ! InsertRLC(((Filter *)hFilter)->escapeChar, pState->lc, ppEchoMsg); ! } ! if (pState->soMask & SO_V2O_PIN_STATE(SPS_V2P_MST(-1))) ! InsertStatus(((Filter *)hFilter)->escapeChar, SERIAL_LSRMST_MST, SPS_P2V_MST(pState->pinState), ppEchoMsg); ! ! if (pState->soMask & (SO_V2O_LINE_STATUS(-1) | SO_V2O_PIN_STATE(PIN_STATE_BREAK))) { ! BYTE brk = (pState->pinState & PIN_STATE_BREAK) ? LINE_STATUS_BI : 0; ! ! InsertStatus(((Filter *)hFilter)->escapeChar, SERIAL_LSRMST_LSR_NODATA, brk, ppEchoMsg); ! } break; *************** *** 305,314 **** switch (pOutMsg->type) { ! case HUB_MSG_TYPE_SET_OUT_OPTS: // discard supported options pOutMsg->u.val &= ~((Filter *)hFilter)->soMask; break; ! case HUB_MSG_TYPE_SET_BR: ! if (((Filter *)hFilter)->soMask & SO_SET_BR) { DWORD val = pOutMsg->u.val; --- 315,342 ---- switch (pOutMsg->type) { ! case HUB_MSG_TYPE_SET_OUT_OPTS: { ! DWORD soMask = (pOutMsg->u.val & ((Filter *)hFilter)->soMask); ! // discard supported options pOutMsg->u.val &= ~((Filter *)hFilter)->soMask; + + State *pState = ((Filter *)hFilter)->GetState(nToPort); + + if (!pState) + return FALSE; + + pState->soMask |= soMask; + break; ! } ! case HUB_MSG_TYPE_SET_BR: { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! ! if (!pState) ! return FALSE; ! ! _ASSERTE(((pState->soMask | ~((Filter *)hFilter)->soMask) & SO_SET_BR) != 0); ! ! if (pState->soMask & SO_SET_BR) { DWORD val = pOutMsg->u.val; *************** *** 317,338 **** return FALSE; - State *pState = ((Filter *)hFilter)->GetState(nToPort); - - if (!pState) - return FALSE; - if (pState->br != val) { pState->br = val; if (pState->isConnected) ! InsertRBR(*(Filter *)hFilter, pState->br, &pOutMsg); } } break; ! case HUB_MSG_TYPE_SET_LC: ! _ASSERTE((pOutMsg->u.val & ~(VAL2LC_BYTESIZE(-1)|VAL2LC_PARITY(-1)|VAL2LC_STOPBITS(-1))) == 0); ! if (((Filter *)hFilter)->soMask & SO_SET_LC) { DWORD val = pOutMsg->u.val; --- 345,371 ---- return FALSE; if (pState->br != val) { pState->br = val; if (pState->isConnected) ! InsertRBR(((Filter *)hFilter)->escapeChar, pState->br, &pOutMsg); } } break; ! } ! case HUB_MSG_TYPE_SET_LC: { ! _ASSERTE((pOutMsg->u.val & ~(VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE ! |VAL2LC_PARITY(-1)|LC_MASK_PARITY ! |VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)) == 0); ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! ! if (!pState) ! return FALSE; ! ! _ASSERTE(((pState->soMask | ~((Filter *)hFilter)->soMask) & SO_SET_LC) != 0); ! ! if (pState->soMask & SO_SET_LC) { DWORD val = pOutMsg->u.val; *************** *** 341,348 **** return FALSE; ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; if (pState->lc != val) { --- 374,391 ---- return FALSE; ! if ((val & LC_MASK_BYTESIZE) == 0) { ! _ASSERTE((val & VAL2LC_BYTESIZE(-1)) == 0); ! val |= (pState->lc & (VAL2LC_BYTESIZE(-1)|LC_MASK_BYTESIZE)); ! } ! if ((val & LC_MASK_PARITY) == 0) { ! _ASSERTE((val & VAL2LC_PARITY(-1)) == 0); ! val |= (pState->lc & (VAL2LC_PARITY(-1)|LC_MASK_PARITY)); ! } ! ! if ((val & LC_MASK_STOPBITS) == 0) { ! _ASSERTE((val & VAL2LC_STOPBITS(-1)) == 0); ! val |= (pState->lc & (VAL2LC_STOPBITS(-1)|LC_MASK_STOPBITS)); ! } if (pState->lc != val) { *************** *** 350,398 **** if (pState->isConnected) ! InsertRLC(*(Filter *)hFilter, pState->lc, &pOutMsg); } } break; case HUB_MSG_TYPE_SET_PIN_STATE: { ! WORD mask = MASK2VAL(pOutMsg->u.val) & SO_O2V_PIN_STATE(((Filter *)hFilter)->soMask); if (!mask) break; ! WORD val = (WORD)pOutMsg->u.val; // discard settings for supported options pOutMsg->u.val &= ~VAL2MASK(mask); ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! ! if (!pState) ! return FALSE; ! ! BYTE mstMask = SPS_P2V_MST(mask); ! ! if (mstMask) { ! BYTE mstVal; ! mstVal = ((SPS_P2V_MST(val) & mstMask) | (pState->mstVal & ~mstMask)); ! mstMask = pState->mstVal ^ mstVal; ! if (mstMask) { ! if (pState->isConnected) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_MST, mstVal, &pOutMsg); ! pState->mstVal = mstVal; } - } ! if (mask & PIN_STATE_BREAK) { ! pState->lsrVal = (val & PIN_STATE_BREAK) ? LINE_STATUS_BI : 0; ! ! if (pState->isConnected && (!pState->lsrVal || ! (((Filter *)hFilter)->soMask & SO_V2O_LINE_STATUS(LINE_STATUS_BI)) == 0)) ! { ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, pState->lsrVal, &pOutMsg); ! } } --- 393,437 ---- if (pState->isConnected) ! InsertRLC(((Filter *)hFilter)->escapeChar, pState->lc, &pOutMsg); } } break; + } case HUB_MSG_TYPE_SET_PIN_STATE: { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! ! if (!pState) ! return FALSE; ! ! _ASSERTE(((pState->soMask | ~((Filter *)hFilter)->soMask) & SO_V2O_PIN_STATE(-1)) != 0); ! ! WORD mask = MASK2VAL(pOutMsg->u.val) & SO_O2V_PIN_STATE(pState->soMask); if (!mask) break; ! WORD pinState = (WORD)pOutMsg->u.val; // discard settings for supported options pOutMsg->u.val &= ~VAL2MASK(mask); ! pinState = ((pinState & mask) | (pState->pinState & ~mask)); ! mask = pState->pinState ^ pinState; ! if (mask) { ! if (pState->isConnected) { ! if (SPS_P2V_MST(mask)) ! InsertStatus(((Filter *)hFilter)->escapeChar, SERIAL_LSRMST_MST, SPS_P2V_MST(pinState), &pOutMsg); ! if (mask & PIN_STATE_BREAK) { ! BYTE brk = (pinState & PIN_STATE_BREAK) ? LINE_STATUS_BI : 0; ! if (!brk || (pState->soMask & SO_V2O_LINE_STATUS(LINE_STATUS_BI)) == 0) ! InsertStatus(((Filter *)hFilter)->escapeChar, SERIAL_LSRMST_LSR_NODATA, brk, &pOutMsg); ! } } ! pState->pinState = pinState; } *************** *** 400,420 **** } case HUB_MSG_TYPE_SET_LSR: { BYTE lsr; ! lsr = (BYTE)pOutMsg->u.val & (BYTE)MASK2VAL(pOutMsg->u.val) & SO_O2V_LINE_STATUS(((Filter *)hFilter)->soMask); // discard settings for supported options ! pOutMsg->u.val &= ~VAL2MASK(SO_O2V_LINE_STATUS(((Filter *)hFilter)->soMask)); if (!lsr) break; - State *pState = ((Filter *)hFilter)->GetState(nToPort); - - if (!pState) - return FALSE; - if (pState->isConnected) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, lsr, &pOutMsg); break; --- 439,461 ---- } case HUB_MSG_TYPE_SET_LSR: { + State *pState = ((Filter *)hFilter)->GetState(nToPort); + + if (!pState) + return FALSE; + + _ASSERTE(((pState->soMask | ~((Filter *)hFilter)->soMask) & SO_V2O_LINE_STATUS(-1)) != 0); + BYTE lsr; ! lsr = (BYTE)pOutMsg->u.val & (BYTE)MASK2VAL(pOutMsg->u.val) & SO_O2V_LINE_STATUS(pState->soMask); // discard settings for supported options ! pOutMsg->u.val &= ~VAL2MASK(SO_O2V_LINE_STATUS(pState->soMask)); if (!lsr) break; if (pState->isConnected) ! InsertStatus(((Filter *)hFilter)->escapeChar, SERIAL_LSRMST_LSR_NODATA, lsr, &pOutMsg); break; *************** *** 445,449 **** } ! if(!pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) return FALSE; --- 486,490 ---- } ! if (!pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) return FALSE; |
From: Vyacheslav F. <vf...@us...> - 2008-10-22 08:30:11
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1797 Modified Files: plugins_api.h Log Message: Added ability to set bytesize, parity and stopbits separately Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** plugins_api.h 16 Oct 2008 16:01:40 -0000 1.15 --- plugins_api.h 22 Oct 2008 08:27:26 -0000 1.16 *************** *** 42,45 **** --- 42,48 ---- #define HUB_MSG_VAL_TYPE_UINT 0x0400 #define HUB_MSG_VAL_TYPE_LC 0x0500 + #define LC_MASK_BYTESIZE ((DWORD)1 << 24) + #define LC_MASK_PARITY ((DWORD)1 << 25) + #define LC_MASK_STOPBITS ((DWORD)1 << 26) #define LC2VAL_BYTESIZE(t) ((BYTE)((t))) #define VAL2LC_BYTESIZE(v) ((DWORD)(BYTE)(v)) |
From: Vyacheslav F. <vf...@us...> - 2008-10-22 08:28:35
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1797/escparse Modified Files: filter.cpp Log Message: Added ability to set bytesize, parity and stopbits separately Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escparse/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 16 Oct 2008 09:24:23 -0000 1.4 --- filter.cpp 22 Oct 2008 08:27:26 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/10/22 08:27:26 vfrolov + * Added ability to set bytesize, parity and stopbits separately + * * Revision 1.4 2008/10/16 09:24:23 vfrolov * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL *************** *** 151,155 **** // discard original data from the stream ! if(!pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0)) return NULL; --- 154,158 ---- // discard original data from the stream ! if (!pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0)) return NULL; *************** *** 271,277 **** return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_RLC_STATUS, ! (VAL2LC_BYTESIZE(data[0]) ! |VAL2LC_PARITY(data[1]) ! |VAL2LC_STOPBITS(data[2]))); if (!pMsg) return NULL; --- 274,280 ---- return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_RLC_STATUS, ! (VAL2LC_BYTESIZE(data[0])|LC_MASK_BYTESIZE ! |VAL2LC_PARITY(data[1])|LC_MASK_PARITY ! |VAL2LC_STOPBITS(data[2])|LC_MASK_STOPBITS)); if (!pMsg) return NULL; *************** *** 525,529 **** // hide this message from subsequent filters ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; --- 528,532 ---- // hide this message from subsequent filters ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; *************** *** 549,553 **** // hide this message from subsequent filters ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; --- 552,556 ---- // hide this message from subsequent filters ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; *************** *** 616,620 **** if (pEscParse->Options() & GO_RBR_STATUS) { // discard any status settings controlled by this filter ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } --- 619,623 ---- if (pEscParse->Options() & GO_RBR_STATUS) { // discard any status settings controlled by this filter ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } *************** *** 629,633 **** if (pEscParse->Options() & GO_RLC_STATUS) { // discard any status settings controlled by this filter ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } --- 632,636 ---- if (pEscParse->Options() & GO_RLC_STATUS) { // discard any status settings controlled by this filter ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } *************** *** 642,646 **** if (pEscParse->Options() & GO_BREAK_STATUS) { // discard any status settings controlled by this filter ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } --- 645,649 ---- if (pEscParse->Options() & GO_BREAK_STATUS) { // discard any status settings controlled by this filter ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) return FALSE; } |
From: Vyacheslav F. <vf...@us...> - 2008-10-22 08:28:29
|
Update of /cvsroot/com0com/hub4com/plugins/linectl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1797/linectl Modified Files: filter.cpp Log Message: Added ability to set bytesize, parity and stopbits separately Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 16 Oct 2008 16:06:30 -0000 1.4 --- filter.cpp 22 Oct 2008 08:27:26 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/10/22 08:27:26 vfrolov + * Added ability to set bytesize, parity and stopbits separately + * * Revision 1.4 2008/10/16 16:06:30 vfrolov * Added --br and --lc options *************** *** 62,81 **** }; /////////////////////////////////////////////////////////////// - class State { - public: - State() - : br(CBR_19200), - lc(VAL2LC_BYTESIZE(8)|VAL2LC_PARITY(NOPARITY)|VAL2LC_PARITY(ONESTOPBIT)) - {} - - ULONG br; - DWORD lc; - }; - /////////////////////////////////////////////////////////////// class Filter : public Valid { public: Filter(int argc, const char *const argv[]); void SetHub(HHUB _hHub) { hHub = _hHub; } - State *GetState(int nPort); const char *PortName(int nPort) const { return pPortName(hHub, nPort); } const char *FilterName() const { return pFilterName(hHub, (HFILTER)this); } --- 65,72 ---- *************** *** 87,95 **** HHUB hHub; - typedef map<int, State*> PortsMap; - typedef pair<int, State*> PortPair; - - PortsMap portsMap; - void Parse(const char *pArg); }; --- 78,81 ---- *************** *** 158,180 **** } } - - State *Filter::GetState(int nPort) - { - PortsMap::iterator iPair = portsMap.find(nPort); - - if (iPair == portsMap.end()) { - portsMap.insert(PortPair(nPort, NULL)); - - iPair = portsMap.find(nPort); - - if (iPair == portsMap.end()) - return NULL; - } - - if (!iPair->second) - iPair->second = new State(); - - return iPair->second; - } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() --- 144,147 ---- *************** *** 265,280 **** // or'e with the required mask to set pOutMsg->u.val |= ((Filter *)hFilter)->soOutMask; - - State *pState = ((Filter *)hFilter)->GetState(nToPort); - - if (!pState) - return FALSE; - - // init baudrate and line control - if (((Filter *)hFilter)->soOutMask & SO_SET_BR) - pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_BR, pState->br); - if (((Filter *)hFilter)->soOutMask & SO_SET_LC) - pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_LC, pState->lc); - break; } --- 232,235 ---- *************** *** 313,359 **** break; case HUB_MSG_TYPE_LBR_STATUS: ! case HUB_MSG_TYPE_RBR_STATUS: { ! if ((((Filter *)hFilter)->soOutMask & SO_SET_BR) && ( ! (pOutMsg->type == HUB_MSG_TYPE_LBR_STATUS && ! (((Filter *)hFilter)->goInMask & GO_LBR_STATUS)) || ! (pOutMsg->type == HUB_MSG_TYPE_RBR_STATUS && ! (((Filter *)hFilter)->goInMask & GO_RBR_STATUS)) ! )) ! { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! if (pState->br != pOutMsg->u.val) { ! pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_BR, pOutMsg->u.val); ! pState->br = pOutMsg->u.val; ! } ! } break; - } case HUB_MSG_TYPE_LLC_STATUS: ! case HUB_MSG_TYPE_RLC_STATUS: { ! if ((((Filter *)hFilter)->soOutMask & SO_SET_LC) && ( ! (pOutMsg->type == HUB_MSG_TYPE_LLC_STATUS && ! (((Filter *)hFilter)->goInMask & GO_LLC_STATUS)) || ! (pOutMsg->type == HUB_MSG_TYPE_RLC_STATUS && ! (((Filter *)hFilter)->goInMask & GO_RLC_STATUS)) ! )) ! { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! _ASSERTE((pOutMsg->u.val & ~(VAL2LC_BYTESIZE(-1)|VAL2LC_PARITY(-1)|VAL2LC_STOPBITS(-1))) == 0); ! if (pState->lc != pOutMsg->u.val) { ! pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_LC, pOutMsg->u.val); ! pState->lc = pOutMsg->u.val; ! } ! } break; - } } --- 268,306 ---- break; case HUB_MSG_TYPE_LBR_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_LBR_STATUS) == 0) ! break; ! if ((((Filter *)hFilter)->soOutMask & SO_SET_BR) == 0) ! break; ! pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_BR, pOutMsg->u.val); ! break; ! case HUB_MSG_TYPE_RBR_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_RBR_STATUS) == 0) ! break; ! ! if ((((Filter *)hFilter)->soOutMask & SO_SET_BR) == 0) ! break; ! ! pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_BR, pOutMsg->u.val); break; case HUB_MSG_TYPE_LLC_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_LLC_STATUS) == 0) ! break; ! if ((((Filter *)hFilter)->soOutMask & SO_SET_LC) == 0) ! break; ! pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_LC, pOutMsg->u.val); ! break; ! case HUB_MSG_TYPE_RLC_STATUS: ! if ((((Filter *)hFilter)->goInMask & GO_RLC_STATUS) == 0) ! break; ! if ((((Filter *)hFilter)->soOutMask & SO_SET_LC) == 0) ! break; ! ! pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_LC, pOutMsg->u.val); break; } |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 16:09:42
|
Update of /cvsroot/com0com/hub4com/examples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20313 Modified Files: com2tcp-esc.bat Log Message: Added --linectl option Index: com2tcp-esc.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/com2tcp-esc.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** com2tcp-esc.bat 16 Oct 2008 07:46:04 -0000 1.2 --- com2tcp-esc.bat 16 Oct 2008 16:09:35 -0000 1.3 *************** *** 21,24 **** --- 21,30 ---- :END_OPTION_INTERFACE + IF /I "%OPTION%" NEQ "--linectl" GOTO END_OPTION_LINECTL + SET LC_CLIENT_MODE=%1 + SHIFT /1 + GOTO BEGIN_PARSE_OPTIONS + :END_OPTION_LINECTL + GOTO USAGE :END_PARSE_OPTIONS *************** *** 37,45 **** --- 43,60 ---- SHIFT /1 + IF /I "%LC_CLIENT_MODE%"=="no" GOTO END_SET_LC_CLIENT_MODE + SET LC_CLIENT_MODE=yes + :END_SET_LC_CLIENT_MODE + IF NOT "%1"=="" GOTO USAGE :END_PARSE_ARGS + IF /I "%LC_CLIENT_MODE%"=="yes" GOTO END_SET_LC_SERVER_MODE_OPTIONS + SET TCP_LC_OPTIONS=:"--br=local --lc=local" + :END_SET_LC_SERVER_MODE_OPTIONS + :SET OPTIONS=%OPTIONS% --create-filter=trace,com,COM SET OPTIONS=%OPTIONS% --create-filter=escparse,com,parse + :SET OPTIONS=%OPTIONS% --create-filter=trace,com,ExM SET OPTIONS=%OPTIONS% --create-filter=pinmap,com,pinmap:"--rts=cts --dtr=dsr --break=break" SET OPTIONS=%OPTIONS% --create-filter=linectl,com,lc *************** *** 53,58 **** :SET OPTIONS=%OPTIONS% --create-filter=trace,tcp,ExM SET OPTIONS=%OPTIONS% --create-filter=pinmap,tcp,pinmap:"--cts=cts --dsr=dsr --ring=ring --dcd=dcd --break=break" ! SET OPTIONS=%OPTIONS% --create-filter=lsrmap,tcp,lsrmap ! SET OPTIONS=%OPTIONS% --create-filter=linectl,tcp,lc SET OPTIONS=%OPTIONS% --add-filters=1:tcp --- 68,72 ---- :SET OPTIONS=%OPTIONS% --create-filter=trace,tcp,ExM SET OPTIONS=%OPTIONS% --create-filter=pinmap,tcp,pinmap:"--cts=cts --dsr=dsr --ring=ring --dcd=dcd --break=break" ! SET OPTIONS=%OPTIONS% --create-filter=linectl,tcp,lc%TCP_LC_OPTIONS% SET OPTIONS=%OPTIONS% --add-filters=1:tcp *************** *** 74,77 **** --- 88,94 ---- ECHO. ECHO Common options: + ECHO --linectl ^{yes^|no^} - enable/disable forwarding of baud rate, data bits, + ECHO parity and stop bits settings from COM port to TCP + ECHO port (default is yes for client mode). ECHO --help - show this help. ECHO. |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 16:06:38
|
Update of /cvsroot/com0com/hub4com/plugins/linectl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20125 Modified Files: filter.cpp Log Message: Added --br and --lc options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/filter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.cpp 16 Oct 2008 09:24:23 -0000 1.3 --- filter.cpp 16 Oct 2008 16:06:30 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/10/16 16:06:30 vfrolov + * Added --br and --lc options + * * Revision 1.3 2008/10/16 09:24:23 vfrolov * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL *************** *** 88,96 **** PortsMap portsMap; }; Filter::Filter(int argc, const char *const argv[]) ! : soOutMask(SO_SET_BR|SO_SET_LC), ! goInMask(GO_RBR_STATUS|GO_RLC_STATUS), hHub(NULL) { --- 91,101 ---- PortsMap portsMap; + + void Parse(const char *pArg); }; Filter::Filter(int argc, const char *const argv[]) ! : soOutMask(0), ! goInMask(0), hHub(NULL) { *************** *** 104,112 **** } ! { ! cerr << "Unknown option --" << pArg << endl; ! Invalidate(); } } } --- 109,160 ---- } ! Parse(pArg); ! } ! ! if (!soOutMask) { ! Parse("br=remote"); ! Parse("lc=remote"); ! } ! } ! ! void Filter::Parse(const char *pArg) ! { ! const char *pParam; ! ! if ((pParam = GetParam(pArg, "br=")) != NULL) { ! soOutMask |= SO_SET_BR; ! ! switch (tolower(*pParam)) { ! case 'l': ! goInMask |= GO_LBR_STATUS; ! break; ! case 'r': ! goInMask |= GO_RBR_STATUS; ! break; ! default: ! cerr << "Invalid option " << pArg << endl; ! Invalidate(); } } + else + if ((pParam = GetParam(pArg, "lc=")) != NULL) { + soOutMask |= SO_SET_LC; + + switch (tolower(*pParam)) { + case 'l': + goInMask |= GO_LLC_STATUS; + break; + case 'r': + goInMask |= GO_RLC_STATUS; + break; + default: + cerr << "Invalid option " << pArg << endl; + Invalidate(); + } + } + else { + cerr << "Unknown option " << pArg << endl; + Invalidate(); + } } *************** *** 154,158 **** << " " << pProgPath << " ... --create-filter=" << GetPluginAbout()->pName << "[,<FID>][:<options>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl << endl ! << "Options:" << endl << endl << "Examples:" << endl --- 202,211 ---- << " " << pProgPath << " ... --create-filter=" << GetPluginAbout()->pName << "[,<FID>][:<options>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl << endl ! << "Wire options:" << endl ! << " --br=<s> - wire input state of <s> baudrate to output one." << endl ! << " --lc=<s> - wire input state of <s> line control to output one." << endl ! << endl ! << " The possible values of <s> above can be l[ocal] or r[emote]. If no any wire" << endl ! << " option specified, then the options --br=remote --lc=remote are used." << endl << endl << "Examples:" << endl *************** *** 198,202 **** return TRUE; } ! static BOOL CALLBACK OutMethod( HFILTER hFilter, --- 251,255 ---- return TRUE; } ! /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, *************** *** 229,233 **** _ASSERTE(pOutMsg->u.pv.pVal != NULL); ! // or'e with the required mask to get remote baudrate and line control *pOutMsg->u.pv.pVal |= (((Filter *)hFilter)->goInMask & pOutMsg->u.pv.val); break; --- 282,286 ---- _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; *************** *** 259,264 **** } break; case HUB_MSG_TYPE_RBR_STATUS: { ! if (((Filter *)hFilter)->soOutMask & SO_SET_BR) { State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 312,324 ---- } break; + case HUB_MSG_TYPE_LBR_STATUS: case HUB_MSG_TYPE_RBR_STATUS: { ! if ((((Filter *)hFilter)->soOutMask & SO_SET_BR) && ( ! (pOutMsg->type == HUB_MSG_TYPE_LBR_STATUS && ! (((Filter *)hFilter)->goInMask & GO_LBR_STATUS)) || ! (pOutMsg->type == HUB_MSG_TYPE_RBR_STATUS && ! (((Filter *)hFilter)->goInMask & GO_RBR_STATUS)) ! )) ! { State *pState = ((Filter *)hFilter)->GetState(nToPort); *************** *** 273,278 **** break; } case HUB_MSG_TYPE_RLC_STATUS: { ! if (((Filter *)hFilter)->soOutMask & SO_SET_LC) { State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 333,345 ---- break; } + case HUB_MSG_TYPE_LLC_STATUS: case HUB_MSG_TYPE_RLC_STATUS: { ! if ((((Filter *)hFilter)->soOutMask & SO_SET_LC) && ( ! (pOutMsg->type == HUB_MSG_TYPE_LLC_STATUS && ! (((Filter *)hFilter)->goInMask & GO_LLC_STATUS)) || ! (pOutMsg->type == HUB_MSG_TYPE_RLC_STATUS && ! (((Filter *)hFilter)->goInMask & GO_RLC_STATUS)) ! )) ! { State *pState = ((Filter *)hFilter)->GetState(nToPort); |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 16:04:46
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19903 Modified Files: comport.cpp Log Message: Added LBR_STATUS and LLC_STATUS Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** comport.cpp 30 Sep 2008 08:28:32 -0000 1.12 --- comport.cpp 16 Oct 2008 16:04:39 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2008/10/16 16:04:39 vfrolov + * Added LBR_STATUS and LLC_STATUS + * * Revision 1.12 2008/09/30 08:28:32 vfrolov * Added ability to control OUT1 and OUT2 pins *************** *** 203,206 **** --- 206,211 ---- TOFIELD2NAME2(GO_, RBR_STATUS), TOFIELD2NAME2(GO_, RLC_STATUS), + TOFIELD2NAME2(GO_, LBR_STATUS), + TOFIELD2NAME2(GO_, LLC_STATUS), TOFIELD2NAME2(GO_, BREAK_STATUS), TOFIELD2NAME2(GO_, ESCAPE_MODE), *************** *** 290,293 **** --- 295,300 ---- GO_RBR_STATUS | GO_RLC_STATUS | + GO_LBR_STATUS | + GO_LLC_STATUS | MODEM_STATUS_CTS | MODEM_STATUS_DSR | *************** *** 343,346 **** --- 350,365 ---- pOnRead(hHub, hMasterPort, &msg); + if (inOptions & GO_LBR_STATUS) { + msg.type = HUB_MSG_TYPE_LBR_STATUS; + msg.u.val = pComIo->GetBaudRate(); + pOnRead(hHub, hMasterPort, &msg); + } + + if (inOptions & GO_LLC_STATUS) { + msg.type = HUB_MSG_TYPE_LLC_STATUS; + msg.u.val = pComIo->GetLineControl(); + pOnRead(hHub, hMasterPort, &msg); + } + if (inOptions & GO_RBR_STATUS) { cerr << name << " WARNING: Suppose remote baud rate is equal local settings" << endl; *************** *** 409,412 **** --- 428,433 ---- GO_RBR_STATUS | GO_RLC_STATUS | + GO_LBR_STATUS | + GO_LLC_STATUS | GO_BREAK_STATUS | GO_V2O_MODEM_STATUS(-1) | *************** *** 515,524 **** } ! if ((inOptions & GO_RBR_STATUS) && oldVal != curVal) { ! HUB_MSG msg; ! msg.type = HUB_MSG_TYPE_RBR_STATUS; ! msg.u.val = curVal; // suppose remote equal local ! pOnRead(hHub, hMasterPort, &msg); } } --- 536,555 ---- } ! if (oldVal != curVal) { ! if (inOptions & GO_LBR_STATUS) { ! HUB_MSG msg; ! msg.type = HUB_MSG_TYPE_LBR_STATUS; ! msg.u.val = curVal; ! pOnRead(hHub, hMasterPort, &msg); ! } ! ! if (inOptions & GO_RBR_STATUS) { ! HUB_MSG msg; ! ! msg.type = HUB_MSG_TYPE_RBR_STATUS; ! msg.u.val = curVal; // suppose remote equal local ! pOnRead(hHub, hMasterPort, &msg); ! } } } *************** *** 541,550 **** } ! if ((inOptions & GO_RLC_STATUS) && oldVal != curVal) { ! HUB_MSG msg; ! msg.type = HUB_MSG_TYPE_RLC_STATUS; ! msg.u.val = curVal; // suppose remote equal local ! pOnRead(hHub, hMasterPort, &msg); } } --- 572,591 ---- } ! if (oldVal != curVal) { ! if (inOptions & GO_LLC_STATUS) { ! HUB_MSG msg; ! msg.type = HUB_MSG_TYPE_LLC_STATUS; ! msg.u.val = curVal; ! pOnRead(hHub, hMasterPort, &msg); ! } ! ! if (inOptions & GO_RLC_STATUS) { ! HUB_MSG msg; ! ! msg.type = HUB_MSG_TYPE_RLC_STATUS; ! msg.u.val = curVal; // suppose remote equal local ! pOnRead(hHub, hMasterPort, &msg); ! } } } |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 16:02:45
|
Update of /cvsroot/com0com/hub4com/plugins/trace In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19576 Modified Files: filter.cpp Log Message: Added LBR_STATUS and LLC_STATUS Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/trace/filter.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** filter.cpp 16 Oct 2008 06:46:13 -0000 1.5 --- filter.cpp 16 Oct 2008 16:02:34 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/10/16 16:02:34 vfrolov + * Added LBR_STATUS and LLC_STATUS + * * Revision 1.5 2008/10/16 06:46:13 vfrolov * Added PIN_STATE_* for DCE *************** *** 414,417 **** --- 417,422 ---- TOCODE2NAME(HUB_MSG_TYPE_, SET_LC), TOCODE2NAME(HUB_MSG_TYPE_, SET_LSR), + TOCODE2NAME(HUB_MSG_TYPE_, LBR_STATUS), + TOCODE2NAME(HUB_MSG_TYPE_, LLC_STATUS), {0, NULL} }; *************** *** 461,464 **** --- 466,471 ---- TOFIELD2NAME2(GO_, RBR_STATUS), TOFIELD2NAME2(GO_, RLC_STATUS), + TOFIELD2NAME2(GO_, LBR_STATUS), + TOFIELD2NAME2(GO_, LLC_STATUS), TOFIELD2NAME2(GO_, BREAK_STATUS), TOFIELD2NAME2(GO_, ESCAPE_MODE), |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 16:01:54
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19454 Modified Files: plugins_api.h Log Message: Added LBR_STATUS and LLC_STATUS Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** plugins_api.h 16 Oct 2008 09:24:23 -0000 1.14 --- plugins_api.h 16 Oct 2008 16:01:40 -0000 1.15 *************** *** 93,96 **** --- 93,98 ---- #define GO_BREAK_STATUS ((DWORD)1 << 18) #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)) *************** *** 114,117 **** --- 116,121 ---- #define HUB_MSG_TYPE_SET_LC (16 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_LC) #define HUB_MSG_TYPE_SET_LSR (17 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_MASK_VAL) + #define HUB_MSG_TYPE_LBR_STATUS (18 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_UINT) + #define HUB_MSG_TYPE_LLC_STATUS (19 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_LC) /*******************************************************************/ typedef struct _HUB_MSG { |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 10:23:34
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins Modified Files: plugins_api.h Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** plugins_api.h 16 Oct 2008 06:45:05 -0000 1.13 --- plugins_api.h 16 Oct 2008 09:24:23 -0000 1.14 *************** *** 138,142 **** typedef VOID (CALLBACK ROUTINE_BUF_FREE)( BYTE *pBuf); ! typedef HUB_MSG *(CALLBACK ROUTINE_MSG_REPLACE_BUF)( HUB_MSG *pMsg, WORD type, --- 138,142 ---- typedef VOID (CALLBACK ROUTINE_BUF_FREE)( BYTE *pBuf); ! typedef BOOL (CALLBACK ROUTINE_MSG_REPLACE_BUF)( HUB_MSG *pMsg, WORD type, *************** *** 148,152 **** const BYTE *pSrc, DWORD sizeSrc); ! typedef HUB_MSG *(CALLBACK ROUTINE_MSG_REPLACE_VAL)( HUB_MSG *pMsg, WORD type, --- 148,152 ---- const BYTE *pSrc, DWORD sizeSrc); ! typedef BOOL (CALLBACK ROUTINE_MSG_REPLACE_VAL)( HUB_MSG *pMsg, WORD type, *************** *** 156,160 **** WORD type, DWORD val); ! typedef HUB_MSG *(CALLBACK ROUTINE_MSG_REPLACE_NONE)( HUB_MSG *pMsg, WORD type); --- 156,160 ---- WORD type, DWORD val); ! typedef BOOL (CALLBACK ROUTINE_MSG_REPLACE_NONE)( HUB_MSG *pMsg, WORD type); |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:27:05
|
Update of /cvsroot/com0com/hub4com/plugins/escinsert In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins/escinsert Modified Files: filter.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escinsert/filter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filter.cpp 16 Oct 2008 07:46:04 -0000 1.2 --- filter.cpp 16 Oct 2008 09:24:23 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.2 2008/10/16 07:46:04 vfrolov * Redesigned escinsert filter to accept SET instead STATUS messages *************** *** 311,315 **** // discard messages for supported options ! pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY); State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 314,319 ---- // discard messages for supported options ! if (!pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; State *pState = ((Filter *)hFilter)->GetState(nToPort); *************** *** 334,338 **** // discard messages for supported options ! pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY); State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 338,343 ---- // discard messages for supported options ! if (!pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; State *pState = ((Filter *)hFilter)->GetState(nToPort); *************** *** 440,447 **** } ! pOutMsg = pMsgReplaceBuf(pOutMsg, ! HUB_MSG_TYPE_LINE_DATA, ! line_data.data(), ! (DWORD)line_data.size()); break; --- 445,450 ---- } ! if(!pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) ! return FALSE; break; |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:27:05
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517 Modified Files: export.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: export.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/export.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** export.cpp 20 Aug 2008 09:06:48 -0000 1.3 --- export.cpp 16 Oct 2008 09:24:23 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.3 2008/08/20 09:06:48 vfrolov * Added HUB_ROUTINES_A::pFilterName *************** *** 49,58 **** } /////////////////////////////////////////////////////////////// ! static HUB_MSG *CALLBACK msg_replace_buf(HUB_MSG *pMsg, WORD type, const BYTE *pSrc, DWORD sizeSrc) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF); if (!pMsg) ! return NULL; if ((pMsg->type & HUB_MSG_UNION_TYPE_MASK) != HUB_MSG_UNION_TYPE_BUF) --- 52,61 ---- } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK msg_replace_buf(HUB_MSG *pMsg, WORD type, const BYTE *pSrc, DWORD sizeSrc) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF); if (!pMsg) ! return FALSE; if ((pMsg->type & HUB_MSG_UNION_TYPE_MASK) != HUB_MSG_UNION_TYPE_BUF) *************** *** 63,67 **** if (!pMsg->u.buf.pBuf && sizeSrc) { ((HubMsg *)pMsg)->Clean(); ! return NULL; } --- 66,70 ---- if (!pMsg->u.buf.pBuf && sizeSrc) { ((HubMsg *)pMsg)->Clean(); ! return FALSE; } *************** *** 69,73 **** pMsg->type = type; ! return pMsg; } /////////////////////////////////////////////////////////////// --- 72,76 ---- pMsg->type = type; ! return TRUE; } /////////////////////////////////////////////////////////////// *************** *** 107,116 **** } /////////////////////////////////////////////////////////////// ! static HUB_MSG *CALLBACK msg_replace_val(HUB_MSG *pMsg, WORD type, DWORD val) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_VAL); if (!pMsg) ! return NULL; ((HubMsg *)pMsg)->Clean(); --- 110,119 ---- } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK msg_replace_val(HUB_MSG *pMsg, WORD type, DWORD val) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_VAL); if (!pMsg) ! return FALSE; ((HubMsg *)pMsg)->Clean(); *************** *** 119,123 **** pMsg->type = type; ! return pMsg; } /////////////////////////////////////////////////////////////// --- 122,126 ---- pMsg->type = type; ! return TRUE; } /////////////////////////////////////////////////////////////// *************** *** 142,151 **** } /////////////////////////////////////////////////////////////// ! static HUB_MSG *CALLBACK msg_replace_none(HUB_MSG *pMsg, WORD type) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_NONE); if (!pMsg) ! return NULL; ((HubMsg *)pMsg)->Clean(); --- 145,154 ---- } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK msg_replace_none(HUB_MSG *pMsg, WORD type) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_NONE); if (!pMsg) ! return FALSE; ((HubMsg *)pMsg)->Clean(); *************** *** 153,157 **** pMsg->type = type; ! return pMsg; } /////////////////////////////////////////////////////////////// --- 156,160 ---- pMsg->type = type; ! return TRUE; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:27:05
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins/escparse Modified Files: filter.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escparse/filter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.cpp 30 Sep 2008 08:28:32 -0000 1.3 --- filter.cpp 16 Oct 2008 09:24:23 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.3 2008/09/30 08:28:32 vfrolov * Added ability to control OUT1 and OUT2 pins *************** *** 138,141 **** --- 141,146 ---- HUB_MSG *EscParse::Convert(HUB_MSG *pMsg) { + _ASSERTE(pMsg->type == HUB_MSG_TYPE_LINE_DATA); + if (!escMode) return pMsg; *************** *** 146,150 **** // discard original data from the stream ! pMsg = pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0); for (; len ; len--) { --- 151,156 ---- // discard original data from the stream ! if(!pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0)) ! return NULL; for (; len ; len--) { *************** *** 180,188 **** --- 186,202 ---- if (Options() & GO_BREAK_STATUS) { pMsg = Flush(pMsg); + if (!pMsg) + return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_BREAK_STATUS, (data[0] & LINE_STATUS_BI) != 0); + if (!pMsg) + return NULL; } if (data[0] & maskLsr) { pMsg = Flush(pMsg); + if (!pMsg) + return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_LINE_STATUS, data[0] | VAL2MASK(maskLsr)); + if (!pMsg) + return NULL; } if (subState == 2 && ((data[0] & LINE_STATUS_BI) == 0 || ch != 0)) { *************** *** 205,209 **** --- 219,227 ---- if (maskMst) { pMsg = Flush(pMsg); + if (!pMsg) + return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_MODEM_STATUS, ch | VAL2MASK(maskMst)); + if (!pMsg) + return NULL; } Reset(); *************** *** 225,229 **** --- 243,251 ---- if (Options() & GO_RBR_STATUS) { pMsg = Flush(pMsg); + if (!pMsg) + return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_RBR_STATUS, *(ULONG *)data); + if (!pMsg) + return NULL; } Reset(); *************** *** 246,253 **** --- 268,279 ---- if (Options() & GO_RLC_STATUS) { pMsg = Flush(pMsg); + if (!pMsg) + return NULL; pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_RLC_STATUS, (VAL2LC_BYTESIZE(data[0]) |VAL2LC_PARITY(data[1]) |VAL2LC_STOPBITS(data[2]))); + if (!pMsg) + return NULL; } Reset(); *************** *** 278,284 **** } ! pMsg = Flush(pMsg); ! ! return pMsg; } /////////////////////////////////////////////////////////////// --- 304,308 ---- } ! return Flush(pMsg); } /////////////////////////////////////////////////////////////// *************** *** 501,505 **** // hide this message from subsequent filters ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); break; --- 525,530 ---- // hide this message from subsequent filters ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; break; *************** *** 524,528 **** // hide this message from subsequent filters ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); break; --- 549,554 ---- // hide this message from subsequent filters ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; break; *************** *** 590,594 **** if (pEscParse->Options() & GO_RBR_STATUS) { // discard any status settings controlled by this filter ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } break; --- 616,621 ---- if (pEscParse->Options() & GO_RBR_STATUS) { // discard any status settings controlled by this filter ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; } break; *************** *** 602,606 **** if (pEscParse->Options() & GO_RLC_STATUS) { // discard any status settings controlled by this filter ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } break; --- 629,634 ---- if (pEscParse->Options() & GO_RLC_STATUS) { // discard any status settings controlled by this filter ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; } break; *************** *** 614,618 **** if (pEscParse->Options() & GO_BREAK_STATUS) { // discard any status settings controlled by this filter ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } break; --- 642,647 ---- if (pEscParse->Options() & GO_BREAK_STATUS) { // discard any status settings controlled by this filter ! if(!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; } break; |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:27:05
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins/awakseq Modified Files: filter.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/awakseq/filter.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** filter.cpp 27 Aug 2008 11:38:29 -0000 1.6 --- filter.cpp 16 Oct 2008 09:24:23 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.6 2008/08/27 11:38:29 vfrolov * Fixed CONNECT(FALSE) losing *************** *** 50,54 **** #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgReplaceVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; --- 53,57 ---- #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_REPLACE_VAL *pMsgReplaceVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; *************** *** 258,262 **** // insert CONNECT(TRUE) instead data ! pInMsg = pMsgReplaceVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE); } --- 261,266 ---- // insert CONNECT(TRUE) instead data ! if(!pMsgReplaceVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE)) ! return FALSE; } *************** *** 271,275 **** if (pInMsg->u.val) { // discard CONNECT(TRUE) from the input stream ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } else { State *pState = ((Filter *)hFilter)->GetState(nFromPort); --- 275,280 ---- if (pInMsg->u.val) { // discard CONNECT(TRUE) from the input stream ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; } else { State *pState = ((Filter *)hFilter)->GetState(nFromPort); *************** *** 280,287 **** // discard CONNECT(FALSE) from the input stream // if CONNECT(TRUE) was not added yet ! if (pState->connectSent) pState->connectSent = FALSE; ! else ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); // start awakening sequence waiting --- 285,294 ---- // discard CONNECT(FALSE) from the input stream // if CONNECT(TRUE) was not added yet ! if (pState->connectSent) { pState->connectSent = FALSE; ! } else { ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; ! } // start awakening sequence waiting |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:25:26
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins/pin2con Modified Files: filter.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** filter.cpp 30 Sep 2008 07:52:09 -0000 1.9 --- filter.cpp 16 Oct 2008 09:24:23 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.9 2008/09/30 07:52:09 vfrolov * Removed HUB_MSG_TYPE_LINE_STATUS filtering *************** *** 293,297 **** case HUB_MSG_TYPE_CONNECT: // discard any CONNECT messages from the input stream ! pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); break; case HUB_MSG_TYPE_MODEM_STATUS: { --- 296,301 ---- case HUB_MSG_TYPE_CONNECT: // discard any CONNECT messages from the input stream ! if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; break; case HUB_MSG_TYPE_MODEM_STATUS: { |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:25:25
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins/telnet Modified Files: telnet.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: telnet.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/telnet.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** telnet.cpp 9 Oct 2008 11:02:58 -0000 1.2 --- telnet.cpp 16 Oct 2008 09:24:23 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.2 2008/10/09 11:02:58 vfrolov * Redesigned class TelnetProtocol *************** *** 144,148 **** // discard original data from the stream ! pMsg = pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0); for (; len ; len--) { --- 147,152 ---- // discard original data from the stream ! if (!pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0)) ! return NULL; for (; len ; len--) { *************** *** 167,171 **** // discard original data from the stream ! pMsg = pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0); for (; len ; len--) { --- 171,176 ---- // discard original data from the stream ! if (!pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0)) ! return NULL; for (; len ; len--) { |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 09:25:25
|
Update of /cvsroot/com0com/hub4com/plugins/linectl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18517/plugins/linectl Modified Files: filter.cpp Log Message: Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/filter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filter.cpp 16 Oct 2008 06:34:27 -0000 1.2 --- filter.cpp 16 Oct 2008 09:24:23 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/10/16 09:24:23 vfrolov + * Changed return type of ROUTINE_MSG_REPLACE_*() to BOOL + * * Revision 1.2 2008/10/16 06:34:27 vfrolov * Fixed typo *************** *** 244,254 **** case HUB_MSG_TYPE_SET_BR: // discard if controlled by this filter ! if (((Filter *)hFilter)->soOutMask & SO_SET_BR) ! pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY); break; case HUB_MSG_TYPE_SET_LC: // discard if controlled by this filter ! if (((Filter *)hFilter)->soOutMask & SO_SET_LC) ! pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY); break; case HUB_MSG_TYPE_RBR_STATUS: { --- 247,261 ---- case HUB_MSG_TYPE_SET_BR: // discard if controlled by this filter ! if (((Filter *)hFilter)->soOutMask & SO_SET_BR) { ! if (!pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; ! } break; case HUB_MSG_TYPE_SET_LC: // discard if controlled by this filter ! if (((Filter *)hFilter)->soOutMask & SO_SET_LC) { ! if (!pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY)) ! return FALSE; ! } break; case HUB_MSG_TYPE_RBR_STATUS: { |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 07:46:14
|
Update of /cvsroot/com0com/hub4com/examples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3996/examples Modified Files: com2tcp-esc.bat Log Message: Redesigned escinsert filter to accept SET instead STATUS messages Index: com2tcp-esc.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/com2tcp-esc.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** com2tcp-esc.bat 7 Oct 2008 14:27:47 -0000 1.1 --- com2tcp-esc.bat 16 Oct 2008 07:46:04 -0000 1.2 *************** *** 40,55 **** :END_PARSE_ARGS ! :SET OPTIONS=%OPTIONS% --create-filter=trace,ser --add-filters=0:ser ! ! SET OPTIONS=%OPTIONS% --create-filter=escparse,escparse-com --add-filters=0:escparse-com ! SET OPTIONS=%OPTIONS% --create-filter=pinmap:"--rts=cts --dtr=dsr --break=break" --add-filters=0:pinmap ! SET OPTIONS=%OPTIONS% --create-filter=linectl --add-filters=0:linectl ! :SET OPTIONS=%OPTIONS% --create-filter=trace,tcp --add-filters=1:tcp ! SET OPTIONS=%OPTIONS% --create-filter=escparse,escparse-tcp:"--request-esc-mode=no" --add-filters=1:escparse-tcp ! SET OPTIONS=%OPTIONS% --create-filter=escinsert --add-filters=1:escinsert ! :SET OPTIONS=%OPTIONS% --create-filter=trace,s2t --add-filters=1:s2t @ECHO ON --- 40,60 ---- :END_PARSE_ARGS ! :SET OPTIONS=%OPTIONS% --create-filter=trace,com,COM ! SET OPTIONS=%OPTIONS% --create-filter=escparse,com,parse ! SET OPTIONS=%OPTIONS% --create-filter=pinmap,com,pinmap:"--rts=cts --dtr=dsr --break=break" ! SET OPTIONS=%OPTIONS% --create-filter=linectl,com,lc ! :SET OPTIONS=%OPTIONS% --create-filter=trace,com,CxT ! SET OPTIONS=%OPTIONS% --add-filters=0:com ! :SET OPTIONS=%OPTIONS% --create-filter=trace,tcp,TCP ! SET OPTIONS=%OPTIONS% --create-filter=escparse,tcp,parse:"--request-esc-mode=no" ! SET OPTIONS=%OPTIONS% --create-filter=escinsert,tcp,insert ! :SET OPTIONS=%OPTIONS% --create-filter=trace,tcp,ExM ! SET OPTIONS=%OPTIONS% --create-filter=pinmap,tcp,pinmap:"--cts=cts --dsr=dsr --ring=ring --dcd=dcd --break=break" ! SET OPTIONS=%OPTIONS% --create-filter=lsrmap,tcp,lsrmap ! SET OPTIONS=%OPTIONS% --create-filter=linectl,tcp,lc ! SET OPTIONS=%OPTIONS% --add-filters=1:tcp @ECHO ON |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 07:46:11
|
Update of /cvsroot/com0com/hub4com/plugins/escinsert In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3996/plugins/escinsert Modified Files: filter.cpp Log Message: Redesigned escinsert filter to accept SET instead STATUS messages Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escinsert/filter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filter.cpp 30 Sep 2008 08:32:38 -0000 1.1 --- filter.cpp 16 Oct 2008 07:46:04 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/10/16 07:46:04 vfrolov + * Redesigned escinsert filter to accept SET instead STATUS messages + * * Revision 1.1 2008/09/30 08:32:38 vfrolov * Initial revision *************** *** 30,37 **** /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf = NULL; ! static ROUTINE_MSG_REPLACE_BUF *pMsgReplaceBuf = NULL; ! static ROUTINE_PORT_NAME_A *pPortName = NULL; ! static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 33,39 ---- /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf; ! static ROUTINE_MSG_REPLACE_BUF *pMsgReplaceBuf; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 58,70 **** State() : isConnected(FALSE), ! mstInVal(0), ! rbr(CBR_19200), ! rlc(VAL2LC_BYTESIZE(8)|VAL2LC_PARITY(NOPARITY)|VAL2LC_STOPBITS(ONESTOPBIT)) {} BOOL isConnected; ! BYTE mstInVal; ! ULONG rbr; ! DWORD rlc; }; /////////////////////////////////////////////////////////////// --- 60,74 ---- State() : isConnected(FALSE), ! mstVal(0), ! lsrVal(0), ! br(CBR_19200), ! lc(VAL2LC_BYTESIZE(8)|VAL2LC_PARITY(NOPARITY)|VAL2LC_STOPBITS(ONESTOPBIT)) {} BOOL isConnected; ! BYTE mstVal; ! BYTE lsrVal; ! DWORD br; ! DWORD lc; }; /////////////////////////////////////////////////////////////// *************** *** 72,86 **** public: Filter(int argc, const char *const argv[]); - void SetHub(HHUB _hHub) { hHub = _hHub; } State *GetState(int nPort); - const char *PortName(int nPort) const { return pPortName(hHub, nPort); } - const char *FilterName() const { return pFilterName(hHub, (HFILTER)this); } ! DWORD goInMask; BYTE escapeChar; private: - HHUB hHub; - typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; --- 76,85 ---- public: Filter(int argc, const char *const argv[]); State *GetState(int nPort); ! DWORD soMask; BYTE escapeChar; private: typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; *************** *** 90,98 **** Filter::Filter(int argc, const char *const argv[]) ! : goInMask(GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI) | ! GO_V2O_LINE_STATUS(LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) | ! GO_RBR_STATUS|GO_RLC_STATUS|GO_BREAK_STATUS), ! escapeChar(0xFF), ! hHub(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 89,96 ---- Filter::Filter(int argc, const char *const argv[]) ! : soMask(SO_V2O_PIN_STATE(PIN_STATE_CTS|PIN_STATE_DSR|PIN_STATE_DCD|PIN_STATE_RI|PIN_STATE_BREAK) | ! SO_V2O_LINE_STATUS(LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) | ! SO_SET_BR|SO_SET_LC), ! escapeChar(0xFF) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 163,167 **** << " \\\\.\\CNCB0" << endl << " --create-filter=escinsert" << endl ! << " --add-filters=1:escinsert" << endl << " --use-driver=tcp" << endl << " 222.22.22.22:2222" << endl --- 161,168 ---- << " \\\\.\\CNCB0" << endl << " --create-filter=escinsert" << endl ! << " --create-filter=pinmap:--cts=cts --dsr=dsr --ring=ring --dcd=dcd --break=break" << endl ! << " --create-filter=lsrmap" << endl ! << " --create-filter=linectl" << endl ! << " --add-filters=1:escinsert,pinmap,lsrmap,linectl" << endl << " --use-driver=tcp" << endl << " 222.22.22.22:2222" << endl *************** *** 190,205 **** } /////////////////////////////////////////////////////////////// - static BOOL CALLBACK Init( - HFILTER hFilter, - HHUB hHub) - { - _ASSERTE(hFilter != NULL); - _ASSERTE(hHub != NULL); - - ((Filter *)hFilter)->SetHub(hHub); - - return TRUE; - } - /////////////////////////////////////////////////////////////// static void InsertStatus( Filter &filter, --- 191,194 ---- *************** *** 275,280 **** --- 264,271 ---- if (pInMsg->u.val) { + _ASSERTE(pState->isConnected == FALSE); pState->isConnected = TRUE; } else { + _ASSERTE(pState->isConnected == TRUE); pState->isConnected = FALSE; break; *************** *** 282,296 **** // init state ! if (((Filter *)hFilter)->goInMask & GO_O2V_MODEM_STATUS(-1)) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_MST, pState->mstInVal, ppEchoMsg); ! if (((Filter *)hFilter)->goInMask & (GO_V2O_LINE_STATUS(-1) | GO_BREAK_STATUS)) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, 0, ppEchoMsg); ! if (((Filter *)hFilter)->goInMask & GO_RBR_STATUS) ! InsertRBR(*(Filter *)hFilter, pState->rbr, ppEchoMsg); ! if (((Filter *)hFilter)->goInMask & GO_RLC_STATUS) ! InsertRLC(*(Filter *)hFilter, pState->rlc, ppEchoMsg); break; --- 273,287 ---- // init state ! if (((Filter *)hFilter)->soMask & SO_V2O_PIN_STATE(SPS_V2P_MST(-1))) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_MST, pState->mstVal, ppEchoMsg); ! if (((Filter *)hFilter)->soMask & (SO_V2O_LINE_STATUS(-1) | SO_V2O_PIN_STATE(PIN_STATE_BREAK))) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, pState->lsrVal, ppEchoMsg); ! if (((Filter *)hFilter)->soMask & SO_SET_BR) ! InsertRBR(*(Filter *)hFilter, pState->br, ppEchoMsg); ! if (((Filter *)hFilter)->soMask & SO_SET_LC) ! InsertRLC(*(Filter *)hFilter, pState->lc, ppEchoMsg); break; *************** *** 303,307 **** static BOOL CALLBACK OutMethod( HFILTER hFilter, ! int nFromPort, int nToPort, HUB_MSG *pOutMsg) --- 294,298 ---- static BOOL CALLBACK OutMethod( HFILTER hFilter, ! int /*nFromPort*/, int nToPort, HUB_MSG *pOutMsg) *************** *** 311,334 **** switch (pOutMsg->type) { ! case HUB_MSG_TYPE_GET_IN_OPTS: { ! _ASSERTE(pOutMsg->u.pv.pVal != NULL); ! ! // or'e with the required mask to get line status and modem status ! *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 << ((Filter *)hFilter)->PortName(nFromPort) - << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() - << " option(s) 0x" << hex << fail_options << dec - << " not accepted" << endl; - } - break; - } - case HUB_MSG_TYPE_RBR_STATUS: - if (((Filter *)hFilter)->goInMask & GO_RBR_STATUS) { State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 302,316 ---- switch (pOutMsg->type) { ! case HUB_MSG_TYPE_SET_OUT_OPTS: ! // discard supported options ! pOutMsg->u.val &= ~((Filter *)hFilter)->soMask; break; ! case HUB_MSG_TYPE_SET_BR: ! if (((Filter *)hFilter)->soMask & SO_SET_BR) { ! DWORD val = pOutMsg->u.val; ! ! // discard messages for supported options ! pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY); State *pState = ((Filter *)hFilter)->GetState(nToPort); *************** *** 336,351 **** return FALSE; ! if (pState->rbr != pOutMsg->u.val) { ! pState->rbr = pOutMsg->u.val; if (pState->isConnected) ! InsertRBR(*(Filter *)hFilter, pState->rbr, &pOutMsg); } } break; ! case HUB_MSG_TYPE_RLC_STATUS: _ASSERTE((pOutMsg->u.val & ~(VAL2LC_BYTESIZE(-1)|VAL2LC_PARITY(-1)|VAL2LC_STOPBITS(-1))) == 0); ! if (((Filter *)hFilter)->goInMask & GO_RLC_STATUS) { State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 318,339 ---- return FALSE; ! if (pState->br != val) { ! pState->br = val; if (pState->isConnected) ! InsertRBR(*(Filter *)hFilter, pState->br, &pOutMsg); } } + break; ! case HUB_MSG_TYPE_SET_LC: _ASSERTE((pOutMsg->u.val & ~(VAL2LC_BYTESIZE(-1)|VAL2LC_PARITY(-1)|VAL2LC_STOPBITS(-1))) == 0); ! if (((Filter *)hFilter)->soMask & SO_SET_LC) { ! DWORD val = pOutMsg->u.val; ! ! // discard messages for supported options ! pMsgReplaceNone(pOutMsg, HUB_MSG_TYPE_EMPTY); ! State *pState = ((Filter *)hFilter)->GetState(nToPort); *************** *** 353,423 **** return FALSE; ! if (pState->rlc != pOutMsg->u.val) { ! pState->rlc = pOutMsg->u.val; if (pState->isConnected) ! InsertRLC(*(Filter *)hFilter, pState->rlc, &pOutMsg); } } break; ! case HUB_MSG_TYPE_BREAK_STATUS: ! if (((Filter *)hFilter)->goInMask & GO_BREAK_STATUS) { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! if (!pState->isConnected) ! break; ! if (pOutMsg->u.val) { ! if ((((Filter *)hFilter)->goInMask & GO_V2O_LINE_STATUS(LINE_STATUS_BI)) == 0) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, LINE_STATUS_BI, &pOutMsg); ! } else { ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, 0, &pOutMsg); ! } ! } ! break; ! case HUB_MSG_TYPE_LINE_STATUS: { ! BYTE lsr; ! lsr = (BYTE)pOutMsg->u.val & (BYTE)MASK2VAL(pOutMsg->u.val) & GO_O2V_LINE_STATUS(((Filter *)hFilter)->goInMask); ! if (lsr) { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! if (pState->isConnected) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, lsr, &pOutMsg); } break; } ! case HUB_MSG_TYPE_MODEM_STATUS: { ! BYTE mstInMask; ! ! mstInMask = (BYTE)MASK2VAL(pOutMsg->u.val) & GO_O2V_MODEM_STATUS(((Filter *)hFilter)->goInMask); ! if (mstInMask) { ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! BYTE mstInVal; ! mstInVal = (((BYTE)pOutMsg->u.val & mstInMask) | (pState->mstInVal & ~mstInMask)); ! mstInMask = pState->mstInVal ^ mstInVal; ! if (!mstInMask) ! break; ! if (pState->isConnected) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_MST, mstInVal, &pOutMsg); - pState->mstInVal = mstInVal; - } break; } --- 341,416 ---- return FALSE; ! if (pState->lc != val) { ! pState->lc = val; if (pState->isConnected) ! InsertRLC(*(Filter *)hFilter, pState->lc, &pOutMsg); } } + break; ! case HUB_MSG_TYPE_SET_PIN_STATE: { ! WORD mask = MASK2VAL(pOutMsg->u.val) & SO_O2V_PIN_STATE(((Filter *)hFilter)->soMask); ! if (!mask) ! break; ! WORD val = (WORD)pOutMsg->u.val; ! // discard settings for supported options ! pOutMsg->u.val &= ~VAL2MASK(mask); ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! BYTE mstMask = SPS_P2V_MST(mask); ! if (mstMask) { ! BYTE mstVal; ! ! mstVal = ((SPS_P2V_MST(val) & mstMask) | (pState->mstVal & ~mstMask)); ! mstMask = pState->mstVal ^ mstVal; ! ! if (mstMask) { ! if (pState->isConnected) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_MST, mstVal, &pOutMsg); ! ! pState->mstVal = mstVal; ! } ! } ! ! if (mask & PIN_STATE_BREAK) { ! pState->lsrVal = (val & PIN_STATE_BREAK) ? LINE_STATUS_BI : 0; ! ! if (pState->isConnected && (!pState->lsrVal || ! (((Filter *)hFilter)->soMask & SO_V2O_LINE_STATUS(LINE_STATUS_BI)) == 0)) ! { ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, pState->lsrVal, &pOutMsg); ! } } break; } ! case HUB_MSG_TYPE_SET_LSR: { ! BYTE lsr; ! lsr = (BYTE)pOutMsg->u.val & (BYTE)MASK2VAL(pOutMsg->u.val) & SO_O2V_LINE_STATUS(((Filter *)hFilter)->soMask); ! // discard settings for supported options ! pOutMsg->u.val &= ~VAL2MASK(SO_O2V_LINE_STATUS(((Filter *)hFilter)->soMask)); ! if (!lsr) ! break; ! State *pState = ((Filter *)hFilter)->GetState(nToPort); ! if (!pState) ! return FALSE; ! if (pState->isConnected) ! InsertStatus(*(Filter *)hFilter, SERIAL_LSRMST_LSR_NODATA, lsr, &pOutMsg); break; } *************** *** 468,472 **** NULL, // ConfigStop Create, ! Init, InMethod, OutMethod, --- 461,465 ---- NULL, // ConfigStop Create, ! NULL, // Init InMethod, OutMethod, *************** *** 484,489 **** if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertBuf) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceBuf) || ! !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; --- 477,481 ---- if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertBuf) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceBuf) || ! !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone)) { return NULL; *************** *** 492,497 **** pMsgInsertBuf = pHubRoutines->pMsgInsertBuf; pMsgReplaceBuf = pHubRoutines->pMsgReplaceBuf; ! pPortName = pHubRoutines->pPortName; ! pFilterName = pHubRoutines->pFilterName; return plugins; --- 484,488 ---- pMsgInsertBuf = pHubRoutines->pMsgInsertBuf; pMsgReplaceBuf = pHubRoutines->pMsgReplaceBuf; ! pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 07:10:16
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31582 Modified Files: hub4com.vcproj Log Message: Added com2tcp-esc.bat Index: hub4com.vcproj =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.vcproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** hub4com.vcproj 2 Oct 2008 12:03:05 -0000 1.4 --- hub4com.vcproj 16 Oct 2008 07:10:05 -0000 1.5 *************** *** 303,306 **** --- 303,310 ---- > <File + RelativePath=".\examples\com2tcp-esc.bat" + > + </File> + <File RelativePath=".\examples\com2tcp.bat" > |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 07:09:20
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31448 Modified Files: hub4com.sln Log Message: Added filter-lsrmap Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** hub4com.sln 30 Sep 2008 08:38:02 -0000 1.10 --- hub4com.sln 16 Oct 2008 07:09:10 -0000 1.11 *************** *** 26,29 **** --- 26,31 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-linectl", "plugins\linectl\linectl.vcproj", "{8060E11C-18B2-4F9D-BDC0-A37726A3B8B9}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-lsrmap", "plugins\lsrmap\lsrmap.vcproj", "{9089D426-5B23-4F82-B32E-33D56AF225DC}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 80,83 **** --- 82,89 ---- {8060E11C-18B2-4F9D-BDC0-A37726A3B8B9}.Release|Win32.ActiveCfg = Release|Win32 {8060E11C-18B2-4F9D-BDC0-A37726A3B8B9}.Release|Win32.Build.0 = Release|Win32 + {9089D426-5B23-4F82-B32E-33D56AF225DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {9089D426-5B23-4F82-B32E-33D56AF225DC}.Debug|Win32.Build.0 = Debug|Win32 + {9089D426-5B23-4F82-B32E-33D56AF225DC}.Release|Win32.ActiveCfg = Release|Win32 + {9089D426-5B23-4F82-B32E-33D56AF225DC}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-10-16 07:06:04
|
Update of /cvsroot/com0com/hub4com/plugins/lsrmap In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30960 Added Files: .cvsignore filter.cpp precomp.cpp lsrmap.vcproj precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/10/16 07:05:53 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: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/10/16 07:05:53 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/10/16 07:05:53 vfrolov * Initial revision * */ #ifndef _PRECOMP_H_ #define _PRECOMP_H_ #include <windows.h> #include <crtdbg.h> #include <map> #include <iostream> using namespace std; #pragma warning(disable:4512) // assignment operator could not be generated #endif /* _PRECOMP_H_ */ --- NEW FILE: lsrmap.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-lsrmap" ProjectGUID="{9089D426-5B23-4F82-B32E-33D56AF225DC}" 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: filter.cpp --- /* * $Id: filter.cpp,v 1.1 2008/10/16 07:05:53 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/10/16 07:05:53 vfrolov * Initial revision * */ #include "precomp.h" #include "../plugins_api.h" /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal; static ROUTINE_PORT_NAME_A *pPortName; static ROUTINE_FILTER_NAME_A *pFilterName; /////////////////////////////////////////////////////////////// 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 SetHub(HHUB _hHub) { hHub = _hHub; } const char *PortName(int nPort) const { return pPortName(hHub, nPort); } const char *FilterName() const { return pFilterName(hHub, (HFILTER)this); } BYTE lsrMask; private: HHUB hHub; }; Filter::Filter(int argc, const char *const argv[]) : lsrMask(LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR), hHub(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), "lsrmap", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "LSR 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, HHUB hHub) { _ASSERTE(hFilter != NULL); _ASSERTE(hHub != NULL); ((Filter *)hFilter)->SetHub(hHub); return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, int nFromPort, int nToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(pOutMsg != NULL); switch (pOutMsg->type) { case HUB_MSG_TYPE_SET_OUT_OPTS: { // or'e with the required mask to set line status pOutMsg->u.val |= SO_V2O_LINE_STATUS(((Filter *)hFilter)->lsrMask); break; } case HUB_MSG_TYPE_GET_IN_OPTS: { _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) { cerr << ((Filter *)hFilter)->PortName(nFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << ((Filter *)hFilter)->PortName(nToPort) << " option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; } break; } case HUB_MSG_TYPE_LINE_STATUS: { BYTE lsr; lsr = (BYTE)pOutMsg->u.val & (BYTE)MASK2VAL(pOutMsg->u.val) & ((Filter *)hFilter)->lsrMask; if (lsr) pOutMsg = pMsgInsertVal(pOutMsg, HUB_MSG_TYPE_SET_LSR, VAL2MASK(lsr) | lsr); 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, pMsgInsertVal) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; } pMsgInsertVal = pHubRoutines->pMsgInsertVal; pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; return plugins; } /////////////////////////////////////////////////////////////// --- NEW FILE: .cvsignore --- *.user Release Debug |