Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
NAME
scfvaluecreate, scfvaluehandle, scfvaluereset,
scfvaluedestroy, scfvaluetype, scfvaluebasetype,
scfvalueistype, scftypebasetype,
scfvaluegetboolean, scfvaluegetcount,
scfvaluegetinteger, scfvaluegettime,
scfvaluegetastring, scfvaluegetustring,
scfvaluegetopaque, scfvaluegetasstring,
scfvaluegetasstringtyped, scfvaluesetboolean,
scfvaluesetcount, scfvaluesetinteger,
scfvaluesettime, scfvaluesetfromstring,
scfvaluesetastring, scfvaluesetustring,
scfvaluesetopaque - manipulate values in the Service Con-
figuration Facility
SYNOPSIS
cc [ flag... ] file... -lscf [ library... ]
#include
scfvaluet *scfvaluecreate(scfhandlet *h);
scfhandlet *scfvaluehandle(scfvaluet *v);
void scfvaluereset(scfvaluet *v);
void scfvaluedestroy(scfvaluet *v);
int scfvaluetype(scfvaluet *v);
int scfvaluebasetype(scfvaluet *v);
int scfvalueistype(scfvaluet *v, scftypet type);
int scftypebasetype(scftypet type, scftypet *out);
int scfvaluegetboolean(scfvaluet *v, uint8t *out);
int scfvaluegetcount(scfvaluet *v, uint64t *out);
int scfvaluegetinteger(scfvaluet *v, int64t *out);
SunOS 5.11 Last change: 16 Oct 2008 1
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
int scfvaluegettime(scfvaluet *v, int64t *seconds,
int32t *ns);
ssizet scfvaluegetastring(scfvaluet *v, char *buf,
sizet size);
ssizet scfvaluegetustring(scfvaluet *v, char *buf,
sizet size);
ssizet scfvaluegetopaque(scfvaluet *v, char *out,
sizet len);
ssizet scfvaluegetasstring(scfvaluet *v, char *buf,
sizet size);
ssizet scfvaluegetasstringtyped(scfvaluet *v,
scftypet type, char *buf, sizet size);
void scfvaluesetboolean(scfvaluet *v, uint8t in);
void scfvaluesetcount(scfvaluet *v, uint64t in);
void scfvaluesetinteger(scfvaluet *v, int64t in);
int scfvaluesettime(scfvaluet *v, int64t seconds,
int32t ns);
int scfvaluesetfromstring(scfvaluet *v, scftypet type,
char *in);
int scfvaluesetastring(scfvaluet *v, const char *in);
int scfvaluesetustring(scfvaluet *v, const char *in);
int scfvaluesetopaque(scfvaluet *v, void *in, sizet sz);
SunOS 5.11 Last change: 16 Oct 2008 2
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
DESCRIPTION
The scfvaluecreate() function creates a new, reset
scfvaluet that holds a single typed value. The value can
be used only with the handle specified by h and objects
associated with h.
The scfvaluereset() function resets the value to the unin-
itialized state. The scfvaluedestroy() function deallo-
cates the object.
The scfvaluetype() function retrieves the type of the con-
tents of v. The scfvalueistype() function determines if a
value is of a particular type or any of its subtypes. The
scftypebasetype() function returns the base type of type.
The scfvaluebasetype() function returns the true base
type of the value (the highest type reachable from the
value's type).
Type Identifier Base Type Type Description
SCFTYPEINVALID reserved invalid type
SCFTYPEBOLEAN single bit
SCFTYPECOUNT unsigned 64-bit quantity
SCFTYPEINTEGER signed 64-bit quantity
SCFTYPETIME signed 64-bit seconds, signed 32-bit
nanoseconds in the range 0 <= ns <
1,000,000,000
SCFTYPEASTRING 8-bit NUL-terminated string
SCFTYPEOPAQUE opaque 8-bit data
SCFTYPEUSTRING ASTRING 8-bit UTF-8 string
SCFTYPEURI USTRING a URI string
SCFTYPEFMRI URI a Fault Management Resource Identifier
SCFTYPEHOST USTRING either a hostname, IPv4 address, or
IPv6 address
SCFTYPEHOSTNAME HOST a fully-qualified domain name
SCFTYPENETADRV4 HOST a dotted-quad IPv4 address with
optional network portion
SCFTYPENETADRV6 HOST legal IPv6 address
The scfvaluegetboolean(), scfvaluegetcount(),
scfvaluegetinteger(), scfvaluegettime(),
scfvaluegetastring(), scfvaluegetustring(), and
scfvaluegetopaque() functions read a particular type of
value from v.
SunOS 5.11 Last change: 16 Oct 2008 3
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
The scfvaluegetasstring() and
scfvaluegetasstringtyped() functions convert the value
to a string form. For scfvaluegetasstringtyped(), the
value must be a reachable subtype of type.
The scfvaluesetboolean(), scfvaluesetcount(),
scfvaluesetinteger(), scfvaluesettime(),
scfvaluesetastring(), scfvaluesetustring(), and
scfvaluesetopaque() functions set v to a particular value
of a particular type.
The scfvaluesetfromstring() function is the inverse of
scfvaluegetasstring(). It sets v to the value encoded in
buf of type type.
The scfvalueset*() functions will succeed on scfvaluet
objects that have already been set.
RETURN VALUES
Upon successful completion, scfvaluecreate() returns a
new, reset scfvaluet. Otherwise, it returns NUL.
Upon successful completion, scfvaluehandle() returns the
handle associated with v. Otherwise, it returns NUL.
The scfvaluebasetype() function returns the base type of
the value, or SCFTYPEINVALID on failure.
Upon successful completion, scfvaluetype() returns the
type of the value. Otherwise, it returns SCFTYPEINVALID.
Upon successful completion, scfvalueistype(),
scfvaluegetboolean(), scfvaluegetcount(),
scfvaluegetinteger(), scfvaluegettime(),
scfvaluesettime(), scfvaluesetfromstring(),
scfvaluesetastring(), scfvaluesetustring(), and
scfvaluesetopaque() return 0. Otherwise, they return -1.
Upon successful completion, scfvaluegetastring(),
scfvaluegetustring(), scfvaluegetasstring(), and
scfvaluegetasstringtyped() return the length of the
string written, not including the terminating null byte.
Otherwise, they return -1.
SunOS 5.11 Last change: 16 Oct 2008 4
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
Upon successful completion, scfvaluegetopaque() returns
the number of bytes written. Otherwise, it returns -1.
ERORS
The scfvaluecreate() function will fail if:
SCFERORHANDLEDESTROYED The handle associated with h
has been destroyed.
SCFERORINVALIDARGUMENT The handle is NUL.
SCFERORNOMEMORY There is not enough memory to
allocate an scfvaluet.
The scfvaluehandle() function will fail if:
SCFERORHANDLEDESTROYED The handle associated with v
has been destroyed.
The scfvaluesettime() function will fail if:
SCFERORINVALIDARGUMENT The nanoseconds field is not
in the range 0 <= ns <
1,000,000,000.
The scftypebasetype() function will fail if:
SCFERORINVALIDARGUMENT The type argument is not a
valid type.
The scfvaluesetastring(), scfvaluesetustring(),
scfvaluesetopaque(), and scfvaluesetfromstring()
functions will fail if:
SCFERORINVALIDARGUMENT The in argument is not a valid
value for the specified type
or is longer than the maximum
supported value length.
SunOS 5.11 Last change: 16 Oct 2008 5
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
The scftypebasetype(), scfvalueistype(), and
scfvaluegetasstringtyped() functions will fail if:
SCFERORINVALIDARGUMENT The type argument is not a
valid type.
The scfvaluetype(), scfvaluebasetype(),
scfvaluegetboolean(), scfvaluegetcount(),
scfvaluegetinteger(), scfvaluegettime(),
scfvaluegetastring(), scfvaluegetustring(),
scfvaluegetasstring(),
andscfvaluegetasstringtyped() functions will fail if:
SCFERORNOTSET The v argument has not been set to a
value.
The scfvaluegetboolean(), scfvaluegetcount(),
scfvaluegetinteger(), scfvaluegettime(),
scfvaluegetastring(), scfvaluegetustring(), and
scfvaluegetasstringtyped() functions will fail if:
SCFERORTYPEMISMATCH The requested type is not the
same as the value's type and is
not in the base-type chain.
The scferror(3SCF) function can be used to retrieve the
error value.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 16 Oct 2008 6
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level Safe
SEE ALSO
libscf(3LIB), scfentryaddvalue(3SCF), scferror(3SCF),
attributes(5)
SunOS 5.11 Last change: 16 Oct 2008 7
Service Configuration Facility Library Functions
scfvaluecreate(3SCF)
SunOS 5.11 Last change: 16 Oct 2008 8
|