1#ifndef foostdinutilhfoo
2#define foostdinutilhfoo
3
4/***
5  This file is part of PulseAudio.
6
7  Copyright 2009 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
11  published by the Free Software Foundation; either version 2.1 of the
12  License, 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
20  License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
21***/
22
23#include <errno.h>
24#include <stdint.h>
25#include <sys/types.h>
26
27#include <pulsecore/module.h>
28#include <pulsecore/typedefs.h>
29
30#define MAX_MODULES 10
31#define BUF_MAX 2048
32
33struct userdata;
34
35struct module_item {
36    char *name;
37    char *args;
38    uint32_t index;
39};
40
41struct pa_module_info {
42    struct userdata *userdata;
43    char *name;
44
45    struct module_item items[MAX_MODULES];
46    unsigned n_items;
47};
48
49struct userdata {
50    pa_core *core;
51    pa_module *module;
52
53    pa_hashmap *module_infos;
54
55    pid_t pid;
56
57    int fd;
58    int fd_type;
59    pa_io_event *io_event;
60
61    char buf[BUF_MAX];
62    size_t buf_fill;
63};
64
65int fill_buf(struct userdata *u);
66int read_byte(struct userdata *u);
67char *read_string(struct userdata *u);
68void unload_one_module(struct pa_module_info *m, unsigned i);
69void unload_all_modules(struct pa_module_info *m);
70void load_module(
71  struct pa_module_info *m,
72  unsigned i,
73  const char *name,
74  const char *args,
75  bool is_new);
76void module_info_free(void *p);
77int handle_event(struct userdata *u);
78void io_event_cb(
79  pa_mainloop_api*a,
80  pa_io_event* e,
81  int fd,
82  pa_io_event_flags_t events,
83  void *userdata);
84
85#endif
86