aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_message_recv.h
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2020-11-12 20:58:07 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2020-11-12 20:58:07 +0100
commitca912f85dae6b61dd80ab02d0e3f0b20a556da7c (patch)
tree788ebaf2ce0870bad875a7d910b6cd1b536a99c7 /src/messenger/gnunet-service-messenger_message_recv.h
parent5bdfe2001fbc68b06293b79dd6426156719d33c0 (diff)
downloadgnunet-ca912f85dae6b61dd80ab02d0e3f0b20a556da7c.tar.gz
gnunet-ca912f85dae6b61dd80ab02d0e3f0b20a556da7c.zip
-remerge branch 'jacki/messenger'
This reverts commit e11d1e59e4ae5f7d89c33df3ae9ca8f1ece990cf.
Diffstat (limited to 'src/messenger/gnunet-service-messenger_message_recv.h')
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/src/messenger/gnunet-service-messenger_message_recv.h b/src/messenger/gnunet-service-messenger_message_recv.h
new file mode 100644
index 000000000..245612cb0
--- /dev/null
+++ b/src/messenger/gnunet-service-messenger_message_recv.h
@@ -0,0 +1,159 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @author Tobias Frisch
22 * @file src/messenger/gnunet-service-messenger_message_recv.h
23 * @brief GNUnet MESSENGER service
24 */
25
26#ifndef GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H
27#define GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H
28
29#include "platform.h"
30#include "gnunet_crypto_lib.h"
31
32#include "gnunet-service-messenger_tunnel.h"
33#include "messenger_api_message.h"
34
35/**
36 * Handles a received info message to change the current member id to the one generated by
37 * the host connected to. (all current tunnels will be informed about the id change)
38 *
39 * @param room Room of the message
40 * @param tunnel Receiving connection
41 * @param message INFO-Message
42 * @param hash Hash of the message
43 */
44void
45recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
46 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
47
48/**
49 * Handles a received join message to forward all member information to the new member if the message was
50 * the direct reaction to a previous info message from this peer.
51 *
52 * @param room Room of the message
53 * @param tunnel Receiving connection
54 * @param message JOIN-Message
55 * @param hash Hash of the message
56 */
57void
58recv_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
59 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
60
61/**
62 * Handles a received leave message.
63 * @see handle_message_leave()
64 *
65 * @param room Room of the message
66 * @param tunnel Receiving connection
67 * @param message LEAVE-Message
68 * @param hash Hash of the message
69 */
70void
71recv_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
72 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
73
74/**
75 * Handles a received name message.
76 * @see handle_message_name()
77 *
78 * @param room Room of the message
79 * @param tunnel Receiving connection
80 * @param message NAME-Message
81 * @param hash Hash of the message
82 */
83void
84recv_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
85 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
86
87/**
88 * Handles a received key message.
89 * @see handle_message_key()
90 *
91 * @param room Room of the message
92 * @param tunnel Receiving connection
93 * @param message KEY-Message
94 * @param hash Hash of the message
95 */
96void
97recv_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
98 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
99
100/**
101 * Handles a received peer message to link it to its origin tunnel if the peer identity matches.
102 * (the peer message and the member id can potentially be linked to the tunnel)
103 *
104 * TODO: This handling will only check the one given tunnel!
105 *
106 * @param room Room of the message
107 * @param tunnel Receiving connection
108 * @param message PEER-Message
109 * @param hash Hash of the message
110 */
111void
112recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
113 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
114
115/**
116 * Handles a received id message to change the tunnels linked member id if necessary.
117 * (the tunnels linked member id will be changed if the sender id is matching)
118 *
119 * TODO: This handling will only check the one given tunnel!
120 *
121 * @param room Room of the message
122 * @param tunnel Receiving connection
123 * @param message ID-Message
124 * @param hash Hash of the message
125 */
126void
127recv_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
128 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
129
130/**
131 * Handles a received miss message.
132 * @see handle_message_miss()
133 *
134 * @param room Room of the message
135 * @param tunnel Receiving connection
136 * @param message MISS-Message
137 * @param hash Hash of the message
138 */
139void
140recv_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
141 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
142
143/**
144 * Handles a received request message by checking for the requested message and forwarding it back
145 * if the message was found.
146 * (this can also cause this peer to send a new request instead of only forwarding the received one)
147 *
148 * TODO: Requests can cause exponentially more requests!
149 *
150 * @param room Room of the message
151 * @param tunnel Receiving connection
152 * @param message REQUEST-Message
153 * @param hash Hash of the message
154 */
155void
156recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
157 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
158
159#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H