Add log dump
[lash.git] / lash / client_interface.h
blob421779de7d3e81cb7028f656a1cb08cd4141bbb9
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 __LASH_CLIENT_INTERFACE_H_
22 #define __LASH_CLIENT_INTERFACE_H_
24 #include <stdint.h>
26 #include <lash/types.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #define lash_enabled(client) ((client) && lash_server_connected (client))
34 /**
35 * Extract lash-specific arguments from argc/argv.
36 * This should be done before the client checks them, obviously
38 lash_args_t *
39 lash_extract_args(int *argc,
40 char ***argv);
42 /**
43 * Destroy a lash_args_t (returned from lash_extract_args).
45 void
46 lash_args_destroy(lash_args_t *args);
48 /**
49 * Open a connection to the server.
50 * Returns NULL on failure.
52 lash_client_t *
53 lash_init(const lash_args_t *args,
54 const char *client_class,
55 int client_flags,
56 lash_protocol_t protocol);
58 /**
59 * Get the hostname of the server.
61 const char *
62 lash_get_server_name(lash_client_t *client);
64 /**
65 * Get the number of pending events.
67 unsigned int
68 lash_get_pending_event_count(lash_client_t *client);
70 /**
71 * Retrieve an event.
72 * The event must be freed using lash_event_destroy.
73 * Returns NULL if there are no events pending.
75 lash_event_t *
76 lash_get_event(lash_client_t *client);
78 /**
79 * Get the number of pending configs.
81 unsigned int
82 lash_get_pending_config_count(lash_client_t *client);
84 /**
85 * Retrieve a config.
86 * The config must be freed using lash_config_destroy.
87 * Returns NULL if there are no configs pending.
89 lash_config_t *
90 lash_get_config(lash_client_t *client);
92 /**
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
96 * by the client.
98 void
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.
108 void
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.
122 void
123 lash_jack_client_name(lash_client_t *client,
124 const char *name);
127 * Tell the server the client's ALSA client ID.
129 void
130 lash_alsa_client_id(lash_client_t *client,
131 unsigned char id);
133 #ifdef __cplusplus
135 #endif
138 #endif /* __LASH_CLIENT_INTERFACE_H_ */