xref: /titanic_51/usr/src/uts/common/sys/sockio.h (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * University Copyright- Copyright (c) 1982, 1986, 1988
32  * The Regents of the University of California
33  * All Rights Reserved
34  *
35  * University Acknowledgment- Portions of this document are derived from
36  * software developed by the University of California, Berkeley, and its
37  * contributors.
38  */
39 
40 #ifndef	_SYS_SOCKIO_H
41 #define	_SYS_SOCKIO_H
42 
43 #pragma ident	"%Z%%M%	%I%	%E% SMI"
44 
45 /*
46  * General socket ioctl definitions.
47  */
48 
49 #include <sys/ioccom.h>
50 
51 #ifdef	__cplusplus
52 extern "C" {
53 #endif
54 
55 /* socket i/o controls */
56 #define	SIOCSHIWAT	_IOW('s',  0, int)		/* set high watermark */
57 #define	SIOCGHIWAT	_IOR('s',  1, int)		/* get high watermark */
58 #define	SIOCSLOWAT	_IOW('s',  2, int)		/* set low watermark */
59 #define	SIOCGLOWAT	_IOR('s',  3, int)		/* get low watermark */
60 #define	SIOCATMARK	_IOR('s',  7, int)		/* at oob mark? */
61 #define	SIOCSPGRP	_IOW('s',  8, int)		/* set process group */
62 #define	SIOCGPGRP	_IOR('s',  9, int)		/* get process group */
63 
64 /*
65  * SIOCADDRT and SIOCDELRT ioctls need to be defined using _IOWN macro to
66  * make them datamodel independent.
67  */
68 #define	SIOCADDRT	_IOWN('r', 10, 48)		/* add route */
69 #define	SIOCDELRT	_IOWN('r', 11, 48)		/* delete route */
70 
71 /* For multicast routing. These might change in future release */
72 #define	SIOCGETVIFCNT	_IOWR('r', 20, struct sioc_vif_req)
73 							/* get vif pkt count */
74 #define	SIOCGETSGCNT	_IOWR('r', 21, struct sioc_sg_req)
75 							/* get s,g pkt count */
76 #define	SIOCGETLSGCNT	_IOWR('r', 21, struct sioc_lsg_req)
77 							/* get s,g pkt count */
78 
79 /*
80  * Obsolete interface ioctls using struct ifreq that are supported
81  * for compatibility. New interface ioctls use struct lifreq.
82  */
83 #define	SIOCSIFADDR	_IOW('i',  12, struct ifreq)	/* set if address */
84 #define	SIOCGIFADDR	_IOWR('i', 13, struct ifreq)	/* get if address */
85 #define	SIOCSIFDSTADDR	_IOW('i',  14, struct ifreq)	/* set p-p address */
86 #define	SIOCGIFDSTADDR	_IOWR('i', 15, struct ifreq)	/* get p-p address */
87 #define	SIOCSIFFLAGS	_IOW('i',  16, struct ifreq)	/* set if flags */
88 #define	SIOCGIFFLAGS	_IOWR('i', 17, struct ifreq)	/* get if flags */
89 #define	SIOCSIFMEM	_IOW('i',  18, struct ifreq)	/* set interface mem */
90 #define	SIOCGIFMEM	_IOWR('i', 19, struct ifreq)	/* get interface mem */
91 
92 /*
93  * Needs to be defined using _IOWRN macro to make it datamodel independent.
94  * Argument is a struct ifconf.
95  */
96 #define	O_SIOCGIFCONF	_IOWRN('i', 20, 8)		/* old get if list */
97 
98 #define	SIOCSIFMTU	_IOW('i',  21, struct ifreq)	/* set if mtu */
99 #define	SIOCGIFMTU	_IOWR('i', 22, struct ifreq)	/* get if mtu */
100 
101 	/* from 4.3BSD */
102 #define	SIOCGIFBRDADDR	_IOWR('i', 23, struct ifreq)	/* get broadcast addr */
103 #define	SIOCSIFBRDADDR	_IOW('i',  24, struct ifreq)	/* set broadcast addr */
104 #define	SIOCGIFNETMASK	_IOWR('i', 25, struct ifreq)	/* get subnetmask */
105 #define	SIOCSIFNETMASK	_IOW('i',  26, struct ifreq)	/* set subnetmask */
106 #define	SIOCGIFMETRIC	_IOWR('i', 27, struct ifreq)	/* get if metric */
107 #define	SIOCSIFMETRIC	_IOW('i',  28, struct ifreq)	/* set if metric */
108 
109 #define	SIOCSARP	_IOW('i',  30, struct arpreq)	/* set arp entry */
110 #define	SIOCGARP	_IOWR('i', 31, struct arpreq)	/* get arp entry */
111 #define	SIOCDARP	_IOW('i',  32, struct arpreq)	/* delete arp entry */
112 #define	SIOCUPPER	_IOW('i',  40, struct ifreq)	/* attach upper layer */
113 #define	SIOCLOWER	_IOW('i',  41, struct ifreq)	/* attach lower layer */
114 #define	SIOCSETSYNC	_IOW('i',  44, struct ifreq)	/* set syncmode */
115 #define	SIOCGETSYNC	_IOWR('i', 45, struct ifreq)	/* get syncmode */
116 #define	SIOCSSDSTATS	_IOWR('i', 46, struct ifreq)	/* sync data stats */
117 #define	SIOCSSESTATS	_IOWR('i', 47, struct ifreq)	/* sync error stats */
118 
119 #define	SIOCSPROMISC	_IOW('i',  48, int)		/* request promisc */
120 							/* mode on/off */
121 #define	SIOCADDMULTI	_IOW('i',  49, struct ifreq)	/* set m/c address */
122 #define	SIOCDELMULTI	_IOW('i',  50, struct ifreq)	/* clr m/c address */
123 
124 /* STREAMS based socket emulation */
125 
126 #define	SIOCGETNAME	_IOR('s',  52, struct sockaddr)	/* getsockname */
127 #define	SIOCGETPEER	_IOR('s',  53, struct sockaddr)	/* getpeername */
128 #define	IF_UNITSEL	_IOW('s',  54, int)		/* set unit number */
129 #define	SIOCXPROTO	_IO('s',   55)			/* empty proto table */
130 
131 #define	SIOCIFDETACH	_IOW('i',  56, struct ifreq)	/* detach interface */
132 #define	SIOCGENPSTATS	_IOWR('i', 57, struct ifreq)	/* get ENP stats */
133 #define	SIOCX25XMT	_IOWR('i', 59, struct ifreq)	/* start a slp proc */
134 							/* in x25if */
135 #define	SIOCX25RCV	_IOWR('i', 60, struct ifreq)	/* start a slp proc */
136 							/* in x25if */
137 #define	SIOCX25TBL	_IOWR('i', 61, struct ifreq)	/* xfer lun table to */
138 							/* kernel */
139 #define	SIOCSLGETREQ	_IOWR('i', 71, struct ifreq)	/* wait for switched */
140 							/* SLIP request */
141 #define	SIOCSLSTAT	_IOW('i',  72, struct ifreq)	/* pass SLIP info to */
142 							/* kernel */
143 #define	SIOCSIFNAME	_IOW('i',  73, struct ifreq)	/* set interface name */
144 #define	SIOCGENADDR	_IOWR('i', 85, struct ifreq)	/* Get ethernet addr */
145 #define	SIOCGIFNUM	_IOR('i',  87, int)		/* get number of ifs */
146 
147 #define	SIOCGIFMUXID	_IOWR('i', 88, struct ifreq)	/* get if muxid */
148 #define	SIOCSIFMUXID	_IOW('i',  89, struct ifreq)	/* set if muxid */
149 
150 #define	SIOCGIFINDEX	_IOWR('i', 90, struct ifreq)	/* get if index */
151 #define	SIOCSIFINDEX	_IOW('i',  91, struct ifreq)	/* set if index */
152 #define	SIOCGIFCONF	_IOWRN('i', 92, 8)		/* get if list */
153 
154 /*
155  * New interface ioctls that use the struct lifreq. Can be used for
156  * both IPv4 and IPv6.
157  */
158 #define	SIOCLIFREMOVEIF	_IOW('i',  110, struct lifreq)	/* delete logical */
159 #define	SIOCLIFADDIF	_IOWR('i', 111, struct lifreq)	/* create logical */
160 
161 #define	SIOCSLIFADDR	_IOW('i',  112, struct lifreq)	/* set if address */
162 #define	SIOCGLIFADDR	_IOWR('i', 113, struct lifreq)	/* get if address */
163 #define	SIOCSLIFDSTADDR	_IOW('i',  114, struct lifreq)	/* set p-p address */
164 #define	SIOCGLIFDSTADDR	_IOWR('i', 115, struct lifreq)	/* get p-p address */
165 #define	SIOCSLIFFLAGS	_IOW('i',  116, struct lifreq)	/* set if flags */
166 #define	SIOCGLIFFLAGS	_IOWR('i', 117, struct lifreq)	/* get if flags */
167 
168 /*
169  * Needs to be defined using _IOWRN macro to make it datamodel independent.
170  * Argument is a struct lifconf.
171  */
172 #define	O_SIOCGLIFCONF	_IOWRN('i', 120, 16)		/* old get if list */
173 #define	SIOCSLIFMTU	_IOW('i',  121, struct lifreq)	/* set if mtu */
174 #define	SIOCGLIFMTU	_IOWR('i', 122, struct lifreq)	/* get if mtu */
175 #define	SIOCGLIFBRDADDR	_IOWR('i', 123, struct lifreq)	/* get broadcast addr */
176 #define	SIOCSLIFBRDADDR	_IOW('i',  124, struct lifreq)	/* set broadcast addr */
177 #define	SIOCGLIFNETMASK	_IOWR('i', 125, struct lifreq)	/* get subnetmask */
178 #define	SIOCSLIFNETMASK	_IOW('i',  126, struct lifreq)	/* set subnetmask */
179 #define	SIOCGLIFMETRIC	_IOWR('i', 127, struct lifreq)	/* get if metric */
180 #define	SIOCSLIFMETRIC	_IOW('i',  128, struct lifreq)	/* set if metric */
181 #define	SIOCSLIFNAME	_IOWR('i',  129, struct lifreq)	/* set interface name */
182 #define	SIOCGLIFNUM	_IOWR('i', 130, struct lifnum)	/* get number of ifs */
183 #define	SIOCGLIFMUXID	_IOWR('i', 131, struct lifreq)	/* get if muxid */
184 #define	SIOCSLIFMUXID	_IOW('i',  132, struct lifreq)	/* set if muxid */
185 
186 #define	SIOCGLIFINDEX	_IOWR('i', 133, struct lifreq)	/* get if index */
187 #define	SIOCSLIFINDEX	_IOW('i',  134, struct lifreq)	/* set if index */
188 
189 #define	SIOCSLIFTOKEN	_IOW('i',  135, struct lifreq)	/* Set token for link */
190 							/* local address and */
191 							/* autoconf */
192 #define	SIOCGLIFTOKEN	_IOWR('i', 136, struct lifreq)	/* Get token for link */
193 							/* local address and */
194 							/* autoconf */
195 
196 #define	SIOCSLIFSUBNET	_IOW('i',  137, struct lifreq)	/* set subnet prefix */
197 #define	SIOCGLIFSUBNET	_IOWR('i', 138, struct lifreq)	/* get subnet prefix */
198 
199 #define	SIOCSLIFLNKINFO _IOW('i',  139, struct lifreq)	/* set link info */
200 #define	SIOCGLIFLNKINFO _IOWR('i', 140, struct lifreq)	/* get link info */
201 
202 #define	SIOCLIFDELND	_IOW('i',  141, struct lifreq)	/* Delete ND entry */
203 #define	SIOCLIFGETND	_IOWR('i', 142, struct lifreq)	/* Get ND entry */
204 #define	SIOCLIFSETND	_IOW('i',  143, struct lifreq)	/* Set ND entry */
205 
206 /*
207  * Address querying ioctls.
208  */
209 #define	SIOCTMYADDR	_IOWR('i', 144, struct sioc_addrreq)
210 							/* My address? */
211 #define	SIOCTONLINK	_IOWR('i', 145, struct sioc_addrreq)
212 							/* Address on-link? */
213 #define	SIOCTMYSITE	_IOWR('i', 146, struct sioc_addrreq)
214 							/* In this site? */
215 
216 #define	SIOCGTUNPARAM	_IOR('i',  147, struct iftun_req)
217 							/* get tunnel */
218 							/* parameters */
219 #define	SIOCSTUNPARAM	_IOW('i',  148, struct iftun_req)
220 							/* set tunnel */
221 							/* parameters */
222 
223 #define	SIOCFIPSECONFIG	_IOW('i',  149, 0)		/* Flush Policy  */
224 #define	SIOCSIPSECONFIG	_IOW('i',  150, 0)		/* Set Policy */
225 #define	SIOCDIPSECONFIG	_IOW('i',  151, 0)		/* Delete Policy */
226 #define	SIOCLIPSECONFIG	_IOW('i',  152, 0)		/* List Policy */
227 
228 /*
229  * IOCTLS for implementing load balancing and failover within IP.
230  */
231 #define	SIOCLIFFAILOVER	_IOW('i',  153, struct lifreq)	/* Failover */
232 #define	SIOCLIFFAILBACK	_IOW('i',  154, struct lifreq)	/* Failback */
233 #define	SIOCSLIFGROUPNAME _IOW('i',  155, struct lifreq) /* Group interfaces */
234 #define	SIOCGLIFGROUPNAME _IOWR('i',  156, struct lifreq) /* Get group name */
235 #define	SIOCGLIFOINDEX	_IOWR('i', 157, struct lifreq)	/* get orig if index */
236 
237 /*
238  * Leave 158 - 160 unused; used to be SIOC*IFARP ioctls.
239  */
240 
241 /*
242  * IOCTL for implementing load balancing and failover within IP.
243  */
244 #define	SIOCSLIFOINDEX	_IOWR('i', 161, struct lifreq)	/* set orig if index */
245 
246 /*
247  * IOCTLS which provide an interface to the IPv6 address selection policy.
248  */
249 #define	SIOCGIP6ADDRPOLICY	_IOWRN('i', 162, 0)
250 #define	SIOCSIP6ADDRPOLICY	_IOWN('i', 163, 0)
251 
252 /*
253  * IOCTL for retrieving sorting info for a list of destination addrs.
254  * Use the _IOWRN macro to make it datamodel independent.  Argument
255  * is a struct dstinfo.
256  */
257 #define	SIOCGDSTINFO	_IOWRN('i', 164, 0)
258 #define	SIOCGLIFCONF	_IOWRN('i', 165, 16)	/* get if list */
259 
260 /*
261  * Extended IOCTLS for manipulating ARP cache entries.
262  */
263 #define	SIOCSXARP	_IOW('i', 166, struct xarpreq)	/* set an ARP entry */
264 #define	SIOCGXARP	_IOWR('i', 167, struct xarpreq)	/* get an ARP entry */
265 #define	SIOCDXARP	_IOW('i', 168, struct xarpreq)	/* delete ARP entry */
266 
267 /*
268  * IOCTL private to sockfs.
269  */
270 #define	_SIOCSOCKFALLBACK _IOW('i', 169, 0)
271 
272 /*
273  * IOCTLs for getting and setting zone associated with an interface, and
274  * unplumbing interfaces associated with a given zone.
275  */
276 #define	SIOCGLIFZONE	_IOWR('i', 170, struct lifreq)	/* get zone id */
277 #define	SIOCSLIFZONE	_IOW('i', 171, struct lifreq)	/* set zone id */
278 
279 /*
280  * IOCTLS for handling SCTP options.
281  */
282 #define	SIOCSCTPSOPT	_IOWN('i', 172, 16)	/* Set SCTP option */
283 #define	SIOCSCTPGOPT	_IOWRN('i', 173, 16)	/* Get SCTP option */
284 #define	SIOCSCTPPEELOFF	_IOWR('i', 174, int)	/* SCTP peeloff */
285 
286 /*
287  * IOCTLs for getting and setting the source address that is used for packets
288  * going out on the given interface.
289  */
290 #define	SIOCGLIFUSESRC	_IOWR('i', 175, struct lifreq)	/* get src addr */
291 #define	SIOCSLIFUSESRC	_IOW('i', 176, struct lifreq)	/* set src addr */
292 
293 /*
294  * IOCTL used to get all the interfaces that use the the specified interfaces'
295  * source address
296  */
297 #define	SIOCGLIFSRCOF	_IOWRN('i', 177, 16)		/* source of */
298 
299 /*
300  * IOCTLs for source specific multicast; get or set a socket's
301  * source filter for a particular multicast group.  Argument is
302  * a struct group_filter.  Defined in RFC 3678.
303  */
304 #define	SIOCGMSFILTER	_IOWR('i', 178, 0)
305 #define	SIOCSMSFILTER	_IOW('i', 179, 0)
306 /*
307  * IPv4-specific versions of the above; get or set a socket's source
308  * filter for a particular multicast group, for PF_INET sockets only.
309  * Argument is a struct ip_msfilter.
310  */
311 #define	SIOCGIPMSFILTER	_IOWR('i', 180, 0)
312 #define	SIOCSIPMSFILTER	_IOW('i', 181, 0)
313 
314 /*
315  * IOCTL for implementing "disable FAILBACK" IPMP configuration.
316  */
317 #define	SIOCSIPMPFAILBACK	_IOW('i', 182, int)	/* enable/disable */
318 							/* FAILBACK */
319 
320 #ifdef	__cplusplus
321 }
322 #endif
323 
324 #endif	/* _SYS_SOCKIO_H */
325