com0com-cvs Mailing List for Null-modem emulator (Page 23)
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-04-07 12:29:15
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16475 Modified Files: filter.cpp Log Message: Replaced --rt-events option by SET_RT_EVENTS message Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/awakseq/filter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filter.cpp 2 Apr 2008 10:39:54 -0000 1.2 --- filter.cpp 7 Apr 2008 12:29:11 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/04/07 12:29:11 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.2 2008/04/02 10:39:54 vfrolov * Added discarding CONNECT(FALSE) from the input stream *************** *** 168,172 **** << " - wait first byte from COM1 and then establish connection to" << endl << " 111.11.11.11:1111." << endl ! << " " << pProgPath << " --create-filter=pin2con --create-filter=" << GetPluginAbout()->pName << ":\"--awak-seq=aaa\" --add-filters=0:pin2con," << GetPluginAbout()->pName << " --rt-events=dsr COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait \"aaa\" from COM1 and then establish connection to 111.11.11.11:1111." << endl << " and disconnect on DSR OFF." << endl --- 171,175 ---- << " - wait first byte from COM1 and then establish connection to" << endl << " 111.11.11.11:1111." << endl ! << " " << pProgPath << " --create-filter=pin2con --create-filter=" << GetPluginAbout()->pName << ":\"--awak-seq=aaa\" --add-filters=0:pin2con," << GetPluginAbout()->pName << " COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait \"aaa\" from COM1 and then establish connection to 111.11.11.11:1111." << endl << " and disconnect on DSR OFF." << endl |
From: Vyacheslav F. <vf...@us...> - 2008-04-07 12:28:10
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16030 Modified Files: comio.cpp comio.h comparams.cpp comparams.h comport.cpp comport.h port.cpp Log Message: Replaced --rt-events option by SET_RT_EVENTS message Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comport.cpp 26 Mar 2008 08:44:34 -0000 1.1 --- comport.cpp 7 Apr 2008 12:28:03 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:28:03 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/03/26 08:44:34 vfrolov * Redesigned for using plugins *************** *** 54,57 **** --- 57,61 ---- countXoff(0), filterX(FALSE), + events(0), writeQueueLimit(256), writeQueued(0), *************** *** 87,102 **** CheckComEvents(DWORD(-1)); - DWORD events; - - if (!::GetCommMask(handle, &events)) { - DWORD err = ::GetLastError(); - - cerr << "ComPort::Start(): GetCommMask() ERROR " << err << endl; - return FALSE; - } - - if (events && !StartWaitCommEvent()) - return FALSE; - if (!StartRead()) return FALSE; --- 91,94 ---- *************** *** 212,215 **** --- 204,222 ---- return FALSE; } + else + if (pMsg->type == HUB_MSG_TYPE_SET_RT_EVENTS) { + if (events != pMsg->u.val) { + if (handle == INVALID_HANDLE_VALUE) + return FALSE; + + events = pMsg->u.val; + + if (!SetComEvents(handle, &events)) + return FALSE; + + if (events && !StartWaitCommEvent()) + return FALSE; + } + } return TRUE; *************** *** 238,242 **** countWaitCommEventOverlapped++; ! //cout << "Started WaitCommEvent " << name << " " << countReadOverlapped << endl; return TRUE; --- 245,250 ---- countWaitCommEventOverlapped++; ! //cout << "Started WaitCommEvent " << name << " " << countReadOverlapped ! // << " " << hex << events << dec << endl; return TRUE; *************** *** 278,286 **** CheckComEvents(eMask); ! if (!pOverlapped->StartWaitCommEvent()) { delete pOverlapped; countWaitCommEventOverlapped--; ! cout << "Stopped WaitCommEvent " << name << " " << countWaitCommEventOverlapped << endl; } } --- 286,294 ---- CheckComEvents(eMask); ! if (!events || !pOverlapped->StartWaitCommEvent()) { delete pOverlapped; countWaitCommEventOverlapped--; ! //cout << "Stopped WaitCommEvent " << name << " " << countWaitCommEventOverlapped << endl; } } Index: comparams.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comparams.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comparams.cpp 26 Mar 2008 08:44:13 -0000 1.1 --- comparams.cpp 7 Apr 2008 12:28:03 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:28:03 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/03/26 08:44:13 vfrolov * Redesigned for using plugins *************** *** 66,71 **** inX(0), inDsr(0), ! intervalTimeout(0), ! events(0) { } --- 69,73 ---- inX(0), inDsr(0), ! intervalTimeout(0) { } *************** *** 141,182 **** } - BOOL ComParams::SetEvents(const char *pEvents) - { - char *pTmp = _strdup(pEvents); - - if (!pTmp) { - cerr << "No enough memory." << endl; - exit(2); - } - - events = 0; - - char *pSave; - - for (char *pName = STRTOK_R(pTmp, ",", &pSave) ; - pName ; - pName = STRTOK_R(NULL, ",", &pSave)) - { - BOOL found = FALSE; - - for (int i = 0 ; i < sizeof(event_names)/sizeof(event_names[0]) ; i++) { - if (_stricmp(pName, event_names[i].pName) == 0) { - events |= event_names[i].val; - found = TRUE; - break; - } - } - - if (!found && _stricmp(pName, "none") != 0) { - free(pTmp); - return FALSE; - } - } - - free(pTmp); - - return TRUE; - } - BOOL ComParams::SetFlag(const char *pFlagStr, int *pFlag) { --- 143,146 ---- *************** *** 255,281 **** } - string ComParams::EventsStr(DWORD events) - { - if (events > 0) { - stringstream buf; - BOOL first = TRUE; - - for (int i = 0 ; i < sizeof(event_names)/sizeof(event_names[0]) ; i++) { - if ((events & event_names[i].val) != 0) { - if (first) - first = FALSE; - else - buf << ","; - - buf << event_names[i].pName; - } - } - - return buf.str(); - } - - return "none"; - } - string ComParams::FlagStr(int flag) { --- 219,222 ---- *************** *** 313,321 **** } - const char *ComParams::EventsLst() - { - return "<E1>[,<E2>...], where <En> is cts, dsr, dcd, ring, break, err or none"; - } - const char *ComParams::FlagLst() { --- 254,257 ---- Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** port.cpp 28 Mar 2008 15:55:09 -0000 1.2 --- port.cpp 7 Apr 2008 12:28:03 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/04/07 12:28:03 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.2 2008/03/28 15:55:09 vfrolov * Fixed help *************** *** 89,108 **** << " --ito=<t> - set read interval timeout to <t> (" << ComParams().IntervalTimeoutStr() << " by default)," << endl << " where <t> is " << ComParams::IntervalTimeoutLst() << "." << endl - << " --rt-events=<LstEv> - set events that should be handled in real-time to" << endl - << " <LstEv> (" << ComParams().EventsStr() << " by default)." << endl << endl << " The value c[urrent] above means to use current COM port settings." << endl - << " The syntax of <LstEv> above is" << endl - << " " << ComParams::EventsLst() << "." << endl << endl << "Output data stream description:" << endl ! << " LINE_DATA(<data>) - write <data> to serial port." << endl << " COM_FUNCTION(<function>) - direct serial port to perform <function>." << endl << endl << "Input data stream description:" << endl ! << " LINE_DATA(<data>) - readed <data> from serial port." << endl ! << " CONNECT(TRUE) - serial port started." << endl ! << " MODEM_STATUS(<value>) - modem control register changed to <value>." << endl ! << " COM_ERRORS(<mask>) - occured communications errors indicated in <mask>." << endl << endl << "Examples:" << endl --- 92,109 ---- << " --ito=<t> - set read interval timeout to <t> (" << ComParams().IntervalTimeoutStr() << " by default)," << endl << " where <t> is " << ComParams::IntervalTimeoutLst() << "." << endl << endl << " The value c[urrent] above means to use current COM port settings." << endl << endl << "Output data stream description:" << endl ! << " LINE_DATA(<data>) - write <data> to serial port." << endl << " COM_FUNCTION(<function>) - direct serial port to perform <function>." << endl + << " SET_RT_EVENTS(<mask>) - direct serial port to monitor <mask> real-time" << endl + << " events." << endl << endl << "Input data stream description:" << endl ! << " LINE_DATA(<data>) - readed <data> from serial port." << endl ! << " CONNECT(TRUE) - serial port started." << endl ! << " MODEM_STATUS(<value>) - modem control register changed to <value>." << endl ! << " COM_ERRORS(<mask>) - occured communications errors indicated in <mask>." << endl << endl << "Examples:" << endl *************** *** 197,206 **** exit(1); } - } else - if ((pParam = GetParam(pArg, "--rt-events=")) != NULL) { - if (!comParams.SetEvents(pParam)) { - cerr << "Unknown events in " << pArg << endl; - exit(1); - } } else { return FALSE; --- 198,201 ---- Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comio.h 26 Mar 2008 08:43:50 -0000 1.1 --- comio.h 7 Apr 2008 12:28:03 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:28:03 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/03/26 08:43:50 vfrolov * Redesigned for using plugins *************** *** 43,46 **** --- 46,50 ---- /////////////////////////////////////////////////////////////// extern HANDLE OpenComPort(const char *pPath, const ComParams &comParams); + extern BOOL SetComEvents(HANDLE handle, DWORD *events); /////////////////////////////////////////////////////////////// class ReadOverlapped : private OVERLAPPED Index: comparams.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comparams.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comparams.h 26 Mar 2008 08:44:13 -0000 1.1 --- comparams.h 7 Apr 2008 12:28:03 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:28:03 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/03/26 08:44:13 vfrolov * Redesigned for using plugins *************** *** 57,61 **** BOOL SetInDsr(const char *pInDsr) { return SetFlag(pInDsr, &inDsr); } BOOL SetIntervalTimeout(const char *pIntervalTimeout); - BOOL SetEvents(const char *pEvents); static string BaudRateStr(long baudRate); --- 60,63 ---- *************** *** 69,73 **** static string InDsrStr(int inDsr) { return FlagStr(inDsr); } static string IntervalTimeoutStr(long intervalTimeout); - static string EventsStr(DWORD events); string BaudRateStr() const { return BaudRateStr(baudRate); } --- 71,74 ---- *************** *** 81,85 **** string InDsrStr() const { return InDsrStr(inDsr); } string IntervalTimeoutStr() const { return IntervalTimeoutStr(intervalTimeout); } - string EventsStr() const { return EventsStr(events); } static const char *BaudRateLst(); --- 82,85 ---- *************** *** 93,97 **** static const char *InDsrLst() { return FlagLst(); } static const char *IntervalTimeoutLst(); - static const char *EventsLst(); long BaudRate() const { return baudRate; } --- 93,96 ---- *************** *** 105,109 **** int InDsr() const { return inDsr; } long IntervalTimeout() const { return intervalTimeout; } - DWORD Events() const { return events; } private: --- 104,107 ---- *************** *** 122,126 **** int inDsr; long intervalTimeout; - DWORD events; }; /////////////////////////////////////////////////////////////// --- 120,123 ---- Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comport.h 26 Mar 2008 08:44:34 -0000 1.1 --- comport.h 7 Apr 2008 12:28:03 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:28:03 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/03/26 08:44:34 vfrolov * Redesigned for using plugins *************** *** 79,82 **** --- 82,86 ---- int countXoff; BOOL filterX; + DWORD events; DWORD writeQueueLimit; Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comio.cpp 26 Mar 2008 08:43:50 -0000 1.1 --- comio.cpp 7 Apr 2008 12:28:02 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:28:02 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/03/26 08:43:50 vfrolov * Redesigned for using plugins *************** *** 62,66 **** dcb->DCBlength = sizeof(*dcb); ! if (!GetCommState(handle, dcb)) { TraceError(GetLastError(), "GetCommState()"); return FALSE; --- 65,69 ---- dcb->DCBlength = sizeof(*dcb); ! if (!::GetCommState(handle, dcb)) { TraceError(GetLastError(), "GetCommState()"); return FALSE; *************** *** 71,80 **** static BOOL mySetCommState(HANDLE handle, DCB *dcb) { ! if (!SetCommState(handle, dcb)) { TraceError(GetLastError(), "SetCommState()"); return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// HANDLE OpenComPort(const char *pPath, const ComParams &comParams) --- 74,122 ---- static BOOL mySetCommState(HANDLE handle, DCB *dcb) { ! if (!::SetCommState(handle, dcb)) { TraceError(GetLastError(), "SetCommState()"); + myGetCommState(handle, dcb); + return FALSE; + } + return myGetCommState(handle, dcb); + } + /////////////////////////////////////////////////////////////// + static BOOL myGetCommTimeouts(HANDLE handle, COMMTIMEOUTS *timeouts) + { + if (!::GetCommTimeouts(handle, timeouts)) { + TraceError(GetLastError(), "GetCommTimeouts()"); return FALSE; } return TRUE; } + + static BOOL mySetCommTimeouts(HANDLE handle, COMMTIMEOUTS *timeouts) + { + if (!::SetCommTimeouts(handle, timeouts)) { + TraceError(GetLastError(), "SetCommTimeouts()"); + myGetCommTimeouts(handle, timeouts); + return FALSE; + } + return myGetCommTimeouts(handle, timeouts); + } + /////////////////////////////////////////////////////////////// + static BOOL myGetCommMask(HANDLE handle, DWORD *events) + { + if (!::GetCommMask(handle, events)) { + TraceError(GetLastError(), "GetCommMask()"); + return FALSE; + } + return TRUE; + } + + BOOL SetComEvents(HANDLE handle, DWORD *events) + { + if (!::SetCommMask(handle, *events)) { + TraceError(GetLastError(), "SetCommMask()"); + myGetCommMask(handle, events); + return FALSE; + } + return myGetCommMask(handle, events); + } /////////////////////////////////////////////////////////////// HANDLE OpenComPort(const char *pPath, const ComParams &comParams) *************** *** 142,147 **** COMMTIMEOUTS timeouts; ! if (!GetCommTimeouts(handle, &timeouts)) { ! TraceError(GetLastError(), "OpenComPort(): GetCommTimeouts()"); CloseHandle(handle); return INVALID_HANDLE_VALUE; --- 184,188 ---- COMMTIMEOUTS timeouts; ! if (!myGetCommTimeouts(handle, &timeouts)) { CloseHandle(handle); return INVALID_HANDLE_VALUE; *************** *** 161,172 **** timeouts.WriteTotalTimeoutConstant = 0; ! if (!SetCommTimeouts(handle, &timeouts)) { ! TraceError(GetLastError(), "OpenComPort(): SetCommTimeouts()"); ! CloseHandle(handle); ! return INVALID_HANDLE_VALUE; ! } ! ! if (!::SetCommMask(handle, comParams.Events())) { ! TraceError(GetLastError(), "OpenComPort(): SetCommMask()"); CloseHandle(handle); return INVALID_HANDLE_VALUE; --- 202,206 ---- timeouts.WriteTotalTimeoutConstant = 0; ! if (!mySetCommTimeouts(handle, &timeouts)) { CloseHandle(handle); return INVALID_HANDLE_VALUE; *************** *** 184,189 **** << ", ix=" << ComParams::InXStr(dcb.fInX) << ", idsr=" << ComParams::InDsrStr(dcb.fDsrSensitivity) ! << ", ito=" << comParams.IntervalTimeoutStr() ! << ", rt-events=" << comParams.EventsStr() << ") - OK" << endl; return handle; --- 218,222 ---- << ", ix=" << ComParams::InXStr(dcb.fInX) << ", idsr=" << ComParams::InDsrStr(dcb.fDsrSensitivity) ! << ", ito=" << ComParams::IntervalTimeoutStr(timeouts.ReadIntervalTimeout) << ") - OK" << endl; return handle; |
From: Vyacheslav F. <vf...@us...> - 2008-04-07 12:24:23
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15397 Modified Files: filter.cpp Log Message: Replaced --rt-events option by SET_RT_EVENTS message Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filter.cpp 2 Apr 2008 10:33:23 -0000 1.1 --- filter.cpp 7 Apr 2008 12:24:17 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:24:17 vfrolov + * Replaced --rt-events option by SET_RT_EVENTS message + * * Revision 1.1 2008/04/02 10:33:23 vfrolov * Initial revision *************** *** 29,38 **** /////////////////////////////////////////////////////////////// - #ifndef _DEBUG - #define DEBUG_PARAM(par) - #else /* _DEBUG */ - #define DEBUG_PARAM(par) par - #endif /* _DEBUG */ - /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; --- 32,35 ---- *************** *** 65,68 **** --- 62,67 ---- DWORD pin; BOOL negative; + DWORD myEvents; + DWORD events; private: *************** *** 73,81 **** DWORD val; const char *pName; } pin_names[] = { ! {MS_CTS_ON, "cts"}, ! {MS_DSR_ON, "dsr"}, ! {MS_RLSD_ON, "dcd"}, ! {MS_RING_ON, "ring"}, }; --- 72,81 ---- DWORD val; const char *pName; + DWORD events; } pin_names[] = { ! {MS_CTS_ON, "cts", EV_CTS}, ! {MS_DSR_ON, "dsr", EV_DSR}, ! {MS_RLSD_ON, "dcd", EV_RLSD}, ! {MS_RING_ON, "ring", EV_RING}, }; *************** *** 115,118 **** --- 115,127 ---- } } + + myEvents = 0; + + for (int i = 0 ; i < sizeof(pin_names)/sizeof(pin_names[0]) ; i++) { + if ((pin & pin_names[i].val) != 0) + myEvents |= pin_names[i].events; + } + + events = myEvents; } *************** *** 172,177 **** << " CONNECT(FALSE) - will be added on appropriate pin state changing." << endl << endl << "Examples:" << endl ! << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0:" << GetPluginAbout()->pName << " --rt-events=dsr COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait DSR ON from COM1 and then establish connection to 111.11.11.11:1111" << endl << " and disconnect on DSR OFF." << endl --- 181,196 ---- << " CONNECT(FALSE) - will be added on appropriate pin state changing." << endl << endl + << "IN method echo data stream description:" << endl + << " SET_RT_EVENTS(<mask>) - will be added on CONNECT(TRUE) in input data stream." << endl + << endl + << "OUT method input data stream description:" << endl + << " SET_RT_EVENTS(<mask>) - <mask> is the events mask." << endl + << endl + << "OUT method output data stream description:" << endl + << " SET_RT_EVENTS(<mask>) - <mask> is the events mask with event required by this" << endl + << " filter." << endl + << endl << "Examples:" << endl ! << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0:" << GetPluginAbout()->pName << " COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait DSR ON from COM1 and then establish connection to 111.11.11.11:1111" << endl << " and disconnect on DSR OFF." << endl *************** *** 191,195 **** int nFromPort, HUB_MSG *pInMsg, ! HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); --- 210,214 ---- int nFromPort, HUB_MSG *pInMsg, ! HUB_MSG **ppEchoMsg) { _ASSERTE(hFilter != NULL); *************** *** 199,202 **** --- 218,230 ---- if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { + if (pInMsg->u.val) { + *ppEchoMsg = pMsgInsertVal(NULL, + HUB_MSG_TYPE_SET_RT_EVENTS, + ((Filter *)hFilter)->events); + + if (!*ppEchoMsg) + return FALSE; + } + // discard any CONNECT messages from the input stream pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); *************** *** 228,231 **** --- 256,277 ---- } /////////////////////////////////////////////////////////////// + static BOOL CALLBACK OutMethod( + HFILTER hFilter, + int /*nFromPort*/, + int /*nToPort*/, + HUB_MSG *pOutMsg) + { + _ASSERTE(hFilter != NULL); + _ASSERTE(pOutMsg != NULL); + + if (pOutMsg->type == HUB_MSG_TYPE_SET_RT_EVENTS) { + // Add event required by this filter + pOutMsg->u.val |= ((Filter *)hFilter)->myEvents; + ((Filter *)hFilter)->events = pOutMsg->u.val; + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), *************** *** 239,243 **** NULL, // Init InMethod, ! NULL, // OutMethod }; --- 285,289 ---- NULL, // Init InMethod, ! OutMethod, }; |
From: Vyacheslav F. <vf...@us...> - 2008-04-07 12:20:57
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14586 Modified Files: plugins_api.h Log Message: Added HUB_MSG_TYPE_SET_RT_EVENTS Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plugins_api.h 26 Mar 2008 08:38:37 -0000 1.1 --- plugins_api.h 7 Apr 2008 12:20:51 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:38:37 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/04/07 12:20:51 vfrolov + * Added HUB_MSG_TYPE_SET_RT_EVENTS + * * Revision 1.1 2008/03/26 08:38:37 vfrolov * Initial revision * */ *************** *** 45,48 **** --- 47,51 ---- #define HUB_MSG_TYPE_COM_ERRORS (HUB_MSG_UNION_TYPE_VAL | 4) #define HUB_MSG_TYPE_COM_FUNCTION (HUB_MSG_UNION_TYPE_VAL | 5) + #define HUB_MSG_TYPE_SET_RT_EVENTS (HUB_MSG_UNION_TYPE_VAL | 6) /*******************************************************************/ typedef struct _HUB_MSG { |
From: Vyacheslav F. <vf...@us...> - 2008-04-03 14:54:53
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14553 Modified Files: hub4com.sln Log Message: Added filter-echo project Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hub4com.sln 2 Apr 2008 10:36:28 -0000 1.5 --- hub4com.sln 3 Apr 2008 14:54:47 -0000 1.6 *************** *** 14,17 **** --- 14,19 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-pin2con", "plugins\pin2con\pin2con.vcproj", "{1706553E-2EDE-4A20-96A5-60ACD10A8F2D}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-echo", "plugins\echo\echo.vcproj", "{F0ACE42D-3488-4054-B683-3B4BC43CD239}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 44,47 **** --- 46,53 ---- {1706553E-2EDE-4A20-96A5-60ACD10A8F2D}.Release|Win32.ActiveCfg = Release|Win32 {1706553E-2EDE-4A20-96A5-60ACD10A8F2D}.Release|Win32.Build.0 = Release|Win32 + {F0ACE42D-3488-4054-B683-3B4BC43CD239}.Debug|Win32.ActiveCfg = Debug|Win32 + {F0ACE42D-3488-4054-B683-3B4BC43CD239}.Debug|Win32.Build.0 = Debug|Win32 + {F0ACE42D-3488-4054-B683-3B4BC43CD239}.Release|Win32.ActiveCfg = Release|Win32 + {F0ACE42D-3488-4054-B683-3B4BC43CD239}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-04-03 14:53:19
|
Update of /cvsroot/com0com/hub4com/plugins/echo In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13948 Added Files: .cvsignore filter.cpp precomp.cpp echo.vcproj precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/04/03 14:53:06 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.cpp,v $ * Revision 1.1 2008/04/03 14:53:06 vfrolov * Initial revision * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/04/03 14:53:06 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/04/03 14:53:06 vfrolov * Initial revision * */ #ifndef _PRECOMP_H_ #define _PRECOMP_H_ #include <windows.h> #include <crtdbg.h> #include <iostream> using namespace std; #pragma warning(disable:4512) // assignment operator could not be generated #endif /* _PRECOMP_H_ */ --- NEW FILE: echo.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-echo" ProjectGUID="{F0ACE42D-3488-4054-B683-3B4BC43CD239}" 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/04/03 14:53:06 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/04/03 14:53:06 vfrolov * Initial revision * */ #include "precomp.h" #include "../plugins_api.h" /////////////////////////////////////////////////////////////// #ifndef _DEBUG #define DEBUG_PARAM(par) #else /* _DEBUG */ #define DEBUG_PARAM(par) par #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf = NULL; /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "echo", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Echo filter (more flexible alternative to --echo-route option).", }; 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>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl << endl << "IN method input data stream description:" << endl << " LINE_DATA(<data>) - <data> is the bytes." << endl << endl << "IN method output data stream description:" << endl << " LINE_DATA(<data>) - <data> is the input data stream bytes." << endl << endl << "IN method echo data stream description:" << endl << " LINE_DATA(<data>) - <data> is the input data stream bytes." << endl << endl << "Examples:" << endl << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --create-filter=flt --add-filters=0:" << GetPluginAbout()->pName << ",flt COM1 COM2" << endl << " - receive data from COM1 and send it as is back to COM1 and send it to COM2" << endl << " via filter flt." << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int /*argc*/, const char *const /*argv*/[]) { return HFILTER(1); } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER DEBUG_PARAM(hFilter), int /*nFromPort*/, HUB_MSG *pInMsg, HUB_MSG **ppEchoMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); _ASSERTE(*ppEchoMsg == NULL); if (pInMsg->type == HUB_MSG_TYPE_LINE_DATA) { _ASSERTE(pInMsg->u.buf.pBuf != NULL || pInMsg->u.buf.size == 0); if (pInMsg->u.buf.size == 0) return TRUE; *ppEchoMsg = pMsgInsertBuf(NULL, HUB_MSG_TYPE_LINE_DATA, pInMsg->u.buf.pBuf, pInMsg->u.buf.size); if (!*ppEchoMsg) return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, NULL, // Init InMethod, NULL, // 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, pMsgInsertBuf)) return NULL; pMsgInsertBuf = pHubRoutines->pMsgInsertBuf; return plugins; } /////////////////////////////////////////////////////////////// --- NEW FILE: .cvsignore --- *.user Release Debug |
From: Vyacheslav F. <vf...@us...> - 2008-04-03 14:51:29
|
Update of /cvsroot/com0com/hub4com/plugins/echo In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13337/echo Log Message: Directory /cvsroot/com0com/hub4com/plugins/echo added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-04-02 10:39:58
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24743 Modified Files: filter.cpp Log Message: Added discarding CONNECT(FALSE) from the input stream Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/awakseq/filter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filter.cpp 1 Apr 2008 14:52:46 -0000 1.1 --- filter.cpp 2 Apr 2008 10:39:54 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/04/01 14:52:46 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/04/02 10:39:54 vfrolov + * Added discarding CONNECT(FALSE) from the input stream + * * Revision 1.1 2008/04/01 14:52:46 vfrolov * Initial revision * */ *************** *** 148,152 **** << " LINE_DATA(<data>) - <data> is the raw bytes." << endl << " CONNECT(TRUE) - it will be discarded from stream." << endl ! << " CONNECT(FALSE) - start awakening sequence waiting." << endl << endl << "IN method output data stream description:" << endl --- 150,155 ---- << " LINE_DATA(<data>) - <data> is the raw bytes." << endl << " CONNECT(TRUE) - it will be discarded from stream." << endl ! << " CONNECT(FALSE) - it will be discarded from stream if CONNECT(TRUE) was not" << endl ! << " added yet. Start awakening sequence waiting." << endl << endl << "IN method output data stream description:" << endl *************** *** 165,170 **** << " - wait first byte from COM1 and then establish connection to" << endl << " 111.11.11.11:1111." << endl ! << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << ":\"--awak-seq=aaa\" --add-filters=0:" << GetPluginAbout()->pName << " COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait \"aaa\" from COM1 and then establish connection to 111.11.11.11:1111." << endl ; } --- 168,174 ---- << " - wait first byte from COM1 and then establish connection to" << endl << " 111.11.11.11:1111." << endl ! << " " << pProgPath << " --create-filter=pin2con --create-filter=" << GetPluginAbout()->pName << ":\"--awak-seq=aaa\" --add-filters=0:pin2con," << GetPluginAbout()->pName << " --rt-events=dsr COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait \"aaa\" from COM1 and then establish connection to 111.11.11.11:1111." << endl + << " and disconnect on DSR OFF." << endl ; } *************** *** 237,240 **** --- 241,246 ---- } } else { + // insert CONNECT(TRUE) instead data + pInMsg = pMsgReplaceVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE); } *************** *** 250,254 **** pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } else { - // start awakening sequence waiting State *pState = ((Filter *)hFilter)->GetState(nFromPort); --- 256,259 ---- *************** *** 256,259 **** --- 261,270 ---- return FALSE; + // discard CONNECT(FALSE) from the input stream + // if CONNECT(TRUE) was not added yet + if (pState->waitAwakSeq) + pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); + + // start awakening sequence waiting pState->StartAwakSeq(((Filter *)hFilter)->pAwakSeq); } |
From: Vyacheslav F. <vf...@us...> - 2008-04-02 10:36:43
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23588 Modified Files: hub4com.sln Log Message: Added filter-pin2con project Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** hub4com.sln 1 Apr 2008 14:54:51 -0000 1.4 --- hub4com.sln 2 Apr 2008 10:36:28 -0000 1.5 *************** *** 12,15 **** --- 12,17 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-awakseq", "plugins\awakseq\awakseq.vcproj", "{58AC48ED-1D7D-4947-8BAA-4CD813B24760}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-pin2con", "plugins\pin2con\pin2con.vcproj", "{1706553E-2EDE-4A20-96A5-60ACD10A8F2D}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 38,41 **** --- 40,47 ---- {58AC48ED-1D7D-4947-8BAA-4CD813B24760}.Release|Win32.ActiveCfg = Release|Win32 {58AC48ED-1D7D-4947-8BAA-4CD813B24760}.Release|Win32.Build.0 = Release|Win32 + {1706553E-2EDE-4A20-96A5-60ACD10A8F2D}.Debug|Win32.ActiveCfg = Debug|Win32 + {1706553E-2EDE-4A20-96A5-60ACD10A8F2D}.Debug|Win32.Build.0 = Debug|Win32 + {1706553E-2EDE-4A20-96A5-60ACD10A8F2D}.Release|Win32.ActiveCfg = Release|Win32 + {1706553E-2EDE-4A20-96A5-60ACD10A8F2D}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-04-02 10:33:27
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22438 Added Files: .cvsignore filter.cpp precomp.cpp pin2con.vcproj precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/04/02 10:33:23 vfrolov Exp $ * * Copyright (c) 2007 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.cpp,v $ * Revision 1.1 2008/04/02 10:33:23 vfrolov * Initial revision * * Revision 1.1 2007/03/26 08:00:50 vfrolov * Initial revision * * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/04/02 10:33: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: precomp.h,v $ * Revision 1.1 2008/04/02 10:33:23 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: .cvsignore --- *.user Release Debug --- NEW FILE: pin2con.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-pin2con" ProjectGUID="{1706553E-2EDE-4A20-96A5-60ACD10A8F2D}" 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/04/02 10:33: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: filter.cpp,v $ * Revision 1.1 2008/04/02 10:33:23 vfrolov * Initial revision * */ #include "precomp.h" #include "../plugins_api.h" /////////////////////////////////////////////////////////////// #ifndef _DEBUG #define DEBUG_PARAM(par) #else /* _DEBUG */ #define DEBUG_PARAM(par) par #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) { size_t lenPattern = strlen(pPattern); if (_strnicmp(pArg, pPattern, lenPattern) != 0) return NULL; return pArg + lenPattern; } /////////////////////////////////////////////////////////////// class State { public: State() : connect(FALSE) {} BOOL connect; }; /////////////////////////////////////////////////////////////// typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; class Filter { public: Filter(int argc, const char *const argv[]); State *GetState(int nPort); DWORD pin; BOOL negative; private: PortsMap portsMap; }; static struct { DWORD val; const char *pName; } pin_names[] = { {MS_CTS_ON, "cts"}, {MS_DSR_ON, "dsr"}, {MS_RLSD_ON, "dcd"}, {MS_RING_ON, "ring"}, }; Filter::Filter(int argc, const char *const argv[]) : pin(MS_DSR_ON), negative(FALSE) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); if (!pArg) { cerr << "Unknown option " << *pArgs << endl; continue; } const char *pParam; if ((pParam = GetParam(pArg, "connect=")) != NULL) { if (*pParam == '!') { negative = TRUE; pParam++; } BOOL found = FALSE; for (int i = 0 ; i < sizeof(pin_names)/sizeof(pin_names[0]) ; i++) { if (_stricmp(pParam, pin_names[i].pName) == 0) { pin = pin_names[i].val; found = TRUE; break; } } if (!found) cerr << "Unknown pin " << pParam << endl; } else { cerr << "Unknown option " << pArg << endl; } } } 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() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "pin2con", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Connect on pin state changing 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 << " --connect=[!]<pin> - <pin> is cts, dsr, dcd or ring (dsr by default)." << endl << endl << "IN method input data stream description:" << endl << " CONNECT(TRUE) - it will be discarded from stream." << endl << " CONNECT(FALSE) - it will be discarded from stream." << endl << " MODEM_STATUS(<value>) - current state of pins" << endl << endl << "IN method output data stream description:" << endl << " CONNECT(TRUE) - will be added on appropriate pin state changing." << endl << " CONNECT(FALSE) - will be added on appropriate pin state changing." << endl << endl << "Examples:" << endl << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0:" << GetPluginAbout()->pName << " --rt-events=dsr COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait DSR ON from COM1 and then establish connection to 111.11.11.11:1111" << endl << " and disconnect on DSR OFF." << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { return (HFILTER)new Filter(argc, argv); } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, int nFromPort, HUB_MSG *pInMsg, HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); _ASSERTE(*ppEchoMsg == NULL); if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { // discard any CONNECT messages from the input stream pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } else if (pInMsg->type == HUB_MSG_TYPE_MODEM_STATUS) { BOOL connect = ((pInMsg->u.val & ((Filter *)hFilter)->pin) != 0); if (((Filter *)hFilter)->negative) connect = !connect; State *pState = ((Filter *)hFilter)->GetState(nFromPort); if (!pState) return FALSE; if (pState->connect != connect) { pState->connect = connect; if (connect) { pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE); } else { pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, FALSE); } } } return pInMsg != NULL; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, NULL, // Init InMethod, NULL, // 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, pMsgReplaceNone)) { return NULL; } pMsgInsertVal = pHubRoutines->pMsgInsertVal; pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; return plugins; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-04-02 10:31:34
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21682/pin2con Log Message: Directory /cvsroot/com0com/hub4com/plugins/pin2con added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-04-02 10:30:31
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21273 Modified Files: inffile.cpp Log Message: Added check pointer for null Index: inffile.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** inffile.cpp 20 Sep 2007 12:39:59 -0000 1.5 --- inffile.cpp 2 Apr 2008 10:30:26 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/04/02 10:30:26 vfrolov + * Added check pointer for null + * * Revision 1.5 2007/09/20 12:39:59 vfrolov * Added SetLastError(ERROR_NOT_ENOUGH_MEMORY) *************** *** 35,39 **** * Initial revision * - * */ --- 38,41 ---- *************** *** 120,123 **** --- 122,130 ---- } + if (!pBuf) { + ShowError(MB_OK|MB_ICONSTOP, ERROR_INVALID_NAME, "GetFullPathName(%s)", pNearPath); + return FALSE; + } + if (DWORD(pBuf - pFilePath + lstrlen(pFileName)) >= lenFilePath) { ShowError(MB_OK|MB_ICONSTOP, ERROR_BUFFER_OVERFLOW, "GetFullPathName(%s)", pNearPath); |
From: Vyacheslav F. <vf...@us...> - 2008-04-02 10:28:31
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20508 Modified Files: setup.cpp Log Message: Added reload command Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** setup.cpp 27 Nov 2007 16:32:54 -0000 1.22 --- setup.cpp 2 Apr 2008 10:28:24 -0000 1.23 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.23 2008/04/02 10:28:24 vfrolov + * Added reload command + * * Revision 1.22 2007/11/27 16:32:54 vfrolov * Added disable and enable options *************** *** 496,500 **** } /////////////////////////////////////////////////////////////// ! int Update(InfFile &infFile) { Stack stack; --- 499,503 ---- } /////////////////////////////////////////////////////////////// ! int Reload(InfFile &infFile, BOOL update) { Stack stack; *************** *** 510,518 **** } ! BOOL rr; ! if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, infFile.Path(), INSTALLFLAG_FORCE, &rr)) { ! CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); ! return 1; } --- 513,523 ---- } ! BOOL rr = FALSE; ! if (update) { ! if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, infFile.Path(), INSTALLFLAG_FORCE, &rr)) { ! CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); ! return 1; ! } } *************** *** 969,972 **** --- 974,978 ---- " preinstall - preinstall driver\n" " update - update driver\n" + " reload - reload driver\n" " uninstall - uninstall all ports and the driver\n" " quit - quit\n" *************** *** 1123,1127 **** if (argc == 2 && !lstrcmpi(argv[1], "update")) { SetTitle(C0C_SETUP_TITLE " (UPDATE)"); ! return Update(infFile); } else --- 1129,1138 ---- if (argc == 2 && !lstrcmpi(argv[1], "update")) { SetTitle(C0C_SETUP_TITLE " (UPDATE)"); ! return Reload(infFile, TRUE); ! } ! else ! if (argc == 2 && !lstrcmpi(argv[1], "reload")) { ! SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Reload(infFile, FALSE); } else |
From: Vyacheslav F. <vf...@us...> - 2008-04-01 14:56:00
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2106 Modified Files: hub4com.sln Log Message: Added filter-awakseq project Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** hub4com.sln 28 Mar 2008 16:07:08 -0000 1.3 --- hub4com.sln 1 Apr 2008 14:54:51 -0000 1.4 *************** *** 10,13 **** --- 10,15 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-telnet", "plugins\telnet\telnet.vcproj", "{BE3A1495-71A9-4B47-B1AC-44CB14A6E721}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-awakseq", "plugins\awakseq\awakseq.vcproj", "{58AC48ED-1D7D-4947-8BAA-4CD813B24760}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 32,35 **** --- 34,41 ---- {BE3A1495-71A9-4B47-B1AC-44CB14A6E721}.Release|Win32.ActiveCfg = Release|Win32 {BE3A1495-71A9-4B47-B1AC-44CB14A6E721}.Release|Win32.Build.0 = Release|Win32 + {58AC48ED-1D7D-4947-8BAA-4CD813B24760}.Debug|Win32.ActiveCfg = Debug|Win32 + {58AC48ED-1D7D-4947-8BAA-4CD813B24760}.Debug|Win32.Build.0 = Debug|Win32 + {58AC48ED-1D7D-4947-8BAA-4CD813B24760}.Release|Win32.ActiveCfg = Release|Win32 + {58AC48ED-1D7D-4947-8BAA-4CD813B24760}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-04-01 14:54:23
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1672 Added Files: awakseq.vcproj .cvsignore Log Message: Initial revision --- NEW FILE: .cvsignore --- *.user Release Debug --- NEW FILE: awakseq.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-awakseq" ProjectGUID="{58AC48ED-1D7D-4947-8BAA-4CD813B24760}" 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> |
From: Vyacheslav F. <vf...@us...> - 2008-04-01 14:54:22
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1318 Added Files: filter.cpp Log Message: Initial revision --- NEW FILE: filter.cpp --- /* * $Id: filter.cpp,v 1.1 2008/04/01 14:52:46 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/04/01 14:52:46 vfrolov * Initial revision * * */ #include "precomp.h" #include "../plugins_api.h" /////////////////////////////////////////////////////////////// #ifndef _DEBUG #define DEBUG_PARAM(par) #else /* _DEBUG */ #define DEBUG_PARAM(par) par #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgReplaceVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgInsertNone = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) { size_t lenPattern = strlen(pPattern); if (_strnicmp(pArg, pPattern, lenPattern) != 0) return NULL; return pArg + lenPattern; } /////////////////////////////////////////////////////////////// class State { public: State(const BYTE *pAwakSeq) : connectionCounter(0) { StartAwakSeq(pAwakSeq); } void StartAwakSeq(const BYTE *pAwakSeq) { waitAwakSeq = TRUE; pAwakSeqNext = pAwakSeq; } BOOL waitAwakSeq; const BYTE *pAwakSeqNext; int connectionCounter; }; /////////////////////////////////////////////////////////////// typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; class Filter { public: Filter(int argc, const char *const argv[]); State *GetState(int nPort); const BYTE *pAwakSeq; private: PortsMap portsMap; }; Filter::Filter(int argc, const char *const argv[]) : pAwakSeq((const BYTE *)"") { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); if (!pArg) { cerr << "Unknown option " << *pArgs << endl; continue; } const char *pParam; if ((pParam = GetParam(pArg, "awak-seq=")) != NULL) { pAwakSeq = (const BYTE *)_strdup(pParam); } else { cerr << "Unknown option " << pArg << endl; } } } 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(pAwakSeq); return iPair->second; } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "awakseq", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Connect on awakening sequence 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 << " --awak-seq=<s> - set awakening sequence to <s>." << endl << endl << "IN method input data stream description:" << endl << " LINE_DATA(<data>) - <data> is the raw bytes." << endl << " CONNECT(TRUE) - it will be discarded from stream." << endl << " CONNECT(FALSE) - start awakening sequence waiting." << endl << endl << "IN method output data stream description:" << endl << " LINE_DATA(<data>) - <data> is the raw bytes w/o awakening sequence and all" << endl << " data before it." << endl << " CONNECT(TRUE) - will be added when awakening sequence found." << endl << endl << "OUT method input data stream description:" << endl << " CONNECT(TRUE) - increment connection counter." << endl << " CONNECT(FALSE) - decrement connection counter. The decrementing of the" << endl << " connection counter to 0 will start awakening sequence" << endl << " waiting." << endl << endl << "Examples:" << endl << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0:" << GetPluginAbout()->pName << " COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait first byte from COM1 and then establish connection to" << endl << " 111.11.11.11:1111." << endl << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << ":\"--awak-seq=aaa\" --add-filters=0:" << GetPluginAbout()->pName << " COM1 --use-port-module=tcp 111.11.11.11:1111" << endl << " - wait \"aaa\" from COM1 and then establish connection to 111.11.11.11:1111." << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { return (HFILTER)new Filter(argc, argv); } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, int nFromPort, HUB_MSG *pInMsg, HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); _ASSERTE(*ppEchoMsg == NULL); if (pInMsg->type == HUB_MSG_TYPE_LINE_DATA) { _ASSERTE(pInMsg->u.buf.pBuf != NULL || pInMsg->u.buf.size == 0); DWORD size = pInMsg->u.buf.size; if (size == 0) return TRUE; State *pState = ((Filter *)hFilter)->GetState(nFromPort); if (!pState) return FALSE; if (!pState->waitAwakSeq) return TRUE; BYTE *pBuf = pInMsg->u.buf.pBuf; const BYTE *pAwakSeqNext = pState->pAwakSeqNext; for ( ; *pAwakSeqNext && size ; size--) { if (*pAwakSeqNext == *pBuf++) pAwakSeqNext++; else pAwakSeqNext = ((Filter *)hFilter)->pAwakSeq; } if (!*pAwakSeqNext) { pState->waitAwakSeq = FALSE; if (size) { // insert CONNECT(TRUE) before rest of data if (pBuf != pInMsg->u.buf.pBuf) { memmove(pInMsg->u.buf.pBuf, pBuf, size); pBuf = pInMsg->u.buf.pBuf; } pInMsg->type = HUB_MSG_TYPE_CONNECT; pInMsg->u.val = TRUE; pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); if (pInMsg) { pInMsg->type = HUB_MSG_TYPE_LINE_DATA; pInMsg->u.buf.pBuf = pBuf; pInMsg->u.buf.size = size; } } else { pInMsg = pMsgReplaceVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE); } } else { pInMsg->u.buf.size = 0; pState->pAwakSeqNext = pAwakSeqNext; } } else if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { if (pInMsg->u.val) { // discard CONNECT(TRUE) from the input stream pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } else { // start awakening sequence waiting State *pState = ((Filter *)hFilter)->GetState(nFromPort); if (!pState) return FALSE; pState->StartAwakSeq(((Filter *)hFilter)->pAwakSeq); } } return pInMsg != NULL; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, int /*nFromPort*/, int nToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(pOutMsg != NULL); if (pOutMsg->type == HUB_MSG_TYPE_CONNECT) { State *pState = ((Filter *)hFilter)->GetState(nToPort); if (!pState) return FALSE; if (pOutMsg->u.val) { pState->connectionCounter++; _ASSERTE(pState->connectionCounter > 0); } else { _ASSERTE(pState->connectionCounter > 0); if (--pState->connectionCounter <= 0) pState->StartAwakSeq(((Filter *)hFilter)->pAwakSeq); } } return TRUE; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, NULL, // Init 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, pMsgReplaceVal) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone)) { return NULL; } pMsgReplaceVal = pHubRoutines->pMsgReplaceVal; pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; pMsgInsertNone = pHubRoutines->pMsgInsertNone; return plugins; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-04-01 14:53:24
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1292 Added Files: precomp.cpp precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/04/01 14:52:24 vfrolov Exp $ * * Copyright (c) 2007 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.cpp,v $ * Revision 1.1 2008/04/01 14:52:24 vfrolov * Initial revision * * Revision 1.1 2007/03/26 08:00:50 vfrolov * Initial revision * * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/04/01 14:52:24 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/04/01 14:52:24 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_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-04-01 14:49:09
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32264/awakseq Log Message: Directory /cvsroot/com0com/hub4com/plugins/awakseq added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-03-31 12:02:11
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19069 Modified Files: wait.c Log Message: Fixed cleaning of already occured events on wait mask setting Index: wait.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/wait.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wait.c 23 Jun 2006 11:44:52 -0000 1.2 --- wait.c 31 Mar 2008 12:02:06 -0000 1.3 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/03/31 12:02:06 vfrolov + * Fixed cleaning of already occured events on wait mask setting + * * Revision 1.2 2006/06/23 11:44:52 vfrolov * Mass replacement pDevExt by pIoPort *************** *** 107,111 **** pIoPort->waitMask = *pSysBuf; ! pIoPort->eventMask = 0; KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); --- 110,114 ---- pIoPort->waitMask = *pSysBuf; ! pIoPort->eventMask &= pIoPort->waitMask; KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); |
From: Vyacheslav F. <vf...@us...> - 2008-03-28 16:07:12
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20781 Modified Files: hub4com.sln Log Message: Added project filter-telnet Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hub4com.sln 27 Mar 2008 17:21:03 -0000 1.2 --- hub4com.sln 28 Mar 2008 16:07:08 -0000 1.3 *************** *** 8,11 **** --- 8,13 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "port-tcp", "plugins\tcp\tcp.vcproj", "{A1F397C9-2779-49D9-886F-A25D5E41EB0B}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-telnet", "plugins\telnet\telnet.vcproj", "{BE3A1495-71A9-4B47-B1AC-44CB14A6E721}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 26,29 **** --- 28,35 ---- {A1F397C9-2779-49D9-886F-A25D5E41EB0B}.Release|Win32.ActiveCfg = Release|Win32 {A1F397C9-2779-49D9-886F-A25D5E41EB0B}.Release|Win32.Build.0 = Release|Win32 + {BE3A1495-71A9-4B47-B1AC-44CB14A6E721}.Debug|Win32.ActiveCfg = Debug|Win32 + {BE3A1495-71A9-4B47-B1AC-44CB14A6E721}.Debug|Win32.Build.0 = Debug|Win32 + {BE3A1495-71A9-4B47-B1AC-44CB14A6E721}.Release|Win32.ActiveCfg = Release|Win32 + {BE3A1495-71A9-4B47-B1AC-44CB14A6E721}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-03-28 16:05:51
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20032 Added Files: .cvsignore filter.cpp telnet.vcproj Log Message: Initial revision --- NEW FILE: .cvsignore --- *.user Release Debug --- NEW FILE: filter.cpp --- /* * $Id: filter.cpp,v 1.1 2008/03/28 16:05:44 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/03/28 16:05:44 vfrolov * Initial revision * * */ #include "precomp.h" #include "../plugins_api.h" #include "telnet.h" /////////////////////////////////////////////////////////////// static ROUTINE_MSG_REPLACE_BUF *pMsgReplaceBuf = NULL; static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf = NULL; static ROUTINE_PORT_NAME_A *pPortName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) { size_t lenPattern = strlen(pPattern); if (_strnicmp(pArg, pPattern, lenPattern) != 0) return NULL; return pArg + lenPattern; } /////////////////////////////////////////////////////////////// typedef map<int, TelnetProtocol*> PortsMap; typedef pair<int, TelnetProtocol*> PortPair; class Filter { public: Filter(int argc, const char *const argv[]); void SetHub(HHUB _hHub) { hHub = _hHub; } TelnetProtocol *GetProtocol(int nPort); void DelProtocol(int nPort); private: HHUB hHub; string terminalType; PortsMap portsMap; }; Filter::Filter(int argc, const char *const argv[]) : hHub(NULL), terminalType("UNKNOWN") { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); if (!pArg) { cerr << "Unknown option " << *pArgs << endl; continue; } const char *pParam; if ((pParam = GetParam(pArg, "terminal=")) != NULL) { terminalType = pParam; } else { cerr << "Unknown option " << pArg << endl; } } } TelnetProtocol *Filter::GetProtocol(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 TelnetProtocol(pPortName(hHub, nPort)); if (iPair->second) iPair->second->SetTerminalType(terminalType.c_str()); } return iPair->second; } void Filter::DelProtocol(int nPort) { PortsMap::iterator iPair = portsMap.find(nPort); if (iPair != portsMap.end()) { if (iPair->second) delete iPair->second; iPair->second = NULL; } } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "telnet", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Telnet protocol 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 << " --terminal=<t> - use terminal type <t> (RFC 1091)." << endl << endl << "IN method input data stream description:" << endl << " LINE_DATA(<data>) - <data> is the telnet protocol wrapped raw bytes." << endl << " CONNECT(TRUE) - start telnet protocol engine if it's not started." << endl << " CONNECT(FALSE) - stop telnet protocol engine if it's started." << endl << endl << "IN method output data stream description:" << endl << " LINE_DATA(<data>) - <data> is the raw bytes." << endl << endl << "IN method echo data stream description:" << endl << " LINE_DATA(<data>) - <data> is the telnet protocol wrapped raw bytes." << endl << endl << "OUT method input data stream description:" << endl << " LINE_DATA(<data>) - <data> is the raw bytes." << endl << endl << "OUT method output data stream description:" << endl << " LINE_DATA(<data>) - <data> is the telnet protocol wrapped raw bytes." << endl << endl << "Examples:" << endl << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << ":\"--terminal=ANSI\" --add-filters=1:" << GetPluginAbout()->pName << " COM1 --use-port-module=tcp *your.telnet.server:telnet" << endl << " - use the ANSI terminal connected to the port COM1 for working on the" << endl << " telnet server your.telnet.server." << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { return (HFILTER)new Filter(argc, argv); } /////////////////////////////////////////////////////////////// static BOOL CALLBACK Init( HFILTER hFilter, HHUB hHub) { _ASSERTE(hFilter != NULL); _ASSERTE(hHub != NULL); ((Filter *)hFilter)->SetHub(hHub); return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, int nFromPort, HUB_MSG *pInMsg, HUB_MSG **ppEchoMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); _ASSERTE(*ppEchoMsg == NULL); if (pInMsg->type == HUB_MSG_TYPE_LINE_DATA) { _ASSERTE(pInMsg->u.buf.pBuf != NULL || pInMsg->u.buf.size == 0); if (pInMsg->u.buf.size == 0) return TRUE; TelnetProtocol *pTelnetProtocol = ((Filter *)hFilter)->GetProtocol(nFromPort); if (!pTelnetProtocol) return FALSE; pTelnetProtocol->Write(pInMsg->u.buf.pBuf, pInMsg->u.buf.size); pInMsg = pMsgReplaceBuf(pInMsg, HUB_MSG_TYPE_LINE_DATA, pTelnetProtocol->RecvData(), pTelnetProtocol->RecvDataLength()); pTelnetProtocol->RecvDataClear(); if (!pInMsg) return FALSE; if (pTelnetProtocol->ReadDataLength()) { *ppEchoMsg = pMsgInsertBuf(NULL, HUB_MSG_TYPE_LINE_DATA, pTelnetProtocol->ReadData(), pTelnetProtocol->ReadDataLength()); pTelnetProtocol->ReadDataClear(); if (!*ppEchoMsg) return FALSE; } } else if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { if (pInMsg->u.val) ((Filter *)hFilter)->GetProtocol(nFromPort); else ((Filter *)hFilter)->DelProtocol(nFromPort); } return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, int /*nFromPort*/, int nToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(pOutMsg != NULL); if (pOutMsg->type == HUB_MSG_TYPE_LINE_DATA) { _ASSERTE(pOutMsg->u.buf.pBuf != NULL || pOutMsg->u.buf.size == 0); if (pOutMsg->u.buf.size == 0) return TRUE; TelnetProtocol *pTelnetProtocol = ((Filter *)hFilter)->GetProtocol(nToPort); if (!pTelnetProtocol) return FALSE; pTelnetProtocol->Send(pOutMsg->u.buf.pBuf, pOutMsg->u.buf.size); pOutMsg = pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, pTelnetProtocol->ReadData(), pTelnetProtocol->ReadDataLength()); pTelnetProtocol->ReadDataClear(); if (!pOutMsg) return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, Init, 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, pMsgReplaceBuf) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertBuf) || !ROUTINE_IS_VALID(pHubRoutines, pPortName)) { return NULL; } pMsgReplaceBuf = pHubRoutines->pMsgReplaceBuf; pMsgInsertBuf = pHubRoutines->pMsgInsertBuf; pPortName = pHubRoutines->pPortName; return plugins; } /////////////////////////////////////////////////////////////// --- NEW FILE: telnet.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-telnet" ProjectGUID="{BE3A1495-71A9-4B47-B1AC-44CB14A6E721}" 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> <File RelativePath=".\telnet.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> <File RelativePath=".\telnet.cpp" > </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> |
From: Vyacheslav F. <vf...@us...> - 2008-03-28 16:05:19
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19986 Added Files: telnet.cpp telnet.h Log Message: Initial revision --- NEW FILE: telnet.h --- /* * $Id: telnet.h,v 1.1 2008/03/28 16:05:15 vfrolov Exp $ * * Copyright (c) 2005-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: telnet.h,v $ * Revision 1.1 2008/03/28 16:05:15 vfrolov * Initial revision * * */ #ifndef _TELNET_H #define _TELNET_H /////////////////////////////////////////////////////////////// typedef vector<BYTE> BYTE_vector; typedef basic_string<BYTE> BYTE_string; /////////////////////////////////////////////////////////////// class TelnetProtocol { public: TelnetProtocol(const char *pName); void SetTerminalType(const char *pTerminalType); void Write(const BYTE *pBuf, DWORD count); void Send(const BYTE *pBuf, DWORD count); DWORD ReadDataLength() const { return (DWORD)streamSendRead.size(); } const BYTE *ReadData() const { return streamSendRead.data(); } void ReadDataClear() { streamSendRead.clear(); } DWORD RecvDataLength() const { return (DWORD)streamWriteRecv.size(); } const BYTE *RecvData() const { return streamWriteRecv.data(); } void RecvDataClear() { streamWriteRecv.clear(); } void Clear(); protected: void SendOption(BYTE code, BYTE option); void SendSubNegotiation(int option, const BYTE_vector ¶ms); void SendRaw(const BYTE *pBuf, DWORD count) { streamSendRead.append(pBuf, count); } void WriteRaw(const BYTE *pBuf, DWORD count) { streamWriteRecv.append(pBuf, count); } string name; int state; int code; int option; BYTE_vector params; struct OptionState { enum {osCant, osNo, osYes}; int localOptionState : 2; int remoteOptionState : 2; }; OptionState options[256]; BYTE_vector terminalType; BYTE_string streamSendRead; BYTE_string streamWriteRecv; }; /////////////////////////////////////////////////////////////// #endif // _TELNET_H --- NEW FILE: telnet.cpp --- /* * $Id: telnet.cpp,v 1.1 2008/03/28 16:05:15 vfrolov Exp $ * * Copyright (c) 2005-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: telnet.cpp,v $ * Revision 1.1 2008/03/28 16:05:15 vfrolov * Initial revision * * */ #include "precomp.h" #include "telnet.h" /////////////////////////////////////////////////////////////// enum { cdSE = 240, cdSB = 250, cdWILL = 251, cdWONT = 252, cdDO = 253, cdDONT = 254, cdIAC = 255, }; static const char *code2name(unsigned code) { switch (code) { case cdSE: return "SE"; break; case cdSB: return "SB"; break; case cdWILL: return "WILL"; break; case cdWONT: return "WONT"; break; case cdDO: return "DO"; break; case cdDONT: return "DONT"; break; } return "UNKNOWN"; } /////////////////////////////////////////////////////////////// enum { opEcho = 1, opTerminalType = 24, }; /////////////////////////////////////////////////////////////// enum { stData, stCode, stOption, stSubParams, stSubCode, }; /////////////////////////////////////////////////////////////// TelnetProtocol::TelnetProtocol(const char *pName) : name(pName ? pName : "NONAME") { SetTerminalType(NULL); Clear(); } void TelnetProtocol::SetTerminalType(const char *pTerminalType) { terminalType.clear(); if (!pTerminalType) pTerminalType = "UNKNOWN"; while (*pTerminalType) terminalType.push_back(*pTerminalType++); } void TelnetProtocol::Clear() { cout << name << " RESET" << endl; state = stData; for(int i = 0 ; i < sizeof(options)/sizeof(options[0]) ; i++) { options[i].remoteOptionState = OptionState::osCant; options[i].localOptionState = OptionState::osCant; } options[opEcho].remoteOptionState = OptionState::osNo; options[opTerminalType].localOptionState = OptionState::osNo; streamSendRead.clear(); streamWriteRecv.clear(); } void TelnetProtocol::Send(const BYTE *pBuf, DWORD count) { for (DWORD i = 0 ; i < count ; i++) { BYTE ch = ((const BYTE *)pBuf)[i]; if (ch == cdIAC) SendRaw(&ch, 1); SendRaw(&ch, 1); } } void TelnetProtocol::Write(const BYTE *pBuf, DWORD count) { for (DWORD i = 0 ; i < count ; i++) { BYTE ch = ((const BYTE *)pBuf)[i]; switch (state) { case stData: if (ch == cdIAC) state = stCode; else WriteRaw(&ch, 1); break; case stCode: switch (ch) { case cdIAC: WriteRaw(&ch, 1); state = stData; break; case cdSB: case cdWILL: case cdWONT: case cdDO: case cdDONT: code = ch; state = stOption; break; default: cout << name << " RECV: unknown code " << (unsigned)ch << endl; state = stData; } break; case stOption: cout << name << " RECV: " << code2name(code) << " " << (unsigned)ch << endl; switch (code) { case cdSB: option = ch; params.clear(); state = stSubParams; break; case cdWILL: switch (options[ch].remoteOptionState) { case OptionState::osCant: SendOption(cdDONT, ch); break; case OptionState::osNo: options[ch].remoteOptionState = OptionState::osYes; SendOption(cdDO, ch); break; case OptionState::osYes: break; } break; case cdWONT: switch (options[ch].remoteOptionState) { case OptionState::osCant: case OptionState::osNo: break; case OptionState::osYes: options[ch].remoteOptionState = OptionState::osNo; SendOption(cdDONT, ch); break; } break; case cdDO: switch (options[ch].localOptionState) { case OptionState::osCant: SendOption(cdWONT, ch); break; case OptionState::osNo: options[ch].localOptionState = OptionState::osYes; SendOption(cdWILL, ch); break; case OptionState::osYes: break; } break; case cdDONT: switch (options[ch].localOptionState) { case OptionState::osCant: case OptionState::osNo: break; case OptionState::osYes: options[ch].localOptionState = OptionState::osNo; SendOption(cdWONT, ch); break; } break; default: cout << " ignored" << endl; }; if (state == stOption) state = stData; break; case stSubParams: if (ch == cdIAC) state = stSubCode; else params.push_back(ch); break; case stSubCode: switch (ch) { case cdIAC: state = stSubParams; break; case cdSE: cout << " "; { for (BYTE_vector::const_iterator i = params.begin() ; i != params.end() ; i++) cout << (unsigned)*i << " "; } cout << "SE" << endl; switch (option) { case opTerminalType: params.clear(); params.push_back(0); params.insert(params.end(), terminalType.begin(), terminalType.end()); SendSubNegotiation(option, params); break; default: cout << " ignored" << endl; } state = stData; break; default: cout << name << " RECV: unknown sub code " << (unsigned)ch << endl; state = stData; }; break; } } } void TelnetProtocol::SendOption(BYTE code, BYTE option) { BYTE buf[3] = {cdIAC, code, option}; cout << name << " SEND: " << code2name(code) << " " << (unsigned)option << endl; SendRaw(buf, sizeof(buf)); } void TelnetProtocol::SendSubNegotiation(int option, const BYTE_vector ¶ms) { SendOption(cdSB, (BYTE)option); cout << " "; for (BYTE_vector::const_iterator i = params.begin() ; i != params.end() ; i++) { BYTE b = *i; cout << (unsigned)b << " "; SendRaw(&b, sizeof(b)); } cout << "SE" << endl; BYTE buf[2] = {cdIAC, cdSE}; SendRaw(buf, sizeof(buf)); } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-03-28 16:04:51
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19605 Added Files: precomp.cpp precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/03/28 16:04:47 vfrolov Exp $ * * Copyright (c) 2007 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.cpp,v $ * Revision 1.1 2008/03/28 16:04:47 vfrolov * Initial revision * * Revision 1.1 2007/03/26 08:00:50 vfrolov * Initial revision * * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/03/28 16:04:47 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/03/28 16:04:47 vfrolov * Initial revision * * */ #ifndef _PRECOMP_H_ #define _PRECOMP_H_ #include <windows.h> #include <crtdbg.h> #include <string> #include <vector> #include <map> #include <iostream> using namespace std; #pragma warning(disable:4512) // assignment operator could not be generated #endif /* _PRECOMP_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-03-28 16:03:49
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19202/telnet Log Message: Directory /cvsroot/com0com/hub4com/plugins/telnet added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-03-28 16:03:20
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19169 Added Files: .cvsignore Log Message: Initial revision --- NEW FILE: .cvsignore --- *.user Release Debug |