lldp: refactor keeping tlv data and order entries in neighbor GVariant
authorThomas Haller <thaller@redhat.com>
Wed, 16 Mar 2016 17:46:41 +0000 (18:46 +0100)
committerThomas Haller <thaller@redhat.com>
Thu, 17 Mar 2016 14:04:37 +0000 (15:04 +0100)
commit3363d8fd4eaea9f8cad0489e53747f0843b1f555
treef0f667aeb7b436180912303558ef625b04d5dc21
parent191e5ae8a76f998a13ab91e5cf9d273ad1f05a7f
lldp: refactor keeping tlv data and order entries in neighbor GVariant

The fields in the neighbor variant should have a defined order.

Instead of sorting the hash table entries while constructing the
variant in lldp_neighbor_to_variant(), refactor the management of
the TLV attributes.
As we only support known attributes, we can
store them in an array at a known index instead of putting them
in a hash table.
An alternative would be to have explict fields for every known
attribute. That would be even more efficient, but requires more
work when adding new attributes.
src/devices/nm-lldp-listener.c