pa_tnc_attr.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (C) 2011-2014 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 pa_tnc_attr pa_tnc_attr
  17. * @{ @ingroup pa_tnc
  18. */
  19. #ifndef PA_TNC_ATTR_H_
  20. #define PA_TNC_ATTR_H_
  21. typedef struct pa_tnc_attr_t pa_tnc_attr_t;
  22. #include <library.h>
  23. #include <pen/pen.h>
  24. #define PA_TNC_ATTR_INFO_SIZE 8
  25. #define PA_TNC_ATTR_HEADER_SIZE 12
  26. #define PA_TNC_ATTR_FLAG_NONE 0x00
  27. #define PA_TNC_ATTR_FLAG_NOSKIP (1<<7)
  28. /**
  29. * Interface for an RFC 5792 PA-TNC Posture Attribute.
  30. *
  31. */
  32. struct pa_tnc_attr_t {
  33. /**
  34. * Get the vendor ID/type of an PA-TNC attribute
  35. *
  36. * @return vendor-specific attribute type
  37. */
  38. pen_type_t (*get_type)(pa_tnc_attr_t *this);
  39. /**
  40. * Get the value of an PA-TNC attribute
  41. *
  42. * @return attribute value
  43. */
  44. chunk_t (*get_value)(pa_tnc_attr_t *this);
  45. /**
  46. * Get the noskip flag
  47. *
  48. * @return TRUE if the noskip flag is set
  49. */
  50. bool (*get_noskip_flag)(pa_tnc_attr_t *this);
  51. /**
  52. * Set the noskip flag
  53. *
  54. * @param noskip_flag TRUE if the noskip flag is to be set
  55. */
  56. void (*set_noskip_flag)(pa_tnc_attr_t *this, bool noskip);
  57. /**
  58. * Build value of an PA-TNC attribute from its parameters
  59. */
  60. void (*build)(pa_tnc_attr_t *this);
  61. /**
  62. * Process the value of an PA-TNC attribute to extract its parameters
  63. *
  64. * @param offset relative error offset within attribute body
  65. * @return result status
  66. */
  67. status_t (*process)(pa_tnc_attr_t *this, uint32_t *offset);
  68. /**
  69. * Add a data segment to an attribute allowing incremental processing
  70. *
  71. * @param segment data segment to be appended
  72. */
  73. void (*add_segment)(pa_tnc_attr_t *this, chunk_t segment);
  74. /**
  75. * Get a new reference to the PA-TNC attribute
  76. *
  77. * @return this, with an increased refcount
  78. */
  79. pa_tnc_attr_t* (*get_ref)(pa_tnc_attr_t *this);
  80. /**
  81. * Destroys a pa_tnc_attr_t object.
  82. */
  83. void (*destroy)(pa_tnc_attr_t *this);
  84. };
  85. #endif /** PA_TNC_ATTR_H_ @}*/