tndb.h revision ebb7ba5d39a1fc27566910c47e9749493f961e3f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* from "tndb.h 7.34 01/08/31 SMI; TSOL 2.x"
*/
#ifndef _SYS_TSOL_TNDB_H
#define _SYS_TSOL_TNDB_H
#ifdef _KERNEL
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* same on ILP32 and LP64 */
typedef union tnaddr {
struct sockaddr_in ip_addr_v4;
struct sockaddr_in6 ip_addr_v6;
} tnaddr_t;
/*
* structure for TN database access routines and TN system calls
*/
typedef enum tsol_dbops {
TNDB_NOOP = 0,
TNDB_LOAD = 1,
TNDB_DELETE = 2,
TNDB_FLUSH = 3,
TNDB_GET = 5
} tsol_dbops_t;
/*
* For tnrhdb access library routines and tnrh(2TSOL)
* same for both ILP32 and LP64.
*/
typedef struct tsol_rhent {
short rh_prefix; /* length of subnet mask */
short rh_unused; /* padding */
} tsol_rhent_t;
typedef struct tsol_rhstr_s {
int family;
char *address;
char *template;
} tsol_rhstr_t;
/*
* host types recognized by tsol hosts
*/
typedef enum {
UNLABELED = 1,
SUN_CIPSO = 3
typedef enum {
OPT_NONE = 0,
OPT_CIPSO = 1
typedef struct cipso_tag_type_1 {
#define TSOL_CIPSO_MIN_LENGTH 6
#define TSOL_TT1_MIN_LENGTH 4
#define TSOL_TT1_MAX_LENGTH 34
#define TSOL_CIPSO_DOI_OFFSET 2
#define TSOL_CIPSO_TAG_OFFSET 6
typedef struct cipso_option {
/*
* RIPSO classifications
*/
#define TSOL_CL_TOP_SECRET 0x3d
#define TSOL_CL_SECRET 0x5a
#define TSOL_CL_CONFIDENTIAL 0x96
#define TSOL_CL_UNCLASSIFIED 0xab
/*
* RIPSO protection authorities
*/
#define TSOL_PA_GENSER 0x80
#define TSOL_PA_SIOP_ESI 0x40
#define TSOL_PA_SCI 0x20
#define TSOL_PA_NSA 0x10
#define TSOL_PA_DOE 0x08
/*
* this mask is only used for tndb structures, and is different
* from t6mask_t bits definitions
*/
typedef unsigned int tnmask_t;
/*
* unlabeled host structure for the tnrhtp template.
* same for both ILP32 and LP64.
*/
struct tsol_unl {
};
/*
* CIPSO host structure for the tnrhtp template
* same for both ILP32 and LP64.
*/
struct tsol_cipso {
};
/*
* Valid keys and values of the key=value pairs for tnrhtp
*/
#define TP_UNLABELED "unlabeled"
#define TP_CIPSO "cipso"
#define TP_ZONE "zone"
#define TP_HOSTTYPE "host_type"
#define TP_DOI "doi"
#define TP_DEFLABEL "def_label"
#define TP_MINLABEL "min_sl"
#define TP_MAXLABEL "max_sl"
#define TP_SET "sl_set"
#define TP_COMMA ","
/*
* For tnrhtp access library routines and tnrhtp(2TSOL)
* same for both ILP32 and LP64.
*/
typedef struct tsol_tpent {
int tp_doi; /* Domain of Interpretation */
#define tp_cipso_doi_unl tp_doi
#define tp_cipso_doi_cipso tp_doi
union {
} un;
} tsol_tpent_t;
typedef struct tsol_tpstr_s {
char *template;
char *attrs;
} tsol_tpstr_t;
/*
* For tnmlp(2TSOL); same for both ILP32 and LP64.
*/
typedef struct tsol_mlpent {
/*
* For tnzonecfg access library routines.
* List of MLPs ends with null entry, where protocol and port are both zero.
*/
typedef struct tsol_zcent {
char zc_name[ZONENAME_MAX];
int zc_doi;
int zc_match;
} tsol_zcent_t;
typedef struct tsol_tpc {
} tsol_tpc_t;
typedef struct tsol_tnrhc {
char rhc_invalid; /* out-of-date rhc */
char rhc_isbcast; /* broadcast address */
char rhc_local; /* loopback or local interace */
} tsol_tnrhc_t;
/* Size of remote host hash tables in kernel */
#define TNRHC_SIZE 256
#define TSOL_MASK_TABLE_SIZE 33
#define TSOL_MASK_TABLE_SIZE_V6 129
#ifdef _KERNEL
#define TNRHC_HOLD(a) { \
mutex_enter(&(a)->rhc_lock); \
(a)->rhc_refcnt++; \
ASSERT((a)->rhc_refcnt > 0); \
mutex_exit(&(a)->rhc_lock); \
}
#define TNRHC_RELE(a) { \
mutex_enter(&(a)->rhc_lock); \
ASSERT((a)->rhc_refcnt > 0); \
if (--(a)->rhc_refcnt <= 0) \
tnrhc_free(a); \
else \
mutex_exit(&(a)->rhc_lock); \
}
extern void tnrhc_free(tsol_tnrhc_t *);
#define TPC_HOLD(a) { \
mutex_enter(&(a)->tpc_lock); \
(a)->tpc_refcnt++; \
ASSERT((a)->tpc_refcnt > 0); \
mutex_exit(&(a)->tpc_lock); \
}
#define TPC_RELE(a) { \
mutex_enter(&(a)->tpc_lock); \
ASSERT((a)->tpc_refcnt > 0); \
if (--(a)->tpc_refcnt <= 0) \
tpc_free(a); \
else \
mutex_exit(&(a)->tpc_lock); \
}
extern void tpc_free(tsol_tpc_t *);
#endif /* _KERNEL */
/*
* The next three hashing macros are copied from macros in ip_ire.h.
*/
% (table_size))
/* This assumes that table_size is a power of 2. */
/*
* Constants used for getting the mask value in struct tsol_tpent
*/
enum {
TNT_SL_RANGE_TSOL, /* use this for both unl and zone */
};
/*
* mask definitions
*/
/*
* TN errors
*/
/*
* Structure used to hold a list of IP addresses.
*/
typedef struct tsol_address {
struct tsol_address *next;
/* This is shared between tcache and mdb */
typedef struct tnrhc_hash_s {
} tnrhc_hash_t;
#ifdef _KERNEL
typedef enum {
} mlp_type_t;
extern void tcache_init(void);
extern void tsol_print_label(const blevel_t *, const char *);
struct tsol_gc_s;
struct tsol_gcgrp_s;
struct tsol_gcgrp_addr_s;
boolean_t *);
extern void gc_inactive(struct tsol_gc_s *);
extern int rtsa_validate(const struct rtsa_s *);
extern void gcgrp_inactive(struct tsol_gcgrp_s *);
extern int tnrh_load(const tsol_rhent_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_TSOL_TNDB_H */