5 // Created by Terrin Eager on 3/17/13.
9 #ifndef __TestTB__CollectBy__
10 #define __TestTB__CollectBy__
19 // Service request/Respond v4/v6 sameSubnet/DifferentSubnet
21 enum BJ_COLLECTBY_TYPE
31 class CollectByAbstract
;
35 Collection() {m_pHeaderCollectBy
= NULL
;m_pFirstCollectBy
= NULL
;};
37 void Init(BJ_COLLECTBY_TYPE collectByList
[]);
38 void ProcessFrame(CDNSFrame
* pFrame
);
40 void ExportCollection(BJString sFileName
);
41 bool IsValid() { return (m_pFirstCollectBy
!= NULL
);};
43 CollectByAbstract
* Factory(BJ_COLLECTBY_TYPE type
);
45 BJ_COLLECTBY_TYPE m_CollectByList
[20];
46 CollectByAbstract
* m_pHeaderCollectBy
;
47 CollectByAbstract
* m_pFirstCollectBy
;
51 class CollectByAbstract
59 virtual void Collect(CDNSFrame
* pFrame
,CollectByAbstract
* nextCollectBy
)=0;
60 virtual const char* GetTitle()=0;
61 virtual CollectByAbstract
* Factory()=0;
62 virtual void Export(FILE* hFile
,BJString sPrevColumns
)=0;
64 CollectByAbstract
* pNext
;
68 class CServiceNode
: public CRBNode
<BJString
>
71 CServiceNode() {pNext
= NULL
;};
72 CServiceNode(BJString
* pKey
){ m_Key
= *pKey
;};
74 inline virtual BJ_COMPARE
Compare(BJString
* pKey
) { return m_Key
.Compare(*pKey
);};
75 inline virtual void CopyNode(CRBNode
* pSource
) {pNext
= dynamic_cast<CServiceNode
*>(pSource
)->pNext
;} ;
76 inline virtual void Init(){};
77 inline virtual void Clear() {};
78 void Export(FILE* hFile
,BJString sPrevColumns
);
79 CollectByAbstract
* pNext
;
83 class CServiceToCollectByMap
: public CLLRBTree
<BJString
, CServiceNode
>
90 class CollectByService
:public CollectByAbstract
93 virtual void Collect(CDNSFrame
* pFrame
,CollectByAbstract
* nextCollectBy
);
94 virtual const char* GetTitle() {return "Service";};
95 virtual CollectByAbstract
* Factory(){ return new CollectByService();};
96 virtual void Export(FILE* hFile
,BJString sPrevColumns
);
98 CServiceToCollectByMap m_Cache
;
101 class CollectByRequestResponds
:public CollectByAbstract
104 virtual void Collect(CDNSFrame
* pFrame
,CollectByAbstract
* nextCollectBy
);
105 virtual const char* GetTitle() {return "Request/Responds";};
106 virtual CollectByAbstract
* Factory(){ return new CollectByRequestResponds();};
107 virtual void Export(FILE* hFile
,BJString sPrevColumns
);
110 CollectByAbstract
* pRequestNext
;
111 CollectByAbstract
* pRespondsNext
;
114 class CollectByIPAddressType
:public CollectByAbstract
117 virtual void Collect(CDNSFrame
* pFrame
,CollectByAbstract
* nextCollectBy
);
118 virtual const char* GetTitle() {return "V4/V6";};
119 virtual CollectByAbstract
* Factory(){ return new CollectByIPAddressType();};
120 virtual void Export(FILE* hFile
,BJString sPrevColumns
);
122 CollectByAbstract
* pIPv4Next
;
123 CollectByAbstract
* pIPv6Next
;
126 class CollectBySameSubnetDiffSubnet
:public CollectByAbstract
129 virtual void Collect(CDNSFrame
* pFrame
,CollectByAbstract
* nextCollectBy
);
130 virtual const char* GetTitle() {return "SameSubnet/DiffSubnet";};
131 virtual CollectByAbstract
* Factory(){ return new CollectBySameSubnetDiffSubnet();};
132 virtual void Export(FILE* hFile
,BJString sPrevColumns
);
134 static bool bSameSubnet
;
136 CollectByAbstract
* pSameSubnetNext
;
137 CollectByAbstract
* pDiffSubnetNext
;
140 class CollectByPacketCount
:public CollectByAbstract
144 virtual void Collect(CDNSFrame
* pFrame
,CollectByAbstract
* nextCollectBy
);
145 virtual const char* GetTitle() {return "Packets";};
146 virtual CollectByAbstract
* Factory(){ return new CollectByPacketCount();};
147 virtual void Export(FILE* hFile
,BJString sPrevColumns
);
149 BJ_INT64 nFrameCount
;
150 BJ_INT64 nLastFrameIndex
;
151 static BJ_INT64 nFrameIndex
;
155 #endif /* defined(__TestTB__CollectBy__) */