]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/ecostest/common/eCosTestMonitorFilter.h
Initial revision
[karo-tx-redboot.git] / tools / src / tools / ecostest / common / eCosTestMonitorFilter.h
1 //####COPYRIGHTBEGIN####
2 //                                                                          
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it 
9 // under the terms of the GNU General Public License as published by the Free 
10 // Software Foundation; either version 2 of the License, or (at your option) 
11 // any later version.
12 // 
13 // This program is distributed in the hope that it will be useful, but WITHOUT 
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16 // more details.
17 // 
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc., 
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //                                                                          
24 //####COPYRIGHTEND####
25 //=================================================================
26 //
27 //        eCosTestMonitorFilter.h
28 //
29 //        Simple filter for monitoring data flowing through the client
30 //
31 //=================================================================
32 //=================================================================
33 //#####DESCRIPTIONBEGIN####
34 //
35 // Author(s):     jskov
36 // Contributors:  jskov
37 // Date:          2000-03-16
38 //####DESCRIPTIONEND####
39 #ifndef _CECOSMONITORFILTER_H
40 #define _CECOSMONITORFILTER_H
41
42 #include "eCosStd.h"
43 #include "eCosTest.h"
44 #include "eCosSocket.h"
45 #include "eCosSerial.h"
46
47 //----------------------------------------------------------------------------
48 // The filter class
49 class CeCosTestMonitorFilter;
50
51 class CeCosTestMonitorFilter {
52 public:
53     enum data_origin_t {MF_TARGET=0, MF_HOST} ;
54
55     // Constructor
56     CeCosTestMonitorFilter();
57     ~CeCosTestMonitorFilter();
58
59     // Configuration methods
60     void SetVerbose(bool bVerbose) 
61         { m_bOptVerbose = bVerbose; }
62     void SetOrigin(data_origin_t eOrigin)
63         { m_eOrigin = eOrigin; }
64
65     bool FilterFunctionProper(void*& pBuf, unsigned int& nRead);
66
67 private:
68
69     // Output methods
70     void ConsoleWrite(const char* pszStr);
71     void Trace(const char* pszFormat, ...);
72     void PrintHex(const unsigned char* d1, int len, 
73                   data_origin_t origin=MF_TARGET);
74
75         
76     // Options used for configuring behavior.
77     bool m_bOptVerbose;
78
79     data_origin_t m_eOrigin;
80
81 };
82
83 extern bool CALLBACK SerialMonitorFunction(void*& pBuf,
84                                            unsigned int& nRead,
85                                            CeCosSerial& serial,
86                                            CeCosSocket& socket,
87                                            void* pParem);
88     
89 #endif // _CECOSMONITORFILTER_H