153a5a1b3Sopenharmony_ci#ifndef foostdinutilhfoo
253a5a1b3Sopenharmony_ci#define foostdinutilhfoo
353a5a1b3Sopenharmony_ci
453a5a1b3Sopenharmony_ci/***
553a5a1b3Sopenharmony_ci  This file is part of PulseAudio.
653a5a1b3Sopenharmony_ci
753a5a1b3Sopenharmony_ci  Copyright 2009 Lennart Poettering
853a5a1b3Sopenharmony_ci
953a5a1b3Sopenharmony_ci  PulseAudio is free software; you can redistribute it and/or modify
1053a5a1b3Sopenharmony_ci  it under the terms of the GNU Lesser General Public License as
1153a5a1b3Sopenharmony_ci  published by the Free Software Foundation; either version 2.1 of the
1253a5a1b3Sopenharmony_ci  License, or (at your option) any later version.
1353a5a1b3Sopenharmony_ci
1453a5a1b3Sopenharmony_ci  PulseAudio is distributed in the hope that it will be useful, but
1553a5a1b3Sopenharmony_ci  WITHOUT ANY WARRANTY; without even the implied warranty of
1653a5a1b3Sopenharmony_ci  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1753a5a1b3Sopenharmony_ci  General Public License for more details.
1853a5a1b3Sopenharmony_ci
1953a5a1b3Sopenharmony_ci  You should have received a copy of the GNU Lesser General Public
2053a5a1b3Sopenharmony_ci  License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
2153a5a1b3Sopenharmony_ci***/
2253a5a1b3Sopenharmony_ci
2353a5a1b3Sopenharmony_ci#include <errno.h>
2453a5a1b3Sopenharmony_ci#include <stdint.h>
2553a5a1b3Sopenharmony_ci#include <sys/types.h>
2653a5a1b3Sopenharmony_ci
2753a5a1b3Sopenharmony_ci#include <pulsecore/module.h>
2853a5a1b3Sopenharmony_ci#include <pulsecore/typedefs.h>
2953a5a1b3Sopenharmony_ci
3053a5a1b3Sopenharmony_ci#define MAX_MODULES 10
3153a5a1b3Sopenharmony_ci#define BUF_MAX 2048
3253a5a1b3Sopenharmony_ci
3353a5a1b3Sopenharmony_cistruct userdata;
3453a5a1b3Sopenharmony_ci
3553a5a1b3Sopenharmony_cistruct module_item {
3653a5a1b3Sopenharmony_ci    char *name;
3753a5a1b3Sopenharmony_ci    char *args;
3853a5a1b3Sopenharmony_ci    uint32_t index;
3953a5a1b3Sopenharmony_ci};
4053a5a1b3Sopenharmony_ci
4153a5a1b3Sopenharmony_cistruct pa_module_info {
4253a5a1b3Sopenharmony_ci    struct userdata *userdata;
4353a5a1b3Sopenharmony_ci    char *name;
4453a5a1b3Sopenharmony_ci
4553a5a1b3Sopenharmony_ci    struct module_item items[MAX_MODULES];
4653a5a1b3Sopenharmony_ci    unsigned n_items;
4753a5a1b3Sopenharmony_ci};
4853a5a1b3Sopenharmony_ci
4953a5a1b3Sopenharmony_cistruct userdata {
5053a5a1b3Sopenharmony_ci    pa_core *core;
5153a5a1b3Sopenharmony_ci    pa_module *module;
5253a5a1b3Sopenharmony_ci
5353a5a1b3Sopenharmony_ci    pa_hashmap *module_infos;
5453a5a1b3Sopenharmony_ci
5553a5a1b3Sopenharmony_ci    pid_t pid;
5653a5a1b3Sopenharmony_ci
5753a5a1b3Sopenharmony_ci    int fd;
5853a5a1b3Sopenharmony_ci    int fd_type;
5953a5a1b3Sopenharmony_ci    pa_io_event *io_event;
6053a5a1b3Sopenharmony_ci
6153a5a1b3Sopenharmony_ci    char buf[BUF_MAX];
6253a5a1b3Sopenharmony_ci    size_t buf_fill;
6353a5a1b3Sopenharmony_ci};
6453a5a1b3Sopenharmony_ci
6553a5a1b3Sopenharmony_ciint fill_buf(struct userdata *u);
6653a5a1b3Sopenharmony_ciint read_byte(struct userdata *u);
6753a5a1b3Sopenharmony_cichar *read_string(struct userdata *u);
6853a5a1b3Sopenharmony_civoid unload_one_module(struct pa_module_info *m, unsigned i);
6953a5a1b3Sopenharmony_civoid unload_all_modules(struct pa_module_info *m);
7053a5a1b3Sopenharmony_civoid load_module(
7153a5a1b3Sopenharmony_ci  struct pa_module_info *m,
7253a5a1b3Sopenharmony_ci  unsigned i,
7353a5a1b3Sopenharmony_ci  const char *name,
7453a5a1b3Sopenharmony_ci  const char *args,
7553a5a1b3Sopenharmony_ci  bool is_new);
7653a5a1b3Sopenharmony_civoid module_info_free(void *p);
7753a5a1b3Sopenharmony_ciint handle_event(struct userdata *u);
7853a5a1b3Sopenharmony_civoid io_event_cb(
7953a5a1b3Sopenharmony_ci  pa_mainloop_api*a,
8053a5a1b3Sopenharmony_ci  pa_io_event* e,
8153a5a1b3Sopenharmony_ci  int fd,
8253a5a1b3Sopenharmony_ci  pa_io_event_flags_t events,
8353a5a1b3Sopenharmony_ci  void *userdata);
8453a5a1b3Sopenharmony_ci
8553a5a1b3Sopenharmony_ci#endif
86