From cfc2314156eaf0bb29862570ef30d5ddfa38982e Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Thu, 9 Aug 2012 17:49:26 +0900 Subject: [PATCH] ofp-msgs: Split OFPRAW_OFPST_FLOW_{REQUEST,REPLY} Split OFPRAW_OFPST_FLOW_{REQUEST,REPLY} into OpenFlow 1.0 and 1.1+ versions. This is in preparation for adding encoding and decoding of Open Flow 1.1 & 1.2 messages. Signed-off-by: Simon Horman Signed-off-by: Ben Pfaff --- lib/ofp-msgs.h | 14 ++++++++++---- lib/ofp-util.c | 10 +++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h index 0683bc5e..7e7b21b6 100644 --- a/lib/ofp-msgs.h +++ b/lib/ofp-msgs.h @@ -180,12 +180,16 @@ enum ofpraw { OFPRAW_OFPST_DESC_REPLY, /* OFPST 1.0 (1): struct ofp10_flow_stats_request. */ - OFPRAW_OFPST_FLOW_REQUEST, + OFPRAW_OFPST10_FLOW_REQUEST, + /* OFPST 1.1+ (1): struct ofp11_flow_stats_request, uint8_t[8][]. */ + OFPRAW_OFPST11_FLOW_REQUEST, /* NXST 1.0 (0): struct nx_flow_stats_request, uint8_t[8][]. */ OFPRAW_NXST_FLOW_REQUEST, /* OFPST 1.0 (1): uint8_t[]. */ - OFPRAW_OFPST_FLOW_REPLY, + OFPRAW_OFPST10_FLOW_REPLY, + /* OFPST 1.1+ (1): uint8_t[]. */ + OFPRAW_OFPST11_FLOW_REPLY, /* NXST 1.0 (0): uint8_t[]. */ OFPRAW_NXST_FLOW_REPLY, @@ -357,9 +361,11 @@ enum ofptype { /* Statistics. */ OFPTYPE_DESC_STATS_REQUEST, /* OFPRAW_OFPST_DESC_REQUEST. */ OFPTYPE_DESC_STATS_REPLY, /* OFPRAW_OFPST_DESC_REPLY. */ - OFPTYPE_FLOW_STATS_REQUEST, /* OFPRAW_OFPST_FLOW_REQUEST. + OFPTYPE_FLOW_STATS_REQUEST, /* OFPRAW_OFPST10_FLOW_REQUEST. + * OFPRAW_OFPST11_FLOW_REQUEST. * OFPRAW_NXST_FLOW_REQUEST. */ - OFPTYPE_FLOW_STATS_REPLY, /* OFPRAW_OFPST_FLOW_REPLY. + OFPTYPE_FLOW_STATS_REPLY, /* OFPRAW_OFPST10_FLOW_REPLY. + * OFPRAW_OFPST11_FLOW_REPLY. * OFPRAW_NXST_FLOW_REPLY. */ OFPTYPE_AGGREGATE_STATS_REQUEST, /* OFPRAW_OFPST_AGGREGATE_REQUEST. * OFPRAW_NXST_AGGREGATE_REQUEST. */ diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 14f1c0d6..0cf48e65 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1453,7 +1453,7 @@ ofputil_decode_flow_stats_request(struct ofputil_flow_stats_request *fsr, ofpbuf_use_const(&b, oh, ntohs(oh->length)); raw = ofpraw_pull_assert(&b); switch ((int) raw) { - case OFPRAW_OFPST_FLOW_REQUEST: + case OFPRAW_OFPST10_FLOW_REQUEST: return ofputil_decode_ofpst_flow_request(fsr, b.data, false); case OFPRAW_OFPST_AGGREGATE_REQUEST: @@ -1487,7 +1487,7 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr, raw = (fsr->aggregate ? OFPRAW_OFPST_AGGREGATE_REQUEST - : OFPRAW_OFPST_FLOW_REQUEST); + : OFPRAW_OFPST11_FLOW_REQUEST); msg = ofpraw_alloc(raw, OFP12_VERSION, NXM_TYPICAL_LEN); ofsr = ofpbuf_put_zeros(msg, sizeof *ofsr); ofsr->table_id = fsr->table_id; @@ -1505,7 +1505,7 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr, raw = (fsr->aggregate ? OFPRAW_OFPST_AGGREGATE_REQUEST - : OFPRAW_OFPST_FLOW_REQUEST); + : OFPRAW_OFPST10_FLOW_REQUEST); msg = ofpraw_alloc(raw, OFP10_VERSION, 0); ofsr = ofpbuf_put_zeros(msg, sizeof *ofsr); ofputil_cls_rule_to_ofp10_match(&fsr->match, &ofsr->match); @@ -1596,7 +1596,7 @@ ofputil_decode_flow_stats_reply(struct ofputil_flow_stats *fs, if (!msg->size) { return EOF; - } else if (raw == OFPRAW_OFPST_FLOW_REPLY) { + } else if (raw == OFPRAW_OFPST10_FLOW_REPLY) { const struct ofp10_flow_stats *ofs; size_t length; @@ -1708,7 +1708,7 @@ ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *fs, enum ofpraw raw; ofpraw_decode_partial(&raw, reply->data, reply->size); - if (raw == OFPRAW_OFPST_FLOW_REPLY) { + if (raw == OFPRAW_OFPST10_FLOW_REPLY) { struct ofp10_flow_stats *ofs; ofpbuf_put_uninit(reply, sizeof *ofs); -- 2.30.2