xref: /titanic_44/usr/src/uts/common/inet/rawip_impl.h (revision 3e95bd4ab92abca814bd28e854607d1975c7dc88)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5e4f35dbaSgt145670  * Common Development and Distribution License (the "License").
6e4f35dbaSgt145670  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*3e95bd4aSAnders Persson  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_RAWIP_IMPL_H
277c478bd9Sstevel@tonic-gate #define	_RAWIP_IMPL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef _KERNEL
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
36f4b3ec61Sdh155122 #include <sys/netstack.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include <netinet/in.h>
397c478bd9Sstevel@tonic-gate #include <netinet/icmp6.h>
407c478bd9Sstevel@tonic-gate #include <netinet/ip6.h>
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include <inet/common.h>
437c478bd9Sstevel@tonic-gate #include <inet/ip.h>
440f1702c5SYu Xiangning #include <inet/optcom.h>
456e91bba0SGirish Moodalbail #include <inet/tunables.h>
46f4b3ec61Sdh155122 
47f4b3ec61Sdh155122 /*
48f4b3ec61Sdh155122  * ICMP stack instances
49f4b3ec61Sdh155122  */
50f4b3ec61Sdh155122 struct icmp_stack {
51f4b3ec61Sdh155122 	netstack_t	*is_netstack;	/* Common netstack */
52f4b3ec61Sdh155122 	void		*is_head;	/* Head for list of open icmps */
536e91bba0SGirish Moodalbail 	mod_prop_info_t	*is_propinfo_tbl; /* holds the icmp tunables */
54f4b3ec61Sdh155122 	kstat_t		*is_ksp;	/* kstats */
55f4b3ec61Sdh155122 	mib2_rawip_t	is_rawip_mib;	/* SNMP fixed size info */
560f1702c5SYu Xiangning 	ldi_ident_t	is_ldi_ident;
57f4b3ec61Sdh155122 };
580f1702c5SYu Xiangning 
59f4b3ec61Sdh155122 typedef struct icmp_stack icmp_stack_t;
60f4b3ec61Sdh155122 
617c478bd9Sstevel@tonic-gate /* Internal icmp control structure, one per open stream */
627c478bd9Sstevel@tonic-gate typedef	struct icmp_s {
63fc80c0dfSnordmark 	/*
64bd670b35SErik Nordmark 	 * The addresses and ports in the conn_t and icmp_state are protected by
65bd670b35SErik Nordmark 	 * conn_lock. conn_lock also protects the content of icmp_t.
66fc80c0dfSnordmark 	 */
677c478bd9Sstevel@tonic-gate 	uint_t		icmp_state;	/* TPI state */
687c478bd9Sstevel@tonic-gate 
69fc80c0dfSnordmark 	/* Written to only once at the time of opening the endpoint */
70fc80c0dfSnordmark 	conn_t		*icmp_connp;
71fc80c0dfSnordmark 
727c478bd9Sstevel@tonic-gate 	uint_t
737c478bd9Sstevel@tonic-gate 	    icmp_hdrincl : 1,		/* IP_HDRINCL option + RAW and IGMP */
74fc80c0dfSnordmark 
75bd670b35SErik Nordmark 	    icmp_pad_to_bit_31: 31;
76fc80c0dfSnordmark 
777c478bd9Sstevel@tonic-gate 	icmp6_filter_t	*icmp_filter;		/* ICMP6_FILTER option */
787c478bd9Sstevel@tonic-gate 
79bd670b35SErik Nordmark 	/* Set at open time and never changed */
80f4b3ec61Sdh155122 	icmp_stack_t	*icmp_is;		/* Stack instance */
81bd670b35SErik Nordmark 
820f1702c5SYu Xiangning 	int		icmp_delayed_error;
830f1702c5SYu Xiangning 	kmutex_t	icmp_recv_lock;
840f1702c5SYu Xiangning 	mblk_t		*icmp_fallback_queue_head;
850f1702c5SYu Xiangning 	mblk_t		*icmp_fallback_queue_tail;
860f1702c5SYu Xiangning 	struct sockaddr_storage	icmp_delayed_addr;
877c478bd9Sstevel@tonic-gate } icmp_t;
88fc80c0dfSnordmark 
89fc80c0dfSnordmark /*
90fc80c0dfSnordmark  * Object to represent database of options to search passed to
91fc80c0dfSnordmark  * {sock,tpi}optcom_req() interface routine to take care of option
92fc80c0dfSnordmark  * management and associated methods.
93fc80c0dfSnordmark  */
94fc80c0dfSnordmark extern optdb_obj_t	icmp_opt_obj;
95fc80c0dfSnordmark extern uint_t		icmp_max_optsize;
96fc80c0dfSnordmark 
97bd670b35SErik Nordmark extern int	icmp_opt_default(queue_t *, t_scalar_t, t_scalar_t, uchar_t *);
98bd670b35SErik Nordmark extern int	icmp_tpi_opt_get(queue_t *, t_scalar_t, t_scalar_t, uchar_t *);
99bd670b35SErik Nordmark extern int	icmp_tpi_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *,
100bd670b35SErik Nordmark 		    uint_t *, uchar_t *, void *, cred_t *);
101fc80c0dfSnordmark extern mblk_t	*icmp_snmp_get(queue_t *q, mblk_t *mpctl);
102fc80c0dfSnordmark 
1030f1702c5SYu Xiangning extern void	icmp_ddi_g_init(void);
1040f1702c5SYu Xiangning extern void	icmp_ddi_g_destroy(void);
1050f1702c5SYu Xiangning 
1060f1702c5SYu Xiangning extern sock_lower_handle_t rawip_create(int, int, int, sock_downcalls_t **,
1070f1702c5SYu Xiangning     uint_t *, int *, int, cred_t *);
10841174437SAnders Persson extern int rawip_fallback(sock_lower_handle_t, queue_t *, boolean_t,
109*3e95bd4aSAnders Persson     so_proto_quiesced_cb_t, sock_quiesce_arg_t *);
1100f1702c5SYu Xiangning 
1110f1702c5SYu Xiangning extern sock_downcalls_t sock_rawip_downcalls;
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1167c478bd9Sstevel@tonic-gate }
1177c478bd9Sstevel@tonic-gate #endif
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #endif	/* _RAWIP_IMPL_H */
120