diff options
Diffstat (limited to 'src/include/gnunet_social_service.h')
-rw-r--r-- | src/include/gnunet_social_service.h | 187 |
1 files changed, 184 insertions, 3 deletions
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index bde3dbceb..c5e55bbab 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h | |||
@@ -19,11 +19,191 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_social_service.h | ||
23 | * @brief Social service; implements social interactions using the PSYC service. | ||
24 | * @author Gabor X Toth | 22 | * @author Gabor X Toth |
25 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * | ||
25 | * @file | ||
26 | * Social service; implements social interactions through the PSYC service. | ||
26 | */ | 27 | */ |
28 | |||
29 | /** @defgroup social Social service | ||
30 | Social interactions through the PSYC service. | ||
31 | |||
32 | # Overview | ||
33 | |||
34 | The social service provides an API for social interactions based on a one-to-many messaging model. | ||
35 | It manages subscriptions of applications to places, provides messaging functionality in places, | ||
36 | allows access to the local message history and manages the GNS zone of _egos_ (user identities). | ||
37 | |||
38 | The service stores private and public keys of subscribed places, as well as files received in subscribed places. | ||
39 | |||
40 | # Concepts and terminology | ||
41 | |||
42 | ## Ego, Nym | ||
43 | |||
44 | An _ego_ is an identity of a user, a private-public key pair. | ||
45 | A _nym_ is an identity of another user in the network, identified by its public key. | ||
46 | Each user can have multiple identities. | ||
47 | |||
48 | struct GNUNET_SOCIAL_Ego and struct GNUNET_SOCIAL_Nym represents one of these identities. | ||
49 | |||
50 | ## Place, Host, Guest | ||
51 | |||
52 | A _place_ is where social interactions happen. It is owned and created by an _ego_. | ||
53 | Creating a new place happens by an _ego_ entering a new place as a _host_, | ||
54 | where _guests_ can enter later to receive messages sent to the place. | ||
55 | |||
56 | A place is identified by its public key. | ||
57 | |||
58 | - struct GNUNET_SOCIAL_Host represents a place entered as host, | ||
59 | - struct GNUNET_SOCIAL_Guest is used for a place entered as guest. | ||
60 | - A struct GNUNET_SOCIAL_Place can be obtained for both a host and guest place | ||
61 | using GNUNET_SOCIAL_host_get_place() and GNUNET_SOCIAL_guest_get_place() | ||
62 | and can be used with API functions common to hosts and guests. | ||
63 | |||
64 | ## History | ||
65 | |||
66 | Messages sent to places are stored locally by the PSYCstore service, and can be queried any time. | ||
67 | GNUNET_SOCIAL_history_replay_latest() retrieves the latest N messages sent to the place, | ||
68 | while GNUNET_SOCIAL_history_replay() is used to query a given message ID range. | ||
69 | |||
70 | ## GNU Name System | ||
71 | |||
72 | The GNU Name System is used for assigning human-readable names to nyms and places. | ||
73 | There's a _GNS zone_ corresponding to each _nym_. | ||
74 | An _ego_ can publish PKEY and PLACE records in its own zone, pointing to nyms and places, respectively. | ||
75 | |||
76 | ## Announcement, talk request | ||
77 | |||
78 | The host can _announce_ messages to the place, using GNUNET_SOCIAL_host_announce(). | ||
79 | Guests can send _talk_ requests to the host, using GNUNET_SOCIAL_guest_talk(). | ||
80 | The host receives talk requests of guests and can _relay_ them to the place, | ||
81 | or process it using a message handler function. | ||
82 | |||
83 | # Using the API | ||
84 | |||
85 | ## Connecting to the service | ||
86 | |||
87 | A client first establishes an _application connection_ to the service using | ||
88 | GNUNET_SOCIAL_app_connect() providing its _application ID_, then receives the | ||
89 | public keys of subscribed places and available egos and in response. | ||
90 | |||
91 | ## Reconnecting to places | ||
92 | |||
93 | Then the application can reconnect to its subscribed places by establishing | ||
94 | _place connections_ with GNUNET_SOCIAL_host_enter_reconnect() and | ||
95 | GNUNET_SOCIAL_guest_enter_reconnect(). | ||
96 | |||
97 | ## Subscribing to a place | ||
98 | |||
99 | Entering and subscribing a new host or guest place is done using | ||
100 | GNUNET_SOCIAL_host_enter() and GNUNET_SOCIAL_guest_enter(). | ||
101 | |||
102 | ## Disconnecting from a place | ||
103 | |||
104 | An application can disconnect from a place while the social service keeps its | ||
105 | network connection active, using GNUNET_SOCIAL_host_disconnect() and | ||
106 | GNUNET_SOCIAL_guest_disconnect(). | ||
107 | |||
108 | ## Leaving a place | ||
109 | |||
110 | To permanently leave a place, see GNUNET_SOCIAL_host_leave() and GNUNET_SOCIAL_guest_leave(). | ||
111 | When leaving a place its network connections are closed and all applications are unsubscribed from the place. | ||
112 | |||
113 | # Methods | ||
114 | |||
115 | ## _message | ||
116 | |||
117 | A message sent to the place. | ||
118 | |||
119 | ### Environment | ||
120 | |||
121 | #### _id_reply_to | ||
122 | message ID this message is in reply to. | ||
123 | |||
124 | #### _id_thread | ||
125 | |||
126 | thread ID, the first message ID in the thread. | ||
127 | |||
128 | #### _nym_author__ | ||
129 | nym of the author. | ||
130 | |||
131 | #### _sig_author | ||
132 | signature of the message body and its variables by the author. | ||
133 | |||
134 | ## Data | ||
135 | |||
136 | Message body. | ||
137 | |||
138 | ## _notice_place | ||
139 | |||
140 | Notification about a place. | ||
141 | |||
142 | TODO: Applications can decide to auto-subscribe to certain places, | ||
143 | e.g. files under a given size. | ||
144 | |||
145 | ### Environment | ||
146 | |||
147 | #### Using GNS | ||
148 | |||
149 | ##### _gns_place | ||
150 | GNS name of the place in a globally unique .zkey zone | ||
151 | |||
152 | #### Without GNS | ||
153 | |||
154 | ##### _key_pub_place | ||
155 | public key of place | ||
156 | |||
157 | ##### _peer_origin | ||
158 | peer ID of origin | ||
159 | |||
160 | ##### _list_peer_relays | ||
161 | list of peer IDs of relays | ||
162 | |||
163 | ## _notice_place_file | ||
164 | |||
165 | Notification about a place hosting a file. | ||
166 | |||
167 | ### Environment | ||
168 | |||
169 | The environment of _notice_place above, plus the following: | ||
170 | |||
171 | #### _size_file | ||
172 | size of file | ||
173 | |||
174 | #### _mime_file | ||
175 | MIME type of file | ||
176 | |||
177 | #### _name_file | ||
178 | name of file | ||
179 | |||
180 | #### _description_file | ||
181 | description of file | ||
182 | |||
183 | ## _file | ||
184 | |||
185 | Messages with a _file method contain a file, | ||
186 | which is saved to disk upon receipt at the following location: | ||
187 | $GNUNET_DATA_HOME/social/files/<H(place_pub)>/<message_id> | ||
188 | |||
189 | ### Environment | ||
190 | |||
191 | #### _size_file | ||
192 | size of file | ||
193 | |||
194 | #### _mime_file | ||
195 | MIME type of file | ||
196 | |||
197 | #### _name_file | ||
198 | name of file | ||
199 | |||
200 | #### _description_file | ||
201 | description | ||
202 | |||
203 | @{ | ||
204 | */ | ||
205 | |||
206 | |||
27 | #ifndef GNUNET_SOCIAL_SERVICE_H | 207 | #ifndef GNUNET_SOCIAL_SERVICE_H |
28 | #define GNUNET_SOCIAL_SERVICE_H | 208 | #define GNUNET_SOCIAL_SERVICE_H |
29 | 209 | ||
@@ -371,7 +551,7 @@ typedef void | |||
371 | * Message part, as it arrived from the network. | 551 | * Message part, as it arrived from the network. |
372 | * @param message_id | 552 | * @param message_id |
373 | * Message ID this data fragment belongs to. | 553 | * Message ID this data fragment belongs to. |
374 | * @param cancelled. | 554 | * @param cancelled |
375 | * #GNUNET_YES if the message was cancelled, | 555 | * #GNUNET_YES if the message was cancelled, |
376 | * #GNUNET_NO if the message is complete. | 556 | * #GNUNET_NO if the message is complete. |
377 | */ | 557 | */ |
@@ -1334,6 +1514,7 @@ GNUNET_SOCIAL_zone_add_nym (const struct GNUNET_SOCIAL_App *app, | |||
1334 | GNUNET_ResultCallback result_cb, | 1514 | GNUNET_ResultCallback result_cb, |
1335 | void *result_cls); | 1515 | void *result_cls); |
1336 | 1516 | ||
1517 | /** @} */ /* end of group social */ | ||
1337 | 1518 | ||
1338 | #if 0 /* keep Emacsens' auto-indent happy */ | 1519 | #if 0 /* keep Emacsens' auto-indent happy */ |
1339 | { | 1520 | { |