extern int client_init(void);
extern void client_fini(void);
-extern int client_browse_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data);
-extern int client_nr_of_subscriber(const char *cluster, const char *category);
+extern int client_browse_group_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data);
+extern int client_count_of_group_subscriber(const char *cluster, const char *category);
+
+extern int client_browse_category_list(const char *category, int (*cb)(struct client_node *client, void *data), void *data);
extern int client_broadcast(struct inst_info *inst, struct packet *packet);
return 0;
}
-HAPI int client_browse_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data)
+HAPI int client_browse_group_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data)
{
Eina_List *l;
struct client_node *client;
return cnt;
}
-HAPI int client_nr_of_subscriber(const char *cluster, const char *category)
+HAPI int client_browse_category_list(const char *category, int (*cb)(struct client_node *client, void *data), void *data)
+{
+ Eina_List *l;
+ struct client_node *client;
+ int cnt;
+
+ if (!cb || !category) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ cnt = 0;
+ EINA_LIST_FOREACH(s_info.client_list, l, client) {
+ if (!client_is_subscribed_by_category(client, category)) {
+ continue;
+ }
+
+ if (cb(client, data) < 0) {
+ return DBOX_STATUS_ERROR_CANCEL;
+ }
+
+ cnt++;
+ }
+
+ return cnt;
+}
+
+HAPI int client_count_of_group_subscriber(const char *cluster, const char *category)
{
Eina_List *l;
struct client_node *client;
}
if (!inst->client) {
- client_browse_list(inst->cluster, inst->category, update_client_list, inst);
+ client_browse_group_list(inst->cluster, inst->category, update_client_list, inst);
}
packet = packet_create_noack((const char *)&cmd, "dsssiiiisssssdiiiiidsi",