tcpclientsrc, tcpserversrc: fix tcp stats gathering
Fix-up after commit e56b7841. Unclear how that could ever have worked. Code only built because basically everything was disabled due to the missing config.h include.
- Include config.h so that HAVE_* defines are available.
- Fix missing variable declarations that somehow disappeared when moving the stats gathering code block into a separate function in a new file.
- Fix structure variable modified to match name in new function.