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