Unified message dispatch function and struct