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

ofp-parse: Generalize parse_ofp_add_flow_str() as parse_ofp_flow_mod_str().

This generalization allows us to delete several lines of code from
ovs-ofctl.c.
This commit is contained in:
Ben Pfaff
2010-11-11 11:01:09 -08:00
parent 06da29ee25
commit 049c8dc212
3 changed files with 13 additions and 66 deletions

View File

@@ -519,10 +519,10 @@ parse_ofp_str(char *string, struct ofp_match *match, struct ofpbuf *actions,
}
}
/* Parses 'string' as a OFPT_FLOW_MOD with subtype OFPFC_ADD and returns an
* ofpbuf that contains it. */
/* Parses 'string' as an OFPT_FLOW_MOD with command 'command' (one of OFPFC_*)
* and returns an ofpbuf that contains it. */
struct ofpbuf *
parse_ofp_add_flow_str(char *string)
parse_ofp_flow_mod_str(char *string, uint16_t command)
{
struct ofpbuf *buffer;
struct ofp_flow_mod *ofm;
@@ -538,10 +538,10 @@ parse_ofp_add_flow_str(char *string)
&cookie);
ofm = buffer->data;
ofm->match = match;
ofm->command = htons(OFPFC_ADD);
ofm->cookie = htonll(cookie);
ofm->idle_timeout = htons(idle_timeout);
ofm->hard_timeout = htons(hard_timeout);
ofm->command = htons(command);
ofm->buffer_id = htonl(UINT32_MAX);
ofm->priority = htons(priority);
update_openflow_length(buffer);
@@ -573,7 +573,7 @@ parse_ofp_add_flow_file(FILE *stream)
continue;
}
b = parse_ofp_add_flow_str(line);
b = parse_ofp_flow_mod_str(line, OFPFC_ADD);
break;
}
ds_destroy(&s);