label.h revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e
/*
* 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 _TSOL_LABEL_H
#define _TSOL_LABEL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <priv.h>
#ifdef __cplusplus
extern "C" {
#endif
/* 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 char *getpathbylabel(const char *, char *, size_t,
extern m_label_t *getzonelabelbyname(const char *);
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
/* implies NEW_LABEL */
/* Procedure Interface Definitions available to user */
extern m_label_t *blabel_alloc(void);
extern void blabel_free(m_label_t *);
extern size_t blabel_size(void);
extern char *bcleartoh_r(const m_label_t *, char *);
extern void h_free(char *);
extern m_range_t *getuserrange(const char *);
extern m_range_t *getdevicerange(const char *);
extern int set_effective_priv(priv_op_t, int, ...);
extern int set_inheritable_priv(priv_op_t, int, ...);
extern int set_permitted_priv(priv_op_t, int, ...);
extern int is_system_labeled(void);
/* Procedures needed for multi-level printing */
/* APIs implemented via labeld */
extern int labelinfo(struct label_info *);
extern int bclearvalid(const m_label_t *);
/* Manifest human readable label names */
#define ADMIN_LOW "ADMIN_LOW"
#define ADMIN_HIGH "ADMIN_HIGH"
/* DIA label conversion and parsing */
/* Conversion types */
typedef enum _m_label_str {
/* Flags for conversion, not all flags apply to all types */
#define DEF_NAMES 0x1
uint_t);
/* Parsing types */
typedef enum _m_label_type {
/* Flags for parsing */
#define L_DEFAULT 0x0
/* EINVAL sub codes */
/* bad requested label type, bad previous label type */
uint_t, int *);
extern void m_label_free(m_label_t *);
/* Contract Private interfaces with the label builder GUIs */
char **, char **[], char **[], char *[], int *, int *);
char **, char **[], char **[], char *[], int *, int *);
extern int labelfields(struct name_fields *);
#ifdef __cplusplus
}
#endif
#endif /* !_TSOL_LABEL_H */