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