1 /*
2 ** Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 **
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU General Public License Version 2 as
6 ** published by the Free Software Foundation.  You may not use, modify or
7 ** distribute this program under any other version of the GNU General
8 ** Public License.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 */
19 
20 #ifndef _PKT_TRACER_H
21 #define _PKT_TRACER_H
22 
23 #include "sf_ip.h"
24 #include "sfdaq.h"
25 #include "dynamic-plugins/sf_dynamic_common.h"
26 
27 #define CS_TYPE_PKT_TRACER 120
28 #define MAX_TRACE_LINE 256
29 
30 extern volatile int pkt_trace_cli_flag;
31 extern bool pkt_trace_enabled;
32 extern char trace_line[MAX_TRACE_LINE];
33 
34 int DebugPktTracer(uint16_t type, const uint8_t *data, uint32_t length, void **new_context,
35         char* statusBuf, int statusBuf_len);
36 bool pktTracerDebugCheck(Packet* p);
37 bool pktTracerDebugCheckSsn(void* ssn);
38 void addPktTraceData(int module, int traceLen);
39 void addPktTraceInfo(void *packet);
40 void writePktTraceData(DAQ_Verdict verdict, unsigned int napId, unsigned int ipsId, const Packet* p);
41 const char* getPktTraceActMsg();
42 void SavePktTrace();
43 void RestorePktTrace();
44 
45 extern Verdict_Reason verdict_reason;
46 #if defined(HAVE_DAQ_EXT_MODFLOW) && defined(HAVE_DAQ_VERDICT_REASON)
47 void sendReason(const Packet* p);
48 #endif
49 
50 #endif
51