delete_payload.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2015 Tobias Brunner
  3. * Copyright (C) 2005-2006 Martin Willi
  4. * Copyright (C) 2005 Jan Hutter
  5. * HSR Hochschule fuer Technik Rapperswil
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  14. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15. * for more details.
  16. */
  17. /**
  18. * @defgroup delete_payload delete_payload
  19. * @{ @ingroup payloads
  20. */
  21. #ifndef DELETE_PAYLOAD_H_
  22. #define DELETE_PAYLOAD_H_
  23. typedef struct delete_payload_t delete_payload_t;
  24. #include <library.h>
  25. #include <encoding/payloads/payload.h>
  26. #include <encoding/payloads/proposal_substructure.h>
  27. /**
  28. * Class representing an IKEv1 or a IKEv2 DELETE payload.
  29. */
  30. struct delete_payload_t {
  31. /**
  32. * The payload_t interface.
  33. */
  34. payload_t payload_interface;
  35. /**
  36. * Get the protocol ID.
  37. *
  38. * @return protocol ID
  39. */
  40. protocol_id_t (*get_protocol_id) (delete_payload_t *this);
  41. /**
  42. * Add an SPI to the list of deleted SAs.
  43. *
  44. * @param spi spi to add
  45. */
  46. void (*add_spi) (delete_payload_t *this, uint32_t spi);
  47. /**
  48. * Set the IKE SPIs for an IKEv1 delete.
  49. *
  50. * @param spi_i initiator SPI
  51. * @param spi_r responder SPI
  52. */
  53. void (*set_ike_spi)(delete_payload_t *this, uint64_t spi_i, uint64_t spi_r);
  54. /**
  55. * Get the IKE SPIs from an IKEv1 delete.
  56. *
  57. * @param spi_i initiator SPI
  58. * @param spi_r responder SPI
  59. * @return TRUE if SPIs extracted successfully
  60. */
  61. bool (*get_ike_spi)(delete_payload_t *this, uint64_t *spi_i, uint64_t *spi_r);
  62. /**
  63. * Get an enumerator over the SPIs in network order.
  64. *
  65. * @return enumerator over SPIs, uint32_t
  66. */
  67. enumerator_t *(*create_spi_enumerator) (delete_payload_t *this);
  68. /**
  69. * Destroys an delete_payload_t object.
  70. */
  71. void (*destroy) (delete_payload_t *this);
  72. };
  73. /**
  74. * Creates an empty delete_payload_t object.
  75. *
  76. * @param type PLV2_DELETE or PLV1_DELETE
  77. * @param protocol_id protocol, such as AH|ESP
  78. * @return delete_payload_t object
  79. */
  80. delete_payload_t *delete_payload_create(payload_type_t type,
  81. protocol_id_t protocol_id);
  82. #endif /** DELETE_PAYLOAD_H_ @}*/