aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_social_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2015-12-17 14:12:44 +0000
committerGabor X Toth <*@tg-x.net>2015-12-17 14:12:44 +0000
commitc159ab01bd16e9f3ad1776fa6fb26398cb7986d9 (patch)
tree61b0cad0b3e94f7e2dc7a8b48de7dc24784e229d /src/include/gnunet_social_service.h
parent6cf89fa848bbcb9e1f941bad1ac0c4ec6066fdd7 (diff)
downloadgnunet-c159ab01bd16e9f3ad1776fa6fb26398cb7986d9.tar.gz
gnunet-c159ab01bd16e9f3ad1776fa6fb26398cb7986d9.zip
social: API changes for application connections: store/load app subscriptions to places
Diffstat (limited to 'src/include/gnunet_social_service.h')
-rw-r--r--src/include/gnunet_social_service.h485
1 files changed, 326 insertions, 159 deletions
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h
index 21c073256..47062fdaf 100644
--- a/src/include/gnunet_social_service.h
+++ b/src/include/gnunet_social_service.h
@@ -48,6 +48,20 @@ extern "C"
48 */ 48 */
49#define GNUNET_SOCIAL_VERSION 0x00000000 49#define GNUNET_SOCIAL_VERSION 0x00000000
50 50
51/**
52 * Maximum size of client ID including '\0' terminator.
53 */
54#define GNUNET_SOCIAL_APP_MAX_ID_SIZE 256
55
56/**
57 * Handle for an application.
58 */
59struct GNUNET_SOCIAL_App;
60
61/**
62 * Handle for an ego (own identity)
63 */
64struct GNUNET_SOCIAL_Ego;
51 65
52/** 66/**
53 * Handle for a pseudonym of another user in the network. 67 * Handle for a pseudonym of another user in the network.
@@ -74,6 +88,144 @@ struct GNUNET_SOCIAL_Guest;
74 */ 88 */
75struct GNUNET_SOCIAL_Slicer; 89struct GNUNET_SOCIAL_Slicer;
76 90
91
92
93
94/**
95 * Handle that can be used to reconnect to a place as host.
96 */
97struct GNUNET_SOCIAL_HostConnection;
98
99/**
100 * Handle that can be used to reconnect to a place as guest.
101 */
102struct GNUNET_SOCIAL_GuestConnection;
103
104/**
105 * Notification about an available identity.
106 *
107 * @param cls
108 * Closure.
109 * @param pub_key
110 * Public key of ego.
111 * @param name
112 * Name of ego.
113 */
114typedef void
115(*GNUNET_SOCIAL_AppEgoCallback) (void *cls,
116 struct GNUNET_SOCIAL_Ego *ego,
117 const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key,
118 const char *name);
119
120
121/**
122 * Notification about a place entered.
123 */
124typedef void
125(*GNUNET_SOCIAL_AppHostPlaceCallback) (void *cls,
126 struct GNUNET_SOCIAL_HostConnection *hconn,
127 struct GNUNET_SOCIAL_Ego *ego,
128 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key);
129
130/**
131h * Notification about a place entered.
132 */
133typedef void
134(*GNUNET_SOCIAL_AppGuestPlaceCallback) (void *cls,
135 struct GNUNET_SOCIAL_GuestConnection *gconn,
136 struct GNUNET_SOCIAL_Ego *ego,
137 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key);
138
139
140/**
141 * Establish application connection to the social service.
142 *
143 * The @host_place_cb and @guest_place_cb functions are
144 * initially called for each entered places,
145 * then later each time a new place is entered with the current app ID.
146 *
147 * @param cfg
148 * Configuration.
149 * @param ego_cb
150 * Function to notify about an available ego.
151 * @param host_cb
152 * Function to notify about a place entered as host.
153 * @param guest_cb
154 * Function to notify about a place entered as guest.
155 * @param cls
156 * Closure for the callbacks.
157 *
158 * @return Handle that can be used to stop listening.
159 */
160struct GNUNET_SOCIAL_App *
161GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
162 const char *id,
163 GNUNET_SOCIAL_AppEgoCallback ego_cb,
164 GNUNET_SOCIAL_AppHostPlaceCallback host_cb,
165 GNUNET_SOCIAL_AppGuestPlaceCallback guest_cb,
166 void *cls);
167
168
169/**
170 * Disconnect app.
171 *
172 * @param c
173 * App handle.
174 */
175void
176GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app);
177
178
179/**
180 * Get the public key of @a ego.
181 *
182 * @param ego
183 * Ego.
184 *
185 * @return Public key of ego.
186 */
187const struct GNUNET_CRYPTO_EcdsaPublicKey *
188GNUNET_SOCIAL_ego_get_pub_key (const struct GNUNET_SOCIAL_Ego *ego);
189
190
191/**
192 * Get the name of @a ego.
193 *
194 * @param ego
195 * Ego.
196 *
197 * @return Public key of @a ego.
198 */
199const char *
200GNUNET_SOCIAL_ego_get_name (const struct GNUNET_SOCIAL_Ego *ego);
201
202
203/**
204 * Get the public key of a @a nym.
205 *
206 * Suitable, for example, to be used with GNUNET_SOCIAL_zone_add_nym().
207 *
208 * @param nym
209 * Pseudonym to map to a cryptographic identifier.
210 *
211 * @return Public key of nym.
212 */
213const struct GNUNET_CRYPTO_EcdsaPublicKey *
214GNUNET_SOCIAL_nym_get_pub_key (const struct GNUNET_SOCIAL_Nym *nym);
215
216
217/**
218 * Get the hash of the public key of a @a nym.
219 *
220 * @param nym
221 * Pseudonym to map to a cryptographic identifier.
222 *
223 * @return Hash of the public key of nym.
224 */
225const struct GNUNET_HashCode *
226GNUNET_SOCIAL_nym_get_pub_key_hash (const struct GNUNET_SOCIAL_Nym *nym);
227
228
77/** 229/**
78 * Function called upon receiving a message indicating a call to a @e method. 230 * Function called upon receiving a message indicating a call to a @e method.
79 * 231 *
@@ -352,19 +504,22 @@ typedef void
352 504
353 505
354/** 506/**
355 * Function called after the host entered the place. 507 * Function called after the host entered a home.
356 * 508 *
357 * @param cls 509 * @param cls
358 * Closure. 510 * Closure.
359 * @param result 511 * @param result
360 * #GNUNET_OK on success, or 512 * #GNUNET_OK on success, or
361 * #GNUNET_SYSERR on error. 513 * #GNUNET_SYSERR on error.
514 * @param place_pub_key
515 * Public key of home.
362 * @param max_message_id 516 * @param max_message_id
363 * Last message ID sent to the channel. 517 * Last message ID sent to the channel.
364 * Or 0 if no messages have been sent to the place yet. 518 * Or 0 if no messages have been sent to the place yet.
365 */ 519 */
366typedef void 520typedef void
367(*GNUNET_SOCIAL_HostEnterCallback) (void *cls, int result, 521(*GNUNET_SOCIAL_HostEnterCallback) (void *cls, int result,
522 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
368 uint64_t max_message_id); 523 uint64_t max_message_id);
369 524
370 525
@@ -385,6 +540,8 @@ typedef void
385 * Policy specifying entry and history restrictions for the place. 540 * Policy specifying entry and history restrictions for the place.
386 * @param slicer 541 * @param slicer
387 * Slicer to handle incoming messages. 542 * Slicer to handle incoming messages.
543 * @param enter_cb
544 * Function called when the place is entered and ready to use.
388 * @param answer_door_cb 545 * @param answer_door_cb
389 * Function to handle new nyms that want to enter. 546 * Function to handle new nyms that want to enter.
390 * @param farewell_cb 547 * @param farewell_cb
@@ -395,9 +552,8 @@ typedef void
395 * @return Handle for the host. 552 * @return Handle for the host.
396 */ 553 */
397struct GNUNET_SOCIAL_Host * 554struct GNUNET_SOCIAL_Host *
398GNUNET_SOCIAL_host_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, 555GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,
399 const struct GNUNET_IDENTITY_Ego *ego, 556 const struct GNUNET_SOCIAL_Ego *ego,
400 const struct GNUNET_CRYPTO_EddsaPrivateKey *place_key,
401 enum GNUNET_PSYC_Policy policy, 557 enum GNUNET_PSYC_Policy policy,
402 struct GNUNET_SOCIAL_Slicer *slicer, 558 struct GNUNET_SOCIAL_Slicer *slicer,
403 GNUNET_SOCIAL_HostEnterCallback enter_cb, 559 GNUNET_SOCIAL_HostEnterCallback enter_cb,
@@ -407,6 +563,34 @@ GNUNET_SOCIAL_host_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
407 563
408 564
409/** 565/**
566 * Reconnect to an already entered place as host.
567 *
568 * @param hconn
569 * Host connection handle.
570 * @see GNUNET_SOCIAL_app_connect() & GNUNET_SOCIAL_AppHostPlaceCallback()
571 * @param slicer
572 * Slicer to handle incoming messages.
573 * @param enter_cb
574 * Function called when the place is entered and ready to use.
575 * @param answer_door_cb
576 * Function to handle new nyms that want to enter.
577 * @param farewell_cb
578 * Function to handle departing nyms.
579 * @param cls
580 * Closure for the callbacks.
581 *
582 * @return Handle for the host.
583 */
584struct GNUNET_SOCIAL_Host *
585GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn,
586 struct GNUNET_SOCIAL_Slicer *slicer,
587 GNUNET_SOCIAL_HostEnterCallback enter_cb,
588 GNUNET_SOCIAL_AnswerDoorCallback answer_door_cb,
589 GNUNET_SOCIAL_FarewellCallback farewell_cb,
590 void *cls);
591
592
593/**
410 * Decision whether to admit @a nym into the place or refuse entry. 594 * Decision whether to admit @a nym into the place or refuse entry.
411 * 595 *
412 * @param hst 596 * @param hst
@@ -438,6 +622,8 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
438/** 622/**
439 * Throw @a nym out of the place. 623 * Throw @a nym out of the place.
440 * 624 *
625 * Sends a _notice_place_leave announcement to the home.
626 *
441 * The @a nym reference will remain valid until the 627 * The @a nym reference will remain valid until the
442 * #GNUNET_SOCIAL_FarewellCallback is invoked, 628 * #GNUNET_SOCIAL_FarewellCallback is invoked,
443 * which should be very soon after this call. 629 * which should be very soon after this call.
@@ -446,69 +632,14 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
446 * Host of the place. 632 * Host of the place.
447 * @param nym 633 * @param nym
448 * Handle for the entity to be ejected. 634 * Handle for the entity to be ejected.
635 * @param env
636 * Environment for the message or NULL.
637 * _nym is set to @e nym regardless whether an @e env is provided.
449 */ 638 */
450void 639void
451GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *host, 640GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *host,
452 const struct GNUNET_SOCIAL_Nym *nym); 641 const struct GNUNET_SOCIAL_Nym *nym,
453 642 struct GNUNET_ENV_Environment *env);
454
455/**
456 * Get the public key of a @a nym.
457 *
458 * Suitable, for example, to be used with GNUNET_NAMESTORE_zone_to_name().
459 *
460 * @param nym
461 * Pseudonym to map to a cryptographic identifier.
462 *
463 * @return Public key of nym.
464 */
465const struct GNUNET_CRYPTO_EcdsaPublicKey *
466GNUNET_SOCIAL_nym_get_key (const struct GNUNET_SOCIAL_Nym *nym);
467
468
469/**
470 * Get the hash of the public key of a @a nym.
471 *
472 * @param nym
473 * Pseudonym to map to a cryptographic identifier.
474 *
475 * @return Hash of the public key of nym.
476 */
477const struct GNUNET_HashCode *
478GNUNET_SOCIAL_nym_get_key_hash (const struct GNUNET_SOCIAL_Nym *nym);
479
480
481/**
482 * Advertise the place in the GNS zone of the @e ego of the @a host.
483 *
484 * @param hst
485 * Host of the place.
486 * @param name
487 * The name for the PLACE record to put in the zone.
488 * @param peer_count
489 * Number of elements in the @a peers array.
490 * @param peers
491 * List of peers to put in the PLACE record to advertise
492 * as entry points to the place in addition to the origin.
493 * @param expiration_time
494 * Expiration time of the record, use 0 to remove the record.
495 * @param password
496 * Password used to encrypt the record.
497 * FIXME: not implemented yet.
498 * @param result_cb
499 * Function called with the result of the operation.
500 * @param result_cls
501 * Closure for @a result_cb
502 */
503void
504GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *host,
505 const char *name,
506 uint32_t peer_count,
507 const struct GNUNET_PeerIdentity *peers,
508 struct GNUNET_TIME_Absolute expiration_time,
509 const char *password,
510 GNUNET_NAMESTORE_ContinuationWithStatus result_cb,
511 void *result_cls);
512 643
513 644
514/** 645/**
@@ -602,25 +733,44 @@ GNUNET_SOCIAL_host_get_place (struct GNUNET_SOCIAL_Host *host);
602 733
603 734
604/** 735/**
605 * Stop hosting a place. 736 * Disconnect from a home.
606 * 737 *
607 * Invalidates host handle. 738 * Invalidates host handle.
608 * 739 *
609 * @param host 740 * @param hst
610 * Host leaving the place. 741 * The host to disconnect.
611 * @param keep_active 742 * @param disconnect_cb
612 * Keep the place active after last host disconnected. 743 * Function called after disconnected from the service.
613 * @param leave_cb 744 * @param cls
745 * Closure for @a disconnect_cb.
746 */
747void
748GNUNET_SOCIAL_host_disconnect (struct GNUNET_SOCIAL_Host *hst,
749 GNUNET_ContinuationCallback disconnect_cb,
750 void *cls);
751
752
753/**
754 * Stop hosting a home.
755 *
756 * Sends a _notice_place_closed announcement to the home.
757 * Invalidates host handle.
758 *
759 * @param hst
760 * Host leaving.
761 * @param env
762 * Environment for the message or NULL.
763 * @param disconnect_cb
614 * Function called after the host left the place 764 * Function called after the host left the place
615 * and disconnected from the social service. 765 * and disconnected from the service.
616 * @param leave_cls 766 * @param cls
617 * Closure for @a leave_cb. 767 * Closure for @a disconnect_cb.
618 */ 768 */
619void 769void
620GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *host, 770GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *hst,
621 int keep_active, 771 const struct GNUNET_ENV_Environment *env,
622 GNUNET_ContinuationCallback leave_cb, 772 GNUNET_ContinuationCallback disconnect_cb,
623 void *leave_cls); 773 void *cls);
624 774
625 775
626/** 776/**
@@ -689,9 +839,9 @@ typedef void
689 * @return NULL on errors, otherwise handle for the guest. 839 * @return NULL on errors, otherwise handle for the guest.
690 */ 840 */
691struct GNUNET_SOCIAL_Guest * 841struct GNUNET_SOCIAL_Guest *
692GNUNET_SOCIAL_guest_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, 842GNUNET_SOCIAL_guest_enter (const struct GNUNET_SOCIAL_App *app,
693 const struct GNUNET_IDENTITY_Ego *ego, 843 const struct GNUNET_SOCIAL_Ego *ego,
694 const struct GNUNET_CRYPTO_EddsaPublicKey *place_key, 844 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
695 const struct GNUNET_PeerIdentity *origin, 845 const struct GNUNET_PeerIdentity *origin,
696 uint32_t relay_count, 846 uint32_t relay_count,
697 const struct GNUNET_PeerIdentity *relays, 847 const struct GNUNET_PeerIdentity *relays,
@@ -729,9 +879,10 @@ GNUNET_SOCIAL_guest_enter (const struct GNUNET_CONFIGURATION_Handle *cfg,
729 * @return NULL on errors, otherwise handle for the guest. 879 * @return NULL on errors, otherwise handle for the guest.
730 */ 880 */
731struct GNUNET_SOCIAL_Guest * 881struct GNUNET_SOCIAL_Guest *
732GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_CONFIGURATION_Handle *cfg, 882GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
733 const struct GNUNET_IDENTITY_Ego *ego, 883 const struct GNUNET_SOCIAL_Ego *ego,
734 const char *gns_name, const char *password, 884 const char *gns_name,
885 const char *password,
735 const struct GNUNET_PSYC_Message *join_msg, 886 const struct GNUNET_PSYC_Message *join_msg,
736 struct GNUNET_SOCIAL_Slicer *slicer, 887 struct GNUNET_SOCIAL_Slicer *slicer,
737 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb, 888 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
@@ -740,6 +891,28 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_CONFIGURATION_Handle *cfg
740 891
741 892
742/** 893/**
894 * Reconnect to an already entered place as guest.
895 *
896 * @param gconn
897 * Guest connection handle.
898 * @see GNUNET_SOCIAL_app_connect() & GNUNET_SOCIAL_AppGuestPlaceCallback()
899 * @param slicer
900 * Slicer to use for processing incoming requests from guests.
901 * @param local_enter_cb
902 * Called upon connection established to the social service.
903 * @param entry_decision_cb
904 * Called upon receiving entry decision.
905 *
906 * @return NULL on errors, otherwise handle for the guest.
907 */
908struct GNUNET_SOCIAL_Guest *
909GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn,
910 struct GNUNET_SOCIAL_Slicer *slicer,
911 GNUNET_SOCIAL_GuestEnterCallback local_enter_cb,
912 void *cls);
913
914
915/**
743 * Flags for talking to the host of a place. 916 * Flags for talking to the host of a place.
744 */ 917 */
745enum GNUNET_SOCIAL_TalkFlags 918enum GNUNET_SOCIAL_TalkFlags
@@ -803,26 +976,40 @@ GNUNET_SOCIAL_guest_talk_cancel (struct GNUNET_SOCIAL_TalkRequest *tr);
803 976
804 977
805/** 978/**
979 * Disconnect from a place.
980 *
981 * Invalidates guest handle.
982 *
983 * @param gst
984 * The guest to disconnect.
985 * @param disconnect_cb
986 * Function called after disconnected from the service.
987 * @param cls
988 * Closure for @a disconnect_cb.
989 */
990void
991GNUNET_SOCIAL_guest_disconnect (struct GNUNET_SOCIAL_Guest *gst,
992 GNUNET_ContinuationCallback disconnect_cb,
993 void *cls);
994
995
996/**
806 * Leave a place temporarily or permanently. 997 * Leave a place temporarily or permanently.
807 * 998 *
808 * Notifies the owner of the place about leaving, and destroys the place handle. 999 * Notifies the owner of the place about leaving, and destroys the place handle.
809 * 1000 *
810 * @param place 1001 * @param place
811 * Place to leave. 1002 * Place to leave.
812 * @param keep_active
813 * Keep place active after last application disconnected.
814 * #GNUNET_YES or #GNUNET_NO
815 * @param env 1003 * @param env
816 * Optional environment for the leave message if @a keep_active 1004 * Optional environment for the leave message if @a keep_active
817 * is #GNUNET_NO. NULL if not needed. 1005 * is #GNUNET_NO. NULL if not needed.
818 * @param leave_cb 1006 * @param disconnect_cb
819 * Called upon disconnecting from the social service. 1007 * Called upon disconnecting from the social service.
820 */ 1008 */
821void 1009void
822GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest *gst, 1010GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest *gst,
823 int keep_active,
824 struct GNUNET_ENV_Environment *env, 1011 struct GNUNET_ENV_Environment *env,
825 GNUNET_ContinuationCallback leave_cb, 1012 GNUNET_ContinuationCallback disconnect_cb,
826 void *leave_cls); 1013 void *leave_cls);
827 1014
828 1015
@@ -974,96 +1161,76 @@ GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh);
974 1161
975 1162
976/** 1163/**
977 * Add public key to the GNS zone of the @e ego. 1164 * Advertise a @e place in the GNS zone of @a ego.
978 * 1165 *
979 * @param cfg 1166 * @param app
980 * Configuration. 1167 * Application handle.
981 * @param ego 1168 * @param ego
982 * Ego. 1169 * Ego.
1170 * @param place_pub_key
1171 * Public key of place to add.
983 * @param name 1172 * @param name
984 * The name for the PKEY record to put in the zone. 1173 * The name for the PLACE record to put in the zone.
985 * @param nym_pub_key 1174 * @param password
986 * Public key of nym to add. 1175 * Password used to encrypt the record or NULL to keep it cleartext.
1176 * @param relay_count
1177 * Number of elements in the @a relays array.
1178 * @param relays
1179 * List of relays to put in the PLACE record to advertise
1180 * as entry points to the place in addition to the origin.
987 * @param expiration_time 1181 * @param expiration_time
988 * Expiration time of the record, use 0 to remove the record. 1182 * Expiration time of the record, use 0 to remove the record.
989 * @param result_cb 1183 * @param result_cb
990 * Function called with the result of the operation. 1184 * Function called with the result of the operation.
991 * @param result_cls 1185 * @param result_cls
992 * Closure for @a result_cb 1186 * Closure for @a result_cb
1187 *
1188 * @return #GNUNET_OK if the request was sent,
1189 * #GNUNET_SYSERR on error, e.g. the name/password is too long.
993 */ 1190 */
994void 1191int
995GNUNET_SOCIAL_zone_add_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg, 1192GNUNET_SOCIAL_zone_add_place (const struct GNUNET_SOCIAL_App *app,
996 const struct GNUNET_IDENTITY_Ego *ego, 1193 const struct GNUNET_SOCIAL_Ego *ego,
997 const char *name, 1194 const char *name,
998 const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key, 1195 const char *password,
999 struct GNUNET_TIME_Absolute expiration_time, 1196 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
1000 GNUNET_NAMESTORE_ContinuationWithStatus result_cb, 1197 const struct GNUNET_PeerIdentity *origin,
1001 void *result_cls); 1198 uint32_t relay_count,
1002 1199 const struct GNUNET_PeerIdentity *relays,
1003 1200 struct GNUNET_TIME_Absolute expiration_time,
1004/** 1201 GNUNET_ResultCallback result_cb,
1005 * Handle for place notifications. 1202 void *result_cls);
1006 */
1007struct GNUNET_SOCIAL_PlaceListenHandle;
1008
1009
1010/**
1011 * Notification about a place entered as host.
1012 */
1013typedef void
1014(*GNUNET_SOCIAL_PlaceNotifyHostCallback) (void *cls,
1015 const struct GNUNET_CRYPTO_EddsaPrivateKey *place_key,
1016 enum GNUNET_PSYC_Policy policy);
1017
1018
1019/**
1020 * Notification about a place entered as guest.
1021 */
1022typedef void
1023(*GNUNET_SOCIAL_PlaceNotifyGuestCallback) (void *cls,
1024 const struct GNUNET_CRYPTO_EddsaPublicKey *place_key,
1025 const struct GNUNET_PeerIdentity *origin,
1026 uint32_t relay_count,
1027 const struct GNUNET_PeerIdentity *relays,
1028 const struct GNUNET_PSYC_Message *entry_msg);
1029 1203
1030 1204
1031/** 1205/**
1032 * Start listening for entered places as host or guest. 1206 * Add public key to the GNS zone of the @e ego.
1033 *
1034 * The @notify_host and @notify_guest functions are
1035 * initially called with the full list of entered places,
1036 * then later each time a new place is entered.
1037 * 1207 *
1038 * @param cfg 1208 * @param cfg
1039 * Configuration. 1209 * Configuration.
1040 * @param ego 1210 * @param ego
1041 * Listen for places of this ego. 1211 * Ego.
1042 * @param notify_host 1212 * @param name
1043 * Function to notify about a place entered as host. 1213 * The name for the PKEY record to put in the zone.
1044 * @param notify_guest 1214 * @param nym_pub_key
1045 * Function to notify about a place entered as guest.. 1215 * Public key of nym to add.
1046 * @param notify_cls 1216 * @param expiration_time
1047 * Closure for the callbacks. 1217 * Expiration time of the record, use 0 to remove the record.
1048 * 1218 * @param result_cb
1049 * @return Handle that can be used to stop listening. 1219 * Function called with the result of the operation.
1050 */ 1220 * @param result_cls
1051struct GNUNET_SOCIAL_PlaceListenHandle * 1221 * Closure for @a result_cb
1052GNUNET_SOCIAL_place_listen_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
1053 const struct GNUNET_IDENTITY_Ego *ego,
1054 GNUNET_SOCIAL_PlaceNotifyHostCallback notify_host,
1055 GNUNET_SOCIAL_PlaceNotifyGuestCallback notify_guest,
1056 void *notify_cls);
1057
1058
1059/**
1060 * Stop listening for entered places.
1061 * 1222 *
1062 * @param h 1223 * @return #GNUNET_OK if the request was sent,
1063 * Listen handle. 1224 * #GNUNET_SYSERR on error, e.g. the name is too long.
1064 */ 1225 */
1065void 1226int
1066GNUNET_SOCIAL_place_listen_stop (struct GNUNET_SOCIAL_PlaceListenHandle *h); 1227GNUNET_SOCIAL_zone_add_nym (const struct GNUNET_SOCIAL_App *app,
1228 const struct GNUNET_SOCIAL_Ego *ego,
1229 const char *name,
1230 const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key,
1231 struct GNUNET_TIME_Absolute expiration_time,
1232 GNUNET_ResultCallback result_cb,
1233 void *result_cls);
1067 1234
1068 1235
1069#if 0 /* keep Emacsens' auto-indent happy */ 1236#if 0 /* keep Emacsens' auto-indent happy */