1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" 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]
.TH LABEL_TO_STR 3TSOL "Jul 20, 2007"
.SH NAME
label_to_str \- convert labels to human readable strings
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [\fIflag\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
.fi
.LP
.nf
#include <tsol/label.h>
\fBint\fR \fBlabel_to_str\fR(\fBconst m_label_t *\fR\fIlabel\fR, \fBchar **\fR\fIstring\fR,
\fBconst m_label_str_t\fR \fIconversion_type\fR, \fBuint_t\fR \fIflags\fR);
.fi
.SH DESCRIPTION
.sp
.LP
\fBlabel_to_str()\fR is a simple function to convert various mandatory label
types to human readable strings.
.sp
.LP
\fIlabel\fR is the mandatory label to convert. \fIstring\fR points to memory
that is allocated by \fBlabel_to_str()\fR that contains the converted string.
The caller is responsible for calling \fBfree\fR(3C) to free allocated memory.
.sp
.LP
The calling process must have mandatory read access to the resulting human
readable string. Or the calling process must have the \fBsys_trans_label\fR
privilege.
.sp
.LP
The \fIconversion_type\fR parameter controls the type of label conversion. Not
all types of conversion are valid for all types of label:
.sp
.ne 2
.na
\fB\fBM_LABEL\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to a human readable string based on its type.
.RE
.sp
.ne 2
.na
\fB\fBM_INTERNAL\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to an internal text representation that is safe for
storing in a public object. Internal conversions can later be parsed to their
same value.
.RE
.sp
.ne 2
.na
\fB\fBM_COLOR\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to a string that represents the color name that the
administrator has associated with the label.
.RE
.sp
.ne 2
.na
\fB\fBPRINTER_TOP_BOTTOM\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to a human readable string that is appropriate for use as
the top and bottom label of banner and trailer pages in the Defense
Intelligence Agency (DIA) encodings printed output schema.
.RE
.sp
.ne 2
.na
\fB\fBPRINTER_LABEL\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to a human readable string that is appropriate for use as
the banner page downgrade warning in the DIA encodings printed output schema.
.RE
.sp
.ne 2
.na
\fB\fBPRINTER_CAVEATS\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to a human readable string that is appropriate for use as
the banner page caveats section in the DIA encodings printed output schema.
.RE
.sp
.ne 2
.na
\fB\fBPRINTER_CHANNELS\fR\fR
.ad
.RS 22n
Converts \fIlabel\fR to a human readable string that is appropriate for use as
the banner page handling channels in the DIA encodings printed output schema.
.RE
.sp
.LP
The \fIflags\fR parameter provides a hint to the label conversion:
.sp
.ne 2
.na
\fB\fBDEF_NAMES\fR\fR
.ad
.RS 15n
The default names are preferred.
.RE
.sp
.ne 2
.na
\fB\fBSHORT_NAMES\fR\fR
.ad
.RS 15n
Short names are preferred where defined.
.RE
.sp
.ne 2
.na
\fB\fBLONG_NAMES\fR\fR
.ad
.RS 15n
Long names are preferred.
.RE
.SH RETURN VALUES
.sp
.LP
Upon successful completion, the \fBlabel_to_str()\fR function returns 0.
Otherwise, -1 is returned, \fIerrno\fR is set to indicate the error and the
string pointer is set to \fINULL\fR.
.SH ERRORS
.sp
.LP
The \fBlabel_to_str()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 11n
Invalid parameter.
.RE
.sp
.ne 2
.na
\fB\fBENOTSUP\fR\fR
.ad
.RS 11n
The system does not support label translations.
.RE
.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 11n
The physical limits of the system are exceeded by size bytes of memory which
cannot be allocated.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability See below.
_
MT-Level MT-Safe
_
Standard See below.
.TE
.sp
.LP
The \fBlabel_to_str()\fR function is Committed. The returned string is
Not-an-Interface and is dependent on the specific \fBlabel_encodings\fR file.
The conversion type \fBINTERNAL\fR is Uncommitted, but is always accepted as
input to \fBstr_to_label\fR(3TSOL).
.sp
.LP
Conversion types that are relative to the DIA encodings schema are Standard.
Standard is specified in \fBlabel_encodings\fR(4).
.SH SEE ALSO
.sp
.LP
\fBfree\fR(3C), \fBlibtsol\fR(3LIB), \fBstr_to_label\fR(3TSOL),
\fBlabel_encodings\fR(4), \fBattributes\fR(5), \fBlabels\fR(5)
.sp
.LP
\fIUsing the label_to_str Function\fR in \fISolaris Trusted Extensions
Developer\&'s Guide\fR
.SH WARNINGS
.sp
.LP
A number of these conversions rely on the DIA label encodings schema. They
might not be valid for other label schemata.
.SH NOTES
.sp
.LP
The functionality described on this manual page is available only if the system
is configured with Trusted Extensions.
|