kemix: functions to get msg buffer and length