/* * 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 * or http://www.opensolaris.org/os/licensing. * 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. */ #ifndef _TSOL_LABEL_H #define _TSOL_LABEL_H #include #include #include /* Procedural Interface Structure Definitions */ struct label_info { /* structure returned by label_info */ short ilabel_len; /* max Information Label length */ short slabel_len; /* max Sensitivity Label length */ short clabel_len; /* max CMW Label length */ short clear_len; /* max Clearance Label length */ short vers_len; /* version string length */ short header_len; /* max len of banner page header */ short protect_as_len; /* max len of banner page protect as */ short caveats_len; /* max len of banner page caveats */ short channels_len; /* max len of banner page channels */ }; typedef struct label_set_identifier { /* valid label set identifier */ int type; /* type of the set */ char *name; /* name of the set if needed */ } set_id; struct name_fields { /* names for label builder fields */ char *class_name; /* Classifications field name */ char *comps_name; /* Compartments field name */ char *marks_name; /* Markings field name */ }; /* Label Set Identifier Types */ /* * The accreditation ranges as specified in the label encodings file. * The name parameter is ignored. * * System Accreditation Range is all valid labels plus Admin High and Low. * * User Accreditation Range is valid user labels as defined in the * ACCREDITATION RANGE: section of the label encodings file. */ #define SYSTEM_ACCREDITATION_RANGE 1 #define USER_ACCREDITATION_RANGE 2 /* System Call Interface Definitions */ extern int getlabel(const char *, m_label_t *); extern int fgetlabel(int, m_label_t *); extern int getplabel(m_label_t *); extern int setflabel(const char *, m_label_t *); extern char *getpathbylabel(const char *, char *, size_t, const m_label_t *sl); extern m_label_t *getzonelabelbyid(zoneid_t); extern m_label_t *getzonelabelbyname(const char *); extern zoneid_t getzoneidbylabel(const m_label_t *); extern char *getzonenamebylabel(const m_label_t *); extern char *getzonerootbyid(zoneid_t); extern char *getzonerootbyname(const char *); extern char *getzonerootbylabel(const m_label_t *); extern m_label_t *getlabelbypath(const char *); /* Flag word values */ #define ALL_ENTRIES 0x00000000 #define ACCESS_RELATED 0x00000001 #define ACCESS_MASK 0x0000FFFF #define ACCESS_SHIFT 0 #define LONG_WORDS 0x00010000 /* use long names */ #define SHORT_WORDS 0x00020000 /* use short names if present */ #define LONG_CLASSIFICATION 0x00040000 /* use long classification */ #define SHORT_CLASSIFICATION 0x00080000 /* use short classification */ #define NO_CLASSIFICATION 0x00100000 /* don't translate the class */ #define VIEW_INTERNAL 0x00200000 /* don't promote/demote */ #define VIEW_EXTERNAL 0x00400000 /* promote/demote label */ #define NEW_LABEL 0x00000001 /* create a full new label */ #define NO_CORRECTION 0x00000002 /* don't correct label errors */ /* implies NEW_LABEL */ #define CVT_DIM 0x01 /* display word dimmed */ #define CVT_SET 0x02 /* display word currently set */ /* Procedure Interface Definitions available to user */ /* APIs shared with the kernel are in