gnunet-service-messenger_message_recv.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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_recv.h
  19. * @brief GNUnet MESSENGER service
  20. */
  21. #ifndef GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H
  22. #define GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H
  23. #include "platform.h"
  24. #include "gnunet_crypto_lib.h"
  25. #include "gnunet-service-messenger_tunnel.h"
  26. #include "messenger_api_message.h"
  27. /**
  28. * Handles a received info message to change the current member id to the one generated by
  29. * the host connected to. (all current tunnels will be informed about the id change)
  30. *
  31. * @param room Room of the message
  32. * @param tunnel Receiving connection
  33. * @param message INFO-Message
  34. * @param hash Hash of the message
  35. */
  36. void
  37. recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  38. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  39. /**
  40. * Handles a received join message to forward all member information to the new member if the message was
  41. * the direct reaction to a previous info message from this peer.
  42. *
  43. * @param room Room of the message
  44. * @param tunnel Receiving connection
  45. * @param message JOIN-Message
  46. * @param hash Hash of the message
  47. */
  48. void
  49. recv_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  50. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  51. /**
  52. * Handles a received leave message.
  53. * @see handle_message_leave()
  54. *
  55. * @param room Room of the message
  56. * @param tunnel Receiving connection
  57. * @param message LEAVE-Message
  58. * @param hash Hash of the message
  59. */
  60. void
  61. recv_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  62. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  63. /**
  64. * Handles a received name message.
  65. * @see handle_message_name()
  66. *
  67. * @param room Room of the message
  68. * @param tunnel Receiving connection
  69. * @param message NAME-Message
  70. * @param hash Hash of the message
  71. */
  72. void
  73. recv_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  74. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  75. /**
  76. * Handles a received key message.
  77. * @see handle_message_key()
  78. *
  79. * @param room Room of the message
  80. * @param tunnel Receiving connection
  81. * @param message KEY-Message
  82. * @param hash Hash of the message
  83. */
  84. void
  85. recv_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  86. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  87. /**
  88. * Handles a received peer message to link it to its origin tunnel if the peer identity matches.
  89. * (the peer message and the member id can potentially be linked to the tunnel)
  90. *
  91. * TODO: This handling will only check the one given tunnel!
  92. *
  93. * @param room Room of the message
  94. * @param tunnel Receiving connection
  95. * @param message PEER-Message
  96. * @param hash Hash of the message
  97. */
  98. void
  99. recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  100. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  101. /**
  102. * Handles a received id message to change the tunnels linked member id if necessary.
  103. * (the tunnels linked member id will be changed if the sender id is matching)
  104. *
  105. * TODO: This handling will only check the one given tunnel!
  106. *
  107. * @param room Room of the message
  108. * @param tunnel Receiving connection
  109. * @param message ID-Message
  110. * @param hash Hash of the message
  111. */
  112. void
  113. recv_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  114. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  115. /**
  116. * Handles a received miss message.
  117. * @see handle_message_miss()
  118. *
  119. * @param room Room of the message
  120. * @param tunnel Receiving connection
  121. * @param message MISS-Message
  122. * @param hash Hash of the message
  123. */
  124. void
  125. recv_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  126. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  127. /**
  128. * Handles a received request message by checking for the requested message and forwarding it back
  129. * if the message was found.
  130. * (this can also cause this peer to send a new request instead of only forwarding the received one)
  131. *
  132. * TODO: Requests can cause exponentially more requests!
  133. *
  134. * @param room Room of the message
  135. * @param tunnel Receiving connection
  136. * @param message REQUEST-Message
  137. * @param hash Hash of the message
  138. */
  139. void
  140. recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
  141. struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
  142. #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H