コード例 #1
0
ファイル: phy.py プロジェクト: reidlindsay/wins
    def seterror(self, p):
        """Convenience method to set error annotation (or parameters) in `p`.

        :return: Modified packet with updated parameters/annotations.

        By default, if packet `p` has a `CRC32` layer, this method will set the
        'crcerror' field, otherwise this method will set the 'crcerror'
        annotation to 1.

        **Overload this method as needed.**
        """
        hascrc = CRC32.supported(p)
        hasanno = ANNO.supported(p)
        if hascrc:
            p[CRC32].crcerror = 1
        elif hasanno:
            p.setanno('crcerror', 1)
        else:
            raise RuntimeError, "[PHY]: seterror() failed to find packet!"