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
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.
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]
23 * Copyright 1989 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
28 #include <sys/types.h>
29 #include <sys/socket.h>
30 #include <netinet/in.h>
33 /* multicast setsockopts */
34 #define SUNOS4X_IP_MULTICAST_IF 2
35 #define SUNOS4X_IP_MULTICAST_TTL 3
36 #define SUNOS4X_IP_MULTICAST_LOOP 4
37 #define SUNOS4X_IP_ADD_MEMBERSHIP 5
38 #define SUNOS4X_IP_DROP_MEMBERSHIP 6
39 #define SUNOS5X_IP_MULTICAST_IF 0x10
40 #define SUNOS5X_IP_MULTICAST_TTL 0x11
41 #define SUNOS5X_IP_MULTICAST_LOOP 0x12
42 #define SUNOS5X_IP_ADD_MEMBERSHIP 0x13
43 #define SUNOS5X_IP_DROP_MEMBERSHIP 0x14
47 setsockopt(int s
, int level
, int optname
, char *optval
, int optlen
)
51 if (level
== SOL_SOCKET
)
56 if ((a
= _setsockopt(s
, level
, SO_LINGER
, &ling
,
57 sizeof (struct linger
))) == -1)
63 if (optlen
== sizeof (int)) {
66 ling
.l_linger
= (int)*optval
;
67 if ((a
= _setsockopt(s
, level
, SO_LINGER
, &ling
,
68 sizeof (struct linger
))) == -1)
79 if ((a
= _setsockopt(s
, level
, optname
, &val
,
85 if (level
== IPPROTO_IP
)
87 case SUNOS4X_IP_MULTICAST_IF
:
88 optname
= SUNOS5X_IP_MULTICAST_IF
;
91 case SUNOS4X_IP_MULTICAST_TTL
:
92 optname
= SUNOS5X_IP_MULTICAST_TTL
;
95 case SUNOS4X_IP_MULTICAST_LOOP
:
96 optname
= SUNOS5X_IP_MULTICAST_LOOP
;
99 case SUNOS4X_IP_ADD_MEMBERSHIP
:
100 optname
= SUNOS5X_IP_ADD_MEMBERSHIP
;
103 case SUNOS4X_IP_DROP_MEMBERSHIP
:
104 optname
= SUNOS5X_IP_DROP_MEMBERSHIP
;
108 if ((a
= _setsockopt(s
, level
, optname
, optval
, optlen
)) == -1)