]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/sys: stub in suricata-sys crate for Rust bindings to C
authorJason Ish <jason.ish@oisf.net>
Thu, 23 Jan 2025 22:19:09 +0000 (16:19 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 17 Feb 2025 06:31:29 +0000 (07:31 +0100)
Follow Rust convention of using a "sys" crate for bindings to C
functions. The bindings don't exist yet, but will be generated by
bindgen and put into this crate.

Ticket: #7341

configure.ac
rust/Cargo.lock.in
rust/Cargo.toml.in
rust/Makefile.am
rust/sys/Cargo.toml.in [new file with mode: 0644]
rust/sys/Makefile.am [new file with mode: 0644]
rust/sys/src/lib.rs [new file with mode: 0644]

index 360c354ebcb8dd9210589d9d95fb2a5d4605c159..9b4db2ba1f2d73e1319379e7731c6676f39603ee 100644 (file)
@@ -2536,6 +2536,7 @@ AC_SUBST(enable_non_bundled_htp)
 AM_CONDITIONAL([BUILD_SHARED_LIBRARY], [test "x$enable_shared" = "xyes"] && [test "x$can_build_shared_library" = "xyes"])
 
 AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.lock rust/Cargo.toml rust/derive/Cargo.toml rust/.cargo/config.toml)
+AC_CONFIG_FILES(rust/sys/Makefile rust/sys/Cargo.toml)
 AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile)
 AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile)
 AC_CONFIG_FILES(contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile)
index 2f9dd776ac20510e886ccb9962c5864577ce5f54..f48fa14081028ff1da92f53a5ad887f9c2e9b006 100644 (file)
@@ -1010,6 +1010,7 @@ dependencies = [
  "snmp-parser",
  "suricata-derive",
  "suricata-lua-sys",
+ "suricata-sys",
  "test-case",
  "time",
  "tls-parser",
@@ -1037,6 +1038,10 @@ dependencies = [
  "fs_extra",
 ]
 
+[[package]]
+name = "suricata-sys"
+version = "8.0.0-dev"
+
 [[package]]
 name = "syn"
 version = "1.0.109"
index e3c469dc8855e73693a5cacb86e5fc4004be8886..b01e4c570c4709e6716a23e6fdefa0a2b2c8088c 100644 (file)
@@ -7,7 +7,7 @@ edition = "2021"
 rust-version = "1.67.1"
 
 [workspace]
-members = [".", "./derive"]
+members = [".", "./derive", "sys"]
 
 [lib]
 crate-type = ["staticlib", "rlib"]
@@ -68,6 +68,7 @@ hex = "~0.4.3"
 time = "~0.3.36"
 
 suricata-derive = { path = "./derive", version = "@PACKAGE_VERSION@" }
+suricata-sys = { path = "./sys", version = "@PACKAGE_VERSION@" }
 
 suricata-lua-sys = { version = "0.1.0-alpha.6" }
 
index a47a1c15342d5383122b0014db57dd746a6bed9f..7abd37d2208fc6d54922f8c6177e17acd593fa43 100644 (file)
@@ -1,10 +1,14 @@
+SUBDIRS =      sys
+
 EXTRA_DIST =   src derive \
                .cargo/config.toml.in \
                cbindgen.toml \
                dist/rust-bindings.h \
                vendor \
                Cargo.toml Cargo.lock \
-               derive/Cargo.toml
+               derive/Cargo.toml \
+               sys \
+               sys/Cargo.toml
 
 if !DEBUG
 RELEASE = --release
diff --git a/rust/sys/Cargo.toml.in b/rust/sys/Cargo.toml.in
new file mode 100644 (file)
index 0000000..518fe36
--- /dev/null
@@ -0,0 +1,6 @@
+[package]
+name = "suricata-sys"
+version = "@PACKAGE_VERSION@"
+edition = "2021"
+license = "GPL-2.0-only"
+description = "Bindings to Suricata C interface"
diff --git a/rust/sys/Makefile.am b/rust/sys/Makefile.am
new file mode 100644 (file)
index 0000000..acf00ae
--- /dev/null
@@ -0,0 +1,3 @@
+EXTRA_DIST =   Cargo.toml
+
+all-local: Cargo.toml
diff --git a/rust/sys/src/lib.rs b/rust/sys/src/lib.rs
new file mode 100644 (file)
index 0000000..48917a9
--- /dev/null
@@ -0,0 +1,16 @@
+/* Copyright (C) 2025 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.
+ */