diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-04-16 07:01:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-04-16 07:01:48 +0000 |
commit | 63321de7f2e730f590a5b0560bed321e26738b3f (patch) | |
tree | 7fc832b8bf5418471f3cfc09dcfd585b0df89cd8 | |
parent | 4ad2dc840e92ef8a0e4a33b0c53f9f16cb6de877 (diff) | |
download | gnunet-63321de7f2e730f590a5b0560bed321e26738b3f.tar.gz gnunet-63321de7f2e730f590a5b0560bed321e26738b3f.zip |
-minor remarks on Florians draft
-rw-r--r-- | src/include/gnunet_set_service.h | 135 |
1 files changed, 77 insertions, 58 deletions
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index eca01f81a..78dc7b7d0 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h | |||
@@ -1,3 +1,4 @@ | |||
1 | // FIXME: copyright, etc. | ||
1 | 2 | ||
2 | /** | 3 | /** |
3 | * The operation that a set set supports. | 4 | * The operation that a set set supports. |
@@ -33,6 +34,7 @@ enum GNUNET_SET_Status | |||
33 | GNUNET_SET_STATUS_REFUSED | 34 | GNUNET_SET_STATUS_REFUSED |
34 | }; | 35 | }; |
35 | 36 | ||
37 | // FIXME: comment | ||
36 | struct GNUNET_SET_Element | 38 | struct GNUNET_SET_Element |
37 | { | 39 | { |
38 | /** | 40 | /** |
@@ -49,9 +51,51 @@ struct GNUNET_SET_Element | |||
49 | void *data; | 51 | void *data; |
50 | }; | 52 | }; |
51 | 53 | ||
54 | |||
55 | /** | ||
56 | * Create an empty set, supporting the specified operation. | ||
57 | * | ||
58 | * @param op operation supported by the set | ||
59 | * Note that the operation has to be specified | ||
60 | * beforehand, as certain set operations need to maintain | ||
61 | * data structures spefific to the operation | ||
62 | * @return a handle to the set | ||
63 | */ | ||
64 | struct GNUNET_SET_Handle * | ||
65 | GNUNET_SET_create (enum GNUNET_SET_Operation op); | ||
66 | |||
67 | |||
68 | // FIXME: comment | ||
69 | void | ||
70 | GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, | ||
71 | const struct GNUNET_SET_Element *element, | ||
72 | GNUNET_SET_Continuation cont, | ||
73 | void *cont_cls); | ||
74 | |||
75 | |||
76 | // FIXME: comment | ||
77 | void | ||
78 | GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set, | ||
79 | const struct GNUNET_SET_Element *element, | ||
80 | GNUNET_SET_Continuation cont, | ||
81 | void *cont_cls); | ||
82 | |||
83 | |||
84 | // FIXME: comment | ||
85 | struct GNUNET_SET_Handle * | ||
86 | GNUNET_SET_clone (struct GNUNET_SET_Handle *set); | ||
87 | |||
88 | |||
89 | // FIXME: comment | ||
90 | void | ||
91 | GNUNET_SET_destroy (struct GNUNET_SET_Handle *set); | ||
92 | |||
93 | |||
94 | |||
52 | /** | 95 | /** |
53 | * Callback for set operation results. Called for each element | 96 | * Callback for set operation results. Called for each element |
54 | * in the result set. | 97 | * in the result set. |
98 | // FIXME: might want a way to just get the 'additional/removd' elements | ||
55 | * | 99 | * |
56 | * @param cls closure | 100 | * @param cls closure |
57 | * @param element element, or NULL to indicate that all elements | 101 | * @param element element, or NULL to indicate that all elements |
@@ -64,6 +108,26 @@ typedef void | |||
64 | struct GNUNET_SET_Element *element, | 108 | struct GNUNET_SET_Element *element, |
65 | enum GNUNET_SET_ResultStatus status); | 109 | enum GNUNET_SET_ResultStatus status); |
66 | 110 | ||
111 | |||
112 | /** | ||
113 | * Evaluate a set operation with our set and the set of another peer. | ||
114 | * | ||
115 | * @param other_peer peer with the other set | ||
116 | * @param app_id hash for the application using the set | ||
117 | * @param context_msg additional information for the request | ||
118 | * @param result_cb called on error or success | ||
119 | * @param result_cls closure for result_cb | ||
120 | * @return a handle to cancel the operation | ||
121 | */ | ||
122 | struct GNUNET_SET_OperationHandle * | ||
123 | GNUNET_SET_evaluate (const struct GNUNET_PeerIdentity *other_peer, | ||
124 | const struct GNUNET_HashCode *app_id, | ||
125 | const struct GNUNET_MessageHeader *context_msg, | ||
126 | struct GNUNET_TIME_Relative timeout, | ||
127 | GNUNET_SET_ResultIterator result_cb, | ||
128 | void *result_cls); | ||
129 | |||
130 | |||
67 | /** | 131 | /** |
68 | * Called when another peer wants to do a set operation with the | 132 | * Called when another peer wants to do a set operation with the |
69 | * local peer | 133 | * local peer |
@@ -80,41 +144,10 @@ typedef void | |||
80 | */ | 144 | */ |
81 | typedef void | 145 | typedef void |
82 | (*GNUNET_SET_ListenCallback) (void *cls, | 146 | (*GNUNET_SET_ListenCallback) (void *cls, |
83 | struct GNUNET_PeerIdentity *other_peer, | 147 | const struct GNUNET_PeerIdentity *other_peer, |
84 | struct GNUNET_MessageHeader *context_msg, | 148 | const struct GNUNET_MessageHeader *context_msg, |
85 | struct GNUNET_SET_Request *request); | 149 | struct GNUNET_SET_Request *request); |
86 | 150 | ||
87 | /** | ||
88 | * Create an empty set, supporting the specified operation. | ||
89 | * | ||
90 | * @param op operation supported by the set | ||
91 | * Note that the operation has to be specified | ||
92 | * beforehand, as certain set operations need to maintain | ||
93 | * data structures spefific to the operation | ||
94 | * @return a handle to the set | ||
95 | */ | ||
96 | struct GNUNET_SET_Handle * | ||
97 | GNUNET_SET_create (enum GNUNET_SET_Operation op); | ||
98 | |||
99 | |||
100 | /** | ||
101 | * Evaluate a set operation with our set and the set of another peer. | ||
102 | * | ||
103 | * @param other_peer peer with the other set | ||
104 | * @param app_id hash for the application using the set | ||
105 | * @param context_msg additional information for the request | ||
106 | * @param result_cb called on error or success | ||
107 | * @param result_cls closure for result_cb | ||
108 | * @return a handle to cancel the operation | ||
109 | */ | ||
110 | struct GNUNET_SET_OperationHandle * | ||
111 | GNUNET_SET_evaluate (struct GNUNET_PeerIdentity other_peer, | ||
112 | struct GNUNET_HashCode *app_id, | ||
113 | struct GNUNET_MessageHeader *context_msg, | ||
114 | struct GNUNET_TIME_Relative timeout, | ||
115 | GNUNET_SET_ResultIterator result_cb, | ||
116 | void *result_cls); | ||
117 | |||
118 | 151 | ||
119 | /** | 152 | /** |
120 | * Wait for set operation requests for the given application id | 153 | * Wait for set operation requests for the given application id |
@@ -128,11 +161,17 @@ GNUNET_SET_evaluate (struct GNUNET_PeerIdentity other_peer, | |||
128 | */ | 161 | */ |
129 | struct GNUNET_SET_ListenHandle * | 162 | struct GNUNET_SET_ListenHandle * |
130 | GNUNET_SET_listen (enum GNUNET_SET_Operation operation, | 163 | GNUNET_SET_listen (enum GNUNET_SET_Operation operation, |
131 | struct GNUNET_HashCode *app_id, | 164 | const struct GNUNET_HashCode *app_id, |
132 | GNUNET_SET_ListenCallback listen_cb, | 165 | GNUNET_SET_ListenCallback listen_cb, |
133 | void *listen_cls); | 166 | void *listen_cls); |
134 | 167 | ||
135 | 168 | ||
169 | |||
170 | // FIXME: comment | ||
171 | void | ||
172 | GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh); | ||
173 | |||
174 | |||
136 | /** | 175 | /** |
137 | * Accept a request we got via GNUNET_SET_listen | 176 | * Accept a request we got via GNUNET_SET_listen |
138 | * | 177 | * |
@@ -145,33 +184,13 @@ GNUNET_SET_listen (enum GNUNET_SET_Operation operation, | |||
145 | struct GNUNET_SET_OperationHandle * | 184 | struct GNUNET_SET_OperationHandle * |
146 | GNUNET_SET_accept (struct GNUNET_SET_Request *request, | 185 | GNUNET_SET_accept (struct GNUNET_SET_Request *request, |
147 | struct GNUNET_SET_Handle *set, | 186 | struct GNUNET_SET_Handle *set, |
148 | struct GNUNET_TIME_Relative timeout | 187 | struct GNUNET_TIME_Relative timeout, |
149 | struct GNUNET_SET_ResultIterator *result_cb, | 188 | GNUNET_SET_ResultIterator result_cb, |
150 | void *cls) | 189 | void *cls) |
151 | |||
152 | |||
153 | void | ||
154 | GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, | ||
155 | struct GNUNET_SET_Element *element, | ||
156 | GNUNET_SET_Continuation cont, | ||
157 | void *cont_cls); | ||
158 | |||
159 | |||
160 | void | ||
161 | GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set, | ||
162 | struct GNUNET_SET_Element *element, | ||
163 | GNUNET_SET_Continuation cont, | ||
164 | void *cont_cls); | ||
165 | 190 | ||
166 | void | ||
167 | GNUNET_SET_destroy (struct GNUNET_SET_Handle *set); | ||
168 | |||
169 | void | ||
170 | GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh); | ||
171 | 191 | ||
192 | // FIXME: comment | ||
172 | void | 193 | void |
173 | GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *op); | 194 | GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *op); |
174 | 195 | ||
175 | struct GNUNET_SET_Handle * | ||
176 | GNUNET_SET_clone (struct GNUNET_SET_Handle *set); | ||
177 | 196 | ||