diff options
Diffstat (limited to 'src/messenger/messenger_api_message_kind.h')
-rw-r--r-- | src/messenger/messenger_api_message_kind.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/src/messenger/messenger_api_message_kind.h b/src/messenger/messenger_api_message_kind.h new file mode 100644 index 000000000..9369e2a9a --- /dev/null +++ b/src/messenger/messenger_api_message_kind.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2023 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_util_lib.h" | ||
31 | #include "gnunet_identity_service.h" | ||
32 | #include "gnunet_time_lib.h" | ||
33 | |||
34 | #include "messenger_api_message.h" | ||
35 | #include "gnunet-service-messenger_service.h" | ||
36 | |||
37 | /** | ||
38 | * Creates and allocates a new join message containing the clients EGO public <i>key</i>. | ||
39 | * (all values are stored as copy) | ||
40 | * | ||
41 | * @param[in] key Private key of EGO | ||
42 | * @return New message | ||
43 | */ | ||
44 | struct GNUNET_MESSENGER_Message* | ||
45 | create_message_join (const struct GNUNET_IDENTITY_PrivateKey *key); | ||
46 | |||
47 | /** | ||
48 | * Creates and allocates a new leave message. | ||
49 | * | ||
50 | * @return New message | ||
51 | */ | ||
52 | struct GNUNET_MESSENGER_Message* | ||
53 | create_message_leave (); | ||
54 | |||
55 | /** | ||
56 | * Creates and allocates a new name message containing the <i>name</i> to change to. | ||
57 | * (all values are stored as copy) | ||
58 | * | ||
59 | * @param[in] name New name | ||
60 | * @return New message | ||
61 | */ | ||
62 | struct GNUNET_MESSENGER_Message* | ||
63 | create_message_name (const char *name); | ||
64 | |||
65 | /** | ||
66 | * Creates and allocates a new key message containing the public <i>key</i> to change to derived | ||
67 | * from its private counterpart. (all values are stored as copy) | ||
68 | * | ||
69 | * @param[in] key Private key of EGO | ||
70 | * @return New message | ||
71 | */ | ||
72 | struct GNUNET_MESSENGER_Message* | ||
73 | create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key); | ||
74 | |||
75 | /** | ||
76 | * Creates and allocates a new id message containing the unique member id to change to. | ||
77 | * (all values are stored as copy) | ||
78 | * | ||
79 | * @param[in] unique_id Unique member id | ||
80 | * @return New message | ||
81 | */ | ||
82 | struct GNUNET_MESSENGER_Message* | ||
83 | create_message_id (const struct GNUNET_ShortHashCode *unique_id); | ||
84 | |||
85 | /** | ||
86 | * Creates and allocates a new request message containing the <i>hash</i> of a missing message. | ||
87 | * (all values are stored as copy) | ||
88 | * | ||
89 | * @param[in] hash Hash of message | ||
90 | * @return New message | ||
91 | */ | ||
92 | struct GNUNET_MESSENGER_Message* | ||
93 | create_message_request (const struct GNUNET_HashCode *hash); | ||
94 | |||
95 | /** | ||
96 | * Creates and allocates a new invite message containing the peer identity of an entrance peer | ||
97 | * to a room using a given <i>key</i> as shared secret for communication. | ||
98 | * (all values are stored as copy) | ||
99 | * | ||
100 | * @param[in] door Peer identity | ||
101 | * @param[in] key Shared secret of a room | ||
102 | * @return New message | ||
103 | */ | ||
104 | struct GNUNET_MESSENGER_Message* | ||
105 | create_message_invite (const struct GNUNET_PeerIdentity *door, | ||
106 | const struct GNUNET_HashCode *key); | ||
107 | |||
108 | /** | ||
109 | * Creates and allocates a new <i>text</i> message containing a string representing text. | ||
110 | * (all values are stored as copy) | ||
111 | * | ||
112 | * @param[in] text Text | ||
113 | * @return New message | ||
114 | */ | ||
115 | struct GNUNET_MESSENGER_Message* | ||
116 | create_message_text (const char *text); | ||
117 | |||
118 | /** | ||
119 | * Creates and allocates a new delete message containing the <i>hash</i> of a message to delete after a specific <i>delay</i>. | ||
120 | * (all values are stored as copy) | ||
121 | * | ||
122 | * @param[in] hash Hash of message | ||
123 | * @param[in] delay Delay of deletion | ||
124 | * @return New message | ||
125 | */ | ||
126 | struct GNUNET_MESSENGER_Message* | ||
127 | create_message_delete (const struct GNUNET_HashCode *hash, | ||
128 | const struct GNUNET_TIME_Relative delay); | ||
129 | |||
130 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H | ||