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