blob: f30164ff9cc2c759384639910bfe116ae9e6eccd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#ifndef foomessagehelperhfoo
#define foomessagehelperhfoo
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
***/
#include <stddef.h>
#include <stdbool.h>
#include <inttypes.h>
#include <pulse/cdecl.h>
#include <pulse/version.h>
/** \file
* Utility functions for reading and writing message parameters */
PA_C_DECL_BEGIN
/** Structure which holds a parameter list. Wrapper for pa_strbuf \since 15.0 */
typedef struct pa_message_params pa_message_params;
/** @{ \name Read functions */
/** Read raw data from a parameter list. Used to split a message parameter
* string into list elements. The string returned in *result must not be freed. \since 15.0 */
int pa_message_params_read_raw(char *c, char **result, void **state);
/** Read a string from a parameter list. Escaped curly braces and backslashes
* will be unescaped. \since 15.0 */
int pa_message_params_read_string(char *c, const char **result, void **state);
/** @} */
/** @{ \name Write functions */
/** Create a new pa_message_params structure \since 15.0 */
pa_message_params *pa_message_params_new(void);
/** Free a pa_message_params structure. \since 15.0 */
void pa_message_params_free(pa_message_params *params);
/** Convert pa_message_params to string, free pa_message_params structure. \since 15.0 */
char *pa_message_params_to_string_free(pa_message_params *params);
/** Start a list by writing an opening brace. \since 15.0 */
void pa_message_params_begin_list(pa_message_params *params);
/** End a list by writing a closing brace. \since 15.0 */
void pa_message_params_end_list(pa_message_params *params);
/** Append string to parameter list. Curly braces and backslashes will be escaped. \since 15.0 */
void pa_message_params_write_string(pa_message_params *params, const char *value);
/** Append raw string to parameter list. Used to write incomplete strings
* or complete parameter lists (for example arrays). Adds curly braces around
* the string if add_braces is true. \since 15.0 */
void pa_message_params_write_raw(pa_message_params *params, const char *value, bool add_braces);
/** @} */
PA_C_DECL_END
#endif
|