[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33431 - in gnunet/src: include multicast social
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33431 - in gnunet/src: include multicast social |
Date: |
Tue, 27 May 2014 23:31:53 +0200 |
Author: tg
Date: 2014-05-27 23:31:53 +0200 (Tue, 27 May 2014)
New Revision: 33431
Modified:
gnunet/src/include/gnunet_psyc_service.h
gnunet/src/include/gnunet_social_service.h
gnunet/src/multicast/multicast_api.c
gnunet/src/social/social_api.c
Log:
social: separate host/guest/place API; add missing method cb params; improve
docs
Modified: gnunet/src/include/gnunet_psyc_service.h
===================================================================
--- gnunet/src/include/gnunet_psyc_service.h 2014-05-27 21:31:46 UTC (rev
33430)
+++ gnunet/src/include/gnunet_psyc_service.h 2014-05-27 21:31:53 UTC (rev
33431)
@@ -307,8 +307,10 @@
/**
* Method called from PSYC upon receiving part of a message.
*
- * @param cls Closure.
- * @param msg Message part, one of the following types:
+ * @param cls Closure.
+ * @param message_id Sequence number of the message.
+ * @param flags OR'ed GNUNET_PSYC_MessageFlags
+ * @param msg Message part, one of the following types:
* - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_HEADER
* - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD
* - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER
Modified: gnunet/src/include/gnunet_social_service.h
===================================================================
--- gnunet/src/include/gnunet_social_service.h 2014-05-27 21:31:46 UTC (rev
33430)
+++ gnunet/src/include/gnunet_social_service.h 2014-05-27 21:31:53 UTC (rev
33431)
@@ -20,7 +20,7 @@
/**
* @file include/gnunet_social_service.h
- * @brief Social service; implements social functionality using the PSYC
service.
+ * @brief Social service; implements social interactions using the PSYC
service.
* @author Gabor X Toth
* @author Christian Grothoff
*/
@@ -48,7 +48,7 @@
/**
- * Handle for another user (who is likely pseudonymous) in the network.
+ * Handle for a pseudonym of another user in the network.
*/
struct GNUNET_SOCIAL_Nym;
@@ -58,47 +58,61 @@
struct GNUNET_SOCIAL_Place;
/**
- * Handle for a place that one of our egos hosts.
+ * Host handle for a place that we entered.
*/
-struct GNUNET_SOCIAL_Home;
+struct GNUNET_SOCIAL_Host;
/**
+ * Guest handle for place that we entered.
+ */
+struct GNUNET_SOCIAL_Guest;
+
+/**
* Handle to an implementation of try-and-slice.
*/
struct GNUNET_SOCIAL_Slicer;
/**
- * Method called from SOCIAL upon receiving a message indicating a call
- * to a @e method.
+ * Function called upon receiving a message indicating a call to a @e method.
*
- * @param cls Closure.
- * @param nym The sender of the message. NULL for the ego's own messages to
the home.
- * @param full_method_name Original method name from PSYC (may be more
- * specific than the registered method name due to try-and-slice
matching).
-
- * @param message_id Unique message counter for this message
- * (unique only in combination with the given sender for
- * this channel).
- * @param modifier_count Number of elements in the @a modifiers array.
- * @param modifiers Modifiers present in the message. FIXME: use environment
instead?
- * @param data_offset Byte offset of @a data in the overall data of the method.
- * @param data Data stream given to the method (might not be zero-terminated
- * if data is binary).
- * @param data_size Number of bytes in @a data.
- * @param flags Message flags indicating fragmentation status.
+ * This function is called one or more times for each message until all data
+ * fragments arrive from the network.
+ *
+ * @param cls Closure.
+ * @param message_id Message counter, monotonically increasing from 1.
+ * @param nym The sender of the message. Can be NULL if the message is not
+ * connected to a pseudonym.
+ * @param flags OR'ed GNUNET_PSYC_MessageFlags
+ * @param method_name Original method name from PSYC (may be more specific
+ * than the registered method name due to try-and-slice matching).
+ * @param env Environment containing variables for the message and operations
+ * on objects of the place, or NULL.
+ * Only set for the first call of this function for each @a
message_id,
+ * NULL when notifying about further data fragments.
+ * @param data_offset Byte offset of @a data in the overall data of the
method.
+ * @param data_size Number of bytes in @a data.
+ * @param data Data stream given to the method (might not be zero-terminated
+ * if data is binary).
+ * @param end End of message?
+ * #GNUNET_NO if there are further fragments,
+ * #GNUNET_YES if this is the last fragment,
+ * #GNUNET_SYSERR indicates the message was cancelled by the sender.
+ *
+ * @return #GNUNET_YES the application keeps @a env for further use,
+ * #GNUNET_NO @a env is free()'d after the function returns.
*/
typedef int
-(*GNUNET_SOCIAL_Method) (void *cls,
- struct GNUNET_SOCIAL_Nym *nym,
- const char *full_method_name,
- uint64_t message_id,
- size_t modifier_count,
- struct GNUNET_ENV_Modifier *modifiers,
- uint64_t data_offset,
- const void *data,
- size_t data_size,
- enum GNUNET_PSYC_MessageFlags flags);
+(*GNUNET_SOCIAL_MethodCallback) (void *cls,
+ uint64_t message_id,
+ uint32_t flags,
+ const struct GNUNET_SOCIAL_Nym *nym,
+ const char *method_name,
+ struct GNUNET_ENV_Environment *env,
+ uint64_t data_offset,
+ size_t data_size,
+ const void *data,
+ int end);
/**
@@ -125,8 +139,8 @@
void
GNUNET_SOCIAL_slicer_add (struct GNUNET_SOCIAL_Slicer *slicer,
const char *method_name,
- GNUNET_SOCIAL_Method method,
- void *method_cls);
+ GNUNET_SOCIAL_MethodCallback method_cb,
+ void *cls);
/**
@@ -139,7 +153,7 @@
void
GNUNET_SOCIAL_slicer_remove (struct GNUNET_SOCIAL_Slicer *slicer,
const char *method_name,
- GNUNET_SOCIAL_Method method);
+ GNUNET_SOCIAL_MethodCallback method_cb);
/**
* Destroy a given try-and-slice instance.
@@ -153,10 +167,10 @@
/**
* Function called asking for nym to be admitted to the place.
*
- * Should call either GNUNET_SOCIAL_home_admit() or
- * GNUNET_SOCIAL_home_reject_entry() (possibly asynchronously). If this owner
+ * Should call either GNUNET_SOCIAL_host_admit() or
+ * GNUNET_SOCIAL_host_reject_entry() (possibly asynchronously). If this host
* cannot decide, it is fine to call neither function, in which case hopefully
- * some other owner of the home exists that will make the decision. The @a nym
+ * some other host of the place exists that will make the decision. The @a nym
* reference remains valid until the #GNUNET_SOCIAL_FarewellCallback is invoked
* for it.
*
@@ -197,26 +211,26 @@
/**
- * Enter a home where guests (nyms) can be hosted.
+ * Enter a place as host.
*
- * A home is created upon first entering, and exists until
- * GNUNET_SOCIAL_home_destroy() is called. It can also be left temporarily
using
- * GNUNET_SOCIAL_home_leave().
+ * A place is created upon first entering, and it is active until permanently
+ * left using GNUNET_SOCIAL_host_leave().
*
- * @param cfg Configuration to contact the social service.
- * @param home_keyfile File with the private-public key pair of the home,
- * created if the file does not exist; pass NULL for ephemeral homes.
- * @param policy Policy specifying entry and history restrictions of the home.
- * @param ego Owner of the home (host).
- * @param slicer Slicer to handle guests talking.
- * @param listener_cb Function to handle new nyms that want to enter.
- * @param farewell_cb Function to handle departing nyms.
- * @param cls Closure for @a listener_cb and @a farewell_cb.
- * @return Handle for a new home.
+ * @param cfg Configuration to contact the social service.
+ * @param place_keyfile File with the private-public key pair of the place,
+ * created if the file does not exist; pass NULL for ephemeral places.
+ * @param policy Policy specifying entry and history restrictions of the
place.
+ * @param ego Identity of the host.
+ * @param slicer Slicer to handle incoming messages.
+ * @param listener_cb Function to handle new nyms that want to enter.
+ * @param farewell_cb Function to handle departing nyms.
+ * @param cls Closure for @a listener_cb and @a farewell_cb.
+ *
+ * @return Handle for the host.
*/
-struct GNUNET_SOCIAL_Home *
-GNUNET_SOCIAL_home_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *home_keyfile,
+struct GNUNET_SOCIAL_Host *
+GNUNET_SOCIAL_host_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *place_keyfile,
enum GNUNET_PSYC_Policy policy,
struct GNUNET_IDENTITY_Ego *ego,
struct GNUNET_SOCIAL_Slicer *slicer,
@@ -226,38 +240,38 @@
/**
- * Admit @a nym to the @a home.
+ * Admit @a nym to the place.
*
- * The @a nym reference will remain valid until either the home is destroyed or
- * @a nym leaves.
+ * The @a nym reference will remain valid until either the @a host or @a nym
+ * leaves the place.
*
- * @param home Home to allow @a nym to enter.
- * @param nym Handle for the entity that wants to enter.
+ * @param host Host of the place.
+ * @param nym Handle for the entity that wants to enter.
*/
void
-GNUNET_SOCIAL_home_admit (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_admit (struct GNUNET_SOCIAL_Host *host,
struct GNUNET_SOCIAL_Nym *nym);
/**
- * Throw @a nym out of the @a home.
+ * Throw @a nym out of the place.
*
* The @a nym reference will remain valid until the
* #GNUNET_SOCIAL_FarewellCallback is invoked,
* which should be very soon after this call.
*
- * @param home Home to eject @a nym from.
- * @param nym Handle for the entity to be ejected.
+ * @param host Host of the place.
+ * @param nym Handle for the entity to be ejected.
*/
void
-GNUNET_SOCIAL_home_eject (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *host,
struct GNUNET_SOCIAL_Nym *nym);
/**
- * Refuse @a nym entry into the @a home.
+ * Refuse @a nym entry into the place.
*
- * @param home Home to disallow @a nym to enter.
+ * @param host Host of the place.
* @param nym Handle for the entity that wanted to enter.
* @param method_name Method name for the rejection message.
* @param env Environment containing variables for the message, or NULL.
@@ -265,7 +279,7 @@
* @param data_size Number of bytes in @a data for method.
*/
void
-GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_refuse_entry (struct GNUNET_SOCIAL_Host *host,
struct GNUNET_SOCIAL_Nym *nym,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
@@ -274,7 +288,7 @@
/**
- * Get the public key of a nym.
+ * Get the public key of a @a nym.
*
* Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name().
*
@@ -287,20 +301,22 @@
/**
- * Obtain the private-public key pair of the home.
+ * Obtain the private-public key pair of the host.
*
- * @param home Home to get the key of.
- * @param[out] home_key Set to the private-public key pair of the home. The
public part is suitable for storing in GNS within a "PLACE" record, along with
peer IDs to join at.
+ * @param host Host to get the key of.
+ * @param[out] host_key Set to the private-public key pair of the host. The
+ * public part is suitable for storing in GNS within a "PLACE"
+ * record, along with peer IDs to join at.
*/
void
-GNUNET_SOCIAL_home_get_key (struct GNUNET_SOCIAL_Home *home,
- struct GNUNET_CRYPTO_EddsaPrivateKey *home_key);
+GNUNET_SOCIAL_host_get_key (struct GNUNET_SOCIAL_Host *host,
+ struct GNUNET_CRYPTO_EddsaPrivateKey *host_key);
/**
- * Advertise @a home under @a name in the GNS zone of the @e ego.
+ * Advertise the place in the GNS zone of the @e ego of the @a host.
*
- * @param home The home to advertise.
+ * @param host Host of the place.
* @param name The name for the PLACE record to put in the zone.
* @param peer_count Number of elements in the @a peers array.
* @param peers List of peers in the PLACE record that can be used to send join
@@ -309,7 +325,7 @@
* @param password Password used to encrypt the record.
*/
void
-GNUNET_SOCIAL_home_advertise (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *host,
const char *name,
size_t peer_count,
const struct GNUNET_PeerIdentity *peers,
@@ -318,16 +334,16 @@
/**
- * Flags for announcements in a home.
+ * Flags for announcements by a host.
*/
enum GNUNET_SOCIAL_AnnounceFlags
{
GNUNET_SOCIAL_ANNOUNCE_NONE = 0,
/**
- * Whether this announcement removes all objects from the home.
+ * Whether this announcement removes all objects from the place.
*
- * New objects can be still added to the now empty home using the @e env
+ * New objects can be still added to the now empty place using the @e env
* parameter of the same announcement.
*/
GNUNET_SOCIAL_ANNOUNCE_CLEAR_OBJECTS = 1 << 0
@@ -341,22 +357,23 @@
/**
- * Send a message to all nyms that are present in the home.
+ * Send a message to all nyms that are present in the place.
*
- * This function is restricted to the home owner. Nyms can only send requests
- * to the home owner who can decide to relay it to other guests.
+ * This function is restricted to the host. Nyms can only send requests
+ * to the host who can decide to relay it to everyone in the place.
*
- * @param home Home to address the announcement to.
+ * @param host Host of the place.
* @param method_name Method to use for the announcement.
- * @param env Environment containing variables for the message and operations
on
- * objects of the home, or NULL.
+ * @param env Environment containing variables for the message and operations
+ * on objects of the place. Can be NULL.
* @param notify Function to call to get the payload of the announcement.
* @param notify_cls Closure for @a notify.
* @param flags Flags for this announcement.
+ *
* @return NULL on error (announcement already in progress?).
*/
struct GNUNET_SOCIAL_Announcement *
-GNUNET_SOCIAL_home_announce (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host *host,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
GNUNET_CONNECTION_TransmitReadyNotify notify,
@@ -370,37 +387,39 @@
* @param a The announcement to cancel.
*/
void
-GNUNET_SOCIAL_home_announce_cancel (struct GNUNET_SOCIAL_Announcement *a);
+GNUNET_SOCIAL_host_announce_cancel (struct GNUNET_SOCIAL_Announcement *a);
/**
- * Convert our home to a place so we can access it via the place API.
+ * Obtain handle for a hosted place.
*
- * @param home Handle for the home.
- * @return Place handle for the same home, valid as long as @a home is valid;
- * do NOT try to GNUNET_SOCIAL_place_leave() this place, it's your
home!
+ * The returned handle can be used to access the place API.
+ *
+ * @param host Handle for the host.
+ *
+ * @return Handle for the hosted place, valid as long as @a host is valid.
*/
struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home);
+GNUNET_SOCIAL_host_get_place (struct GNUNET_SOCIAL_Host *host);
/**
- * Leave a home.
-
- * Invalidates home handle.
- * Guests will be disconnected until the home is restarted.
+ * Stop hosting a place.
*
- * @param home Home to leave.
- * @param keep_active Keep home active after last application disconnected.
+ * Invalidates host handle.
+ *
+ * @param host Host leaving the place.
+ * @param keep_active Keep the place active after last host disconnected.
*/
void
-GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home, int keep_active);
+GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *host, int keep_active);
+
/**
- * Request entry to a place (home hosted by someone else).
+ * Request entry to a place as a guest.
*
- * @param cfg Configuration to contact the social service.
- * @param ego Owner of the home (host).
+ * @param cfg Configuration to contact the social service.
+ * @param ego Identity of the guest.
* @param address GNS name of the place to enter. Either in the form of
* 'room.friend.gnu', or 'NYMPUBKEY.zkey'. This latter case refers to
* the 'PLACE' record of the empty label ("+") in the GNS zone with the
@@ -411,10 +430,11 @@
* @param data Payload for the message to give to the enter callback.
* @param data_size Number of bytes in @a data.
* @param slicer Slicer to use for processing incoming requests from guests.
- * @return NULL on errors, otherwise handle to the place.
+ *
+ * @return NULL on errors, otherwise handle for the guest.
*/
-struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
+struct GNUNET_SOCIAL_Guest *
+GNUNET_SOCIAL_guest_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_IDENTITY_Ego *ego,
char *address,
const char *method_name,
@@ -424,10 +444,10 @@
struct GNUNET_SOCIAL_Slicer *slicer);
/**
- * Request entry to a place (home hosted by someone else).
+ * Request entry to a place as a guest.
*
* @param cfg Configuration to contact the social service.
- * @param ego Owner of the home (host).
+ * @param ego Identity of the guest.
* @param crypto_address Public key of the place to enter.
* @param origin Peer identity of the origin of the underlying multicast group.
* @param relay_count Number of elements in the @a relays array.
@@ -437,10 +457,11 @@
* @param data Payload for the message to give to the enter callback.
* @param data_size Number of bytes in @a data.
* @param slicer Slicer to use for processing incoming requests from guests.
- * @return NULL on errors, otherwise handle to the place.
+ *
+ * @return NULL on errors, otherwise handle for the guest.
*/
-struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
+struct GNUNET_SOCIAL_Guest *
+GNUNET_SOCIAL_guest_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_IDENTITY_Ego *ego,
struct GNUNET_CRYPTO_EddsaPublicKey
*crypto_address,
struct GNUNET_PeerIdentity *origin,
@@ -453,82 +474,7 @@
struct GNUNET_SOCIAL_Slicer *slicer);
-struct GNUNET_SOCIAL_WatchHandle;
-
/**
- * Watch a place for changed objects.
- *
- * @param place Place to watch.
- * @param object_filter Object prefix to match.
- * @param state_cb Function to call when an object/state changes.
- * @param state_cb_cls Closure for callback.
- *
- * @return Handle that can be used to cancel watching.
- */
-struct GNUNET_SOCIAL_WatchHandle *
-GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
- const char *object_filter,
- GNUNET_PSYC_StateCallback state_cb,
- void *state_cb_cls);
-
-
-/**
- * Cancel watching a place for changed objects.
- *
- * @param wh Watch handle to cancel.
- */
-void
-GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh);
-
-
-struct GNUNET_SOCIAL_LookHandle;
-
-
-/**
- * Look at objects in the place with a matching name prefix.
- *
- * @param place The place to look its objects at.
- * @param name_prefix Look at objects with names beginning with this value.
- * @param state_cb Function to call for each object found.
- * @param state_cb_cls Closure for callback function.
- *
- * @return Handle that can be used to stop looking at objects.
- */
-struct GNUNET_SOCIAL_LookHandle *
-GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
- const char *name_prefix,
- GNUNET_PSYC_StateCallback state_cb,
- void *state_cb_cls);
-
-
-/**
- * Stop looking at objects.
- *
- * @param lh Look handle to stop.
- */
-void
-GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh);
-
-
-
-/**
- * Look at a particular object in the place.
- *
- * The best matching object is returned (its name might be less specific than
- * what was requested).
- *
- * @param place The place to look the object at.
- * @param full_name Full name of the object.
- * @param value_size Set to the size of the returned value.
- * @return NULL if there is no such object at this place.
- */
-const void *
-GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place,
- const char *full_name,
- size_t *value_size);
-
-
-/**
* Flags for talking to the host of a place.
*/
enum GNUNET_SOCIAL_TalkFlags
@@ -542,6 +488,7 @@
*/
struct GNUNET_SOCIAL_TalkRequest;
+
/**
* Talk to the host of the place.
*
@@ -551,11 +498,12 @@
* @param notify Function to use to get the payload for the method.
* @param notify_cls Closure for @a notify.
* @param flags Flags for the message being sent.
+ *
* @return NULL if we are already trying to talk to the host,
* otherwise handle to cancel the request.
*/
struct GNUNET_SOCIAL_TalkRequest *
-GNUNET_SOCIAL_place_talk (struct GNUNET_SOCIAL_Place *place,
+GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Place *place,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
GNUNET_CONNECTION_TransmitReadyNotify notify,
@@ -569,10 +517,35 @@
* @param tr Talk request to cancel.
*/
void
-GNUNET_SOCIAL_place_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr);
+GNUNET_SOCIAL_guest_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr);
/**
+ * Leave a place permanently.
+ *
+ * Notifies the owner of the place about leaving, and destroys the place
handle.
+ *
+ * @param place Place to leave permanently.
+ * @param keep_active Keep place active after last application disconnected.
+ */
+void
+GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Place *place, int keep_active);
+
+
+/**
+ * Obtain handle for a place entered as guest.
+ *
+ * The returned handle can be used to access the place API.
+ *
+ * @param guest Handle for the guest.
+ *
+ * @return Handle for the place, valid as long as @a guest is valid.
+ */
+struct GNUNET_SOCIAL_Place *
+GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Host *guest);
+
+
+/**
* A history lesson.
*/
struct GNUNET_SOCIAL_HistoryLesson;
@@ -618,18 +591,81 @@
GNUNET_SOCIAL_place_get_history_cancel (struct GNUNET_SOCIAL_HistoryLesson
*hist);
+struct GNUNET_SOCIAL_WatchHandle;
+
/**
- * Leave a place permanently.
+ * Watch a place for changed objects.
*
- * Notifies the owner of the place about leaving, and destroys the place
handle.
+ * @param place Place to watch.
+ * @param object_filter Object prefix to match.
+ * @param state_cb Function to call when an object/state changes.
+ * @param state_cb_cls Closure for callback.
*
- * @param place Place to leave permanently.
- * @param keep_active Keep place active after last application disconnected.
+ * @return Handle that can be used to cancel watching.
*/
+struct GNUNET_SOCIAL_WatchHandle *
+GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
+ const char *object_filter,
+ GNUNET_PSYC_StateCallback state_cb,
+ void *state_cb_cls);
+
+
+/**
+ * Cancel watching a place for changed objects.
+ *
+ * @param wh Watch handle to cancel.
+ */
void
-GNUNET_SOCIAL_place_leave (struct GNUNET_SOCIAL_Place *place, int keep_active);
+GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh);
+struct GNUNET_SOCIAL_LookHandle;
+
+
+/**
+ * Look at objects in the place with a matching name prefix.
+ *
+ * @param place The place to look its objects at.
+ * @param name_prefix Look at objects with names beginning with this value.
+ * @param state_cb Function to call for each object found.
+ * @param state_cb_cls Closure for callback function.
+ *
+ * @return Handle that can be used to stop looking at objects.
+ */
+struct GNUNET_SOCIAL_LookHandle *
+GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
+ const char *name_prefix,
+ GNUNET_PSYC_StateCallback state_cb,
+ void *state_cb_cls);
+
+
+/**
+ * Stop looking at objects.
+ *
+ * @param lh Look handle to stop.
+ */
+void
+GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh);
+
+
+
+/**
+ * Look at a particular object in the place.
+ *
+ * The best matching object is returned (its name might be less specific than
+ * what was requested).
+ *
+ * @param place The place to look the object at.
+ * @param full_name Full name of the object.
+ * @param value_size Set to the size of the returned value.
+ * @return NULL if there is no such object at this place.
+ */
+const void *
+GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place,
+ const char *full_name,
+ size_t *value_size);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: gnunet/src/multicast/multicast_api.c
===================================================================
--- gnunet/src/multicast/multicast_api.c 2014-05-27 21:31:46 UTC (rev
33430)
+++ gnunet/src/multicast/multicast_api.c 2014-05-27 21:31:53 UTC (rev
33431)
@@ -20,7 +20,7 @@
/**
* @file multicast/multicast_api.c
- * @brief multicast service; establish tunnels to distant peers
+ * @brief Multicast service; implements multicast groups using CADET
connections.
* @author Christian Grothoff
* @author Gabor X Toth
*/
Modified: gnunet/src/social/social_api.c
===================================================================
--- gnunet/src/social/social_api.c 2014-05-27 21:31:46 UTC (rev 33430)
+++ gnunet/src/social/social_api.c 2014-05-27 21:31:53 UTC (rev 33431)
@@ -20,7 +20,7 @@
/**
* @file social/social_api.c
- * @brief Social service; implements social functionality using the PSYC
service.
+ * @brief Social service; implements social interactions using the PSYC
service.
* @author Gabor X Toth
*/
@@ -35,7 +35,7 @@
/**
- * Handle for another user (who is likely pseudonymous) in the network.
+ * Handle for a pseudonym of another user in the network.
*/
struct GNUNET_SOCIAL_Nym
{
@@ -53,15 +53,24 @@
/**
- * Handle for a place that one of our egos hosts.
+ * Host handle for a place that we entered.
*/
-struct GNUNET_SOCIAL_Home
+struct GNUNET_SOCIAL_Host
{
};
/**
+ * Guest handle for place that we entered.
+ */
+struct GNUNET_SOCIAL_Guest
+{
+
+};
+
+
+/**
* Handle to an implementation of try-and-slice.
*/
struct GNUNET_SOCIAL_Slicer
@@ -109,6 +118,8 @@
};
+
+
/**
* Create a try-and-slice instance.
*
@@ -136,8 +147,8 @@
void
GNUNET_SOCIAL_slicer_add (struct GNUNET_SOCIAL_Slicer *slicer,
const char *method_name,
- GNUNET_SOCIAL_Method method,
- void *method_cls)
+ GNUNET_SOCIAL_MethodCallback method_cb,
+ void *cls)
{
}
@@ -153,12 +164,11 @@
void
GNUNET_SOCIAL_slicer_remove (struct GNUNET_SOCIAL_Slicer *slicer,
const char *method_name,
- GNUNET_SOCIAL_Method method)
+ GNUNET_SOCIAL_MethodCallback method_cb)
{
}
-
/**
* Destroy a given try-and-slice instance.
*
@@ -172,26 +182,26 @@
/**
- * Enter a home where guests (nyms) can be hosted.
+ * Enter a place as host.
*
- * A home is created upon first entering, and exists until
- * GNUNET_SOCIAL_home_destroy() is called. It can also be left temporarily
using
- * GNUNET_SOCIAL_home_leave().
+ * A place is created upon first entering, and it is active until permanently
+ * left using GNUNET_SOCIAL_host_leave().
*
- * @param cfg Configuration to contact the social service.
- * @param home_keyfile File with the private-public key pair of the home,
- * created if the file does not exist; pass NULL for ephemeral homes.
- * @param policy Policy specifying entry and history restrictions of the home.
- * @param ego Owner of the home (host).
- * @param slicer Slicer to handle guests talking.
- * @param listener_cb Function to handle new nyms that want to enter.
- * @param farewell_cb Function to handle departing nyms.
- * @param cls Closure for @a listener_cb and @a farewell_cb.
- * @return Handle for a new home.
+ * @param cfg Configuration to contact the social service.
+ * @param place_keyfile File with the private-public key pair of the place,
+ * created if the file does not exist; pass NULL for ephemeral places.
+ * @param policy Policy specifying entry and history restrictions of the
place.
+ * @param ego Identity of the host.
+ * @param slicer Slicer to handle incoming messages.
+ * @param listener_cb Function to handle new nyms that want to enter.
+ * @param farewell_cb Function to handle departing nyms.
+ * @param cls Closure for @a listener_cb and @a farewell_cb.
+ *
+ * @return Handle for the host.
*/
-struct GNUNET_SOCIAL_Home *
-GNUNET_SOCIAL_home_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *home_keyfile,
+struct GNUNET_SOCIAL_Host *
+GNUNET_SOCIAL_host_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *place_keyfile,
enum GNUNET_PSYC_Policy policy,
struct GNUNET_IDENTITY_Ego *ego,
struct GNUNET_SOCIAL_Slicer *slicer,
@@ -204,16 +214,16 @@
/**
- * Admit @a nym to the @a home.
+ * Admit @a nym to the place.
*
- * The @a nym reference will remain valid until either the home is destroyed or
- * @a nym leaves.
+ * The @a nym reference will remain valid until either the @a host or @a nym
+ * leaves the place.
*
- * @param home Home to allow @a nym to enter.
- * @param nym Handle for the entity that wants to enter.
+ * @param host Host of the place.
+ * @param nym Handle for the entity that wants to enter.
*/
void
-GNUNET_SOCIAL_home_admit (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_admit (struct GNUNET_SOCIAL_Host *host,
struct GNUNET_SOCIAL_Nym *nym)
{
@@ -221,17 +231,17 @@
/**
- * Throw @a nym out of the @a home.
+ * Throw @a nym out of the place.
*
* The @a nym reference will remain valid until the
* #GNUNET_SOCIAL_FarewellCallback is invoked,
* which should be very soon after this call.
*
- * @param home Home to eject @a nym from.
- * @param nym Handle for the entity to be ejected.
+ * @param host Host of the place.
+ * @param nym Handle for the entity to be ejected.
*/
void
-GNUNET_SOCIAL_home_eject (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *host,
struct GNUNET_SOCIAL_Nym *nym)
{
@@ -239,9 +249,9 @@
/**
- * Refuse @a nym entry into the @a home.
+ * Refuse @a nym entry into the place.
*
- * @param home Home to disallow @a nym to enter.
+ * @param host Host of the place.
* @param nym Handle for the entity that wanted to enter.
* @param method_name Method name for the rejection message.
* @param env Environment containing variables for the message, or NULL.
@@ -249,7 +259,7 @@
* @param data_size Number of bytes in @a data for method.
*/
void
-GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_refuse_entry (struct GNUNET_SOCIAL_Host *host,
struct GNUNET_SOCIAL_Nym *nym,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
@@ -261,7 +271,7 @@
/**
- * Get the public key of a nym.
+ * Get the public key of a @a nym.
*
* Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name().
*
@@ -277,23 +287,25 @@
/**
- * Obtain the private-public key pair of the home.
+ * Obtain the private-public key pair of the host.
*
- * @param home Home to get the key of.
- * @param[out] home_key Set to the private-public key pair of the home. The
public part is suitable for storing in GNS within a "PLACE" record, along with
peer IDs to join at.
+ * @param host Host to get the key of.
+ * @param[out] host_key Set to the private-public key pair of the host. The
+ * public part is suitable for storing in GNS within a "PLACE"
+ * record, along with peer IDs to join at.
*/
void
-GNUNET_SOCIAL_home_get_key (struct GNUNET_SOCIAL_Home *home,
- struct GNUNET_CRYPTO_EddsaPrivateKey *home_key)
+GNUNET_SOCIAL_host_get_key (struct GNUNET_SOCIAL_Host *host,
+ struct GNUNET_CRYPTO_EddsaPrivateKey *host_key)
{
}
/**
- * Advertise @a home under @a name in the GNS zone of the @e ego.
+ * Advertise the place in the GNS zone of the @e ego of the @a host.
*
- * @param home The home to advertise.
+ * @param host Host of the place.
* @param name The name for the PLACE record to put in the zone.
* @param peer_count Number of elements in the @a peers array.
* @param peers List of peers in the PLACE record that can be used to send join
@@ -302,7 +314,7 @@
* @param password Password used to encrypt the record.
*/
void
-GNUNET_SOCIAL_home_advertise (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *host,
const char *name,
size_t peer_count,
const struct GNUNET_PeerIdentity *peers,
@@ -314,22 +326,23 @@
/**
- * Send a message to all nyms that are present in the home.
+ * Send a message to all nyms that are present in the place.
*
- * This function is restricted to the home owner. Nyms can only send requests
- * to the home owner who can decide to relay it to other guests.
+ * This function is restricted to the host. Nyms can only send requests
+ * to the host who can decide to relay it to everyone in the place.
*
- * @param home Home to address the announcement to.
+ * @param host Host of the place.
* @param method_name Method to use for the announcement.
- * @param env Environment containing variables for the message and operations
on
- * objects of the home, or NULL.
+ * @param env Environment containing variables for the message and operations
+ * on objects of the place. Can be NULL.
* @param notify Function to call to get the payload of the announcement.
* @param notify_cls Closure for @a notify.
* @param flags Flags for this announcement.
+ *
* @return NULL on error (announcement already in progress?).
*/
struct GNUNET_SOCIAL_Announcement *
-GNUNET_SOCIAL_home_announce (struct GNUNET_SOCIAL_Home *home,
+GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host *host,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
GNUNET_CONNECTION_TransmitReadyNotify notify,
@@ -346,46 +359,48 @@
* @param a The announcement to cancel.
*/
void
-GNUNET_SOCIAL_home_announce_cancel (struct GNUNET_SOCIAL_Announcement *a)
+GNUNET_SOCIAL_host_announce_cancel (struct GNUNET_SOCIAL_Announcement *a)
{
}
/**
- * Convert our home to a place so we can access it via the place API.
+ * Obtain handle for a hosted place.
*
- * @param home Handle for the home.
- * @return Place handle for the same home, valid as long as @a home is valid;
- * do NOT try to GNUNET_SOCIAL_place_leave() this place, it's your
home!
+ * The returned handle can be used to access the place API.
+ *
+ * @param host Handle for the host.
+ *
+ * @return Handle for the hosted place, valid as long as @a host is valid.
*/
struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_home_get_place (struct GNUNET_SOCIAL_Home *home)
+GNUNET_SOCIAL_host_get_place (struct GNUNET_SOCIAL_Host *host)
{
return NULL;
}
/**
- * Leave a home.
-
- * Invalidates home handle.
- * Guests will be disconnected until the home is restarted.
+ * Stop hosting a place.
*
- * @param home Home to leave.
- * @param keep_active Keep home active after last application disconnected.
+ * Invalidates host handle.
+ *
+ * @param host Host leaving the place.
+ * @param keep_active Keep the place active after last host disconnected.
*/
void
-GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home, int keep_active)
+GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *host, int keep_active)
{
}
+
/**
- * Request entry to a place (home hosted by someone else).
+ * Request entry to a place as a guest.
*
- * @param cfg Configuration to contact the social service.
- * @param ego Owner of the home (host).
+ * @param cfg Configuration to contact the social service.
+ * @param ego Identity of the guest.
* @param address GNS name of the place to enter. Either in the form of
* 'room.friend.gnu', or 'NYMPUBKEY.zkey'. This latter case refers to
* the 'PLACE' record of the empty label ("+") in the GNS zone with the
@@ -396,10 +411,11 @@
* @param data Payload for the message to give to the enter callback.
* @param data_size Number of bytes in @a data.
* @param slicer Slicer to use for processing incoming requests from guests.
- * @return NULL on errors, otherwise handle to the place.
+ *
+ * @return NULL on errors, otherwise handle for the guest.
*/
-struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
+struct GNUNET_SOCIAL_Guest *
+GNUNET_SOCIAL_guest_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_IDENTITY_Ego *ego,
char *address,
const char *method_name,
@@ -412,10 +428,10 @@
}
/**
- * Request entry to a place (home hosted by someone else).
+ * Request entry to a place as a guest.
*
* @param cfg Configuration to contact the social service.
- * @param ego Owner of the home (host).
+ * @param ego Identity of the guest.
* @param crypto_address Public key of the place to enter.
* @param origin Peer identity of the origin of the underlying multicast group.
* @param relay_count Number of elements in the @a relays array.
@@ -425,10 +441,11 @@
* @param data Payload for the message to give to the enter callback.
* @param data_size Number of bytes in @a data.
* @param slicer Slicer to use for processing incoming requests from guests.
- * @return NULL on errors, otherwise handle to the place.
+ *
+ * @return NULL on errors, otherwise handle for the guest.
*/
-struct GNUNET_SOCIAL_Place *
-GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
+struct GNUNET_SOCIAL_Guest *
+GNUNET_SOCIAL_guest_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_IDENTITY_Ego *ego,
struct GNUNET_CRYPTO_EddsaPublicKey
*crypto_address,
struct GNUNET_PeerIdentity *origin,
@@ -445,126 +462,78 @@
/**
- * Watch a place for changed objects.
+ * Talk to the host of the place.
*
- * @param place Place to watch.
- * @param object_filter Object prefix to match.
- * @param state_cb Function to call when an object/state changes.
- * @param state_cb_cls Closure for callback.
+ * @param place Place where we want to talk to the host.
+ * @param method_name Method to invoke on the host.
+ * @param env Environment containing variables for the message, or NULL.
+ * @param notify Function to use to get the payload for the method.
+ * @param notify_cls Closure for @a notify.
+ * @param flags Flags for the message being sent.
*
- * @return Handle that can be used to cancel watching.
+ * @return NULL if we are already trying to talk to the host,
+ * otherwise handle to cancel the request.
*/
-struct GNUNET_SOCIAL_WatchHandle *
-GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
- const char *object_filter,
- GNUNET_PSYC_StateCallback state_cb,
- void *state_cb_cls)
+struct GNUNET_SOCIAL_TalkRequest *
+GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Place *place,
+ const char *method_name,
+ const struct GNUNET_ENV_Environment *env,
+ GNUNET_CONNECTION_TransmitReadyNotify notify,
+ void *notify_cls,
+ enum GNUNET_SOCIAL_TalkFlags flags)
{
return NULL;
}
/**
- * Cancel watching a place for changed objects.
+ * Cancel talking to the host of the place.
*
- * @param wh Watch handle to cancel.
+ * @param tr Talk request to cancel.
*/
void
-GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh)
+GNUNET_SOCIAL_guest_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr)
{
}
/**
- * Look at objects in the place with a matching name prefix.
+ * Leave a place permanently.
*
- * @param place The place to look its objects at.
- * @param name_prefix Look at objects with names beginning with this value.
- * @param state_cb Function to call for each object found.
- * @param state_cb_cls Closure for callback function.
+ * Notifies the owner of the place about leaving, and destroys the place
handle.
*
- * @return Handle that can be used to stop looking at objects.
+ * @param place Place to leave permanently.
+ * @param keep_active Keep place active after last application disconnected.
*/
-struct GNUNET_SOCIAL_LookHandle *
-GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
- const char *name_prefix,
- GNUNET_PSYC_StateCallback state_cb,
- void *state_cb_cls)
-{
- return NULL;
-}
-
-
-/**
- * Stop looking at objects.
- *
- * @param lh Look handle to stop.
- */
void
-GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh)
+GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Place *place, int keep_active)
{
}
-
/**
- * Look at a particular object in the place.
+ * Obtain handle for a place entered as guest.
*
- * The best matching object is returned (its name might be less specific than
- * what was requested).
+ * The returned handle can be used to access the place API.
*
- * @param place The place to look the object at.
- * @param full_name Full name of the object.
- * @param value_size Set to the size of the returned value.
- * @return NULL if there is no such object at this place.
- */
-const void *
-GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place,
- const char *full_name,
- size_t *value_size)
-{
- return NULL;
-}
-
-
-/**
- * Talk to the host of the place.
+ * @param guest Handle for the guest.
*
- * @param place Place where we want to talk to the host.
- * @param method_name Method to invoke on the host.
- * @param env Environment containing variables for the message, or NULL.
- * @param notify Function to use to get the payload for the method.
- * @param notify_cls Closure for @a notify.
- * @param flags Flags for the message being sent.
- * @return NULL if we are already trying to talk to the host,
- * otherwise handle to cancel the request.
+ * @return Handle for the place, valid as long as @a guest is valid.
*/
-struct GNUNET_SOCIAL_TalkRequest *
-GNUNET_SOCIAL_place_talk (struct GNUNET_SOCIAL_Place *place,
- const char *method_name,
- const struct GNUNET_ENV_Environment *env,
- GNUNET_CONNECTION_TransmitReadyNotify notify,
- void *notify_cls,
- enum GNUNET_SOCIAL_TalkFlags flags)
+struct GNUNET_SOCIAL_Place *
+GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Host *guest)
{
return NULL;
}
/**
- * Cancel talking to the host of the place.
- *
- * @param tr Talk request to cancel.
+ * A history lesson.
*/
-void
-GNUNET_SOCIAL_place_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr)
-{
+struct GNUNET_SOCIAL_HistoryLesson;
-}
-
-
/**
* Learn about the history of a place.
*
@@ -612,16 +581,96 @@
}
+struct GNUNET_SOCIAL_WatchHandle;
+
/**
- * Leave a place permanently.
+ * Watch a place for changed objects.
*
- * Notifies the owner of the place about leaving, and destroys the place
handle.
+ * @param place Place to watch.
+ * @param object_filter Object prefix to match.
+ * @param state_cb Function to call when an object/state changes.
+ * @param state_cb_cls Closure for callback.
*
- * @param place Place to leave permanently.
- * @param keep_active Keep place active after last application disconnected.
+ * @return Handle that can be used to cancel watching.
*/
+struct GNUNET_SOCIAL_WatchHandle *
+GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place,
+ const char *object_filter,
+ GNUNET_PSYC_StateCallback state_cb,
+ void *state_cb_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Cancel watching a place for changed objects.
+ *
+ * @param wh Watch handle to cancel.
+ */
void
-GNUNET_SOCIAL_place_leave (struct GNUNET_SOCIAL_Place *place, int keep_active)
+GNUNET_SOCIAL_place_watch_cancel (struct GNUNET_SOCIAL_WatchHandle *wh)
{
}
+
+
+struct GNUNET_SOCIAL_LookHandle;
+
+
+/**
+ * Look at objects in the place with a matching name prefix.
+ *
+ * @param place The place to look its objects at.
+ * @param name_prefix Look at objects with names beginning with this value.
+ * @param state_cb Function to call for each object found.
+ * @param state_cb_cls Closure for callback function.
+ *
+ * @return Handle that can be used to stop looking at objects.
+ */
+struct GNUNET_SOCIAL_LookHandle *
+GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place,
+ const char *name_prefix,
+ GNUNET_PSYC_StateCallback state_cb,
+ void *state_cb_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Stop looking at objects.
+ *
+ * @param lh Look handle to stop.
+ */
+void
+GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh)
+{
+
+}
+
+
+
+/**
+ * Look at a particular object in the place.
+ *
+ * The best matching object is returned (its name might be less specific than
+ * what was requested).
+ *
+ * @param place The place to look the object at.
+ * @param full_name Full name of the object.
+ * @param value_size Set to the size of the returned value.
+ * @return NULL if there is no such object at this place.
+ */
+const void *
+GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place,
+ const char *full_name,
+ size_t *value_size)
+{
+ return NULL;
+}
+
+
+
+
+/* end of social_api.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33431 - in gnunet/src: include multicast social,
gnunet <=