loci: add a function to parse messages without allocating memory

Reviewer: @wilmo119

This will be used by the Indigo connection manager to parse messages directly 
from the read buffer, saving three allocations and a memcpy.