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);
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().
/* 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); }