fix conf_set()
[ladish.git] / daemon / cmd.h
blob7c4f737ffdb043a8493e7b46577d2cac2c10e075
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains interface to the command queue stuff
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 CMD_H__28542C9B_7CB8_40F8_BBB6_DCE13CBB1E7F__INCLUDED
28 #define CMD_H__28542C9B_7CB8_40F8_BBB6_DCE13CBB1E7F__INCLUDED
30 #include "common.h"
32 #define LADISH_COMMAND_STATE_PREPARE 0
33 #define LADISH_COMMAND_STATE_PENDING 1
34 #define LADISH_COMMAND_STATE_WAITING 2
35 #define LADISH_COMMAND_STATE_DONE 3
37 struct ladish_command
39 struct list_head siblings;
41 unsigned int state;
42 bool cancel;
44 void * context;
45 bool (* run)(void * context);
46 void (* destructor)(void * context);
49 struct ladish_cqueue
51 bool cancel;
52 struct list_head queue;
55 void ladish_cqueue_init(struct ladish_cqueue * queue_ptr);
56 void ladish_cqueue_run(struct ladish_cqueue * queue_ptr);
57 void ladish_cqueue_cancel(struct ladish_cqueue * queue_ptr);
58 bool ladish_cqueue_add_command(struct ladish_cqueue * queue_ptr, struct ladish_command * command_ptr);
59 void ladish_cqueue_drop_command(struct ladish_cqueue * queue_ptr);
60 void ladish_cqueue_clear(struct ladish_cqueue * queue_ptr);
62 void * ladish_command_new(size_t size);
64 bool ladish_command_new_studio(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * studio_name);
65 bool ladish_command_load_studio(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * studio_name, bool autostart);
66 bool ladish_command_rename_studio(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * studio_name);
67 bool ladish_command_save_studio(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * new_studio_name);
68 bool ladish_command_start_studio(void * call_ptr, struct ladish_cqueue * queue_ptr);
69 bool ladish_command_stop_studio(void * call_ptr, struct ladish_cqueue * queue_ptr);
70 bool ladish_command_unload_studio(void * call_ptr, struct ladish_cqueue * queue_ptr);
71 bool ladish_command_exit(void * call_ptr, struct ladish_cqueue * queue_ptr);
73 bool
74 ladish_command_new_app(
75 void * call_ptr,
76 struct ladish_cqueue * queue_ptr,
77 const char * opath,
78 bool terminal,
79 const char * commandline,
80 const char * name,
81 uint8_t level);
83 bool ladish_command_change_app_state(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * opath, uint64_t id, unsigned int target_state);
84 bool ladish_command_remove_app(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * opath, uint64_t id);
85 bool ladish_command_create_room(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * room_name, const char * template_name);
86 bool ladish_command_delete_room(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * room_name);
88 bool
89 ladish_command_save_project(
90 void * call_ptr,
91 struct ladish_cqueue * queue_ptr,
92 const uuid_t room_uuid_ptr,
93 const char * project_dir,
94 const char * project_name);
96 bool
97 ladish_command_unload_project(
98 void * call_ptr,
99 struct ladish_cqueue * queue_ptr,
100 const uuid_t room_uuid_ptr);
102 bool
103 ladish_command_load_project(
104 void * call_ptr,
105 struct ladish_cqueue * queue_ptr,
106 const uuid_t room_uuid_ptr,
107 const char * project_dir);
109 #endif /* #ifndef CMD_H__28542C9B_7CB8_40F8_BBB6_DCE13CBB1E7F__INCLUDED */