source: roaraudio/include/libroar/libroar.h @ 5951:b0e1eff45456

Last change on this file since 5951:b0e1eff45456 was 5951:b0e1eff45456, checked in by phi, 10 years ago

more header cleanup: cleanup of #includes

File size: 7.8 KB
Line 
1//libroar.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2013
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#ifdef ROAR_HAVE_H_SYS_SOCKET
78#include <sys/socket.h>
79#endif
80
81#ifdef ROAR_HAVE_IPV4
82#include <netinet/in_systm.h>
83#include <netinet/in.h>
84#include <netinet/ip.h>
85#include <netinet/tcp.h>
86#endif
87
88#if defined(ROAR_HAVE_IPV4) || defined(ROAR_HAVE_IPV6)
89#include <arpa/inet.h>
90#endif
91
92#include <sys/uio.h>
93
94#ifdef ROAR_HAVE_UNIX
95#include <sys/un.h>
96#endif
97
98#ifdef ROAR_HAVE_LIBDNET
99#include <netdnet/dn.h>
100#include <netdnet/dnetdb.h>
101#endif
102
103#ifdef ROAR_HAVE_IPX
104#include <netipx/ipx.h>
105#endif
106
107#endif /* ROAR_HAVE_BSDSOCKETS */
108
109#if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
110#include <netdb.h>
111#endif
112
113// OpenSSL (crypto):
114
115#ifdef ROAR_HAVE_LIBSSL
116#include <openssl/bio.h>
117#include <openssl/evp.h>
118#endif
119
120// OpenSLP (autoconf):
121
122#ifdef ROAR_HAVE_LIBSLP
123#include <slp.h>
124#ifdef ROAR_HAVE_H_SYS_TIME
125#include <sys/time.h>
126#endif
127#endif
128
129// Time related:
130
131#ifdef ROAR_HAVE_H_TIME
132#include <time.h>
133#endif
134
135// Dynamic loader:
136
137#if defined(ROAR_HAVE_H_DLFCN)
138#include <dlfcn.h>
139#endif
140
141// X11:
142
143#ifdef ROAR_HAVE_LIBX11
144#include <X11/Xlib.h>
145#include <X11/Xatom.h>
146#endif
147
148#include "roarfeatures.h"
149#include "error.h"
150#include "trap.h"
151#include "config.h"
152#include "roarfloat.h"
153#include "crc.h"
154#include "base64.h"
155#include "keyval.h"
156#include "uuid.h"
157#include "env.h"
158#include "roardl.h"
159#include "plugincontainer.h"
160#include "services.h"
161#include "debug.h"
162#include "memmgr.h"
163#include "stack.h"
164#include "buffer.h"
165#include "crypto.h"
166#include "random.h"
167#include "hash.h"
168#include "hash_tiger.h"
169#include "nnode.h"
170#include "vio_ctl.h"
171#include "vio.h"
172#include "vio_buffer.h"
173#include "vio_buffer_store.h"
174#include "vio_cmd.h"
175#include "vio_zlib.h"
176#include "vio_ops.h"
177#include "vio_string.h"
178#include "vio_magic.h"
179#include "vio_bio.h"
180#include "vio_stdio.h"
181#include "vio_stack.h"
182#include "vio_jumbo.h"
183#include "vio_pipe.h"
184#include "vio_socket.h"
185#include "vio_winsock.h"
186#include "vio_proto.h"
187#include "vio_proxy.h"
188#include "vio_rtp.h"
189#include "vio_select.h"
190// dstr needs to have access to all other VIOs, so it must be included last
191#include "vio_dstr.h"
192#include "vio_tantalos.h"
193#include "vio_stdvios.h"
194#include "vio_misc.h"
195#include "client.h"
196#include "basic.h"
197#include "serverinfo.h"
198#include "stream.h"
199#include "simple.h"
200#include "cdrom.h"
201#include "authfile.h"
202#include "auth.h"
203#include "socket.h"
204#include "ctl.h"
205#include "caps.h"
206#include "roartime.h"
207#include "meta.h"
208#include "file.h"
209#include "acl.h"
210#include "pinentry.h"
211#include "sshaskpass.h"
212#include "passwordapi.h"
213#include "roarslp.h"
214#include "display.h"
215#include "roarx11.h"
216#include "beep.h"
217#include "ltm.h"
218#include "vs.h"
219#include "enumdev.h"
220#include "notify.h"
221#include "notify_proxy.h"
222#include "asyncctl.h"
223#include "kstore.h"
224#include "watchdog.h"
225#include "scheduler.h"
226
227// some basic macros:
228#define ROAR_MAX2(a,b) ((a) > (b) ? (a) : (b))
229#define ROAR_MIN2(a,b) ((a) < (b) ? (a) : (b))
230
231#define ROAR_MAX3(a,b,c) ROAR_MAX2(ROAR_MAX2(a,b),c)
232#define ROAR_MIN3(a,b,c) ROAR_MIN2(ROAR_MIN2(a,b),c)
233
234#define ROAR_MAX4(a,b,c,d) ROAR_MAX2(ROAR_MAX2(a,b),ROAR_MAX2(c,d))
235#define ROAR_MIN4(a,b,c,d) ROAR_MIN2(ROAR_MIN2(a,b),ROAR_MIN2(c,d))
236
237#define ROAR_MAX ROAR_MAX2
238#define ROAR_MIN ROAR_MIN2
239
240#define ROAR_CKHAVEARGS(x) if ( (i + (x)) >= argc ) { \
241                            ROAR_ERR("Option %s requires more arguments. See --help for more details.", k); \
242                            return 70; \
243                            }
244
245int roar_usleep(uint_least32_t t);
246int roar_sleep(int t);
247pid_t roar_fork(const struct roar_libroar_forkapi * api);
248
249// call this function after we fork/exec()ed or similar.
250enum roar_reset {
251 ROAR_RESET_UNKNOWN     = -1,
252#define ROAR_RESET_UNKNOWN ROAR_RESET_UNKNOWN
253 ROAR_RESET_NONE        =  0,
254#define ROAR_RESET_NONE ROAR_RESET_NONE
255 ROAR_RESET_ON_FORK     =  1,
256#define ROAR_RESET_ON_FORK ROAR_RESET_ON_FORK
257 ROAR_RESET_ON_EXIT     =  2,
258#define ROAR_RESET_ON_EXIT ROAR_RESET_ON_EXIT
259 ROAR_RESET_ON_PRE_EXEC =  3,
260#define ROAR_RESET_ON_PRE_EXEC ROAR_RESET_ON_PRE_EXEC
261 ROAR_RESET_MEMORY      =  0x81,
262#define ROAR_RESET_MEMORY ROAR_RESET_MEMORY
263 ROAR_RESET_CONFIG      =  0x82,
264#define ROAR_RESET_CONFIG ROAR_RESET_CONFIG
265 ROAR_RESET_RANDOMPOOL  =  0x84,
266#define ROAR_RESET_RANDOMPOOL ROAR_RESET_RANDOMPOOL
267 ROAR_RESET_EOL         = -2
268#define ROAR_RESET_EOL ROAR_RESET_EOL
269};
270int roar_reset(enum roar_reset what);
271
272// fatal probelms:
273enum roar_fatal_error {
274 ROAR_FATAL_ERROR_NONE = 0,          // ???
275 ROAR_FATAL_ERROR_UNKNOWN,           // Unknown error
276#define ROAR_FATAL_ERROR_UNKNOWN ROAR_FATAL_ERROR_UNKNOWN
277 ROAR_FATAL_ERROR_MEMORY_CORRUPTION, // some structure has been corrupted
278#define ROAR_FATAL_ERROR_MEMORY_CORRUPTION ROAR_FATAL_ERROR_MEMORY_CORRUPTION
279 ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD, // memory was corruppted but no data has been harmed (yet)
280#define ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD
281 ROAR_FATAL_ERROR_CPU_FAILURE,      // CPU general CPU failure
282#define ROAR_FATAL_ERROR_CPU_FAILURE ROAR_FATAL_ERROR_CPU_FAILURE
283 ROAR_FATAL_ERROR_CPU_FAILTURE = ROAR_FATAL_ERROR_CPU_FAILURE,
284 ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE,
285#define ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE
286 ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE,
287#define ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE
288 ROAR_FATAL_ERROR_WATCHDOG,
289#define ROAR_FATAL_ERROR_WATCHDOG ROAR_FATAL_ERROR_WATCHDOG
290
291 ROAR_FATAL_ERROR_EOL
292};
293
294#if __STDC_VERSION__ < 199901L
295#if __GNUC__ >= 2
296#define __roar_func__ __FUNCTION__
297#else
298#define __roar_func__ NULL
299#endif
300#else
301#define __roar_func__ __func__
302#endif
303
304#define roar_panic(err,info) roar_panic_real((err), (info), __LINE__, __FILE__, ROAR_DBG_PREFIX, __roar_func__)
305void roar_panic_real(enum roar_fatal_error error, const char * info,
306                     unsigned long int line, const char * file, const char * prefix, const char * func);
307
308// version stuff:
309const char * roar_version_string(void);
310uint32_t     roar_version_num(void);
311
312#endif
313
314//ll
Note: See TracBrowser for help on using the repository browser.