tlv.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. *====================================================================*/
  8. /*====================================================================*
  9. *
  10. * tlv.h - type-length-value struct definitions and declarations;
  11. *
  12. * Contributor(s):
  13. * Charles Maier <cmaier@qca.qualcomm.com>
  14. *
  15. *--------------------------------------------------------------------*/
  16. #ifndef TLV_HEADER
  17. #define TLV_HEADER
  18. /*====================================================================*
  19. * system header files;
  20. *--------------------------------------------------------------------*/
  21. #include <stdio.h>
  22. /*====================================================================*
  23. * custom header files;
  24. *--------------------------------------------------------------------*/
  25. #include "../tools/types.h"
  26. #include "../tools/endian.h"
  27. #include "../tools/memory.h"
  28. /*====================================================================*
  29. * macros;
  30. *--------------------------------------------------------------------*/
  31. #define TLVSPAN(node) (sizeof(*(node))-sizeof((node)->data)+LE32TOH((node)->size))
  32. #define TLVDUMP(node) hexdump(&(node)->data,0,(node)->size,stderr)
  33. /*====================================================================*
  34. * variables;
  35. *--------------------------------------------------------------------*/
  36. #ifndef __GNUC__
  37. #pragma pack (push,1)
  38. #endif
  39. typedef struct __packed TLVNode
  40. {
  41. uint32_t type;
  42. uint32_t size;
  43. uint32_t data;
  44. }
  45. TLVNode;
  46. #ifndef __GNUC__
  47. #pragma pack (pop)
  48. #endif
  49. /*====================================================================*
  50. *
  51. *--------------------------------------------------------------------*/
  52. #endif