Archived
3
0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues or pull requests.
libipc-old/pubsub/lib/channels.h

46 lines
1.6 KiB
C
Raw Normal View History

2017-01-19 22:07:52 +01:00
#ifndef __CHANNELS_H__
#define __CHANNELS_H__
2018-10-30 11:13:30 +01:00
#include "../../core/ipc.h"
2017-01-19 22:07:52 +01:00
// head of the list
LIST_HEAD(channels, channel);
// element of the list
// channel : chan name + chan name length + a list of applications
struct channel {
char *chan;
size_t chanlen;
struct ipc_clients *subs;
2017-01-19 22:07:52 +01:00
LIST_ENTRY(channel) entries;
};
// simple channel
int pubsubd_channel_new (struct channel *c, const char *name);
struct channel * pubsubd_channel_get (struct channels *chans, struct channel *c);
void pubsubd_channel_free (struct channel *c);
int pubsubd_channel_eq (const struct channel *c1, const struct channel *c2);
void pubsubd_channel_print (const struct channel *c);
// list of channels
void pubsubd_channels_init (struct channels *chans);
void pubsubd_channels_print (const struct channels *chans);
struct channel * pubsubd_channels_add (struct channels *chans, const char *chan);
void pubsubd_channels_del (struct channels *chans, struct channel *c);
void pubsubd_channels_del_all (struct channels *chans);
struct channel * pubsubd_channel_search (struct channels *chans, char *chan);
// add and remove subscribers
2018-10-04 00:30:47 +02:00
void pubsubd_channel_subscribe (const struct channel *c, struct ipc_client *p);
void pubsubd_channel_unsubscribe (const struct channel *c, struct ipc_client *p);
2017-01-19 22:07:52 +01:00
void pubsubd_channels_subscribe (struct channels *chans
2018-10-04 00:30:47 +02:00
, char *chname, struct ipc_client *p);
2017-01-19 22:07:52 +01:00
void pubsubd_channels_unsubscribe (struct channels *chans
2018-10-04 00:30:47 +02:00
, char *chname, struct ipc_client *p);
2017-01-19 22:07:52 +01:00
void pubsubd_channels_unsubscribe_everywhere (struct channels *chans
2018-10-04 00:30:47 +02:00
, struct ipc_client *p);
2017-01-19 22:07:52 +01:00
#endif