daemon: fix connection autohidding when hidding port
[ladish.git] / daemon / graph.h
blobd2cc5367e0824edccf7083312491eb0ef30a74cd
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 uint64_t
88 ladish_graph_add_connection(
89 ladish_graph_handle graph_handle,
90 ladish_port_handle port1_handle,
91 ladish_port_handle port2_handle,
92 bool hidden);
94 void
95 ladish_graph_remove_connection(
96 ladish_graph_handle graph_handle,
97 uint64_t connection_id);
99 bool
100 ladish_graph_get_connection_ports(
101 ladish_graph_handle graph_handle,
102 uint64_t connection_id,
103 ladish_port_handle * port1_handle_ptr,
104 ladish_port_handle * port2_handle_ptr);
106 bool
107 ladish_graph_find_connection(
108 ladish_graph_handle graph_handle,
109 ladish_port_handle port1_handle,
110 ladish_port_handle port2_handle,
111 uint64_t * connection_id_ptr);
113 ladish_client_handle ladish_graph_find_client_by_id(ladish_graph_handle graph_handle, uint64_t client_id);
114 ladish_port_handle ladish_graph_find_port_by_id(ladish_graph_handle graph_handle, uint64_t port_id);
115 ladish_client_handle ladish_graph_find_client_by_jack_id(ladish_graph_handle graph_handle, uint64_t client_id);
116 ladish_port_handle ladish_graph_find_port_by_jack_id(ladish_graph_handle graph_handle, uint64_t port_id);
117 ladish_client_handle ladish_graph_find_client_by_name(ladish_graph_handle graph_handle, const char * name);
118 ladish_port_handle ladish_graph_find_port_by_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle, const char * name);
119 ladish_client_handle ladish_graph_find_client_by_uuid(ladish_graph_handle graph_handle, uuid_t uuid);
120 ladish_port_handle ladish_graph_find_port_by_uuid(ladish_graph_handle graph_handle, uuid_t uuid);
121 ladish_client_handle ladish_graph_get_port_client(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
122 const char * ladish_graph_get_client_name(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
123 bool ladish_graph_is_client_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
124 bool ladish_graph_is_client_looks_empty(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
125 bool ladish_graph_is_port_present(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
126 void ladish_graph_show_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
127 void ladish_graph_hide_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle);
128 void ladish_graph_show_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
129 void ladish_graph_hide_client(ladish_graph_handle graph_handle, ladish_client_handle client_handle);
130 void ladish_graph_adjust_port(ladish_graph_handle graph_handle, ladish_port_handle port_handle, uint32_t type, uint32_t flags);
131 void ladish_graph_show_connection(ladish_graph_handle graph_handle, uint64_t connection_id);
132 void ladish_try_connect_hidden_connections(ladish_graph_handle graph_handle);
134 void ladish_graph_dump(ladish_graph_handle graph_handle);
136 bool
137 ladish_graph_iterate_nodes(
138 ladish_graph_handle graph_handle,
139 void * callback_context,
140 bool
141 (* client_begin_callback)(
142 void * context,
143 ladish_client_handle client_handle,
144 const char * client_name,
145 void ** client_iteration_context_ptr_ptr),
146 bool
147 (* port_callback)(
148 void * context,
149 void * client_iteration_context_ptr,
150 ladish_client_handle client_handle,
151 const char * client_name,
152 ladish_port_handle port_handle,
153 const char * port_name,
154 uint32_t port_type,
155 uint32_t port_flags),
156 bool
157 (* client_end_callback)(
158 void * context,
159 ladish_client_handle client_handle,
160 const char * client_name,
161 void * client_iteration_context_ptr));
163 bool
164 ladish_graph_iterate_connections(
165 ladish_graph_handle graph_handle,
166 void * callback_context,
167 bool (* callback)(void * context, ladish_port_handle port1_handle, ladish_port_handle port2_handle, ladish_dict_handle dict));
169 extern const struct dbus_interface_descriptor g_interface_patchbay;
171 #endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */