le = 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 program with libsmi library. # gcc mibtrap2xml. -lsmi C. Run the executable with the MIB file as input and check the converted XML output. // Example - files usually available in MIB folders // Usual folder in linux systems: /usr/share/snmp/ # mibtrap2xml SNMPv2-MIB.txt # mibtrap2xml IF-MIB.txt Application Layer d. Sample outputs Example 1: Output for SNMPv2-MIB <!-- Start of xml generated from MIB: SNMPv2-MIB --> <event> <objIdf>.1.3.6.1.6.3.1.1.5.1</objIdf> keventIdf>coldStart</eventIdf> <eventLabel>SNMPv2-MIB defined trap event: coldStart</eventLabel> <description> A coldStart trap signifies th