implement view switching from world tree
[ladish.git] / daemon / common.h
blob817842c0af3b52a667d11e1d688b300d4b651121
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 stuff that is needed almost everywhere in the ladishd
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 COMMON_H__CFDC869A_31AE_4FA3_B2D3_DACA8488CA55__INCLUDED
28 #define COMMON_H__CFDC869A_31AE_4FA3_B2D3_DACA8488CA55__INCLUDED
30 #include "../common.h"
32 #include <errno.h>
33 #include <dbus/dbus.h>
34 #include <uuid/uuid.h>
36 #include "../dbus/service.h"
37 #include "../dbus/helpers.h"
38 #include "../common/debug.h"
40 /* JACK port or virtual port */
41 struct port
43 struct list_head siblings_studio_all; /* link for the studio::all_ports list */
44 struct list_head siblings_studio; /* link for the studio::ports list */
45 struct list_head siblings_room; /* link for the room::ports list */
46 struct list_head siblings_client; /* link for the port list of the client */
47 struct list_head siblings_vclient; /* link for the port list of the virtual client */
49 uuid_t uuid; /* The UUID of the port */
50 bool virtual; /* Whether the port is virtual or JACK port */
51 char * jack_name; /* JACK name (short). Not valid for virtual ports. */
52 uint64_t jack_id; /* JACK port ID. Not valid for virtual ports. */
53 char * human_name; /* User assigned name */
55 struct client * client_ptr; /* JACK client this port belongs to. Not valid for virtual ports. */
56 struct client * vclient_ptr; /* Virtual client this port belongs to. NULL if there is no virtual client associated. */
58 /* superconnections are not in these lists */
59 struct list_head input_connections; /* list of input connections, i.e. connections that play to this port */
60 struct list_head output_connections; /* list of output connections, i.e. connections that capture from this port */
63 /* connection between two ports */
64 /* virtual connection is connection where at least one the ports is virtual */
65 /* superconnection is connection that implements virtual connection chain at JACK level */
66 struct connection
68 struct list_head siblings_studio_all; /* link for the studio::all_connections list */
69 struct list_head siblings_jack; /* link for the studio::jack_connections list, not valid for virtual connections */
70 struct list_head siblings_capture_port; /* link for the port::output_connections list, not valid for superconnections */
71 struct list_head siblings_playback_port; /* link for the port::input_connections list, not valid for superconnections */
73 struct connection * superconnection; /* Superconnection. NULL for non-virtual connections */
74 uint64_t jack_id; /* JACK connection ID, not valid for virtual connections */
76 struct port * capture_port_ptr; /* The capture output port */
77 struct port * playback_port_ptr; /* The playback input port */
80 struct client
82 struct list_head siblings_studio_all; /* link for the studio::all_clients list */
83 struct list_head siblings_room; /* link for the room::clients list */
84 struct list_head ports; /* List of ports that belong to the client */
85 uuid_t uuid; /* The UUID of the client */
86 uint64_t jack_id; /* JACK client ID */
87 char * jack_name; /* JACK name, not valid for virtual clients */
88 char * human_name; /* User assigned name, not valid for studio-room link clients */
89 bool virtual:1; /* Whether client is virtual */
90 bool link:1; /* Whether client is a studio-room link */
91 bool system:1; /* Whether client is system (server in-process) */
92 pid_t pid; /* process id. Not valid for system and virtual clients */
93 struct room * room_ptr; /* Room this client belongs to. If NULL, client belongs only to studio guts. */
94 struct studio * studio_ptr; /* Studio this client belongs to. For room clients this points to studio connected to the room */
97 struct room
99 struct list_head siblings; /* link for studio::rooms list */
100 struct list_head clients; /* non-virtual room clients */
101 struct list_head ports; /* ports of the room clients */
102 uuid_t uuid; /* The UUID of the room */
103 char * name; /* Name of the room */
104 struct client * link_client_ptr; /* client that connects the room to studio */
105 struct studio * studio_ptr; /* Studio connected to the room */
108 #include "studio.h"
110 extern bool g_quit;
111 extern studio_handle g_studio;
113 #endif /* #ifndef COMMON_H__CFDC869A_31AE_4FA3_B2D3_DACA8488CA55__INCLUDED */