2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 CLIENT_EVENT_ACTIVATE,
19 CLIENT_EVENT_DEACTIVATE
22 enum client_global_event {
23 CLIENT_GLOBAL_EVENT_CREATE,
24 CLIENT_GLOBAL_EVENT_DESTROY
34 extern struct client_node *client_create(pid_t pid, int handle);
35 #define client_destroy(client) client_unref(client)
41 extern struct client_node *client_ref(struct client_node *client);
42 extern struct client_node *client_unref(struct client_node *client);
43 extern const int const client_refcnt(const struct client_node *client);
47 * Information of client PID
49 extern const pid_t const client_pid(const struct client_node *client);
50 extern struct client_node *client_find_by_pid(pid_t pid);
51 extern struct client_node *client_find_by_rpc_handle(int handle);
55 * Statistics for state of client
57 extern const int const client_count_paused(void);
58 extern int client_is_all_paused(void);
59 extern int client_count(void);
63 * For dead signal handler
65 extern struct client_node *client_deactivated_by_fault(struct client_node *client);
66 extern void client_reset_fault(struct client_node *client);
67 extern const int const client_is_faulted(const struct client_node *client);
71 * For other components which wants to know the state of a client
73 extern int client_event_callback_add(struct client_node *client, enum client_event event, int (*cb)(struct client_node *, void *), void *data);
74 extern int client_event_callback_del(struct client_node *client, enum client_event event, int (*cb)(struct client_node *, void *), void *data);
76 extern int client_global_event_handler_del(enum client_global_event event_type, int (*cb)(struct client_node *, void *), void *data);
77 extern int client_global_event_handler_add(enum client_global_event event_type, int (*cb)(struct client_node *client, void *data), void *data);
81 * Private data set & get
83 extern int client_set_data(struct client_node *client, const char *tag, void *data);
84 extern void *client_data(struct client_node *client, const char *tag);
85 extern void *client_del_data(struct client_node *client, const char *tag);
88 * Handling the client statues
91 extern void client_paused(struct client_node *client);
92 extern void client_resumed(struct client_node *client);
94 extern int client_subscribe(struct client_node *client, const char *cluster, const char *category);
95 extern int client_unsubscribe(struct client_node *client, const char *cluster, const char *category);
96 extern int client_is_subscribed(struct client_node *client, const char *cluster, const char *category);
98 extern int client_init(void);
99 extern void client_fini(void);
101 extern int client_browse_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data);
102 extern int client_nr_of_subscriber(const char *cluster, const char *category);
104 extern int client_broadcast(struct inst_info *inst, struct packet *packet);