1 /*
2 **
3 **  sfcontrol.h
4 **
5 **  Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
6 **  Copyright (C) 2002-2013 Sourcefire, Inc.
7 **  Author(s):  Ron Dempster <rdempster@sourcefire.com>
8 **
9 **  NOTES
10 **  5.16.11 - Initial Source Code. Dempster
11 **
12 **  This program is free software; you can redistribute it and/or modify
13 **  it under the terms of the GNU General Public License Version 2 as
14 **  published by the Free Software Foundation.  You may not use, modify or
15 **  distribute this program under any other version of the GNU General
16 **  Public License.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26 **
27 */
28 
29 #ifndef __SF_CONTROL_H__
30 #define __SF_CONTROL_H__
31 
32 #define CONTROL_FILE    "SNORT.sock"
33 
34 #define CS_TYPE_HUP_DAQ         0x0001
35 #define CS_TYPE_RELOAD          0x0002
36 #define CS_TYPE_IS_PROCESSING   0x0003
37 #define CS_TYPE_DUMP_PACKETS    0x0004
38 #define CS_TYPE_MEM_USAGE       0x0005
39 #define CS_TYPE_ACTION_STATS    0x0006
40 #define CS_TYPE_STREAM_STATS    0x0007
41 #define CS_TYPE_SMTP_STATS      0x0008
42 #define CS_TYPE_SSL_STATS       0x0009
43 #define CS_TYPE_SIP_STATS       0x000A
44 #define CS_TYPE_FLOWIP_START    0x000D
45 #define CS_TYPE_FLOWIP_STOP     0x000E
46 #define CS_TYPE_FLOWIP_SHOW     0x000F
47 #define CS_TYPE_MEM_STATS_CFG   0x0011
48 #define CS_TYPE_MEM_STATS_SHOW  0x0012
49 #define CS_TYPE_MAX             0x1FFF
50 #define CS_HEADER_VERSION       0x0001
51 #define CS_HEADER_SUCCESS       0x0000
52 #define CS_HEADER_ERROR         0x0001
53 #define CS_HEADER_DATA          0x0009
54 #ifdef REG_TEST
55 #define CS_CONFIG_SWAP          0x000A
56 #endif
57 /* For SFR Display */
58 #define MEM_STATS_BUF_SIZE 7680 //CS_STATS_BUF_SIZE * (no. of preprocessors) * 2 = 1280 * 3 * 2
59 #define CS_STATS_BUF_SIZE 1280
60 #pragma pack(1)
61 typedef struct _CS_MESSAGE_DATA_HEADER
62 {
63     /* All values must be in network byte order */
64     int32_t code;
65     uint16_t length;    /* Data length. Does not include this header */
66 } CSMessageDataHeader;
67 #pragma pack()
68 
69 typedef struct _CS_MESSAGE_HEADER
70 {
71     /* All values must be in network byte order */
72     uint16_t version;
73     uint16_t type;
74     uint32_t length;    /* Does not include the header */
75 } CSMessageHeader;
76 
77 struct _THREAD_ELEMENT;
78 typedef int (*ControlDataSendFunc)(struct _THREAD_ELEMENT *te, const uint8_t *data, uint16_t length);
79 typedef int (*OOBPreControlFunc)(uint16_t type, const uint8_t *data, uint32_t length, void **new_context, char *statusBuf, int statusBuf_len);
80 typedef int (*IBControlFunc)(uint16_t type, void *new_context, void **old_context);
81 typedef void (*OOBPostControlFunc)(uint16_t type, void *old_context, struct _THREAD_ELEMENT *te, ControlDataSendFunc f);
82 
83 #endif
84 
85