Hi,
I don't know if anyone is using the -f corba functionality of smidump,
but as indicated in the source-file dump-corba.c :
/* XXX I think we need to include INDEX columns here XXX */
it is indeed needed (as far as I know and as far as I can find in the
JIDM documents, otherwise you can't create rows when an index column is
non-accessible or read-only) to add the index columns always to the
create_xxx functions in the
interface SmiEntryFactory : SNMPMgmt::GenericFactory {
which are used to create rows in tables.
So, in attachment you can find a patch which solves this. (for
libsmi-0.3.0).
It's the first time I write some code with libsmi, so I hope it's
correct :-).
regards,
Brecht
diff -c -r ../temp/libsmi-0.3.0.orig/tools/dump-corba.c ./tools/dump-corba.c
*** ../temp/libsmi-0.3.0.orig/tools/dump-corba.c Fri Nov 9 14:48:11 2001
--- ./tools/dump-corba.c Wed Mar 6 00:37:22 2002
***************
*** 1078,1085 ****
--- 1078,1087 ----
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");
--- 1093,1146 ----
fprintSegment(f, 2*INDENT, "", 0);
fprint(f, "%s create_%s (\n", idlNodeName, idlNodeName);
! /* First we include the INDEXes */
! 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 */
! 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");