source: roaraudio/roard/include/roard.h @ 4678:8480af30c884

Last change on this file since 4678:8480af30c884 was 4678:8480af30c884, checked in by phi, 13 years ago

convert select(){} into array looked up with for(){} for protocol in client check rutine

File size: 5.1 KB
RevLine 
[0]1//roard.h:
2
[668]3/*
[3812]4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2010
[668]5 *
6 *  This file is part of roard a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
[3517]21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
[668]23 *
24 */
25
[0]26#ifndef _ROARD_H_
27#define _ROARD_H_
28
[2970]29// configure ROAR_INFO()
30int g_verbose;
31#define ROAR_DBG_INFOVAR g_verbose
32
[4299]33// configure ROAR_*()
34#define ROAR_DBG_PREFIX "roard"
35
[1482]36// need to include this first as we need the config
37#include <roaraudio.h>
[3207]38#include <roaraudio/units.h>
[1964]39#include <libroarlight/libroarlight.h>
[2283]40#include <libroareio/libroareio.h>
[1482]41
[2726]42#include <ctype.h>
[1482]43
[3056]44#ifdef ROAR_HAVE_H_SIGNAL
[0]45#include <signal.h>
[1482]46#endif
47
[1537]48#if defined(ROAR_HAVE_SELECT) && defined(ROAR_HAVE_H_SYS_SELECT)
[0]49#include <sys/select.h>
[1482]50#endif
51
52#ifdef ROAR_HAVE_WAIT
[248]53#include <sys/wait.h>
[1482]54#endif
55
56#if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
[444]57#include <pwd.h>
[1482]58#endif
59
[3202]60#ifdef ROAR_HAVE_H_SYS_TIME
[1198]61#include <sys/time.h>
[3202]62#endif
63#ifdef ROAR_HAVE_H_TIME
[1198]64#include <time.h>
[1482]65#endif
[242]66
[1993]67#ifdef ROAR_HAVE_LIBSLP
68#include <slp.h>
69#endif
70
[243]71/*
[242]72#ifdef __linux__
[243]73#include <linux/unistd.h>
[242]74#include <linux/ioprio.h>
75#endif
[243]76*/
[242]77
[1917]78#define ROAR_SUBSYS_NONE          0x00
79#define ROAR_SUBSYS_WAVEFORM      0x01
80#define ROAR_SUBSYS_MIDI          0x02
81#define ROAR_SUBSYS_CB            0x04
82#define ROAR_SUBSYS_LIGHT         0x08
[2232]83#define ROAR_SUBSYS_RAW           0x10
[2681]84#define ROAR_SUBSYS_COMPLEX       0x20
[2838]85#define ROAR_SUBSYS_RDTCS         0x40
[1917]86
[2530]87// listeing code:
88#define ROAR_MAX_LISTEN_SOCKETS  8
89
[3977]90union uniinst {
91 void * vp;
92 int    si;
93};
94
[3763]95// MFOI = Marked For Optional Include
96
[0]97//#include "buffer.h"
[4504]98#include "caps.h"
[4231]99#include "memlock.h"
[3763]100#include "codecfilter.h" /* MFOI */
101#include "container_framework.h" /* MFOI */
[0]102#include "client.h"
[4469]103#include "auth.h"
[3763]104#include "driver.h" /* MFOI */
[0]105#include "output.h"
106#include "mixer.h"
107//#include "convert.h"
108#include "streams.h"
109#include "network.h"
110#include "commands.h"
111#include "req.h"
[3763]112#include "emul_esd.h" /* MFOI */
113#include "emul_simple.h" /* MFOI */
114#include "emul_rsound.h" /* MFOI */
[3968]115#include "emul_rplay.h" /* MFOI */
[0]116#include "sources.h"
[40]117#include "sample.h"
[4359]118#include "hwmixer.h"
[89]119#include "meta.h"
[244]120#include "midi.h"
[2446]121#include "ssynth.h"
[1816]122#include "light.h"
[2236]123#include "raw.h"
[2717]124#include "rdtcs.h"
[2945]125#include "waveform.h"
[3572]126#include "beep.h"
[245]127#include "lib.h"
[3353]128#include "plugins.h"
[0]129
[242]130
[0]131int alive;
[1494]132#ifdef ROAR_SUPPORT_LISTEN
[1155]133int g_no_listen;
[1494]134#endif
[0]135
[246]136uint32_t g_pos; // current possition in output stream
137
[0]138int g_standby;
[920]139int g_autostandby;
[0]140
[3730]141#ifdef ROAR_SUPPORT_LISTEN
142struct roard_listen;
143#endif
144
[905]145int main_loop (int driver, DRIVER_USERDATA_T driver_inst, struct roar_audio_info * sa, int sysclocksync);
[574]146void cleanup_listen_socket (int terminate);
[0]147void clean_quit (void);
148void clean_quit_prep (void);
149
[3800]150void on_sig_int  (int signum);
[2732]151void on_sig_term (int signum);
[248]152void on_sig_chld (int signum);
[2112]153void on_sig_usr1 (int signum);
[0]154
[1494]155#ifdef ROAR_SUPPORT_LISTEN
[3731]156int get_listen(struct roard_listen ** sock, char *** sockname);
[4678]157int add_listen (char * addr, int port, int sock_type, char * user, char * group, int proto, int dir, struct roar_audio_info * info);
[3730]158#endif
159
160#ifdef ROAR_SUPPORT_LISTEN
[3253]161struct roard_listen {
[3802]162 int used;
163 struct roar_vio_calls sock;
[3128]164 int proto;
165 union {
166  void * vp;
167  int    si;
168  struct {
169   int                    dir;
170   struct roar_audio_info info;
171  } stpl;
172 } inst;
173} g_listen[ROAR_MAX_LISTEN_SOCKETS];
[1494]174#endif
[0]175
[37]176int g_self_client;
177
[71]178int g_terminate;
179
[1609]180struct roar_audio_info * g_sa, * g_max_sa;
181
[4442]182#define CONF_DEF_STRING "***default***"
183
[1609]184struct roard_config {
185 uint32_t flags;
186 struct {
187  uint32_t flags;
188  struct roar_mixer_settings mixer;
189  int                        mixer_channels;
190 } streams[ROAR_DIR_DIRIDS];
[2017]191 char * location;
[4421]192 char * description;
[3039]193 size_t jumbo_mtu;
[4245]194 int memlock_level;
[1609]195} * g_config;
[0]196
[4101]197struct _counters {
198 size_t clients, streams,
199        samples,
200        sources, outputs,
201        mixers, bridges,
202        listens;
203};
204
205struct {
206 struct _counters cur, sum;
207} g_counters;
208
209
210#define counters_init() memset(&g_counters, 0, sizeof(g_counters))
211//#define counters_inc(c,i) do { signed long int __i = (i); if ( __i < 0 && __i > (g_counters.cur.c) ) { ROAR_WARN("counters_inc(c=%s, i=%li): Decrement request bigger than current counter value. Counter out of syn!", )  } while (0)
212#define counters_inc(c,i) do { signed long int __i = (i); g_counters.cur.c += __i; if ( __i > 0 ) g_counters.sum.c += __i; } while (0)
213
214#define counters_get(g,c) ((g_counters.g.c))
215
216void counters_print(int type, int force);
217
[0]218#endif
219
220//ll
Note: See TracBrowser for help on using the repository browser.