Skip to content

Commit

Permalink
ofp-util: New function ofputil_async_msg_type_to_string().
Browse files Browse the repository at this point in the history
An upcoming commit will add another user.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jan 20, 2016
1 parent e016fb6 commit 2da7974
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
27 changes: 2 additions & 25 deletions lib/ofp-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -2151,31 +2151,8 @@ ofp_print_nxt_set_async_config(struct ds *string,

ds_put_format(string, "\n %s:\n", i == 0 ? "master" : "slave");
for (type = 0; type < OAM_N_TYPES; type++) {
switch (type) {
case OAM_PACKET_IN:
ds_put_cstr(string, " PACKET_IN:");
break;

case OAM_PORT_STATUS:
ds_put_cstr(string, " PORT_STATUS:");
break;

case OAM_FLOW_REMOVED:
ds_put_cstr(string, " FLOW_REMOVED:");
break;

case OAM_ROLE_STATUS:
ds_put_cstr(string, " ROLE_STATUS:");
break;

case OAM_TABLE_STATUS:
ds_put_cstr(string, " TABLE_STATUS:");
break;

case OAM_REQUESTFORWARD:
ds_put_cstr(string, " REQUESTFORWARD:");
break;
}
ds_put_format(string, "%16s:",
ofputil_async_msg_type_to_string(type));

for (j = 0; j < 32; j++) {
if (role[i][type] & (1u << j)) {
Expand Down
17 changes: 17 additions & 0 deletions lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9467,6 +9467,23 @@ ofputil_uninit_tlv_table(struct ovs_list *mappings)
}
}

const char *
ofputil_async_msg_type_to_string(enum ofputil_async_msg_type type)
{
switch (type) {
case OAM_PACKET_IN: return "PACKET_IN";
case OAM_PORT_STATUS: return "PORT_STATUS";
case OAM_FLOW_REMOVED: return "FLOW_REMOVED";
case OAM_ROLE_STATUS: return "ROLE_STATUS";
case OAM_TABLE_STATUS: return "TABLE_STATUS";
case OAM_REQUESTFORWARD: return "REQUESTFORWARD";

case OAM_N_TYPES:
default:
OVS_NOT_REACHED();
}
}

/* Decodes the OpenFlow "set async config" request and "get async config
* reply" message in '*oh' into an abstract form in 'master' and 'slave'.
*
Expand Down
1 change: 1 addition & 0 deletions lib/ofp-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,7 @@ enum ofputil_async_msg_type {
OAM_REQUESTFORWARD, /* OFPT_REQUESTFORWARD. */
OAM_N_TYPES
};
const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type);

enum ofperr ofputil_decode_set_async_config(const struct ofp_header *,
uint32_t master[OAM_N_TYPES],
Expand Down

0 comments on commit 2da7974

Please sign in to comment.