xref: /titanic_44/usr/src/uts/common/inet/rawip_impl.h (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 /* Copyright (c) 1990 Mentat Inc. */
26 
27 #ifndef	_RAWIP_IMPL_H
28 #define	_RAWIP_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef _KERNEL
37 
38 #include <sys/types.h>
39 
40 #include <netinet/in.h>
41 #include <netinet/icmp6.h>
42 #include <netinet/ip6.h>
43 
44 #include <inet/common.h>
45 #include <inet/ip.h>
46 
47 /* Internal icmp control structure, one per open stream */
48 typedef	struct icmp_s {
49 	uint_t		icmp_state;	/* TPI state */
50 	in6_addr_t	icmp_v6src;	/* Source address of this stream */
51 	in6_addr_t	icmp_bound_v6src; /* Explicitely bound to address */
52 	in6_addr_t 	icmp_v6dst;	/* Connected destination */
53 	uint32_t	icmp_flowinfo;	/* Connected flow id and tclass */
54 	uint32_t 	icmp_max_hdr_len; /* For write offset in stream head */
55 	sa_family_t	icmp_family;	/* Family from socket() call */
56 	/*
57 	 * IP format that packets transmitted from this struct should use.
58 	 * Value can be IP4_VERSION or IPV6_VERSION.
59 	 */
60 	uchar_t	icmp_ipversion;
61 
62 	uint_t		icmp_proto;
63 	uint_t		icmp_ip_snd_options_len; /* Len of IPv4 options */
64 	uint8_t		*icmp_ip_snd_options;	/* Ptr to IPv4 options */
65 	uint8_t		icmp_multicast_ttl;	/* IP*_MULTICAST_TTL/HOPS */
66 	ipaddr_t	icmp_multicast_if_addr; /* IP_MULTICAST_IF option */
67 	uint_t		icmp_multicast_if_index; /* IPV6_MULTICAST_IF option */
68 	int		icmp_bound_if;		/* IP*_BOUND_IF option */
69 	int		icmp_xmit_if;		/* IP_XMIT_IF option */
70 
71 	uint_t
72 	    icmp_debug : 1,		/* SO_DEBUG "socket" option. */
73 	    icmp_dontroute : 1,		/* SO_DONTROUTE "socket" option. */
74 	    icmp_broadcast : 1,		/* SO_BROADCAST "socket" option. */
75 	    icmp_reuseaddr : 1,		/* SO_REUSEADDR "socket" option. */
76 
77 	    icmp_useloopback : 1,	/* SO_USELOOPBACK "socket" option. */
78 	    icmp_multicast_loop : 1,	/* IP_MULTICAST_LOOP option */
79 	    icmp_hdrincl : 1,		/* IP_HDRINCL option + RAW and IGMP */
80 	    icmp_dgram_errind : 1,	/* SO_DGRAM_ERRIND option */
81 
82 	    icmp_discon_pending : 1,	/* T_DISCON_REQ in progress */
83 	    icmp_unspec_source : 1,	/* IP*_UNSPEC_SRC option */
84 	    icmp_raw_checksum : 1,	/* raw checksum per IPV6_CHECKSUM */
85 	    icmp_no_tp_cksum : 1,	/* icmp_proto is UDP or TCP */
86 
87 	    icmp_ipv6_recvpktinfo : 1,	/* IPV6_RECVPKTINFO option  */
88 	    icmp_ipv6_recvhoplimit : 1,	/* IPV6_RECVHOPLIMIT option */
89 	    icmp_ipv6_recvhopopts : 1,	/* IPV6_RECVHOPOPTS option */
90 	    icmp_ipv6_recvdstopts : 1,	/* IPV6_RECVDSTOPTS option */
91 
92 	    icmp_ipv6_recvrthdr : 1,	/* IPV6_RECVRTHDR option */
93 	    icmp_ipv6_recvpathmtu : 1,	/* IPV6_RECVPATHMTU option */
94 	    icmp_recvif:1,		/* IP_RECVIF for raw sockets option */
95 	    icmp_ipv6_recvtclass : 1,	/* IPV6_RECVTCLASS option */
96 
97 	    icmp_restricted : 1,	/* opened by non-privileged user */
98 	    icmp_ipv6_recvrtdstopts : 1, /* Obsolete IPV6_RECVRTHDRDSTOPTS */
99 	    icmp_old_ipv6_recvdstopts : 1, /* Old ver of IPV6_RECVDSTOPTS */
100 	    icmp_timestamp : 1,  	/* SO_TIMESTAMP "socket" option */
101 	    icmp_mac_exempt : 1,	/* SO_MAC_EXEMPT option */
102 
103 	    icmp_pad_to_bit_31: 7;
104 
105 	uint8_t		icmp_type_of_service;
106 	uint8_t		icmp_ttl;		/* TTL or hoplimit */
107 	uint32_t	icmp_checksum_off; /* user supplied checksum offset */
108 	icmp6_filter_t	*icmp_filter;		/* ICMP6_FILTER option */
109 	cred_t		*icmp_credp;		/* Opener's credentials */
110 
111 	ip6_pkt_t	icmp_sticky_ipp;	/* Sticky options */
112 	uint8_t		*icmp_sticky_hdrs;	/* Prebuilt IPv6 hdrs */
113 	uint_t		icmp_sticky_hdrs_len;	/* Incl. ip6h and any ip6i */
114 	zoneid_t	icmp_zoneid;		/* ID of owning zone */
115 	uint_t		icmp_label_len;		/* length of security label */
116 	uint_t		icmp_label_len_v6;	/* sec. part of sticky opt */
117 	in6_addr_t 	icmp_v6lastdst;		/* most recent destination */
118 	mblk_t		*icmp_delabel;		/* send this on close */
119 } icmp_t;
120 
121 #endif	/* _KERNEL */
122 
123 #ifdef	__cplusplus
124 }
125 #endif
126 
127 #endif	/* _RAWIP_IMPL_H */
128