pips_publication_attach_data()

Updated: April 19, 2023

Attach user data to a publication

Synopsis:

#include <pips/publication.h>
int pips_publication_attach_data(pips_publication_t *publication,
                                 void *const usr_data)

Arguments:

publication
A pointer to the publication to which the user data will be attached
usr_data
An opaque pointer to user-defined data. The caller retains ownership of the data and is responsible for deleting its memory. This argument can be NULL to clear the user data.

Library:

pips-client

Description:

This function attaches the given user data to the current PiPS publication as a convenience for the caller. Internally, PiPS doesn't use the data, but the caller may retrieve the attached data at any time using pips_publication_get_data().

Note:

The user data is local only. Other providers have no visiblity into any local data attached to a publication.

Prerequisites

The caller must keep a pointer to the previous data, which is the data attached to the publication before this function is called, so it can free that data's memory. Otherwise, if the function succeeds, this memory is leaked.

Returns:

EOK
The user data was successfully attached to the publication
-1
An error occurred (errno is set)

Errors:

  • EINVAL: The publication is invalid.