Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def bin(self, update_auto_fields=True):
# padding needs to be placed at the very end
return pypacker.Packet.bin(self, update_auto_fields=update_auto_fields) + self.padding
def __calc_sum(self):
self._sum = 0
self._sum = pypacker.in_cksum(pypacker.Packet.bin(self))
def bin(self, update_auto_fields=True):
"""Custom bin(): handle crc for BTLE."""
return pypacker.Packet.bin(self, update_auto_fields=update_auto_fields) + self.crc
def _update_fields(self):
if self.sum_au_active and self._changed():
# logger.debug(">>> IP: calculating sum")
# reset checksum for recalculation, mark as changed / clear cache
self.sum = 0
# logger.debug(">>> IP: bytes for sum: %s" % self.header_bytes)
self.sum = checksum.in_cksum(pypacker.Packet.bin(self, update_auto_fields=True))
def bin(self, update_auto_fields=True):
return pypacker.Packet.bin(self, update_auto_fields=update_auto_fields) + self.padding
def bin(self):
if self.__needs_checksum_update():
self.__calc_sum()
return pypacker.Packet.bin(self)
def bin(self, update_auto_fields=True):
"""Custom bin(): handle FCS."""
return pypacker.Packet.bin(self, update_auto_fields=update_auto_fields) + self.fcs