3 * \brief Application interface library for the ALSA driver
4 * \author Jaroslav Kysela <perex@suse.cz>
5 * \author Abramo Bagnara <abramo@alsa-project.org>
6 * \author Takashi Iwai <tiwai@suse.de>
9 * Application interface library for the ALSA driver
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 * \defgroup Config Configuration Interface
37 * Configuration Interface
41 /** dlsym version for config evaluate callback */
42 #define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
43 /** dlsym version for config hook callback */
44 #define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
46 /** Config node type */
47 typedef enum _snd_config_type {
49 SND_CONFIG_TYPE_INTEGER,
50 /** 64 bit Integer number */
51 SND_CONFIG_TYPE_INTEGER64,
54 /** Character string */
55 SND_CONFIG_TYPE_STRING,
56 /** Pointer - runtime only - cannot be saved */
57 SND_CONFIG_TYPE_POINTER,
59 SND_CONFIG_TYPE_COMPOUND = 1024
62 /** Config node handle */
63 typedef struct _snd_config snd_config_t;
64 /** Config compound iterator */
65 typedef struct _snd_config_iterator *snd_config_iterator_t;
66 /** Config private update structure */
67 typedef struct _snd_config_update snd_config_update_t;
69 extern snd_config_t *snd_config;
71 int snd_config_top(snd_config_t **config);
73 int snd_config_load(snd_config_t *config, snd_input_t *in);
74 int snd_config_load_override(snd_config_t *config, snd_input_t *in);
75 int snd_config_save(snd_config_t *config, snd_output_t *out);
76 int snd_config_update(void);
77 int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
78 int snd_config_update_free(snd_config_update_t *update);
79 int snd_config_update_free_global(void);
81 int snd_config_search(snd_config_t *config, const char *key,
82 snd_config_t **result);
83 int snd_config_searchv(snd_config_t *config,
84 snd_config_t **result, ...);
85 int snd_config_search_definition(snd_config_t *config,
86 const char *base, const char *key,
87 snd_config_t **result);
89 int snd_config_expand(snd_config_t *config, snd_config_t *root,
90 const char *args, snd_config_t *private_data,
91 snd_config_t **result);
92 int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
93 snd_config_t *private_data, snd_config_t **result);
95 int snd_config_add(snd_config_t *config, snd_config_t *leaf);
96 int snd_config_delete(snd_config_t *config);
97 int snd_config_delete_compound_members(const snd_config_t *config);
98 int snd_config_copy(snd_config_t **dst, snd_config_t *src);
100 int snd_config_make(snd_config_t **config, const char *key,
101 snd_config_type_t type);
102 int snd_config_make_integer(snd_config_t **config, const char *key);
103 int snd_config_make_integer64(snd_config_t **config, const char *key);
104 int snd_config_make_real(snd_config_t **config, const char *key);
105 int snd_config_make_string(snd_config_t **config, const char *key);
106 int snd_config_make_pointer(snd_config_t **config, const char *key);
107 int snd_config_make_compound(snd_config_t **config, const char *key, int join);
109 int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
110 int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
111 int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
112 int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
113 int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
115 snd_config_type_t snd_config_get_type(const snd_config_t *config);
117 int snd_config_set_id(snd_config_t *config, const char *id);
118 int snd_config_set_integer(snd_config_t *config, long value);
119 int snd_config_set_integer64(snd_config_t *config, long long value);
120 int snd_config_set_real(snd_config_t *config, double value);
121 int snd_config_set_string(snd_config_t *config, const char *value);
122 int snd_config_set_ascii(snd_config_t *config, const char *ascii);
123 int snd_config_set_pointer(snd_config_t *config, const void *ptr);
124 int snd_config_get_id(const snd_config_t *config, const char **value);
125 int snd_config_get_integer(const snd_config_t *config, long *value);
126 int snd_config_get_integer64(const snd_config_t *config, long long *value);
127 int snd_config_get_real(const snd_config_t *config, double *value);
128 int snd_config_get_ireal(const snd_config_t *config, double *value);
129 int snd_config_get_string(const snd_config_t *config, const char **value);
130 int snd_config_get_ascii(const snd_config_t *config, char **value);
131 int snd_config_get_pointer(const snd_config_t *config, const void **value);
132 int snd_config_test_id(const snd_config_t *config, const char *id);
134 snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
135 snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
136 snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
137 snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
139 /** Helper for compound config node leaves traversal
140 * \param pos Current node iterator
141 * \param next Next node iterator
142 * \param node Compound config node
144 * This macro is designed to permit the removal of current node.
146 #define snd_config_for_each(pos, next, node) \
147 for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
151 int snd_config_get_bool_ascii(const char *ascii);
152 int snd_config_get_bool(const snd_config_t *conf);
153 int snd_config_get_ctl_iface_ascii(const char *ascii);
154 int snd_config_get_ctl_iface(const snd_config_t *conf);
162 #endif /* __ALSA_CONF_H */