Merge branch 'stable' into 'main'
[ladish.git] / daemon / graph.h
blob9730b203c1e302573639f3e097b0de1f4d806727
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009, 2010, 2011 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains interface to the D-Bus patchbay interface helpers
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED
28 #define PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED
30 #include "client.h"
31 #include "port.h"
33 typedef struct ladish_graph_tag { int unused; } * ladish_graph_handle;
35 typedef
36 bool
37 (* ladish_graph_connect_request_handler)(
38 void * context,
39 ladish_graph_handle graph_handle,
40 ladish_port_handle port1,
41 ladish_port_handle port2);
43 typedef
44 bool
45 (* ladish_graph_disconnect_request_handler)(
46 void * context,
47 ladish_graph_handle graph_handle,
48 uint64_t connection_id);
50 typedef void (* ladish_graph_simple_port_callback)(ladish_port_handle port_handle);
52 bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * opath);
53 bool ladish_graph_copy(ladish_graph_handle src, ladish_graph_handle dest);
54 void ladish_graph_destroy(ladish_graph_handle graph_handle);
56 const char * ladish_graph_get_opath(ladish_graph_handle graph_handle);
57 const char * ladish_graph_get_description(ladish_graph_handle graph_handle);
59 void
60 ladish_graph_set_connection_handlers(
61 ladish_graph_handle graph_handle,
62 void * graph_context,
63 ladish_graph_connect_request_handler connect_handler,
64 ladish_graph_disconnect_request_handler disconnect_handler);
66 void ladish_graph_clear(ladish_graph_handle graph_handle, ladish_graph_simple_port_callback port_callback);
67 void * ladish_graph_get_dbus_context(ladish_graph_handle graph_handle);
68 ladish_dict_handle ladish_graph_get_dict(ladish_graph_handle graph_handle);
69 ladish_dict_handle ladish_graph_get_connection_dict(ladish_graph_handle graph_handle, uint64_t connection_id);
70 bool ladish_graph_add_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name, bool hidden);
72 void
73 ladish_graph_remove_client(
74 ladish_graph_handle graph_handle,
75 ladish_client_handle client_handle);
77 bool
78 ladish_graph_rename_client(
79 ladish_graph_handle graph_handle,
80 ladish_client_handle client_handle,
81 const char * new_client_name);
83 bool
84 ladish_graph_add_port(
85 ladish_graph_handle graph_handle,
86 ladish_client_handle client_handle,
87 ladish_port_handle port_handle,
88 const char * name,
89 uint32_t type,
90 uint32_t flags,
91 bool hidden);
93 ladish_client_handle
94 ladish_graph_remove_port(
95 ladish_graph_handle graph_handle,
96 ladish_port_handle port_handle);
98 ladish_client_handle
99 ladish_graph_remove_port_by_jack_id(
100 ladish_graph_handle graph_handle,
101 uint64_t jack_port_id,
102 bool room,
103 bool studio);
105 void
106 ladish_graph_move_port(
107 ladish_graph_handle graph_handle,
108 ladish_port_handle port_handle,
109 ladish_client_handle client_handle);
111 bool
112 ladish_graph_rename_port(
113 ladish_graph_handle graph_handle,
114 ladish_port_handle port_handle,
115 const char * new_port_name);
117 uint64_t
118 ladish_graph_add_connection(
119 ladish_graph_handle graph_handle,
120 ladish_port_handle port1_handle,
121 ladish_port_handle port2_handle,
122 bool hidden);
124 void
125 ladish_graph_remove_connection(
126 ladish_graph_handle graph_handle,
127 uint64_t connection_id,
128 bool force);
130 bool
131 ladish_graph_get_connection_ports(
132 ladish_graph_handle graph_handle,
133 uint64_t connection_id,
134 ladish_port_handle * port1_handle_ptr,
135 ladish_port_handle * port2_handle_ptr);
137 bool
138 ladish_graph_find_connection(
139 ladish_graph_handle graph_handle,
140 ladish_port_handle port1_handle,
141 ladish_port_handle port2_handle,
142 uint64_t * connection_id_ptr);
144 ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id);
145 ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id);
146 ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle graph_handle, uint64_t client_id);
147 ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id, bool room, bool studio);
148 ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name, bool appless);
149 ladish_client_handle ladish_graph_find_client_by_app(ladish_graph_handle graph_handle, const uuid_t app_uuid);
150 ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name, void * vgraph_filter);
151 ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid);
152 ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, bool use_link_override_uuids, void * vgraph_filter);
154 ladish_port_handle
155 ladish_graph_find_client_port_by_uuid(
156 ladish_graph_handle graph,
157 ladish_client_handle client,
158 const uuid_t uuid,
159 bool use_link_override_uuids);
161 void
162 ladish_graph_set_link_port_override_uuid(
163 ladish_graph_handle graph,
164 ladish_port_handle port,
165 const uuid_t override_uuid);
167 ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
168 uint64_t ladish_graph_get_client_id(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
169 const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
170 const char * ladish_graph_get_port_name(ladish_graph_handle graph, ladish_port_handle port);
171 bool ladish_graph_client_is_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
172 bool ladish_graph_client_looks_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
173 bool ladish_graph_client_is_hidden(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
174 bool ladish_graph_is_port_present(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
175 void ladish_graph_show_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
176 void ladish_graph_hide_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
177 void ladish_graph_show_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
178 void ladish_graph_hide_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
179 void ladish_graph_adjust_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle, uint32_t type, uint32_t flags);
180 void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t connection_id);
181 void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle);
182 bool ladish_disconnect_visible_connections(ladish_graph_handle graph_handle);
183 void ladish_graph_hide_non_virtual(ladish_graph_handle graph_handle);
184 void ladish_graph_get_port_uuid(ladish_graph_handle graph, ladish_port_handle port, uuid_t uuid_ptr);
185 bool ladish_graph_client_has_visible_app_port(ladish_graph_handle graph, ladish_client_handle client, const uuid_t app_uuid);
186 bool ladish_graph_client_has_visible_ports(ladish_graph_handle graph, ladish_client_handle client);
188 void ladish_graph_dump(ladish_graph_handle graph_handle);
190 bool
191 ladish_graph_iterate_nodes(
192 ladish_graph_handle graph_handle,
193 void * callback_context,
194 bool
195 (* client_begin_callback)(
196 void * context,
197 ladish_graph_handle graph_handle,
198 bool hidden,
199 ladish_client_handle client_handle,
200 const char * client_name,
201 void ** client_iteration_context_ptr_ptr),
202 bool
203 (* port_callback)(
204 void * context,
205 ladish_graph_handle graph_handle,
206 bool hidden,
207 void * client_iteration_context_ptr,
208 ladish_client_handle client_handle,
209 const char * client_name,
210 ladish_port_handle port_handle,
211 const char * port_name,
212 uint32_t port_type,
213 uint32_t port_flags),
214 bool
215 (* client_end_callback)(
216 void * context,
217 ladish_graph_handle graph_handle,
218 bool hidden,
219 ladish_client_handle client_handle,
220 const char * client_name,
221 void * client_iteration_context_ptr));
223 bool
224 ladish_graph_iterate_connections(
225 ladish_graph_handle graph_handle,
226 void * callback_context,
227 bool (* callback)(
228 void * context,
229 ladish_graph_handle graph_handle,
230 bool connection_hidden,
231 ladish_client_handle client1_handle,
232 ladish_port_handle port1_handle,
233 bool port1_hidden,
234 ladish_client_handle client2_handle,
235 ladish_port_handle port2_handle,
236 bool port2_hidden,
237 ladish_dict_handle dict));
239 bool
240 ladish_graph_interate_client_ports(
241 ladish_graph_handle graph_handle,
242 ladish_client_handle client_handle,
243 void * callback_context,
244 bool
245 (* port_callback)(
246 void * context,
247 ladish_graph_handle graph_handle,
248 bool hidden,
249 ladish_client_handle client_handle,
250 const char * client_name,
251 ladish_port_handle port_handle,
252 const char * port_name,
253 uint32_t port_type,
254 uint32_t port_flags));
256 void ladish_graph_clear_persist(ladish_graph_handle graph_handle);
257 void ladish_graph_set_persist(ladish_graph_handle graph_handle);
258 bool ladish_graph_is_persist(ladish_graph_handle graph_handle);
259 bool ladish_graph_looks_empty(ladish_graph_handle graph_handle);
260 bool ladish_graph_has_visible_connections(ladish_graph_handle graph_handle);
262 void ladish_graph_remove_hidden_objects(ladish_graph_handle graph_handle);
264 void ladish_graph_trick_dicts(ladish_graph_handle graph_handle);
266 extern const struct cdbus_interface_descriptor g_interface_patchbay;
268 #endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */