0

这是我在 Python 中的 ctypes 代码:

class IP(Structure):
_fields_ = [
    ('ip_hl', c_ubyte, 4), 
    ('ip_version', c_ubyte, 4),
    ('tos', c_ubyte),
    ('len', c_ushort),
    ('id', c_ushort),
    ('offset', c_ushort),
    ('ttl', c_ubyte),
    ('protocol_num', c_ubyte),
    ('sum', c_ushort),
    ('src', c_ulong),
    ('dst', c_ulong)
]

众所周知,IP Header 0-3bit 是 Version 而 4-7bit 是 HeaderLength 但为什么在这段代码中 HeaderLength 是在 Version 之前

4

0 回答 0