diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-02 13:50:45 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-02 13:50:45 +0000 |
commit | 5635cdd2e7644ca44e94c767b42831d891f35df7 (patch) | |
tree | e29d6bb3819cc3a20c19cc93e603ae3084536cc5 /src/scalarproduct/scalarproduct.h | |
parent | 75bcc248e9dfbbe5976f1ecd3a42f7d40df74432 (diff) | |
download | gnunet-5635cdd2e7644ca44e94c767b42831d891f35df7.tar.gz gnunet-5635cdd2e7644ca44e94c767b42831d891f35df7.zip |
added new header for protocol definitions
Diffstat (limited to 'src/scalarproduct/scalarproduct.h')
-rw-r--r-- | src/scalarproduct/scalarproduct.h | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/src/scalarproduct/scalarproduct.h b/src/scalarproduct/scalarproduct.h new file mode 100644 index 000000000..5d6b82a35 --- /dev/null +++ b/src/scalarproduct/scalarproduct.h | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009, 2010, 2011, 2012, 2013 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., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file scalarproduct.h | ||
23 | * @brief Scalar Product Message Types | ||
24 | * @author Christian M. Fuchs | ||
25 | * | ||
26 | * Created on September 2, 2013, 3:43 PM | ||
27 | */ | ||
28 | |||
29 | #ifndef SCALARPRODUCT_H | ||
30 | #define SCALARPRODUCT_H | ||
31 | |||
32 | #ifdef __cplusplus | ||
33 | extern "C" | ||
34 | { | ||
35 | #endif | ||
36 | |||
37 | /////////////////////////////////////////////////////////////////////////////// | ||
38 | // Scalar Product Message Types | ||
39 | /////////////////////////////////////////////////////////////////////////////// | ||
40 | |||
41 | /** | ||
42 | * Message type passed from client to service | ||
43 | * to initiate a request or responder role | ||
44 | */ | ||
45 | struct GNUNET_SCALARPRODUCT_client_request | ||
46 | { | ||
47 | /** | ||
48 | * GNUNET message header | ||
49 | */ | ||
50 | struct GNUNET_MessageHeader header; | ||
51 | |||
52 | /** | ||
53 | * how many elements the vector in payload contains | ||
54 | */ | ||
55 | uint16_t element_count GNUNET_PACKED; | ||
56 | |||
57 | /** | ||
58 | * how many bytes the mask has | ||
59 | */ | ||
60 | uint16_t mask_length GNUNET_PACKED; | ||
61 | |||
62 | /** | ||
63 | * the transaction/session key used to identify a session | ||
64 | */ | ||
65 | struct GNUNET_HashCode key; | ||
66 | |||
67 | /** | ||
68 | * the identity of a remote peer we want to communicate with | ||
69 | */ | ||
70 | struct GNUNET_PeerIdentity peer; | ||
71 | |||
72 | /** | ||
73 | * followed by long vector[element_count] | [unsigned char mask[mask_bytes]] | ||
74 | */ | ||
75 | }; | ||
76 | |||
77 | /** | ||
78 | * Message type passed from requesting service Alice to responding service Bob | ||
79 | * to initiate a request and make bob participate in our protocol | ||
80 | */ | ||
81 | struct GNUNET_SCALARPRODUCT_service_request { | ||
82 | /** | ||
83 | * GNUNET message header | ||
84 | */ | ||
85 | struct GNUNET_MessageHeader header; | ||
86 | |||
87 | /** | ||
88 | * how many bytes the mask has | ||
89 | */ | ||
90 | uint16_t mask_length GNUNET_PACKED; | ||
91 | |||
92 | /** | ||
93 | * the length of the publickey contained within this message | ||
94 | */ | ||
95 | uint16_t pk_length GNUNET_PACKED; | ||
96 | |||
97 | /** | ||
98 | * the transaction/session key used to identify a session | ||
99 | */ | ||
100 | struct GNUNET_HashCode key; | ||
101 | |||
102 | /** | ||
103 | * how many elements the vector in payload contains | ||
104 | */ | ||
105 | uint16_t element_count GNUNET_PACKED; | ||
106 | |||
107 | /** | ||
108 | * how many elements are actually included after the mask was applied. | ||
109 | */ | ||
110 | uint16_t used_element_count GNUNET_PACKED; | ||
111 | |||
112 | /** | ||
113 | * followed by mask | public_key | vector[used_element_count] | ||
114 | */ | ||
115 | }; | ||
116 | |||
117 | /** | ||
118 | * Message type passed from responding service Bob to responding service Alice | ||
119 | * to complete a request and allow Alice to compute the result | ||
120 | */ | ||
121 | struct GNUNET_SCALARPRODUCT_service_response { | ||
122 | /** | ||
123 | * GNUNET message header | ||
124 | */ | ||
125 | struct GNUNET_MessageHeader header; | ||
126 | |||
127 | /** | ||
128 | * how many elements the vector in payload contains | ||
129 | */ | ||
130 | uint16_t element_count GNUNET_PACKED; | ||
131 | |||
132 | /** | ||
133 | * how many elements are actually included after the mask was applied. | ||
134 | */ | ||
135 | uint16_t used_element_count GNUNET_PACKED; | ||
136 | |||
137 | /** | ||
138 | * the transaction/session key used to identify a session | ||
139 | */ | ||
140 | struct GNUNET_HashCode key; | ||
141 | |||
142 | /** | ||
143 | * followed by s | s' | kp[] | kq[] | ||
144 | */ | ||
145 | }; | ||
146 | |||
147 | /** | ||
148 | * Message type passed from service client | ||
149 | * to finalize a session as requester or responder | ||
150 | */ | ||
151 | struct GNUNET_SCALARPRODUCT_client_response | ||
152 | { | ||
153 | /** | ||
154 | * GNUNET message header | ||
155 | */ | ||
156 | struct GNUNET_MessageHeader header; | ||
157 | |||
158 | /** | ||
159 | * 0 if no product attached | ||
160 | */ | ||
161 | uint32_t product_length GNUNET_PACKED; | ||
162 | |||
163 | /** | ||
164 | * the transaction/session key used to identify a session | ||
165 | */ | ||
166 | struct GNUNET_HashCode key; | ||
167 | |||
168 | /** | ||
169 | * the identity of a remote peer we want to communicate with | ||
170 | */ | ||
171 | struct GNUNET_PeerIdentity peer; | ||
172 | |||
173 | /** | ||
174 | * Workaround for libgcrypt: -1 if negative, 0 if zero, else 1 | ||
175 | */ | ||
176 | int8_t range; | ||
177 | |||
178 | /** | ||
179 | * followed by product of length product_length (or nothing) | ||
180 | */ | ||
181 | }; | ||
182 | |||
183 | #ifdef __cplusplus | ||
184 | } | ||
185 | #endif | ||
186 | |||
187 | #endif /* SCALARPRODUCT_H */ | ||
188 | |||