-test skeleton -- disable for now
[oweals/gnunet.git] / src / scalarproduct / gnunet-service-scalarproduct.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2013, 2014 Christian Grothoff (and other contributing authors)
4
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.
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      General Public License for more details.
14
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19  */
20 /**
21  * @file scalarproduct/gnunet-service-scalarproduct.h
22  * @brief scalarproduct service  P2P messages
23  * @author Christian M. Fuchs
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_SCALARPRODUCT_H
27 #define GNUNET_SERVICE_SCALARPRODUCT_H
28
29
30 GNUNET_NETWORK_STRUCT_BEGIN
31
32 /**
33  * Message type passed from requesting service Alice to responding
34  * service Bob to initiate a request and make Bob participate in our
35  * protocol.  Afterwards, Bob is expected to perform the set
36  * intersection with Alice. Once that has succeeded, Alice will
37  * send a `struct AliceCryptodataMessage *`.  Bob is not expected
38  * to respond via CADET in the meantime.
39  */
40 struct ServiceRequestMessage
41 {
42   /**
43    * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SESSION_INITIALIZATION
44    */
45   struct GNUNET_MessageHeader header;
46
47   /**
48    * For alignment. Always zero.
49    */
50   uint32_t reserved;
51
52   /**
53    * The transaction/session key used to identify a session
54    */
55   struct GNUNET_HashCode session_id;
56
57   /**
58    * Alice's public key
59    */
60   struct GNUNET_CRYPTO_PaillierPublicKey public_key;
61
62 };
63
64
65 /**
66  * Vector of Pallier-encrypted values sent by Alice to Bob
67  * (after set intersection).  Alice may send messages of this
68  * type repeatedly to transmit all values.
69  */
70 struct AliceCryptodataMessage
71 {
72   /**
73    * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA
74    */
75   struct GNUNET_MessageHeader header;
76
77   /**
78    * How many elements we appended to this message? In NBO.
79    */
80   uint32_t contained_element_count GNUNET_PACKED;
81
82   /**
83    * struct GNUNET_CRYPTO_PaillierCiphertext[contained_element_count]
84    */
85 };
86
87
88 /**
89  * Message type passed from responding service Bob to responding
90  * service Alice to complete a request and allow Alice to compute the
91  * result.  If Bob's reply does not fit into this one message, the
92  * conversation may be continued with `struct BobCryptodataMultipartMessage`
93  * messages afterwards.
94  */
95 struct BobCryptodataMessage
96 {
97   /**
98    * GNUNET message header with type
99    * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_CRYPTODATA.
100    */
101   struct GNUNET_MessageHeader header;
102
103   /**
104    * How many elements this individual message delivers (in NBO).
105    */
106   uint32_t contained_element_count GNUNET_PACKED;
107
108   /**
109    * followed by s | s' | k[i][perm]
110    */
111 };
112
113
114 /**
115  * Multipart Message type passed between to supply additional elements
116  * for the peer.  Send from Bob to Alice with additional elements
117  * of k[i][perm] after his `struct BobCryptodataMessage *`.
118  * Once all k-values have been transmitted, Bob is finished and
119  * Alice can transmit the final result to the client.
120  */
121 struct BobCryptodataMultipartMessage
122 {
123   /**
124    * GNUNET message header
125    */
126   struct GNUNET_MessageHeader header;
127
128   /**
129    * How many elements we supply within this message? In NBO.
130    */
131   uint32_t contained_element_count GNUNET_PACKED;
132
133   /**
134    * Followed by `struct
135    * GNUNET_CRYPTO_PaillierCiphertext[contained_element_count]`
136    */
137 };
138
139
140
141 GNUNET_NETWORK_STRUCT_END
142
143
144 #endif