This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
2017-01-19 22:07:52 +01:00
|
|
|
#ifndef __PUBSUB_MSG_H__
|
|
|
|
#define __PUBSUB_MSG_H__
|
|
|
|
|
|
|
|
#define PUBSUB_MSG_TYPE_SUB 1
|
|
|
|
#define PUBSUB_MSG_TYPE_UNSUB 2
|
|
|
|
#define PUBSUB_MSG_TYPE_PUB 3
|
|
|
|
|
|
|
|
struct pubsub_msg {
|
|
|
|
unsigned char type; // message type : alert, notification, …
|
|
|
|
char *chan;
|
|
|
|
size_t chanlen;
|
|
|
|
char *data;
|
|
|
|
size_t datalen;
|
|
|
|
};
|
|
|
|
|
2018-10-03 21:52:11 +02:00
|
|
|
void pubsub_message_serialize (const struct pubsub_msg *msg, char **data, size_t *len);
|
|
|
|
void pubsub_message_unserialize (struct pubsub_msg *msg, const char *data, size_t len);
|
|
|
|
void pubsub_message_free (struct pubsub_msg *msg);
|
|
|
|
void pubsub_message_print (const struct pubsub_msg *msg);
|
2017-01-19 22:07:52 +01:00
|
|
|
|
|
|
|
#endif
|