#include <cat.h>
int cat_onclose(cat_session *sess, cat_closefunc *func, void *data);
The callback should match the following prototype:
typedef void cat_closefunc(cat_session *, void *);
When the callback is invoked, the only cat function that can safely be called is cat_getsessid().
Any number of callbacks can be installed for a session.
The function returns CAT_OK if successful, or a negative error code otherwise.