xref: /xnu-11417.140.69/bsd/sys/sockio.h (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
1*43a90889SApple OSS Distributions /*
2*43a90889SApple OSS Distributions  * Copyright (c) 2000-2023 Apple Inc. All rights reserved.
3*43a90889SApple OSS Distributions  *
4*43a90889SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*43a90889SApple OSS Distributions  *
6*43a90889SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*43a90889SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*43a90889SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*43a90889SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*43a90889SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*43a90889SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*43a90889SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*43a90889SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*43a90889SApple OSS Distributions  *
15*43a90889SApple OSS Distributions  * Please obtain a copy of the License at
16*43a90889SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*43a90889SApple OSS Distributions  *
18*43a90889SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*43a90889SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*43a90889SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*43a90889SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*43a90889SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*43a90889SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*43a90889SApple OSS Distributions  * limitations under the License.
25*43a90889SApple OSS Distributions  *
26*43a90889SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*43a90889SApple OSS Distributions  */
28*43a90889SApple OSS Distributions /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29*43a90889SApple OSS Distributions /*-
30*43a90889SApple OSS Distributions  * Copyright (c) 1982, 1986, 1990, 1993, 1994
31*43a90889SApple OSS Distributions  *	The Regents of the University of California.  All rights reserved.
32*43a90889SApple OSS Distributions  *
33*43a90889SApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
34*43a90889SApple OSS Distributions  * modification, are permitted provided that the following conditions
35*43a90889SApple OSS Distributions  * are met:
36*43a90889SApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
37*43a90889SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
38*43a90889SApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
39*43a90889SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
40*43a90889SApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
41*43a90889SApple OSS Distributions  * 3. All advertising materials mentioning features or use of this software
42*43a90889SApple OSS Distributions  *    must display the following acknowledgement:
43*43a90889SApple OSS Distributions  *	This product includes software developed by the University of
44*43a90889SApple OSS Distributions  *	California, Berkeley and its contributors.
45*43a90889SApple OSS Distributions  * 4. Neither the name of the University nor the names of its contributors
46*43a90889SApple OSS Distributions  *    may be used to endorse or promote products derived from this software
47*43a90889SApple OSS Distributions  *    without specific prior written permission.
48*43a90889SApple OSS Distributions  *
49*43a90889SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50*43a90889SApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51*43a90889SApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52*43a90889SApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53*43a90889SApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54*43a90889SApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55*43a90889SApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56*43a90889SApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57*43a90889SApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58*43a90889SApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59*43a90889SApple OSS Distributions  * SUCH DAMAGE.
60*43a90889SApple OSS Distributions  *
61*43a90889SApple OSS Distributions  *	@(#)sockio.h	8.1 (Berkeley) 3/28/94
62*43a90889SApple OSS Distributions  */
63*43a90889SApple OSS Distributions 
64*43a90889SApple OSS Distributions #ifndef _SYS_SOCKIO_H_
65*43a90889SApple OSS Distributions #define _SYS_SOCKIO_H_
66*43a90889SApple OSS Distributions 
67*43a90889SApple OSS Distributions #include <sys/appleapiopts.h>
68*43a90889SApple OSS Distributions 
69*43a90889SApple OSS Distributions #ifndef KERNEL_PRIVATE
70*43a90889SApple OSS Distributions #include <net/if.h>
71*43a90889SApple OSS Distributions #endif
72*43a90889SApple OSS Distributions #include <sys/ioccom.h>
73*43a90889SApple OSS Distributions 
74*43a90889SApple OSS Distributions /* Socket ioctl's. */
75*43a90889SApple OSS Distributions #define SIOCSHIWAT       _IOW('s',  0, int)             /* set high watermark */
76*43a90889SApple OSS Distributions #define SIOCGHIWAT       _IOR('s',  1, int)             /* get high watermark */
77*43a90889SApple OSS Distributions #define SIOCSLOWAT       _IOW('s',  2, int)             /* set low watermark */
78*43a90889SApple OSS Distributions #define SIOCGLOWAT       _IOR('s',  3, int)             /* get low watermark */
79*43a90889SApple OSS Distributions #define SIOCATMARK       _IOR('s',  7, int)             /* at oob mark? */
80*43a90889SApple OSS Distributions #define SIOCSPGRP        _IOW('s',  8, int)             /* set process group */
81*43a90889SApple OSS Distributions #define SIOCGPGRP        _IOR('s',  9, int)             /* get process group */
82*43a90889SApple OSS Distributions 
83*43a90889SApple OSS Distributions #define SIOCSIFADDR     _IOW('i', 12, struct ifreq)     /* set ifnet address */
84*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
85*43a90889SApple OSS Distributions /* See sockio_private.h for extended ioctls */
86*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
87*43a90889SApple OSS Distributions #define SIOCSIFDSTADDR   _IOW('i', 14, struct ifreq)    /* set p-p address */
88*43a90889SApple OSS Distributions #define SIOCSIFFLAGS     _IOW('i', 16, struct ifreq)    /* set ifnet flags */
89*43a90889SApple OSS Distributions #define SIOCGIFFLAGS    _IOWR('i', 17, struct ifreq)    /* get ifnet flags */
90*43a90889SApple OSS Distributions #define SIOCSIFBRDADDR   _IOW('i', 19, struct ifreq)    /* set broadcast addr */
91*43a90889SApple OSS Distributions #define SIOCSIFNETMASK   _IOW('i', 22, struct ifreq)    /* set net addr mask */
92*43a90889SApple OSS Distributions #define SIOCGIFMETRIC   _IOWR('i', 23, struct ifreq)    /* get IF metric */
93*43a90889SApple OSS Distributions #define SIOCSIFMETRIC   _IOW('i', 24, struct ifreq)     /* set IF metric */
94*43a90889SApple OSS Distributions #define SIOCDIFADDR     _IOW('i', 25, struct ifreq)     /* delete IF addr */
95*43a90889SApple OSS Distributions #define SIOCAIFADDR     _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
96*43a90889SApple OSS Distributions 
97*43a90889SApple OSS Distributions #define SIOCGIFADDR     _IOWR('i', 33, struct ifreq)    /* get ifnet address */
98*43a90889SApple OSS Distributions #define SIOCGIFDSTADDR  _IOWR('i', 34, struct ifreq)    /* get p-p address */
99*43a90889SApple OSS Distributions #define SIOCGIFBRDADDR  _IOWR('i', 35, struct ifreq)    /* get broadcast addr */
100*43a90889SApple OSS Distributions #if !defined(KERNEL) || defined(KERNEL_PRIVATE)
101*43a90889SApple OSS Distributions #define SIOCGIFCONF     _IOWR('i', 36, struct ifconf)   /* get ifnet list */
102*43a90889SApple OSS Distributions #endif /* !KERNEL || KERNEL_PRIVATE */
103*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
104*43a90889SApple OSS Distributions /* See sockio_private.h for extended ioctls */
105*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
106*43a90889SApple OSS Distributions #define SIOCGIFNETMASK  _IOWR('i', 37, struct ifreq)    /* get net addr mask */
107*43a90889SApple OSS Distributions #define SIOCAUTOADDR    _IOWR('i', 38, struct ifreq)    /* autoconf address */
108*43a90889SApple OSS Distributions #define SIOCAUTONETMASK _IOW('i', 39, struct ifreq)     /* autoconf netmask */
109*43a90889SApple OSS Distributions #define SIOCARPIPLL             _IOWR('i', 40, struct ifreq)    /* arp for IPv4LL address */
110*43a90889SApple OSS Distributions 
111*43a90889SApple OSS Distributions #define SIOCADDMULTI     _IOW('i', 49, struct ifreq)    /* add m'cast addr */
112*43a90889SApple OSS Distributions #define SIOCDELMULTI     _IOW('i', 50, struct ifreq)    /* del m'cast addr */
113*43a90889SApple OSS Distributions #define SIOCGIFMTU      _IOWR('i', 51, struct ifreq)    /* get IF mtu */
114*43a90889SApple OSS Distributions #define SIOCSIFMTU       _IOW('i', 52, struct ifreq)    /* set IF mtu */
115*43a90889SApple OSS Distributions #define SIOCGIFPHYS     _IOWR('i', 53, struct ifreq)    /* get IF wire */
116*43a90889SApple OSS Distributions #define SIOCSIFPHYS      _IOW('i', 54, struct ifreq)    /* set IF wire */
117*43a90889SApple OSS Distributions #define SIOCSIFMEDIA    _IOWR('i', 55, struct ifreq)    /* set net media */
118*43a90889SApple OSS Distributions 
119*43a90889SApple OSS Distributions /*
120*43a90889SApple OSS Distributions  * The command SIOCGIFMEDIA does not allow a process to access the extended
121*43a90889SApple OSS Distributions  * media subtype and extended subtype values are returned as IFM_OTHER.
122*43a90889SApple OSS Distributions  */
123*43a90889SApple OSS Distributions #define SIOCGIFMEDIA    _IOWR('i', 56, struct ifmediareq) /* get compatible net media  */
124*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
125*43a90889SApple OSS Distributions /* See sockio_private.h for extended ioctls */
126*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
127*43a90889SApple OSS Distributions 
128*43a90889SApple OSS Distributions #define SIOCSIFGENERIC   _IOW('i', 57, struct ifreq)    /* generic IF set op */
129*43a90889SApple OSS Distributions #define SIOCGIFGENERIC  _IOWR('i', 58, struct ifreq)    /* generic IF get op */
130*43a90889SApple OSS Distributions #define SIOCRSLVMULTI   _IOWR('i', 59, struct rslvmulti_req)
131*43a90889SApple OSS Distributions 
132*43a90889SApple OSS Distributions #define SIOCSIFLLADDR   _IOW('i', 60, struct ifreq)     /* set link level addr */
133*43a90889SApple OSS Distributions #define SIOCGIFSTATUS   _IOWR('i', 61, struct ifstat)   /* get IF status */
134*43a90889SApple OSS Distributions #define SIOCSIFPHYADDR   _IOW('i', 62, struct ifaliasreq) /* set gif addres */
135*43a90889SApple OSS Distributions #define SIOCGIFPSRCADDR _IOWR('i', 63, struct ifreq)    /* get gif psrc addr */
136*43a90889SApple OSS Distributions #define SIOCGIFPDSTADDR _IOWR('i', 64, struct ifreq)    /* get gif pdst addr */
137*43a90889SApple OSS Distributions #define SIOCDIFPHYADDR   _IOW('i', 65, struct ifreq)    /* delete gif addrs */
138*43a90889SApple OSS Distributions 
139*43a90889SApple OSS Distributions #define SIOCGIFDEVMTU   _IOWR('i', 68, struct ifreq)    /* get if ifdevmtu */
140*43a90889SApple OSS Distributions #define SIOCSIFALTMTU    _IOW('i', 69, struct ifreq)    /* set if alternate mtu */
141*43a90889SApple OSS Distributions #define SIOCGIFALTMTU   _IOWR('i', 72, struct ifreq)    /* get if alternate mtu */
142*43a90889SApple OSS Distributions #define SIOCSIFBOND      _IOW('i', 70, struct ifreq)    /* set bond if config */
143*43a90889SApple OSS Distributions #define SIOCGIFBOND     _IOWR('i', 71, struct ifreq)    /* get bond if config */
144*43a90889SApple OSS Distributions 
145*43a90889SApple OSS Distributions /*
146*43a90889SApple OSS Distributions  * The command SIOCGIFXMEDIA is meant to be used by processes only to be able
147*43a90889SApple OSS Distributions  * to access the extended media subtypes with the extended IFM_TMASK.
148*43a90889SApple OSS Distributions  *
149*43a90889SApple OSS Distributions  * An ifnet must not implement SIOCGIFXMEDIA as it gets the extended
150*43a90889SApple OSS Distributions  * media subtypes by simply compiling with <net/if_media.h>
151*43a90889SApple OSS Distributions  */
152*43a90889SApple OSS Distributions #define SIOCGIFXMEDIA   _IOWR('i', 72, struct ifmediareq) /* get net extended media */
153*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
154*43a90889SApple OSS Distributions /* See sockio_private.h for extended ioctls */
155*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
156*43a90889SApple OSS Distributions 
157*43a90889SApple OSS Distributions #define SIOCSIFCAP       _IOW('i', 90, struct ifreq)    /* set IF features */
158*43a90889SApple OSS Distributions #define SIOCGIFCAP      _IOWR('i', 91, struct ifreq)    /* get IF features */
159*43a90889SApple OSS Distributions 
160*43a90889SApple OSS Distributions #define SIOCSIFMANAGEMENT       _IOWR('i', 92, struct ifreq)   /* set management interface */
161*43a90889SApple OSS Distributions 
162*43a90889SApple OSS Distributions #define SIOCIFCREATE    _IOWR('i', 120, struct ifreq)   /* create clone if */
163*43a90889SApple OSS Distributions #define SIOCIFDESTROY    _IOW('i', 121, struct ifreq)   /* destroy clone if */
164*43a90889SApple OSS Distributions #define SIOCIFCREATE2   _IOWR('i', 122, struct ifreq)   /* create clone if with data */
165*43a90889SApple OSS Distributions 
166*43a90889SApple OSS Distributions #define SIOCSDRVSPEC    _IOW('i', 123, struct ifdrv)    /* set driver-specific
167*43a90889SApple OSS Distributions 	                                                 *         parameters */
168*43a90889SApple OSS Distributions #define SIOCGDRVSPEC    _IOWR('i', 123, struct ifdrv)   /* get driver-specific
169*43a90889SApple OSS Distributions 	                                                 *         parameters */
170*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
171*43a90889SApple OSS Distributions /* See sockio_private.h for extended ioctls */
172*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
173*43a90889SApple OSS Distributions #define SIOCSIFVLAN      _IOW('i', 126, struct ifreq)   /* set VLAN config */
174*43a90889SApple OSS Distributions #define SIOCGIFVLAN     _IOWR('i', 127, struct ifreq)   /* get VLAN config */
175*43a90889SApple OSS Distributions #define SIOCSETVLAN     SIOCSIFVLAN
176*43a90889SApple OSS Distributions #define SIOCGETVLAN     SIOCGIFVLAN
177*43a90889SApple OSS Distributions 
178*43a90889SApple OSS Distributions #if !defined(KERNEL) || defined(KERNEL_PRIVATE)
179*43a90889SApple OSS Distributions #define SIOCIFGCLONERS  _IOWR('i', 129, struct if_clonereq) /* get cloners */
180*43a90889SApple OSS Distributions #endif /* !KERNEL || KERNEL_PRIVATE */
181*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
182*43a90889SApple OSS Distributions /* See sockio_private.h for extended ioctls */
183*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
184*43a90889SApple OSS Distributions 
185*43a90889SApple OSS Distributions #define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq)   /* get ppp asyncmap */
186*43a90889SApple OSS Distributions #define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq)    /* set ppp asyncmap */
187*43a90889SApple OSS Distributions 
188*43a90889SApple OSS Distributions 
189*43a90889SApple OSS Distributions #define SIOCGIFMAC      _IOWR('i', 130, struct ifreq)   /* deprecated */
190*43a90889SApple OSS Distributions #define SIOCSIFMAC      _IOW('i', 131, struct ifreq)    /* deprecated */
191*43a90889SApple OSS Distributions #define SIOCSIFKPI      _IOW('i', 134, struct ifreq) /* set interface kext param - root only */
192*43a90889SApple OSS Distributions #define SIOCGIFKPI      _IOWR('i', 135, struct ifreq) /* get interface kext param */
193*43a90889SApple OSS Distributions 
194*43a90889SApple OSS Distributions #define SIOCGIFWAKEFLAGS _IOWR('i', 136, struct ifreq) /* get interface wake property flags */
195*43a90889SApple OSS Distributions 
196*43a90889SApple OSS Distributions #define SIOCGIFFUNCTIONALTYPE   _IOWR('i', 173, struct ifreq) /* get interface functional type */
197*43a90889SApple OSS Distributions 
198*43a90889SApple OSS Distributions #define SIOCSIF6LOWPAN  _IOW('i', 196, struct ifreq)    /* set 6LOWPAN config */
199*43a90889SApple OSS Distributions #define SIOCGIF6LOWPAN  _IOWR('i', 197, struct ifreq)   /* get 6LOWPAN config */
200*43a90889SApple OSS Distributions 
201*43a90889SApple OSS Distributions #define SIOCGIFDIRECTLINK _IOWR('i', 222, struct ifreq) /* get DIRECTLINK */
202*43a90889SApple OSS Distributions 
203*43a90889SApple OSS Distributions #ifdef PRIVATE
204*43a90889SApple OSS Distributions #include <sys/sockio_private.h>
205*43a90889SApple OSS Distributions #endif /* PRIVATE */
206*43a90889SApple OSS Distributions 
207*43a90889SApple OSS Distributions #endif /* !_SYS_SOCKIO_H_ */
208