swima_record.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (C) 2017 Andreas Steffen
  3. * HSR Hochschule fuer Technik Rapperswil
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  12. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. * for more details.
  14. */
  15. /**
  16. * @defgroup swima_record swima_record
  17. * @{ @ingroup libimcv_swima
  18. */
  19. #ifndef SWIMA_RECORD_H_
  20. #define SWIMA_RECORD_H_
  21. #include <library.h>
  22. #include <pen/pen.h>
  23. typedef struct swima_record_t swima_record_t;
  24. /**
  25. * Class storing a Software Inventory Evidence Collection record
  26. */
  27. struct swima_record_t {
  28. /**
  29. * Get Software Identifier and optional Software Location
  30. *
  31. * @return Record ID
  32. */
  33. uint32_t (*get_record_id)(swima_record_t *this);
  34. /**
  35. * Get Software Identifier and optional Software Location
  36. *
  37. * @param sw_locator Optional Software Locator
  38. * @return Software Identifier
  39. */
  40. chunk_t (*get_sw_id)(swima_record_t *this, chunk_t *sw_locator);
  41. /**
  42. * Set Data Model
  43. *
  44. * @param Data model type in PEN namespace
  45. */
  46. void (*set_data_model)(swima_record_t *this, pen_type_t data_model);
  47. /**
  48. * Get Data Model
  49. *
  50. * @return Data model type in PEN namespace
  51. */
  52. pen_type_t (*get_data_model)(swima_record_t *this);
  53. /**
  54. * Set Source ID
  55. *
  56. * @param Source ID
  57. */
  58. void (*set_source_id)(swima_record_t *this, uint8_t source_id);
  59. /**
  60. * Get Source ID
  61. *
  62. * @return Source ID
  63. */
  64. uint8_t (*get_source_id)(swima_record_t *this);
  65. /**
  66. * Set Software Inventory Evidence Record
  67. *
  68. * @param Software Inventory Evidence Record
  69. */
  70. void (*set_record)(swima_record_t *this, chunk_t record);
  71. /**
  72. * Get Software Inventory Evidence Record
  73. *
  74. * @return Software Inventory Evidence Record
  75. */
  76. chunk_t (*get_record)(swima_record_t *this);
  77. /**
  78. * Get a new reference to a swima_record object
  79. *
  80. * @return this, with an increased refcount
  81. */
  82. swima_record_t* (*get_ref)(swima_record_t *this);
  83. /**
  84. * Destroys a swima_record_t object.
  85. */
  86. void (*destroy)(swima_record_t *this);
  87. };
  88. /**
  89. * Creates a swima_record_t object
  90. *
  91. * @param record_id Record ID
  92. * @param sw_id Software Identifierl
  93. * @param sw_locator Software Locator or empty chunk
  94. */
  95. swima_record_t* swima_record_create(uint32_t record_id, chunk_t sw_id,
  96. chunk_t sw_locator);
  97. #endif /** SWIMA_RECORD_H_ @}*/