Implemented the message system for internal messages and external messages.
Added return value constants for p2p functions.