import struct


def extract_oap_header(pkt, index = 0):
    """Extract the OAP transport header from an OAP packet"""
    (ctrl, sid) = struct.unpack('2B', pkt[index:index+2])
    return {'reliable': bool(ctrl & 1),
            'response': bool(ctrl & 2),
            'sync': bool(ctrl & 4),
            'session': int(sid) >> 4,
            'sequence': int(sid & 0x0F)}