xref: /xnu-11215/bsd/dev/dtrace/scripts/socket.d (revision 186b8fce)
1*186b8fceSApple OSS Distributions /*
2*186b8fceSApple OSS Distributions  * Copyright (c) 2013 Apple Computer, Inc.  All Rights Reserved.
3*186b8fceSApple OSS Distributions  *
4*186b8fceSApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*186b8fceSApple OSS Distributions  *
6*186b8fceSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*186b8fceSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*186b8fceSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*186b8fceSApple OSS Distributions  * compliance with the License. Please obtain a copy of the License at
10*186b8fceSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this
11*186b8fceSApple OSS Distributions  * file.
12*186b8fceSApple OSS Distributions  *
13*186b8fceSApple OSS Distributions  * The Original Code and all software distributed under the License are
14*186b8fceSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15*186b8fceSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16*186b8fceSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17*186b8fceSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18*186b8fceSApple OSS Distributions  * Please see the License for the specific language governing rights and
19*186b8fceSApple OSS Distributions  * limitations under the License.
20*186b8fceSApple OSS Distributions  *
21*186b8fceSApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
22*186b8fceSApple OSS Distributions  */
23*186b8fceSApple OSS Distributions 
24*186b8fceSApple OSS Distributions #pragma D depends_on library darwin.d
25*186b8fceSApple OSS Distributions #pragma D depends_on module mach_kernel
26*186b8fceSApple OSS Distributions 
27*186b8fceSApple OSS Distributions typedef struct socketbuf {
28*186b8fceSApple OSS Distributions 	uint32_t	cc;
29*186b8fceSApple OSS Distributions 	uint32_t	hiwat;
30*186b8fceSApple OSS Distributions 	uint32_t	lowat;
31*186b8fceSApple OSS Distributions 	uint32_t	mbcnt;
32*186b8fceSApple OSS Distributions 	uint32_t	mbmax;
33*186b8fceSApple OSS Distributions 	uint32_t	flags;
34*186b8fceSApple OSS Distributions 	struct sockbuf	*sockbuf;
35*186b8fceSApple OSS Distributions } socketbuf_t;
36*186b8fceSApple OSS Distributions 
37*186b8fceSApple OSS Distributions translator socketbuf_t < struct sockbuf *T > {
38*186b8fceSApple OSS Distributions 	cc	= T->sb_cc;
39*186b8fceSApple OSS Distributions 	hiwat	= T->sb_hiwat;
40*186b8fceSApple OSS Distributions 	lowat	= T->sb_lowat;
41*186b8fceSApple OSS Distributions 	mbcnt	= T->sb_mbcnt;
42*186b8fceSApple OSS Distributions 	mbmax	= T->sb_mbmax;
43*186b8fceSApple OSS Distributions 	flags	= T->sb_flags;
44*186b8fceSApple OSS Distributions 	sockbuf = T;
45*186b8fceSApple OSS Distributions };
46*186b8fceSApple OSS Distributions 
47*186b8fceSApple OSS Distributions typedef struct socketinfo {
48*186b8fceSApple OSS Distributions 	int		zone;
49*186b8fceSApple OSS Distributions 	short		type;
50*186b8fceSApple OSS Distributions 	uint32_t	options;
51*186b8fceSApple OSS Distributions 	short		linger;
52*186b8fceSApple OSS Distributions 	short		state;
53*186b8fceSApple OSS Distributions 	short		qlen;
54*186b8fceSApple OSS Distributions 	short		incqlen;
55*186b8fceSApple OSS Distributions 	short		qlimit;
56*186b8fceSApple OSS Distributions 	short		error;
57*186b8fceSApple OSS Distributions 	uint32_t	flags;
58*186b8fceSApple OSS Distributions 	int		traffic_class;
59*186b8fceSApple OSS Distributions 	struct socket	*socket;
60*186b8fceSApple OSS Distributions } socketinfo_t;
61*186b8fceSApple OSS Distributions 
62*186b8fceSApple OSS Distributions translator socketinfo_t < struct socket *T > {
63*186b8fceSApple OSS Distributions 	zone		= T->so_zone;
64*186b8fceSApple OSS Distributions 	type		= T->so_type;
65*186b8fceSApple OSS Distributions 	options		= T->so_options;
66*186b8fceSApple OSS Distributions 	linger		= T->so_linger;
67*186b8fceSApple OSS Distributions 	state		= T->so_state;
68*186b8fceSApple OSS Distributions 	qlen		= T->so_qlen;
69*186b8fceSApple OSS Distributions 	incqlen		= T->so_incqlen;
70*186b8fceSApple OSS Distributions 	qlimit		= T->so_qlimit;
71*186b8fceSApple OSS Distributions 	error		= T->so_error;
72*186b8fceSApple OSS Distributions 	flags		= T->so_flags;
73*186b8fceSApple OSS Distributions 	traffic_class	= T->so_traffic_class;
74*186b8fceSApple OSS Distributions 	socket		= T;
75*186b8fceSApple OSS Distributions };
76*186b8fceSApple OSS Distributions 
77*186b8fceSApple OSS Distributions 
78