summaryrefslogtreecommitdiffstats
path: root/src/expect/api.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2007-05-06 17:39:00 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2007-05-06 17:39:00 +0000
commit84f120b150d14adb1cefec601e28b2522612a620 (patch)
treecc96e2849a8e7be3ec9a36759b8fe5ad84d0ffa4 /src/expect/api.c
parent04678e577c875efdefc93a0450688ca60cc93cd8 (diff)
- add warning note to ctnl_test.c: old API is deprecated
- split expect_api_test.c into small example files expect_*.c - introduce alias tags for original tuple attributes - introduce nfexp_sizeof and nfexp_maxsize - build expectation attributes iif they are set - fix l3num setting in expect/build.c
Diffstat (limited to 'src/expect/api.c')
-rw-r--r--src/expect/api.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/expect/api.c b/src/expect/api.c
index 127846a..5c3868c 100644
--- a/src/expect/api.c
+++ b/src/expect/api.c
@@ -43,6 +43,35 @@ void nfexp_destroy(struct nf_expect *exp)
}
/**
+ * nfexp_sizeof - return the size in bytes of a certain expect object
+ * @exp: pointer to the expect object
+ */
+size_t nfexp_sizeof(const struct nf_expect *exp)
+{
+ assert(exp != NULL);
+ return sizeof(*exp);
+}
+
+/**
+ * nfexp_maxsize - return the maximum size in bytes of a expect object
+ *
+ * Use this function if you want to allocate a expect object in the stack
+ * instead of the heap. For example:
+ *
+ * char buf[nfexp_maxsize()];
+ * struct nf_expect *exp = (struct nf_expect *) buf;
+ * memset(exp, 0, nfexp_maxsize());
+ *
+ * Note: As for now this function returns the same size that nfexp_sizeof(exp)
+ * does although _this could change in the future_. Therefore, do not assume
+ * that nfexp_sizeof(exp) == nfexp_maxsize().
+ */
+size_t nfexp_maxsize()
+{
+ return sizeof(struct nf_expect);
+}
+
+/**
* nfexp_clone - clone a expectation object
* @exp: pointer to a valid expectation object
*