def createFields(self): yield UInt16(self, "hw_type") yield UInt16(self, "proto_type") yield UInt8(self, "hw_size") yield UInt8(self, "proto_size") yield Enum(UInt16(self, "opcode"), ARP.opcode_name) yield MAC48_Address(self, "src_mac") yield IPv4_Address(self, "src_ip") yield MAC48_Address(self, "dst_mac") yield IPv4_Address(self, "dst_ip")
def createFields(self): if self.version == 1: yield TimestampUUID60(self, "time") yield Enum(Bits(self, "version", 4), self.VERSION_NAME) yield Enum(Bits(self, "variant", 3), self.VARIANT_NAME) yield textHandler(Bits(self, "clock", 13), hexadecimal) # yield textHandler(Bits(self, "clock", 16), hexadecimal) if self.version == 1: yield MAC48_Address(self, "mac", "IEEE 802 MAC address") else: yield Bytes(self, "node", 6) else: namea, nameb = self.FIELD_NAMES.get(self.version, ("data_a", "data_b")) yield textHandler(Bits(self, namea, 60), hexadecimal) yield Enum(Bits(self, "version", 4), self.VERSION_NAME) yield Enum(Bits(self, "variant", 3), self.VARIANT_NAME) yield textHandler(Bits(self, nameb, 61), hexadecimal)
def createFields(self): yield MAC48_Address(self, "dst") yield MAC48_Address(self, "src") yield Enum(UInt16(self, "protocol"), self.PROTO_DESC)