[Com0com-cvs] hub4com filters.cpp, 1.4, 1.5 filters.h, 1.4, 1.5 hub4com.cpp, 1.15, 1.16
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2008-10-16 06:19:24
|
Update of /cvsroot/com0com/hub4com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25644 Modified Files: filters.cpp filters.h hub4com.cpp Log Message: Divided filter ID to filter group ID and filter name Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** hub4com.cpp 26 Sep 2008 15:34:50 -0000 1.15 --- hub4com.cpp 16 Oct 2008 06:19:12 -0000 1.16 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.16 2008/10/16 06:19:12 vfrolov + * Divided filter ID to filter group ID and filter name + * * Revision 1.15 2008/09/26 15:34:50 vfrolov * Fixed adding order for filters with the same FID *************** *** 117,124 **** << endl << "Filter options:" << endl ! << " --create-filter=<MID>[,<FID>][:<Args>]" << endl << " - by using filter module with name <MID> create a" << endl ! << " filter with name <FID> (<FID> is <MID> by default)" << endl << " and put arguments <Args> (if any) to the filter." << endl << " --add-filters=<Lst>:<LstF>" << endl << " - attach the filters listed in <LstF> to the ports" << endl --- 120,129 ---- << endl << "Filter options:" << endl ! << " --create-filter=<MID>[,<FGID>[,<FN>]][:<Args>]" << endl << " - by using filter module with name <MID> create a" << endl ! << " filter with name <FN> (<FN> is <FGID> by default)" << endl << " 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 << " --add-filters=<Lst>:<LstF>" << endl << " - attach the filters listed in <LstF> to the ports" << endl *************** *** 129,137 **** << endl << " The syntax of <LstF> above is <F1>[,<F2>...], where the syntax of <Fn> is" << endl ! << " <FID>[.<Method>][(<Lst>)], where <FID> is a filter name, <Method> is IN or" << endl << " OUT and <Lst> lists the source ports (the data only from them will be handled" << endl ! << " by OUT method). The <FID> w/o <Method> is equivalent to adding IN and OUT for" << endl ! << " each filter with name <FID>. If the list of the source ports is not specified" << endl ! << " then the data routed from any port will be handled by OUT method." << endl << endl << "Port options:" << endl --- 134,142 ---- << endl << " The syntax of <LstF> above is <F1>[,<F2>...], where the syntax of <Fn> is" << endl ! << " <FGID>[.<Method>][(<Lst>)], where <FGID> is a filter group, <Method> is IN or" << endl << " OUT and <Lst> lists the source ports (the data only from them will be handled" << endl ! << " by OUT method). The <FGID> w/o <Method> is equivalent to adding IN and OUT" << endl ! << " for each filter from the group <FGID>. If the list of the source ports is not" << endl ! << " specified then the data routed from any port will be handled by OUT method." << endl << endl << "Port options:" << endl *************** *** 310,319 **** } const char *pFilterName = STRTOK_R(NULL, "", &pSave); if (!pFilterName || !*pFilterName) ! pFilterName = pPluginName; ! if (!filter.CreateFilter(pFltRoutines, pFilterName, hConfig, pArgs)) { cerr << "Invalid filter " << pParam << endl; exit(1); --- 315,329 ---- } + const char *pFilterGroup = STRTOK_R(NULL, ",", &pSave); + + if (!pFilterGroup || !*pFilterGroup) + pFilterGroup = pPluginName; + const char *pFilterName = STRTOK_R(NULL, "", &pSave); if (!pFilterName || !*pFilterName) ! pFilterName = pFilterGroup; ! if (!filter.CreateFilter(pFltRoutines, pFilterGroup, pFilterName, hConfig, pArgs)) { cerr << "Invalid filter " << pParam << endl; exit(1); Index: filters.h =================================================================== RCS file: /cvsroot/com0com/hub4com/filters.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filters.h 26 Sep 2008 15:34:50 -0000 1.4 --- filters.h 16 Oct 2008 06:19:12 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/10/16 06:19:12 vfrolov + * Divided filter ID to filter group ID and filter name + * * Revision 1.4 2008/09/26 15:34:50 vfrolov * Fixed adding order for filters with the same FID *************** *** 56,59 **** --- 59,63 ---- BOOL CreateFilter( const FILTER_ROUTINES_A *pFltRoutines, + const char *pFilterGroup, const char *pFilterName, HCONFIG hConfig, *************** *** 61,65 **** BOOL AddFilter( int iPort, ! const char *pName, BOOL addInMethod, BOOL addOutMethod, --- 65,69 ---- BOOL AddFilter( int iPort, ! const char *pGroup, BOOL addInMethod, BOOL addOutMethod, Index: filters.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/filters.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filters.cpp 26 Sep 2008 15:34:50 -0000 1.4 --- filters.cpp 16 Oct 2008 06:19:12 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/10/16 06:19:12 vfrolov + * Divided filter ID to filter group ID and filter name + * * Revision 1.4 2008/09/26 15:34:50 vfrolov * Fixed adding order for filters with the same FID *************** *** 46,49 **** --- 49,53 ---- public: Filter( + const char *pGroup, const char *pName, HFILTER _hFilter, *************** *** 51,55 **** FILTER_IN_METHOD *_pInMethod, FILTER_OUT_METHOD *_pOutMethod) ! : name(pName), hFilter(_hFilter), pInit(_pInit), --- 55,60 ---- FILTER_IN_METHOD *_pInMethod, FILTER_OUT_METHOD *_pOutMethod) ! : group(pGroup), ! name(pName), hFilter(_hFilter), pInit(_pInit), *************** *** 57,60 **** --- 62,66 ---- pOutMethod(_pOutMethod) {} + const string group; const string name; const HFILTER hFilter; *************** *** 103,106 **** --- 109,113 ---- BOOL Filters::CreateFilter( const FILTER_ROUTINES_A *pFltRoutines, + const char *pFilterGroup, const char *pFilterName, HCONFIG hConfig, *************** *** 128,131 **** --- 135,139 ---- Filter *pFilter = new Filter( + pFilterGroup, pFilterName, hFilter, *************** *** 146,150 **** BOOL Filters::AddFilter( int iPort, ! const char *pName, BOOL addInMethod, BOOL addOutMethod, --- 154,158 ---- BOOL Filters::AddFilter( int iPort, ! const char *pGroup, BOOL addInMethod, BOOL addOutMethod, *************** *** 176,180 **** for (FilterArray::const_iterator i = allFilters.begin() ; i != allFilters.end() ; i++) { ! if (*i && (*i)->name == pName) { if (addInMethod && (*i)->pInMethod) { FilterMethod *pFilterMethod = new FilterMethod(*(*i), TRUE, NULL); --- 184,188 ---- for (FilterArray::const_iterator i = allFilters.begin() ; i != allFilters.end() ; i++) { ! if (*i && (*i)->group == pGroup) { if (addInMethod && (*i)->pInMethod) { FilterMethod *pFilterMethod = new FilterMethod(*(*i), TRUE, NULL); *************** *** 217,221 **** if (!found) { ! cerr << "Can't find filter " << pName << endl; return FALSE; } --- 225,229 ---- if (!found) { ! cerr << "Can't find any filter for group " << pGroup << endl; return FALSE; } |