aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_protocols.h4
-rw-r--r--src/include/gnunet_psyc_service.h226
-rw-r--r--src/include/gnunet_psycstore_plugin.h41
-rw-r--r--src/include/gnunet_psycstore_service.h146
-rw-r--r--src/include/gnunet_social_service.h46
5 files changed, 325 insertions, 138 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 5626e1e5e..ea295197c 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2187,10 +2187,10 @@ extern "C"
2187/* 700 */ 2187/* 700 */
2188 2188
2189/** C->S: client requests channel history from PSYCstore. */ 2189/** C->S: client requests channel history from PSYCstore. */
2190#define GNUNET_MESSAGE_TYPE_PSYC_STORY_REQUEST 701 2190#define GNUNET_MESSAGE_TYPE_PSYC_HISTORY_REPLAY 701
2191 2191
2192/** S->C: result for a channel history request */ 2192/** S->C: result for a channel history request */
2193#define GNUNET_MESSAGE_TYPE_PSYC_STORY_RESULT 702 2193#define GNUNET_MESSAGE_TYPE_PSYC_HISTORY_RESULT 702
2194 2194
2195 2195
2196/** C->S: request best matching state variable from PSYCstore. */ 2196/** C->S: request best matching state variable from PSYCstore. */
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index 7097c46a8..25b405dad 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -160,6 +160,11 @@ enum GNUNET_PSYC_Policy
160enum GNUNET_PSYC_MessageFlags 160enum GNUNET_PSYC_MessageFlags
161{ 161{
162 /** 162 /**
163 * Default / no flags.
164 */
165 GNUNET_PSYC_MESSAGE_DEFAULT = 0,
166
167 /**
163 * Historic message, retrieved from PSYCstore. 168 * Historic message, retrieved from PSYCstore.
164 */ 169 */
165 GNUNET_PSYC_MESSAGE_HISTORIC = 1 << 0, 170 GNUNET_PSYC_MESSAGE_HISTORIC = 1 << 0,
@@ -314,12 +319,12 @@ struct GNUNET_PSYC_CountersResultMessage
314 /** 319 /**
315 * Status code for the operation. 320 * Status code for the operation.
316 */ 321 */
317 int32_t result_code GNUNET_PACKED; 322 uint32_t result_code GNUNET_PACKED;
318 323
319 /** 324 /**
320 * Last message ID sent to the channel. 325 * Last message ID sent to the channel.
321 */ 326 */
322 uint64_t max_message_id; 327 uint64_t max_message_id GNUNET_PACKED;
323}; 328};
324 329
325 330
@@ -503,13 +508,24 @@ struct GNUNET_PSYC_Master;
503 508
504 509
505/** 510/**
506 * Function called after the channel master started. 511 * Function called after connected to the PSYC service
512 * and the channel master started.
507 * 513 *
508 * @param cls Closure. 514 * Also called when reconnected to the service
509 * @param max_message_id Last message ID sent to the channel. 515 * after the connection closed unexpectedly.
516 *
517 * @param cls
518 * Closure.
519 * @param result
520 * #GNUNET_YES if there were already messages sent to the channel,
521 * #GNUNET_NO if the message history is empty,
522 * #GNUNET_SYSERR on error.
523 * @param max_message_id
524 * Last message ID sent to the channel.
510 */ 525 */
511typedef void 526typedef void
512(*GNUNET_PSYC_MasterStartCallback) (void *cls, uint64_t max_message_id); 527(*GNUNET_PSYC_MasterStartCallback) (void *cls, int result,
528 uint64_t max_message_id);
513 529
514 530
515/** 531/**
@@ -720,11 +736,21 @@ struct GNUNET_PSYC_Slave;
720/** 736/**
721 * Function called after the slave connected to the PSYC service. 737 * Function called after the slave connected to the PSYC service.
722 * 738 *
723 * @param cls Closure. 739 * Also called when reconnected to the service
724 * @param max_message_id Last message ID sent to the channel. 740 * after the connection closed unexpectedly.
741 *
742 * @param cls
743 * Closure.
744 * @param result
745 * #GNUNET_YES if there were already messages sent to the channel,
746 * #GNUNET_NO if the message history is empty,
747 * #GNUNET_SYSERR on error.
748 * @param max_message_id
749 * Last message ID sent to the channel.
725 */ 750 */
726typedef void 751typedef void
727(*GNUNET_PSYC_SlaveConnectCallback) (void *cls, uint64_t max_message_id); 752(*GNUNET_PSYC_SlaveConnectCallback) (void *cls, int result,
753 uint64_t max_message_id);
728 754
729 755
730/** 756/**
@@ -876,6 +902,23 @@ struct GNUNET_PSYC_Channel;
876 902
877 903
878/** 904/**
905 * Function called with the result of an asynchronous operation.
906 *
907 * @param cls
908 * Closure.
909 * @param result
910 * Result of the operation.
911 * Usually one of #GNUNET_OK, #GNUNET_YES, #GNUNET_NO, or #GNUNET_SYSERR.
912 * @param err_msg
913 * Error message.
914 */
915typedef void
916(*GNUNET_PSYC_ResultCallback) (void *cls,
917 int64_t result,
918 const char *err_msg);
919
920
921/**
879 * Convert a channel @a master to a @e channel handle to access the @e channel 922 * Convert a channel @a master to a @e channel handle to access the @e channel
880 * APIs. 923 * APIs.
881 * 924 *
@@ -921,7 +964,9 @@ void
921GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel, 964GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel,
922 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 965 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
923 uint64_t announced_at, 966 uint64_t announced_at,
924 uint64_t effective_since); 967 uint64_t effective_since,
968 GNUNET_PSYC_ResultCallback result_cb,
969 void *cls);
925 970
926 971
927/** 972/**
@@ -949,7 +994,9 @@ void
949GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, 994GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel,
950 const struct GNUNET_CRYPTO_EcdsaPublicKey 995 const struct GNUNET_CRYPTO_EcdsaPublicKey
951 *slave_key, 996 *slave_key,
952 uint64_t announced_at); 997 uint64_t announced_at,
998 GNUNET_PSYC_ResultCallback result_cb,
999 void *cls);
953 1000
954 1001
955/** 1002/**
@@ -962,74 +1009,69 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel,
962 * @param value_size Number of bytes in @a value. 1009 * @param value_size Number of bytes in @a value.
963 */ 1010 */
964typedef void 1011typedef void
965(*GNUNET_PSYC_StateCallback) (void *cls, 1012(*GNUNET_PSYC_StateVarCallback) (void *cls,
966 const char *name, 1013 const char *name,
967 const void *value, 1014 const void *value,
968 size_t value_size); 1015 size_t value_size);
969 1016
970 1017
971/** 1018/**
972 * Function called when a requested operation has finished. 1019 * Request to replay a part of the message history of the channel.
973 *
974 * @param cls Closure.
975 */
976typedef void
977(*GNUNET_PSYC_FinishCallback) (void *cls);
978
979
980/**
981 * Handle to a story telling operation.
982 */
983struct GNUNET_PSYC_Story;
984
985
986/**
987 * Request to be told the message history of the channel.
988 * 1020 *
989 * Historic messages (but NOT the state at the time) will be replayed (given to 1021 * Historic messages (but NOT the state at the time) will be replayed (given to
990 * the normal method handlers) if available and if access is permitted. 1022 * the normal method handlers) if available and if access is permitted.
991 * 1023 *
992 * To get the latest message, use 0 for both the start and end message ID. 1024 * @param channel
1025 * Which channel should be replayed?
1026 * @param start_message_id
1027 * Earliest interesting point in history.
1028 * @param end_message_id
1029 * Last (inclusive) interesting point in history.
1030 * @param finish_cb
1031 * Function to call when the requested history has been fully replayed
1032 * (counting message IDs might not suffice, as some messages might be
1033 * secret and thus the listener would not know the story is finished
1034 * without being told explicitly)o once this function has been called, the
1035 * client must not call GNUNET_PSYC_channel_history_replay_cancel() anymore.
1036 * @param cls
1037 * Closure for the callbacks.
993 * 1038 *
994 * @param channel Which channel should be replayed? 1039 * @return Handle to cancel history replay operation.
995 * @param start_message_id Earliest interesting point in history.
996 * @param end_message_id Last (exclusive) interesting point in history.
997 * @param message_cb Function to invoke on message parts received from the story.
998 * @param finish_cb Function to call when the requested story has been fully
999 * told (counting message IDs might not suffice, as some messages
1000 * might be secret and thus the listener would not know the story is
1001 * finished without being told explicitly); once this function
1002 * has been called, the client must not call
1003 * GNUNET_PSYC_channel_story_tell_cancel() anymore.
1004 * @param cls Closure for the callbacks.
1005 * @return Handle to cancel story telling operation.
1006 */ 1040 */
1007struct GNUNET_PSYC_Story * 1041void
1008GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *channel, 1042GNUNET_PSYC_channel_history_replay (struct GNUNET_PSYC_Channel *channel,
1009 uint64_t start_message_id, 1043 uint64_t start_message_id,
1010 uint64_t end_message_id, 1044 uint64_t end_message_id,
1011 GNUNET_PSYC_MessageCallback message_cb, 1045 GNUNET_PSYC_ResultCallback finish_cb,
1012 GNUNET_PSYC_MessagePartCallback message_part_cb, 1046 void *cls);
1013 GNUNET_PSYC_FinishCallback finish_cb,
1014 void *cls);
1015 1047
1016 1048
1017/** 1049/**
1018 * Abort story telling. 1050 * Request to replay the latest messages from the message history of the channel.
1051 *
1052 * Historic messages (but NOT the state at the time) will be replayed (given to
1053 * the normal method handlers) if available and if access is permitted.
1019 * 1054 *
1020 * This function must not be called from within method handlers (as given to 1055 * @param channel
1021 * GNUNET_PSYC_slave_join()) of the slave. 1056 * Which channel should be replayed?
1057 * @param message_limit
1058 * Maximum number of messages to replay.
1059 * @param finish_cb
1060 * Function to call when the requested history has been fully replayed
1061 * (counting message IDs might not suffice, as some messages might be
1062 * secret and thus the listener would not know the story is finished
1063 * without being told explicitly)o once this function has been called, the
1064 * client must not call GNUNET_PSYC_channel_history_replay_cancel() anymore.
1065 * @param cls
1066 * Closure for the callbacks.
1022 * 1067 *
1023 * @param story Story telling operation to stop. 1068 * @return Handle to cancel history replay operation.
1024 */ 1069 */
1025void 1070void
1026GNUNET_PSYC_channel_story_tell_cancel (struct GNUNET_PSYC_Story *story); 1071GNUNET_PSYC_channel_history_replay_latest (struct GNUNET_PSYC_Channel *channel,
1027 1072 uint64_t message_limit,
1028 1073 GNUNET_PSYC_ResultCallback finish_cb,
1029/** 1074 void *cls);
1030 * Handle for a state query operation.
1031 */
1032struct GNUNET_PSYC_StateQuery;
1033 1075
1034 1076
1035/** 1077/**
@@ -1039,19 +1081,26 @@ struct GNUNET_PSYC_StateQuery;
1039 * less-specific name is matched; for example, requesting "_a_b" will match "_a" 1081 * less-specific name is matched; for example, requesting "_a_b" will match "_a"
1040 * if "_a_b" does not exist. 1082 * if "_a_b" does not exist.
1041 * 1083 *
1042 * @param channel Channel handle. 1084 * @param channel
1043 * @param full_name Full name of the requested variable, the actual variable 1085 * Channel handle.
1044 * returned might have a shorter name.. 1086 * @param full_name
1045 * @param cb Function called once when a matching state variable is found. 1087 * Full name of the requested variable.
1088 * The actual variable returned might have a shorter name.
1089 * @param var_cb
1090 * Function called once when a matching state variable is found.
1046 * Not called if there's no matching state variable. 1091 * Not called if there's no matching state variable.
1047 * @param cb_cls Closure for the callbacks. 1092 * @param result_cb
1048 * @return Handle that can be used to cancel the query operation. 1093 * Function called after the operation finished.
1094 * (i.e. all state variables have been returned via @a state_cb)
1095 * @param cls
1096 * Closure for the callbacks.
1049 */ 1097 */
1050struct GNUNET_PSYC_StateQuery * 1098void
1051GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel, 1099GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel,
1052 const char *full_name, 1100 const char *full_name,
1053 GNUNET_PSYC_StateCallback cb, 1101 GNUNET_PSYC_StateVarCallback var_cb,
1054 void *cb_cls); 1102 GNUNET_PSYC_ResultCallback result_cb,
1103 void *cls);
1055 1104
1056 1105
1057/** 1106/**
@@ -1064,26 +1113,25 @@ GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel,
1064 * The @a state_cb is invoked on all matching state variables asynchronously, as 1113 * The @a state_cb is invoked on all matching state variables asynchronously, as
1065 * the state is stored in and retrieved from the PSYCstore, 1114 * the state is stored in and retrieved from the PSYCstore,
1066 * 1115 *
1067 * @param channel Channel handle. 1116 * @param channel
1068 * @param name_prefix Prefix of the state variable name to match. 1117 * Channel handle.
1069 * @param cb Function to call with the matching state variables. 1118 * @param name_prefix
1070 * @param cb_cls Closure for the callbacks. 1119 * Prefix of the state variable name to match.
1071 * @return Handle that can be used to cancel the query operation. 1120 * @param var_cb
1121 * Function called once when a matching state variable is found.
1122 * Not called if there's no matching state variable.
1123 * @param result_cb
1124 * Function called after the operation finished.
1125 * (i.e. all state variables have been returned via @a state_cb)
1126 * @param cls
1127 * Closure for the callbacks.
1072 */ 1128 */
1073struct GNUNET_PSYC_StateQuery * 1129void
1074GNUNET_PSYC_channel_state_get_prefix (struct GNUNET_PSYC_Channel *channel, 1130GNUNET_PSYC_channel_state_get_prefix (struct GNUNET_PSYC_Channel *channel,
1075 const char *name_prefix, 1131 const char *name_prefix,
1076 GNUNET_PSYC_StateCallback cb, 1132 GNUNET_PSYC_StateVarCallback var_cb,
1077 void *cb_cls); 1133 GNUNET_PSYC_ResultCallback result_cb,
1078 1134 void *cls);
1079
1080/**
1081 * Cancel a state query operation.
1082 *
1083 * @param query Handle for the operation to cancel.
1084 */
1085void
1086GNUNET_PSYC_channel_state_get_cancel (struct GNUNET_PSYC_StateQuery *query);
1087 1135
1088 1136
1089#if 0 /* keep Emacsens' auto-indent happy */ 1137#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/include/gnunet_psycstore_plugin.h b/src/include/gnunet_psycstore_plugin.h
index 1945b400e..3f02759f6 100644
--- a/src/include/gnunet_psycstore_plugin.h
+++ b/src/include/gnunet_psycstore_plugin.h
@@ -112,7 +112,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions
112 uint64_t psycstore_flags); 112 uint64_t psycstore_flags);
113 113
114 /** 114 /**
115 * Retrieve a message fragment by fragment ID. 115 * Retrieve a message fragment range by fragment ID.
116 * 116 *
117 * @see GNUNET_PSYCSTORE_fragment_get() 117 * @see GNUNET_PSYCSTORE_fragment_get()
118 * 118 *
@@ -121,12 +121,29 @@ struct GNUNET_PSYCSTORE_PluginFunctions
121 int 121 int
122 (*fragment_get) (void *cls, 122 (*fragment_get) (void *cls,
123 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 123 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
124 uint64_t fragment_id, 124 uint64_t first_fragment_id,
125 uint64_t last_fragment_id,
126 uint64_t *returned_fragments,
125 GNUNET_PSYCSTORE_FragmentCallback cb, 127 GNUNET_PSYCSTORE_FragmentCallback cb,
126 void *cb_cls); 128 void *cb_cls);
127 129
128 /** 130 /**
129 * Retrieve all fragments of a message. 131 * Retrieve latest message fragments.
132 *
133 * @see GNUNET_PSYCSTORE_fragment_get()
134 *
135 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
136 */
137 int
138 (*fragment_get_latest) (void *cls,
139 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
140 uint64_t fragment_limit,
141 uint64_t *returned_fragments,
142 GNUNET_PSYCSTORE_FragmentCallback cb,
143 void *cb_cls);
144
145 /**
146 * Retrieve all fragments of a message ID range.
130 * 147 *
131 * @see GNUNET_PSYCSTORE_message_get() 148 * @see GNUNET_PSYCSTORE_message_get()
132 * 149 *
@@ -135,12 +152,28 @@ struct GNUNET_PSYCSTORE_PluginFunctions
135 int 152 int
136 (*message_get) (void *cls, 153 (*message_get) (void *cls,
137 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 154 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
138 uint64_t message_id, 155 uint64_t first_fragment_id,
156 uint64_t last_fragment_id,
139 uint64_t *returned_fragments, 157 uint64_t *returned_fragments,
140 GNUNET_PSYCSTORE_FragmentCallback cb, 158 GNUNET_PSYCSTORE_FragmentCallback cb,
141 void *cb_cls); 159 void *cb_cls);
142 160
143 /** 161 /**
162 * Retrieve all fragments of the latest messages.
163 *
164 * @see GNUNET_PSYCSTORE_message_get()
165 *
166 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
167 */
168 int
169 (*message_get_latest) (void *cls,
170 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
171 uint64_t fragment_limit,
172 uint64_t *returned_fragments,
173 GNUNET_PSYCSTORE_FragmentCallback cb,
174 void *cb_cls);
175
176 /**
144 * Retrieve a fragment of message specified by its message ID and fragment 177 * Retrieve a fragment of message specified by its message ID and fragment
145 * offset. 178 * offset.
146 * 179 *
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h
index 84d69c24d..78d016bb3 100644
--- a/src/include/gnunet_psycstore_service.h
+++ b/src/include/gnunet_psycstore_service.h
@@ -107,9 +107,10 @@ struct GNUNET_PSYCSTORE_OperationHandle;
107/** 107/**
108 * Function called with the result of an asynchronous operation. 108 * Function called with the result of an asynchronous operation.
109 * 109 *
110 * @param result #GNUNET_SYSERR on error, 110 * @param result
111 * #GNUNET_YES on success or if the peer was a member, 111 * #GNUNET_YES on success or if the peer was a member,
112 * #GNUNET_NO if the peer was not a member 112 * #GNUNET_NO if the peer was not a member,
113 * #GNUNET_SYSERR on error,
113 */ 114 */
114typedef void 115typedef void
115(*GNUNET_PSYCSTORE_ResultCallback) (void *cls, 116(*GNUNET_PSYCSTORE_ResultCallback) (void *cls,
@@ -235,7 +236,7 @@ typedef int
235 236
236 237
237/** 238/**
238 * Retrieve a message fragment by fragment ID. 239 * Retrieve message fragments by fragment ID range.
239 * 240 *
240 * @param h 241 * @param h
241 * Handle for the PSYCstore. 242 * Handle for the PSYCstore.
@@ -245,11 +246,15 @@ typedef int
245 * The slave requesting the fragment. If not NULL, a membership test is 246 * The slave requesting the fragment. If not NULL, a membership test is
246 * performed first and the fragment is only returned if the slave has 247 * performed first and the fragment is only returned if the slave has
247 * access to it. 248 * access to it.
248 * @param fragment_id 249 * @param first_fragment_id
249 * Fragment ID to retrieve. Use 0 to get the latest message fragment. 250 * First fragment ID to retrieve.
250 * @param fcb 251 * Use 0 to get the latest message fragment.
252 * @param last_fragment_id
253 * Last consecutive fragment ID to retrieve.
254 * Use 0 to get the latest message fragment.
255 * @param fragment_cb
251 * Callback to call with the retrieved fragments. 256 * Callback to call with the retrieved fragments.
252 * @param rcb 257 * @param result_cb
253 * Callback to call with the result of the operation. 258 * Callback to call with the result of the operation.
254 * @param cls 259 * @param cls
255 * Closure for the callbacks. 260 * Closure for the callbacks.
@@ -260,14 +265,53 @@ struct GNUNET_PSYCSTORE_OperationHandle *
260GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, 265GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
261 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 266 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
262 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 267 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
263 uint64_t fragment_id, 268 uint64_t first_message_id,
264 GNUNET_PSYCSTORE_FragmentCallback fcb, 269 uint64_t last_message_id,
265 GNUNET_PSYCSTORE_ResultCallback rcb, 270 GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
271 GNUNET_PSYCSTORE_ResultCallback result_cb,
266 void *cls); 272 void *cls);
267 273
268 274
269/** 275/**
270 * Retrieve all fragments of a message. 276 * Retrieve latest message fragments.
277 *
278 * @param h
279 * Handle for the PSYCstore.
280 * @param channel_key
281 * The channel we are interested in.
282 * @param slave_key
283 * The slave requesting the fragment. If not NULL, a membership test is
284 * performed first and the fragment is only returned if the slave has
285 * access to it.
286 * @param first_fragment_id
287 * First fragment ID to retrieve.
288 * Use 0 to get the latest message fragment.
289 * @param last_fragment_id
290 * Last consecutive fragment ID to retrieve.
291 * Use 0 to get the latest message fragment.
292 * @param fragment_limit
293 * Maximum number of fragments to retrieve.
294 * @param fragment_cb
295 * Callback to call with the retrieved fragments.
296 * @param rcb
297 * Callback to call with the result of the operation.
298 * @param cls
299 * Closure for the callbacks.
300 *
301 * @return Handle that can be used to cancel the operation.
302 */
303struct GNUNET_PSYCSTORE_OperationHandle *
304GNUNET_PSYCSTORE_fragment_get_latest (struct GNUNET_PSYCSTORE_Handle *h,
305 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
306 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
307 uint64_t fragment_limit,
308 GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
309 GNUNET_PSYCSTORE_ResultCallback rcb,
310 void *cls);
311
312
313/**
314 * Retrieve all fragments of messages in a message ID range.
271 * 315 *
272 * @param h 316 * @param h
273 * Handle for the PSYCstore. 317 * Handle for the PSYCstore.
@@ -277,11 +321,15 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
277 * The slave requesting the message. If not NULL, a membership test is 321 * The slave requesting the message. If not NULL, a membership test is
278 * performed first and the message is only returned if the slave has 322 * performed first and the message is only returned if the slave has
279 * access to it. 323 * access to it.
280 * @param message_id 324 * @param first_message_id
281 * Message ID to retrieve. Use 0 to get the latest message. 325 * First message ID to retrieve.
282 * @param fcb 326 * Use 0 to get the latest message.
327 * @param last_message_id
328 * Last consecutive message ID to retrieve.
329 * Use 0 to get the latest message.
330 * @param fragment_cb
283 * Callback to call with the retrieved fragments. 331 * Callback to call with the retrieved fragments.
284 * @param rcb 332 * @param result_cb
285 * Callback to call with the result of the operation. 333 * Callback to call with the result of the operation.
286 * @param cls 334 * @param cls
287 * Closure for the callbacks. 335 * Closure for the callbacks.
@@ -292,23 +340,67 @@ struct GNUNET_PSYCSTORE_OperationHandle *
292GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, 340GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
293 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 341 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
294 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 342 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
295 uint64_t message_id, 343 uint64_t first_message_id,
296 GNUNET_PSYCSTORE_FragmentCallback fcb, 344 uint64_t last_message_id,
297 GNUNET_PSYCSTORE_ResultCallback rcb, 345 GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
346 GNUNET_PSYCSTORE_ResultCallback result_cb,
298 void *cls); 347 void *cls);
299 348
300 349
301/** 350/**
351 * Retrieve all fragments of the latest messages.
352 *
353 * @param h
354 * Handle for the PSYCstore.
355 * @param channel_key
356 * The channel we are interested in.
357 * @param slave_key
358 * The slave requesting the message. If not NULL, a membership test is
359 * performed first and the message is only returned if the slave has
360 * access to it.
361 * @param message_limit
362 * Maximum number of messages to retrieve.
363 * @param fragment_cb
364 * Callback to call with the retrieved fragments.
365 * @param rcb
366 * Callback to call with the result of the operation.
367 * @param cls
368 * Closure for the callbacks.
369 *
370 * @return Handle that can be used to cancel the operation.
371 */
372struct GNUNET_PSYCSTORE_OperationHandle *
373GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h,
374 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
375 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
376 uint64_t message_limit,
377 GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
378 GNUNET_PSYCSTORE_ResultCallback rcb,
379 void *cls);
380
381
382/**
302 * Retrieve a fragment of message specified by its message ID and fragment 383 * Retrieve a fragment of message specified by its message ID and fragment
303 * offset. 384 * offset.
304 * 385 *
305 * @param h Handle for the PSYCstore. 386 * @param h
306 * @param channel_key The channel we are interested in. 387 * Handle for the PSYCstore.
307 * @param message_id Message ID to check. Use 0 to get the latest message. 388 * @param channel_key
308 * @param fragment_offset Offset of the fragment to retrieve. 389 * The channel we are interested in.
309 * @param fcb Callback to call with the retrieved fragments. 390 * @param slave_key
310 * @param rcb Callback to call with the result of the operation. 391 * The slave requesting the message fragment. If not NULL, a membership
311 * @param cls Closure for the callbacks. 392 * test is performed first and the message fragment is only returned
393 * if the slave has access to it.
394 * @param message_id
395 * Message ID to retrieve. Use 0 to get the latest message.
396 * @param fragment_offset
397 * Offset of the fragment to retrieve.
398 * @param fragment_cb
399 * Callback to call with the retrieved fragments.
400 * @param result_cb
401 * Callback to call with the result of the operation.
402 * @param cls
403 * Closure for the callbacks.
312 * 404 *
313 * @return Handle that can be used to cancel the operation. 405 * @return Handle that can be used to cancel the operation.
314 */ 406 */
@@ -318,8 +410,8 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
318 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 410 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
319 uint64_t message_id, 411 uint64_t message_id,
320 uint64_t fragment_offset, 412 uint64_t fragment_offset,
321 GNUNET_PSYCSTORE_FragmentCallback fcb, 413 GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
322 GNUNET_PSYCSTORE_ResultCallback rcb, 414 GNUNET_PSYCSTORE_ResultCallback result_cb,
323 void *cls); 415 void *cls);
324 416
325 417
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h
index ca1578820..66427a072 100644
--- a/src/include/gnunet_social_service.h
+++ b/src/include/gnunet_social_service.h
@@ -287,12 +287,18 @@ typedef void
287/** 287/**
288 * Function called after the host entered the place. 288 * Function called after the host entered the place.
289 * 289 *
290 * @param cls Closure. 290 * @param cls
291 * @param max_message_id Last message ID sent to the channel. 291 * Closure.
292 * Or 0 if no messages have been sent to the place yet. 292 * @param result
293 * #GNUNET_OK on success, or
294 * #GNUNET_SYSERR on error.
295 * @param max_message_id
296 * Last message ID sent to the channel.
297 * Or 0 if no messages have been sent to the place yet.
293 */ 298 */
294typedef void 299typedef void
295(*GNUNET_SOCIAL_HostEnterCallback) (void *cls, uint64_t max_message_id); 300(*GNUNET_SOCIAL_HostEnterCallback) (void *cls, int result,
301 uint64_t max_message_id);
296 302
297 303
298/** 304/**
@@ -793,18 +799,22 @@ struct GNUNET_SOCIAL_WatchHandle;
793/** 799/**
794 * Watch a place for changed objects. 800 * Watch a place for changed objects.
795 * 801 *
796 * @param place Place to watch. 802 * @param place
797 * @param object_filter Object prefix to match. 803 * Place to watch.
798 * @param state_cb Function to call when an object/state changes. 804 * @param object_filter
799 * @param state_cb_cls Closure for callback. 805 * Object prefix to match.
806 * @param state_var_cb
807 * Function to call when an object/state var changes.
808 * @param cls
809 * Closure for callback.
800 * 810 *
801 * @return Handle that can be used to cancel watching. 811 * @return Handle that can be used to cancel watching.
802 */ 812 */
803struct GNUNET_SOCIAL_WatchHandle * 813struct GNUNET_SOCIAL_WatchHandle *
804GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place, 814GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
805 const char *object_filter, 815 const char *object_filter,
806 GNUNET_PSYC_StateCallback state_cb, 816 GNUNET_PSYC_StateVarCallback state_var_cb,
807 void *state_cb_cls); 817 void *cls);
808 818
809 819
810/** 820/**
@@ -822,18 +832,22 @@ struct GNUNET_SOCIAL_LookHandle;
822/** 832/**
823 * Look at objects in the place with a matching name prefix. 833 * Look at objects in the place with a matching name prefix.
824 * 834 *
825 * @param place The place to look its objects at. 835 * @param place
826 * @param name_prefix Look at objects with names beginning with this value. 836 * The place to look its objects at.
827 * @param state_cb Function to call for each object found. 837 * @param name_prefix
828 * @param state_cb_cls Closure for callback function. 838 * Look at objects with names beginning with this value.
839 * @param state_var_cb
840 * Function to call for each object found.
841 * @param cls
842 * Closure for callback function.
829 * 843 *
830 * @return Handle that can be used to stop looking at objects. 844 * @return Handle that can be used to stop looking at objects.
831 */ 845 */
832struct GNUNET_SOCIAL_LookHandle * 846struct GNUNET_SOCIAL_LookHandle *
833GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place, 847GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
834 const char *name_prefix, 848 const char *name_prefix,
835 GNUNET_PSYC_StateCallback state_cb, 849 GNUNET_PSYC_StateVarCallback state_var_cb,
836 void *state_cb_cls); 850 void *cls);
837 851
838 852
839/** 853/**