Factor out hdlc context, add some documentation.