reorganize constant assignments and usage
refactor helpers and constants

* extract function to get a buffer with a constrained integer
* add getKeepaliveInterval function stub
* add descriptive comments and TODO notes