xref: /freebsd/sys/netinet/in_kdtrace.c (revision 3a92d97ff0f22d21608e1c19b83104c4937523b6)
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_DEFINE6_XLATE(tcp, , , state__change,
106     "void *", "void *",
107     "struct tcpcb *", "csinfo_t *",
108     "void *", "void *",
109     "struct tcpcb *", "tcpsinfo_t *",
110     "void *", "void *",
111     "int", "tcplsinfo_t *");
112 
113 SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
114     "void *", "pktinfo_t *",
115     "struct inpcb *", "csinfo_t *",
116     "uint8_t *", "ipinfo_t *",
117     "struct inpcb *", "udpsinfo_t *",
118     "struct udphdr *", "udpinfo_t *");
119 
120 SDT_PROBE_DEFINE5_XLATE(udp, , , send,
121     "void *", "pktinfo_t *",
122     "struct inpcb *", "csinfo_t *",
123     "uint8_t *", "ipinfo_t *",
124     "struct inpcb *", "udpsinfo_t *",
125     "struct udphdr *", "udpinfo_t *");
126