def choose_data(self,data,offset=None,size=None): if self.type&0x0800: if self.type==0x0800: return IPv4 try: return StringSZ._c(size=self._data_size-self._offsetof("data")) except AttributeError: return StringSZ elif self.type==0x8100: return EtherVlanQ else: return LLC._c(size=int(self.type))
def choose_src_route(self, data, offset=None, size=None): if (data and offset is None) or self.ctrl.src_route: return self.SrcRoute else: return StringSZ._c(size=0)
def choose_src64(self, data, offset=None, size=None): if (data and offset is None) or self.ctrl.ext_src: return Quad else: return StringSZ._c(size=0)
def choose_dst_pan(self, data, offset=None, size=None): if (data and offset is None) or self.ctrl.intra_pan: return Short else: return StringSZ._c(size=0)
def choose_src(self, data, offset=None, size=None): if (data and offset is None) or self.ctrl.src_mode==2: return Short else: return StringSZ._c(size=0)
def choose_data(self, data, offset=None, size=None): if (data and offset is None) or self.ctrl.type.name=="data": return self.dtype else: return StringSZ._c(size=0)