bool TMXLoader::Private::load(const char *f) { TinyXML::XMLDocument l_tmx; XMLElement *l_root; is_loaded = false; if (l_tmx.LoadFile(f) != XML_NO_ERROR) return(false); /* get parent directory */ base_directory = Core::Platform::PathDirectory(f); /* parse general map data */ if (!(l_root = l_tmx.RootElement()) || !processMap(*l_root)) return(false); /* parse tilesets */ XMLElement *l_tileset = l_root->FirstChildElement(TMXTILESET_NODE); while (l_tileset) { if (!processTileset(*l_tileset)) return(false); l_tileset = l_tileset->NextSiblingElement(TMXTILESET_NODE); } /* parse layers and object groups */ XMLElement *l_element = l_root->FirstChildElement(); while (l_element) { if (0 == strcmp(l_element->Value(), TMXLAYER_NODE) && !processLayer(*l_element)) return(false); else if (0 == strcmp(l_element->Value(), TMXOBJECTGROUP_NODE) && !processObjectGroup(*l_element)) return(false); l_element = l_element->NextSiblingElement(); } /* attach layers to scene */ Game::SharedSceneLayerList::iterator l_layer_i; for (l_layer_i = layers.begin(); l_layer_i != layers.end(); ++l_layer_i) scene.pushLayer(*l_layer_i); return(is_loaded = true); }
void processPIXInput(struct nipperConfig *nipper, char *line) { // Variables... struct ciscoCommand command; int tempInt = 0; int setting = 0; // Split the command line up command = splitLine(line); // No? if (strcmp(command.part[0], "no") == 0) { setting = false; tempInt = 1; } else { setting = true; tempInt = 0; } // Hostname if (strcmp(command.part[0], "hostname") == 0) { if (nipper->debugMode == true) printf("Hostname Line: %s\n", line); strncpy(nipper->hostname, command.part[1], sizeof(nipper->hostname) - 1); } // Version else if (((strcmp(command.part[0], "PIX") == 0) || (strcmp(command.part[0], "ASA") == 0) || (strcmp(command.part[0], "FWSM") == 0)) && (strcmp(command.part[1], "Version") == 0)) { if (nipper->debugMode == true) printf("Version Line: %s\n", line); strncpy(nipper->version, command.part[2], sizeof(nipper->version) - 1); nipper->versionMajor = atoi(nipper->version); if (strchr(nipper->version, '.') != 0) nipper->versionMinor = atoi(strchr(nipper->version, '.') + 1); if (strchr(nipper->version, '(') != 0) nipper->versionRevision = atoi(strchr(nipper->version, '(') + 1); if (strcmp(command.part[0], "PIX") == 0) nipper->deviceType = type_pix_firewall; else if (strcmp(command.part[0], "ASA") == 0) nipper->deviceType = type_asa_firewall; else if (strcmp(command.part[0], "FWSM") == 0) nipper->deviceType = type_fwsm_firewall; } // Flood Guard else if (strcmp(command.part[tempInt], "floodguard") == 0) { if (strcmp(command.part[1], "enable") == 0) nipper->pix->floodguard = true; else if (strcmp(command.part[1], "disable") == 0) nipper->pix->floodguard = false; else if (strcmp(command.part[tempInt + 1], "enable") == 0) nipper->pix->floodguard = setting; } // IP else if (strcmp(command.part[tempInt], "ip") == 0) { tempInt++; // Address if (strcmp(command.part[tempInt], "address") == 0) processPIXInterface(line, nipper); // uRFP else if ((strcmp(command.part[tempInt], "verify") == 0) && (strcmp(command.part[tempInt + 1], "reverse-path") == 0) && (strcmp(command.part[tempInt + 2], "interface") == 0)) processPIXuRPF(line, nipper); } // Transparent Firewall? else if ((strcmp(command.part[0], "firewall") == 0) && (strcmp(command.part[1], "transparent") == 0)) { if (nipper->debugMode == true) printf("Transparent Line: %s\n", line); nipper->pix->transparent = true; } // ICMP Access... else if (strcmp(command.part[tempInt], "icmp") == 0) processICMPPIX(line, nipper); // Enable Password else if (((strcmp(command.part[tempInt], "enable") == 0) && (strcmp(command.part[tempInt + 1], "password") == 0)) || (strcmp(command.part[tempInt], "passwd") == 0)) processEnablePIX(line, nipper); // Usernames... else if ((strcmp(command.part[tempInt], "username") == 0) && (strcmp(command.part[tempInt+2], "password") == 0)) processPIXUsername(line, nipper); // Route... else if (strcmp(command.part[tempInt], "route") == 0) processRoutePIX(line, nipper); // Interfaces... else if ((strcmp(command.part[tempInt], "interface") == 0) || (strcmp(command.part[tempInt], "nameif") == 0) || (strcmp(command.part[tempInt], "access-group") == 0)) processPIXInterface(line, nipper); // Object Group... else if (strcmp(command.part[tempInt], "object-group") == 0) processObjectGroup(line, nipper); // Protocol Inspection... else if ((strcmp(command.part[tempInt], "fixup") == 0) && (strcmp(command.part[tempInt + 1], "protocol") == 0)) processFixupPIX(line, nipper); // Name... else if (strcmp(command.part[tempInt], "name") == 0) processPIXName(line, nipper); // Domain Name else if (strcmp(command.part[tempInt], "domain-name") == 0) strncpy(nipper->domainName, line + 12, sizeof(nipper->domainName) - 1); // Access Lists... else if (strcmp(command.part[tempInt], "access-list") == 0) processPIXAccessList(line, nipper); // Static NAT / PAT else if (strcmp(command.part[tempInt], "static") == 0) processStaticPIX(line, nipper); // SNMP else if (strcmp(command.part[tempInt], "snmp-server") == 0) processSnmpPIX(line, nipper); // SSH else if (strcmp(command.part[tempInt], "ssh") == 0) processPIXSSH(line, nipper); // HTTP else if ((strcmp(command.part[tempInt], "http") == 0) && (strcmp(command.part[tempInt + 1], "server") == 0) && (strcmp(command.part[tempInt + 2], "enable") == 0)) processPIXHTTP(line, nipper); // Debug (lines not processed) else if (nipper->linesnotprocessed == true) printf("%s\n", line); }