very basic refactoring baby steps towards making telxcc a library

as a first step towards making telxcc a library, just order globals together to make it easy to refactor them.
also prepare a header files which library users will use