]> code.delx.au - pulseaudio/blob - src/pulsecore/ioline.h
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / ioline.h
1 #ifndef fooiolinehfoo
2 #define fooiolinehfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2004-2006 Lennart Poettering
8
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2.1 of the License,
12 or (at your option) any later version.
13
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <pulse/gccmacro.h>
26
27 #include <pulsecore/iochannel.h>
28
29 /* An ioline wraps an iochannel for line based communication. A
30 * callback function is called whenever a new line has been received
31 * from the client */
32
33 typedef struct pa_ioline pa_ioline;
34
35 typedef void (*pa_ioline_cb_t)(pa_ioline*io, const char *s, void *userdata);
36 typedef void (*pa_ioline_drain_cb_t)(pa_ioline *io, void *userdata);
37
38 pa_ioline* pa_ioline_new(pa_iochannel *io);
39 void pa_ioline_unref(pa_ioline *l);
40 pa_ioline* pa_ioline_ref(pa_ioline *l);
41 void pa_ioline_close(pa_ioline *l);
42
43 /* Write a string to the channel */
44 void pa_ioline_puts(pa_ioline *s, const char *c);
45
46 /* Write a string to the channel */
47 void pa_ioline_printf(pa_ioline *s, const char *format, ...) PA_GCC_PRINTF_ATTR(2,3);
48
49 /* Set the callback function that is called for every received line */
50 void pa_ioline_set_callback(pa_ioline*io, pa_ioline_cb_t callback, void *userdata);
51
52 /* Set the callback function that is called when everything has been written */
53 void pa_ioline_set_drain_callback(pa_ioline*io, pa_ioline_drain_cb_t callback, void *userdata);
54
55 /* Make sure to close the ioline object as soon as the send buffer is emptied */
56 void pa_ioline_defer_close(pa_ioline *io);
57
58 /* Returns true when everything was written */
59 bool pa_ioline_is_drained(pa_ioline *io);
60
61 /* Detaches from the iochannel and returns it. Data that has already
62 * been read will not be available in the detached iochannel */
63 pa_iochannel* pa_ioline_detach_iochannel(pa_ioline *l);
64
65 #endif