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 __LASH_CLIENT_INTERFACE_H_
22 #define __LASH_CLIENT_INTERFACE_H_
26 #include <lash/types.h>
32 #define lash_enabled(client) ((client) && lash_server_connected (client))
35 * Extract lash-specific arguments from argc/argv.
36 * This should be done before the client checks them, obviously
39 lash_extract_args(int *argc
,
43 * Destroy a lash_args_t (returned from lash_extract_args).
46 lash_args_destroy(lash_args_t
*args
);
49 * Open a connection to the server.
50 * Returns NULL on failure.
53 lash_init(const lash_args_t
*args
,
54 const char *client_class
,
56 lash_protocol_t protocol
);
59 * Get the hostname of the server.
62 lash_get_server_name(lash_client_t
*client
);
65 * Get the number of pending events.
68 lash_get_pending_event_count(lash_client_t
*client
);
72 * The event must be freed using lash_event_destroy.
73 * Returns NULL if there are no events pending.
76 lash_get_event(lash_client_t
*client
);
79 * Get the number of pending configs.
82 lash_get_pending_config_count(lash_client_t
*client
);
86 * The config must be freed using lash_config_destroy.
87 * Returns NULL if there are no configs pending.
90 lash_get_config(lash_client_t
*client
);
93 * Send an event to the server.
94 * The event must be created using lash_event_new or lash_event_new_with_type.
95 * The program takes over ownership of the memory and it should not be freed
99 lash_send_event(lash_client_t
*client
,
100 lash_event_t
*event
);
103 * Send some data to the server.
104 * The config must be created using lash_config_new, lash_config_new_with_key
105 * or lash_config_dup. The program takes over ownership of the memory and
106 * it should not be freed by the client.
109 lash_send_config(lash_client_t
*client
,
110 lash_config_t
*config
);
113 * Check whether the server is connected.
114 * Returns 1 if the server is still connected or 0 if it isn't.
117 lash_server_connected(lash_client_t
*client
);
120 * Tell the server the client's JACK client name.
123 lash_jack_client_name(lash_client_t
*client
,
127 * Tell the server the client's ALSA client ID.
130 lash_alsa_client_id(lash_client_t
*client
,
138 #endif /* __LASH_CLIENT_INTERFACE_H_ */