This makes callback registration completely thread safe.
This patch also uses templates and macros to dramatically reduce the amount of
manual boilerplate.
Makes configuration easier when you can associate the items with a name
instead of just a port number. Important if there is a GUI added at some
point.
The old headers were moved into folders because doing so avoids polluting
the system include directories.
Folder names were also normalized to lowercase.