GNUnet  0.11.x
gnunet-service-messenger_message_send.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2020--2021 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  */
27 
31 
32 void
34  const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
35 {
36  check_room_peer_status(room, NULL);
37 }
38 
39 void
41  const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
42 {
43  if (!room->peer_message)
44  room->peer_message = GNUNET_new(struct GNUNET_HashCode);
45 
46  GNUNET_memcpy(room->peer_message, hash, sizeof(struct GNUNET_HashCode));
47 }
48 
49 void
51  const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
52 {
53  change_handle_member_id (handle, get_room_key(room), &(message->body.id.id));
54 }
55 
56 void
58  const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
59 {
60  struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room);
61 
63  operation_store,
64  &(message->body.request.hash),
67  );
68 }
void send_message_join(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a sent join message to ensure growth of the decentralized room structure. ...
void check_room_peer_status(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Checks the current state of opening a given room from this peer and re-publishes it if necessary to a...
GNUnet MESSENGER service.
struct GNUNET_ShortHashCode id
The new id which will replace the senders id in a room.
struct GNUNET_HashCode hash
The hash of the requested message.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
int change_handle_member_id(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *unique_id)
Changes the member id of a given handle in a specific room to match a unique_id and returns GNUNET_OK...
struct GNUNET_MESSENGER_MessageRequest request
struct GNUNET_MESSENGER_OperationStore * get_room_operation_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used operation store of a given room.
void send_message_request(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a sent request message to trigger the request operation for this service. ...
struct GNUNET_HashCode * peer_message
void send_message_peer(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a sent peer message to update the rooms peer message of this service.
GNUnet MESSENGER service.
void send_message_id(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a sent id message to update the handles member id in the room.
struct GNUNET_MESSENGER_MessageBody body
Body.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
A 512-bit hashcode.
#define GNUNET_MESSENGER_REQUEST_DELAY
GNUnet MESSENGER service.
int use_store_operation(struct GNUNET_MESSENGER_OperationStore *store, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_OperationType type, struct GNUNET_TIME_Relative delay)
Tries to use an operation under a given hash in a specific operation store.
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the shared secret you need to access a room.
struct GNUNET_MESSENGER_MessageId id