2 This file is part of GNUnet.
3 Copyright (C) 2013-2016 GNUnet e.V.
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.
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.
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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @file conversation/conversation.h
23 * @brief constants for network protocols
24 * @author Siomon Dieterle
25 * @author Andreas Fuchs
27 #ifndef CONVERSATION_H
28 #define CONVERSATION_H
33 #if 0 /* keep Emacsens' auto-indent happy */
39 #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
43 * Highest bit in a 32-bit unsigned integer,
44 * bit set if we are making an outgoing call,
45 * bit unset for local lines.
47 #define HIGH_BIT ((uint32_t)(1LL << 31))
49 GNUNET_NETWORK_STRUCT_BEGIN
53 * Message to transmit the audio (between client and helpers).
57 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
59 struct GNUNET_MessageHeader header;
61 /* followed by audio data */
66 * Client -> Service message to register a phone.
68 struct ClientPhoneRegisterMessage {
70 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER
72 struct GNUNET_MessageHeader header;
77 uint32_t reserved GNUNET_PACKED;
80 * Phone line / CADET port to register.
82 struct GNUNET_HashCode line_port;
87 * Service -> Client message for phone is ringing.
89 struct ClientPhoneRingMessage {
91 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING
93 struct GNUNET_MessageHeader header;
96 * CID, internal caller ID number used in the future to identify
97 * which active call we are talking about.
99 uint32_t cid GNUNET_PACKED;
104 struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
109 * Service <-> Client message for phone was suspended.
111 struct ClientPhoneSuspendMessage {
113 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
115 struct GNUNET_MessageHeader header;
118 * CID, internal caller ID to identify which active call we are
121 uint32_t cid GNUNET_PACKED;
126 * Service <-> Client message for phone was resumed.
128 struct ClientPhoneResumeMessage {
130 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
132 struct GNUNET_MessageHeader header;
135 * CID, internal caller ID to identify which active call we are
138 uint32_t cid GNUNET_PACKED;
143 * Client -> Service pick up phone that is ringing.
145 struct ClientPhonePickupMessage {
147 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
149 struct GNUNET_MessageHeader header;
152 * CID, internal caller ID to identify which active call we are
155 uint32_t cid GNUNET_PACKED;
160 * Client <-> Service hang up phone that may or may not be ringing.
161 * Also sent in response to a (failed) `struct ClientCallMessage`.
163 struct ClientPhoneHangupMessage {
165 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
167 struct GNUNET_MessageHeader header;
170 * CID, internal caller ID to identify which active call we are
173 uint32_t cid GNUNET_PACKED;
178 * Message Client <-> Service to transmit the audio.
180 struct ClientAudioMessage {
182 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
184 struct GNUNET_MessageHeader header;
187 * CID, internal caller ID to identify which active call we are
190 uint32_t cid GNUNET_PACKED;
192 /* followed by audio data */
197 * Client -> Service message to call a phone.
199 struct ClientCallMessage {
201 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
203 struct GNUNET_MessageHeader header;
208 uint32_t reserved GNUNET_PACKED;
211 * Which peer is hosting the line?
213 struct GNUNET_PeerIdentity target;
216 * Which phone line to call at the peer?
218 struct GNUNET_HashCode line_port;
221 * Identity of the caller.
223 struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id;
228 * Service -> Client: other peer has picked up the phone, we are
231 struct ClientPhonePickedupMessage {
233 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
235 struct GNUNET_MessageHeader header;
238 * Call ID of the corresponding
239 * #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
241 uint32_t cid GNUNET_PACKED;
246 * Information signed in a `struct CadetPhoneRingMessage`
247 * whereby the caller self-identifies to the receiver.
249 struct CadetPhoneRingInfoPS {
251 * Purpose for the signature, must be
252 * #GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING.
254 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
257 * Which port did the call go to?
259 struct GNUNET_HashCode line_port;
262 * Which peer is the call for?
264 struct GNUNET_PeerIdentity target_peer;
267 * When does the signature expire?
269 struct GNUNET_TIME_AbsoluteNBO expiration_time;
274 * Cadet message to make a phone ring. Sent to the port
275 * of the respective phone.
277 struct CadetPhoneRingMessage {
279 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
281 struct GNUNET_MessageHeader header;
286 uint32_t reserved GNUNET_PACKED;
289 * Who is calling us? (also who is signing).
291 struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
294 * When does the signature expire?
296 struct GNUNET_TIME_AbsoluteNBO expiration_time;
299 * Signature over a `struct CadetPhoneRingInfoPS`
301 struct GNUNET_CRYPTO_EcdsaSignature signature;
306 * Cadet message for hanging up.
308 struct CadetPhoneHangupMessage {
310 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
312 struct GNUNET_MessageHeader header;
317 * Cadet message for picking up.
319 struct CadetPhonePickupMessage {
321 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
323 struct GNUNET_MessageHeader header;
328 * Cadet message for phone suspended.
330 struct CadetPhoneSuspendMessage {
332 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
334 struct GNUNET_MessageHeader header;
339 * Cadet message for phone resumed.
341 struct CadetPhoneResumeMessage {
343 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
345 struct GNUNET_MessageHeader header;
350 * Cadet message to transmit the audio.
352 struct CadetAudioMessage {
354 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
356 struct GNUNET_MessageHeader header;
358 /* followed by audio data */
362 GNUNET_NETWORK_STRUCT_END
365 #if 0 /* keep Emacsens' auto-indent happy */
372 /* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */
374 /* end of gnunet_protocols_conversation.h */