Quit when requested from the menu
[ladish.git] / daemon / common.h
blob9ad0d608f73aac14a896debcf990e7b46960c9dc
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/klist.h"
39 #include "../common/debug.h"
41 /* JACK port or virtual port */
42 struct port
44 struct list_head siblings_studio_all; /* link for the studio::all_ports list */
45 struct list_head siblings_studio; /* link for the studio::ports list */
46 struct list_head siblings_room; /* link for the room::ports list */
47 struct list_head siblings_client; /* link for the port list of the client */
48 struct list_head siblings_vclient; /* link for the port list of the virtual client */
50 uuid_t uuid; /* The UUID of the port */
51 bool virtual; /* Whether the port is virtual or JACK port */
52 char * jack_name; /* JACK name (short). Not valid for virtual ports. */
53 uint64_t jack_id; /* JACK port ID. Not valid for virtual ports. */
54 char * human_name; /* User assigned name */
56 struct client * client_ptr; /* JACK client this port belongs to. Not valid for virtual ports. */
57 struct client * vclient_ptr; /* Virtual client this port belongs to. NULL if there is no virtual client associated. */
59 /* superconnections are not in these lists */
60 struct list_head input_connections; /* list of input connections, i.e. connections that play to this port */
61 struct list_head output_connections; /* list of output connections, i.e. connections that capture from this port */
64 /* connection between two ports */
65 /* virtual connection is connection where at least one the ports is virtual */
66 /* superconnection is connection that implements virtual connection chain at JACK level */
67 struct connection
69 struct list_head siblings_studio_all; /* link for the studio::all_connections list */
70 struct list_head siblings_jack; /* link for the studio::jack_connections list, not valid for virtual connections */
71 struct list_head siblings_capture_port; /* link for the port::output_connections list, not valid for superconnections */
72 struct list_head siblings_playback_port; /* link for the port::input_connections list, not valid for superconnections */
74 struct connection * superconnection; /* Superconnection. NULL for non-virtual connections */
75 uint64_t jack_id; /* JACK connection ID, not valid for virtual connections */
77 struct port * capture_port_ptr; /* The capture output port */
78 struct port * playback_port_ptr; /* The playback input port */
81 struct client
83 struct list_head siblings_studio_all; /* link for the studio::all_clients list */
84 struct list_head siblings_room; /* link for the room::clients list */
85 struct list_head ports; /* List of ports that belong to the client */
86 uuid_t uuid; /* The UUID of the client */
87 uint64_t jack_id; /* JACK client ID */
88 char * jack_name; /* JACK name, not valid for virtual clients */
89 char * human_name; /* User assigned name, not valid for studio-room link clients */
90 bool virtual:1; /* Whether client is virtual */
91 bool link:1; /* Whether client is a studio-room link */
92 bool system:1; /* Whether client is system (server in-process) */
93 pid_t pid; /* process id. Not valid for system and virtual clients */
94 struct room * room_ptr; /* Room this client belongs to. If NULL, client belongs only to studio guts. */
95 struct studio * studio_ptr; /* Studio this client belongs to. For room clients this points to studio connected to the room */
98 struct room
100 struct list_head siblings; /* link for studio::rooms list */
101 struct list_head clients; /* non-virtual room clients */
102 struct list_head ports; /* ports of the room clients */
103 uuid_t uuid; /* The UUID of the room */
104 char * name; /* Name of the room */
105 struct client * link_client_ptr; /* client that connects the room to studio */
106 struct studio * studio_ptr; /* Studio connected to the room */
109 #include "studio.h"
111 extern bool g_quit;
112 extern studio_handle g_studio;
114 #endif /* #ifndef COMMON_H__CFDC869A_31AE_4FA3_B2D3_DACA8488CA55__INCLUDED */