Exemplo n.º 1
0
 def handle_header(self, buf):
     """Takes a buffer and readers information from header.
     
     Returns a tuple (pktsize, pktnr)
     """
     pktsize = utils.int3read(buf[0:3])
     pktnr = utils.int1read(buf[3])
     
     return (pktsize, pktnr)
Exemplo n.º 2
0
    def is_valid(self, buf=None):
        if buf is None:
            buf = self.data

        (l, n) = (buf[0:3], buf[3])
        hlength = utils.int3read(l)
        rlength = len(buf) - 4

        if hlength != rlength:
            return False

        res = self._is_valid_extra(buf)
        if res != None:
            return res

        return True