]> code.delx.au - pulseaudio/blob - src/polypcore/ioline.h
84ccb47a6b197987494b5ea7b9947f2225acde6c
[pulseaudio] / src / polypcore / ioline.h
1 #ifndef fooiolinehfoo
2 #define fooiolinehfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of polypaudio.
8
9 polypaudio 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 of the License,
12 or (at your option) any later version.
13
14 polypaudio 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 polypaudio; 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 "iochannel.h"
26 #include "util.h"
27
28 /* An ioline wraps an iochannel for line based communication. A
29 * callback function is called whenever a new line has been recieved
30 * from the client */
31
32 typedef struct pa_ioline pa_ioline;
33
34 pa_ioline* pa_ioline_new(pa_iochannel *io);
35 void pa_ioline_unref(pa_ioline *l);
36 pa_ioline* pa_ioline_ref(pa_ioline *l);
37 void pa_ioline_close(pa_ioline *l);
38
39 /* Write a string to the channel */
40 void pa_ioline_puts(pa_ioline *s, const char *c);
41
42 /* Write a string to the channel */
43 void pa_ioline_printf(pa_ioline *s, const char *format, ...) PA_GCC_PRINTF_ATTR(2,3);
44
45 /* Set the callback function that is called for every recieved line */
46 void pa_ioline_set_callback(pa_ioline*io, void (*callback)(pa_ioline*io, const char *s, void *userdata), void *userdata);
47
48 /* Make sure to close the ioline object as soon as the send buffer is emptied */
49 void pa_ioline_defer_close(pa_ioline *io);
50
51 #endif