
Thanks. I do not have the spec handy, but it just makes sense to add all INDEX columns as parameters. I have checked the patch into the
Well, I've found a draft version of the spec on the Lucent website (they have a gateway). (the official spec has to be paid http://www.opengroup.org/publications/catalog/c802.htm and the free HTML version is a dangling link. In http://www.opengroup.org/onlinepubs/8349099/toc.htm which I've found via google, I haven't found this though...)
The draft says: For each IDL interface generated for groups/table-entries, one IDL operation is defined. The name of the IDL operation is derived by concatenating the identifier of the interface to the string create_ (in the form of create_<interface_id>() ). The return value of the operations is the type of the IDL interface. In addition to the criteria parameter (which is always defined as the last parameter), the types and names of the other parameters of a operation are derived from the index variables and those column variables with read-write and read-create mode of the corresponding group/table-entry. It is assumed that the IDL interface for a group does not have any index variables.
Anyway, feel free to send more feedback about the JIDM CORBA backend and I would certainly be interested whether you are planning to use this for any production tools or just for academic purposes.
okay, attached you can find a new patch (against libsmi0.3.0) which includes the previous one and contains also a patch to add INDEX columns which are imported from other MIBs to the importList, so that a typedef can be added for them. Problem was with the DiffServ MIB (v16): for the DataPathTable, ifIndex (type InterfaceIndex) is an INDEX (imported from IF-MIB), but its type wasn't typedef'ed in IDL (and is used now in the 'create' functions in the SmiEntryFactory interface).
I've also added the extra check : if (smiNode->indexkind == SMI_INDEX_INDEX || smiNode->indexkind == SMI_INDEX_REORDER) { in fprintConstructor before running through the INDEXes.
I don't know if this is required (I'm not an expert in MIBs), but I copied it from fprintRowInterface.
I'm just using it for converting the DiffServ MIB to IDL because I'm trying to manage DiffServ domains with CORBA (please don't shoot me for this :-) ) and wanted to use the already-done work on creating a model for a DiffServ router. And yes, it's for academic purposes (a PhD). And that conversion looks good now. I'll send other patches if necessary. Thanks for the great tool.
regards, Brecht
diff -c -r ./temp_orig/libsmi-0.3.0.orig/tools/dump-corba.c ./libsmi-0.3.0/tools/dump-corba.c *** ./temp_orig/libsmi-0.3.0.orig/tools/dump-corba.c Fri Nov 9 14:48:11 2001 --- ./libsmi-0.3.0/tools/dump-corba.c Wed Mar 6 16:06:06 2002 *************** *** 529,540 **** SmiNode *smiNode; SmiType *smiType; SmiModule *smiTypeModule; ! SmiNodekind kind = SMI_NODEKIND_SCALAR | SMI_NODEKIND_COLUMN;
for (smiNode = smiGetFirstNode(smiModule, kind); smiNode; smiNode = smiGetNextNode(smiNode, kind)) { ! smiType = smiGetNodeType(smiNode); if (smiType) { smiTypeModule = smiGetTypeModule(smiType); --- 529,566 ---- SmiNode *smiNode; SmiType *smiType; SmiModule *smiTypeModule; ! SmiNodekind kind = SMI_NODEKIND_SCALAR | SMI_NODEKIND_COLUMN | SMI_NODEKIND_ROW; ! SmiNode *smiNodeIndex; ! SmiElement *smiElement; ! int j;
for (smiNode = smiGetFirstNode(smiModule, kind); smiNode; smiNode = smiGetNextNode(smiNode, kind)) { ! switch(smiNode->nodekind) { ! case SMI_NODEKIND_ROW: /* Test also if Indexes of tables have to be imported */ ! for (j = 0, smiElement = smiGetFirstElement(smiNode); ! smiElement; ! j++, smiElement = smiGetNextElement(smiElement)) { ! smiNodeIndex = smiGetElementNode(smiElement); ! smiType = smiGetNodeType(smiNodeIndex); ! if (smiType) { ! smiTypeModule = smiGetTypeModule(smiType); ! if (smiTypeModule && ! strcmp(smiTypeModule->name, smiModule->name)) { ! if (strlen(smiTypeModule->name)) { ! addImport(smiTypeModule->name, smiType->name); ! } ! } ! if (smiType->basetype == SMI_BASETYPE_INTEGER32) { ! addImport("SNMPv2-SMI", "Integer32"); ! } ! } ! ! } ! break; ! case SMI_NODEKIND_SCALAR: ! case SMI_NODEKIND_COLUMN: smiType = smiGetNodeType(smiNode); if (smiType) { smiTypeModule = smiGetTypeModule(smiType); *************** *** 548,553 **** --- 574,581 ---- addImport("SNMPv2-SMI", "Integer32"); } } + break; + } } }
*************** *** 1078,1085 **** --- 1106,1115 ---- static void fprintConstructor(FILE *f, SmiNode *smiNode) { SmiNode *childNode; + SmiNode *indexNode; SmiType *smiType; SmiModule *smiModule; + SmiElement *smiElement; char *idlNodeName; char *idlChildNodeName, *idlChildTypeName; int cnt = 0; *************** *** 1091,1116 **** fprintSegment(f, 2*INDENT, "", 0); fprint(f, "%s create_%s (\n", idlNodeName, idlNodeName);
! /* XXX I think we need to include INDEX columns here XXX */ for (childNode = smiGetFirstChildNode(smiNode); childNode; childNode = smiGetNextChildNode(childNode)) { if ((childNode->nodekind == SMI_NODEKIND_SCALAR || childNode->nodekind == SMI_NODEKIND_COLUMN) && current(childNode->status) && childNode->access == SMI_ACCESS_READ_WRITE) {
! cnt++; ! idlChildNodeName = getIdlNodeName(smiGetNodeModule(childNode)->name, childNode->name); ! smiType = smiGetNodeType(childNode); ! idlChildTypeName = getIdlAnyTypeName(childNode, smiType); ! if (cnt > 1) { fprint(f, ",\n"); } - fprintSegment(f, 3*INDENT, "in ", 0); - fprint(f, "%s %s", idlChildTypeName, idlChildNodeName); } } fprint(f, "\n"); --- 1121,1182 ---- fprintSegment(f, 2*INDENT, "", 0); fprint(f, "%s create_%s (\n", idlNodeName, idlNodeName);
! /* First we include the INDEXes */ ! if (smiNode->indexkind == SMI_INDEX_INDEX ! || smiNode->indexkind == SMI_INDEX_REORDER) { ! for (smiElement = smiGetFirstElement(smiNode); smiElement; smiElement = smiGetNextElement(smiElement)) { ! cnt++; ! indexNode = smiGetElementNode(smiElement); ! idlChildNodeName = ! getIdlNodeName(smiGetNodeModule(indexNode)->name, ! indexNode->name); ! smiType = smiGetNodeType(indexNode); ! idlChildTypeName = getIdlAnyTypeName(indexNode, smiType); ! if (cnt > 1) { ! fprint(f, ",\n"); ! } ! fprintSegment(f, 3*INDENT, "in ", 0); ! fprint(f, "%s %s", idlChildTypeName, idlChildNodeName); ! } ! } ! for (childNode = smiGetFirstChildNode(smiNode); childNode; childNode = smiGetNextChildNode(childNode)) { + if ((childNode->nodekind == SMI_NODEKIND_SCALAR || childNode->nodekind == SMI_NODEKIND_COLUMN) && current(childNode->status) && childNode->access == SMI_ACCESS_READ_WRITE) { + int matched = 0;
! /* Test if this column is already used as parameter because it is an index */ ! if (smiNode->indexkind == SMI_INDEX_INDEX ! || smiNode->indexkind == SMI_INDEX_REORDER) { ! for (smiElement = smiGetFirstElement(smiNode); ! smiElement; ! smiElement = smiGetNextElement(smiElement)) { ! indexNode = smiGetElementNode(smiElement); ! if (!strcmp(indexNode->name, childNode->name)) { ! matched = 1; ! break; // already index column ! } ! } ! } ! ! if (!matched) { ! cnt++; ! idlChildNodeName = getIdlNodeName(smiGetNodeModule(childNode)->name, childNode->name); ! smiType = smiGetNodeType(childNode); ! idlChildTypeName = getIdlAnyTypeName(childNode, smiType); ! if (cnt > 1) { fprint(f, ",\n"); + } + fprintSegment(f, 3*INDENT, "in ", 0); + fprint(f, "%s %s", idlChildTypeName, idlChildNodeName); } } } fprint(f, "\n");