diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-03-16 19:41:11 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-03-16 19:41:11 +0000 |
commit | 48db873e37ec4127d4d4b86658dea5907bcc1606 (patch) | |
tree | 2f892a7e36a270c327c5df77a35cff200b2019a4 /src/dht/dht.h | |
parent | f2e9dfa6d34c5f213b4ee4d4d38c59104d37a74b (diff) | |
download | gnunet-48db873e37ec4127d4d4b86658dea5907bcc1606.tar.gz gnunet-48db873e37ec4127d4d4b86658dea5907bcc1606.zip |
dht api, shell dht service, base of future test case.... not yet working
Diffstat (limited to 'src/dht/dht.h')
-rw-r--r-- | src/dht/dht.h | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h new file mode 100644 index 000000000..5293bf6bd --- /dev/null +++ b/src/dht/dht.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2001, 2002, 2003, 2004, 2009 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 2, 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 | * @author Christian Grothoff | ||
23 | * @author Nathan Evans | ||
24 | * @file dht/dht.h | ||
25 | */ | ||
26 | |||
27 | #ifndef DHT_H_ | ||
28 | #define DHT_H_ | ||
29 | |||
30 | #define DEBUG_DHT GNUNET_YES | ||
31 | |||
32 | typedef void (*GNUNET_DHT_MessageReceivedHandler) (void *cls, | ||
33 | struct GNUNET_MessageHeader *msg); | ||
34 | |||
35 | /** | ||
36 | * Message to insert data into the DHT | ||
37 | */ | ||
38 | struct GNUNET_DHT_PutMessage | ||
39 | { | ||
40 | /** | ||
41 | * Type: GNUNET_MESSAGE_TYPE_DHT_PUT | ||
42 | */ | ||
43 | struct GNUNET_MessageHeader header; | ||
44 | |||
45 | /** | ||
46 | * The type of data to insert. | ||
47 | */ | ||
48 | size_t type; | ||
49 | |||
50 | /** | ||
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. | ||
57 | */ | ||
58 | size_t data_size; | ||
59 | |||
60 | /** | ||
61 | * How long should this data persist? | ||
62 | */ | ||
63 | struct GNUNET_TIME_Relative timeout; | ||
64 | |||
65 | }; | ||
66 | |||
67 | |||
68 | /** | ||
69 | * Message to request data from the DHT | ||
70 | */ | ||
71 | struct GNUNET_DHT_GetMessage | ||
72 | { | ||
73 | /** | ||
74 | * Type: GNUNET_MESSAGE_TYPE_DHT_GET | ||
75 | */ | ||
76 | struct GNUNET_MessageHeader header; | ||
77 | |||
78 | /** | ||
79 | * The type for the data for the GET request | ||
80 | */ | ||
81 | size_t type; | ||
82 | |||
83 | /** | ||
84 | * The key to search for | ||
85 | */ | ||
86 | GNUNET_HashCode key; | ||
87 | |||
88 | }; | ||
89 | |||
90 | /** | ||
91 | * Message to return data from the DHT | ||
92 | */ | ||
93 | struct GNUNET_DHT_GetResultMessage | ||
94 | { | ||
95 | /** | ||
96 | * Type: GNUNET_MESSAGE_TYPE_DHT_GET_RESULT | ||
97 | */ | ||
98 | struct GNUNET_MessageHeader header; | ||
99 | |||
100 | /** | ||
101 | * The type for the data for the GET request | ||
102 | */ | ||
103 | size_t type; | ||
104 | |||
105 | /** | ||
106 | * The key to search for | ||
107 | */ | ||
108 | GNUNET_HashCode key; | ||
109 | |||
110 | /** | ||
111 | * The size of the data, appended to the end of this message. | ||
112 | */ | ||
113 | size_t data_size; | ||
114 | |||
115 | }; | ||
116 | |||
117 | /** | ||
118 | * Response to PUT request from the DHT | ||
119 | */ | ||
120 | struct GNUNET_DHT_PutResultMessage | ||
121 | { | ||
122 | /** | ||
123 | * Type: GNUNET_MESSAGE_TYPE_DHT_PUT_RESULT | ||
124 | */ | ||
125 | struct GNUNET_MessageHeader header; | ||
126 | |||
127 | /** | ||
128 | * The type for the data for the GET request | ||
129 | */ | ||
130 | size_t type; | ||
131 | |||
132 | /** | ||
133 | * The key to search for | ||
134 | */ | ||
135 | GNUNET_HashCode key; | ||
136 | |||
137 | /** | ||
138 | * Was the put successful? GNUNET_YES or GNUNET_NO | ||
139 | */ | ||
140 | size_t result; | ||
141 | |||
142 | }; | ||
143 | |||
144 | |||
145 | |||
146 | #endif /* DHT_H_ */ | ||