|
|
Although syntactically correct, ``Example CDT (Tcl)'' defines a non-existent class (``sco user''):
Example CDT (Tcl)
#=========================================================================== # CDT(class) # # This is the name of the class. #---------------------------------------------------------------------------set users(class) {sco user}
#=========================================================================== # OFBinding <class array> # # This call to the Object API library binds the class described by the <class # array> to the Object API. Thus those procedures that call the scoAdmin Library # can access this class via the Object API connection. #---------------------------------------------------------------------------
OFBinding users
The call to OFBinding(3tlib) passes the CDT to the Server API so that it can call on the execution procedures belonging to the object class when needed. It is noteworthy that the CDT entries explained above and used in this example are the ones recognized and used by Server API. The OSA writer is free to add as many more CDT entries as desired.
``Example CDT (C/C++)'' is the same OSA written in C/C++ code; note that all four of the CDT description tables are composed of NULL terminated array/lists.
Example CDT (C/C++)
#include "osaStdDef.h"#define ATTR_UID 1 #define ATTR_GID 2 #define ATTR_SHELL 3 #define ATTR_HOME 4 #define ATTR_NAME 5
bool_t OsaCMain(int , /* argc is ignored by OsaCMain */ char **, /* argv is ignored by OsaCMain */ errStatus_cl *errStatusPtr) { OFBinding(errStatusPtr, sco user, attr, sizeof(attr)/sizeof(OSAAttr_t), group, sizeof(group)/sizeof(OSAGroup_t), op, sizeof(op)/sizeof(OSAOp_t), NULL, /* Use the default request processor */ subordinates, NULL); /* It has no misc data */
if (!ErrorIsOk(errStatusPtr)) return FALSE;
return TRUE; }