Home | History | Annotate | Download | only in layers

Lines Matching defs:TCP

276                 warning("Malformed TCP option (announced length is %i)" % olen)
510 class TCP(Packet):
511 name = "TCP"
545 if not isinstance(other, TCP):
576 return self.underlayer.sprintf("TCP %IP.src%:%TCP.sport% > %IP.dst%:%TCP.dport% %TCP.flags%")
578 return self.underlayer.sprintf("TCP %IPv6.src%:%TCP.sport% > %IPv6.dst%:%TCP.dport% %TCP.flags%")
580 return self.sprintf("TCP %TCP.sport% > %TCP.dport% %TCP.flags%")
744 class TCPerror(TCP):
745 name = "TCP in ICMP"
747 if not isinstance(other, TCP):
811 bind_layers( IP, TCP, frag=0, proto=6)
1013 # Filter TCP segments which source address is 'ip'
1015 b = (x for x in tmp if IP in x and x[IP].src == ip and TCP in x)
1021 opts = p.getlayer(TCP).options
1073 return self.make_table(lambda s_r: (s_r[0].sprintf("%IP.dst%:{TCP:tcp%ir,TCP.dport%}{UDP:udp%ir,UDP.dport%}{ICMP:ICMP}"),
1075 s_r[1].sprintf("%-15s,IP.src% {TCP:%TCP.flags%}{ICMP:%ir,ICMP.type%}")))
1185 a,b=sr(IP(dst=o.ip)/TCP(dport=[21,22,23,25,80,443]),timeout=2)
1192 txt += r.sprintf("{TCP:%IP.src%:%TCP.sport% %TCP.flags%}{TCPerror:%IPerror.dst%:%TCPerror.dport% %IP.src% %ir,ICMP.type%}\n")
1237 if s.haslayer(TCP) or s.haslayer(UDP):
1303 if TCP in s:
1318 if TCP in r:
1319 p.append(r.sprintf("<T%ir,TCP.sport%> %TCP.sport% %TCP.flags%"))
1320 trace[ttl] = r.sprintf('"%r,src%":T%ir,TCP.sport%')
1348 elif rtk[2] == 6: #TCP
1349 bh = "%s %i/tcp" % (rtk[1],rtk[3])
1464 """Instant TCP traceroute
1470 # we only consider ICMP error packets and TCP packets with at
1473 filter="(icmp and (icmp[0]=3 or icmp[0]=4 or icmp[0]=5 or icmp[0]=11 or icmp[0]=12)) or (tcp and (tcp[13] & 0x16 > 0x10))"
1475 a,b = sr(IP(dst=target, id=RandShort(), ttl=(minttl,maxttl))/TCP(seq=RandInt(),sport=sport, dport=dport),
1491 ## Simple TCP client stack ##
1500 self.l4 = IP(dst=ip)/TCP(sport=self.sport, dport=self.dport, flags=0,
1503 self.swin=self.l4[TCP].window
1519 TCP in pkt and
1520 pkt[TCP].sport == self.dport and
1521 pkt[TCP].dport == self.sport and
1522 self.l4[TCP].seq >= pkt[TCP].ack and # XXX: seq/ack 2^32 wrap up
1523 ((self.l4[TCP].ack == 0) or (self.l4[TCP].ack <= pkt[TCP].seq <= self.l4[TCP].ack+self.swin)) )
1552 self.l4[TCP].flags = "S"
1554 self.l4[TCP].seq += 1
1559 if pkt[TCP].flags & 0x3f == 0x12:
1563 self.l4[TCP].ack = pkt[TCP].seq+1
1564 self.l4[TCP].flags = "A"
1569 if not isinstance(pkt[TCP].payload, NoPayload) and not isinstance(pkt[TCP].payload, conf.padding_layer):
1573 data = raw(pkt[TCP].payload)
1574 if data and self.l4[TCP].ack == pkt[TCP].seq:
1575 self.l4[TCP].ack += len(data)
1576 self.l4[TCP].flags = "A"
1579 if pkt[TCP].flags.P:
1580 self.oi.tcp.send(self.rcvbuf)
1583 @ATMT.ioevent(ESTABLISHED,name="tcp", as_supersocket="tcplink")
1588 self.l4[TCP].flags = "PA"
1590 self.l4[TCP].seq += len(d)
1595 if pkt[TCP].flags & 4 != 0:
1600 if pkt[TCP].flags & 0x1 == 1:
1604 self.l4[TCP].flags = "FA"
1605 self.l4[TCP].ack = pkt[TCP].seq+1
1607 self.l4[TCP].seq += 1
1611 if pkt[TCP].flags & 0x3f == 0x10:
1626 ans,unans = sr(IP(dst=target)/TCP(dport=ports),timeout=5)
1631 rep += r.sprintf("%TCP.sport% & open & SA \\\\\n")
1637 rep += r.sprintf("%TCP.sport% & closed & TCP %TCP.flags% \\\\\n")
1640 rep += i.sprintf("%TCP.dport% & ? & unanswered \\\\\n")
1732 conf.stats_classic_protocols += [TCP,UDP,ICMP]
1733 conf.stats_dot11_protocols += [TCP,UDP,ICMP]