Dont assign restore tasks to stateless clients; improve logs
[ladish.git] / lashd / server.h
blob3a9a6c33b1530ca1b9502c7010e2ddcf3000ed29
1 /*
2 * LASH
4 * Copyright (C) 2002 Robert Ham <rah@bash.sh>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef __LASHD_SERVER_H__
22 #define __LASHD_SERVER_H__
24 #include "../config.h"
26 #include <stdbool.h>
27 #include <sys/types.h>
28 #include <dbus/dbus.h>
30 #include "types.h"
31 #include "dbus/service.h"
32 #include "common/klist.h"
34 #ifdef HAVE_ALSA
35 # include "alsa_mgr.h"
36 #endif
38 extern server_t *g_server;
40 struct _server
42 service_t *dbus_service;
43 #ifdef HAVE_JACK_DBUS
44 lashd_jackdbus_mgr_t *jackdbus_mgr;
45 #else
46 jack_mgr_t *jack_mgr;
47 #endif
48 #ifdef HAVE_ALSA
49 alsa_mgr_t *alsa_mgr;
50 #else
51 void *alsa_mgr;
52 #endif
54 char *projects_dir;
55 struct list_head loaded_projects;
56 struct list_head all_projects;
57 struct list_head appdb;
58 dbus_uint64_t task_iter;
60 bool quit;
63 server_t *
64 server_new(const char *default_dir);
66 void
67 server_destroy(server_t *server);
69 void
70 server_main(server_t *server);
72 project_t *
73 server_find_project_by_name(server_t *server,
74 const char *project_name);
76 client_t *
77 server_add_client(server_t *server,
78 const char *dbus_name,
79 pid_t pid,
80 const char *class,
81 int flags,
82 const char *working_dir,
83 int argc,
84 char **argv);
86 client_t *
87 server_find_client_by_dbus_name(server_t *server,
88 const char *dbus_name);
90 client_t *
91 server_find_client_by_pid(server_t *server,
92 pid_t pid);
94 client_t *
95 server_find_lost_client_by_pid(
96 server_t * server,
97 pid_t pid);
99 client_t *
100 server_find_client_by_id(
101 uuid_t id);
103 void
104 server_close_project(server_t *server,
105 project_t *project);
107 void
108 server_save_all_projects(server_t *server);
110 void
111 server_close_all_projects(server_t *server);
113 bool
114 server_project_close_by_name(server_t *server,
115 const char *project_name);
117 bool
118 server_project_restore_by_dir(server_t *server,
119 const char *directory);
121 bool
122 server_project_restore_by_name(server_t *server,
123 const char *project_name);
125 bool
126 server_project_save_by_name(server_t *server,
127 const char *project_name);
129 #endif /* __LASHD_SERVER_H__ */