@@ -123,10 +123,12 @@ LIBSESSION_EXPORT bool config_needs_push(const config_object* conf);
123123typedef struct config_push_data {
124124 // The config seqno (to be provided later in `config_confirm_pushed`).
125125 seqno_t seqno ;
126- // The config message to push (binary data, not null-terminated).
127- unsigned char * config ;
128- // The length of `config`
129- size_t config_len ;
126+ // Array of config message(s) to push (each is binary data, not null-terminated).
127+ unsigned char * * config ;
128+ // Array of lengths of the messages in `config`
129+ size_t * config_lens ;
130+ // Length of config and config_len arrays.
131+ size_t n_configs ;
130132 // Array of obsolete message hashes to delete; each element is a null-terminated C string
131133 char * * obsolete ;
132134 // length of `obsolete`
@@ -161,24 +163,28 @@ LIBSESSION_EXPORT config_push_data* config_push(config_object* conf);
161163/// API: base/config_confirm_pushed
162164///
163165/// Reports that data obtained from `config_push` has been successfully stored on the server with
164- /// message hash `msg_hash`. The seqno value is the one returned by the config_push call that
165- /// yielded the config data.
166+ /// message hash(es) `msg_hashes` containing `hashes_len` hashes. The seqno value is the one
167+ /// returned by the config_push call that yielded the config data. The order of hashes in the
168+ /// msg_hashes array is unimportant.
166169///
167170/// Declaration:
168171/// ```cpp
169172/// VOID config_confirm_pushed(
170173/// [in, out] config_object* conf,
171- /// [out] seqno_t seqno,
172- /// [out] const char* msg_hash
174+ /// [in] seqno_t seqno,
175+ /// [in] const char* const* msg_hashes
176+ /// [in] size_t hashes_len
173177/// );
174178/// ```
175179///
176180/// Inputs:
177181/// - `conf` -- [in] Pointer to config_object object
178- /// - `seqno` -- [out] Value returned by config_push call
179- /// - `msg_hash` -- [out] Value returned by config_push call
182+ /// - `seqno` -- [in] Value returned by config_push call
183+ /// - `msg_hashes` -- [in] array of message hashes (null terminated C strings) returned by the
184+ /// storage server when stored.
185+ /// - `hashes_len` -- [in] length of the `msg_hashes` array
180186LIBSESSION_EXPORT void config_confirm_pushed (
181- config_object * conf , seqno_t seqno , const char * msg_hash );
187+ config_object * conf , seqno_t seqno , const char * const * msg_hashes , size_t hashes_len );
182188
183189/// API: base/config_dump
184190///
@@ -229,17 +235,46 @@ LIBSESSION_EXPORT bool config_dump(config_object* conf, unsigned char** out, siz
229235/// - `bool` -- True if config has changed since last call to `dump()`
230236LIBSESSION_EXPORT bool config_needs_dump (const config_object * conf );
231237
232- /// API: base/config_current_hashes
238+ /// API: base/config_curr_hashes
233239///
234- /// Obtains the current active hashes. Note that this will be empty if the current hash is unknown
235- /// or not yet determined (for example, because the current state is dirty or because the most
236- /// recent push is still pending and we don't know the hash yet).
240+ /// Obtains the hashes of the current config state. Note that this will be empty if the current
241+ /// hash is unknown or not yet determined (for example, because the current state is dirty or
242+ /// because the most recent push is still pending and we don't know the hash yet).
243+ ///
244+ /// See also config_active_hashes(), which you often want to use instead of this.
245+ ///
246+ /// The returned pointer belongs to the caller and must be freed via `free()` when done with it.
247+ ///
248+ /// Declaration:
249+ /// ```cpp
250+ /// CONFIG_STRING_LIST* config_curr_hashes(
251+ /// [in] const config_object* conf
252+ /// );
253+ ///
254+ /// ```
255+ ///
256+ /// Inputs:
257+ /// - `conf` -- [in] Pointer to config_object object
258+ ///
259+ /// Outputs:
260+ /// - `config_string_list*` -- pointer to the list of hashes; the pointer belongs to the caller
261+ LIBSESSION_EXPORT config_string_list * config_curr_hashes (const config_object * conf )
262+ LIBSESSION_WARN_UNUSED ;
263+
264+ /// API: base/config_active_hashes
265+ ///
266+ /// Obtains the hashes of currently active config messages. This includes both the hashes of the
267+ /// current config (as returned by config_curr_hashes), but also any partially-arrived multipart
268+ /// config messages for which we are still waiting for remaining parts to complete the config.
269+ ///
270+ /// The returned array of hashes have no particular ordering (and may differ from one call to the
271+ /// next even without any change to the values considered as a set).
237272///
238273/// The returned pointer belongs to the caller and must be freed via `free()` when done with it.
239274///
240275/// Declaration:
241276/// ```cpp
242- /// CONFIG_STRING_LIST* config_current_hashes (
277+ /// CONFIG_STRING_LIST* config_active_hashes (
243278/// [in] const config_object* conf
244279/// );
245280///
@@ -250,7 +285,7 @@ LIBSESSION_EXPORT bool config_needs_dump(const config_object* conf);
250285///
251286/// Outputs:
252287/// - `config_string_list*` -- pointer to the list of hashes; the pointer belongs to the caller
253- LIBSESSION_EXPORT config_string_list * config_current_hashes (const config_object * conf )
288+ LIBSESSION_EXPORT config_string_list * config_active_hashes (const config_object * conf )
254289 LIBSESSION_WARN_UNUSED ;
255290
256291/// API: base/config_old_hashes
0 commit comments