aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_message_kind.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_message_kind.h')
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/src/messenger/gnunet-service-messenger_message_kind.h b/src/messenger/gnunet-service-messenger_message_kind.h
new file mode 100644
index 000000000..dd89d0b2f
--- /dev/null
+++ b/src/messenger/gnunet-service-messenger_message_kind.h
@@ -0,0 +1,160 @@
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_kind.h
23 * @brief GNUnet MESSENGER service
24 */
25
26#ifndef GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H
27#define GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H
28
29#include "platform.h"
30#include "gnunet_container_lib.h"
31#include "gnunet_crypto_lib.h"
32#include "gnunet_identity_service.h"
33
34#include "messenger_api_message.h"
35#include "gnunet-service-messenger_service.h"
36#include "messenger_api_ego.h"
37
38/**
39 * Creates and allocates a new info message containing the hosts public key and a newly generated unique member id.
40 * (all values are stored as copy)
41 *
42 * @param ego EGO of the host
43 * @param members Map of all assigned member ids
44 * @return New message
45 */
46struct GNUNET_MESSENGER_Message*
47create_message_info (struct GNUNET_MESSENGER_Ego *ego, struct GNUNET_CONTAINER_MultiShortmap *members);
48
49/**
50 * Creates and allocates a new join message containing the clients public key.
51 * (all values are stored as copy)
52 *
53 * @param ego EGO of the client
54 * @return New message
55 */
56struct GNUNET_MESSENGER_Message*
57create_message_join (struct GNUNET_MESSENGER_Ego *ego);
58
59/**
60 * Creates and allocates a new leave message.
61 *
62 * @return New message
63 */
64struct GNUNET_MESSENGER_Message*
65create_message_leave ();
66
67/**
68 * Creates and allocates a new name message containing the <i>name</i> to change to.
69 * (all values are stored as copy)
70 *
71 * @param name New name
72 * @return New message
73 */
74struct GNUNET_MESSENGER_Message*
75create_message_name (const char *name);
76
77/**
78 * Creates and allocates a new key message containing the public key to change to derived
79 * from its private counterpart. (all values are stored as copy)
80 *
81 * @param key Private key of EGO
82 * @return New message
83 */
84struct GNUNET_MESSENGER_Message*
85create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key);
86
87/**
88 * Creates and allocates a new peer message containing a services peer identity.
89 * (all values are stored as copy)
90 *
91 * @param service Service
92 * @return New message
93 */
94struct GNUNET_MESSENGER_Message*
95create_message_peer (const struct GNUNET_MESSENGER_Service *service);
96
97/**
98 * Creates and allocates a new id message containing the unique member id to change to.
99 * (all values are stored as copy)
100 *
101 * @param unique_id Unique member id
102 * @return New message
103 */
104struct GNUNET_MESSENGER_Message*
105create_message_id (const struct GNUNET_ShortHashCode *unique_id);
106
107/**
108 * Creates and allocates a new miss message containing the missing peer identity.
109 * (all values are stored as copy)
110 *
111 * @param peer Missing peer identity
112 * @return New message
113 */
114struct GNUNET_MESSENGER_Message*
115create_message_miss (const struct GNUNET_PeerIdentity *peer);
116
117/**
118 * Creates and allocates a new merge message containing the hash of a second previous message
119 * besides the regular previous message mentioned in a messages header.
120 * (all values are stored as copy)
121 *
122 * @param previous Hash of message
123 * @return New message
124 */
125struct GNUNET_MESSENGER_Message*
126create_message_merge (const struct GNUNET_HashCode *previous);
127
128/**
129 * Creates and allocates a new request message containing the hash of a missing message.
130 * (all values are stored as copy)
131 *
132 * @param hash Hash of message
133 * @return New message
134 */
135struct GNUNET_MESSENGER_Message*
136create_message_request (const struct GNUNET_HashCode *hash);
137
138/**
139 * Creates and allocates a new invite message containing the peer identity of an entrance peer
140 * to a room using a given <i>key</i> as shared secret for communication.
141 * (all values are stored as copy)
142 *
143 * @param door Peer identity
144 * @param key Shared secret of a room
145 * @return New message
146 */
147struct GNUNET_MESSENGER_Message*
148create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key);
149
150/**
151 * Creates and allocates a new text message containing a string representing text.
152 * (all values are stored as copy)
153 *
154 * @param text Text
155 * @return New message
156 */
157struct GNUNET_MESSENGER_Message*
158create_message_text (const char *text);
159
160#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H