handle port renames. closes #32
[ladish.git] / daemon / graph.h
blobb05bf7c234b2868b5e0e37d4cdf3f395fdf349fc
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009 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 bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * opath);
51 void ladish_graph_destroy(ladish_graph_handle graph_handle, bool destroy_ports);
53 void
54 ladish_graph_set_connection_handlers(
55 ladish_graph_handle graph_handle,
56 void * graph_context,
57 ladish_graph_connect_request_handler connect_handler,
58 ladish_graph_disconnect_request_handler disconnect_handler);
60 void ladish_graph_clear(ladish_graph_handle graph_handle, bool destroy_ports);
61 void * ladish_graph_get_dbus_context(ladish_graph_handle graph_handle);
62 ladish_dict_handle ladish_graph_get_dict(ladish_graph_handle graph_handle);
63 ladish_dict_handle ladish_graph_get_connection_dict(ladish_graph_handle graph_handle, uint64_t connection_id);
64 bool ladish_graph_add_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name, bool hidden);
66 void
67 ladish_graph_remove_client(
68 ladish_graph_handle graph_handle,
69 ladish_client_handle client_handle,
70 bool destroy_ports);
72 bool
73 ladish_graph_add_port(
74 ladish_graph_handle graph_handle,
75 ladish_client_handle client_handle,
76 ladish_port_handle port_handle,
77 const char * name,
78 uint32_t type,
79 uint32_t flags,
80 bool hidden);
82 ladish_client_handle
83 ladish_graph_remove_port(
84 ladish_graph_handle graph_handle,
85 ladish_port_handle port_handle);
87 bool
88 ladish_graph_rename_port(
89 ladish_graph_handle graph_handle,
90 ladish_port_handle port_handle,
91 const char * new_port_name);
93 uint64_t
94 ladish_graph_add_connection(
95 ladish_graph_handle graph_handle,
96 ladish_port_handle port1_handle,
97 ladish_port_handle port2_handle,
98 bool hidden);
100 void
101 ladish_graph_remove_connection(
102 ladish_graph_handle graph_handle,
103 uint64_t connection_id,
104 bool force);
106 bool
107 ladish_graph_get_connection_ports(
108 ladish_graph_handle graph_handle,
109 uint64_t connection_id,
110 ladish_port_handle * port1_handle_ptr,
111 ladish_port_handle * port2_handle_ptr);
113 bool
114 ladish_graph_find_connection(
115 ladish_graph_handle graph_handle,
116 ladish_port_handle port1_handle,
117 ladish_port_handle port2_handle,
118 uint64_t * connection_id_ptr);
120 ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id);
121 ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id);
122 ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle graph_handle, uint64_t client_id);
123 ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id);
124 ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name);
125 ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name);
126 ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid);
127 ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, const uuid_t uuid);
128 ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
129 const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
130 bool ladish_graph_is_client_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
131 bool ladish_graph_is_client_looks_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
132 bool ladish_graph_is_port_present(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
133 void ladish_graph_show_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
134 void ladish_graph_hide_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
135 void ladish_graph_show_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
136 void ladish_graph_hide_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
137 void ladish_graph_adjust_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle, uint32_t type, uint32_t flags);
138 void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t connection_id);
139 void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle);
140 void ladish_graph_hide_all(ladish_graph_handle graph_handle);
142 void ladish_graph_dump(ladish_graph_handle graph_handle);
144 bool
145 ladish_graph_iterate_nodes(
146 ladish_graph_handle graph_handle,
147 void * callback_context,
148 bool
149 (* client_begin_callback)(
150 void * context,
151 ladish_client_handle client_handle,
152 const char * client_name,
153 void ** client_iteration_context_ptr_ptr),
154 bool
155 (* port_callback)(
156 void * context,
157 void * client_iteration_context_ptr,
158 ladish_client_handle client_handle,
159 const char * client_name,
160 ladish_port_handle port_handle,
161 const char * port_name,
162 uint32_t port_type,
163 uint32_t port_flags),
164 bool
165 (* client_end_callback)(
166 void * context,
167 ladish_client_handle client_handle,
168 const char * client_name,
169 void * client_iteration_context_ptr));
171 bool
172 ladish_graph_iterate_connections(
173 ladish_graph_handle graph_handle,
174 void * callback_context,
175 bool (* callback)(void * context, ladish_port_handle port1_handle, ladish_port_handle port2_handle, ladish_dict_handle dict));
177 extern const struct dbus_interface_descriptor g_interface_patchbay;
179 #endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */