2 .\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH SCF_TMPL_VALIDATE_FMRI 3SCF "Oct 28, 2008"
8 scf_tmpl_validate_fmri, scf_tmpl_errors_destroy, scf_tmpl_next_error,
9 scf_tmpl_reset_errors, scf_tmpl_strerror, scf_tmpl_error_type,
10 scf_tmpl_error_source_fmri, scf_tmpl_error_pg_tmpl, scf_tmpl_error_pg,
11 scf_tmpl_error_prop_tmpl, scf_tmpl_error_prop, scf_tmpl_error_value \- template
16 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ]
19 \fBint\fR \fBscf_tmpl_validate_fmri\fR(\fBscf_handle_t *\fR\fIh\fR, \fBconst char *\fR\fIfmri\fR,
20 \fBconst char *\fR\fIsnapshot\fR, \fBscf_tmpl_errors_t **\fR\fIerrs\fR, \fBint\fR \fIflags\fR);
25 \fBvoid\fR \fBscf_tmpl_errors_destroy\fR(\fBscf_tmpl_errors_t *\fR\fIerrs\fR);
30 \fBscf_tmpl_error_t *\fR\fBscf_tmpl_next_error\fR(\fBscf_tmpl_errors_t *\fR\fIerrs\fR,
31 \fBscf_tmpl_errors_t *\fR\fIerr\fR)
36 \fBvoid\fR \fBscf_tmpl_reset_errors\fR(\fBscf_tmpl_errors_t *\fR\fIerrs\fR);
41 \fBint\fR \fBscf_tmpl_strerror\fR(\fBscf_tmpl_error_t *\fR\fIerr\fR, \fBchar *\fR\fIs\fR,
42 \fBsize_t\fR \fIn\fR, \fBint\fR \fIflags\fR);
47 \fBint\fR \fBscf_tmpl_error_type\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR,
48 \fBscf_tmpl_error_type_t *\fR\fItype\fR);
53 \fBint\fR \fBscf_tmpl_error_source_fmri\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR,
54 \fBchar *\fR\fIfmri\fR);
59 \fBint\fR \fBscf_tmpl_error_pg_tmpl\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar *\fR\fIname\fR,
60 \fBchar *\fR\fItype\fR);
65 \fBint\fR \fBscf_tmpl_error_pg\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR,
66 \fBchar **\fR\fIname\fR, \fBchar **\fR\fItype\fR);
71 \fBint\fR \fBscf_tmpl_error_prop_tmpl\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar **\fR\fIname\fR,
72 \fBchar **\fR\fItype\fR);
77 \fBint\fR \fBscf_tmpl_error_prop\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar **\fR\fIname\fR,
78 \fBchar **\fR\fItype\fR,);
83 \fBint\fR \fBscf_tmpl_error_value\fR(\fBconst scf_tmpl_error_t *\fR\fIerr\fR, \fBchar**\fR\fIval\fR);
89 The template validation functions offer a way to validate the configuration
90 data of an service instance against the appropriate template data. The
91 \fBscf_tmpl_validate_fmri()\fR function returns the full set of errors for the
92 specified instance, and those errors can be printed or explored directly.
95 By default, the validation is performed on the composed data from the running
96 snapshot of an instance. A different snapshot can be explicitly selected by
97 specifying a valid snapshot name rather than \fINULL\fR for the \fIsnapshot\fR
98 argument. If \fIflags\fR includes \fBSCF_TMPL_VALIDATE_FLAG_CURRENT\fR, the
99 \fIsnapshot\fR argument is ignored and the current configuration is used.
102 By default, these functions also explore template data defined by the service
103 or instance itself, the service's restarter, and global template data. See
104 \fBsmf_template\fR(5) for more information about this composition.
107 An instance FMRI is required, and FMRIs that specify other entities (for
108 example, services) are explicitly rejected.
111 The \fBscf_tmpl_validate_fmri()\fR function validates an instance FMRI against
112 the template data in the repository. As described above, when the
113 \fIsnapshot\fR argument is \fINULL\fR, the default running snapshot is used. If
114 \fBscf_tmpl_errors_t **\fR is non-null, the structure is allocated and returned
115 to the caller for further perusal or printing of the errors.
118 The \fBscf_tmpl_errors_destroy()\fR function destroys and frees the
119 \fBscf_tmpl_errors_t\fR and all of the \fBscf_tmpl_error_t\fR structures to
123 The \fBscf_tmpl_next_error()\fR function takes a pointer to a
124 \fBscf_tmpl_errors_t\fR structure previously returned by
125 \fBscf_tmpl_validate_fmri()\fR. On the first call, it returns a pointer to the
126 first \fBscf_tmpl_error_t\fR found during validation. On subsequent calls, the
127 next error is returned. To resume processing from the first error, the caller
128 can use \fBscf_tmpl_reset_errors()\fR.
131 The contents of an \fBscf_tmpl_error_t\fR are determined by its type. Types
132 added as additional validation checks are introduced. Based on the error type,
133 a set of fields can be retrieved from the error.
137 \fB\fBSCF_TERR_TYPE_INVALID\fR\fR
141 reserved invalid type
147 \fB\fBSCF_TERR_MISSING_PG\fR\fR
151 required property group is missing
158 property group template name and type
165 \fB\fBSCF_TERR_WRONG_PG_TYPE\fR\fR
169 property group type is incorrect
176 property group template name and type
180 property group name and type
187 \fB\fBSCF_TERR_MISSING_PROP\fR\fR
191 required property is missing
198 property group template name and type
202 property template name and type
209 \fB\fBSCF_TERR_WRONG_PROP_TYPE\fR\fR
213 property type is incorrect
220 property group template name and type
224 property template name and type
228 property group name and type
232 property name and type
239 \fB\fBSCF_TERR_CARDINALITY_VIOLATION\fR\fR
243 number of values violates cardinality
250 property group template name and type
254 property template name and type
258 property group name and type
262 property name and type
266 cardinality and cardinality limits
273 \fB\fBSCF_TERR_VALUE_CONSTRAINT_VIOLATED\fR\fR
277 constraint violated for value
284 property group template name and type
288 property template name and type
292 property group name and type
296 property name and type
307 \fB\fBSCF_TERR_RANGE_VIOLATION\fR\fR
311 value violated specified range
318 property group template name and type
322 property template name and type
326 property group name and type
330 property name and type
341 \fB\fBSCF_TERR_PROP_TYPE_MISMATCH\fR\fR
345 value type is different from property type
352 property group template name and type
356 property template name and type
363 \fB\fBSCF_TERR_VALUE_OUT_OF_RANGE\fR\fR
367 value is out of template defined range
374 property group template name and type
378 property template name and type
389 \fB\fBSCF_TERR_INVALID_VALUE\fR\fR
393 value violates template defined constraints
400 property group template name and type
404 property template name and type
414 The \fBSCF_TERR_PROP_TYPE_MISMATCH\fR, \fBSCF_TERR_VALUE_OUT_OF_RANGE\fR and
415 \fBSCF_TERR_INVALID_VALUE\fR types are only set from calls to
416 \fBscf_tmpl_value_in_constraint\fR(3SCF).
419 The \fBscf_tmpl_error_type()\fR function retrieves the error type.
422 The \fBscf_tmpl_error_source_fmri()\fR function retrieves a string with the
423 FMRI of the source of the template that was violated. This string is freed by
424 \fBscf_tmpl_errors_destroy()\fR.
427 The \fBscf_tmpl_error_pg_tmpl()\fR function retrieves strings with the name and
428 type of the property group template that was violated. If the property group
429 name or type was implicitly wildcarded (see \fBsmf_template\fR(5)) in the
430 template, this function returns a string containing \fBSCF_TMPL_WILDCARD\fR
431 ("*"). These strings are freed by \fBscf_tmpl_errors_destroy()\fR.
434 The \fBscf_tmpl_error_pg()\fR function retrieves strings with the name and type
435 of the property group that was violated. These strings are freed by
436 \fBscf_tmpl_errors_destroy()\fR.
439 The \fBscf_tmpl_error_prop_tmpl()\fR function retrieves strings with the name
440 and type of the property template that was violated. If the property type was
441 implicitly wildcarded (see \fBsmf_template\fR(5)) in the template, this
442 function returns a string containing \fBSCF_TMPL_WILDCARD\fR ("*"). These
443 strings are freed by \fBscf_tmpl_errors_destroy()\fR.
446 The \fBscf_tmpl_error_prop()\fR function retrieves strings with the name and
447 type of the property that was violated. These strings are freed by
448 \fBscf_tmpl_errors_destroy()\fR.
451 The \fBscf_tmpl_error_value()\fR function retrieves a string with the value
452 containing the error in \fIval\fR. This string are freed by
453 \fBscf_tmpl_errors_destroy()\fR.
456 The \fBscf_tmpl_strerror()\fR function takes an \fBscf_tmpl_error_t\fR
457 previously returned by \fBscf_tmpl_next_error()\fR and returns in \fIs\fR. If
458 flags includes \fBSCF_TMPL_STRERROR_HUMAN\fR, \fIs\fR is a human-readable,
459 localized description of the error. Otherwise, \fIs\fR is a one-line string
460 suitable for logfile output.
464 The \fBscf_tmpl_validate_fmri()\fR function returns 0 on successful completion
465 with no validation failures. It returns 1 if there are validation failures. It
466 returns -1 if there is an error validating the instance.
469 The \fBscf_tmpl_next_error()\fR function returns a pointer to the next
470 \fBscf_tmpl_error_t\fR. When none remain, it returns \fINULL\fR.
473 The \fBscf_tmpl_error_type()\fR, \fBscf_tmpl_error_source_fmri()\fR,
474 \fBscf_tmpl_error_pg_tmpl()\fR, \fBscf_tmpl_error_pg()\fR,
475 \fBscf_tmpl_error_prop_tmpl()\fR, \fBscf_tmpl_error_prop()\fR, and
476 \fBscf_tmpl_error_value()\fR functions return 0 on success and -1 on failure.
479 The \fBscf_tmpl_strerror()\fR function returns the number of bytes that would
480 have been written to s if n had been sufficiently large.
484 The \fBscf_tmpl_validate_fmri()\fR function will fail if:
488 \fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR
492 The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose
493 for the operation denied access.
499 \fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR
503 The connection to the repository was lost.
509 \fB\fBSCF_ERROR_DELETED\fR\fR
513 The instance or one of its template property group have been deleted.
519 \fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR
523 The handle passed in has been destroyed.
529 \fB\fBSCF_ERROR_INTERNAL\fR\fR
533 An internal error occurred.
539 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
543 The handle argument, FMRI argument, or snapshot name is invalid
549 \fB\fBSCF_ERROR_NO_MEMORY\fR\fR
553 There is not enough memory to validate the instance.
559 \fB\fBSCF_ERROR_NO_RESOURCES\fR\fR
563 The server does not have adequate resources to complete the request.
569 \fB\fBSCF_ERROR_NOT_BOUND\fR\fR
573 The handle is not currently bound.
579 \fB\fBSCF_ERROR_NOT_FOUND\fR\fR
583 An object matching FMRI does not exist in the repository, or the snapshot does
590 \fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR
594 The instance or template could not be read due to access restrictions.
600 \fB\fBSCF_ERROR_TEMPLATE_INVALID\fR\fR
604 The template data is invalid.
609 The \fBscf_tmpl_strerror()\fR, \fBscf_tmpl_error_type()\fR,
610 \fBscf_tmpl_error_source_fmri()\fR, \fBscf_tmpl_error_pg_tmpl()\fR,
611 \fBscf_tmpl_error_pg()\fR, \fBscf_tmpl_error_prop_tmpl()\fR,
612 \fBscf_tmpl_error_prop()\fR, and \fBscf_tmpl_error_value()\fR functions will
617 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
620 The \fBscf_tmpl_errors_t\fR argument is invalid.
625 The \fBscf_tmpl_error_type()\fR, \fBscf_tmpl_error_source_fmri()\fR,
626 \fBscf_tmpl_error_pg_tmpl()\fR, \fBscf_tmpl_error_pg()\fR,
627 \fBscf_tmpl_error_prop_tmpl()\fR, \fBscf_tmpl_error_prop()\fR, and
628 \fBscf_tmpl_error_value()\fR functions will fail if:
632 \fB\fBSCF_ERROR_NOT_FOUND\fR\fR
635 The data requested is not available for the \fBscf_tmpl_error_t\fR argument
642 See \fBattributes\fR(5) for descriptions of the following attributes:
650 ATTRIBUTE TYPE ATTRIBUTE VALUE
652 Interface Stability Committed
660 \fBsvc.configd\fR(1M), \fBscf_tmpl_value_in_constraint\fR(3SCF),
661 \fBattributes\fR(5), \fBsmf_template\fR(5)