Added some functions to create/handle middle level protocol packets.