DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

FWClassOperations(3sadm)


FWClassOperations: FWObjectCreate, FWObjectDelete, FWObjectAdd, FWObjectRemove, FWObjectReplace, FWObjectReplaceWithDefault, FWObjectAction, FWObjectGet -- Perform an operation on a SCOadmin object class

Synopsis

CC ... -lsysadm -lvtcl -ltclx -ltcl -lsocket -lgen -lm

#include <scoadmin/basicIncl.h> #include <scoadmin/callBack.h> #include <scoadmin/statusLst.h> #include <scoadmin/CAPI.h>

void FWObjectCreate( bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, objectInstance_pt referenceObject, char **attributes, char **values, errStatus_cl *errStatusPtr); void FWObjectDelete( bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, errStatus_cl *errStatusPtr); void FWObjectAdd( bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, char **attributes, char **values, errStatus_cl *errStatusPtr); void FWObjectRemove( bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, char **attributes, char **values, errStatus_cl *errStatusPtr); void FWObjectReplace(bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, char **attributes, char **values, errStatus_cl *errStatusPtr); void FWObjectReplaceWithDefault (bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, char **attributes, errStatus_cl *errStatusPtr);

actionInfo_pt FWObjectAction( bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, actionType_pt actionType, actionInfo_pt actionInfo, errStatus_cl *errStatusPtr);

attributeList_pt FWObjectGet( bmipSubmission_cl *bmipSubmissionPtr, objectInstance_pt objectInstance, char **attributes, errStatus_cl *errStatusPtr);

Description

These functions perform operations on SCOadmin object classes. All calls to these functions must be proceeded by calls to FWInitializeFrameWork() and FWInitObjectSubmission(). Unless an error stack is placed in the errorStatus_cl errStatusPtr parameter, the operation can be assumed to have been sent to the named object class and operated on.

In the cases of FWObjectGet() the framework will return a Tcl keyed list of attribute-value pairs.

In the case of FWObjectAction() the framework will return the named action information. In cases where more than one Response is to be returned to the caller, the caller will need to use the FWExamineNextObject*() routines.

When the user no longer needs the named object class they should clean up with FWShutdownObjectSubmission(). When the user no longer needs the framework they should clean up with FWShutdownFrameWork().

Arguments


bmipSubmissionPtr
object class specific data pointer obtained from a prior call to FWInitObjectSubmission(3sadm).

referenceObject
A single object instance that represents the reference object for use in the create operation. For example, a printer reference object might be used as a template for the creation of new printers. This allows the "cloning" of existing object instances. Reference objects are not supported by all object classes.

attributes
A list of attributes to be operated on, or retrieved. These are named in a NULL terminated array of type char *. Once given to the routine the memory allocated to this array, and the values it points to, can be freed.

values
A list of values, to be assigned to the attributes given by the attributes argument. These values are named in a NULL terminated array of type char *. Once given to this function, the memory allocated to this array, and the values it points to, can be freed.

actionType
An object class-specific action type. This is a text string identifying the type of action to take on an object class.

actionInfo
A text string, containing object class-specific information associated with a specific action type.

errStatusPtr
A pointer to the error stack data structure. If an error occurs the appropriate error will be placed in the error stack. This data can be referenced using the library functions defined in Error(3sadm).

Examples

/* Example 1 - Obtain the information about all CD-ROM devices on the system */

#include <scoadmin/basicIncl.h> #include <scoadmin/callBack.h> #include <scoadmin/statusLst.h> #include <scoadmin/CAPI.h>

main() { frameWorkCClientData_cl *clientDataPtr; bmipSubmission_cl *bmipSubmissionPtr;

/* Set scoping and filtering parameters for later use. */ scopeParameter_pt scope ="1"; filterParameter_pt filter="type eq cdrom";

/* * Since we are looking at all of the devices, there is no specific * instance. */ objectInstance_pt instance="NULL";

/* Specifically look at the desc and mountpt attributes. */ char **attributes={"desc", "mountpt", "\0"};

/* Initialize the SCOadmin error stack. */ errStatus_cl *errStatusPtr=ErrorNew();

/* Variable used for the return value of ObjectGet(). */ attributeList_pt *attributeList;

/* Initialize general SCOadmin data structure. */ clientDataPtr=FWInitializeFrameWork();

/* Initialize class-specific SCOadmin data structures. */

/* Initialize communications to the "sco devices" class. */

bmipSubmissionPtr=FWInitObjectSubmission(clientDataPtr, "sco devices");

/* Identify this as a scoped request */ FWSetScope(bmipSubmissionPtr, scope);

/* Filter against the "type" attribute. Search only for type "cdrom". */ FWSetFilter(bmipSubmissionPtr, filter);

/* Actually get information from the object classes. */ attributeList=ObjectGet(bmipSubmissionPtr,instance,attributes,errStatusPtr); if( ! ErrorIsOk(errStatusPtr) ) { ErrorOutput(errStatusPtr, stderr, 0, argv[0]); exit(1); }

/* Unset filter parameters. */ FWUnSetScope(bmipSubmissionPtr); FWUnSetFilter(bmipSubmissionPtr);

/* Cleanup */ FWShutdownObjectSubmission(bmipSubmissionPtr); FWShutdownFrameWork(clientDataPtr); }

/* Example 2 - Change the home directory of user test1 to "/tmp/test1". */

#include <scoadmin/basicIncl.h> #include <scoadmin/callBack.h> #include <scoadmin/statusLst.h> #include <scoadmin/CAPI.h>

main() { frameWorkCClientData_cl *clientDataPtr; bmipSubmission_cl *bmipSubmissionPtr;

objectInstance_pt instance = "test1"; char **attributes= {"pw_dir", "\0"}; char **values = {"/tmp/test1", "\0"};

errStatus_cl *errStatusPtr=ErrorNew();

/* Initialize general SCOadmin data structure */ clientDataPtr=FWInitializeFrameWork();

/* Initialize class-specific SCOadmin data structures */ /* Initialize communications to the "sco user" class. */ bmipSubmissionPtr=FWInitObjectSubmission(clientDataPtr, "sco user");

/* Actually replace the home directory information. */ ObjectReplace(bmipSubmissionPtr,instance,attributes,values,errStatusPtr);

/* Handle errors */ if( ! ErrorIsOk(errStatusPtr) ) { ErrorOutput(errStatusPtr, stderr, 0, argv[0]); exit(1);

}

/* Cleanup */ FWShutdownObjectSubmission(bmipSubmissionPtr); FWShutdownFrameWork(clientDataPtr); }

References

FWInitializeFrameWork(3sadm), FWInitObjectSubmission(3sadm).
25 April 2004
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004