aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_message_recv.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_message_recv.h')
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.h128
1 files changed, 25 insertions, 103 deletions
diff --git a/src/messenger/gnunet-service-messenger_message_recv.h b/src/messenger/gnunet-service-messenger_message_recv.h
index 245612cb0..9cb36c466 100644
--- a/src/messenger/gnunet-service-messenger_message_recv.h
+++ b/src/messenger/gnunet-service-messenger_message_recv.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2020 GNUnet e.V. 3 Copyright (C) 2020--2021 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 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 6 under the terms of the GNU Affero General Public License as published
@@ -29,6 +29,9 @@
29#include "platform.h" 29#include "platform.h"
30#include "gnunet_crypto_lib.h" 30#include "gnunet_crypto_lib.h"
31 31
32#include "gnunet-service-messenger_message_kind.h"
33
34#include "gnunet-service-messenger_member_session.h"
32#include "gnunet-service-messenger_tunnel.h" 35#include "gnunet-service-messenger_tunnel.h"
33#include "messenger_api_message.h" 36#include "messenger_api_message.h"
34 37
@@ -36,124 +39,43 @@
36 * Handles a received info message to change the current member id to the one generated by 39 * 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) 40 * the host connected to. (all current tunnels will be informed about the id change)
38 * 41 *
39 * @param room Room of the message 42 * @param[in/out] room Room of the message
40 * @param tunnel Receiving connection 43 * @param[in/out] tunnel Receiving connection
41 * @param message INFO-Message 44 * @param[in] message INFO-Message
42 * @param hash Hash of the message 45 * @param[in] hash Hash of the message
46 * @return #GNUNET_NO to not forward the message
43 */ 47 */
44void 48int
45recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 49recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
46 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 50 const 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 51
100/** 52/**
101 * Handles a received peer message to link it to its origin tunnel if the peer identity matches. 53 * 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) 54 * (the peer message and the member id can potentially be linked to the tunnel)
103 * 55 *
104 * TODO: This handling will only check the one given tunnel! 56 * @param[in/out] room Room of the message
105 * 57 * @param[in/out] tunnel Receiving connection
106 * @param room Room of the message 58 * @param[in] message PEER-Message
107 * @param tunnel Receiving connection 59 * @param[in] hash Hash of the message
108 * @param message PEER-Message 60 * @return #GNUNET_YES to forward the message
109 * @param hash Hash of the message
110 */ 61 */
111void 62int
112recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 63recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
113 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 64 const 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 65
143/** 66/**
144 * Handles a received request message by checking for the requested message and forwarding it back 67 * Handles a received request message by checking for the requested message and forwarding it back
145 * if the message was found. 68 * if the message was found.
146 * (this can also cause this peer to send a new request instead of only forwarding the received one) 69 * (this can also cause this peer to send a new request instead of only forwarding the received one)
147 * 70 *
148 * TODO: Requests can cause exponentially more requests! 71 * @param[in/out] room Room of the message
149 * 72 * @param[in/out] tunnel Receiving connection
150 * @param room Room of the message 73 * @param[in] message REQUEST-Message
151 * @param tunnel Receiving connection 74 * @param[in] hash Hash of the message
152 * @param message REQUEST-Message 75 * @return #GNUNET_YES or #GNUNET_NO depending on required forwarding
153 * @param hash Hash of the message
154 */ 76 */
155void 77int
156recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 78recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
157 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 79 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
158 80
159#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H 81#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H