xref: /freebsd/sys/netinet/in_kdtrace.c (revision 3e5645b78f476816ca3b5acc28b29bbafbb9c444)
1 /*-
2  * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org>
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in
11  *    the documentation and/or other materials provided with the
12  *    distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
31 
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/sdt.h>
35 
36 SDT_PROVIDER_DEFINE(ip);
37 SDT_PROVIDER_DEFINE(tcp);
38 SDT_PROVIDER_DEFINE(udp);
39 
40 SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
41     "void *", "pktinfo_t *",
42     "void *", "csinfo_t *",
43     "uint8_t *", "ipinfo_t *",
44     "struct ifnet *", "ifinfo_t *",
45     "struct ip *", "ipv4info_t *",
46     "struct ip6_hdr *", "ipv6info_t *");
47 
48 SDT_PROBE_DEFINE6_XLATE(ip, , , send,
49     "void *", "pktinfo_t *",
50     "void *", "csinfo_t *",
51     "uint8_t *", "ipinfo_t *",
52     "struct ifnet *", "ifinfo_t *",
53     "struct ip *", "ipv4info_t *",
54     "struct ip6_hdr *", "ipv6info_t *");
55 
56 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
57     "void *", "pktinfo_t *",
58     "struct tcpcb *", "csinfo_t *",
59     "uint8_t *", "ipinfo_t *",
60     "struct tcpcb *", "tcpsinfo_t *" ,
61     "struct tcphdr *", "tcpinfoh_t *");
62 
63 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
64     "void *", "pktinfo_t *",
65     "struct tcpcb *", "csinfo_t *",
66     "uint8_t *", "ipinfo_t *",
67     "struct tcpcb *", "tcpsinfo_t *" ,
68     "struct tcphdr *", "tcpinfo_t *");
69 
70 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
71     "void *", "pktinfo_t *",
72     "struct tcpcb *", "csinfo_t *",
73     "uint8_t *", "ipinfo_t *",
74     "struct tcpcb *", "tcpsinfo_t *" ,
75     "struct tcphdr *", "tcpinfoh_t *");
76 
77 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
78     "void *", "pktinfo_t *",
79     "struct tcpcb *", "csinfo_t *",
80     "uint8_t *", "ipinfo_t *",
81     "struct tcpcb *", "tcpsinfo_t *" ,
82     "struct tcphdr *", "tcpinfoh_t *");
83 
84 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request,
85     "void *", "pktinfo_t *",
86     "struct tcpcb *", "csinfo_t *",
87     "uint8_t *", "ipinfo_t *",
88     "struct tcpcb *", "tcpsinfo_t *" ,
89     "struct tcphdr *", "tcpinfo_t *");
90 
91 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
92     "void *", "pktinfo_t *",
93     "struct tcpcb *", "csinfo_t *",
94     "uint8_t *", "ipinfo_t *",
95     "struct tcpcb *", "tcpsinfo_t *" ,
96     "struct tcphdr *", "tcpinfoh_t *");
97 
98 SDT_PROBE_DEFINE5_XLATE(tcp, , , send,
99     "void *", "pktinfo_t *",
100     "struct tcpcb *", "csinfo_t *",
101     "uint8_t *", "ipinfo_t *",
102     "struct tcpcb *", "tcpsinfo_t *" ,
103     "struct tcphdr *", "tcpinfo_t *");
104 
105 SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
106     "struct pkt_node *", "siftrinfo_t *");
107 
108 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
109     "void *", "void *",
110     "struct tcpcb *", "csinfo_t *",
111     "void *", "void *",
112     "struct tcpcb *", "tcpsinfo_t *",
113     "void *", "void *",
114     "int", "tcplsinfo_t *");
115 
116 SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
117     "void *", "pktinfo_t *",
118     "struct inpcb *", "csinfo_t *",
119     "uint8_t *", "ipinfo_t *",
120     "struct inpcb *", "udpsinfo_t *",
121     "struct udphdr *", "udpinfo_t *");
122 
123 SDT_PROBE_DEFINE5_XLATE(udp, , , send,
124     "void *", "pktinfo_t *",
125     "struct inpcb *", "csinfo_t *",
126     "uint8_t *", "ipinfo_t *",
127     "struct inpcb *", "udpsinfo_t *",
128     "struct udphdr *", "udpinfo_t *");
129