12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef MANIFETCH_SOURCE
- #define MANIFETCH_SOURCE
- #include <stdio.h>
- #include <stdint.h>
- #include "../tools/endian.h"
- #include "../tools/tlv.h"
- void * manifetch (void const * memory, size_t extent, uint32_t type)
- {
- uint8_t * offset = (uint8_t *) (memory);
- while (extent)
- {
- struct TLVNode * node = (struct TLVNode *) (offset);
- if (LE32TOH (node->type) == type)
- {
- return ((void *) (& node->data));
- }
- extent -= TLVSPAN (node);
- offset += TLVSPAN (node);
- }
- return ((void *) (0));
- }
- #endif
|