fragment_management_information.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * ESG parser
  3. *
  4. * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  19. */
  20. #ifndef _ESG_ENCAPSULATION_FRAGMENT_MANAGEMENT_INFORMATION_H
  21. #define _ESG_ENCAPSULATION_FRAGMENT_MANAGEMENT_INFORMATION_H 1
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. #include <stdint.h>
  27. /**
  28. * esg_encapsulation_header structure.
  29. */
  30. struct esg_encapsulation_header {
  31. uint8_t fragment_reference_format;
  32. };
  33. /**
  34. * esg_fragment_reference structure.
  35. */
  36. struct esg_fragment_reference {
  37. uint8_t fragment_type;
  38. uint32_t data_repository_offset;
  39. };
  40. /**
  41. * esg_encapsulation_entry structure.
  42. */
  43. struct esg_encapsulation_entry {
  44. struct esg_fragment_reference *fragment_reference;
  45. uint8_t fragment_version;
  46. uint32_t fragment_id;
  47. struct esg_encapsulation_entry *_next;
  48. };
  49. /**
  50. * esg_encapsulation_structure structure.
  51. */
  52. struct esg_encapsulation_structure {
  53. struct esg_encapsulation_header *header;
  54. struct esg_encapsulation_entry *entry_list;
  55. };
  56. /**
  57. * Process an esg_encapsulation_structure.
  58. *
  59. * @param buffer Binary buffer to decode.
  60. * @param size Binary buffer size.
  61. * @return Pointer to an esg_encapsulation_structure structure, or NULL on error.
  62. */
  63. extern struct esg_encapsulation_structure *esg_encapsulation_structure_decode(uint8_t *buffer, uint32_t size);
  64. /**
  65. * Free an esg_encapsulation_structure.
  66. *
  67. * @param container Pointer to an esg_container structure.
  68. */
  69. extern void esg_encapsulation_structure_free(struct esg_encapsulation_structure *structure);
  70. /**
  71. * Convenience iterator for entry_list field of an esg_encapsulation_structure.
  72. *
  73. * @param structure The esg_encapsulation_structure pointer.
  74. * @param entry Variable holding a pointer to the current esg_encapsulation_entry.
  75. */
  76. #define esg_encapsulation_structure_entry_list_for_each(structure, entry) \
  77. for ((entry) = (structure)->entry_list; \
  78. (entry); \
  79. (entry) = (entry)->_next)
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif