PSYC(store), Multicast: use ECDSA slave/member keys; PSYC: add GNUNET_PSYC_message_cr...
[oweals/gnunet.git] / src / include / gnunet_social_service.h
1 /*
2      This file is part of GNUnet.
3      (C) 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 include/gnunet_social_service.h
23  * @brief Social service; implements social interactions using the PSYC service.
24  * @author Gabor X Toth
25  * @author Christian Grothoff
26  */
27 #ifndef GNUNET_SOCIAL_SERVICE_H
28 #define GNUNET_SOCIAL_SERVICE_H
29
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #if 0                           /* keep Emacsens' auto-indent happy */
34 }
35 #endif
36 #endif
37
38 #include "gnunet_util_lib.h"
39 #include "gnunet_env_lib.h"
40 #include "gnunet_identity_service.h"
41 #include "gnunet_psyc_service.h"
42
43
44 /**
45  * Version number of GNUnet Social API.
46  */
47 #define GNUNET_SOCIAL_VERSION 0x00000000
48
49
50 /**
51  * Handle for a pseudonym of another user in the network.
52  */
53 struct GNUNET_SOCIAL_Nym;
54
55 /**
56  * Handle for a place where social interactions happen.
57  */
58 struct GNUNET_SOCIAL_Place;
59
60 /**
61  * Host handle for a place that we entered.
62  */
63 struct GNUNET_SOCIAL_Host;
64
65 /**
66  * Guest handle for place that we entered.
67  */
68 struct GNUNET_SOCIAL_Guest;
69
70 /**
71  * Handle to an implementation of try-and-slice.
72  */
73 struct GNUNET_SOCIAL_Slicer;
74
75
76 /**
77  * Function called upon receiving a message indicating a call to a @e method.
78  *
79  * This function is called one or more times for each message until all data
80  * fragments arrive from the network.
81  *
82  * @param cls
83  *        Closure.
84  * @param message_id
85  *        Message counter, monotonically increasing from 1.
86  * @param nym
87  *        The sender of the message.
88  *        Can be NULL if the message is not connected to a pseudonym.
89  * @param flags
90  *        OR'ed GNUNET_PSYC_MessageFlags
91  * @param method_name
92  *        Original method name from PSYC.
93  *        May be more specific than the registered method name due to
94  *        try-and-slice matching.
95  * @param env
96  *        Environment with operations and variables for the message.
97  *        Only set for the first call of this function for each @a message_id,
98  *        NULL when notifying about further data fragments.
99  *        It has to be freed using GNUNET_ENV_environment_destroy()
100  *        when it is not needed anymore.
101  * @param data_offset
102  *        Byte offset of @a data in the overall data of the method.
103  * @param data_size
104  *        Number of bytes in @a data.
105  * @param data
106  *        Data stream given to the method.
107  * @param end
108  *        End of message?
109  *   #GNUNET_NO     if there are further fragments,
110  *   #GNUNET_YES    if this is the last fragment,
111  *   #GNUNET_SYSERR indicates the message was cancelled by the sender.
112  */
113 typedef void
114 (*GNUNET_SOCIAL_MethodCallback) (void *cls,
115                                  uint64_t message_id,
116                                  uint32_t flags,
117                                  const struct GNUNET_SOCIAL_Nym *nym,
118                                  const char *method_name,
119                                  struct GNUNET_ENV_Environment *env,
120                                  uint64_t data_offset,
121                                  size_t data_size,
122                                  const void *data,
123                                  int end);
124
125
126 /**
127  * Create a try-and-slice instance.
128  *
129  * @return A new try-and-slice construct.
130  */
131 struct GNUNET_SOCIAL_Slicer *
132 GNUNET_SOCIAL_slicer_create (void);
133
134
135 /**
136  * Add a method to the try-and-slice instance.
137  *
138  * A slicer processes messages and calls methods that match a message. A match
139  * happens whenever the method name of a message starts with the method_name
140  * parameter given here.
141  *
142  * @param slicer The try-and-slice instance to extend.
143  * @param method_name Name of the given method, use empty string for default.
144  * @param method Method to invoke.
145  * @param method_cls Closure for method.
146  */
147 void
148 GNUNET_SOCIAL_slicer_add (struct GNUNET_SOCIAL_Slicer *slicer,
149                           const char *method_name,
150                           GNUNET_SOCIAL_MethodCallback method_cb,
151                           void *cls);
152
153
154 /**
155  * Remove a registered method from the try-and-slice instance.
156  *
157  * @param slicer The try-and-slice instance.
158  * @param method_name Name of the method to remove.
159  * @param method Method handler.
160  */
161 void
162 GNUNET_SOCIAL_slicer_remove (struct GNUNET_SOCIAL_Slicer *slicer,
163                              const char *method_name,
164                              GNUNET_SOCIAL_MethodCallback method_cb);
165
166 /**
167  * Destroy a given try-and-slice instance.
168  *
169  * @param slicer slicer to destroy
170  */
171 void
172 GNUNET_SOCIAL_slicer_destroy (struct GNUNET_SOCIAL_Slicer *slicer);
173
174
175 /**
176  * Function called asking for nym to be admitted to the place.
177  *
178  * Should call either GNUNET_SOCIAL_host_admit() or
179  * GNUNET_SOCIAL_host_reject_entry() (possibly asynchronously).  If this host
180  * cannot decide, it is fine to call neither function, in which case hopefully
181  * some other host of the place exists that will make the decision.  The @a nym
182  * reference remains valid until the #GNUNET_SOCIAL_FarewellCallback is invoked
183  * for it.
184  *
185  * @param cls Closure.
186  * @param nym Handle for the user who wants to enter.
187  * @param method_name Method name in the entry request.
188  * @param variable_count Number of elements in the @a variables array.
189  * @param variables Variables present in the message.
190  * @param data_size Number of bytes in @a data.
191  * @param data Payload given on enter (e.g. a password).
192  */
193 typedef void
194 (*GNUNET_SOCIAL_AnswerDoorCallback) (void *cls,
195                                      struct GNUNET_SOCIAL_Nym *nym,
196                                      const char *method_name,
197                                      struct GNUNET_ENV_Environment *env,
198                                      size_t data_size,
199                                      const void *data);
200
201
202 /**
203  * Function called when a @a nym leaves the place.
204  *
205  * This is also called if the @a nym was never given permission to enter
206  * (i.e. the @a nym stopped asking to get in).
207  *
208  * @param cls   Closure.
209  * @param nym Handle for the user who left.
210  * @param variable_count Number of elements in the @a variables array.
211  * @param variables Variables present in the message.
212  */
213 typedef void
214 (*GNUNET_SOCIAL_FarewellCallback) (void *cls,
215                                    struct GNUNET_SOCIAL_Nym *nym,
216                                    struct GNUNET_ENV_Environment *env,
217                                    size_t variable_count,
218                                    struct GNUNET_ENV_Modifier *variables);
219
220
221 /**
222  * Function called after the host entered the place.
223  *
224  * @param cls             Closure.
225  * @param max_message_id  Last message ID sent to the channel.
226  *   Or 0 if no messages have been sent to the place yet.
227  */
228 typedef void
229 (*GNUNET_SOCIAL_HostEnterCallback) (void *cls, uint64_t max_message_id);
230
231
232 /**
233  * Enter a place as host.
234  *
235  * A place is created upon first entering, and it is active until permanently
236  * left using GNUNET_SOCIAL_host_leave().
237  *
238  * @param cfg
239  *        Configuration to contact the social service.
240  * @param ego
241  *        Identity of the host.
242  * @param place_key
243  *        Private-public key pair of the place.
244  *        NULL for ephemeral places.
245  * @param policy
246  *        Policy specifying entry and history restrictions for the place.
247  * @param slicer
248  *        Slicer to handle incoming messages.
249  * @param answer_door_cb
250  *        Function to handle new nyms that want to enter.
251  * @param farewell_cb
252  *        Function to handle departing nyms.
253  * @param cls
254  *        Closure for the callbacks.
255  *
256  * @return Handle for the host.
257  */
258 struct GNUNET_SOCIAL_Host *
259 GNUNET_SOCIAL_host_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
260                           struct GNUNET_IDENTITY_Ego *ego,
261                           const struct GNUNET_CRYPTO_EddsaPrivateKey *place_key,
262                           enum GNUNET_PSYC_Policy policy,
263                           struct GNUNET_SOCIAL_Slicer *slicer,
264                           GNUNET_SOCIAL_HostEnterCallback enter_cb,
265                           GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb,
266                           GNUNET_SOCIAL_FarewellCallback farewell_cb,
267                           void *cls);
268
269
270 /**
271  * Admit @a nym to the place.
272  *
273  * The @a nym reference will remain valid until either the @a host or @a nym
274  * leaves the place.
275  *
276  * @param host  Host of the place.
277  * @param nym  Handle for the entity that wants to enter.
278  */
279 void
280 GNUNET_SOCIAL_host_admit (struct GNUNET_SOCIAL_Host *host,
281                           struct GNUNET_SOCIAL_Nym *nym);
282
283
284 /**
285  * Throw @a nym out of the place.
286  *
287  * The @a nym reference will remain valid until the
288  * #GNUNET_SOCIAL_FarewellCallback is invoked,
289  * which should be very soon after this call.
290  *
291  * @param host  Host of the place.
292  * @param nym  Handle for the entity to be ejected.
293  */
294 void
295 GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *host,
296                           struct GNUNET_SOCIAL_Nym *nym);
297
298
299 /**
300  * Refuse @a nym entry into the place.
301  *
302  * @param host  Host of the place.
303  * @param nym Handle for the entity that wanted to enter.
304  * @param method_name Method name for the rejection message.
305  * @param env Environment containing variables for the message, or NULL.
306  * @param data Data for the rejection message to send back.
307  * @param data_size Number of bytes in @a data for method.
308  */
309 void
310 GNUNET_SOCIAL_host_refuse_entry (struct GNUNET_SOCIAL_Host *host,
311                                  struct GNUNET_SOCIAL_Nym *nym,
312                                  const char *method_name,
313                                  const struct GNUNET_ENV_Environment *env,
314                                  const void *data,
315                                  size_t data_size);
316
317
318 /**
319  * Get the public key of a @a nym.
320  *
321  * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name().
322  *
323  * @param nym Pseudonym to map to a cryptographic identifier.
324  * @param[out] nym_key Set to the public key of the nym.
325  */
326 void
327 GNUNET_SOCIAL_nym_get_key (struct GNUNET_SOCIAL_Nym *nym,
328                            struct GNUNET_CRYPTO_EddsaPublicKey *nym_key);
329
330
331 /**
332  * Obtain the private-public key pair of the host.
333  *
334  * @param host  Host to get the key of.
335  * @param[out] host_key  Set to the private-public key pair of the host.  The
336  *                 public part is suitable for storing in GNS within a "PLACE"
337  *                 record, along with peer IDs to join at.
338  */
339 void
340 GNUNET_SOCIAL_host_get_key (struct GNUNET_SOCIAL_Host *host,
341                             struct GNUNET_CRYPTO_EddsaPrivateKey *host_key);
342
343
344 /**
345  * Advertise the place in the GNS zone of the @e ego of the @a host.
346  *
347  * @param host  Host of the place.
348  * @param name The name for the PLACE record to put in the zone.
349  * @param peer_count Number of elements in the @a peers array.
350  * @param peers List of peers in the PLACE record that can be used to send join
351  *        requests to.
352  * @param expiration_time Expiration time of the record, use 0 to remove the record.
353  * @param password Password used to encrypt the record.
354  */
355 void
356 GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *host,
357                               const char *name,
358                               size_t peer_count,
359                               const struct GNUNET_PeerIdentity *peers,
360                               struct GNUNET_TIME_Relative expiration_time,
361                               const char *password);
362
363
364 /**
365  * Flags for announcements by a host.
366  */
367 enum GNUNET_SOCIAL_AnnounceFlags
368 {
369   GNUNET_SOCIAL_ANNOUNCE_NONE = 0,
370
371   /**
372    * Whether this announcement removes all objects from the place.
373    *
374    * New objects can be still added to the now empty place using the @e env
375    * parameter of the same announcement.
376    */
377   GNUNET_SOCIAL_ANNOUNCE_CLEAR_OBJECTS = 1 << 0
378 };
379
380
381 /**
382  * Handle for an announcement request.
383  */
384 struct GNUNET_SOCIAL_Announcement;
385
386
387 /**
388  * Send a message to all nyms that are present in the place.
389  *
390  * This function is restricted to the host.  Nyms can only send requests
391  * to the host who can decide to relay it to everyone in the place.
392  *
393  * @param host
394  *        Host of the place.
395  * @param method_name
396  *        Method to use for the announcement.
397  * @param env
398  *        Environment containing variables for the message and operations
399  *        on objects of the place.
400  *        Has to remain available until the first call to @a notify_data.
401  *        Can be NULL.
402  * @param notify_data
403  *        Function to call to get the payload of the announcement.
404  * @param notify_data_cls
405  *        Closure for @a notify.
406  * @param flags
407  *        Flags for this announcement.
408  *
409  * @return NULL on error (another announcement already in progress?).
410  */
411 struct GNUNET_SOCIAL_Announcement *
412 GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host *host,
413                              const char *method_name,
414                              const struct GNUNET_ENV_Environment *env,
415                              GNUNET_PSYC_TransmitNotifyData notify_data,
416                              void *notify_data_cls,
417                              enum GNUNET_SOCIAL_AnnounceFlags flags);
418
419
420 /**
421  * Cancel announcement.
422  *
423  * @param a The announcement to cancel.
424  */
425 void
426 GNUNET_SOCIAL_host_announce_cancel (struct GNUNET_SOCIAL_Announcement *a);
427
428
429 /**
430  * Obtain handle for a hosted place.
431  *
432  * The returned handle can be used to access the place API.
433  *
434  * @param host  Handle for the host.
435  *
436  * @return Handle for the hosted place, valid as long as @a host is valid.
437  */
438 struct GNUNET_SOCIAL_Place *
439 GNUNET_SOCIAL_host_get_place (struct GNUNET_SOCIAL_Host *host);
440
441
442 /**
443  * Stop hosting a place.
444  *
445  * Invalidates host handle.
446  *
447  * @param host  Host leaving the place.
448  * @param keep_active  Keep the place active after last host disconnected.
449  */
450 void
451 GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *host, int keep_active);
452
453
454 /**
455  * Function called after the guest entered the local copy of the place.
456  *
457  * History and object query functions can be used after this call,
458  * but new messages can't be sent or received.
459  *
460  * @param cls
461  *        Closure.
462  * @param result
463  *        #GNUNET_OK on success, or
464  *        #GNUNET_SYSERR on error, e.g. could not connect to the service, or
465  *        could not resolve GNS name.
466  * @param max_message_id
467  *        Last message ID sent to the place.
468  *        Or 0 if no messages have been sent to the place yet.
469  */
470 typedef void
471 (*GNUNET_SOCIAL_GuestEnterCallback) (void *cls, int result,
472                                      uint64_t max_message_id);
473
474
475 /**
476  * Function called upon a guest receives a decision about entry to the place.
477  *
478  * @param is_admitted
479  *   Is the guest admitted to the place?
480  *   #GNUNET_YES    if admitted,
481  *   #GNUNET_NO     if refused entry
482  *   #GNUNET_SYSERR if the request could not be answered.
483  * @param method_name
484  *   Method for the message sent along with the decision.
485  *   NULL if no message was sent.
486  * @param env
487  *   Environment with variables for the message.
488  *   NULL if there are no variables.
489  *   It has to be freed using GNUNET_ENV_environment_destroy()
490  *   when it is not needed anymore.
491  * @param data_size
492  *   Size of @data.
493  * @param data
494  *   Payload of the message.
495  */
496 typedef int
497 (*GNUNET_SOCIAL_EntryDecisionCallback) (void *cls,
498                                         int is_admitted,
499                                         const char *method_name,
500                                         struct GNUNET_ENV_Environment *env,
501                                         size_t data_size,
502                                         const void *data);
503
504
505 /**
506  * Request entry to a place as a guest.
507  *
508  * @param cfg Configuration to contact the social service.
509  * @param ego  Identity of the guest.
510  * @param crypto_address Public key of the place to enter.
511  * @param origin Peer identity of the origin of the underlying multicast group.
512  * @param relay_count Number of elements in the @a relays array.
513  * @param relays Relays for the underlying multicast group.
514  * @param method_name Method name for the message.
515  * @param env Environment containing variables for the message, or NULL.
516  * @param data Payload for the message to give to the enter callback.
517  * @param data_size Number of bytes in @a data.
518  * @param slicer Slicer to use for processing incoming requests from guests.
519  *
520  * @return NULL on errors, otherwise handle for the guest.
521  */
522 struct GNUNET_SOCIAL_Guest *
523 GNUNET_SOCIAL_guest_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
524                            struct GNUNET_IDENTITY_Ego *ego,
525                            struct GNUNET_CRYPTO_EddsaPublicKey *place_key,
526                            struct GNUNET_PeerIdentity *origin,
527                            uint32_t relay_count,
528                            struct GNUNET_PeerIdentity *relays,
529                            const char *method_name,
530                            const struct GNUNET_ENV_Environment *env,
531                            const void *data,
532                            size_t data_size,
533                            struct GNUNET_SOCIAL_Slicer *slicer,
534                            GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
535                            GNUNET_SOCIAL_EntryDecisionCallback entry_decision_cb,
536                            void *cls);
537
538
539 /**
540  * Request entry to a place as a guest using a GNS name.
541  *
542  * @param cfg  Configuration to contact the social service.
543  * @param ego  Identity of the guest.
544  * @param address GNS name of the place to enter.  Either in the form of
545  *        'room.friend.gnu', or 'NYMPUBKEY.zkey'.  This latter case refers to
546  *        the 'PLACE' record of the empty label ("+") in the GNS zone with the
547  *        nym's public key 'NYMPUBKEY', and can be used to request entry to a
548  *        pseudonym's place directly.
549  * @param method_name Method name for the message.
550  * @param env Environment containing variables for the message, or NULL.
551  * @param data Payload for the message to give to the enter callback.
552  * @param data_size Number of bytes in @a data.
553  * @param slicer Slicer to use for processing incoming requests from guests.
554  *
555  * @return NULL on errors, otherwise handle for the guest.
556  */
557 struct GNUNET_SOCIAL_Guest *
558 GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_CONFIGURATION_Handle *cfg,
559                                    struct GNUNET_IDENTITY_Ego *ego,
560                                    char *gns_name,
561                                    const char *method_name,
562                                    const struct GNUNET_ENV_Environment *env,
563                                    const void *data,
564                                    size_t data_size,
565                                    struct GNUNET_SOCIAL_Slicer *slicer,
566                                    GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
567                                    GNUNET_SOCIAL_EntryDecisionCallback entry_decision_cb,
568                                    void *cls);
569
570
571 /**
572  * Flags for talking to the host of a place.
573  */
574 enum GNUNET_SOCIAL_TalkFlags
575 {
576   GNUNET_SOCIAL_TALK_NONE = 0
577 };
578
579
580 /**
581  * A talk request.
582  */
583 struct GNUNET_SOCIAL_TalkRequest;
584
585
586 /**
587  * Talk to the host of the place.
588  *
589  * @param place
590  *        Place where we want to talk to the host.
591  * @param method_name
592  *        Method to invoke on the host.
593  * @param env
594  *        Environment containing variables for the message, or NULL.
595  * @param notify_data
596  *        Function to use to get the payload for the method.
597  * @param notify_data_cls
598  *        Closure for @a notify_data.
599  * @param flags
600  *        Flags for the message being sent.
601  *
602  * @return NULL if we are already trying to talk to the host,
603  *         otherwise handle to cancel the request.
604  */
605 struct GNUNET_SOCIAL_TalkRequest *
606 GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *guest,
607                           const char *method_name,
608                           const struct GNUNET_ENV_Environment *env,
609                           GNUNET_PSYC_TransmitNotifyData notify_data,
610                           void *notify_data_cls,
611                           enum GNUNET_SOCIAL_TalkFlags flags);
612
613
614 /**
615  * Cancel talking to the host of the place.
616  *
617  * @param tr Talk request to cancel.
618  */
619 void
620 GNUNET_SOCIAL_guest_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr);
621
622
623 /**
624  * Leave a place permanently.
625  *
626  * Notifies the owner of the place about leaving, and destroys the place handle.
627  *
628  * @param place Place to leave permanently.
629  * @param keep_active Keep place active after last application disconnected.
630  */
631 void
632 GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest *guest, int keep_active);
633
634
635 /**
636  * Obtain handle for a place entered as guest.
637  *
638  * The returned handle can be used to access the place API.
639  *
640  * @param guest  Handle for the guest.
641  *
642  * @return Handle for the place, valid as long as @a guest is valid.
643  */
644 struct GNUNET_SOCIAL_Place *
645 GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Guest *guest);
646
647
648 /**
649  * A history lesson.
650  */
651 struct GNUNET_SOCIAL_HistoryLesson;
652
653 /**
654  * Learn about the history of a place.
655  *
656  * Sends messages through the slicer function of the place where
657  * start_message_id <= message_id <= end_message_id.
658  * The messages will have the #GNUNET_PSYC_MESSAGE_HISTORIC flag set.
659  *
660  * To get the latest message, use 0 for both the start and end message ID.
661  *
662  * @param place Place we want to learn more about.
663  * @param start_message_id First historic message we are interested in.
664  * @param end_message_id Last historic message we are interested in (inclusive).
665  * @param slicer Slicer to use to process history.  Can be the same as the
666  *               slicer of the place, as the HISTORIC flag allows distinguishing
667  *               old messages from fresh ones.
668  * @param finish_cb Function called after the last message in the history lesson
669  *              is passed through the @a slicer. NULL if not needed.
670  * @param finish_cb_cls Closure for @a finish_cb.
671  * @return Handle to abort history lesson, never NULL (multiple lessons
672  *         at the same time are allowed).
673  */
674 struct GNUNET_SOCIAL_HistoryLesson *
675 GNUNET_SOCIAL_place_get_history (struct GNUNET_SOCIAL_Place *place,
676                                  uint64_t start_message_id,
677                                  uint64_t end_message_id,
678                                  const struct GNUNET_SOCIAL_Slicer *slicer,
679                                  void (*finish_cb)(void *),
680                                  void *finish_cb_cls);
681
682
683 /**
684  * Stop processing messages from the history lesson.
685  *
686  * Must not be called after the finish callback of the history lesson is called.
687  *
688  * @param hist History lesson to cancel.
689  */
690 void
691 GNUNET_SOCIAL_place_get_history_cancel (struct GNUNET_SOCIAL_HistoryLesson *hist);
692
693
694 struct GNUNET_SOCIAL_WatchHandle;
695
696 /**
697  * Watch a place for changed objects.
698  *
699  * @param place Place to watch.
700  * @param object_filter Object prefix to match.
701  * @param state_cb Function to call when an object/state changes.
702  * @param state_cb_cls Closure for callback.
703  *
704  * @return Handle that can be used to cancel watching.
705  */
706 struct GNUNET_SOCIAL_WatchHandle *
707 GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
708                            const char *object_filter,
709                            GNUNET_PSYC_StateCallback state_cb,
710                            void *state_cb_cls);
711
712
713 /**
714  * Cancel watching a place for changed objects.
715  *
716  * @param wh Watch handle to cancel.
717  */
718 void
719 GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh);
720
721
722 struct GNUNET_SOCIAL_LookHandle;
723
724
725 /**
726  * Look at objects in the place with a matching name prefix.
727  *
728  * @param place The place to look its objects at.
729  * @param name_prefix Look at objects with names beginning with this value.
730  * @param state_cb Function to call for each object found.
731  * @param state_cb_cls Closure for callback function.
732  *
733  * @return Handle that can be used to stop looking at objects.
734  */
735 struct GNUNET_SOCIAL_LookHandle *
736 GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
737                           const char *name_prefix,
738                           GNUNET_PSYC_StateCallback state_cb,
739                           void *state_cb_cls);
740
741
742 /**
743  * Stop looking at objects.
744  *
745  * @param lh Look handle to stop.
746  */
747 void
748 GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh);
749
750
751
752 /**
753  * Look at a particular object in the place.
754  *
755  * The best matching object is returned (its name might be less specific than
756  * what was requested).
757  *
758  * @param place The place to look the object at.
759  * @param full_name Full name of the object.
760  * @param value_size Set to the size of the returned value.
761  * @return NULL if there is no such object at this place.
762  */
763 const void *
764 GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place,
765                              const char *full_name,
766                              size_t *value_size);
767
768
769 #if 0                           /* keep Emacsens' auto-indent happy */
770 {
771 #endif
772 #ifdef __cplusplus
773 }
774 #endif
775
776 /* ifndef GNUNET_SOCIAL_SERVICE_H */
777 #endif
778 /* end of gnunet_social_service.h */