/ Define objects for accessing SMI MIB modules SmiModule* smiModule; SmiModule* modules = NULL; // ......... // Initialize smilnit (NULL) ; // Identify number of modules modules = (SmiModule **) malloc ( argc * sizeof (SmiModule *) ) ; moduleCount = 0; while ( optind < argc ) { i = optind++; modulename = smiLoadModule (argv [i] ) i smiModule = modulename ? smiGetModule (modulename) : NULL; Application Layer if ( ! smiModule ) { fprintf (stderr, "Cannot locate module `%s'\n", argv [i] ) ; // Get total module count modules[moduleCount++] = smiModule; // Call convert to XML function - createXML file = fopen (filename, "w") i for ( i = 0; i < moduleCount; i++ ) smiModule = modules [i] ; createXml (smiModule, file); fclose (file) i Step 3: Convert the data to XML. The output needs to describe each event with the object identifier, event identifier, event label, and description. Read through the comments to understand program flow. void createXml (SmiModule* smiModule, FILE* file) SmiNode* smiNode; SmiNode* tmpNode SmiElement* smiElem; int i; int j ; int len; char* logmsg; smiNode = smiGetFirstNode (smiModule, SMI NODEKIND_ NOTIFICATION) ; fprintf (file, "<!- Start of xml generated from MIB: %S -->\n", smiModule->name) ; for (i smiNode; smiNode = smiGetNextNode (smiNode, SMI_ NODEKIND NOTIFICATION) ) Fundamentals of EMS, NMS and OSS/BSS fprintf (file, "<event>\n"); fprintf (file, "\t<objIdf>") len = smiNode->oidlen; // Print the Object Identifier for ( j =0;j<len; j++ = ) { fprintf (file, ".%d", smiNode->oid[jl); - fprintf (file, "</objIdf>\n"); // Print the Event Identifier fprintf (file, "\t<eventIdf>%s</eventIdf>\n", smiNode->name) ; // Print the Event Label fprintf(file, "\t<eventLabel>%s defined trap event: %s</eventLabel>\n", smiModule - >name, smiNode->name); // Print the Event Description fprintf(file, "\t<description> %S", smiNode- >description) ; fprintf (file, "</descriptor>\n"); fprintf (file, "</event>\n"); fprintf(file, "<!- End of xml generated from MIB: %S -->\n", smiModule - >name) ; b. Compile the pro