コード例 #1
0
ファイル: inquiry.py プロジェクト: tubbytani/python-rdma
def decode_link(o, bytes):
    """Assume bytes starts with the LRH and parse accordingly. Returns bytes
       starting at the MAD header"""
    lhdr = IBA.HdrLRH(bytes)
    off = 8
    if o.verbosity >= 1:
        lhdr.printer(sys.stdout)
    if lhdr.LNH & 1 == 1:
        ghdr = IBA.HdrGRH(bytes[off:])
        if o.verbosity >= 1:
            ghdr.printer(sys.stdout)
        off = off + 40
    bth = IBA.HdrBTH(bytes[off:])
    if o.verbosity >= 1:
        bth.printer(sys.stdout)
    off = off + 12
    if bth.service == 3 and bth.function == 4:
        deth = IBA.HdrDETH(bytes[off:])
        if o.verbosity >= 1:
            deth.printer(sys.stdout)
        off = off + 8
    return bytes[off:]