void TL_Xml2Array::parseMemory(const string& memory_) { try { parse_memory(memory_); } catch(const xmlpp::exception& ex) { throw TL_Exception<TL_Xml2Array>("TL_Xml2Array::parseMemory", ex.what()); _dataValid = false; } }
static int parse_header(void *addr, int len) { struct cb_header *header; unsigned char *ptr = (unsigned char *)addr; int i; for (i = 0; i < len; i += 16, ptr += 16) { header = (struct cb_header *)ptr; if (!strncmp((const char *)header->signature, "LBIO", 4)) break; } /* We walked the entire space and didn't find anything. */ if (i >= len) return -1; if (!header->table_bytes) return 0; /* FIXME: Check the checksum. */ if (ipchksum((uint16_t *) header, sizeof(*header))) return -1; if (ipchksum((uint16_t *) (ptr + sizeof(*header)), header->table_bytes) != header->table_checksum) return -1; /* Now, walk the tables. */ ptr += header->header_bytes; for (i = 0; i < header->table_entries; i++) { struct cb_record *rec = (struct cb_record *)ptr; switch (rec->tag) { case CB_TAG_FORWARD: return parse_header((void *)(unsigned long)((struct cb_forward *)rec)->forward, 1); break; case CB_TAG_MEMORY: parse_memory(ptr); break; case CB_TAG_MAINBOARD: parse_mainboard(ptr); break; case CB_TAG_VERSION: case CB_TAG_EXTRA_VERSION: case CB_TAG_BUILD: case CB_TAG_COMPILE_TIME: case CB_TAG_COMPILE_BY: case CB_TAG_COMPILE_HOST: case CB_TAG_COMPILE_DOMAIN: case CB_TAG_COMPILER: case CB_TAG_LINKER: case CB_TAG_ASSEMBLER: parse_strings(ptr); break; case CB_TAG_SERIAL: parse_serial(ptr); break; case CB_TAG_CONSOLE: parse_console(ptr); break; default: break; } ptr += rec->size; } return 1; }