mirror of
https://github.com/samba-team/samba.git
synced 2025-07-29 15:42:04 +03:00
traffic: split is_a_real_packet() function out of class
So we can use it to determine whether a packet should be a Packet before making the leap. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Douglas Bagnall
parent
24d09d1df8
commit
e866782a15
@ -297,25 +297,29 @@ class Packet(object):
|
||||
return self.timestamp - other.timestamp
|
||||
|
||||
def is_really_a_packet(self, missing_packet_stats=None):
|
||||
"""Is the packet one that can be ignored?
|
||||
return is_a_real_packet(self.protocol, self.opcode)
|
||||
|
||||
If so removing it will have no effect on the replay
|
||||
"""
|
||||
if self.protocol in SKIPPED_PROTOCOLS:
|
||||
# Ignore any packets for the protocols we're not interested in.
|
||||
return False
|
||||
if self.protocol == "ldap" and self.opcode == '':
|
||||
# skip ldap continuation packets
|
||||
return False
|
||||
|
||||
fn_name = 'packet_%s_%s' % (self.protocol, self.opcode)
|
||||
fn = getattr(traffic_packets, fn_name, None)
|
||||
if not fn:
|
||||
print("missing packet %s" % fn_name, file=sys.stderr)
|
||||
return False
|
||||
if fn is traffic_packets.null_packet:
|
||||
return False
|
||||
return True
|
||||
def is_a_real_packet(protocol, opcode):
|
||||
"""Is the packet one that can be ignored?
|
||||
|
||||
If so removing it will have no effect on the replay
|
||||
"""
|
||||
if protocol in SKIPPED_PROTOCOLS:
|
||||
# Ignore any packets for the protocols we're not interested in.
|
||||
return False
|
||||
if protocol == "ldap" and opcode == '':
|
||||
# skip ldap continuation packets
|
||||
return False
|
||||
|
||||
fn_name = 'packet_%s_%s' % (protocol, opcode)
|
||||
fn = getattr(traffic_packets, fn_name, None)
|
||||
if fn is None:
|
||||
LOGGER.debug("missing packet %s" % fn_name, file=sys.stderr)
|
||||
return False
|
||||
if fn is traffic_packets.null_packet:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ReplayContext(object):
|
||||
|
Reference in New Issue
Block a user