gnunet-service-messenger_message_handle.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2020 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @author Tobias Frisch
  18. * @file src/messenger/gnunet-service-messenger_message_handle.h
  19. * @brief GNUnet MESSENGER service
  20. */
  21. #ifndef GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H
  22. #define GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H
  23. #include "platform.h"
  24. #include "gnunet_crypto_lib.h"
  25. #include "gnunet-service-messenger_message_kind.h"
  26. #include "gnunet-service-messenger_tunnel.h"
  27. #include "messenger_api_message.h"
  28. /**
  29. * Handles a received or sent join message to make changes of current member information.
  30. * (add matching member and clear member info)
  31. *
  32. * @param room Room of the message
  33. * @param tunnel Receiving/sending connection (may be NULL)
  34. * @param message JOIN-Message
  35. * @param hash Hash of the message
  36. */
  37. void
  38. handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  39. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  40. /**
  41. * Handles a received or sent leave message to make changes of current member information.
  42. * (remove matching member and clear member info)
  43. *
  44. * @param room Room of the message
  45. * @param tunnel Receiving/sending connection (may be NULL)
  46. * @param message LEAVE-Message
  47. * @param hash Hash of the message
  48. */
  49. void
  50. handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  51. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  52. /**
  53. * Handles a received or sent name message to rename a current member.
  54. * (change name of matching member)
  55. *
  56. * @param room Room of the message
  57. * @param tunnel Receiving/sending connection (may be NULL)
  58. * @param message NAME-Message
  59. * @param hash Hash of the message
  60. */
  61. void
  62. handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  63. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  64. /**
  65. * Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly.
  66. * (move the member in the contacts and change its key)
  67. *
  68. * @param room Room of the message
  69. * @param tunnel Receiving/sending connection (may be NULL)
  70. * @param message KEY-Message
  71. * @param hash Hash of the message
  72. */
  73. void
  74. handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  75. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  76. /**
  77. * Handles a received or sent peer message to make changes of the basement in the room.
  78. * (add a new peer to the basement and restructure connections based on updated list of peers)
  79. *
  80. * @param room Room of the message
  81. * @param tunnel Receiving/sending connection (may be NULL)
  82. * @param message PEER-Message
  83. * @param hash Hash of the message
  84. */
  85. void
  86. handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  87. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  88. /**
  89. * Handles a received or sent id message to change a members id.
  90. * (change id of matching member)
  91. *
  92. * @param room Room of the message
  93. * @param tunnel Receiving/sending connection (may be NULL)
  94. * @param message ID-Message
  95. * @param hash Hash of the message
  96. */
  97. void
  98. handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  99. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  100. /**
  101. * Handles a received or sent miss message to drop a peer from the basement in the room.
  102. * (remove a peer from the basement and restructure connections based on updated list of peers)
  103. *
  104. * @param room Room of the message
  105. * @param tunnel Receiving/sending connection (may be NULL)
  106. * @param message MISS-Message
  107. * @param hash Hash of the message
  108. */
  109. void
  110. handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  111. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  112. #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H