def recalculate_checksums(self, flags=<NUM_LIT:0>):
buff, buff_ = self.__to_buffers()<EOL>num = windivert_dll.WinDivertHelperCalcChecksums(ctypes.byref(buff_), len(self.raw), flags)<EOL>if PY2:<EOL><INDENT>self.raw = memoryview(buff)[:len(self.raw)]<EOL><DEDENT>return num<EOL>
(Re)calculates the checksum for any IPv4/ICMP/ICMPv6/TCP/UDP checksum present in the given packet.
Individual checksum calculations may be disabled via the appropriate flag.
Typically this function should be invoked on a modified packet before it is injected with WinDivert.send().
Returns the number of checksums calculated.

See: https://reqrypt.org/windivert-doc.html#divert_helper_calc_checksums