1 /*
2 ** Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 ** Copyright (C) 2002-2013 Sourcefire, Inc.
4 ** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com>
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License Version 2 as
8 ** published by the Free Software Foundation.  You may not use, modify or
9 ** distribute this program under any other version of the GNU General
10 ** Public License.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 */
21 
22 /* $Id$ */
23 #ifndef __LOG_H__
24 #define __LOG_H__
25 
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29 
30 #include <syslog.h>
31 
32 #include "event.h"
33 #include "decode.h"
34 
35 #ifndef LOG_AUTHPRIV
36 # define LOG_AUTHPRIV LOG_AUTH
37 #endif
38 
39 #define FRAME_SIZE        66
40 #define C_OFFSET          49
41 
42 /*  P R O T O T Y P E S  ******************************************************/
43 
44 
45 void PrintIpAddrs(FILE *, Packet *);
46 void PrintIPPkt(FILE *, int,Packet*);
47 void PrintNetData(FILE *, const u_char *, const int, Packet *);
48 void ClearDumpBuf(void);
49 void Print2ndHeader(FILE *, Packet *);
50 void PrintEthHeader(FILE *, Packet *);
51 #ifdef MPLS
52 void PrintMPLSHeader(FILE *, Packet *);
53 #endif
54 #ifdef GRE
55 void PrintGREHeader(FILE *, Packet *);
56 void PrintOuterIPHeader(FILE *, Packet *);
57 #endif
58 void PrintIPHeader(FILE *, Packet *);
59 void PrintTCPHeader(FILE *, Packet *);
60 void PrintTcpOptions(FILE *, Packet *);
61 void PrintIpOptions(FILE *, Packet *);
62 void PrintICMPHeader(FILE *, Packet *);
63 void PrintICMPEmbeddedIP(FILE *, Packet *);
64 void PrintEmbeddedICMPHeader(FILE *, const ICMPHdr *);
65 void PrintUDPHeader(FILE *, Packet *);
66 void PrintPriorityData(FILE *, int);
67 void PrintXrefs(FILE *, int);
68 void CreateTCPFlagString(Packet *, char *);
69 
70 #ifndef NO_NON_ETHER_DECODER
71 void PrintEapolPkt(FILE *, Packet *);
72 void PrintEapolKey(FILE *, Packet *);
73 void PrintWifiPkt(FILE *, Packet *);
74 void PrintTrHeader(FILE *, Packet *);
75 void PrintWifiHeader(FILE *, Packet *);
76 void PrintSLLHeader(FILE *, Packet *);
77 void PrintArpHeader(FILE *, Packet *);
78 void PrintEapolHeader(FILE *, Packet *);
79 void PrintEAPHeader(FILE *, Packet *);
80 #endif
81 
82 void NoLog(Packet *, char *, void *, Event *);
83 void NoAlert(Packet *, char *, void *, Event *);
84 FILE *OpenAlertFile(const char *);
85 int RollAlertFile(const char *);
86 
87 #ifndef WIN32
88 void SetEvent(Event *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
89 #if !defined(FEAT_OPEN_APPID)
90         uint32_t);
91 #else /* defined(FEAT_OPEN_APPID) */
92         uint32_t, char *);
93 #endif /* defined(FEAT_OPEN_APPID) */
94 #else
95 /* There is a naming conflict with a Win32 standard function, so compensate */
96 #define SetEvent SnortSetEvent
97 void SnortSetEvent(Event *, uint32_t, uint32_t, uint32_t, uint32_t,
98 #if !defined(FEAT_OPEN_APPID)
99         uint32_t, uint32_t);
100 #else /* defined(FEAT_OPEN_APPID) */
101         uint32_t, uint32_t, char *);
102 #endif /* defined(FEAT_OPEN_APPID) */
103 #endif
104 
105 #endif /* __LOG_H__ */
106 
107