daemon: Fix for #97
[ladish.git] / daemon / graph.h
blobe37b73b5dc2b53583adf3db2c512ee3425b1351c
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009, 2010 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, bool skip_hidden);
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 bool
106 ladish_graph_rename_port(
107 ladish_graph_handle graph_handle,
108 ladish_port_handle port_handle,
109 const char * new_port_name);
111 uint64_t
112 ladish_graph_add_connection(
113 ladish_graph_handle graph_handle,
114 ladish_port_handle port1_handle,
115 ladish_port_handle port2_handle,
116 bool hidden);
118 void
119 ladish_graph_remove_connection(
120 ladish_graph_handle graph_handle,
121 uint64_t connection_id,
122 bool force);
124 bool
125 ladish_graph_get_connection_ports(
126 ladish_graph_handle graph_handle,
127 uint64_t connection_id,
128 ladish_port_handle * port1_handle_ptr,
129 ladish_port_handle * port2_handle_ptr);
131 bool
132 ladish_graph_find_connection(
133 ladish_graph_handle graph_handle,
134 ladish_port_handle port1_handle,
135 ladish_port_handle port2_handle,
136 uint64_t * connection_id_ptr);
138 ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id);
139 ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id);
140 ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle graph_handle, uint64_t client_id);
141 ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id, bool room, bool studio);
142 ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name);
143 ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name);
144 ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid);
145 ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, bool use_link_override_uuids);
146 ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
147 const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
148 const char * ladish_graph_get_port_name(ladish_graph_handle graph, ladish_port_handle port);
149 bool ladish_graph_client_is_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
150 bool ladish_graph_client_looks_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
151 bool ladish_graph_client_is_hidden(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
152 bool ladish_graph_is_port_present(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
153 void ladish_graph_show_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
154 void ladish_graph_hide_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
155 void ladish_graph_show_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
156 void ladish_graph_hide_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
157 void ladish_graph_adjust_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle, uint32_t type, uint32_t flags);
158 void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t connection_id);
159 void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle);
160 void ladish_graph_hide_non_virtual(ladish_graph_handle graph_handle);
161 void ladish_graph_get_port_uuid(ladish_graph_handle graph, ladish_port_handle port, uuid_t uuid_ptr);
162 void ladish_graph_set_link_port_override_uuid(ladish_graph_handle graph_handle, const uuid_t uuid, const uuid_t override_uuid);
164 void ladish_graph_dump(ladish_graph_handle graph_handle);
166 bool
167 ladish_graph_iterate_nodes(
168 ladish_graph_handle graph_handle,
169 bool skip_hidden,
170 void * vgraph_filter,
171 void * callback_context,
172 bool
173 (* client_begin_callback)(
174 void * context,
175 ladish_client_handle client_handle,
176 const char * client_name,
177 void ** client_iteration_context_ptr_ptr),
178 bool
179 (* port_callback)(
180 void * context,
181 void * client_iteration_context_ptr,
182 ladish_client_handle client_handle,
183 const char * client_name,
184 ladish_port_handle port_handle,
185 const char * port_name,
186 uint32_t port_type,
187 uint32_t port_flags),
188 bool
189 (* client_end_callback)(
190 void * context,
191 ladish_client_handle client_handle,
192 const char * client_name,
193 void * client_iteration_context_ptr));
195 bool
196 ladish_graph_iterate_connections(
197 ladish_graph_handle graph_handle,
198 bool skip_hidden,
199 void * callback_context,
200 bool (* callback)(void * context, ladish_port_handle port1_handle, ladish_port_handle port2_handle, ladish_dict_handle dict));
202 void ladish_graph_clear_persist(ladish_graph_handle graph_handle);
203 bool ladish_graph_is_persist(ladish_graph_handle graph_handle);
204 bool ladish_graph_looks_empty(ladish_graph_handle graph_handle);
206 extern const struct dbus_interface_descriptor g_interface_patchbay;
208 #endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */