36 #ifndef ARM_TRC_PKT_PROC_BASE_H_INCLUDED 37 #define ARM_TRC_PKT_PROC_BASE_H_INCLUDED 68 TrcPktProcI(
const char *component_name,
int instIDNum);
73 virtual ocsd_datapath_resp_t
TraceDataIn(
const ocsd_datapath_op_t op,
74 const ocsd_trc_index_t index,
75 const uint32_t dataBlockSize,
76 const uint8_t *pDataBlock,
77 uint32_t *numBytesProcessed) = 0;
84 virtual ocsd_datapath_resp_t
processData(
const ocsd_trc_index_t index,
85 const uint32_t dataBlockSize,
86 const uint8_t *pDataBlock,
87 uint32_t *numBytesProcessed) = 0;
89 virtual ocsd_datapath_resp_t
onEOT() = 0;
90 virtual ocsd_datapath_resp_t
onReset() = 0;
91 virtual ocsd_datapath_resp_t
onFlush() = 0;
122 template <
class P,
class Pt,
class Pc>
135 virtual ocsd_datapath_resp_t
TraceDataIn(
const ocsd_datapath_op_t op,
136 const ocsd_trc_index_t index,
137 const uint32_t dataBlockSize,
138 const uint8_t *pDataBlock,
139 uint32_t *numBytesProcessed);
154 virtual ocsd_err_t setProtocolConfig(
const Pc *config);
161 ocsd_datapath_resp_t outputDecodedPacket(
const ocsd_trc_index_t index_sop,
const P *pkt);
163 void outputRawPacketToMonitor(
const ocsd_trc_index_t index_sop,
166 const uint8_t *p_data);
168 void indexPacket(
const ocsd_trc_index_t index_sop,
const Pt *packet_type);
170 ocsd_datapath_resp_t outputOnAllInterfaces(
const ocsd_trc_index_t index_sop,
const P *pkt,
const Pt *pkt_type, std::vector<uint8_t> &pktdata);
172 ocsd_datapath_resp_t outputOnAllInterfaces(
const ocsd_trc_index_t index_sop,
const P *pkt,
const Pt *pkt_type,
const uint8_t *pktdata, uint32_t pktlen);
177 const bool hasRawMon()
const;
182 void ClearConfigObj();
184 const bool checkInit();
188 ocsd_datapath_resp_t Reset(
const ocsd_trc_index_t index);
189 ocsd_datapath_resp_t Flush();
190 ocsd_datapath_resp_t EOT();
220 const ocsd_trc_index_t index,
221 const uint32_t dataBlockSize,
222 const uint8_t *pDataBlock,
223 uint32_t *numBytesProcessed)
225 ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
230 if((dataBlockSize == 0) || (pDataBlock == 0) || (numBytesProcessed == 0))
232 if(numBytesProcessed)
233 *numBytesProcessed = 0;
234 LogError(
ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL,
"Packet Processor: Zero length data block or NULL pointer error\n"));
235 resp = OCSD_RESP_FATAL_INVALID_PARAM;
238 resp =
processData(index,dataBlockSize,pDataBlock,numBytesProcessed);
254 LogError(
ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL,
"Packet Processor : Unknown Datapath operation\n"));
255 resp = OCSD_RESP_FATAL_INVALID_OP;
264 ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
268 resp = m_pkt_out_i.
first()->PacketDataIn(OCSD_OP_RESET,index,0);
271 if(!OCSD_DATA_RESP_IS_FATAL(resp))
276 m_pkt_raw_mon_i.
first()->RawPacketDataMon(OCSD_OP_RESET,index,0,0,0);
283 ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
284 ocsd_datapath_resp_t resplocal = OCSD_RESP_CONT;
288 resp = m_pkt_out_i.
first()->PacketDataIn(OCSD_OP_FLUSH,0,0);
291 if(OCSD_DATA_RESP_IS_CONT(resp))
294 return (resplocal > resp) ? resplocal : resp;
299 ocsd_datapath_resp_t resp =
onEOT();
303 resp = m_pkt_out_i.
first()->PacketDataIn(OCSD_OP_EOT,0,0);
307 m_pkt_raw_mon_i.
first()->RawPacketDataMon(OCSD_OP_EOT,0,0,0,0);
314 ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
322 resp = m_pkt_out_i.
first()->PacketDataIn(OCSD_OP_DATA,index,pkt);
327 const ocsd_trc_index_t index_sop,
330 const uint8_t *p_data)
342 m_pkt_raw_mon_i.
first()->RawPacketDataMon(OCSD_OP_DATA,index_sop,pkt,size,p_data);
354 m_pkt_indexer_i.
first()->TracePktIndex(index_sop,packet_type);
360 if(pktdata.size() > 0)
374 ocsd_err_t err = OCSD_ERR_INVALID_PARAM_VAL;
378 m_config =
new (std::nothrow) Pc(*config);
410 #endif // ARM_TRC_PKT_PROC_BASE_H_INCLUDED
virtual ocsd_err_t onProtocolConfig()=0
Called when the configuration object is passed to the decoder.
virtual const bool isBadPacket() const =0
check if the current packet is an error / bad packet
virtual ocsd_datapath_resp_t onFlush()=0
Implementation function for the OCSD_OP_FLUSH operation.
virtual ocsd_datapath_resp_t TraceDataIn(const ocsd_datapath_op_t op, const ocsd_trc_index_t index, const uint32_t dataBlockSize, const uint8_t *pDataBlock, uint32_t *numBytesProcessed)=0
ocsd_datapath_resp_t outputOnAllInterfaces(const ocsd_trc_index_t index_sop, const P *pkt, const Pt *pkt_type, std::vector< uint8_t > &pktdata)
TrcPktProcI(const char *component_name)
const uint32_t getComponentOpMode() const
Packet Processor base class. Provides common infrastructure and interconnections for packet processor...
void outputRawPacketToMonitor(const ocsd_trc_index_t index_sop, const P *pkt, const uint32_t size, const uint8_t *p_data)
virtual const Pc * getProtocolConfig() const
Base class for all decode components in the library.
TrcPktProcBase(const char *component_name)
virtual ocsd_datapath_resp_t onEOT()=0
Implementation function for the OCSD_OP_EOT operation.
virtual ocsd_datapath_resp_t processData(const ocsd_trc_index_t index, const uint32_t dataBlockSize, const uint8_t *pDataBlock, uint32_t *numBytesProcessed)=0
Implementation function for the OCSD_OP_DATA operation.
const bool hasAttached() const
Interface to either trace data frame deformatter or packet processor.
void LogError(const ocsdError &Error)
virtual ~TrcPktProcBase()
virtual ocsd_err_t setProtocolConfig(const Pc *config)
< Set the protocol specific configuration for the decoder.
componentAttachPt< IPktRawDataMon< P > > * getRawPacketMonAttachPt()
Attachment point for the protocol packet monitor.
ocsd_datapath_resp_t outputDecodedPacket(const ocsd_trc_index_t index_sop, const P *pkt)
componentAttachPt< IPktDataIn< P > > * getPacketOutAttachPt()
Attachement point for the protocol packet output.
Base Packet processing interface.
const bool hasAttachedAndEnabled() const
virtual ocsd_datapath_resp_t TraceDataIn(const ocsd_datapath_op_t op, const ocsd_trc_index_t index, const uint32_t dataBlockSize, const uint8_t *pDataBlock, uint32_t *numBytesProcessed)
Single component interface pointer attachment point.
componentAttachPt< ITrcPktIndexer< Pt > > * getTraceIDIndexerAttachPt()
Attachment point for a packet indexer.
void indexPacket(const ocsd_trc_index_t index_sop, const Pt *packet_type)
OpenCSD : Base trace decode component.
const bool hasRawMon() const
OpenCSD : Component attachment point interface class.
virtual ocsd_datapath_resp_t onReset()=0
Implementation function for the OCSD_OP_RESET operation.