source: roaraudio/include/libroar/libroar.h @ 6052:d48765b2475e

Last change on this file since 6052:d48765b2475e was 6052:d48765b2475e, checked in by phi, 9 years ago

updated copyright headers

File size: 7.8 KB
Line 
1//libroar.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
5 *
6 *  This file is part of libroar 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 *  libroar 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
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 *  NOTE for everyone want's to change something and send patches:
25 *  read README and HACKING! There a addition information on
26 *  the license of this document you need to read before you send
27 *  any patches.
28 *
29 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
30 *  or libpulse*:
31 *  The libs libroaresd, libroararts and libroarpulse link this lib
32 *  and are therefore GPL. Because of this it may be illigal to use
33 *  them with any software that uses libesd, libartsc or libpulse*.
34 */
35
36#ifndef _LIBROAR_H_
37#define _LIBROAR_H_
38
39//#define ROAR_DBG_PREFIX  "libroar"
40
41#include <roaraudio.h>
42
43// Parameter passing:
44
45#include <stdarg.h>
46
47// Process control:
48
49#ifdef ROAR_HAVE_WAIT
50#include <sys/wait.h>
51#endif
52
53// File handle control:
54
55#ifdef ROAR_HAVE_H_FCNTL
56#include <fcntl.h>
57#endif
58
59// Signal handling:
60
61#ifdef ROAR_HAVE_H_SIGNAL
62#include <signal.h>
63#endif
64
65// Logging:
66
67#ifdef ROAR_HAVE_SYSLOG
68#include <syslog.h>
69#endif
70
71// Network:
72
73#ifdef ROAR_TARGET_WIN32
74#include <winsock2.h>
75#elif defined(ROAR_HAVE_BSDSOCKETS)
76
77// <sys/socket.h> is included in <roaraudio.h> as it is required early.
78
79#ifdef ROAR_HAVE_IPV4
80#include <netinet/in_systm.h>
81#include <netinet/in.h>
82#include <netinet/ip.h>
83#include <netinet/tcp.h>
84#endif
85
86#if defined(ROAR_HAVE_IPV4) || defined(ROAR_HAVE_IPV6)
87#include <arpa/inet.h>
88#endif
89
90#include <sys/uio.h>
91
92#ifdef ROAR_HAVE_UNIX
93#include <sys/un.h>
94#endif
95
96#ifdef ROAR_HAVE_LIBDNET
97#include <netdnet/dn.h>
98#include <netdnet/dnetdb.h>
99#endif
100
101#ifdef ROAR_HAVE_IPX
102#include <netipx/ipx.h>
103#endif
104
105#endif /* ROAR_HAVE_BSDSOCKETS */
106
107#if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
108#include <netdb.h>
109#endif
110
111// OpenSLP (autoconf):
112
113#ifdef ROAR_HAVE_LIBSLP
114#include <slp.h>
115#ifdef ROAR_HAVE_H_SYS_TIME
116#include <sys/time.h>
117#endif
118#endif
119
120// Time related:
121
122#ifdef ROAR_HAVE_H_TIME
123#include <time.h>
124#endif
125
126// Dynamic loader:
127
128#if defined(ROAR_HAVE_H_DLFCN)
129#include <dlfcn.h>
130#endif
131
132// X11:
133
134#ifdef ROAR_HAVE_LIBX11
135#include <X11/Xlib.h>
136#include <X11/Xatom.h>
137#endif
138
139#include "roarfeatures.h"
140#include "error.h"
141#include "trap.h"
142#include "config.h"
143#include "roarfloat.h"
144#include "crc.h"
145#include "base64.h"
146#include "keyval.h"
147#include "uuid.h"
148#include "env.h"
149#include "roardl.h"
150#include "plugincontainer.h"
151#include "services.h"
152#include "debug.h"
153#include "memmgr.h"
154#include "stack.h"
155#include "buffer.h"
156#include "crypto.h"
157#include "random.h"
158#include "hash.h"
159#include "hash_tiger.h"
160#include "nnode.h"
161#include "vio_ctl.h"
162#include "vio.h"
163#include "vio_buffer.h"
164#include "vio_buffer_store.h"
165#include "vio_cmd.h"
166#include "vio_zlib.h"
167#include "vio_ops.h"
168#include "vio_string.h"
169#include "vio_magic.h"
170#include "vio_bio.h"
171#include "vio_stdio.h"
172#include "vio_stack.h"
173#include "vio_jumbo.h"
174#include "vio_pipe.h"
175#include "vio_socket.h"
176#include "vio_winsock.h"
177#include "vio_proto.h"
178#include "vio_proxy.h"
179#include "vio_rtp.h"
180#include "vio_select.h"
181// dstr needs to have access to all other VIOs, so it must be included last
182#include "vio_dstr.h"
183#include "vio_tantalos.h"
184#include "vio_stdvios.h"
185#include "vio_misc.h"
186#include "client.h"
187#include "basic.h"
188#include "serverinfo.h"
189#include "stream.h"
190#include "simple.h"
191#include "cdrom.h"
192#include "authfile.h"
193#include "auth.h"
194#include "socket.h"
195#include "ctl.h"
196#include "caps.h"
197#include "roartime.h"
198#include "meta.h"
199#include "file.h"
200#include "acl.h"
201#include "pinentry.h"
202#include "sshaskpass.h"
203#include "passwordapi.h"
204#include "roarslp.h"
205#include "display.h"
206#include "roarx11.h"
207#include "beep.h"
208#include "ltm.h"
209#include "vs.h"
210#include "enumdev.h"
211#include "notify.h"
212#include "notify_proxy.h"
213#include "asyncctl.h"
214#include "kstore.h"
215#include "watchdog.h"
216#include "scheduler.h"
217
218// some basic macros:
219#define ROAR_MAX2(a,b) ((a) > (b) ? (a) : (b))
220#define ROAR_MIN2(a,b) ((a) < (b) ? (a) : (b))
221
222#define ROAR_MAX3(a,b,c) ROAR_MAX2(ROAR_MAX2((a),(b)),(c))
223#define ROAR_MIN3(a,b,c) ROAR_MIN2(ROAR_MIN2((a),(b)),(c))
224
225#define ROAR_MAX4(a,b,c,d) ROAR_MAX2(ROAR_MAX2((a),(b)),ROAR_MAX2((c),(d)))
226#define ROAR_MIN4(a,b,c,d) ROAR_MIN2(ROAR_MIN2((a),(b)),ROAR_MIN2((c),(d)))
227
228#define ROAR_MAX ROAR_MAX2
229#define ROAR_MIN ROAR_MIN2
230
231#define ROAR_CKHAVEARGS(x) if ( (i + (x)) >= argc ) { \
232                            ROAR_ERR("Option %s requires more arguments. See --help for more details.", k); \
233                            return 70; \
234                            }
235
236int_least32_t roar_str2usec(const char * str);
237int roar_usleep(uint_least32_t t);
238int roar_sleep(int t);
239pid_t roar_fork(const struct roar_libroar_forkapi * api);
240
241// call this function after we fork/exec()ed or similar.
242enum roar_reset {
243 ROAR_RESET_UNKNOWN     = -1,
244#define ROAR_RESET_UNKNOWN ROAR_RESET_UNKNOWN
245 ROAR_RESET_NONE        =  0,
246#define ROAR_RESET_NONE ROAR_RESET_NONE
247 ROAR_RESET_ON_FORK     =  1,
248#define ROAR_RESET_ON_FORK ROAR_RESET_ON_FORK
249 ROAR_RESET_ON_EXIT     =  2,
250#define ROAR_RESET_ON_EXIT ROAR_RESET_ON_EXIT
251 ROAR_RESET_ON_PRE_EXEC =  3,
252#define ROAR_RESET_ON_PRE_EXEC ROAR_RESET_ON_PRE_EXEC
253 ROAR_RESET_MEMORY      =  0x81,
254#define ROAR_RESET_MEMORY ROAR_RESET_MEMORY
255 ROAR_RESET_CONFIG      =  0x82,
256#define ROAR_RESET_CONFIG ROAR_RESET_CONFIG
257 ROAR_RESET_RANDOMPOOL  =  0x84,
258#define ROAR_RESET_RANDOMPOOL ROAR_RESET_RANDOMPOOL
259 ROAR_RESET_EOL         = -2
260#define ROAR_RESET_EOL ROAR_RESET_EOL
261};
262int roar_reset(enum roar_reset what);
263
264// fatal probelms:
265enum roar_fatal_error {
266 ROAR_FATAL_ERROR_NONE = 0,          // ???
267 ROAR_FATAL_ERROR_UNKNOWN,           // Unknown error
268#define ROAR_FATAL_ERROR_UNKNOWN ROAR_FATAL_ERROR_UNKNOWN
269 ROAR_FATAL_ERROR_MEMORY_CORRUPTION, // some structure has been corrupted
270#define ROAR_FATAL_ERROR_MEMORY_CORRUPTION ROAR_FATAL_ERROR_MEMORY_CORRUPTION
271 ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD, // memory was corruppted but no data has been harmed (yet)
272#define ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD
273 ROAR_FATAL_ERROR_CPU_FAILURE,      // CPU general CPU failure
274#define ROAR_FATAL_ERROR_CPU_FAILURE ROAR_FATAL_ERROR_CPU_FAILURE
275 ROAR_FATAL_ERROR_CPU_FAILTURE = ROAR_FATAL_ERROR_CPU_FAILURE,
276 ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE,
277#define ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE
278 ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE,
279#define ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE
280 ROAR_FATAL_ERROR_WATCHDOG,
281#define ROAR_FATAL_ERROR_WATCHDOG ROAR_FATAL_ERROR_WATCHDOG
282
283 ROAR_FATAL_ERROR_EOL
284};
285
286#if __STDC_VERSION__ < 199901L
287#if __GNUC__ >= 2
288#define __roar_func__ __FUNCTION__
289#else
290#define __roar_func__ NULL
291#endif
292#else
293#define __roar_func__ __func__
294#endif
295
296#define roar_panic(err,info) roar_panic_real((err), (info), __LINE__, __FILE__, ROAR_DBG_PREFIX, __roar_func__)
297void roar_panic_real(enum roar_fatal_error error, const char * info,
298                     unsigned long int line, const char * file, const char * prefix, const char * func);
299
300// version stuff:
301const char * roar_version_string(void);
302uint32_t     roar_version_num(void);
303
304#endif
305
306//ll
Note: See TracBrowser for help on using the repository browser.