NAME

cat_setsessdata - associate data with a session

SYNOPSIS

#include <cat.h>

int cat_setsessdata(cat_session *sess, int key, void *data, cat_freefunc *freefun);

DESCRIPTION

Associates the arbitrary data <data> with a session. When new data is set or when the session is destroyed, the data will be freed using the supplied freefun, if freefun is non-NULL. The key is the identifier of the data and must be obtained by a prior call to cat_newdatakey().

The function returns CAT_OK if successful, or a negative error code otherwise.

NOTES

When running in forking mode on UNIX, sessions will be closed as part of the cleanup procedure in the child process.

SEE ALSO

cat, cat_newdatakey