xref: /titanic_50/usr/src/uts/common/inet/ipp_common.h (revision ead1f93ee620d7580f7e53350fe5a884fc4f158a)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_INET_IPP_COMMON_H
27 #define	_INET_IPP_COMMON_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #ifdef _KERNEL
34 #include <ipp/ipp.h>
35 
36 /*
37  * IPP  -- IP Policy -- interface.
38  *
39  * WARNING: Everything in this file is private, belonging to the IPP
40  * subsystem.  The interfaces and declarations made here are subject
41  * to change.
42  */
43 
44 extern uint32_t ipp_action_count;
45 
46 /* Whether ip policy is enabled at callout position proc */
47 #define	IPP_ENABLED(proc, ipst)	((ipp_action_count != 0) && \
48 	(~((ipst)->ips_ip_policy_mask) & (proc)))
49 
50 /* Extracts 8 bit traffic class from IPV6 flow label field */
51 #ifdef  _BIG_ENDIAN
52 #define	__IPV6_TCLASS_FROM_FLOW(n)	(((n)>>20) & 0xff)
53 #else
54 #define	__IPV6_TCLASS_FROM_FLOW(n)	((((n)<<4) | (((n)>>12) & 0xf)) & 0xff)
55 #endif /* _BIG_ENDIAN */
56 
57 typedef	enum {
58 	IPP_LOCAL_IN =	0x01,
59 	IPP_LOCAL_OUT =	0x02,
60 	IPP_FWD_IN =	0x04,
61 	IPP_FWD_OUT =	0x08
62 } ip_proc_t;
63 
64 /* IP private data structure */
65 typedef	struct ip_priv {
66 	ip_proc_t	proc;
67 	uint32_t	ill_index;
68 } ip_priv_t;
69 
70 /* The entry point for ip policy processing */
71 #ifdef	ILL_CONDEMNED
72 extern mblk_t *ip_process(ip_proc_t, mblk_t *, ill_t *, ill_t *);
73 #endif
74 extern void ip_priv_free(void *);
75 #endif /* _KERNEL */
76 
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _INET_IPP_COMMON_H */
83