From a070b0de9f9e9cbca150eea4eda74757ca588bed Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Wed, 23 Sep 2020 17:50:52 +0200 Subject: [HICN-645] Control plane (WIP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4be6a40b690b62f22f57de6d8c10b01a1be42a6d Signed-off-by: Jordan Augé Signed-off-by: Enrico Loparco (eloparco) Signed-off-by: Mauro Sardara --- lib/src/policy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/src') diff --git a/lib/src/policy.c b/lib/src/policy.c index 694f0ea5e..8f317bc11 100644 --- a/lib/src/policy.c +++ b/lib/src/policy.c @@ -39,6 +39,18 @@ const char * policy_state_str[] = { #undef _ }; +policy_state_t +policy_state_from_str(const char * str) +{ +#define _(x) \ + if (strcasecmp(str, #x) == 0) \ + return POLICY_STATE_ ## x; \ + else + foreach_policy_state +#undef _ + return POLICY_STATE_N; +} + int policy_tag_state_snprintf(char * s, size_t size, const policy_tag_state_t * tag_state) { -- cgit 1.2.3-korg