def tcp_traceflow(packet):
if '<STR_LIT>' in packet:<EOL><INDENT>ip = packet.ip if '<STR_LIT>' in packet else packet.ipv6<EOL>tcp = packet.tcp<EOL>data = dict(<EOL>protocol=LINKTYPE.get(packet.layers[<NUM_LIT:0>].layer_name.upper()),     <EOL>index=int(packet.number),                                       <EOL>frame=packet2dict(packet),                                      <EOL>syn=bool(int(tcp.flags_syn)),                                   <EOL>fin=bool(int(tcp.flags_fin)),                                   <EOL>src=ipaddress.ip_address(ip.src),                               <EOL>dst=ipaddress.ip_address(ip.dst),                               <EOL>srcport=int(tcp.srcport),                                       <EOL>dstport=int(tcp.dstport),                                       <EOL>timestamp=packet.frame_info.time_epoch,                         <EOL>)<EOL>return True, data<EOL><DEDENT>return False, None<EOL>
Trace packet flow for TCP.