access_descriptor.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_BOOTSTRAP_ACCESS_DESCRIPTOR_H
  21. #define _ESG_BOOTSTRAP_ACCESS_DESCRIPTOR_H 1
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. #include <libesg/types.h>
  27. /**
  28. * esg_entry structure.
  29. */
  30. struct esg_entry {
  31. uint8_t version;
  32. uint8_t multiple_stream_transport;
  33. uint8_t ip_version_6;
  34. uint16_t provider_id;
  35. union esg_ip_address source_ip;
  36. union esg_ip_address destination_ip;
  37. uint16_t port;
  38. uint16_t tsi;
  39. struct esg_entry *_next;
  40. };
  41. /**
  42. * esg_access_descriptor structure.
  43. */
  44. struct esg_access_descriptor {
  45. uint16_t n_o_entries;
  46. struct esg_entry *entry_list;
  47. };
  48. /**
  49. * Process an esg_access_descriptor.
  50. *
  51. * @param buffer Binary buffer to decode.
  52. * @param size Binary buffer size.
  53. * @return Pointer to an esg_access_descriptor structure, or NULL on error.
  54. */
  55. extern struct esg_access_descriptor *esg_access_descriptor_decode(uint8_t *buffer, uint32_t size);
  56. /**
  57. * Free an esg_access_descriptor.
  58. *
  59. * @param esg Pointer to an esg_access_descriptor structure.
  60. */
  61. extern void esg_access_descriptor_free(struct esg_access_descriptor *access_descriptor);
  62. /**
  63. * Convenience iterator for esg_entry_list field of an esg_access_descriptor.
  64. *
  65. * @param access_descriptor The esg_access_descriptor pointer.
  66. * @param entry Variable holding a pointer to the current esg_entry.
  67. */
  68. #define esg_access_descriptor_entry_list_for_each(access_descriptor, entry) \
  69. for ((entry) = (access_descriptor)->entry_list; \
  70. (entry); \
  71. (entry) = (entry)->_next)
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif