ofp-util: Rewrite async config encoding and decoding to be table-driven.
authorBen Pfaff <blp@ovn.org>
Wed, 20 Jan 2016 17:46:09 +0000 (09:46 -0800)
committerBen Pfaff <blp@ovn.org>
Wed, 20 Jan 2016 17:46:11 +0000 (09:46 -0800)
commit8fd0bb602e49bff8b5b6db594083572bb5604025
treebfe53e6100f48f1e0424bdb232d98822c3a9a1c4
parenta930d4c5a46e8d0e5aaf3bd83161e54db10275f1
ofp-util: Rewrite async config encoding and decoding to be table-driven.

The encoding and decoding of the OpenFlow and Open vSwitch async config
messages was, until now, a collection of disjoint code that had a lot of
redundancy.  This commit changes it all to be driven using a single central
table.

This rewrite fixes a bug in the OF1.4+ version of the code, which until
now assumed that every TLV in an OF1.4+ asynchronous configuration message
was exactly 8 bytes long, and reported an error if any was a different
length.  This invariant is true of all the standard TLVs already defined,
but it won't be true of any experimenter TLVs (and won't necessarily be
true of any new standard TLVs), so this commit changes it to be more
tolerant.

The OFPACPT_* constants are no longer useful (they are encoded directly
in the table and do not need to be anywhere else), so this removes them.

This commit also adds support for experimenter async config messages.
We don't have any yet but an upcoming commit will add one.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
include/openflow/openflow-1.4.h
lib/ofp-print.c
lib/ofp-util.c
lib/ofp-util.h
tests/ofp-print.at