Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
NAME
scftmplvalidatefmri, scftmplerrorsdestroy,
scftmplnexterror, scftmplreseterrors,
scftmplstrerror, scftmplerrortype,
scftmplerrorsourcefmri, scftmplerrorpgtmpl,
scftmplerrorpg, scftmplerrorproptmpl,
scftmplerrorprop, scftmplerrorvalue - template valida-
tion functions
SYNOPSIS
cc [ flag... ] file... -lscf [ library... ]
#include
int scftmplvalidatefmri(scfhandlet *h, const char *fmri,
const char *snapshot, scftmplerrorst **errs, int flags);
void scftmplerrorsdestroy(scftmplerrorst *errs);
scftmplerrort *scftmplnexterror(scftmplerrorst *errs,
scftmplerrorst *err)
void scftmplreseterrors(scftmplerrorst *errs);
int scftmplstrerror(scftmplerrort *err, char *s,
sizet n, int flags);
int scftmplerrortype(const scftmplerrort *err,
scftmplerrortypet *type);
int scftmplerrorsourcefmri(const scftmplerrort *err,
char *fmri);
int scftmplerrorpgtmpl(const scftmplerrort *err, char *name,
char *type);
int scftmplerrorpg(const scftmplerrort *err,
char **name, char **type);
int scftmplerrorproptmpl(const scftmplerrort *err, char **name,
char **type);
SunOS 5.11 Last change: 28 Oct 2008 1
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
int scftmplerrorprop(const scftmplerrort *err, char **name,
char **type,);
int scftmplerrorvalue(const scftmplerrort *err, char**val);
DESCRIPTION
The template validation functions offer a way to validate
the configuration data of an service instance against the
appropriate template data. The scftmplvalidatefmri()
function returns the full set of errors for the specified
instance, and those errors can be printed or explored
directly.
By default, the validation is performed on the composed data
from the running snapshot of an instance. A different
snapshot can be explicitly selected by specifying a valid
snapshot name rather than NUL for the snapshot argument. If
flags includes SCFTMPLVALIDATEFLAGCURENT, the snapshot
argument is ignored and the current configuration is used.
By default, these functions also explore template data
defined by the service or instance itself, the service's
restarter, and global template data. See smftemplate(5) for
more information about this composition.
An instance FMRI is required, and FMRIs that specify other
entities (for example, services) are explicitly rejected.
The scftmplvalidatefmri() function validates an instance
FMRI against the template data in the repository. As
described above, when the snapshot argument is NUL, the
default running snapshot is used. If scftmplerrorst ** is
non-null, the structure is allocated and returned to the
caller for further perusal or printing of the errors.
The scftmplerrorsdestroy() function destroys and frees
the scftmplerrorst and all of the scftmplerrort struc-
tures to which it refers.
The scftmplnexterror() function takes a pointer to a
scftmplerrorst structure previously returned by
scftmplvalidatefmri(). On the first call, it returns a
pointer to the first scftmplerrort found during
SunOS 5.11 Last change: 28 Oct 2008 2
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
validation. On subsequent calls, the next error is returned.
To resume processing from the first error, the caller can
use scftmplreseterrors().
The contents of an scftmplerrort are determined by its
type. Types added as additional validation checks are intro-
duced. Based on the error type, a set of fields can be
retrieved from the error.
SCFTERTYPEINVALID
reserved invalid type
SCFTERMISINGPG
required property group is missing
template source FMRI
property group template name and type
SCFTERWRONGPGTYPE
property group type is incorrect
template source FMRI
property group template name and type
property group name and type
SCFTERMISINGPROP
required property is missing
template source FMRI
property group template name and type
property template name and type
SCFTERWRONGPROPTYPE
property type is incorrect
template source FMRI
property group template name and type
property template name and type
property group name and type
property name and type
SCFTERCARDINALITYVIOLATION
number of values violates cardinality
SunOS 5.11 Last change: 28 Oct 2008 3
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
template source FMRI
property group template name and type
property template name and type
property group name and type
property name and type
cardinality and cardinality limits
SCFTERVALUECONSTRAINTVIOLATED
constraint violated for value
template source FMRI
property group template name and type
property template name and type
property group name and type
property name and type
value
SCFTERANGEVIOLATION
value violated specified range
template source FMRI
property group template name and type
property template name and type
property group name and type
property name and type
value
SCFTERPROPTYPEMISMATCH
value type is different from property type
template source FMRI
property group template name and type
property template name and type
SCFTERVALUEOUTOFRANGE
value is out of template defined range
template source FMRI
property group template name and type
property template name and type
value
SCFTERINVALIDVALUE
value violates template defined constraints
template source FMRI
SunOS 5.11 Last change: 28 Oct 2008 4
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
property group template name and type
property template name and type
value
The SCFTERPROPTYPEMISMATCH, SCFTERVALUEOUTOFRANGE
and SCFTERINVALIDVALUE types are only set from calls to
scftmplvalueinconstraint(3SCF).
The scftmplerrortype() function retrieves the error type.
The scftmplerrorsourcefmri() function retrieves a string
with the FMRI of the source of the template that was
violated. This string is freed by scftmplerrorsdestroy().
The scftmplerrorpgtmpl() function retrieves strings with
the name and type of the property group template that was
violated. If the property group name or type was implicitly
wildcarded (see smftemplate(5)) in the template, this func-
tion returns a string containing SCFTMPLWILDCARD ("*").
These strings are freed by scftmplerrorsdestroy().
The scftmplerrorpg() function retrieves strings with the
name and type of the property group that was violated. These
strings are freed by scftmplerrorsdestroy().
The scftmplerrorproptmpl() function retrieves strings
with the name and type of the property template that was
violated. If the property type was implicitly wildcarded
(see smftemplate(5)) in the template, this function returns
a string containing SCFTMPLWILDCARD ("*"). These strings
are freed by scftmplerrorsdestroy().
The scftmplerrorprop() function retrieves strings with
the name and type of the property that was violated. These
strings are freed by scftmplerrorsdestroy().
The scftmplerrorvalue() function retrieves a string with
the value containing the error in val. This string are freed
by scftmplerrorsdestroy().
SunOS 5.11 Last change: 28 Oct 2008 5
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
The scftmplstrerror() function takes an scftmplerrort
previously returned by scftmplnexterror() and returns in
s. If flags includes SCFTMPLSTRERORHUMAN, s is a human-
readable, localized description of the error. Otherwise, s
is a one-line string suitable for logfile output.
RETURN VALUES
The scftmplvalidatefmri() function returns 0 on success-
ful completion with no validation failures. It returns 1 if
there are validation failures. It returns -1 if there is an
error validating the instance.
The scftmplnexterror() function returns a pointer to the
next scftmplerrort. When none remain, it returns NUL.
The scftmplerrortype(), scftmplerrorsourcefmri(),
scftmplerrorpgtmpl(), scftmplerrorpg(),
scftmplerrorproptmpl(), scftmplerrorprop(), and
scftmplerrorvalue() functions return 0 on success and -1
on failure.
The scftmplstrerror() function returns the number of bytes
that would have been written to s if n had been sufficiently
large.
ERORS
The scftmplvalidatefmri() function will fail if:
SCFERORBACKENDACES
The storage mechanism that the repository server
(svc.configd(1M)) chose for the operation denied access.
SCFERORCONECTIONBROKEN
The connection to the repository was lost.
SCFERORDELETED
The instance or one of its template property group have
been deleted.
SCFERORHANDLEDESTROYED
The handle passed in has been destroyed.
SunOS 5.11 Last change: 28 Oct 2008 6
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
SCFERORINTERNAL
An internal error occurred.
SCFERORINVALIDARGUMENT
The handle argument, FMRI argument, or snapshot name is
invalid
SCFERORNOMEMORY
There is not enough memory to validate the instance.
SCFERORNORESOURCES
The server does not have adequate resources to complete
the request.
SCFERORNOTBOUND
The handle is not currently bound.
SCFERORNOTFOUND
An object matching FMRI does not exist in the reposi-
tory, or the snapshot does not exist.
SCFERORPERMISIONDENIED
The instance or template could not be read due to access
restrictions.
SCFERORTEMPLATEINVALID
The template data is invalid.
The scftmplstrerror(), scftmplerrortype(),
scftmplerrorsourcefmri(), scftmplerrorpgtmpl(),
scftmplerrorpg(), scftmplerrorproptmpl(),
scftmplerrorprop(), and scftmplerrorvalue() functions
will fail if:
SunOS 5.11 Last change: 28 Oct 2008 7
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
SCFERORINVALIDARGUMENT The scftmplerrorst argument
is invalid.
The scftmplerrortype(), scftmplerrorsourcefmri(),
scftmplerrorpgtmpl(), scftmplerrorpg(),
scftmplerrorproptmpl(), scftmplerrorprop(), and
scftmplerrorvalue() functions will fail if:
SCFERORNOTFOUND The data requested is not available
for the scftmplerrort argument
supplied.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level Safe
SEE ALSO
svc.configd(1M), scftmplvalueinconstraint(3SCF), attri-
butes(5), smftemplate(5)
SunOS 5.11 Last change: 28 Oct 2008 8
Service Configuration Facility Library Functions
scftmplvalidatefmri(3SCF)
SunOS 5.11 Last change: 28 Oct 2008 9
|