com0com-cvs Mailing List for Null-modem emulator (Page 8)
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...> - 2009-03-06 07:56:33
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16239/plugins/tcp Modified Files: comparams.cpp port.cpp Log Message: Fixed assertion with non ascii chars Index: comparams.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comparams.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comparams.cpp 27 Nov 2008 13:46:29 -0000 1.4 --- comparams.cpp 6 Mar 2009 07:56:28 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2009/03/06 07:56:28 vfrolov + * Fixed assertion with non ascii chars + * * Revision 1.4 2008/11/27 13:46:29 vfrolov * Added --write-limit option *************** *** 65,69 **** BOOL ComParams::SetWriteQueueLimit(const char *pWriteQueueLimit) { ! if (isdigit(*pWriteQueueLimit)) { writeQueueLimit = atol(pWriteQueueLimit); return writeQueueLimit > 0; --- 68,72 ---- BOOL ComParams::SetWriteQueueLimit(const char *pWriteQueueLimit) { ! if (isdigit((unsigned char)*pWriteQueueLimit)) { writeQueueLimit = atol(pWriteQueueLimit); return writeQueueLimit > 0; Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/port.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** port.cpp 23 Jan 2009 16:55:05 -0000 1.12 --- port.cpp 6 Mar 2009 07:56:28 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2009/03/06 07:56:28 vfrolov + * Fixed assertion with non ascii chars + * * Revision 1.12 2009/01/23 16:55:05 vfrolov * Utilized timer routines *************** *** 187,191 **** } else ! if (isdigit(*pParam)) { reconnectTime = atoi(pParam); } --- 190,194 ---- } else ! if (isdigit((unsigned char)*pParam)) { reconnectTime = atoi(pParam); } |
From: Vyacheslav F. <vf...@us...> - 2009-03-06 07:56:33
|
Update of /cvsroot/com0com/hub4com/plugins/linectl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16239/plugins/linectl Modified Files: filter.cpp Log Message: Fixed assertion with non ascii chars Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/filter.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** filter.cpp 2 Feb 2009 15:21:42 -0000 1.11 --- filter.cpp 6 Mar 2009 07:56:28 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2009/03/06 07:56:28 vfrolov + * Fixed assertion with non ascii chars + * * Revision 1.11 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 137,141 **** soOutMask |= SO_SET_BR; ! switch (tolower(*pParam)) { case 'l': goInMask[0] |= GO0_LBR_STATUS; --- 140,144 ---- soOutMask |= SO_SET_BR; ! switch (tolower((unsigned char)*pParam)) { case 'l': goInMask[0] |= GO0_LBR_STATUS; *************** *** 153,157 **** soOutMask |= SO_SET_LC; ! switch (tolower(*pParam)) { case 'l': goInMask[0] |= GO0_LLC_STATUS; --- 156,160 ---- soOutMask |= SO_SET_LC; ! switch (tolower((unsigned char)*pParam)) { case 'l': goInMask[0] |= GO0_LLC_STATUS; |
From: Vyacheslav F. <vf...@us...> - 2009-03-06 07:56:32
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16239/plugins/serial Modified Files: comparams.cpp Log Message: Fixed assertion with non ascii chars Index: comparams.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comparams.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comparams.cpp 27 Nov 2008 13:44:52 -0000 1.6 --- comparams.cpp 6 Mar 2009 07:56:28 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2009/03/06 07:56:28 vfrolov + * Fixed assertion with non ascii chars + * * Revision 1.6 2008/11/27 13:44:52 vfrolov * Added --write-limit option *************** *** 76,85 **** BOOL ComParams::SetBaudRate(const char *pBaudRate) { ! if (tolower(*pBaudRate) == 'c') { baudRate = -1; return TRUE; } ! if (isdigit(*pBaudRate)) { baudRate = atol(pBaudRate); return TRUE; --- 79,88 ---- BOOL ComParams::SetBaudRate(const char *pBaudRate) { ! if (tolower((unsigned char)*pBaudRate) == 'c') { baudRate = -1; return TRUE; } ! if (isdigit((unsigned char)*pBaudRate)) { baudRate = atol(pBaudRate); return TRUE; *************** *** 91,100 **** BOOL ComParams::SetByteSize(const char *pByteSize) { ! if (tolower(*pByteSize) == 'c') { byteSize = -1; return TRUE; } ! if (isdigit(*pByteSize)) { byteSize = atoi(pByteSize); return TRUE; --- 94,103 ---- BOOL ComParams::SetByteSize(const char *pByteSize) { ! if (tolower((unsigned char)*pByteSize) == 'c') { byteSize = -1; return TRUE; } ! if (isdigit((unsigned char)*pByteSize)) { byteSize = atoi(pByteSize); return TRUE; *************** *** 106,110 **** BOOL ComParams::SetParity(const char *pParity) { ! switch (tolower(*pParity)) { case 'n': parity = NOPARITY; break; case 'o': parity = ODDPARITY; break; --- 109,113 ---- BOOL ComParams::SetParity(const char *pParity) { ! switch (tolower((unsigned char)*pParity)) { case 'n': parity = NOPARITY; break; case 'o': parity = ODDPARITY; break; *************** *** 120,124 **** BOOL ComParams::SetStopBits(const char *pStopBits) { ! switch (tolower(*pStopBits)) { case '1': if ((pStopBits[1] == '.' || pStopBits[1] == ',') && pStopBits[2] == '5') --- 123,127 ---- BOOL ComParams::SetStopBits(const char *pStopBits) { ! switch (tolower((unsigned char)*pStopBits)) { case '1': if ((pStopBits[1] == '.' || pStopBits[1] == ',') && pStopBits[2] == '5') *************** *** 136,140 **** BOOL ComParams::SetIntervalTimeout(const char *pIntervalTimeout) { ! if (isdigit(*pIntervalTimeout)) { intervalTimeout = atol(pIntervalTimeout); return TRUE; --- 139,143 ---- BOOL ComParams::SetIntervalTimeout(const char *pIntervalTimeout) { ! if (isdigit((unsigned char)*pIntervalTimeout)) { intervalTimeout = atol(pIntervalTimeout); return TRUE; *************** *** 146,150 **** BOOL ComParams::SetWriteQueueLimit(const char *pWriteQueueLimit) { ! if (isdigit(*pWriteQueueLimit)) { writeQueueLimit = atol(pWriteQueueLimit); return writeQueueLimit > 0; --- 149,153 ---- BOOL ComParams::SetWriteQueueLimit(const char *pWriteQueueLimit) { ! if (isdigit((unsigned char)*pWriteQueueLimit)) { writeQueueLimit = atol(pWriteQueueLimit); return writeQueueLimit > 0; *************** *** 164,168 **** } else ! if (tolower(*pFlagStr) == 'c') { *pFlag = -1; } --- 167,171 ---- } else ! if (tolower((unsigned char)*pFlagStr) == 'c') { *pFlag = -1; } |
From: Vyacheslav F. <vf...@us...> - 2009-02-20 18:32:48
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15554/plugins/telnet Modified Files: filter.cpp Log Message: Added info about location of options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** filter.cpp 17 Feb 2009 14:17:37 -0000 1.17 --- filter.cpp 20 Feb 2009 18:32:35 -0000 1.18 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.18 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.17 2009/02/17 14:17:37 vfrolov * Redesigned timer's API *************** *** 88,91 **** --- 91,95 ---- static ROUTINE_TIMER_DELETE *pTimerDelete; static ROUTINE_FILTERPORT *pFilterPort; + static ROUTINE_GET_ARG_INFO_A *pGetArgInfo; /////////////////////////////////////////////////////////////// #ifndef _DEBUG *************** *** 105,108 **** --- 109,141 ---- } /////////////////////////////////////////////////////////////// + static void Diag(const char *pPref, const char *pArg) + { + cerr << pPref << "'" << pArg << "'"; + + string pref(" ("); + string suff; + + const ARG_INFO_A *pInfo = pGetArgInfo(pArg); + + if (ITEM_IS_VALID(pInfo, pFile) && pInfo->pFile != NULL) { + cerr << pref << "file " << pInfo->pFile; + pref = ", "; + suff = ")"; + } + + if (ITEM_IS_VALID(pInfo, iLine) && pInfo->iLine >= 0) { + cerr << pref << "line " << (pInfo->iLine + 1); + pref = ", "; + suff = ")"; + } + + cerr << suff; + + if (ITEM_IS_VALID(pInfo, pReference) && pInfo->pReference != NULL) + cerr << "," << endl << pInfo->pReference; + + cerr << endl; + } + /////////////////////////////////////////////////////////////// class Valid { public: *************** *** 203,207 **** if (!pArg) { ! cerr << "Unknown option " << *pArgs << endl; Invalidate(); continue; --- 236,240 ---- if (!pArg) { ! Diag("Unknown option ", *pArgs); Invalidate(); continue; *************** *** 226,230 **** break; default: ! cerr << "Unknown value in " << *pArgs << endl; Invalidate(); } --- 259,263 ---- break; default: ! Diag("Unknown value in ", *pArgs); Invalidate(); } *************** *** 240,244 **** break; default: ! cerr << "Unknown value in " << *pArgs << endl; Invalidate(); } --- 273,277 ---- break; default: ! Diag("Unknown value in ", *pArgs); Invalidate(); } *************** *** 249,258 **** keepActive = (unsigned)atol(pParam); } else { ! cerr << "Invalid value in " << *pArgs << endl; Invalidate(); } } else { ! cerr << "Unknown option " << *pArgs << endl; Invalidate(); } --- 282,291 ---- keepActive = (unsigned)atol(pParam); } else { ! Diag("Invalid value in ", *pArgs); Invalidate(); } } else { ! Diag("Unknown option ", *pArgs); Invalidate(); } *************** *** 900,904 **** !ROUTINE_IS_VALID(pHubRoutines, pTimerSet) || !ROUTINE_IS_VALID(pHubRoutines, pTimerDelete) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterPort)) { return NULL; --- 933,938 ---- !ROUTINE_IS_VALID(pHubRoutines, pTimerSet) || !ROUTINE_IS_VALID(pHubRoutines, pTimerDelete) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterPort) || ! !ROUTINE_IS_VALID(pHubRoutines, pGetArgInfo)) { return NULL; *************** *** 916,919 **** --- 950,954 ---- pTimerDelete = pHubRoutines->pTimerDelete; pFilterPort = pHubRoutines->pFilterPort; + pGetArgInfo = pHubRoutines->pGetArgInfo; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2009-02-20 18:32:47
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15554 Modified Files: export.cpp filters.cpp hub4com.cpp utils.cpp utils.h Log Message: Added info about location of options Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** hub4com.cpp 4 Feb 2009 12:26:54 -0000 1.22 --- hub4com.cpp 20 Feb 2009 18:32:35 -0000 1.23 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.23 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.22 2009/02/04 12:26:54 vfrolov * Implemented --load option for filters *************** *** 154,159 **** << " and put arguments <Args> (if any) to the filter." << endl << " Add filter to the end of filter group <FGID>" << endl ! << " (<FGID> is <MID> by default)." << endl ! << " Any filter can accept " << Args::LoadPrefix() << "... option." << endl << " --add-filters=<Lst>:<LstF>" << endl << " - attach the filters listed in <LstF> to the ports" << endl --- 157,162 ---- << " and put arguments <Args> (if any) to the filter." << endl << " Add filter to the end of filter group <FGID>" << endl ! << " (<FGID> is <MID> by default). Any filter can" << endl ! << " accept described above option " << Args::LoadPrefix() << "[...]." << endl << " --add-filters=<Lst>:<LstF>" << endl << " - attach the filters listed in <LstF> to the ports" << endl *************** *** 322,326 **** } /////////////////////////////////////////////////////////////// ! static void CreateFilter( const Plugins &plugins, Filters &filter, --- 325,329 ---- } /////////////////////////////////////////////////////////////// ! static BOOL CreateFilter( const Plugins &plugins, Filters &filter, *************** *** 341,345 **** if (!pPlugin || !*pPlugin) { cerr << "No module name." << endl; ! exit(1); } --- 344,349 ---- if (!pPlugin || !*pPlugin) { cerr << "No module name." << endl; ! free(pTmp); ! return FALSE; } *************** *** 348,352 **** if (!pPluginName || !*pPluginName) { cerr << "No module name." << endl; ! exit(1); } --- 352,357 ---- if (!pPluginName || !*pPluginName) { cerr << "No module name." << endl; ! free(pTmp); ! return FALSE; } *************** *** 358,362 **** if (!pFltRoutines) { cerr << "No filter module " << pPluginName << endl; ! exit(1); } --- 363,368 ---- if (!pFltRoutines) { cerr << "No filter module " << pPluginName << endl; ! free(pTmp); ! return FALSE; } *************** *** 372,380 **** if (!filter.CreateFilter(pFltRoutines, pFilterGroup, pFilterName, hConfig, pArgs)) { ! cerr << "Invalid filter " << pParam << endl; ! exit(1); } free(pTmp); } /////////////////////////////////////////////////////////////// --- 378,387 ---- if (!filter.CreateFilter(pFltRoutines, pFilterGroup, pFilterName, hConfig, pArgs)) { ! free(pTmp); ! return FALSE; } free(pTmp); + return TRUE; } /////////////////////////////////////////////////////////////// *************** *** 488,492 **** Args args(argc - 1, argv + 1); ! for (vector<string>::const_iterator i = args.begin() ; i != args.end() ; i++) { if (!GetParam(i->c_str(), "--")) hub.Add(); --- 495,499 ---- Args args(argc - 1, argv + 1); ! for (vector<Arg>::const_iterator i = args.begin() ; i != args.end() ; i++) { if (!GetParam(i->c_str(), "--")) hub.Add(); *************** *** 512,516 **** const char *pUseDriver = "serial"; ! for (vector<string>::const_iterator i = args.begin() ; i != args.end() ; i++) { BOOL ok = pPlugins->Config(i->c_str()); const char *pArg = GetParam(i->c_str(), "--"); --- 519,523 ---- const char *pUseDriver = "serial"; ! for (vector<Arg>::const_iterator i = args.begin() ; i != args.end() ; i++) { BOOL ok = pPlugins->Config(i->c_str()); const char *pArg = GetParam(i->c_str(), "--"); *************** *** 588,596 **** } ! CreateFilter(*pPlugins, *pFilters, pParam); } else if ((pParam = GetParam(pArg, "add-filters=")) != NULL) { if (!pFilters) { ! cerr << "No create-filter option before " << i->c_str() << endl; exit(1); } --- 595,608 ---- } ! if (!CreateFilter(*pPlugins, *pFilters, pParam)) { ! cerr << "Can't create filter by '" << i->c_str() << "'"; ! i->OutReference(cerr, " (", ")") << endl; ! exit(1); ! } } else if ((pParam = GetParam(pArg, "add-filters=")) != NULL) { if (!pFilters) { ! cerr << "There is not any --create-filter option before '" << i->c_str() << "'"; ! i->OutReference(cerr, " (", ")") << endl; exit(1); } *************** *** 602,606 **** } else { if (!ok) { ! cerr << "Unknown option " << i->c_str() << endl; exit(1); } --- 614,619 ---- } else { if (!ok) { ! cerr << "Unknown option '" << i->c_str() << "'"; ! i->OutReference(cerr, " (", ")") << endl; exit(1); } Index: utils.h =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** utils.h 4 Feb 2009 12:26:54 -0000 1.6 --- utils.h 20 Feb 2009 18:32:35 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.6 2009/02/04 12:26:54 vfrolov * Implemented --load option for filters *************** *** 48,52 **** /////////////////////////////////////////////////////////////// ! class Args : public vector<string> { public: --- 51,88 ---- /////////////////////////////////////////////////////////////// ! class Arg : protected ARG_INFO_A ! { ! public: ! Arg(const char *_pArg, ! const char *_pFile = NULL, ! int _iLine = -1, ! const char *_pReference = NULL) ! { ! Init(_pArg, _pFile, _iLine, _pReference); ! } ! ! Arg(const Arg &arg) { ! Init(arg.c_str(), arg.pFile, arg.iLine, arg.pReference); ! } ! ! Arg::~Arg(); ! ! const char *c_str() const { return (const char *)pBuf; } ! ostream &Arg::OutReference(ostream &out, const string &prefix, const string &suffix) const; ! ! static Arg *Arg::GetArg(const char *_pArg); ! static const ARG_INFO_A *Arg::GetArgInfo(const char *_pArg) { return GetArg(_pArg); } ! ! protected: ! void Init( ! const char *_pArg, ! const char *_pFile, ! int _iLine, ! const char *_pReference); ! ! BYTE *pBuf; ! }; ! /////////////////////////////////////////////////////////////// ! class Args : public vector<Arg> { public: *************** *** 54,58 **** Args(int argc, const char *const argv[]); ! void Add(const vector<string> &args); static const char *LoadPrefix() { return "--load="; } --- 90,94 ---- Args(int argc, const char *const argv[]); ! void Add(const vector<Arg> &args); static const char *LoadPrefix() { return "--load="; } *************** *** 60,64 **** private: ! void Add(const string &arg); int num_recursive; --- 96,100 ---- private: ! void Add(const Arg &arg); int num_recursive; Index: export.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/export.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** export.cpp 17 Feb 2009 14:17:36 -0000 1.14 --- export.cpp 20 Feb 2009 18:32:35 -0000 1.15 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.15 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.14 2009/02/17 14:17:36 vfrolov * Redesigned timer's API *************** *** 74,77 **** --- 77,81 ---- #include "filter.h" #include "timer.h" + #include "utils.h" /////////////////////////////////////////////////////////////// *************** *** 303,306 **** --- 307,315 ---- } /////////////////////////////////////////////////////////////// + static const ARG_INFO_A * CALLBACK get_arg_info(const char *pArg) + { + return Arg::GetArgInfo(pArg); + } + /////////////////////////////////////////////////////////////// HUB_ROUTINES_A hubRoutines = { sizeof(HUB_ROUTINES_A), *************** *** 323,326 **** --- 332,336 ---- filter_port, get_filter, + get_arg_info, }; /////////////////////////////////////////////////////////////// Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** utils.cpp 4 Feb 2009 12:26:54 -0000 1.7 --- utils.cpp 20 Feb 2009 18:32:35 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.7 2009/02/04 12:26:54 vfrolov * Implemented --load option for filters *************** *** 48,64 **** #include "precomp.h" #include "utils.h" /////////////////////////////////////////////////////////////// Args::Args(int argc, const char *const argv[]) : num_recursive(0) { for (int i = 0 ; i < argc ; i++) ! Add(argv[i]); } ! void Args::Add(const vector<string> &args) { ! for (vector<string>::const_iterator i = args.begin() ; i != args.end() ; i++) Add(*i); } --- 51,161 ---- #include "precomp.h" + #include "plugins/plugins_api.h" + #include "utils.h" /////////////////////////////////////////////////////////////// + #define ARG_SIGNATURE 'h4cA' + + void Arg::Init( + const char *_pArg, + const char *_pFile, + int _iLine, + const char *_pReference) + { + pFile = ((_pFile && *_pFile) ? _strdup(_pFile) : NULL); + iLine = _iLine; + pReference = ((_pReference && *_pReference) ? _strdup(_pReference) : NULL); + + pBuf = new BYTE[(strlen(_pArg) + 1) * sizeof(char) + #ifdef _DEBUG + + sizeof(DWORD) + #endif + + sizeof(Arg **)]; + + if (!pBuf) { + cerr << "No enough memory." << endl; + exit(2); + } + + #ifdef _DEBUG + *(DWORD *)pBuf = ARG_SIGNATURE; + pBuf += sizeof(DWORD); + #endif + + *(Arg **)pBuf = this; + pBuf += sizeof(Arg **); + + strcpy((char *)pBuf, _pArg); + } + + Arg::~Arg() + { + if (pBuf) { + _ASSERTE(*(DWORD *)(pBuf - sizeof(DWORD) - sizeof(Arg **)) == ARG_SIGNATURE); + + #ifdef _DEBUG + *(DWORD *)(pBuf - sizeof(DWORD) - sizeof(Arg **)) = 0; + #endif + + delete [] (pBuf + #ifdef _DEBUG + - sizeof(DWORD) + #endif + - sizeof(Arg **)); + } + + if (pReference) + free((void *)pReference); + + if (pFile) + free((void *)pFile); + } + + ostream &Arg::OutReference(ostream &out, const string &prefix, const string &suffix) const + { + string pref(prefix); + string suff; + + if (pFile) { + out << pref << "file " << pFile; + pref = ", "; + suff = suffix; + } + + if (iLine >= 0) { + out << pref << "line " << (iLine + 1); + pref = ", "; + suff = suffix; + } + + out << suff; + + if (pReference) + out << "," << endl << pReference; + + return out; + } + + Arg *Arg::GetArg(const char *_pArg) + { + if (!_pArg) + return NULL; + + _ASSERTE(*(DWORD *)((const BYTE *)_pArg - sizeof(DWORD) - sizeof(Arg **)) == ARG_SIGNATURE); + + return *(Arg **)((const BYTE *)_pArg - sizeof(Arg **)); + } + /////////////////////////////////////////////////////////////// Args::Args(int argc, const char *const argv[]) : num_recursive(0) { for (int i = 0 ; i < argc ; i++) ! Add(Arg(argv[i])); } ! void Args::Add(const vector<Arg> &args) { ! for (vector<Arg>::const_iterator i = args.begin() ; i != args.end() ; i++) Add(*i); } *************** *** 105,114 **** } ! void Args::Add(const string &arg) { const char *pLoad = GetParam(arg.c_str(), LoadPrefix()); if (!pLoad) { ! //cout << "<" << arg << ">" << endl; push_back(arg); return; --- 202,211 ---- } ! void Args::Add(const Arg &arg) { const char *pLoad = GetParam(arg.c_str(), LoadPrefix()); if (!pLoad) { ! //cout << "<" << arg.c_str() << ">" << endl; push_back(arg); return; *************** *** 151,154 **** --- 248,253 ---- if (ifile.fail()) { cerr << "Can't open file " << pFile << endl; + cerr << "by '" << arg.c_str() << "'"; + arg.OutReference(cerr, " (", ")") << endl; exit(1); } *************** *** 164,168 **** paramsLoad.push_back(p); ! while (pInStream->good()) { stringstream line; --- 263,267 ---- paramsLoad.push_back(p); ! for (int iLine = 0 ; pInStream->good() ; iLine++) { stringstream line; *************** *** 170,173 **** --- 269,276 ---- if (!pInStream->fail()) { + char ch; + + pInStream->get(ch); + string str = line.str(); *************** *** 203,222 **** if (num_recursive > RecursiveMax()) { ! cerr << "Too many recursive options " << arg << endl; exit(1); } num_recursive++; ! Add(str); num_recursive--; } } else { if (!pInStream->eof()) pInStream->clear(); - } ! char ch; ! pInStream->get(ch); } --- 306,334 ---- if (num_recursive > RecursiveMax()) { ! cerr << "Too many recursive options " << LoadPrefix() << endl; exit(1); } num_recursive++; ! ! stringstream reference; ! ! reference << "loaded by '" << arg.c_str() << "'"; ! ! arg.OutReference(reference, " (", ")"); ! ! Add(Arg(str.c_str(), pFile, iLine, reference.str().c_str())); ! num_recursive--; } + continue; } else { if (!pInStream->eof()) pInStream->clear(); ! char ch; ! pInStream->get(ch); ! } } *************** *** 380,386 **** const char ***pArgv) { - vector<string> tokens; - if (pArgs) { char *pTmp = _strdup(pArgs); --- 492,497 ---- const char ***pArgv) { if (pArgs) { + vector<Arg> tokens; char *pTmp = _strdup(pArgs); *************** *** 397,407 **** pToken = STRQTOK_R(NULL, " ", &pSave, "\"\"", TRUE, TRUE)) { ! tokens.push_back(pToken); } free(pTmp); - } ! args.Add(tokens); *pArgc = int(args.size() + 1); --- 508,524 ---- pToken = STRQTOK_R(NULL, " ", &pSave, "\"\"", TRUE, TRUE)) { ! tokens.push_back(Arg(pToken)); } free(pTmp); ! args.Add(tokens); ! ! //cout << pArgs << ":" << endl; ! //for (vector<Arg>::const_iterator i = args.begin() ; i != args.end() ; i++) { ! // cout << "'" << i->c_str() << "'"; ! // i->OutReference(cerr, " (", ")") << endl; ! //} ! } *pArgc = int(args.size() + 1); *************** *** 413,417 **** } ! (*pArgv)[0] = pName; for (int i = 1 ; i < *pArgc ; i++) --- 530,541 ---- } ! Arg *pArgName = new Arg(pName); ! ! if (!pArgName) { ! cerr << "No enough memory." << endl; ! exit(2); ! } ! ! (*pArgv)[0] = pArgName->c_str(); for (int i = 1 ; i < *pArgc ; i++) *************** *** 423,428 **** void FreeArgsVector(const char **argv) { ! if (argv) free(argv); } /////////////////////////////////////////////////////////////// --- 547,558 ---- void FreeArgsVector(const char **argv) { ! if (argv) { ! Arg *pArgName = Arg::GetArg(argv[0]); ! ! if (pArgName) ! delete pArgName; ! free(argv); + } } /////////////////////////////////////////////////////////////// Index: filters.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/filters.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** filters.cpp 4 Feb 2009 12:26:54 -0000 1.9 --- filters.cpp 20 Feb 2009 18:32:35 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.9 2009/02/04 12:26:54 vfrolov * Implemented --load option for filters *************** *** 112,116 **** if (!hFilter) { - cerr << "Can't create filter " << pFilterName << endl; delete pFilter; return FALSE; --- 115,118 ---- |
From: Vyacheslav F. <vf...@us...> - 2009-02-20 18:32:46
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15554/plugins/serial Modified Files: port.cpp Log Message: Added info about location of options Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** port.cpp 27 Nov 2008 16:25:08 -0000 1.13 --- port.cpp 20 Feb 2009 18:32:35 -0000 1.14 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2009/02/20 18:32:35 vfrolov + * Added info about location of options + * * Revision 1.13 2008/11/27 16:25:08 vfrolov * Improved write buffering *************** *** 70,73 **** --- 73,78 ---- #include "import.h" /////////////////////////////////////////////////////////////// + static ROUTINE_GET_ARG_INFO_A *pGetArgInfo; + /////////////////////////////////////////////////////////////// static const char *GetParam(const char *pArg, const char *pPattern) { *************** *** 80,83 **** --- 85,117 ---- } /////////////////////////////////////////////////////////////// + static void Diag(const char *pPref, const char *pArg) + { + cerr << pPref << "'" << pArg << "'"; + + string pref(" ("); + string suff; + + const ARG_INFO_A *pInfo = pGetArgInfo(pArg); + + if (ITEM_IS_VALID(pInfo, pFile) && pInfo->pFile != NULL) { + cerr << pref << "file " << pInfo->pFile; + pref = ", "; + suff = ")"; + } + + if (ITEM_IS_VALID(pInfo, iLine) && pInfo->iLine >= 0) { + cerr << pref << "line " << (pInfo->iLine + 1); + pref = ", "; + suff = ")"; + } + + cerr << suff; + + if (ITEM_IS_VALID(pInfo, pReference) && pInfo->pReference != NULL) + cerr << "," << endl << pInfo->pReference; + + cerr << endl; + } + /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { *************** *** 196,200 **** if ((pParam = GetParam(pArg, "--baud=")) != NULL) { if (!comParams.SetBaudRate(pParam)) { ! cerr << "Invalid baud rate value in " << pArg << endl; exit(1); } --- 230,234 ---- if ((pParam = GetParam(pArg, "--baud=")) != NULL) { if (!comParams.SetBaudRate(pParam)) { ! Diag("Invalid baud rate value in ", pArg); exit(1); } *************** *** 202,206 **** if ((pParam = GetParam(pArg, "--data=")) != NULL) { if (!comParams.SetByteSize(pParam)) { ! cerr << "Invalid data bits value in " << pArg << endl; exit(1); } --- 236,240 ---- if ((pParam = GetParam(pArg, "--data=")) != NULL) { if (!comParams.SetByteSize(pParam)) { ! Diag("Invalid data bits value in ", pArg); exit(1); } *************** *** 208,212 **** if ((pParam = GetParam(pArg, "--parity=")) != NULL) { if (!comParams.SetParity(pParam)) { ! cerr << "Invalid parity value in " << pArg << endl; exit(1); } --- 242,246 ---- if ((pParam = GetParam(pArg, "--parity=")) != NULL) { if (!comParams.SetParity(pParam)) { ! Diag("Invalid parity value in ", pArg); exit(1); } *************** *** 214,218 **** if ((pParam = GetParam(pArg, "--stop=")) != NULL) { if (!comParams.SetStopBits(pParam)) { ! cerr << "Invalid stop bits value in " << pArg << endl; exit(1); } --- 248,252 ---- if ((pParam = GetParam(pArg, "--stop=")) != NULL) { if (!comParams.SetStopBits(pParam)) { ! Diag("Invalid stop bits value in ", pArg); exit(1); } *************** *** 220,224 **** if ((pParam = GetParam(pArg, "--octs=")) != NULL) { if (!comParams.SetOutCts(pParam)) { ! cerr << "Invalid CTS handshaking on output value in " << pArg << endl; exit(1); } --- 254,258 ---- if ((pParam = GetParam(pArg, "--octs=")) != NULL) { if (!comParams.SetOutCts(pParam)) { ! Diag("Invalid CTS handshaking on output value in ", pArg); exit(1); } *************** *** 226,230 **** if ((pParam = GetParam(pArg, "--odsr=")) != NULL) { if (!comParams.SetOutDsr(pParam)) { ! cerr << "Invalid DSR handshaking on output value in " << pArg << endl; exit(1); } --- 260,264 ---- if ((pParam = GetParam(pArg, "--odsr=")) != NULL) { if (!comParams.SetOutDsr(pParam)) { ! Diag("Invalid DSR handshaking on output value in ", pArg); exit(1); } *************** *** 232,236 **** if ((pParam = GetParam(pArg, "--ox=")) != NULL) { if (!comParams.SetOutX(pParam)) { ! cerr << "Invalid XON/XOFF handshaking on output value in " << pArg << endl; exit(1); } --- 266,270 ---- if ((pParam = GetParam(pArg, "--ox=")) != NULL) { if (!comParams.SetOutX(pParam)) { ! Diag("Invalid XON/XOFF handshaking on output value in ", pArg); exit(1); } *************** *** 238,242 **** if ((pParam = GetParam(pArg, "--ix=")) != NULL) { if (!comParams.SetInX(pParam)) { ! cerr << "Invalid XON/XOFF handshaking on input value in " << pArg << endl; exit(1); } --- 272,276 ---- if ((pParam = GetParam(pArg, "--ix=")) != NULL) { if (!comParams.SetInX(pParam)) { ! Diag("Invalid XON/XOFF handshaking on input value in ", pArg); exit(1); } *************** *** 244,248 **** if ((pParam = GetParam(pArg, "--idsr=")) != NULL) { if (!comParams.SetInDsr(pParam)) { ! cerr << "Invalid DSR sensitivity value in " << pArg << endl; exit(1); } --- 278,282 ---- if ((pParam = GetParam(pArg, "--idsr=")) != NULL) { if (!comParams.SetInDsr(pParam)) { ! Diag("Invalid DSR sensitivity value in ", pArg); exit(1); } *************** *** 250,254 **** if ((pParam = GetParam(pArg, "--ito=")) != NULL) { if (!comParams.SetIntervalTimeout(pParam)) { ! cerr << "Invalid read interval timeout value in " << pArg << endl; exit(1); } --- 284,288 ---- if ((pParam = GetParam(pArg, "--ito=")) != NULL) { if (!comParams.SetIntervalTimeout(pParam)) { ! Diag("Invalid read interval timeout value in ", pArg); exit(1); } *************** *** 256,260 **** if ((pParam = GetParam(pArg, "--write-limit=")) != NULL) { if (!comParams.SetWriteQueueLimit(pParam)) { ! cerr << "Invalid write limit value in " << pArg << endl; exit(1); } --- 290,294 ---- if ((pParam = GetParam(pArg, "--write-limit=")) != NULL) { if (!comParams.SetWriteQueueLimit(pParam)) { ! Diag("Invalid write limit value in ", pArg); exit(1); } *************** *** 388,392 **** !ROUTINE_IS_VALID(pHubRoutines, pBufAppend) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || ! !ROUTINE_IS_VALID(pHubRoutines, pOnRead)) { return NULL; --- 422,427 ---- !ROUTINE_IS_VALID(pHubRoutines, pBufAppend) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || ! !ROUTINE_IS_VALID(pHubRoutines, pOnRead) || ! !ROUTINE_IS_VALID(pHubRoutines, pGetArgInfo)) { return NULL; *************** *** 398,401 **** --- 433,437 ---- pMsgInsertNone = pHubRoutines->pMsgInsertNone; pOnRead = pHubRoutines->pOnRead; + pGetArgInfo = pHubRoutines->pGetArgInfo; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2009-02-20 18:32:45
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15554/plugins Modified Files: plugins_api.h Log Message: Added info about location of options Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** plugins_api.h 17 Feb 2009 14:17:37 -0000 1.27 --- plugins_api.h 20 Feb 2009 18:32:35 -0000 1.28 *************** *** 165,168 **** --- 165,175 ---- DECLARE_HANDLE(HFILTER); /*******************************************************************/ + typedef struct _ARG_INFO_A { + size_t size; + const char *pFile; + int iLine; + const char *pReference; + } ARG_INFO_A; + /*******************************************************************/ typedef BYTE *(CALLBACK ROUTINE_BUF_ALLOC)( DWORD size); *************** *** 221,224 **** --- 228,233 ---- typedef HFILTER (CALLBACK ROUTINE_GET_FILTER)( HMASTERFILTERINSTANCE hMasterFilterInstance); + typedef const ARG_INFO_A *(CALLBACK ROUTINE_GET_ARG_INFO_A)( + const char *pArg); /*******************************************************************/ typedef struct _HUB_ROUTINES_A { *************** *** 242,245 **** --- 251,255 ---- ROUTINE_FILTERPORT *pFilterPort; ROUTINE_GET_FILTER *pGetFilter; + ROUTINE_GET_ARG_INFO_A *pGetArgInfo; } HUB_ROUTINES_A; /*******************************************************************/ *************** *** 360,365 **** } PORT_ROUTINES_A; /*******************************************************************/ #define ROUTINE_GET(pStruct, pRoutine) \ ! ((((BYTE *)(&(pStruct)->pRoutine + 1)) <= ((BYTE *)(pStruct) + (pStruct)->size)) \ ? (pStruct)->pRoutine \ : NULL) --- 370,378 ---- } PORT_ROUTINES_A; /*******************************************************************/ + #define ITEM_IS_VALID(pStruct, item) \ + (((BYTE *)(&(pStruct)->item + 1)) <= ((BYTE *)(pStruct) + (pStruct)->size)) + #define ROUTINE_GET(pStruct, pRoutine) \ ! (ITEM_IS_VALID(pStruct, pRoutine) \ ? (pStruct)->pRoutine \ : NULL) |
From: Vyacheslav F. <vf...@us...> - 2009-02-17 14:17:45
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15866 Modified Files: export.cpp timer.cpp timer.h Log Message: Redesigned timer's API Index: export.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/export.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** export.cpp 4 Feb 2009 15:41:15 -0000 1.13 --- export.cpp 17 Feb 2009 14:17:36 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2009/02/17 14:17:36 vfrolov + * Redesigned timer's API + * * Revision 1.13 2009/02/04 15:41:15 vfrolov * Added pGetFilter() *************** *** 243,249 **** } /////////////////////////////////////////////////////////////// ! static HMASTERTIMER CALLBACK timer_create() { ! Timer *pTimer = new Timer(); if (!pTimer) --- 246,252 ---- } /////////////////////////////////////////////////////////////// ! static HMASTERTIMER CALLBACK timer_create(HTIMEROWNER hTimerOwner) { ! Timer *pTimer = new Timer(hTimerOwner); if (!pTimer) *************** *** 257,261 **** HMASTERPORT hMasterPort, const LARGE_INTEGER *pDueTime, ! LONG period) { _ASSERTE(hMasterTimer != NULL); --- 260,265 ---- HMASTERPORT hMasterPort, const LARGE_INTEGER *pDueTime, ! LONG period, ! HTIMERPARAM hTimerParam) { _ASSERTE(hMasterTimer != NULL); *************** *** 264,268 **** _ASSERTE(((Port *)hMasterPort)->IsValid()); ! return ((Timer *)hMasterTimer)->Set((Port *)hMasterPort, pDueTime, period); } /////////////////////////////////////////////////////////////// --- 268,272 ---- _ASSERTE(((Port *)hMasterPort)->IsValid()); ! return ((Timer *)hMasterTimer)->Set((Port *)hMasterPort, pDueTime, period, hTimerParam); } /////////////////////////////////////////////////////////////// Index: timer.h =================================================================== RCS file: /cvsroot/com0com/hub4com/timer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timer.h 26 Jan 2009 14:55:29 -0000 1.2 --- timer.h 17 Feb 2009 14:17:36 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2009/02/17 14:17:36 vfrolov + * Redesigned timer's API + * * Revision 1.2 2009/01/26 14:55:29 vfrolov * Added signature checking for Timer *************** *** 39,46 **** { public: ! Timer(); ~Timer(); ! BOOL Set(Port *_pPort, const LARGE_INTEGER *pDueTime, LONG period); void Cancel(); --- 42,49 ---- { public: ! Timer(HTIMEROWNER _hTimerOwner); ~Timer(); ! BOOL Set(Port *_pPort, const LARGE_INTEGER *pDueTime, LONG period, HTIMERPARAM _hTimerParam); void Cancel(); *************** *** 51,55 **** --- 54,61 ---- DWORD dwTimerHighValue); + HTIMEROWNER hTimerOwner; Port *pPort; + HTIMERPARAM hTimerParam; + HANDLE hTimer; Index: timer.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/timer.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timer.cpp 26 Jan 2009 14:55:29 -0000 1.2 --- timer.cpp 17 Feb 2009 14:17:36 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2009/02/17 14:17:36 vfrolov + * Redesigned timer's API + * * Revision 1.2 2009/01/26 14:55:29 vfrolov * Added signature checking for Timer *************** *** 36,40 **** #include "hubmsg.h" /////////////////////////////////////////////////////////////// ! Timer::Timer() { #ifdef _DEBUG --- 39,44 ---- #include "hubmsg.h" /////////////////////////////////////////////////////////////// ! Timer::Timer(HTIMEROWNER _hTimerOwner) ! : hTimerOwner(_hTimerOwner) { #ifdef _DEBUG *************** *** 75,88 **** msg.type = HUB_MSG_TYPE_TICK; ! msg.u.hVal = pArg; ((Timer *)pArg)->pPort->hub.OnFakeRead(((Timer *)pArg)->pPort, &msg); } /////////////////////////////////////////////////////////////// ! BOOL Timer::Set(Port *_pPort, const LARGE_INTEGER *pDueTime, LONG period) { _ASSERTE(signature == TIMER_SIGNATURE); pPort = _pPort; _ASSERTE(pPort != NULL); --- 79,94 ---- msg.type = HUB_MSG_TYPE_TICK; ! msg.u.hv2.hVal0 = ((Timer *)pArg)->hTimerOwner; ! msg.u.hv2.hVal1 = ((Timer *)pArg)->hTimerParam; ((Timer *)pArg)->pPort->hub.OnFakeRead(((Timer *)pArg)->pPort, &msg); } /////////////////////////////////////////////////////////////// ! BOOL Timer::Set(Port *_pPort, const LARGE_INTEGER *pDueTime, LONG period, HTIMERPARAM _hTimerParam) { _ASSERTE(signature == TIMER_SIGNATURE); pPort = _pPort; + hTimerParam = _hTimerParam; _ASSERTE(pPort != NULL); |
From: Vyacheslav F. <vf...@us...> - 2009-02-17 14:17:44
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15866/plugins Modified Files: plugins_api.h Log Message: Redesigned timer's API Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** plugins_api.h 4 Feb 2009 15:41:16 -0000 1.26 --- plugins_api.h 17 Feb 2009 14:17:37 -0000 1.27 *************** *** 34,37 **** --- 34,38 ---- #define HUB_MSG_UNION_TYPE_PVAL ((DWORD)0x03000000) #define HUB_MSG_UNION_TYPE_HVAL ((DWORD)0x04000000) + #define HUB_MSG_UNION_TYPE_HVAL2 ((DWORD)0x05000000) /*******************************************************************/ #define HUB_MSG_VAL_TYPES_MASK ((DWORD)0x00FF0000) *************** *** 134,138 **** #define HUB_MSG_TYPE_PURGE_TX_IN (22 | HUB_MSG_UNION_TYPE_NONE) #define HUB_MSG_TYPE_PURGE_TX (23 | HUB_MSG_UNION_TYPE_NONE) ! #define HUB_MSG_TYPE_TICK (24 | HUB_MSG_UNION_TYPE_HVAL) /*******************************************************************/ typedef struct _HUB_MSG { --- 135,139 ---- #define HUB_MSG_TYPE_PURGE_TX_IN (22 | HUB_MSG_UNION_TYPE_NONE) #define HUB_MSG_TYPE_PURGE_TX (23 | HUB_MSG_UNION_TYPE_NONE) ! #define HUB_MSG_TYPE_TICK (24 | HUB_MSG_UNION_TYPE_HVAL2) /*******************************************************************/ typedef struct _HUB_MSG { *************** *** 147,150 **** --- 148,155 ---- DWORD val; } pv; + struct { + HANDLE hVal0; + HANDLE hVal1; + } hv2; DWORD val; HANDLE hVal; *************** *** 156,159 **** --- 161,166 ---- DECLARE_HANDLE(HMASTERFILTERINSTANCE); DECLARE_HANDLE(HMASTERTIMER); + DECLARE_HANDLE(HTIMEROWNER); + DECLARE_HANDLE(HTIMERPARAM); DECLARE_HANDLE(HFILTER); /*******************************************************************/ *************** *** 199,208 **** HUB_MSG *pMsg); typedef HMASTERTIMER (CALLBACK ROUTINE_TIMER_CREATE)( ! ); typedef BOOL (CALLBACK ROUTINE_TIMER_SET)( HMASTERTIMER hMasterTimer, HMASTERPORT hMasterPort, const LARGE_INTEGER *pDueTime, ! LONG period); typedef void (CALLBACK ROUTINE_TIMER_CANCEL)( HMASTERTIMER hMasterTimer); --- 206,216 ---- HUB_MSG *pMsg); typedef HMASTERTIMER (CALLBACK ROUTINE_TIMER_CREATE)( ! HTIMEROWNER hTimerOwner); typedef BOOL (CALLBACK ROUTINE_TIMER_SET)( HMASTERTIMER hMasterTimer, HMASTERPORT hMasterPort, const LARGE_INTEGER *pDueTime, ! LONG period, ! HTIMERPARAM hTimerParam); typedef void (CALLBACK ROUTINE_TIMER_CANCEL)( HMASTERTIMER hMasterTimer); |
From: Vyacheslav F. <vf...@us...> - 2009-02-17 14:17:44
|
Update of /cvsroot/com0com/hub4com/plugins/trace In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15866/plugins/trace Modified Files: filter.cpp Log Message: Redesigned timer's API Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/trace/filter.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** filter.cpp 2 Feb 2009 15:21:43 -0000 1.17 --- filter.cpp 17 Feb 2009 14:17:37 -0000 1.18 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.18 2009/02/17 14:17:37 vfrolov + * Redesigned timer's API + * * Revision 1.17 2009/02/02 15:21:43 vfrolov * Optimized filter's API *************** *** 703,706 **** --- 706,712 ---- tout << pMsg->u.hVal; break; + case HUB_MSG_UNION_TYPE_HVAL2: + tout << pMsg->u.hv2.hVal0 << " " << pMsg->u.hv2.hVal1; + break; default: tout << "???"; |
From: Vyacheslav F. <vf...@us...> - 2009-02-17 14:17:44
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15866/plugins/telnet Modified Files: filter.cpp Log Message: Redesigned timer's API Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** filter.cpp 2 Feb 2009 15:21:42 -0000 1.16 --- filter.cpp 17 Feb 2009 14:17:37 -0000 1.17 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.17 2009/02/17 14:17:37 vfrolov + * Redesigned timer's API + * * Revision 1.16 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 618,622 **** _ASSERTE(((State *)hFilterInstance)->hKeepActiveTimer == NULL); ! ((State *)hFilterInstance)->hKeepActiveTimer = pTimerCreate(); if (((State *)hFilterInstance)->hKeepActiveTimer) { --- 621,625 ---- _ASSERTE(((State *)hFilterInstance)->hKeepActiveTimer == NULL); ! ((State *)hFilterInstance)->hKeepActiveTimer = pTimerCreate((HTIMEROWNER)hFilterInstance); if (((State *)hFilterInstance)->hKeepActiveTimer) { *************** *** 625,629 **** firstReportTime.QuadPart = -10000000LL * ((Filter *)hFilter)->keepActive; ! pTimerSet(((State *)hFilterInstance)->hKeepActiveTimer, ((State *)hFilterInstance)->hMasterPort, &firstReportTime, ((Filter *)hFilter)->keepActive * 1000L); } } --- 628,637 ---- firstReportTime.QuadPart = -10000000LL * ((Filter *)hFilter)->keepActive; ! pTimerSet( ! ((State *)hFilterInstance)->hKeepActiveTimer, ! ((State *)hFilterInstance)->hMasterPort, ! &firstReportTime, ! ((Filter *)hFilter)->keepActive * 1000L, ! (HTIMERPARAM)((State *)hFilterInstance)->hKeepActiveTimer); } } *************** *** 634,643 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_TICK): { ! HMASTERTIMER hTimer = (HMASTERTIMER)pInMsg->u.hVal; ! ! if (!hTimer) break; ! if (hTimer == ((State *)hFilterInstance)->hKeepActiveTimer) { TelnetProtocol *pTelnetProtocol = ((State *)hFilterInstance)->pTelnetProtocol; --- 642,649 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_TICK): { ! if (pInMsg->u.hv2.hVal0 != hFilterInstance) break; ! if (pInMsg->u.hv2.hVal1 == ((State *)hFilterInstance)->hKeepActiveTimer) { TelnetProtocol *pTelnetProtocol = ((State *)hFilterInstance)->pTelnetProtocol; |
From: Vyacheslav F. <vf...@us...> - 2009-02-17 14:17:44
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15866/plugins/tcp Modified Files: comport.cpp Log Message: Redesigned timer's API Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comport.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** comport.cpp 23 Jan 2009 16:55:05 -0000 1.14 --- comport.cpp 17 Feb 2009 14:17:37 -0000 1.15 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.15 2009/02/17 14:17:37 vfrolov + * Redesigned timer's API + * * Revision 1.14 2009/01/23 16:55:05 vfrolov * Utilized timer routines *************** *** 273,282 **** switch (HUB_MSG_T2N(pInMsg->type)) { case HUB_MSG_T2N(HUB_MSG_TYPE_TICK): { ! HMASTERTIMER hTimer = (HMASTERTIMER)pInMsg->u.hVal; ! ! if (!hTimer) break; ! if (hTimer == hReconnectTimer) { if (CanConnect()) StartConnect(); --- 276,283 ---- switch (HUB_MSG_T2N(pInMsg->type)) { case HUB_MSG_T2N(HUB_MSG_TYPE_TICK): { ! if (pInMsg->u.hv2.hVal0 != this) break; ! if (pInMsg->u.hv2.hVal1 == hReconnectTimer) { if (CanConnect()) StartConnect(); *************** *** 579,583 **** if (reconnectTime > 0) { if (!hReconnectTimer) ! hReconnectTimer = pTimerCreate(); if (hReconnectTimer) { --- 580,584 ---- if (reconnectTime > 0) { if (!hReconnectTimer) ! hReconnectTimer = pTimerCreate((HTIMEROWNER)this); if (hReconnectTimer) { *************** *** 586,590 **** firstReportTime.QuadPart = -10000LL * reconnectTime; ! pTimerSet(hReconnectTimer, hMasterPort, &firstReportTime, 0); } } --- 587,595 ---- firstReportTime.QuadPart = -10000LL * reconnectTime; ! pTimerSet( ! hReconnectTimer, ! hMasterPort, ! &firstReportTime, 0, ! (HTIMERPARAM)hReconnectTimer); } } |
From: Vyacheslav F. <vf...@us...> - 2009-02-16 12:24:38
|
Update of /cvsroot/com0com/com0com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31308 Modified Files: ReadMe.txt Log Message: Added questions about installing multiple port pairs Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ReadMe.txt 8 Dec 2008 10:41:10 -0000 1.20 --- ReadMe.txt 16 Feb 2009 12:24:26 -0000 1.21 *************** *** 183,187 **** Platform Software Development Kit (SDK). ! Q. How to monitor and get the paired port settings? A. It can be done with extended IOCTL_SERIAL_LSRMST_INSERT. See example in --- 183,188 ---- Platform Software Development Kit (SDK). ! Q. How to monitor and get the paired port settings (baud rate, byte size, parity ! and stop bits)? A. It can be done with extended IOCTL_SERIAL_LSRMST_INSERT. See example in *************** *** 255,256 **** --- 256,282 ---- Now each character frame (including idle frames) will be corrupted with probability 0.00001. + + Q. What is the maximum number of port pairs that can be defined? + A. It depends from your system. The com0com itself has internal limit + 1000000 port pairs. + + Q. In my application, users could be installing up to 250 com port pairs. + Initially, the installation is fairly quick, but each additional com port + generally takes longer to install than the previous one. It quickly + becomes unacceptable for a user to be expected to wait for the installation. + A. It's because the installing of each next port pair requires to update driver + for all installed pairs. You can speed up installing of multiple com port + pairs by using install commands with --no-update option and finish them by + update command, for example: + + command> --no-update install - - + command> --no-update install - - + ... + command> --no-update install - - + command> update + + Another example: + + > cd /D "%ProgramFiles%\com0com" + > FOR /L %i IN (0,1,249) DO setupc --no-update install - - + > setupc update |
From: Vyacheslav F. <vf...@us...> - 2009-02-16 10:36:23
|
Update of /cvsroot/com0com/com0com/setup In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18815 Modified Files: devutils.cpp inffile.cpp Log Message: Done --silent option more silent Index: inffile.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** inffile.cpp 2 Apr 2008 10:30:26 -0000 1.6 --- inffile.cpp 16 Feb 2009 10:36:16 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2009/02/16 10:36:16 vfrolov + * Done --silent option more silent + * * Revision 1.6 2008/04/02 10:30:26 vfrolov * Added check pointer for null *************** *** 502,506 **** if (infFile.Compare(_pClassGUID, _pClass, _pProvider, FALSE)) { ! if (ShowMsg(MB_YESNO, "The file %s possible should be deleted too.\n" "\n" --- 505,512 ---- if (infFile.Compare(_pClassGUID, _pClass, _pProvider, FALSE)) { ! int res; ! ! if (!Silent()) { ! res = ShowMsg(MB_YESNO, "The file %s possible should be deleted too.\n" "\n" *************** *** 515,520 **** infFile.ClassGUID(FALSE), infFile.Class(FALSE), ! infFile.Provider(FALSE)) == IDYES) ! { Trace("\n"); UninstallInf(infFile.Path()); --- 521,539 ---- infFile.ClassGUID(FALSE), infFile.Class(FALSE), ! infFile.Provider(FALSE)); ! } else { ! Trace("\nThe file %s possible should be deleted too\n" ! " ClassGUID = %s\n" ! " Class = %s\n" ! " Provider = %s\n", ! infFile.Path(), ! infFile.ClassGUID(FALSE), ! infFile.Class(FALSE), ! infFile.Provider(FALSE)); ! ! res = IDNO; ! } ! ! if (res == IDYES) { Trace("\n"); UninstallInf(infFile.Path()); Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** devutils.cpp 11 Feb 2009 07:35:21 -0000 1.10 --- devutils.cpp 16 Feb 2009 10:36:16 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2009/02/16 10:36:16 vfrolov + * Done --silent option more silent + * * Revision 1.10 2009/02/11 07:35:21 vfrolov * Added --no-update option *************** *** 241,244 **** --- 244,260 ---- return TRUE; + ULONG status = 0; + ULONG problem = 0; + + *pRebootRequired = + CM_Get_DevNode_Status(&status, &problem, pDevInfoData->DevInst, 0) == CR_SUCCESS && + (status & DN_NEED_RESTART) != 0; + + //if (*pRebootRequired) + // Trace("Enumerated status=0x%lX problem=0x%lX\n", status, problem); + + if (*pRebootRequired) + return TRUE; + SP_DEVINSTALL_PARAMS installParams; *************** *** 253,256 **** --- 269,275 ---- *pRebootRequired = (installParams.Flags & DI_NEEDREBOOT) ? TRUE : FALSE; + //if (*pRebootRequired) + // Trace("Enumerated Flags=0x%lX\n", installParams.Flags); + return TRUE; } *************** *** 299,303 **** return FALSE; ! return (status & DN_HAS_PROBLEM) == 0; } /////////////////////////////////////////////////////////////// --- 318,322 ---- return FALSE; ! return (status & (DN_HAS_PROBLEM|DN_NEED_RESTART)) == 0; } /////////////////////////////////////////////////////////////// *************** *** 359,362 **** --- 378,389 ---- return IDCONTINUE; + BOOL rebootRequired = FALSE; + + if (!UpdateRebootRequired(hDevInfo, pDevInfoData, &rebootRequired)) + return IDCANCEL; + + //if (rebootRequired && pRebootRequired) + // *pRebootRequired = TRUE; + if (!ChangeState(hDevInfo, pDevInfoData, DICS_DISABLE)) return IDCANCEL; *************** *** 367,379 **** pDevProperties->PhObjName()); ! if (pRebootRequired && !*pRebootRequired) { ! BOOL rebootRequired = FALSE; ! if (!UpdateRebootRequired(hDevInfo, pDevInfoData, &rebootRequired)) return IDCANCEL; if (rebootRequired) { ! int res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't disable device %s %s %s.\n" "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", --- 394,412 ---- pDevProperties->PhObjName()); ! if (!rebootRequired) { if (!UpdateRebootRequired(hDevInfo, pDevInfoData, &rebootRequired)) return IDCANCEL; if (rebootRequired) { ! Trace("Can't stop device %s %s %s\n", ! pDevProperties->Location(), ! pDevProperties->DevId(), ! pDevProperties->PhObjName()); ! ! int res; ! ! if (!Silent()) { ! res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't stop device %s %s %s.\n" "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", *************** *** 381,384 **** --- 414,420 ---- pDevProperties->DevId(), pDevProperties->PhObjName()); + } else { + res = IDCONTINUE; + } if (res != IDCONTINUE) { *************** *** 394,398 **** } ! *pRebootRequired = TRUE; } } --- 430,435 ---- } ! if (pRebootRequired) ! *pRebootRequired = TRUE; } } *************** *** 466,469 **** --- 503,508 ---- } + UpdateRebootRequired(hDevInfo, pDevInfoData, pDevParams->pEnumParams->pRebootRequired); + return IDCONTINUE; } *************** *** 496,507 **** return IDCANCEL; ! if (pDevParams->pEnumParams->pRebootRequired && !*pDevParams->pEnumParams->pRebootRequired) { ! BOOL rebootRequired = FALSE; ! if (!UpdateRebootRequired(hDevInfo, pDevInfoData, &rebootRequired)) ! return IDCANCEL; ! if (rebootRequired) { ! int res = ShowMsg(MB_CANCELTRYCONTINUE, "Can't reastart device %s %s %s.\n" "Close application that use this device and Try Again.\n" --- 535,554 ---- return IDCANCEL; ! BOOL rebootRequired = FALSE; ! if (!UpdateRebootRequired(hDevInfo, pDevInfoData, &rebootRequired)) ! return IDCANCEL; ! if (rebootRequired) { ! Trace("Can't reastart device %s %s %s\n", ! pDevParams->devProperties.Location(), ! pDevParams->devProperties.DevId(), ! pDevParams->devProperties.PhObjName()); ! ! if (pDevParams->pEnumParams->pRebootRequired && !*pDevParams->pEnumParams->pRebootRequired) { ! int res; ! ! if (!Silent()) { ! res = ShowMsg(MB_CANCELTRYCONTINUE, "Can't reastart device %s %s %s.\n" "Close application that use this device and Try Again.\n" *************** *** 510,513 **** --- 557,563 ---- pDevParams->devProperties.DevId(), pDevParams->devProperties.PhObjName()); + } else { + res = IDCONTINUE; + } if (res != IDCONTINUE) { *************** *** 520,526 **** *pDevParams->pEnumParams->pRebootRequired = TRUE; } ! } ! ! if (!pDevParams->pEnumParams->pRebootRequired || !*pDevParams->pEnumParams->pRebootRequired) { Trace("Restarted %s %s %s\n", pDevParams->devProperties.Location(), --- 570,574 ---- *pDevParams->pEnumParams->pRebootRequired = TRUE; } ! } else { Trace("Restarted %s %s %s\n", pDevParams->devProperties.Location(), |
From: Vyacheslav F. <vf...@us...> - 2009-02-11 07:35:29
|
Update of /cvsroot/com0com/com0com/setup In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5230 Modified Files: devutils.cpp devutils.h setup.cpp Log Message: Added --no-update option Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** devutils.h 1 Oct 2007 15:01:35 -0000 1.6 --- devutils.h 11 Feb 2009 07:35:22 -0000 1.7 *************** *** 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-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2009/02/11 07:35:22 vfrolov + * Added --no-update option + * * Revision 1.6 2007/10/01 15:01:35 vfrolov * Added pDevInstID parameter to InstallDevice() *************** *** 133,137 **** const char *pDevInstID, PDEVCALLBACK pDevCallBack, ! void *pCallBackParam); /////////////////////////////////////////////////////////////// --- 136,141 ---- const char *pDevInstID, PDEVCALLBACK pDevCallBack, ! void *pCallBackParam, ! BOOL update); /////////////////////////////////////////////////////////////// Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** setup.cpp 12 Jan 2009 12:48:05 -0000 1.28 --- setup.cpp 11 Feb 2009 07:35:22 -0000 1.29 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.29 2009/02/11 07:35:22 vfrolov + * Added --no-update option + * * Revision 1.28 2009/01/12 12:48:05 vfrolov * Fixed typo *************** *** 137,140 **** --- 140,144 ---- static BOOL detailPrms = FALSE; static BOOL silent = FALSE; + static BOOL no_update = FALSE; /////////////////////////////////////////////////////////////// static BOOL IsValidPortNum(int num) *************** *** 498,502 **** BOOL rr = FALSE; ! if (update) { if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, infFile.Path(), INSTALLFLAG_FORCE, &rr)) { CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); --- 502,506 ---- BOOL rr = FALSE; ! if (update && !no_update) { if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, infFile.Path(), INSTALLFLAG_FORCE, &rr)) { CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); *************** *** 584,588 **** static BOOL InstallBusDevice(InfFile &infFile, int num) { ! return InstallDevice(infFile, C0C_BUS_DEVICE_ID, C0C_CLASS, InstallDeviceCallBack, &num); } --- 588,592 ---- static BOOL InstallBusDevice(InfFile &infFile, int num) { ! return InstallDevice(infFile, C0C_BUS_DEVICE_ID, C0C_CLASS, InstallDeviceCallBack, &num, !no_update); } *************** *** 1097,1100 **** --- 1101,1106 ---- " --detail-prms - show detailed parameters\n" " --silent - suppress dialogs if possible\n" + " --no-update - do not update driver while install command\n" + " execution (update command expected later)\n" ); ConsoleWrite( *************** *** 1183,1186 **** --- 1189,1194 ---- detailPrms = FALSE; + silent = FALSE; + no_update = FALSE; while (argc > 1) { *************** *** 1207,1210 **** --- 1215,1224 ---- argc--; } + else + if (!strcmp(argv[1], "--no-update")) { + no_update = TRUE; + argv++; + argc--; + } else { ConsoleWrite("Invalid option %s\n", argv[1]); Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** devutils.cpp 27 Nov 2007 16:35:49 -0000 1.9 --- devutils.cpp 11 Feb 2009 07:35:21 -0000 1.10 *************** *** 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-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2009/02/11 07:35:21 vfrolov + * Added --no-update option + * * Revision 1.9 2007/11/27 16:35:49 vfrolov * Added state check before enabling *************** *** 610,614 **** const char *pDevInstID, PDEVCALLBACK pDevCallBack, ! void *pCallBackParam) { GUID classGUID; --- 613,618 ---- const char *pDevInstID, PDEVCALLBACK pDevCallBack, ! void *pCallBackParam, ! BOOL update) { GUID classGUID; *************** *** 719,725 **** for (i = 0 ; i < 10 ; i++) { ! BOOL rebootRequired; ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, infFile.Path(), 0, &rebootRequired); if (res) { --- 723,733 ---- for (i = 0 ; i < 10 ; i++) { ! if (update) { ! BOOL rebootRequired; ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, infFile.Path(), 0, &rebootRequired); ! } else { ! res = TRUE; ! } if (res) { *************** *** 798,807 **** const char *pDevInstID, PDEVCALLBACK pDevCallBack, ! void *pCallBackParam) { int res; do { ! res = TryInstallDevice(infFile, pDevId, pDevInstID, pDevCallBack, pCallBackParam); } while (res == IDTRYAGAIN); --- 806,816 ---- const char *pDevInstID, PDEVCALLBACK pDevCallBack, ! void *pCallBackParam, ! BOOL update) { int res; do { ! res = TryInstallDevice(infFile, pDevId, pDevInstID, pDevCallBack, pCallBackParam, update); } while (res == IDTRYAGAIN); |
From: Vyacheslav F. <vf...@us...> - 2009-02-04 15:41:27
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2995/plugins/awakseq Modified Files: filter.cpp Log Message: Added pGetFilter() Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/awakseq/filter.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** filter.cpp 2 Feb 2009 15:21:42 -0000 1.12 --- filter.cpp 4 Feb 2009 15:41:16 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2009/02/04 15:41:16 vfrolov + * Added pGetFilter() + * * Revision 1.12 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 69,75 **** #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_REPLACE_VAL *pMsgReplaceVal = NULL; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 72,79 ---- #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_REPLACE_VAL *pMsgReplaceVal; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; ! static ROUTINE_GET_FILTER *pGetFilter; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 94,102 **** class State { public: ! State() ! : waitAwakSeq(FALSE), ! pAwakSeqNext(NULL), ! connectSent(FALSE), ! connectionCounter(0) {} void StartAwakSeq(const BYTE *pAwakSeq) { --- 98,107 ---- class State { public: ! State(const BYTE *pAwakSeq) ! : connectSent(FALSE), ! connectionCounter(0) ! { ! StartAwakSeq(pAwakSeq); ! } void StartAwakSeq(const BYTE *pAwakSeq) { *************** *** 251,259 **** /////////////////////////////////////////////////////////////// static HFILTERINSTANCE CALLBACK CreateInstance( ! HMASTERFILTERINSTANCE DEBUG_PARAM(hMasterFilterInstance)) { _ASSERTE(hMasterFilterInstance != NULL); ! return (HFILTERINSTANCE)new State(); } /////////////////////////////////////////////////////////////// --- 256,268 ---- /////////////////////////////////////////////////////////////// static HFILTERINSTANCE CALLBACK CreateInstance( ! HMASTERFILTERINSTANCE hMasterFilterInstance) { _ASSERTE(hMasterFilterInstance != NULL); ! Filter *pFilter = (Filter *)pGetFilter(hMasterFilterInstance); ! ! _ASSERTE(pFilter != NULL); ! ! return (HFILTERINSTANCE)new State(pFilter->pAwakSeq); } /////////////////////////////////////////////////////////////// *************** *** 287,293 **** return TRUE; - if (((State *)hFilterInstance)->pAwakSeqNext == NULL) - ((State *)hFilterInstance)->StartAwakSeq(((Filter *)hFilter)->pAwakSeq); - if (!((State *)hFilterInstance)->waitAwakSeq) return TRUE; --- 296,299 ---- *************** *** 419,423 **** if (!ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceVal) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || ! !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone)) { return NULL; --- 425,430 ---- if (!ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceVal) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || ! !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || ! !ROUTINE_IS_VALID(pHubRoutines, pGetFilter)) { return NULL; *************** *** 427,430 **** --- 434,438 ---- pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; pMsgInsertNone = pHubRoutines->pMsgInsertNone; + pGetFilter = pHubRoutines->pGetFilter; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2009-02-04 15:41:27
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2995/plugins Modified Files: plugins_api.h Log Message: Added pGetFilter() Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** plugins_api.h 2 Feb 2009 15:21:42 -0000 1.25 --- plugins_api.h 4 Feb 2009 15:41:16 -0000 1.26 *************** *** 156,159 **** --- 156,160 ---- DECLARE_HANDLE(HMASTERFILTERINSTANCE); DECLARE_HANDLE(HMASTERTIMER); + DECLARE_HANDLE(HFILTER); /*******************************************************************/ typedef BYTE *(CALLBACK ROUTINE_BUF_ALLOC)( *************** *** 210,213 **** --- 211,216 ---- typedef HMASTERPORT (CALLBACK ROUTINE_FILTERPORT)( HMASTERFILTERINSTANCE hMasterFilterInstance); + typedef HFILTER (CALLBACK ROUTINE_GET_FILTER)( + HMASTERFILTERINSTANCE hMasterFilterInstance); /*******************************************************************/ typedef struct _HUB_ROUTINES_A { *************** *** 230,233 **** --- 233,237 ---- ROUTINE_TIMER_DELETE *pTimerDelete; ROUTINE_FILTERPORT *pFilterPort; + ROUTINE_GET_FILTER *pGetFilter; } HUB_ROUTINES_A; /*******************************************************************/ *************** *** 278,282 **** const HUB_ROUTINES_A *pHubRoutines); /*******************************************************************/ - DECLARE_HANDLE(HFILTER); DECLARE_HANDLE(HFILTERINSTANCE); /*******************************************************************/ --- 282,285 ---- |
From: Vyacheslav F. <vf...@us...> - 2009-02-04 15:41:22
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2995 Modified Files: export.cpp filter.h Log Message: Added pGetFilter() Index: export.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/export.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** export.cpp 2 Feb 2009 15:21:42 -0000 1.12 --- export.cpp 4 Feb 2009 15:41:15 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2009/02/04 15:41:15 vfrolov + * Added pGetFilter() + * * Revision 1.12 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 288,291 **** --- 291,302 ---- } /////////////////////////////////////////////////////////////// + static HFILTER CALLBACK get_filter(HMASTERFILTERINSTANCE hMasterFilterInstance) + { + _ASSERTE(hMasterFilterInstance != NULL); + _ASSERTE(((FilterInstance *)hMasterFilterInstance)->IsValid()); + + return ((FilterInstance *)hMasterFilterInstance)->HFilter(); + } + /////////////////////////////////////////////////////////////// HUB_ROUTINES_A hubRoutines = { sizeof(HUB_ROUTINES_A), *************** *** 307,310 **** --- 318,322 ---- timer_delete, filter_port, + get_filter, }; /////////////////////////////////////////////////////////////// Index: filter.h =================================================================== RCS file: /cvsroot/com0com/hub4com/filter.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filter.h 2 Feb 2009 15:21:42 -0000 1.2 --- filter.h 4 Feb 2009 15:41:15 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2009/02/04 15:41:15 vfrolov + * Added pGetFilter() + * * Revision 1.2 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 55,64 **** } - #ifdef _DEBUG ~Filter() { _ASSERTE(signature == FILTER_SIGNATURE); signature = 0; - } #endif const string &Name() const { return name; } --- 58,70 ---- } ~Filter() { + //if (hFilter && pDelete) + // pDelete(hFilter); + + #ifdef _DEBUG _ASSERTE(signature == FILTER_SIGNATURE); signature = 0; #endif + } const string &Name() const { return name; } *************** *** 111,116 **** delete pSrcPorts; ! //if (hFilterInstance) ! // Delete(hFilterInstance); #ifdef _DEBUG --- 117,122 ---- delete pSrcPorts; ! //if (hFilterInstance && pDeleteInstance) ! // pDeleteInstance(hFilterInstance); #ifdef _DEBUG *************** *** 120,123 **** --- 126,131 ---- } + HFILTER HFilter() const { return filter.hFilter; } + Filter &filter; Port &port; |
From: Vyacheslav F. <vf...@us...> - 2009-02-04 12:27:02
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5111 Modified Files: filters.cpp hub4com.cpp utils.cpp utils.h Log Message: Implemented --load option for filters Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** utils.cpp 2 Oct 2008 07:52:38 -0000 1.6 --- utils.cpp 4 Feb 2009 12:26:54 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2009/02/04 12:26:54 vfrolov + * Implemented --load option for filters + * * Revision 1.6 2008/10/02 07:52:38 vfrolov * Added removing macroses for undefined parameters of --load option *************** *** 55,58 **** --- 58,67 ---- } + void Args::Add(const vector<string> &args) + { + for (vector<string>::const_iterator i = args.begin() ; i != args.end() ; i++) + Add(*i); + } + static void SubstParams(string &argBuf, const vector<string> ¶ms) { *************** *** 98,102 **** void Args::Add(const string &arg) { ! const char *pLoad = GetParam(arg.c_str(), "--load="); if (!pLoad) { --- 107,111 ---- void Args::Add(const string &arg) { ! const char *pLoad = GetParam(arg.c_str(), LoadPrefix()); if (!pLoad) { *************** *** 193,197 **** continue; ! if (num_recursive > 256) { cerr << "Too many recursive options " << arg << endl; exit(1); --- 202,206 ---- continue; ! if (num_recursive > RecursiveMax()) { cerr << "Too many recursive options " << arg << endl; exit(1); *************** *** 367,388 **** const char *pName, const char *pArgs, int *pArgc, ! const char ***pArgv, ! void **ppTmp) { ! int argc = 1; ! const char **argv = (const char **)malloc((argc + 1) * sizeof(argv[0])); ! ! if (!argv) { ! cerr << "No enough memory." << endl; ! exit(2); ! } ! ! argv[0] = pName; ! ! char *pTmp; if (pArgs) { ! pTmp = _strdup(pArgs); if (!pTmp) { --- 376,387 ---- const char *pName, const char *pArgs, + Args &args, int *pArgc, ! const char ***pArgv) { ! vector<string> tokens; if (pArgs) { ! char *pTmp = _strdup(pArgs); if (!pTmp) { *************** *** 392,427 **** char *pSave; ! for (argv[argc] = STRQTOK_R(pTmp, " ", &pSave, "\"\"", TRUE, TRUE) ; ! argv[argc] ; ! argv[argc] = STRQTOK_R(NULL, " ", &pSave, "\"\"", TRUE, TRUE)) { ! argc++; ! argv = (const char **)realloc(argv, (argc + 1) * sizeof(argv[0])); ! ! if (!argv) { ! cerr << "No enough memory." << endl; ! exit(2); ! } } ! } else { ! pTmp = NULL; ! argv[argc] = NULL; } ! *pArgc = argc; ! *pArgv = argv; ! *ppTmp = pTmp; } ! void FreeArgsVector( ! const char **argv, ! void *pTmp) { if (argv) free(argv); - - if (pTmp) - free(pTmp); } /////////////////////////////////////////////////////////////// --- 391,428 ---- char *pSave; + const char *pToken; ! for (pToken = STRQTOK_R(pTmp, " ", &pSave, "\"\"", TRUE, TRUE) ; ! pToken ; ! pToken = STRQTOK_R(NULL, " ", &pSave, "\"\"", TRUE, TRUE)) { ! tokens.push_back(pToken); } ! ! free(pTmp); } ! args.Add(tokens); ! ! *pArgc = int(args.size() + 1); ! *pArgv = (const char **)malloc((*pArgc + 1) * sizeof((*pArgv)[0])); ! ! if (!*pArgv) { ! cerr << "No enough memory." << endl; ! exit(2); ! } ! ! (*pArgv)[0] = pName; ! ! for (int i = 1 ; i < *pArgc ; i++) ! (*pArgv)[i] = args[i - 1].c_str(); ! ! (*pArgv)[*pArgc] = NULL; } ! void FreeArgsVector(const char **argv) { if (argv) free(argv); } /////////////////////////////////////////////////////////////// Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** hub4com.cpp 2 Feb 2009 15:21:42 -0000 1.21 --- hub4com.cpp 4 Feb 2009 12:26:54 -0000 1.22 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.22 2009/02/04 12:26:54 vfrolov + * Implemented --load option for filters + * * Revision 1.21 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 104,108 **** << endl << "Common options:" << endl ! << " --load=[<file>][,<begin>[,<end>]][:<prms>]" << endl << " - load arguments (one argument per line) between" << endl << " <begin> and <end> lines from a file <file> (use" << endl --- 107,111 ---- << endl << "Common options:" << endl ! << " " << Args::LoadPrefix() << "[<file>][,<begin>[,<end>]][:<prms>]" << endl << " - load arguments (one argument per line) between" << endl << " <begin> and <end> lines from a file <file> (use" << endl *************** *** 114,117 **** --- 117,121 ---- << " if <end> is empty. Ignore arguments begining with" << endl << " '#'. <file> will replace %%0%% in the arguments." << endl + << " It is possible up to " << Args::RecursiveMax() << " recursive loads." << endl << " --help - show this help." << endl << " --help=* - show help for all modules." << endl *************** *** 151,154 **** --- 155,159 ---- << " Add filter to the end of filter group <FGID>" << endl << " (<FGID> is <MID> by default)." << endl + << " Any filter can accept " << Args::LoadPrefix() << "... option." << endl << " --add-filters=<Lst>:<LstF>" << endl << " - attach the filters listed in <LstF> to the ports" << endl *************** *** 182,191 **** << " " << pProgPath << " --echo-route=0 COM2" << endl << " - receive data from COM2 and send it back to COM2." << endl ! << " " << pProgPath << " --load=" << endl << " --echo-route=0" << endl << " COM2" << endl << " ^Z" << endl << " - the same as above." << endl ! << " " << pProgPath << " --load=,_BEGIN_,_END_" << endl << " blah blah blah" << endl << " _BEGIN_" << endl --- 187,196 ---- << " " << pProgPath << " --echo-route=0 COM2" << endl << " - receive data from COM2 and send it back to COM2." << endl ! << " " << pProgPath << " " << Args::LoadPrefix() << endl << " --echo-route=0" << endl << " COM2" << endl << " ^Z" << endl << " - the same as above." << endl ! << " " << pProgPath << " " << Args::LoadPrefix() << ",_BEGIN_,_END_" << endl << " blah blah blah" << endl << " _BEGIN_" << endl Index: utils.h =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** utils.h 2 Oct 2008 07:52:38 -0000 1.5 --- utils.h 4 Feb 2009 12:26:54 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2009/02/04 12:26:54 vfrolov + * Implemented --load option for filters + * * Revision 1.5 2008/10/02 07:52:38 vfrolov * Added removing macroses for undefined parameters of --load option *************** *** 48,53 **** --- 51,62 ---- { public: + Args() : num_recursive(0) {} Args(int argc, const char *const argv[]); + void Add(const vector<string> &args); + + static const char *LoadPrefix() { return "--load="; } + static int RecursiveMax() { return 256; } + private: void Add(const string &arg); *************** *** 69,78 **** const char *pName, const char *pArgs, int *pArgc, ! const char ***pArgv, ! void **ppTmp); void FreeArgsVector( ! const char **argv, ! void *pTmp); /////////////////////////////////////////////////////////////// --- 78,86 ---- const char *pName, const char *pArgs, + Args &args, int *pArgc, ! const char ***pArgv); void FreeArgsVector( ! const char **argv); /////////////////////////////////////////////////////////////// Index: filters.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/filters.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** filters.cpp 2 Feb 2009 15:21:42 -0000 1.8 --- filters.cpp 4 Feb 2009 12:26:54 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2009/02/04 12:26:54 vfrolov + * Implemented --load option for filters + * * Revision 1.8 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 100,110 **** int argc; const char **argv; ! void *pTmpArgs; ! CreateArgsVector(pFilterName, pArgs, &argc, &argv, &pTmpArgs); HFILTER hFilter = pFltRoutines->pCreate((HMASTERFILTER)pFilter, hConfig, argc, argv); ! FreeArgsVector(argv, pTmpArgs); if (!hFilter) { --- 103,113 ---- int argc; const char **argv; ! Args args; ! CreateArgsVector(pFilterName, pArgs, args, &argc, &argv); HFILTER hFilter = pFltRoutines->pCreate((HMASTERFILTER)pFilter, hConfig, argc, argv); ! FreeArgsVector(argv); if (!hFilter) { |
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:57
|
Update of /cvsroot/com0com/hub4com/plugins In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins Modified Files: plugins_api.h Log Message: Optimized filter's API Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** plugins_api.h 23 Jan 2009 16:48:49 -0000 1.24 --- plugins_api.h 2 Feb 2009 15:21:42 -0000 1.25 *************** *** 154,157 **** --- 154,158 ---- DECLARE_HANDLE(HMASTERPORT); DECLARE_HANDLE(HMASTERFILTER); + DECLARE_HANDLE(HMASTERFILTERINSTANCE); DECLARE_HANDLE(HMASTERTIMER); /*******************************************************************/ *************** *** 207,210 **** --- 208,213 ---- typedef void (CALLBACK ROUTINE_TIMER_DELETE)( HMASTERTIMER hMasterTimer); + typedef HMASTERPORT (CALLBACK ROUTINE_FILTERPORT)( + HMASTERFILTERINSTANCE hMasterFilterInstance); /*******************************************************************/ typedef struct _HUB_ROUTINES_A { *************** *** 226,229 **** --- 229,233 ---- ROUTINE_TIMER_CANCEL *pTimerCancel; ROUTINE_TIMER_DELETE *pTimerDelete; + ROUTINE_FILTERPORT *pFilterPort; } HUB_ROUTINES_A; /*******************************************************************/ *************** *** 275,295 **** /*******************************************************************/ DECLARE_HANDLE(HFILTER); /*******************************************************************/ typedef HFILTER (CALLBACK FILTER_CREATE_A)( HCONFIG hConfig, int argc, const char *const argv[]); ! typedef BOOL (CALLBACK FILTER_INIT)( ! HFILTER hFilter, ! HMASTERFILTER hMasterFilter); typedef BOOL (CALLBACK FILTER_IN_METHOD)( HFILTER hFilter, ! HMASTERPORT hFromPort, HUB_MSG *pInMsg, HUB_MSG **ppEchoMsg); typedef BOOL (CALLBACK FILTER_OUT_METHOD)( HFILTER hFilter, HMASTERPORT hFromPort, - HMASTERPORT hToPort, HUB_MSG *pOutMsg); /*******************************************************************/ --- 279,304 ---- /*******************************************************************/ DECLARE_HANDLE(HFILTER); + DECLARE_HANDLE(HFILTERINSTANCE); /*******************************************************************/ typedef HFILTER (CALLBACK FILTER_CREATE_A)( + HMASTERFILTER hMasterFilter, HCONFIG hConfig, int argc, const char *const argv[]); ! typedef void (CALLBACK FILTER_DELETE)( ! HFILTER hFilter); ! typedef HFILTERINSTANCE (CALLBACK FILTER_CREATE_INSTANCE)( ! HMASTERFILTERINSTANCE hMasterFilterInstance); ! typedef void (CALLBACK FILTER_DELETE_INSTANCE)( ! HFILTERINSTANCE hFilterInstance); typedef BOOL (CALLBACK FILTER_IN_METHOD)( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HUB_MSG *pInMsg, HUB_MSG **ppEchoMsg); typedef BOOL (CALLBACK FILTER_OUT_METHOD)( HFILTER hFilter, + HFILTERINSTANCE hFilterInstance, HMASTERPORT hFromPort, HUB_MSG *pOutMsg); /*******************************************************************/ *************** *** 297,301 **** COMMON_PLUGIN_ROUTINES_A FILTER_CREATE_A *pCreate; ! FILTER_INIT *pInit; FILTER_IN_METHOD *pInMethod; FILTER_OUT_METHOD *pOutMethod; --- 306,312 ---- COMMON_PLUGIN_ROUTINES_A FILTER_CREATE_A *pCreate; ! FILTER_DELETE *pDelete; ! FILTER_CREATE_INSTANCE *pCreateInstance; ! FILTER_DELETE_INSTANCE *pDeleteInstance; FILTER_IN_METHOD *pInMethod; FILTER_OUT_METHOD *pOutMethod; |
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:55
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins/pinmap Modified Files: filter.cpp precomp.h Log Message: Optimized filter's API Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/precomp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** precomp.h 11 Aug 2008 07:26:48 -0000 1.1 --- precomp.h 2 Feb 2009 15:21:42 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.1 2008/08/11 07:26:48 vfrolov * Initial revision *************** *** 31,35 **** #include <crtdbg.h> - #include <map> #include <iostream> --- 34,37 ---- Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** filter.cpp 22 Dec 2008 09:40:46 -0000 1.15 --- filter.cpp 2 Feb 2009 15:21:42 -0000 1.16 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.16 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.15 2008/12/22 09:40:46 vfrolov * Optimized message switching *************** *** 75,81 **** namespace FilterPinMap { /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; ! static ROUTINE_PORT_NAME_A *pPortName = NULL; ! static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 78,85 ---- namespace FilterPinMap { /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal; ! static ROUTINE_PORT_NAME_A *pPortName; ! static ROUTINE_FILTER_NAME_A *pFilterName; ! static ROUTINE_FILTERPORT *pFilterPort; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 133,138 **** class State { public: ! State() : lmInVal(0) {} WORD lmInVal; }; --- 137,143 ---- class State { public: ! State(HMASTERPORT hMasterPort) : pName(pPortName(hMasterPort)), lmInVal(0) {} + const char *const pName; WORD lmInVal; }; *************** *** 140,147 **** class Filter : public Valid { public: ! Filter(int argc, const char *const argv[]); ! State *GetState(HMASTERPORT hPort); - void SetFilterName(const char *_pName) { pName = _pName; } const char *FilterName() const { return pName; } --- 145,150 ---- class Filter : public Valid { public: ! Filter(const char *pName, int argc, const char *const argv[]); const char *FilterName() const { return pName; } *************** *** 160,175 **** const char *pName; - typedef map<HMASTERPORT, State*> PortsMap; - typedef pair<HMASTERPORT, State*> PortPair; - - PortsMap portsMap; - void Parse(const char *pArg); }; ! Filter::Filter(int argc, const char *const argv[]) ! : outMask(0), ! lmInMask(0), ! pName(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 163,173 ---- const char *pName; void Parse(const char *pArg); }; ! Filter::Filter(const char *_pName, int argc, const char *const argv[]) ! : pName(_pName), ! outMask(0), ! lmInMask(0) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 252,274 **** } } - - State *Filter::GetState(HMASTERPORT hPort) - { - PortsMap::iterator iPair = portsMap.find(hPort); - - if (iPair == portsMap.end()) { - portsMap.insert(PortPair(hPort, NULL)); - - iPair = portsMap.find(hPort); - - if (iPair == portsMap.end()) - return NULL; - } - - if (!iPair->second) - iPair->second = new State(); - - return iPair->second; - } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() --- 250,253 ---- *************** *** 349,360 **** /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! Filter *pFilter = new Filter(argc, argv); ! if (!pFilter) ! return NULL; if (!pFilter->IsValid()) { --- 328,344 ---- /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( + HMASTERFILTER hMasterFilter, HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! _ASSERTE(hMasterFilter != NULL); ! Filter *pFilter = new Filter(pFilterName(hMasterFilter), argc, argv); ! ! if (!pFilter) { ! cerr << "No enough memory." << endl; ! exit(2); ! } if (!pFilter->IsValid()) { *************** *** 366,379 **** } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK Init( ! HFILTER hFilter, ! HMASTERFILTER hMasterFilter) { _ASSERTE(hFilter != NULL); - _ASSERTE(hMasterFilter != NULL); ! ((Filter *)hFilter)->SetFilterName(pFilterName(hMasterFilter)); ! return TRUE; } /////////////////////////////////////////////////////////////// --- 350,379 ---- } /////////////////////////////////////////////////////////////// ! static void CALLBACK Delete( ! HFILTER hFilter) { _ASSERTE(hFilter != NULL); ! delete (Filter *)hFilter; ! } ! /////////////////////////////////////////////////////////////// ! static HFILTERINSTANCE CALLBACK CreateInstance( ! HMASTERFILTERINSTANCE hMasterFilterInstance) ! { ! _ASSERTE(hMasterFilterInstance != NULL); ! HMASTERPORT hMasterPort = pFilterPort(hMasterFilterInstance); ! ! _ASSERTE(hMasterPort != NULL); ! ! return (HFILTERINSTANCE)new State(hMasterPort); ! } ! /////////////////////////////////////////////////////////////// ! static void CALLBACK DeleteInstance( ! HFILTERINSTANCE hFilterInstance) ! { ! _ASSERTE(hFilterInstance != NULL); ! ! delete (State *)hFilterInstance; } /////////////////////////////////////////////////////////////// *************** *** 413,422 **** static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HMASTERPORT hFromPort, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFromPort != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); --- 413,422 ---- static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFilterInstance != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); *************** *** 427,437 **** pOutMsg->u.val |= SO_V2O_PIN_STATE(((Filter *)hFilter)->outMask); - State *pState = ((Filter *)hFilter)->GetState(hToPort); - - if (!pState) - return FALSE; - // init pin state ! InsertPinState(*(Filter *)hFilter, ((Filter *)hFilter)->lmInMask, pState->lmInVal, &pOutMsg); break; --- 427,432 ---- pOutMsg->u.val |= SO_V2O_PIN_STATE(((Filter *)hFilter)->outMask); // init pin state ! InsertPinState(*(Filter *)hFilter, ((Filter *)hFilter)->lmInMask, ((State *)hFilterInstance)->lmInVal, &pOutMsg); break; *************** *** 454,458 **** if (fail_options) { ! cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) --- 449,453 ---- if (fail_options) { ! cerr << ((State *)hFilterInstance)->pName << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) *************** *** 467,495 **** break; case HUB_MSG_T2N(HUB_MSG_TYPE_MODEM_STATUS): { - State *pState = ((Filter *)hFilter)->GetState(hToPort); - - if (!pState) - return FALSE; - WORD lmInMask = MST2LM(MASK2VAL(pOutMsg->u.val)) & ((Filter *)hFilter)->lmInMask; ! WORD lmInVal = ((MST2LM(pOutMsg->u.val) & lmInMask) | (pState->lmInVal & ~lmInMask)); ! InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! pState->lmInVal = lmInVal; break; } case HUB_MSG_T2N(HUB_MSG_TYPE_BREAK_STATUS): { if (((Filter *)hFilter)->lmInMask & LM_BREAK) { ! State *pState = ((Filter *)hFilter)->GetState(hToPort); ! ! if (!pState) ! return FALSE; ! ! WORD lmInVal = ((pOutMsg->u.val ? LM_BREAK : 0) | (pState->lmInVal & ~LM_BREAK)); ! InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! pState->lmInVal = lmInVal; } break; --- 462,480 ---- break; case HUB_MSG_T2N(HUB_MSG_TYPE_MODEM_STATUS): { WORD lmInMask = MST2LM(MASK2VAL(pOutMsg->u.val)) & ((Filter *)hFilter)->lmInMask; ! WORD lmInVal = ((MST2LM(pOutMsg->u.val) & lmInMask) | (((State *)hFilterInstance)->lmInVal & ~lmInMask)); ! InsertPinState(*(Filter *)hFilter, ((State *)hFilterInstance)->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! ((State *)hFilterInstance)->lmInVal = lmInVal; break; } case HUB_MSG_T2N(HUB_MSG_TYPE_BREAK_STATUS): { if (((Filter *)hFilter)->lmInMask & LM_BREAK) { ! WORD lmInVal = ((pOutMsg->u.val ? LM_BREAK : 0) | (((State *)hFilterInstance)->lmInVal & ~LM_BREAK)); ! InsertPinState(*(Filter *)hFilter, ((State *)hFilterInstance)->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! ((State *)hFilterInstance)->lmInVal = lmInVal; } break; *************** *** 497,510 **** case HUB_MSG_T2N(HUB_MSG_TYPE_CONNECT): { if (((Filter *)hFilter)->lmInMask & LM_CONNECT) { ! State *pState = ((Filter *)hFilter)->GetState(hToPort); ! ! if (!pState) ! return FALSE; ! ! WORD lmInVal = ((pOutMsg->u.val ? LM_CONNECT : 0) | (pState->lmInVal & ~LM_CONNECT)); ! InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! pState->lmInVal = lmInVal; } break; --- 482,490 ---- case HUB_MSG_T2N(HUB_MSG_TYPE_CONNECT): { if (((Filter *)hFilter)->lmInMask & LM_CONNECT) { ! WORD lmInVal = ((pOutMsg->u.val ? LM_CONNECT : 0) | (((State *)hFilterInstance)->lmInVal & ~LM_CONNECT)); ! InsertPinState(*(Filter *)hFilter, ((State *)hFilterInstance)->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! ((State *)hFilterInstance)->lmInVal = lmInVal; } break; *************** *** 524,528 **** NULL, // ConfigStop Create, ! Init, NULL, // InMethod OutMethod, --- 504,510 ---- NULL, // ConfigStop Create, ! Delete, ! CreateInstance, ! DeleteInstance, NULL, // InMethod OutMethod, *************** *** 540,544 **** if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; --- 522,527 ---- if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterPort)) { return NULL; *************** *** 548,551 **** --- 531,535 ---- pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; + pFilterPort = pHubRoutines->pFilterPort; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:55
|
Update of /cvsroot/com0com/hub4com/plugins/purge In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins/purge Modified Files: filter.cpp Log Message: Optimized filter's API Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/purge/filter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.cpp 22 Dec 2008 09:40:46 -0000 1.3 --- filter.cpp 2 Feb 2009 15:21:42 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.3 2008/12/22 09:40:46 vfrolov * Optimized message switching *************** *** 36,43 **** namespace FilterPurge { /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; ! static ROUTINE_PORT_NAME_A *pPortName = NULL; ! static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 39,53 ---- namespace FilterPurge { /////////////////////////////////////////////////////////////// ! #ifndef _DEBUG ! #define DEBUG_PARAM(par) ! #else /* _DEBUG */ ! #define DEBUG_PARAM(par) par ! #endif /* _DEBUG */ ! /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; ! static ROUTINE_PORT_NAME_A *pPortName; ! static ROUTINE_FILTER_NAME_A *pFilterName; ! static ROUTINE_FILTERPORT *pFilterPort; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 62,68 **** class Filter : public Valid { public: ! Filter(int argc, const char *const argv[]); - void SetFilterName(const char *_pName) { pName = _pName; } const char *FilterName() const { return pName; } --- 72,77 ---- class Filter : public Valid { public: ! Filter(const char *pName, int argc, const char *const argv[]); const char *FilterName() const { return pName; } *************** *** 74,81 **** }; ! Filter::Filter(int argc, const char *const argv[]) ! : soOutMask(SO_PURGE_TX), ! goInMask(GO1_PURGE_TX_IN), ! pName(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 83,90 ---- }; ! Filter::Filter(const char *_pName, int argc, const char *const argv[]) ! : pName(_pName), ! soOutMask(SO_PURGE_TX), ! goInMask(GO1_PURGE_TX_IN) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 126,137 **** /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! Filter *pFilter = new Filter(argc, argv); ! if (!pFilter) ! return NULL; if (!pFilter->IsValid()) { --- 135,151 ---- /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( + HMASTERFILTER hMasterFilter, HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! _ASSERTE(hMasterFilter != NULL); ! Filter *pFilter = new Filter(pFilterName(hMasterFilter), argc, argv); ! ! if (!pFilter) { ! cerr << "No enough memory." << endl; ! exit(2); ! } if (!pFilter->IsValid()) { *************** *** 143,166 **** } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK Init( ! HFILTER hFilter, ! HMASTERFILTER hMasterFilter) { _ASSERTE(hFilter != NULL); - _ASSERTE(hMasterFilter != NULL); ! ((Filter *)hFilter)->SetFilterName(pFilterName(hMasterFilter)); ! return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HMASTERPORT hFromPort, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFromPort != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); --- 157,194 ---- } /////////////////////////////////////////////////////////////// ! static void CALLBACK Delete( ! HFILTER hFilter) { _ASSERTE(hFilter != NULL); ! delete (Filter *)hFilter; ! } ! /////////////////////////////////////////////////////////////// ! static HFILTERINSTANCE CALLBACK CreateInstance( ! HMASTERFILTERINSTANCE hMasterFilterInstance) ! { ! _ASSERTE(hMasterFilterInstance != NULL); ! HMASTERPORT hMasterPort = pFilterPort(hMasterFilterInstance); ! ! _ASSERTE(hMasterPort != NULL); ! ! return (HFILTERINSTANCE)pPortName(hMasterPort); ! } ! /////////////////////////////////////////////////////////////// ! static void CALLBACK DeleteInstance( ! HFILTERINSTANCE DEBUG_PARAM(hFilterInstance)) ! { ! _ASSERTE(hFilterInstance != NULL); } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFilterInstance != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); *************** *** 189,193 **** if (fail_options) { ! cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) --- 217,221 ---- if (fail_options) { ! cerr << (const char *)hFilterInstance << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) *************** *** 227,231 **** NULL, // ConfigStop Create, ! Init, NULL, // InMethod OutMethod, --- 255,261 ---- NULL, // ConfigStop Create, ! Delete, ! CreateInstance, ! DeleteInstance, NULL, // InMethod OutMethod, *************** *** 244,248 **** !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; --- 274,279 ---- !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterPort)) { return NULL; *************** *** 253,256 **** --- 284,288 ---- pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; + pFilterPort = pHubRoutines->pFilterPort; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:54
|
Update of /cvsroot/com0com/hub4com/plugins/echo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins/echo Modified Files: filter.cpp Log Message: Optimized filter's API Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/echo/filter.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** filter.cpp 22 Dec 2008 09:40:45 -0000 1.6 --- filter.cpp 2 Feb 2009 15:21:42 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.6 2008/12/22 09:40:45 vfrolov * Optimized message switching *************** *** 99,118 **** } /////////////////////////////////////////////////////////////// - static HFILTER CALLBACK Create( - HCONFIG /*hConfig*/, - int /*argc*/, - const char *const /*argv*/[]) - { - return HFILTER(1); - } - /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( ! HFILTER DEBUG_PARAM(hFilter), ! HMASTERPORT DEBUG_PARAM(hFromPort), HUB_MSG *pInMsg, HUB_MSG **ppEchoMsg) { - _ASSERTE(hFilter != NULL); - _ASSERTE(hFromPort != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); --- 102,111 ---- } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( ! HFILTER /*hFilter*/, ! HFILTERINSTANCE /*hFilterInstance*/, HUB_MSG *pInMsg, HUB_MSG **ppEchoMsg) { _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); *************** *** 148,153 **** NULL, // Config NULL, // ConfigStop ! Create, ! NULL, // Init InMethod, NULL, // OutMethod --- 141,148 ---- NULL, // Config NULL, // ConfigStop ! NULL, // Create ! NULL, // Delete ! NULL, // CreateInstance ! NULL, // DeleteInstance InMethod, NULL, // OutMethod |
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:53
|
Update of /cvsroot/com0com/hub4com/plugins/crypt In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins/crypt Modified Files: filter.cpp precomp.h Log Message: Optimized filter's API Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/crypt/precomp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** precomp.h 5 Dec 2008 14:27:02 -0000 1.1 --- precomp.h 2 Feb 2009 15:21:42 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.1 2008/12/05 14:27:02 vfrolov * Initial revision *************** *** 32,36 **** #include <crtdbg.h> - #include <map> #include <iostream> --- 35,38 ---- Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/crypt/filter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.cpp 22 Dec 2008 09:40:45 -0000 1.3 --- filter.cpp 2 Feb 2009 15:21:42 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.3 2008/12/22 09:40:45 vfrolov * Optimized message switching *************** *** 65,71 **** --- 68,79 ---- }; /////////////////////////////////////////////////////////////// + class Filter; + class State : public Valid { public: State() { Invalidate(); } + ~State() { Close(); } + void Open(const Filter &filter); + void Close(); HCRYPTKEY hKeyIn; *************** *** 76,91 **** public: Filter(int argc, const char *const argv[]); ! State *GetState(HMASTERPORT hPort); ! void Open(State *pState); ! void Close(State *pState); private: ! HCRYPTPROV hProv; ! HCRYPTHASH hHash; ! typedef map<HMASTERPORT, State*> PortsMap; ! typedef pair<HMASTERPORT, State*> PortPair; ! PortsMap portsMap; }; --- 84,100 ---- public: Filter(int argc, const char *const argv[]); ! ! ~Filter() { ! if (IsValid()) ! CryptRelease(); ! } private: ! void CryptRelease(BOOL all = TRUE); ! friend class State; ! HCRYPTPROV hProv; ! HCRYPTHASH hHash; }; *************** *** 98,102 **** if (!pArg) { ! cerr << "Unknown option " << *pArgs << endl; Invalidate(); continue; --- 107,111 ---- if (!pArg) { ! cerr << "ERROR: Unknown option " << *pArgs << endl; Invalidate(); continue; *************** *** 106,109 **** --- 115,124 ---- if ((pParam = GetParam(pArg, "secret=")) != NULL) { + if (!noSecret) { + cerr << "ERROR: The secret was set twice" << endl; + Invalidate(); + continue; + } + if (!*pParam) cerr << "WARNING: The secret is empty" << endl; *************** *** 119,122 **** --- 134,138 ---- DWORD err = GetLastError(); cerr << "CryptCreateHash() - error=" << err << endl; + CryptRelease(FALSE); Invalidate(); continue; *************** *** 126,147 **** DWORD err = GetLastError(); cerr << "CryptHashData() - error=" << err << endl; Invalidate(); continue; } - //if (!CryptDestroyHash(hHash)) { - // DWORD err = GetLastError(); - // cerr << "CryptDestroyHash() - error=" << err << endl; - //} - - //if (CryptReleaseContext(hProv, 0)) { - // DWORD err = GetLastError(); - // cerr << "CryptReleaseContext() - error=" << err << endl; - //} - noSecret = FALSE; } else { ! cerr << "Unknown option " << pArg << endl; Invalidate(); } --- 142,154 ---- DWORD err = GetLastError(); cerr << "CryptHashData() - error=" << err << endl; + CryptRelease(); Invalidate(); continue; } noSecret = FALSE; } else { ! cerr << "ERROR: Unknown option " << pArg << endl; Invalidate(); } *************** *** 149,183 **** if (noSecret) { ! cerr << "The secret was not set" << endl; Invalidate(); } } ! State *Filter::GetState(HMASTERPORT hPort) { ! PortsMap::iterator iPair = portsMap.find(hPort); ! ! if (iPair == portsMap.end()) { ! portsMap.insert(PortPair(hPort, NULL)); ! ! iPair = portsMap.find(hPort); ! ! if (iPair == portsMap.end()) ! return NULL; } ! if (!iPair->second) ! iPair->second = new State(); ! ! return iPair->second; } ! ! void Filter::Open(State *pState) { ! _ASSERTE(!pState->IsValid()); static const DWORD flags = (((DWORD)128) << 16); ! if (!CryptDeriveKey(hProv, CALG_RC4, hHash, flags, &pState->hKeyIn)) { DWORD err = GetLastError(); cerr << "CryptDeriveKey() - error=" << err << endl; --- 156,190 ---- if (noSecret) { ! cerr << "ERROR: The secret was not set" << endl; Invalidate(); } + else + if (!IsValid()) { + CryptRelease(); + } } ! void Filter::CryptRelease(BOOL all) { ! if (all) { ! if (!CryptDestroyHash(hHash)) { ! DWORD err = GetLastError(); ! cerr << "CryptDestroyHash() - error=" << err << endl; ! } } ! if (CryptReleaseContext(hProv, 0)) { ! DWORD err = GetLastError(); ! cerr << "CryptReleaseContext() - error=" << err << endl; ! } } ! /////////////////////////////////////////////////////////////// ! void State::Open(const Filter &filter) { ! _ASSERTE(!IsValid()); static const DWORD flags = (((DWORD)128) << 16); ! if (!CryptDeriveKey(filter.hProv, CALG_RC4, filter.hHash, flags, &hKeyIn)) { DWORD err = GetLastError(); cerr << "CryptDeriveKey() - error=" << err << endl; *************** *** 185,193 **** } ! if (!CryptDeriveKey(hProv, CALG_RC4, hHash, flags, &pState->hKeyOut)) { DWORD err = GetLastError(); cerr << "CryptDeriveKey() - error=" << err << endl; ! if (!CryptDestroyKey(pState->hKeyIn)) { DWORD err = GetLastError(); cerr << "CryptDestroyKey() - error=" << err << endl; --- 192,200 ---- } ! if (!CryptDeriveKey(filter.hProv, CALG_RC4, filter.hHash, flags, &hKeyOut)) { DWORD err = GetLastError(); cerr << "CryptDeriveKey() - error=" << err << endl; ! if (!CryptDestroyKey(hKeyIn)) { DWORD err = GetLastError(); cerr << "CryptDestroyKey() - error=" << err << endl; *************** *** 197,211 **** } ! pState->Validate(); } ! void Filter::Close(State *pState) { ! if (!pState->IsValid()) return; ! pState->Invalidate(); ! if (!CryptDestroyKey(pState->hKeyIn) || !CryptDestroyKey(pState->hKeyOut)) { DWORD err = GetLastError(); cerr << "CryptDestroyKey() - error=" << err << endl; --- 204,218 ---- } ! Validate(); } ! void State::Close() { ! if (!IsValid()) return; ! Invalidate(); ! if (!CryptDestroyKey(hKeyIn) || !CryptDestroyKey(hKeyOut)) { DWORD err = GetLastError(); cerr << "CryptDestroyKey() - error=" << err << endl; *************** *** 257,268 **** /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { Filter *pFilter = new Filter(argc, argv); ! if (!pFilter) ! return NULL; if (!pFilter->IsValid()) { --- 264,280 ---- /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( + HMASTERFILTER DEBUG_PARAM(hMasterFilter), HCONFIG /*hConfig*/, int argc, const char *const argv[]) { + _ASSERTE(hMasterFilter != NULL); + Filter *pFilter = new Filter(argc, argv); ! if (!pFilter) { ! cerr << "No enough memory." << endl; ! exit(2); ! } if (!pFilter->IsValid()) { *************** *** 274,285 **** } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, ! HMASTERPORT hFromPort, HUB_MSG *pInMsg, HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFromPort != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); --- 286,321 ---- } /////////////////////////////////////////////////////////////// + static void CALLBACK Delete( + HFILTER hFilter) + { + _ASSERTE(hFilter != NULL); + + delete (Filter *)hFilter; + } + /////////////////////////////////////////////////////////////// + static HFILTERINSTANCE CALLBACK CreateInstance( + HMASTERFILTERINSTANCE DEBUG_PARAM(hMasterFilterInstance)) + { + _ASSERTE(hMasterFilterInstance != NULL); + + return (HFILTERINSTANCE)new State(); + } + /////////////////////////////////////////////////////////////// + static void CALLBACK DeleteInstance( + HFILTERINSTANCE hFilterInstance) + { + _ASSERTE(hFilterInstance != NULL); + + delete (State *)hFilterInstance; + } + /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HUB_MSG *pInMsg, HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFilterInstance != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); *************** *** 295,304 **** break; ! State *pState = ((Filter *)hFilter)->GetState(hFromPort); ! ! if (!pState) ! return FALSE; ! ! if (!CryptDecrypt(pState->hKeyIn, 0, FALSE, 0, pInMsg->u.buf.pBuf, &pInMsg->u.buf.size)) { DWORD err = GetLastError(); cerr << "CryptDecrypt() - error=" << err << endl; --- 331,335 ---- break; ! if (!CryptDecrypt(((State *)hFilterInstance)->hKeyIn, 0, FALSE, 0, pInMsg->u.buf.pBuf, &pInMsg->u.buf.size)) { DWORD err = GetLastError(); cerr << "CryptDecrypt() - error=" << err << endl; *************** *** 311,323 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_CONNECT): { - State *pState = ((Filter *)hFilter)->GetState(hFromPort); - - if (!pState) - return FALSE; - if (pInMsg->u.val) ! ((Filter *)hFilter)->Open(pState); else ! ((Filter *)hFilter)->Close(pState); break; --- 342,349 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_CONNECT): { if (pInMsg->u.val) ! ((State *)hFilterInstance)->Open(*(Filter *)hFilter); else ! ((State *)hFilterInstance)->Close(); break; *************** *** 329,340 **** /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( ! HFILTER hFilter, HMASTERPORT DEBUG_PARAM(hFromPort), - HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(hFromPort != NULL); - _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); --- 355,366 ---- /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( ! HFILTER DEBUG_PARAM(hFilter), ! HFILTERINSTANCE hFilterInstance, HMASTERPORT DEBUG_PARAM(hFromPort), HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); + _ASSERTE(hFilterInstance != NULL); _ASSERTE(hFromPort != NULL); _ASSERTE(pOutMsg != NULL); *************** *** 348,357 **** break; ! State *pState = ((Filter *)hFilter)->GetState(hToPort); ! ! if (!pState) ! return FALSE; ! ! if (!CryptEncrypt(pState->hKeyOut, 0, FALSE, 0, pOutMsg->u.buf.pBuf, &pOutMsg->u.buf.size, len)) { DWORD err = GetLastError(); cerr << "CryptEncrypt() - error=" << err << endl; --- 374,378 ---- break; ! if (!CryptEncrypt(((State *)hFilterInstance)->hKeyOut, 0, FALSE, 0, pOutMsg->u.buf.pBuf, &pOutMsg->u.buf.size, len)) { DWORD err = GetLastError(); cerr << "CryptEncrypt() - error=" << err << endl; *************** *** 377,381 **** NULL, // ConfigStop Create, ! NULL, // Init InMethod, OutMethod, --- 398,404 ---- NULL, // ConfigStop Create, ! Delete, ! CreateInstance, ! DeleteInstance, InMethod, OutMethod, |
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:51
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins/escparse Modified Files: filter.cpp precomp.h Log Message: Optimized filter's API Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escparse/precomp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** precomp.h 22 Aug 2008 17:02:59 -0000 1.1 --- precomp.h 2 Feb 2009 15:21:42 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.1 2008/08/22 17:02:59 vfrolov * Initial revision *************** *** 32,36 **** #include <string> - #include <map> #include <iostream> --- 35,38 ---- Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escparse/filter.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** filter.cpp 22 Dec 2008 09:40:45 -0000 1.10 --- filter.cpp 2 Feb 2009 15:21:42 -0000 1.11 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.10 2008/12/22 09:40:45 vfrolov * Optimized message switching *************** *** 67,77 **** #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; ! static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf = NULL; ! static ROUTINE_MSG_REPLACE_BUF *pMsgReplaceBuf = NULL; ! static ROUTINE_PORT_NAME_A *pPortName = NULL; ! static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 70,81 ---- #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; ! static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf; ! static ROUTINE_MSG_REPLACE_BUF *pMsgReplaceBuf; ! static ROUTINE_PORT_NAME_A *pPortName; ! static ROUTINE_FILTER_NAME_A *pFilterName; ! static ROUTINE_FILTERPORT *pFilterPort; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 94,103 **** }; /////////////////////////////////////////////////////////////// ! class EscParse { public: ! EscParse(BYTE _escapeChar) ! : escMode(FALSE), intercepted_options(0), - escapeChar(_escapeChar), maskMst(0), maskLsr(0), --- 98,107 ---- }; /////////////////////////////////////////////////////////////// ! class State { public: ! State(HMASTERPORT hMasterPort) ! : pName(pPortName(hMasterPort)), ! escMode(FALSE), intercepted_options(0), maskMst(0), maskLsr(0), *************** *** 107,111 **** } ! HUB_MSG *Convert(HUB_MSG *pMsg); DWORD Options() const { --- 111,115 ---- } ! HUB_MSG *Convert(BYTE escapeChar, HUB_MSG *pMsg); DWORD Options() const { *************** *** 125,128 **** --- 129,133 ---- } + const char *const pName; BOOL escMode; DWORD intercepted_options; *************** *** 132,136 **** HUB_MSG *Flush(HUB_MSG *pMsg); - BYTE escapeChar; BYTE maskMst; BYTE maskLsr; --- 137,140 ---- *************** *** 144,148 **** }; ! HUB_MSG *EscParse::Flush(HUB_MSG *pMsg) { if (!line_data.empty()) { --- 148,152 ---- }; ! HUB_MSG *State::Flush(HUB_MSG *pMsg) { if (!line_data.empty()) { *************** *** 158,162 **** } ! HUB_MSG *EscParse::Convert(HUB_MSG *pMsg) { _ASSERTE(pMsg->type == HUB_MSG_TYPE_LINE_DATA); --- 162,166 ---- } ! HUB_MSG *State::Convert(BYTE escapeChar, HUB_MSG *pMsg) { _ASSERTE(pMsg->type == HUB_MSG_TYPE_LINE_DATA); *************** *** 328,335 **** class Filter : public Valid { public: ! Filter(int argc, const char *const argv[]); ! EscParse *GetEscParse(HMASTERPORT hPort); - void SetFilterName(const char *_pName) { pName = _pName; } const char *FilterName() const { return pName; } --- 332,337 ---- class Filter : public Valid { public: ! Filter(const char *pName, int argc, const char *const argv[]); const char *FilterName() const { return pName; } *************** *** 340,352 **** private: const char *pName; - - typedef map<HMASTERPORT, EscParse*> PortsMap; - typedef pair<HMASTERPORT, EscParse*> PortPair; - - PortsMap portsMap; }; ! Filter::Filter(int argc, const char *const argv[]) ! : requestEscMode(TRUE), escapeChar(0xFF), acceptableOptions( --- 342,350 ---- private: const char *pName; }; ! Filter::Filter(const char *_pName, int argc, const char *const argv[]) ! : pName(_pName), ! requestEscMode(TRUE), escapeChar(0xFF), acceptableOptions( *************** *** 355,360 **** GO1_BREAK_STATUS | GO1_V2O_MODEM_STATUS(-1) | ! GO1_V2O_LINE_STATUS(-1)), ! pName(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 353,357 ---- GO1_BREAK_STATUS | GO1_V2O_MODEM_STATUS(-1) | ! GO1_V2O_LINE_STATUS(-1)) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 387,409 **** } } - - EscParse *Filter::GetEscParse(HMASTERPORT hPort) - { - PortsMap::iterator iPair = portsMap.find(hPort); - - if (iPair == portsMap.end()) { - portsMap.insert(PortPair(hPort, NULL)); - - iPair = portsMap.find(hPort); - - if (iPair == portsMap.end()) - return NULL; - } - - if (!iPair->second) - iPair->second = new EscParse(escapeChar); - - return iPair->second; - } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() --- 384,387 ---- *************** *** 448,459 **** /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! Filter *pFilter = new Filter(argc, argv); ! if (!pFilter) ! return NULL; if (!pFilter->IsValid()) { --- 426,442 ---- /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( + HMASTERFILTER hMasterFilter, HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! _ASSERTE(hMasterFilter != NULL); ! Filter *pFilter = new Filter(pFilterName(hMasterFilter), argc, argv); ! ! if (!pFilter) { ! cerr << "No enough memory." << endl; ! exit(2); ! } if (!pFilter->IsValid()) { *************** *** 465,488 **** } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK Init( ! HFILTER hFilter, ! HMASTERFILTER hMasterFilter) { _ASSERTE(hFilter != NULL); - _ASSERTE(hMasterFilter != NULL); ! ((Filter *)hFilter)->SetFilterName(pFilterName(hMasterFilter)); ! return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, ! HMASTERPORT hFromPort, HUB_MSG *pInMsg, HUB_MSG ** DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFromPort != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); --- 448,487 ---- } /////////////////////////////////////////////////////////////// ! static void CALLBACK Delete( ! HFILTER hFilter) { _ASSERTE(hFilter != NULL); ! delete (Filter *)hFilter; ! } ! /////////////////////////////////////////////////////////////// ! static HFILTERINSTANCE CALLBACK CreateInstance( ! HMASTERFILTERINSTANCE hMasterFilterInstance) ! { ! _ASSERTE(hMasterFilterInstance != NULL); ! HMASTERPORT hMasterPort = pFilterPort(hMasterFilterInstance); ! ! _ASSERTE(hMasterPort != NULL); ! ! return (HFILTERINSTANCE)new State(hMasterPort); ! } ! /////////////////////////////////////////////////////////////// ! static void CALLBACK DeleteInstance( ! HFILTERINSTANCE hFilterInstance) ! { ! _ASSERTE(hFilterInstance != NULL); ! ! delete (State *)hFilterInstance; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HUB_MSG *pInMsg, HUB_MSG ** DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFilterInstance != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); *************** *** 503,523 **** if (iGo == 0) { - EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); - - if (!pEscParse) - return FALSE; - // if the subsequent filters require interceptable options then // accept the received options and request the escape mode ! pEscParse->OptionsAdd((pEscParse->intercepted_options & ((Filter *)hFilter)->acceptableOptions)); if (((Filter *)hFilter)->requestEscMode) { ! if (pEscParse->Options() && (pInMsg->u.pv.val & GO0_ESCAPE_MODE)) { ! pEscParse->escMode = TRUE; *pInMsg->u.pv.pVal |= GO0_ESCAPE_MODE; // request the escape mode } } else { ! pEscParse->escMode = TRUE; } --- 502,517 ---- if (iGo == 0) { // if the subsequent filters require interceptable options then // accept the received options and request the escape mode ! ((State *)hFilterInstance)->OptionsAdd((((State *)hFilterInstance)->intercepted_options & ((Filter *)hFilter)->acceptableOptions)); if (((Filter *)hFilter)->requestEscMode) { ! if (((State *)hFilterInstance)->Options() && (pInMsg->u.pv.val & GO0_ESCAPE_MODE)) { ! ((State *)hFilterInstance)->escMode = TRUE; *pInMsg->u.pv.pVal |= GO0_ESCAPE_MODE; // request the escape mode } } else { ! ((State *)hFilterInstance)->escMode = TRUE; } *************** *** 528,536 **** else if (iGo == 1) { - EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); - - if (!pEscParse) - return FALSE; - // get interceptable options from subsequent filters separately --- 522,525 ---- *************** *** 545,549 **** pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &pEscParse->intercepted_options; _ASSERTE((interceptable_options & GO_I2O(-1)) == 0); pInMsg->u.pv.val = interceptable_options | GO_I2O(iGo); --- 534,538 ---- pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &((State *)hFilterInstance)->intercepted_options; _ASSERTE((interceptable_options & GO_I2O(-1)) == 0); pInMsg->u.pv.val = interceptable_options | GO_I2O(iGo); *************** *** 553,562 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_GET_ESC_OPTS): { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! ! if (!pEscParse) ! return FALSE; ! ! *pInMsg->u.pv.pVal = ESC_OPTS_MAP_GO1_2_EO(pEscParse->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); --- 542,546 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_GET_ESC_OPTS): { ! *pInMsg->u.pv.pVal = ESC_OPTS_MAP_GO1_2_EO(((State *)hFilterInstance)->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); *************** *** 568,585 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_FAIL_ESC_OPTS): { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! ! if (!pEscParse) ! return FALSE; ! ! DWORD fail_options = (pInMsg->u.pv.val & ESC_OPTS_MAP_GO1_2_EO(pEscParse->Options())); if (fail_options) { ! cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " escape mode option(s) 0x" << hex << fail_options << dec << " not accepted (will try non escape mode option(s))" << endl; ! pEscParse->OptionsDel(ESC_OPTS_MAP_EO_2_GO1(fail_options)); *pInMsg->u.pv.pVal |= ESC_OPTS_MAP_EO_2_GO1(fail_options); } --- 552,564 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_FAIL_ESC_OPTS): { ! DWORD fail_options = (pInMsg->u.pv.val & ESC_OPTS_MAP_GO1_2_EO(((State *)hFilterInstance)->Options())); if (fail_options) { ! cerr << ((State *)hFilterInstance)->pName << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " escape mode option(s) 0x" << hex << fail_options << dec << " not accepted (will try non escape mode option(s))" << endl; ! ((State *)hFilterInstance)->OptionsDel(ESC_OPTS_MAP_EO_2_GO1(fail_options)); *pInMsg->u.pv.pVal |= ESC_OPTS_MAP_EO_2_GO1(fail_options); } *************** *** 595,610 **** break; - EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); - - if (!pEscParse) - return FALSE; - if ((pInMsg->u.val & GO0_ESCAPE_MODE) && ((Filter *)hFilter)->requestEscMode) { ! cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " option ESCAPE_MODE not accepted" << endl; ! pEscParse->escMode = FALSE; ! pEscParse->OptionsDel((DWORD)-1); } --- 574,584 ---- break; if ((pInMsg->u.val & GO0_ESCAPE_MODE) && ((Filter *)hFilter)->requestEscMode) { ! cerr << ((State *)hFilterInstance)->pName << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " option ESCAPE_MODE not accepted" << endl; ! ((State *)hFilterInstance)->escMode = FALSE; ! ((State *)hFilterInstance)->OptionsDel((DWORD)-1); } *************** *** 619,658 **** return TRUE; ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! ! if (!pEscParse) ! return FALSE; ! ! pInMsg = pEscParse->Convert(pInMsg); break; } case HUB_MSG_T2N(HUB_MSG_TYPE_MODEM_STATUS): { - EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); - - if (!pEscParse) - return FALSE; - // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO1_O2V_MODEM_STATUS(pEscParse->Options())); break; } case HUB_MSG_T2N(HUB_MSG_TYPE_LINE_STATUS): { - EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); - - if (!pEscParse) - return FALSE; - // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO1_O2V_LINE_STATUS(pEscParse->Options())); break; } case HUB_MSG_T2N(HUB_MSG_TYPE_RBR_STATUS): { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! ! if (!pEscParse) ! return FALSE; ! ! if (pEscParse->Options() & GO1_RBR_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) --- 593,612 ---- return TRUE; ! pInMsg = ((State *)hFilterInstance)->Convert(((Filter *)hFilter)->escapeChar, pInMsg); break; } case HUB_MSG_T2N(HUB_MSG_TYPE_MODEM_STATUS): { // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO1_O2V_MODEM_STATUS(((State *)hFilterInstance)->Options())); break; } case HUB_MSG_T2N(HUB_MSG_TYPE_LINE_STATUS): { // discard any status settings controlled by this filter ! pInMsg->u.val &= ~VAL2MASK(GO1_O2V_LINE_STATUS(((State *)hFilterInstance)->Options())); break; } case HUB_MSG_T2N(HUB_MSG_TYPE_RBR_STATUS): { ! if (((State *)hFilterInstance)->Options() & GO1_RBR_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) *************** *** 662,671 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_RLC_STATUS): { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! ! if (!pEscParse) ! return FALSE; ! ! if (pEscParse->Options() & GO1_RLC_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) --- 616,620 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_RLC_STATUS): { ! if (((State *)hFilterInstance)->Options() & GO1_RLC_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) *************** *** 675,684 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_BREAK_STATUS): { ! EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(hFromPort); ! ! if (!pEscParse) ! return FALSE; ! ! if (pEscParse->Options() & GO1_BREAK_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) --- 624,628 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_BREAK_STATUS): { ! if (((State *)hFilterInstance)->Options() & GO1_BREAK_STATUS) { // discard any status settings controlled by this filter if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) *************** *** 701,705 **** NULL, // ConfigStop Create, ! Init, InMethod, NULL, // OutMethod --- 645,651 ---- NULL, // ConfigStop Create, ! Delete, ! CreateInstance, ! DeleteInstance, InMethod, NULL, // OutMethod *************** *** 721,725 **** !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceBuf) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; --- 667,672 ---- !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceBuf) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterPort)) { return NULL; *************** *** 733,736 **** --- 680,684 ---- pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; + pFilterPort = pHubRoutines->pFilterPort; return plugins; |