also dump transmitted message
move around some define directives
accept message larger than MAX_TOTAL_LEN
add macro for message-related length computation
move around some function definition
add more lock