From 74dad307188ab7bbec81416c592ac387c1a6ad4f Mon Sep 17 00:00:00 2001 From: Isaac Lee Date: Mon, 19 Feb 2018 10:03:23 +1300 Subject: [PATCH] Add a function to push flow state to open --- ginetflow.c | 8 ++++++++ ginetflow.h | 1 + 2 files changed, 9 insertions(+) diff --git a/ginetflow.c b/ginetflow.c index 7c7972f..d4a3ca3 100644 --- a/ginetflow.c +++ b/ginetflow.c @@ -1057,3 +1057,11 @@ GInetFlow *g_inet_flow_lookup(GInetFlowTable * table, GInetTuple * tuple) packet.tuple = *tuple; return (GInetFlow *) g_hash_table_lookup(table->table, &packet); } + +void g_inet_flow_establish(GInetFlowTable * table, GInetFlow * flow) +{ + remove_flow_by_expiry(table, flow, flow->lifetime); + flow->state = FLOW_OPEN; + flow->lifetime = G_INET_FLOW_DEFAULT_OPEN_TIMEOUT; + insert_flow_by_expiry(table, flow, flow->lifetime); +} diff --git a/ginetflow.h b/ginetflow.h index 55de9a3..d57f7ba 100644 --- a/ginetflow.h +++ b/ginetflow.h @@ -54,6 +54,7 @@ GInetFlow *g_inet_flow_get_full(GInetFlowTable * table, const guint8 * frame, const uint8_t ** iphr); GInetFlow *g_inet_flow_create(GInetFlowTable * table, GInetTuple * tuple); GInetFlow *g_inet_flow_expire(GInetFlowTable * table, guint64 ts); +void g_inet_flow_establish(GInetFlowTable * table, GInetFlow * flow); /* g_inet_flow_parse will populate result if result is not null, otherwise it will malloc a structure * to return. */