diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-03-17 17:19:30 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-03-17 17:19:30 +0000 |
commit | a48e8f508403c9d8641a0c9eb47d88f98cb47f28 (patch) | |
tree | 4f4f5f09a6aa89c60ba1798d507e1cb0cab0a6b9 /src/dht/dht.h | |
parent | b571e5a4ed7fb2ef6f203c540e82675cf38bfcf8 (diff) | |
download | gnunet-a48e8f508403c9d8641a0c9eb47d88f98cb47f28.tar.gz gnunet-a48e8f508403c9d8641a0c9eb47d88f98cb47f28.zip |
beginning of changes
Diffstat (limited to 'src/dht/dht.h')
-rw-r--r-- | src/dht/dht.h | 78 |
1 files changed, 61 insertions, 17 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h index 5293bf6bd..82b0df9a2 100644 --- a/src/dht/dht.h +++ b/src/dht/dht.h | |||
@@ -33,6 +33,43 @@ typedef void (*GNUNET_DHT_MessageReceivedHandler) (void *cls, | |||
33 | struct GNUNET_MessageHeader *msg); | 33 | struct GNUNET_MessageHeader *msg); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Generic DHT message, wrapper for other message types | ||
37 | */ | ||
38 | struct GNUNET_DHT_Message | ||
39 | { | ||
40 | /** | ||
41 | * Type: GNUNET_MESSAGE_TYPE_DHT_MESSAGE | ||
42 | */ | ||
43 | struct GNUNET_MessageHeader header; | ||
44 | |||
45 | /** | ||
46 | * The key to search for | ||
47 | */ | ||
48 | GNUNET_HashCode key; | ||
49 | |||
50 | /** | ||
51 | * Replication level for this message | ||
52 | */ | ||
53 | uint16_t desired_replication_level; | ||
54 | |||
55 | /** | ||
56 | * Message options | ||
57 | */ | ||
58 | uint16_t options; | ||
59 | |||
60 | /** | ||
61 | * Is this message uniquely identified? If so it has | ||
62 | * a unique_id appended to it. | ||
63 | */ | ||
64 | /* uint16_t unique; I don't think we need this, it should be held in the encapsulated message */ | ||
65 | |||
66 | /* uint64_t unique_id*/ | ||
67 | /* */ | ||
68 | /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */ | ||
69 | |||
70 | }; | ||
71 | |||
72 | /** | ||
36 | * Message to insert data into the DHT | 73 | * Message to insert data into the DHT |
37 | */ | 74 | */ |
38 | struct GNUNET_DHT_PutMessage | 75 | struct GNUNET_DHT_PutMessage |
@@ -48,11 +85,6 @@ struct GNUNET_DHT_PutMessage | |||
48 | size_t type; | 85 | size_t type; |
49 | 86 | ||
50 | /** | 87 | /** |
51 | * The key to insert data under. | ||
52 | */ | ||
53 | GNUNET_HashCode key; | ||
54 | |||
55 | /** | ||
56 | * The size of the data, appended to the end of this message. | 88 | * The size of the data, appended to the end of this message. |
57 | */ | 89 | */ |
58 | size_t data_size; | 90 | size_t data_size; |
@@ -60,7 +92,7 @@ struct GNUNET_DHT_PutMessage | |||
60 | /** | 92 | /** |
61 | * How long should this data persist? | 93 | * How long should this data persist? |
62 | */ | 94 | */ |
63 | struct GNUNET_TIME_Relative timeout; | 95 | struct GNUNET_TIME_Absolute expiration; |
64 | 96 | ||
65 | }; | 97 | }; |
66 | 98 | ||
@@ -115,32 +147,44 @@ struct GNUNET_DHT_GetResultMessage | |||
115 | }; | 147 | }; |
116 | 148 | ||
117 | /** | 149 | /** |
118 | * Response to PUT request from the DHT | 150 | * Message to request data from the DHT |
119 | */ | 151 | */ |
120 | struct GNUNET_DHT_PutResultMessage | 152 | struct GNUNET_DHT_FindPeerMessage |
121 | { | 153 | { |
122 | /** | 154 | /** |
123 | * Type: GNUNET_MESSAGE_TYPE_DHT_PUT_RESULT | 155 | * Type: GNUNET_MESSAGE_TYPE_DHT_FIND_PEER |
124 | */ | 156 | */ |
125 | struct GNUNET_MessageHeader header; | 157 | struct GNUNET_MessageHeader header; |
126 | 158 | ||
127 | /** | 159 | /** |
128 | * The type for the data for the GET request | 160 | * The key being looked up |
129 | */ | 161 | */ |
130 | size_t type; | 162 | GNUNET_HashCode key; |
163 | |||
164 | }; | ||
131 | 165 | ||
166 | /** | ||
167 | * Message to return data from the DHT | ||
168 | */ | ||
169 | struct GNUNET_DHT_FindPeerResultMessage | ||
170 | { | ||
132 | /** | 171 | /** |
133 | * The key to search for | 172 | * Type: GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT |
134 | */ | 173 | */ |
135 | GNUNET_HashCode key; | 174 | struct GNUNET_MessageHeader header; |
136 | 175 | ||
137 | /** | 176 | /** |
138 | * Was the put successful? GNUNET_YES or GNUNET_NO | 177 | * The peer that was searched for |
139 | */ | 178 | */ |
140 | size_t result; | 179 | struct GNUNET_PeerIdentity peer; |
141 | |||
142 | }; | ||
143 | 180 | ||
181 | /** | ||
182 | * The size of the HELLO for the returned peer, | ||
183 | * appended to the end of this message, 0 if | ||
184 | * no hello. | ||
185 | */ | ||
186 | size_t data_size; | ||
144 | 187 | ||
188 | }; | ||
145 | 189 | ||
146 | #endif /* DHT_H_ */ | 190 | #endif /* DHT_H_ */ |