2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011, 2012, 2013 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
21 * @file scalarproduct.h
22 * @brief Scalar Product API Message Types
23 * @author Christian M. Fuchs
25 #ifndef SCALARPRODUCT_H
26 #define SCALARPRODUCT_H
28 GNUNET_NETWORK_STRUCT_BEGIN
31 * Log an error message at log-level 'level' that indicates
32 * a failure of the command 'cmd' with the message given
33 * by gcry_strerror(rc).
35 #define LOG_GCRY(level, cmd, rc) do { LOG (level, _ ( \
36 "`%s' failed at %s:%d with error: %s\n"), \
37 cmd, __FILE__, __LINE__, \
38 gcry_strerror (rc)); } while (0)
42 * Message type passed from client to service
43 * to initiate a request or responder role
45 struct AliceComputationMessage
48 * GNUNET message header with type
49 * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE
51 struct GNUNET_MessageHeader header;
54 * how many elements the vector in payload contains
56 uint32_t element_count_total GNUNET_PACKED;
59 * contained elements the vector in payload contains
61 uint32_t element_count_contained GNUNET_PACKED;
66 uint32_t reserved GNUNET_PACKED;
69 * the transaction/session key used to identify a session
71 struct GNUNET_HashCode session_key;
74 * the identity of a remote peer we want to communicate with
76 struct GNUNET_PeerIdentity peer;
79 * followed by struct GNUNET_SCALARPRODUCT_Element[]
85 * Message type passed from client to service
86 * to initiate a request or responder role
88 struct BobComputationMessage
91 * GNUNET message header with type
92 * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_BOB
94 struct GNUNET_MessageHeader header;
97 * how many elements the vector in payload contains
99 uint32_t element_count_total GNUNET_PACKED;
102 * contained elements the vector in payload contains
104 uint32_t element_count_contained GNUNET_PACKED;
109 uint32_t reserved GNUNET_PACKED;
112 * the transaction/session key used to identify a session
114 struct GNUNET_HashCode session_key;
117 * followed by struct GNUNET_SCALARPRODUCT_Element[]
123 * multipart messages following `struct ComputationMessage`
125 struct ComputationBobCryptodataMultipartMessage
128 * GNUNET message header
130 struct GNUNET_MessageHeader header;
133 * contained elements the vector in payload contains
135 uint32_t element_count_contained GNUNET_PACKED;
138 * followed by struct GNUNET_SCALARPRODUCT_Element[]
144 * Message type passed from service client
145 * to finalize a session as requester or responder
147 struct ClientResponseMessage
150 * GNUNET message header
152 struct GNUNET_MessageHeader header;
155 * 0 if no product attached
157 uint32_t product_length GNUNET_PACKED;
160 * Status information about the outcome of this session,
161 * An `enum GNUNET_SCALARPRODUCT_ResponseStatus` (in NBO).
163 uint32_t status GNUNET_PACKED;
166 * Workaround for libgcrypt: -1 if negative, 0 if zero, else 1
168 int32_t range GNUNET_PACKED;
171 * followed by product of length product_length (or nothing)
175 GNUNET_NETWORK_STRUCT_END
177 #endif /* SCALARPRODUCT_H */