2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011, 2012, 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file scalarproduct.h
22 * @brief Scalar Product 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, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0)
39 * Message type passed from client to service
40 * to initiate a request or responder role
42 struct AliceComputationMessage
45 * GNUNET message header with type
46 * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE
48 struct GNUNET_MessageHeader header;
51 * how many elements the vector in payload contains
53 uint32_t element_count_total GNUNET_PACKED;
56 * contained elements the vector in payload contains
58 uint32_t element_count_contained GNUNET_PACKED;
63 uint32_t reserved GNUNET_PACKED;
66 * the transaction/session key used to identify a session
68 struct GNUNET_HashCode session_key;
71 * the identity of a remote peer we want to communicate with
73 struct GNUNET_PeerIdentity peer;
76 * followed by struct GNUNET_SCALARPRODUCT_Element[]
82 * Message type passed from client to service
83 * to initiate a request or responder role
85 struct BobComputationMessage
88 * GNUNET message header with type
89 * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_BOB
91 struct GNUNET_MessageHeader header;
94 * how many elements the vector in payload contains
96 uint32_t element_count_total GNUNET_PACKED;
99 * contained elements the vector in payload contains
101 uint32_t element_count_contained GNUNET_PACKED;
106 uint32_t reserved GNUNET_PACKED;
109 * the transaction/session key used to identify a session
111 struct GNUNET_HashCode session_key;
114 * followed by struct GNUNET_SCALARPRODUCT_Element[]
120 * multipart messages following `struct ComputationMessage`
122 struct ComputationBobCryptodataMultipartMessage
125 * GNUNET message header
127 struct GNUNET_MessageHeader header;
130 * contained elements the vector in payload contains
132 uint32_t element_count_contained GNUNET_PACKED;
135 * followed by struct GNUNET_SCALARPRODUCT_Element[]
141 * Message type passed from service client
142 * to finalize a session as requester or responder
144 struct ClientResponseMessage
147 * GNUNET message header
149 struct GNUNET_MessageHeader header;
152 * 0 if no product attached
154 uint32_t product_length GNUNET_PACKED;
157 * Status information about the outcome of this session,
158 * An `enum GNUNET_SCALARPRODUCT_ResponseStatus` (in NBO).
160 uint32_t status GNUNET_PACKED;
163 * Workaround for libgcrypt: -1 if negative, 0 if zero, else 1
165 int32_t range GNUNET_PACKED;
168 * followed by product of length product_length (or nothing)
172 GNUNET_NETWORK_STRUCT_END
174 #endif /* SCALARPRODUCT_H */