2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

flow: New function ct_state_from_string().

This will have its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
This commit is contained in:
Ben Pfaff
2017-04-17 16:06:35 -07:00
parent fd6cd1bf9e
commit b02e6cf86a
2 changed files with 17 additions and 2 deletions

View File

@@ -1000,7 +1000,8 @@ flow_get_metadata(const struct flow *flow, struct match *flow_metadata)
}
}
const char *ct_state_to_string(uint32_t state)
const char *
ct_state_to_string(uint32_t state)
{
switch (state) {
#define CS_STATE(ENUM, INDEX, NAME) case CS_##ENUM: return NAME;
@@ -1011,6 +1012,18 @@ const char *ct_state_to_string(uint32_t state)
}
}
uint32_t
ct_state_from_string(const char *s)
{
#define CS_STATE(ENUM, INDEX, NAME) \
if (!strcmp(s, NAME)) { \
return CS_##ENUM; \
}
CS_STATES
#undef CS_STATE
return 0;
}
char *
flow_to_string(const struct flow *flow)
{