]> git.ipfire.org Git - thirdparty/lldpd.git/commit - src/lib/atoms/mgmt.c
lib/atom-private.c: break it into smaller modules
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Tue, 31 Mar 2015 10:40:52 +0000 (13:40 +0300)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Thu, 2 Apr 2015 07:14:13 +0000 (10:14 +0300)
commit94c9815776ccb2033ba9d393e14888a4a35eadb9
tree5eaaee7b7dbc970b5d448df11216e60ebfa28aa4
parent9bec20443e7eb301b204308d1a11fe4b3e7c5bba
lib/atom-private.c: break it into smaller modules

This is a huge commit, but 90%+ of it is just splitting
'lib/atom-private.c' into smaller atoms and putting them
into the 'lib/atoms' folder.

Some glue code has been added, for constructing maps and builders.

For the 'struct atom_builder' type a 'nextb' field has been
appended at the end, to help make it a single-linked list of
'struct atom_builders's.
The 'next' field in 'struct atom_builder' is taken (hence 'nextb').

For the maps, a wrapper struct (called 'struct atom_map')
has been added on top of 'lldpctl_map_t' in order to create
single-linked list construct of maps.
The struct looks like:
    struct atom_map {
        int key;             /* lldpctl_key_t equivalent */
        struct atom_map *next; /* next 'struct atom_map' */
        lldpctl_map_t map[]; /* has to be at the end to
                                to be statically init-ed */
    }
The point of this is to register them at load-time so
that 'lldpctl_key_get_map()' can return them.

Each file in 'lib/atoms' registers it's own 'struct atom_builder's
and 'struct atom_map's.

The whole point of this is to be able to add a 'custom' and/or
'custom_list' atom(s) to be able to configure/broadcast other TLVs
in the future.
This mechanism is extensible to add other TLVs defined by
future standards.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
12 files changed:
src/lib/Makefile.am
src/lib/atom-private.c
src/lib/atoms/config.c [new file with mode: 0644]
src/lib/atoms/dot1.c [new file with mode: 0644]
src/lib/atoms/dot3.c [new file with mode: 0644]
src/lib/atoms/interface.c [new file with mode: 0644]
src/lib/atoms/med.c [new file with mode: 0644]
src/lib/atoms/mgmt.c [new file with mode: 0644]
src/lib/atoms/port.c [new file with mode: 0644]
src/lib/helpers.c [new file with mode: 0644]
src/lib/helpers.h [new file with mode: 0644]
src/lib/private.h