summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-02-29 20:37:31 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-03-01 01:34:52 +0100
commit4502e1d247473699d20d978344a09d9558ebfd47 (patch)
tree8998a8bff3d21562851d7d5269d5ccd0cc2f8547 /src
parent92233639e39aa8b8fce4ca0a4a26f574a6feb7ae (diff)
add nfct_timeout_policy_attr_to_name(state_attr)
This function returns the state name as string by taking the state attribute as parameter. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/libnetfilter_cttimeout.c17
-rw-r--r--src/libnetfilter_cttimeout.map1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/libnetfilter_cttimeout.c b/src/libnetfilter_cttimeout.c
index c7060ff..2016e96 100644
--- a/src/libnetfilter_cttimeout.c
+++ b/src/libnetfilter_cttimeout.c
@@ -282,6 +282,23 @@ void nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type)
}
EXPORT_SYMBOL(nfct_timeout_policy_attr_unset);
+const char *nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state)
+{
+ if (timeout_protocol[l4proto].state_to_name == NULL) {
+ printf("no array state name\n");
+ return NULL;
+ }
+
+ if (timeout_protocol[l4proto].state_to_name[state] == NULL) {
+ printf("state %d does not exists\n", state);
+ return NULL;
+ }
+
+ return timeout_protocol[l4proto].state_to_name[state];
+}
+EXPORT_SYMBOL(nfct_timeout_policy_attr_to_name);
+
+
/**
* nfct_timeout_snprintf - print conntrack timeout object into one buffer
* \param buf: pointer to buffer that is used to print the object
diff --git a/src/libnetfilter_cttimeout.map b/src/libnetfilter_cttimeout.map
index a4417cc..788b7f2 100644
--- a/src/libnetfilter_cttimeout.map
+++ b/src/libnetfilter_cttimeout.map
@@ -8,6 +8,7 @@ global:
nfct_timeout_attr_unset;
nfct_timeout_policy_attr_set_u32;
nfct_timeout_policy_unset;
+ nfct_timeout_policy_attr_to_name;
nfct_timeout_nlmsg_build_hdr;
nfct_timeout_nlmsg_build_payload;
nfct_timeout_nlmsg_parse_payload;