app-layer-krb5.c app-layer-krb5.h \
app-layer-dhcp.c app-layer-dhcp.h \
app-layer-template.c app-layer-template.h \
+app-layer-template-rust.c app-layer-template-rust.h \
app-layer-ssh.c app-layer-ssh.h \
app-layer-ssl.c app-layer-ssl.h \
conf.c conf.h \
printf(" alproto: ALPROTO_KRB5\n");
else if (pp_pe->alproto == ALPROTO_DHCP)
printf(" alproto: ALPROTO_DHCP\n");
+ else if (pp_pe->alproto == ALPROTO_TEMPLATE_RUST)
+ printf(" alproto: ALPROTO_TEMPLATE_RUST\n");
else if (pp_pe->alproto == ALPROTO_TEMPLATE)
printf(" alproto: ALPROTO_TEMPLATE\n");
else if (pp_pe->alproto == ALPROTO_DNP3)
printf(" alproto: ALPROTO_KRB5\n");
else if (pp_pe->alproto == ALPROTO_DHCP)
printf(" alproto: ALPROTO_DHCP\n");
+ else if (pp_pe->alproto == ALPROTO_TEMPLATE_RUST)
+ printf(" alproto: ALPROTO_TEMPLATE_RUST\n");
else if (pp_pe->alproto == ALPROTO_TEMPLATE)
printf(" alproto: ALPROTO_TEMPLATE\n");
else if (pp_pe->alproto == ALPROTO_DNP3)
#include "app-layer-krb5.h"
#include "app-layer-dhcp.h"
#include "app-layer-template.h"
+#include "app-layer-template-rust.h"
#include "conf.h"
#include "util-spm.h"
RegisterIKEV2Parsers();
RegisterKRB5Parsers();
RegisterDHCPParsers();
+ RegisterTemplateRustParsers();
RegisterTemplateParsers();
/** IMAP */
case ALPROTO_TEMPLATE:
proto_name = "template";
break;
+ case ALPROTO_TEMPLATE_RUST:
+ proto_name = "template-rust";
+ break;
case ALPROTO_FAILED:
proto_name = "failed";
break;
if (strcmp(proto_name,"krb5")==0) return ALPROTO_KRB5;
if (strcmp(proto_name,"dhcp")==0) return ALPROTO_DHCP;
if (strcmp(proto_name,"template")==0) return ALPROTO_TEMPLATE;
+ if (strcmp(proto_name,"template-rust")==0) return ALPROTO_TEMPLATE_RUST;
if (strcmp(proto_name,"failed")==0) return ALPROTO_FAILED;
return ALPROTO_UNKNOWN;
ALPROTO_KRB5,
ALPROTO_DHCP,
ALPROTO_TEMPLATE,
+ ALPROTO_TEMPLATE_RUST,
/* used by the probing parser when alproto detection fails
* permanently for that particular stream */
--- /dev/null
+/* Copyright (C) 2018 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/*
+ * TODO: Update \author in this file and app-layer-templaterust.h.
+ * TODO: Implement your app-layer logic with unit tests.
+ * TODO: Remove SCLogNotice statements or convert to debug.
+ */
+
+/**
+ * \file
+ *
+ * \author FirstName LastName <yourname@domain>
+ *
+ * TemplateRust application layer detector and parser for learning and
+ * templaterust pruposes.
+ *
+ * This templaterust implements a simple application layer for something
+ * like the echo protocol running on port 7.
+ */
+
+#include "suricata-common.h"
+#include "stream.h"
+#include "conf.h"
+
+#include "util-unittest.h"
+
+#include "app-layer-detect-proto.h"
+#include "app-layer-parser.h"
+
+#include "app-layer-template-rust.h"
+
+#ifdef HAVE_RUST
+#include "rust-applayertemplate-template-gen.h"
+#endif
+
+void RegisterTemplateRustParsers(void)
+{
+#ifdef HAVE_RUST
+ /* Only register if enabled in config. */
+ if (ConfGetNode("app-layer.protocols.template-rust") == NULL) {
+ return;
+ }
+ SCLogNotice("Registring Rust template parser.");
+ rs_template_register_parser();
+#endif
+#ifdef UNITTESTS
+ AppLayerParserRegisterProtocolUnittests(IPPROTO_TCP, ALPROTO_TEMPLATE_RUST,
+ TemplateRustParserRegisterTests);
+#endif
+}
+
+#ifdef UNITTESTS
+#endif
+
+void TemplateRustParserRegisterTests(void)
+{
+#ifdef UNITTESTS
+#endif
+}
--- /dev/null
+/* Copyright (C) 2018 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/**
+ * \file
+ *
+ * \author FirstName LastName <yourname@domain>
+ */
+
+#ifndef __APP_LAYER_TEMPLATE_RUST_H__
+#define __APP_LAYER_TEMPLATE_RUST_H__
+
+void RegisterTemplateRustParsers(void);
+void TemplateRustParserRegisterTests(void);
+
+#endif /* __APP_LAYER_TEMPLATE_RUST_H__ */