Add sample JSON configuration file
[staging/agl-audio-plugin.git] / socketif.c
1 /*
2  * module-agl-audio -- PulseAudio module for providing audio routing support
3  * (forked from "module-murphy-ivi" - https://github.com/otcshare )
4  * Copyright (c) 2012, Intel Corporation.
5  * Copyright (c) 2016, IoT.bzh
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU Lesser General Public License,
9  * version 2.1, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
19  * MA 02110-1301 USA.
20  *
21  */
22 #include "routerif.h"
23
24 struct agl_routerif {
25     int  sock;
26 };
27
28 agl_routerif *agl_routerif_init (struct userdata *u,
29                                  const char      *socktyp,
30                                  const char      *addr,
31                                  const char      *port)
32 {
33         pa_module *m = u->module;
34         agl_routerif *routerif = NULL;
35     
36         routerif = pa_xnew0 (agl_routerif, 1);
37         routerif->sock = -1;
38
39         return routerif;
40 }
41
42 void agl_routerif_done (struct userdata *u)
43 {
44         agl_routerif *routerif;
45
46         if (u && (routerif = u->routerif)) {
47                 if (routerif->sock >= 0)
48                         close (routerif->sock);
49
50                 pa_xfree (routerif);
51
52                 u->routerif = NULL;
53         }
54 }