def index(self, pkt_num): """Return datagram index.""" int_check(pkt_num) for counter, datagram in enumerate(self.datagram): if pkt_num in datagram.index: return counter return None
def index(self, pkt_num): """Return datagram index. Arguments: pkt_num (int): index of packet Returns: Optional[int]: reassembled datagram index which was from No. ``pkt_num`` packet; if not found, returns ``None`` """ int_check(pkt_num) for counter, datagram in enumerate(self.datagram): if pkt_num in datagram.index: return counter return None
def analyse(file, length=None): """Analyse application layer packets. Keyword arguments: * file -- bytes or file-like object, packet to be analysed * length -- int, length of the analysing packet Returns: * Analysis -- an Analysis object from `pcapkit.analyser` """ if isinstance(file, bytes): file = io.BytesIO(file) io_check(file) int_check(length or sys.maxsize) return analyse2(file, length)
def analyse(file, length=None): """Analyse application layer packets. Arguments: file (Union[bytes, io.BytesIO]): packet to be analysed length (Optional[int]): length of the analysing packet Returns: Analysis: an :class:`~pcapkit.foundation.analysis.Analysis` object """ if isinstance(file, bytes): file = io.BytesIO(file) io_check(file) int_check(length or sys.maxsize) return analyse2(file, length)