]> git.ipfire.org Git - people/ms/suricata.git/blame - src/app-layer-mqtt.c
core: Remove unneeded consts
[people/ms/suricata.git] / src / app-layer-mqtt.c
CommitLineData
c3136007
SS
1/* Copyright (C) 2020 Open Information Security Foundation
2 *
3 * You can copy, redistribute or modify this Program under the terms of
4 * the GNU General Public License version 2 as published by the Free
5 * Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * version 2 along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18/**
19 * \file
20 *
21 * \author Sascha Steinbiss <sascha@steinbiss.name>
22 */
23
24#include "suricata-common.h"
25#include "stream.h"
26#include "conf.h"
27
28#include "util-misc.h"
29#include "util-unittest.h"
30
31#include "app-layer-detect-proto.h"
32#include "app-layer-parser.h"
33
34#include "app-layer-mqtt.h"
35#include "rust.h"
36
37void RegisterMQTTParsers(void)
38{
39 SCLogDebug("Registering Rust mqtt parser.");
40 uint32_t max_msg_len = 1048576; /* default: 1MB */
41
42 if (AppLayerParserConfParserEnabled("tcp", "mqtt")) {
43 ConfNode *p = ConfGetNode("app-layer.protocols.mqtt.max-msg-length");
44 if (p != NULL) {
45 uint32_t value;
46 if (ParseSizeStringU32(p->val, &value) < 0) {
47 SCLogError(SC_ERR_SIZE_PARSE, "invalid value for max-msg-length: %s", p->val);
48 } else {
49 max_msg_len = value;
50 }
51 }
52 rs_mqtt_register_parser(max_msg_len);
53 }
54#ifdef UNITTESTS
55 AppLayerParserRegisterProtocolUnittests(IPPROTO_TCP, ALPROTO_MQTT,
56 MQTTParserRegisterTests);
57#endif
58}
59
60void MQTTParserRegisterTests(void)
61{
62#ifdef UNITTESTS
63#endif
64}