#! stap -p4

probe tcp.sendmsg
{
	printf("%s %p %d %d\n", name, sock, family, size)
}
probe tcp.sendmsg.return
{
	printf("%s %d\n", name, size)
}

probe tcp.recvmsg
{
	printf("%s %p %d %d\n", name, sock, size, family)
	printf("%s %s %d %d\n", saddr, daddr, sport, dport)
}
probe tcp.recvmsg.return
{
	printf("%s %d %d\n", name, size, family)
	printf("%s %s %d %d\n", saddr, daddr, sport, dport)
}

probe tcp.disconnect
{
	printf("%s %p %d %d\n", name, sock, family, flags)
	printf("%s %s %d %d\n", saddr, daddr, sport, dport)
}
probe tcp.disconnect.return
{
	printf("%s %d\n", name, ret)
}

probe tcp.ipv4.setsockopt, tcp.ipv6.setsockopt
{
	printf("%s %p %d %d %d(%s) %d\n", name, sock, family, level, optname,
	       optstr, optlen)
}
probe tcp.setsockopt
{
	printf("%s %p %d %d %d(%s) %d\n", name, sock, family, level, optname,
	       optstr, optlen)
}
probe tcp.setsockopt.return
{
	printf("%s %d\n", name, ret)
}

probe tcp.ipv4.receive, tcp.ipv6.receive
{
	printf("%s %p %d\n", name, iphdr, family)
	printf("%s %s %d %d\n", saddr, daddr, sport, dport)
	printf("%d %p %d %d %d %d %d %d\n", protocol, tcphdr, urg,
	       ack, psh, rst, syn, fin)
}
probe tcp.receive
{
	printf("%s %p %d\n", name, iphdr, family)
	printf("%s %s %d %d\n", saddr, daddr, sport, dport)
	printf("%d %p %d %d %d %d %d %d\n", protocol, tcphdr, urg,
	       ack, psh, rst, syn, fin)
}
