xref: /illumos-gate/usr/src/uts/common/sys/tsol/tndb.h (revision b3b35633)
145916cd2Sjpk /*
245916cd2Sjpk  * CDDL HEADER START
345916cd2Sjpk  *
445916cd2Sjpk  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
745916cd2Sjpk  *
845916cd2Sjpk  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
945916cd2Sjpk  * or http://www.opensolaris.org/os/licensing.
1045916cd2Sjpk  * See the License for the specific language governing permissions
1145916cd2Sjpk  * and limitations under the License.
1245916cd2Sjpk  *
1345916cd2Sjpk  * When distributing Covered Code, include this CDDL HEADER in each
1445916cd2Sjpk  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1545916cd2Sjpk  * If applicable, add the following below this CDDL HEADER, with the
1645916cd2Sjpk  * fields enclosed by brackets "[]" replaced with your own identifying
1745916cd2Sjpk  * information: Portions Copyright [yyyy] [name of copyright owner]
1845916cd2Sjpk  *
1945916cd2Sjpk  * CDDL HEADER END
2045916cd2Sjpk  */
2145916cd2Sjpk /*
22ebb7ba5dSTony Nguyen  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
2345916cd2Sjpk  * Use is subject to license terms.
2445916cd2Sjpk  *
2545916cd2Sjpk  * from "tndb.h	7.34	01/08/31 SMI; TSOL 2.x"
2645916cd2Sjpk  */
2745916cd2Sjpk 
2845916cd2Sjpk #ifndef	_SYS_TSOL_TNDB_H
2945916cd2Sjpk #define	_SYS_TSOL_TNDB_H
3045916cd2Sjpk 
3145916cd2Sjpk #include <sys/types.h>
32ebb7ba5dSTony Nguyen #include <sys/zone.h>
3345916cd2Sjpk #include <sys/tsol/label.h>
3445916cd2Sjpk #include <sys/tsol/label_macro.h>
3545916cd2Sjpk #include <net/if.h>
3645916cd2Sjpk 
3745916cd2Sjpk #ifdef _KERNEL
3845916cd2Sjpk #include <net/route.h>
3945916cd2Sjpk #endif
4045916cd2Sjpk 
4145916cd2Sjpk #ifdef	__cplusplus
4245916cd2Sjpk extern "C" {
4345916cd2Sjpk #endif
4445916cd2Sjpk 
4545916cd2Sjpk /* same on ILP32 and LP64 */
4645916cd2Sjpk typedef union tnaddr {
4745916cd2Sjpk 	struct sockaddr_in	ip_addr_v4;
4845916cd2Sjpk 	struct sockaddr_in6	ip_addr_v6;
4945916cd2Sjpk } tnaddr_t;
5045916cd2Sjpk 
5145916cd2Sjpk #define	ta_family	ip_addr_v4.sin_family
5245916cd2Sjpk #define	ta_addr_v4	ip_addr_v4.sin_addr
5345916cd2Sjpk #define	ta_addr_v6	ip_addr_v6.sin6_addr
5445916cd2Sjpk #define	ta_port_v4	ip_addr_v4.sin_port
5545916cd2Sjpk #define	ta_port_v6	ip_addr_v6.sin6_port
5645916cd2Sjpk 
5745916cd2Sjpk #define	TNADDR_EQ(addr1, addr2) \
5845916cd2Sjpk 	(((addr1)->ta_family == AF_INET && (addr2)->ta_family == AF_INET && \
5945916cd2Sjpk 	(addr1)->ta_addr_v4.s_addr == (addr2)->ta_addr_v4.s_addr) || \
6045916cd2Sjpk 	((addr1)->ta_family == AF_INET6 && (addr2)->ta_family == AF_INET6 && \
6145916cd2Sjpk 	IN6_ARE_ADDR_EQUAL(&(addr1)->ta_addr_v6, &(addr2)->ta_addr_v6)))
6245916cd2Sjpk 
6345916cd2Sjpk /*
6445916cd2Sjpk  * structure for TN database access routines and TN system calls
6545916cd2Sjpk  */
6645916cd2Sjpk 
6745916cd2Sjpk typedef enum tsol_dbops {
6845916cd2Sjpk 	TNDB_NOOP = 0,
6945916cd2Sjpk 	TNDB_LOAD = 1,
7045916cd2Sjpk 	TNDB_DELETE = 2,
7145916cd2Sjpk 	TNDB_FLUSH = 3,
7245916cd2Sjpk 	TNDB_GET = 5
7345916cd2Sjpk } tsol_dbops_t;
7445916cd2Sjpk 
75ebb7ba5dSTony Nguyen #define	TNTNAMSIZ 	ZONENAME_MAX	/* template name size */
76ebb7ba5dSTony Nguyen #define	IP_STR_SIZE 	200		/* string ip address size */
7745916cd2Sjpk 
78ebb7ba5dSTony Nguyen #define	TNRHDB_NCOL	2		/* # of columns in tnrhdb */
7945916cd2Sjpk 
8045916cd2Sjpk /*
8145916cd2Sjpk  * For tnrhdb access library routines and tnrh(2TSOL)
8245916cd2Sjpk  * same for both ILP32 and LP64.
8345916cd2Sjpk  */
8445916cd2Sjpk typedef struct tsol_rhent {
8545916cd2Sjpk 	short rh_prefix;		/* length of subnet mask */
8645916cd2Sjpk 	short rh_unused;		/* padding */
8745916cd2Sjpk 	tnaddr_t rh_address;		/* IP address */
8845916cd2Sjpk 	char rh_template[TNTNAMSIZ];	/* template name */
8945916cd2Sjpk } tsol_rhent_t;
9045916cd2Sjpk 
9145916cd2Sjpk typedef struct tsol_rhstr_s {
9245916cd2Sjpk 	int	family;
9345916cd2Sjpk 	char	*address;
9445916cd2Sjpk 	char	*template;
9545916cd2Sjpk } tsol_rhstr_t;
9645916cd2Sjpk 
9745916cd2Sjpk /*
9845916cd2Sjpk  * host types recognized by tsol hosts
9945916cd2Sjpk  */
10045916cd2Sjpk typedef enum {
10145916cd2Sjpk 	UNLABELED	= 1,
10245916cd2Sjpk 	SUN_CIPSO	= 3
10345916cd2Sjpk } tsol_host_type_t;
10445916cd2Sjpk 
10545916cd2Sjpk typedef enum {
10645916cd2Sjpk 	OPT_NONE	= 0,
10745916cd2Sjpk 	OPT_CIPSO	= 1
10845916cd2Sjpk } tsol_ip_label_t;
10945916cd2Sjpk 
11045916cd2Sjpk typedef struct cipso_tag_type_1 {
11145916cd2Sjpk 	uchar_t	tag_type;		/* Tag Type (1) */
11245916cd2Sjpk 	uchar_t	tag_length;		/* Length of Tag */
11345916cd2Sjpk 	uchar_t	tag_align;		/* Alignment Octet */
11445916cd2Sjpk 	uchar_t	tag_sl;			/* Sensitivity Level */
11545916cd2Sjpk 	uchar_t	tag_cat[1];		/* Categories */
11645916cd2Sjpk } cipso_tag_type_1_t;
11745916cd2Sjpk 
11845916cd2Sjpk #define	TSOL_CIPSO_MIN_LENGTH 6
11945916cd2Sjpk #define	TSOL_CIPSO_MAX_LENGTH IP_MAX_OPT_LENGTH
12045916cd2Sjpk #define	TSOL_TT1_MIN_LENGTH 4
12145916cd2Sjpk #define	TSOL_TT1_MAX_LENGTH 34
12245916cd2Sjpk 
12345916cd2Sjpk #define	TSOL_CIPSO_DOI_OFFSET 2
12445916cd2Sjpk #define	TSOL_CIPSO_TAG_OFFSET 6
12545916cd2Sjpk 
12645916cd2Sjpk typedef struct cipso_option {
12745916cd2Sjpk 	uchar_t	cipso_type;		/* Type of option (134) */
12845916cd2Sjpk 	uchar_t	cipso_length;		/* Length of option */
12945916cd2Sjpk 	uchar_t	cipso_doi[4];		/* Domain of Interpretation */
13045916cd2Sjpk 	uchar_t	cipso_tag_type[1];	/* variable length */
13145916cd2Sjpk } cipso_option_t;
13245916cd2Sjpk 
13345916cd2Sjpk /*
13445916cd2Sjpk  * RIPSO classifications
13545916cd2Sjpk  */
13645916cd2Sjpk #define	TSOL_CL_TOP_SECRET 0x3d
13745916cd2Sjpk #define	TSOL_CL_SECRET 0x5a
13845916cd2Sjpk #define	TSOL_CL_CONFIDENTIAL 0x96
13945916cd2Sjpk #define	TSOL_CL_UNCLASSIFIED 0xab
14045916cd2Sjpk 
14145916cd2Sjpk /*
14245916cd2Sjpk  * RIPSO protection authorities
14345916cd2Sjpk  */
14445916cd2Sjpk #define	TSOL_PA_GENSER 0x80
14545916cd2Sjpk #define	TSOL_PA_SIOP_ESI 0x40
14645916cd2Sjpk #define	TSOL_PA_SCI 0x20
14745916cd2Sjpk #define	TSOL_PA_NSA 0x10
14845916cd2Sjpk #define	TSOL_PA_DOE 0x08
14945916cd2Sjpk 
15045916cd2Sjpk /*
15145916cd2Sjpk  * this mask is only used for tndb structures, and is different
15245916cd2Sjpk  * from t6mask_t bits definitions
15345916cd2Sjpk  */
15445916cd2Sjpk 
15545916cd2Sjpk typedef unsigned int tnmask_t;
15645916cd2Sjpk 
15745916cd2Sjpk /*
15845916cd2Sjpk  * unlabeled host structure for the tnrhtp template.
15945916cd2Sjpk  * same for both ILP32 and LP64.
16045916cd2Sjpk  */
16145916cd2Sjpk struct tsol_unl {
16245916cd2Sjpk 	tnmask_t mask; /* tells which attributes are returned by the library */
16345916cd2Sjpk 	bslabel_t def_label;	/* default label */
16445916cd2Sjpk 	brange_t gw_sl_range;	/* for routing only */
16545916cd2Sjpk 	blset_t sl_set;		/* label set */
16645916cd2Sjpk };
16745916cd2Sjpk 
16845916cd2Sjpk /*
16945916cd2Sjpk  * CIPSO host structure for the tnrhtp template
17045916cd2Sjpk  * same for both ILP32 and LP64.
17145916cd2Sjpk  */
17245916cd2Sjpk struct tsol_cipso {
17345916cd2Sjpk 	tnmask_t mask; /* tells which attributes are returned by the library */
17445916cd2Sjpk 	bclear_t def_cl;	/* default clearance */
17545916cd2Sjpk 	brange_t sl_range;	/* min/max SL range */
17645916cd2Sjpk 	blset_t sl_set;		/* label set */
17745916cd2Sjpk };
17845916cd2Sjpk 
17945916cd2Sjpk /*
18045916cd2Sjpk  * Valid keys and values of the key=value pairs for tnrhtp
18145916cd2Sjpk  */
18245916cd2Sjpk #define	TP_UNLABELED	"unlabeled"
18345916cd2Sjpk #define	TP_CIPSO	"cipso"
18445916cd2Sjpk #define	TP_ZONE		"zone"
18545916cd2Sjpk #define	TP_HOSTTYPE	"host_type"
18645916cd2Sjpk #define	TP_DOI		"doi"
18745916cd2Sjpk #define	TP_DEFLABEL	"def_label"
18845916cd2Sjpk #define	TP_MINLABEL	"min_sl"
18945916cd2Sjpk #define	TP_MAXLABEL	"max_sl"
19045916cd2Sjpk #define	TP_SET		"sl_set"
19145916cd2Sjpk 
19245916cd2Sjpk #define	TP_COMMA	","
19345916cd2Sjpk 
19445916cd2Sjpk #define	TNRHTP_NCOL	2	/* # of columns in tnrhtp */
19545916cd2Sjpk 
19645916cd2Sjpk /*
19745916cd2Sjpk  * For tnrhtp access library routines and tnrhtp(2TSOL)
19845916cd2Sjpk  * same for both ILP32 and LP64.
19945916cd2Sjpk  */
20045916cd2Sjpk typedef struct tsol_tpent {
20145916cd2Sjpk 	char name[TNTNAMSIZ]; /* template name */
20245916cd2Sjpk 	tsol_host_type_t host_type; /* specifies host type */
20345916cd2Sjpk 	int tp_doi;		/* Domain of Interpretation */
20445916cd2Sjpk #define	tp_cipso_doi_unl	tp_doi
20545916cd2Sjpk #define	tp_cipso_doi_cipso	tp_doi
20645916cd2Sjpk 	union {
20745916cd2Sjpk 		struct tsol_unl unl; /* template for unlabeled */
20845916cd2Sjpk #define	tp_mask_unl		un.unl.mask
20945916cd2Sjpk #define	tp_def_label		un.unl.def_label
21045916cd2Sjpk #define	tp_gw_sl_range		un.unl.gw_sl_range
21145916cd2Sjpk #define	tp_gw_sl_set		un.unl.sl_set
21245916cd2Sjpk 
21345916cd2Sjpk 		struct tsol_cipso cipso; /* template for CIPSO */
21445916cd2Sjpk #define	tp_mask_cipso		un.cipso.mask
21545916cd2Sjpk #define	tp_def_cl_cipso		un.cipso.def_cl
21645916cd2Sjpk #define	tp_sl_range_cipso	un.cipso.sl_range
21745916cd2Sjpk #define	tp_sl_set_cipso		un.cipso.sl_set
21845916cd2Sjpk 	} un;
21945916cd2Sjpk } tsol_tpent_t;
22045916cd2Sjpk 
22145916cd2Sjpk typedef struct tsol_tpstr_s {
22245916cd2Sjpk 	char	*template;
22345916cd2Sjpk 	char	*attrs;
22445916cd2Sjpk } tsol_tpstr_t;
22545916cd2Sjpk 
22645916cd2Sjpk /*
22745916cd2Sjpk  * For tnmlp(2TSOL); same for both ILP32 and LP64.
22845916cd2Sjpk  */
22945916cd2Sjpk typedef struct tsol_mlpent {
23045916cd2Sjpk 	zoneid_t	tsme_zoneid;
23145916cd2Sjpk 	uint_t		tsme_flags;	/* TSOL_MEF_* */
23245916cd2Sjpk 	tsol_mlp_t	tsme_mlp;
23345916cd2Sjpk } tsol_mlpent_t;
23445916cd2Sjpk 
23545916cd2Sjpk #define	TSOL_MEF_SHARED	0x00000001	/* MLP defined on shared addresses */
23645916cd2Sjpk 
23745916cd2Sjpk /*
23845916cd2Sjpk  * For tnzonecfg access library routines.
23945916cd2Sjpk  * List of MLPs ends with null entry, where protocol and port are both zero.
24045916cd2Sjpk  */
24145916cd2Sjpk typedef struct tsol_zcent {
242ebb7ba5dSTony Nguyen 	char		zc_name[ZONENAME_MAX];
24345916cd2Sjpk 	int		zc_doi;
24445916cd2Sjpk 	bslabel_t	zc_label;
24545916cd2Sjpk 	int		zc_match;
24645916cd2Sjpk 	tsol_mlp_t	*zc_private_mlp;
24745916cd2Sjpk 	tsol_mlp_t	*zc_shared_mlp;
24845916cd2Sjpk } tsol_zcent_t;
24945916cd2Sjpk #define	TSOL_MLP_END(mlp)	((mlp)->mlp_ipp == 0 && (mlp)->mlp_port == 0)
25045916cd2Sjpk 
251*b3b35633SGordon Ross #if (defined(_KERNEL) || defined(_KMEMUSER))
25245916cd2Sjpk typedef struct tsol_tpc {
25345916cd2Sjpk 	kmutex_t		tpc_lock;	/* lock for structure */
25445916cd2Sjpk 	uint_t			tpc_refcnt;	/* reference count */
25545916cd2Sjpk 	boolean_t		tpc_invalid;	/* entry has been deleted */
25645916cd2Sjpk 	struct tsol_tpent	tpc_tp;		/* template */
25745916cd2Sjpk } tsol_tpc_t;
25845916cd2Sjpk 
25945916cd2Sjpk typedef struct tsol_tnrhc {
26045916cd2Sjpk 	struct tsol_tnrhc 	*rhc_next;	/* link to next entry */
26145916cd2Sjpk 	kmutex_t		rhc_lock;	/* lock for structure */
26245916cd2Sjpk 	tnaddr_t		rhc_host;	/* IPv4/IPv6 host address */
26345916cd2Sjpk 	tsol_tpc_t		*rhc_tpc;	/* pointer to template */
26445916cd2Sjpk 	uint_t			rhc_refcnt;	/* Number of references */
26545916cd2Sjpk 	char			rhc_invalid;	/* out-of-date rhc */
26645916cd2Sjpk 	char			rhc_isbcast;	/* broadcast address */
26745916cd2Sjpk 	char			rhc_local;	/* loopback or local interace */
26845916cd2Sjpk } tsol_tnrhc_t;
269*b3b35633SGordon Ross #endif	/* _KERNEL || _KMEMUSER */
27045916cd2Sjpk 
27145916cd2Sjpk /* Size of remote host hash tables in kernel */
27245916cd2Sjpk #define	TNRHC_SIZE 256
27345916cd2Sjpk #define	TSOL_MASK_TABLE_SIZE	33
27445916cd2Sjpk #define	TSOL_MASK_TABLE_SIZE_V6	129
27545916cd2Sjpk 
27645916cd2Sjpk #ifdef	_KERNEL
27745916cd2Sjpk #define	TNRHC_HOLD(a)	{					\
27845916cd2Sjpk 	mutex_enter(&(a)->rhc_lock);				\
27945916cd2Sjpk 	(a)->rhc_refcnt++;					\
28045916cd2Sjpk 	ASSERT((a)->rhc_refcnt > 0);				\
28145916cd2Sjpk 	mutex_exit(&(a)->rhc_lock);				\
28245916cd2Sjpk }
28345916cd2Sjpk #define	TNRHC_RELE(a)	{					\
28445916cd2Sjpk 	mutex_enter(&(a)->rhc_lock);				\
28545916cd2Sjpk 	ASSERT((a)->rhc_refcnt > 0);				\
28645916cd2Sjpk 	if (--(a)->rhc_refcnt <= 0)				\
28745916cd2Sjpk 		tnrhc_free(a);					\
28845916cd2Sjpk 	else							\
28945916cd2Sjpk 		mutex_exit(&(a)->rhc_lock);			\
29045916cd2Sjpk }
29145916cd2Sjpk extern void tnrhc_free(tsol_tnrhc_t *);
29245916cd2Sjpk #define	TPC_HOLD(a)	{					\
29345916cd2Sjpk 	mutex_enter(&(a)->tpc_lock);				\
29445916cd2Sjpk 	(a)->tpc_refcnt++;					\
29545916cd2Sjpk 	ASSERT((a)->tpc_refcnt > 0);				\
29645916cd2Sjpk 	mutex_exit(&(a)->tpc_lock);				\
29745916cd2Sjpk }
29845916cd2Sjpk #define	TPC_RELE(a)	{					\
29945916cd2Sjpk 	mutex_enter(&(a)->tpc_lock);				\
30045916cd2Sjpk 	ASSERT((a)->tpc_refcnt > 0);				\
30145916cd2Sjpk 	if (--(a)->tpc_refcnt <= 0)				\
30245916cd2Sjpk 		tpc_free(a);					\
30345916cd2Sjpk 	else							\
30445916cd2Sjpk 		mutex_exit(&(a)->tpc_lock);			\
30545916cd2Sjpk }
30645916cd2Sjpk extern void tpc_free(tsol_tpc_t *);
30745916cd2Sjpk #endif	/* _KERNEL */
30845916cd2Sjpk 
30945916cd2Sjpk /*
31045916cd2Sjpk  * The next three hashing macros are copied from macros in ip_ire.h.
31145916cd2Sjpk  */
31245916cd2Sjpk #define	TSOL_ADDR_HASH(addr, table_size)				\
31345916cd2Sjpk 	(((((addr) >> 16) ^ (addr)) ^ ((((addr) >> 16) ^ (addr))>> 8))	\
31445916cd2Sjpk 	% (table_size))
31545916cd2Sjpk 
31645916cd2Sjpk #define	TSOL_ADDR_HASH_V6(addr, table_size)				\
31745916cd2Sjpk 	(((addr).s6_addr8[8] ^ (addr).s6_addr8[9] ^			\
31845916cd2Sjpk 	(addr).s6_addr8[10] ^ (addr).s6_addr8[13] ^			\
31945916cd2Sjpk 	(addr).s6_addr8[14] ^ (addr).s6_addr8[15]) % (table_size))
32045916cd2Sjpk 
32145916cd2Sjpk /* This assumes that table_size is a power of 2. */
32245916cd2Sjpk #define	TSOL_ADDR_MASK_HASH_V6(addr, mask, table_size)                   \
32345916cd2Sjpk 	((((addr).s6_addr8[8] & (mask).s6_addr8[8]) ^                   \
32445916cd2Sjpk 	((addr).s6_addr8[9] & (mask).s6_addr8[9]) ^                     \
32545916cd2Sjpk 	((addr).s6_addr8[10] & (mask).s6_addr8[10]) ^                   \
32645916cd2Sjpk 	((addr).s6_addr8[13] & (mask).s6_addr8[13]) ^                   \
32745916cd2Sjpk 	((addr).s6_addr8[14] & (mask).s6_addr8[14]) ^                   \
32845916cd2Sjpk 	((addr).s6_addr8[15] & (mask).s6_addr8[15])) & ((table_size) - 1))
32945916cd2Sjpk 
33045916cd2Sjpk 
33145916cd2Sjpk /*
33245916cd2Sjpk  * Constants used for getting the mask value in struct tsol_tpent
33345916cd2Sjpk  */
33445916cd2Sjpk enum {
33545916cd2Sjpk 	TNT_DEF_LABEL,
33645916cd2Sjpk 	TNT_DEF_CL,
33745916cd2Sjpk 	TNT_SL_RANGE_TSOL, /* use this for both unl and zone */
33845916cd2Sjpk 	TNT_CIPSO_DOI
33945916cd2Sjpk };
34045916cd2Sjpk 
34145916cd2Sjpk /*
34245916cd2Sjpk  * mask definitions
34345916cd2Sjpk  */
34445916cd2Sjpk #define	tsol_tntmask(value) ((unsigned int)(1<<(value)))
34545916cd2Sjpk 
34645916cd2Sjpk #define	TSOL_MSK_DEF_LABEL tsol_tntmask(TNT_DEF_LABEL)
34745916cd2Sjpk #define	TSOL_MSK_DEF_CL tsol_tntmask(TNT_DEF_CL)
34845916cd2Sjpk #define	TSOL_MSK_SL_RANGE_TSOL tsol_tntmask(TNT_SL_RANGE_TSOL)
34945916cd2Sjpk #define	TSOL_MSK_CIPSO_DOI tsol_tntmask(TNT_CIPSO_DOI)
35045916cd2Sjpk 
35145916cd2Sjpk /*
35245916cd2Sjpk  * TN errors
35345916cd2Sjpk  */
35445916cd2Sjpk #define	TSOL_PARSE_ERANGE 1 /* result buffer not allocated */
35545916cd2Sjpk #define	TSOL_NOT_SUPPORTED 2 /* address family not supported */
35645916cd2Sjpk #define	TSOL_NOT_FOUND 3 /* search by * routines target not found */
35745916cd2Sjpk 
35845916cd2Sjpk /*
35945916cd2Sjpk  * Structure used to hold a list of IP addresses.
36045916cd2Sjpk  */
36145916cd2Sjpk typedef struct tsol_address {
36245916cd2Sjpk 	struct tsol_address	*next;
36345916cd2Sjpk 	in_addr_t		ip_address;
36445916cd2Sjpk } tsol_address_t;
36545916cd2Sjpk 
366*b3b35633SGordon Ross #if (defined(_KERNEL) || defined(_KMEMUSER))
36745916cd2Sjpk /* This is shared between tcache and mdb */
36845916cd2Sjpk typedef struct tnrhc_hash_s {
36945916cd2Sjpk 	tsol_tnrhc_t *tnrh_list;
37045916cd2Sjpk 	kmutex_t tnrh_lock;
37145916cd2Sjpk } tnrhc_hash_t;
372*b3b35633SGordon Ross #endif	/* _KERNEL || _KMEMUSER */
37345916cd2Sjpk 
37445916cd2Sjpk #ifdef _KERNEL
37545916cd2Sjpk typedef enum {
37645916cd2Sjpk 	mlptSingle,
37745916cd2Sjpk 	mlptPrivate,
37845916cd2Sjpk 	mlptShared,
37945916cd2Sjpk 	mlptBoth
38045916cd2Sjpk } mlp_type_t;
38145916cd2Sjpk 
38245916cd2Sjpk extern tsol_tpc_t *find_tpc(const void *, uchar_t, boolean_t);
38345916cd2Sjpk extern void tcache_init(void);
38445916cd2Sjpk extern in_port_t tsol_next_port(zone_t *, in_port_t, int, boolean_t);
38545916cd2Sjpk extern mlp_type_t tsol_mlp_port_type(zone_t *, uchar_t, uint16_t, mlp_type_t);
38645916cd2Sjpk extern zoneid_t tsol_mlp_findzone(uchar_t, uint16_t);
38745916cd2Sjpk extern int tsol_mlp_anon(zone_t *, mlp_type_t, uchar_t, uint16_t, boolean_t);
38845916cd2Sjpk extern void tsol_print_label(const blevel_t *, const char *);
38945916cd2Sjpk 
39045916cd2Sjpk struct tsol_gc_s;
39145916cd2Sjpk struct tsol_gcgrp_s;
39245916cd2Sjpk struct tsol_gcgrp_addr_s;
39345916cd2Sjpk 
39445916cd2Sjpk extern struct tsol_gc_s *gc_create(struct rtsa_s *, struct tsol_gcgrp_s *,
39545916cd2Sjpk     boolean_t *);
39645916cd2Sjpk extern void gc_inactive(struct tsol_gc_s *);
39745916cd2Sjpk extern int rtsa_validate(const struct rtsa_s *);
39845916cd2Sjpk extern struct tsol_gcgrp_s *gcgrp_lookup(struct tsol_gcgrp_addr_s *, boolean_t);
39945916cd2Sjpk extern void gcgrp_inactive(struct tsol_gcgrp_s *);
40045916cd2Sjpk extern int tnrh_load(const tsol_rhent_t *);
40145916cd2Sjpk #endif /* _KERNEL */
40245916cd2Sjpk 
40345916cd2Sjpk #ifdef	__cplusplus
40445916cd2Sjpk }
40545916cd2Sjpk #endif
40645916cd2Sjpk 
40745916cd2Sjpk #endif	/* _SYS_TSOL_TNDB_H */
408