label_macro.h revision b9dac67bf3a63377e9c38679121e360b643b6a68
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LABEL_MACRO_H
#define _LABEL_MACRO_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/* PRIVATE ONLY TO THE LABEL LIBRARY. DO NOT USE ELSEWHERE */
/* Actual Binary Label Structure Definitions */
typedef int16_t _Classification;
typedef struct {
union {
} class_u;
typedef struct {
typedef struct {
} Markings_t;
typedef struct _mac_label_impl {
_bslabel_impl_t, /* Sensitivity Label */
_bclear_impl_t; /* Clearance */
typedef struct _binary_information_label_impl { /* Information Label */
typedef struct _binary_cmw_label_impl { /* CMW Label */
typedef struct _binary_level_range_impl { /* Level Range */
#define NMLP_MAX 0x10
#define NSLS_MAX 0x4
/* Label Identifier Types */
/* m_label_t macros */
#define _MTYPE(l, t) \
(((_mac_label_impl_t *)(l))->id == (t))
#define _MSETTYPE(l, t) \
(((_mac_label_impl_t *)(l))->id = (t))
#define SUN_INVALID_ID 0 /* uninitialized label */
#define _bcl_sl bcl_sensitivity_label
#define _bcl_il bcl_information_label
#define _bslev_il binformation_level
#define _lclass classification
#ifdef _BIG_ENDIAN
#else
#define LCLASS_SET(slp, l) \
#endif /* _BIG_ENDIAN */
#define _comps compartments
#ifdef _BIG_ENDIAN
#else
#define ICLASS_SET(ilp, l) \
#endif /* _BIG_ENDIAN */
/* Manifest Constant Values */
#define LOW_CLASS 0 /* Admin_Low classification value */
#define EMPTY_SET 0 /* Empty compartments and markings set */
/* markings set */
/* Construct initial labels */
#define _LOW_LABEL(l, t) \
#define _HIGH_LABEL(l, t) \
/* Macro equivalents */
/* Is this memory a properly formatted label of type t? */
#define BLTYPE(l, t) \
((t) == SUN_CMW_ID ? \
((_mac_label_impl_t *)(l))->id == (t))
/* Are the levels of these labels equal? */
/* Does the level of l1 dominate that of l2? */
/* Does the level of l1 strictly dominate that of l2? */
/* Is the level of l within the range r? */
#define BLINRANGE(l, r)\
(BLDOMINATES((l), &((r)->lower_bound)) && \
BLDOMINATES(&((r)->upper_bound), (l)))
/* Least Upper Bound level l1 and l2 replacing l1 with the result. */
/* Greatest Lower Bound level l1 and l2 replacing l1 with the result. */
/* Create Manifest Labels */
/* Write a System_Low CMW Label into this memory. */
/* Write a System_Low Sensitivity Label into this memory. */
#define _BSLLOW(l) \
/* Write a System_High Sensitivity Label into this memory. */
#define _BSLHIGH(l) \
/* Write a System_Low Information Label into this memory. */
#define _BILLOW(l) \
ICLASS_SET(l, LOW_CLASS), \
/* Write a System_Low Sensitivity Label into this memory. */
#define _BCLEARLOW(c) \
LCLASS_SET(c, LOW_CLASS), \
/* Write a System_High Sensitivity Label into this memory. */
#define _BCLEARHIGH(c) \
LCLASS_SET(c, HIGH_CLASS), \
/* Write an undefined Sensitivity Label into this memory. */
/* Write an undefined Clearance into this memory. */
/* Retrieve the Sensitivity Label portion of a CMW Label */
/* Retrieve the Information Label portion of a CMW Label */
/* Copy the Sensitivity Label portion from a CMW Label */
/* Replace the Sensitivity Label portion of a CMW Label */
/* Set type of this memory to the label type 't' */
#ifdef __cplusplus
}
#endif
#endif /* !_LABEL_MACRO_H */