From: Ben Pfaff Date: Fri, 18 Mar 2011 21:41:22 +0000 (-0700) Subject: ofp-parse: Generalize parse_ofp_add_flow_file() to parse_ofp_flow_mod_file(). X-Git-Tag: v1.1.0~108 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=02c5617b60e6dbd729c529629488bb7f812ca3d9;p=sliver-openvswitch.git ofp-parse: Generalize parse_ofp_add_flow_file() to parse_ofp_flow_mod_file(). An upcoming commit will want to pass a different command. --- diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 1c69d880b..de7cd9c72 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -871,8 +871,8 @@ parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur_format, * 'stream' and the command is always OFPFC_ADD. Returns false if end-of-file * is reached before reading a flow, otherwise true. */ bool -parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur, - FILE *stream) +parse_ofp_flow_mod_file(struct list *packets, enum nx_flow_format *cur, + FILE *stream, uint16_t command) { struct ds s; bool ok; @@ -880,7 +880,7 @@ parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur, ds_init(&s); ok = ds_get_preprocessed_line(&s, stream) == 0; if (ok) { - parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), OFPFC_ADD); + parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), command); } ds_destroy(&s); diff --git a/lib/ofp-parse.h b/lib/ofp-parse.h index 3132f16c1..c8cdade1f 100644 --- a/lib/ofp-parse.h +++ b/lib/ofp-parse.h @@ -34,8 +34,8 @@ void parse_ofp_str(struct flow_mod *, uint8_t *table_idx, void parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur, char *string, uint16_t command); -bool parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur, - FILE *); +bool parse_ofp_flow_mod_file(struct list *packets, enum nx_flow_format *cur, + FILE *, uint16_t command); void parse_ofp_flow_stats_request_str(struct flow_stats_request *, bool aggregate, char *string); diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index f5e501437..af9e11f0d 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -269,7 +269,8 @@ read_flow_file(const char *name) } flow_format = NXFF_OPENFLOW10; - while (parse_ofp_add_flow_file(&default_flows, &flow_format, stream)) { + while (parse_ofp_flow_mod_file(&default_flows, &flow_format, stream, + OFPFC_ADD)) { continue; } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index e7997c61e..6c476951b 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -674,7 +674,7 @@ do_add_flows(int argc OVS_UNUSED, char *argv[]) flow_format = set_initial_format_for_flow_mod(&requests); open_vconn(argv[1], &vconn); - while (parse_ofp_add_flow_file(&requests, &flow_format, file)) { + while (parse_ofp_flow_mod_file(&requests, &flow_format, file, OFPFC_ADD)) { check_final_format_for_flow_mod(flow_format); transact_multiple_noreply(vconn, &requests); } @@ -1339,7 +1339,7 @@ do_parse_flows(int argc OVS_UNUSED, char *argv[]) } list_init(&packets); - while (parse_ofp_add_flow_file(&packets, &flow_format, file)) { + while (parse_ofp_flow_mod_file(&packets, &flow_format, file, OFPFC_ADD)) { print_packet_list(&packets); } fclose(file);