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