From a6159a233e5e9aad04278bffa54ad8cc29ded1f8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 15 Mar 2011 14:56:09 -0700 Subject: [PATCH] ofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next() Nothing uses these anymore. ofputil_decode_flow_stats_reply() is a better alternative. --- lib/ofp-util.c | 45 --------------------------------------------- lib/ofp-util.h | 7 ------- 2 files changed, 52 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index d91fbb11..cc448bcd 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1876,51 +1876,6 @@ hton_ofp_phy_port(struct ofp_phy_port *opp) opp->peer = htonl(opp->peer); } -const struct ofp_flow_stats * -flow_stats_first(struct flow_stats_iterator *iter, - const struct ofp_stats_reply *osr) -{ - iter->pos = osr->body; - iter->end = osr->body + (ntohs(osr->header.length) - - offsetof(struct ofp_stats_reply, body)); - return flow_stats_next(iter); -} - -const struct ofp_flow_stats * -flow_stats_next(struct flow_stats_iterator *iter) -{ - ptrdiff_t bytes_left = iter->end - iter->pos; - const struct ofp_flow_stats *fs; - size_t length; - - if (bytes_left < sizeof *fs) { - if (bytes_left != 0) { - VLOG_WARN_RL(&bad_ofmsg_rl, - "%td leftover bytes in flow stats reply", bytes_left); - } - return NULL; - } - - fs = (const void *) iter->pos; - length = ntohs(fs->length); - if (length < sizeof *fs) { - VLOG_WARN_RL(&bad_ofmsg_rl, "flow stats length %zu is shorter than " - "min %zu", length, sizeof *fs); - return NULL; - } else if (length > bytes_left) { - VLOG_WARN_RL(&bad_ofmsg_rl, "flow stats length %zu but only %td " - "bytes left", length, bytes_left); - return NULL; - } else if ((length - sizeof *fs) % sizeof fs->actions[0]) { - VLOG_WARN_RL(&bad_ofmsg_rl, "flow stats length %zu has %zu bytes " - "left over in final action", length, - (length - sizeof *fs) % sizeof fs->actions[0]); - return NULL; - } - iter->pos += length; - return fs; -} - static int check_action_exact_len(const union ofp_action *a, unsigned int len, unsigned int required_len) diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 75e76e24..fdeb9d9e 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -258,13 +258,6 @@ struct ofpbuf *make_echo_request(void); struct ofpbuf *make_echo_reply(const struct ofp_header *rq); void hton_ofp_phy_port(struct ofp_phy_port *); - -struct flow_stats_iterator { - const uint8_t *pos, *end; -}; -const struct ofp_flow_stats *flow_stats_first(struct flow_stats_iterator *, - const struct ofp_stats_reply *); -const struct ofp_flow_stats *flow_stats_next(struct flow_stats_iterator *); /* Actions. */ -- 2.30.2