imv_database.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2013 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. *
  17. * @defgroup imv_database_t imv_database
  18. * @{ @ingroup libimcv_imv
  19. */
  20. #ifndef IMV_DATABASE_H_
  21. #define IMV_DATABASE_H_
  22. #include "imv_session.h"
  23. #include "imv_workitem.h"
  24. #include <tncifimv.h>
  25. #include <library.h>
  26. typedef struct imv_database_t imv_database_t;
  27. /**
  28. * IMV database interface
  29. */
  30. struct imv_database_t {
  31. /**
  32. * Create or get a session associated with a TNCCS connection
  33. *
  34. * @param conn_id TNCCS Connection ID
  35. * @param ar_id_type Access Requestor identity type
  36. * @param ar_id_value Access Requestor identity value
  37. * @return Session associated with TNCCS Connection
  38. */
  39. imv_session_t* (*add_session)(imv_database_t *this,
  40. TNC_ConnectionID conn_id,
  41. uint32_t ar_id_type, chunk_t ar_id_value);
  42. /**
  43. * Remove and delete a session
  44. *
  45. * @param session Session
  46. */
  47. void (*remove_session)(imv_database_t *this, imv_session_t *session);
  48. /**
  49. * Add final recommendation to a session database entry
  50. *
  51. * @param session Session
  52. * @param rec Final recommendation
  53. */
  54. void (*add_recommendation)(imv_database_t *this, imv_session_t *session,
  55. TNC_IMV_Action_Recommendation rec);
  56. /**
  57. * Announce session start/stop to policy script
  58. *
  59. * @param session Session
  60. * @param start TRUE if session start, FALSE if session stop
  61. * @return TRUE if command successful, FALSE otherwise
  62. */
  63. bool (*policy_script)(imv_database_t *this, imv_session_t *session,
  64. bool start);
  65. /**
  66. * Finalize a workitem
  67. *
  68. * @param workitem Workitem to be finalized
  69. */
  70. bool (*finalize_workitem)(imv_database_t *this, imv_workitem_t *workitem);
  71. /**
  72. * Get database handle
  73. *
  74. * @return Database handle
  75. */
  76. database_t* (*get_database)(imv_database_t *this);
  77. /**
  78. * Destroys an imv_database_t object
  79. */
  80. void (*destroy)(imv_database_t *this);
  81. };
  82. /**
  83. * Create an imv_database_t instance
  84. *
  85. * @param uri Database uri
  86. * @param script Policy Manager script
  87. */
  88. imv_database_t* imv_database_create(char *uri, char *script);
  89. #endif /** IMV_DATABASE_H_ @}*/