1 | //libroar.h: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2011 |
---|
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 | #include <stdarg.h> |
---|
44 | |
---|
45 | #ifdef ROAR_HAVE_WAIT |
---|
46 | #include <sys/wait.h> |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifdef ROAR_HAVE_H_FCNTL |
---|
50 | #include <fcntl.h> |
---|
51 | #endif |
---|
52 | |
---|
53 | #ifdef ROAR_HAVE_H_SIGNAL |
---|
54 | #include <signal.h> |
---|
55 | #endif |
---|
56 | |
---|
57 | #ifdef ROAR_HAVE_SYSLOG |
---|
58 | #include <syslog.h> |
---|
59 | #endif |
---|
60 | |
---|
61 | #ifdef ROAR_HAVE_BSDSOCKETS |
---|
62 | |
---|
63 | #ifndef ROAR_TARGET_WIN32 |
---|
64 | #ifdef ROAR_HAVE_H_SYS_SOCKET |
---|
65 | #include <sys/socket.h> |
---|
66 | #endif |
---|
67 | #ifdef ROAR_HAVE_IPV4 |
---|
68 | #include <netinet/in_systm.h> |
---|
69 | #include <netinet/in.h> |
---|
70 | #include <netinet/ip.h> |
---|
71 | #endif |
---|
72 | #include <sys/uio.h> |
---|
73 | |
---|
74 | #ifdef ROAR_HAVE_UNIX |
---|
75 | #include <sys/un.h> |
---|
76 | #endif |
---|
77 | #endif |
---|
78 | |
---|
79 | #ifdef ROAR_HAVE_LIBDNET |
---|
80 | #include <netdnet/dn.h> |
---|
81 | #include <netdnet/dnetdb.h> |
---|
82 | #endif |
---|
83 | |
---|
84 | #ifdef ROAR_HAVE_IPX |
---|
85 | #include <netipx/ipx.h> |
---|
86 | #endif |
---|
87 | |
---|
88 | #endif /* ROAR_HAVE_BSDSOCKETS */ |
---|
89 | |
---|
90 | #ifdef ROAR_HAVE_LIBSSL |
---|
91 | #include <openssl/bio.h> |
---|
92 | #include <openssl/evp.h> |
---|
93 | #endif |
---|
94 | |
---|
95 | #ifdef ROAR_HAVE_LIBSLP |
---|
96 | #include <slp.h> |
---|
97 | #ifdef ROAR_HAVE_H_SYS_TIME |
---|
98 | #include <sys/time.h> |
---|
99 | #endif |
---|
100 | #endif |
---|
101 | |
---|
102 | #ifdef ROAR_HAVE_H_TIME |
---|
103 | #include <time.h> |
---|
104 | #endif |
---|
105 | |
---|
106 | #if defined(ROAR_HAVE_LIBDL) |
---|
107 | #include <dlfcn.h> |
---|
108 | #endif |
---|
109 | |
---|
110 | #ifdef ROAR_HAVE_LIBX11 |
---|
111 | #include <X11/Xlib.h> |
---|
112 | #include <X11/Xatom.h> |
---|
113 | #endif |
---|
114 | |
---|
115 | #include "roarfeatures.h" |
---|
116 | #include "error.h" |
---|
117 | #include "trap.h" |
---|
118 | #include "config.h" |
---|
119 | #include "roarfloat.h" |
---|
120 | #include "crc.h" |
---|
121 | #include "base64.h" |
---|
122 | #include "keyval.h" |
---|
123 | #include "env.h" |
---|
124 | #include "roardl.h" |
---|
125 | #include "debug.h" |
---|
126 | #include "memmgr.h" |
---|
127 | #include "stack.h" |
---|
128 | #include "buffer.h" |
---|
129 | #include "crypto.h" |
---|
130 | #include "random.h" |
---|
131 | #include "hash.h" |
---|
132 | #include "hash_tiger.h" |
---|
133 | #include "nnode.h" |
---|
134 | #include "vio_ctl.h" |
---|
135 | #include "vio.h" |
---|
136 | #include "vio_buffer.h" |
---|
137 | #include "vio_buffer_store.h" |
---|
138 | #include "vio_cmd.h" |
---|
139 | #include "vio_zlib.h" |
---|
140 | #include "vio_ops.h" |
---|
141 | #include "vio_string.h" |
---|
142 | #include "vio_magic.h" |
---|
143 | #include "vio_bio.h" |
---|
144 | #include "vio_stdio.h" |
---|
145 | #include "vio_stack.h" |
---|
146 | #include "vio_jumbo.h" |
---|
147 | #include "vio_pipe.h" |
---|
148 | #include "vio_socket.h" |
---|
149 | #include "vio_winsock.h" |
---|
150 | #include "vio_proto.h" |
---|
151 | #include "vio_rtp.h" |
---|
152 | #include "vio_select.h" |
---|
153 | // dstr needs to have access to all other VIOs, so it must be included last |
---|
154 | #include "vio_dstr.h" |
---|
155 | #include "vio_tantalos.h" |
---|
156 | #include "vio_stdvios.h" |
---|
157 | #include "vio_misc.h" |
---|
158 | #include "client.h" |
---|
159 | #include "basic.h" |
---|
160 | #include "serverinfo.h" |
---|
161 | #include "stream.h" |
---|
162 | #include "simple.h" |
---|
163 | #include "cdrom.h" |
---|
164 | #include "authfile.h" |
---|
165 | #include "auth.h" |
---|
166 | #include "socket.h" |
---|
167 | #include "ctl.h" |
---|
168 | #include "caps.h" |
---|
169 | #include "roartime.h" |
---|
170 | #include "meta.h" |
---|
171 | #include "file.h" |
---|
172 | #include "acl.h" |
---|
173 | #include "pinentry.h" |
---|
174 | #include "sshaskpass.h" |
---|
175 | #include "passwordapi.h" |
---|
176 | #include "roarslp.h" |
---|
177 | #include "display.h" |
---|
178 | #include "roarx11.h" |
---|
179 | #include "beep.h" |
---|
180 | #include "ltm.h" |
---|
181 | #include "vs.h" |
---|
182 | #include "enumdev.h" |
---|
183 | #include "notify.h" |
---|
184 | #include "notify_proxy.h" |
---|
185 | #include "asyncctl.h" |
---|
186 | |
---|
187 | // some basic macros: |
---|
188 | #define ROAR_MAX2(a,b) ((a) > (b) ? (a) : (b)) |
---|
189 | #define ROAR_MIN2(a,b) ((a) < (b) ? (a) : (b)) |
---|
190 | |
---|
191 | #define ROAR_MAX3(a,b,c) ROAR_MAX2(ROAR_MAX2(a,b),c) |
---|
192 | #define ROAR_MIN3(a,b,c) ROAR_MIN2(ROAR_MIN2(a,b),c) |
---|
193 | |
---|
194 | #define ROAR_MAX4(a,b,c,d) ROAR_MAX2(ROAR_MAX2(a,b),ROAR_MAX2(c,d)) |
---|
195 | #define ROAR_MIN4(a,b,c,d) ROAR_MIN2(ROAR_MIN2(a,b),ROAR_MIN2(c,d)) |
---|
196 | |
---|
197 | #define ROAR_MAX ROAR_MAX2 |
---|
198 | #define ROAR_MIN ROAR_MIN2 |
---|
199 | |
---|
200 | int roar_usleep(uint_least32_t t); |
---|
201 | int roar_sleep(int t); |
---|
202 | |
---|
203 | // call this function after we fork/exec()ed or similar. |
---|
204 | enum roar_reset { |
---|
205 | ROAR_RESET_UNKNOWN = -1, |
---|
206 | #define ROAR_RESET_UNKNOWN ROAR_RESET_UNKNOWN |
---|
207 | ROAR_RESET_NONE = 0, |
---|
208 | #define ROAR_RESET_NONE ROAR_RESET_NONE |
---|
209 | ROAR_RESET_ON_FORK = 1, |
---|
210 | #define ROAR_RESET_ON_FORK ROAR_RESET_ON_FORK |
---|
211 | ROAR_RESET_ON_EXIT = 2, |
---|
212 | #define ROAR_RESET_ON_EXIT ROAR_RESET_ON_EXIT |
---|
213 | ROAR_RESET_ON_PRE_EXEC = 3, |
---|
214 | #define ROAR_RESET_ON_PRE_EXEC ROAR_RESET_ON_PRE_EXEC |
---|
215 | ROAR_RESET_MEMORY = 0x81, |
---|
216 | #define ROAR_RESET_MEMORY ROAR_RESET_MEMORY |
---|
217 | ROAR_RESET_CONFIG = 0x82, |
---|
218 | #define ROAR_RESET_CONFIG ROAR_RESET_CONFIG |
---|
219 | ROAR_RESET_RANDOMPOOL = 0x84, |
---|
220 | #define ROAR_RESET_RANDOMPOOL ROAR_RESET_RANDOMPOOL |
---|
221 | ROAR_RESET_EOL = -2 |
---|
222 | #define ROAR_RESET_EOL ROAR_RESET_EOL |
---|
223 | }; |
---|
224 | int roar_reset(enum roar_reset what); |
---|
225 | |
---|
226 | // fatal probelms: |
---|
227 | enum roar_fatal_error { |
---|
228 | ROAR_FATAL_ERROR_NONE = 0, // ??? |
---|
229 | ROAR_FATAL_ERROR_UNKNOWN, // Unknown error |
---|
230 | #define ROAR_FATAL_ERROR_UNKNOWN ROAR_FATAL_ERROR_UNKNOWN |
---|
231 | ROAR_FATAL_ERROR_MEMORY_CORRUPTION, // some structure has been corrupted |
---|
232 | #define ROAR_FATAL_ERROR_MEMORY_CORRUPTION ROAR_FATAL_ERROR_MEMORY_CORRUPTION |
---|
233 | ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD, // memory was corruppted but no data has been harmed (yet) |
---|
234 | #define ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD |
---|
235 | ROAR_FATAL_ERROR_CPU_FAILURE, // CPU general CPU failure |
---|
236 | #define ROAR_FATAL_ERROR_CPU_FAILURE ROAR_FATAL_ERROR_CPU_FAILURE |
---|
237 | ROAR_FATAL_ERROR_CPU_FAILTURE = ROAR_FATAL_ERROR_CPU_FAILURE, |
---|
238 | ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE, |
---|
239 | #define ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE |
---|
240 | ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE, |
---|
241 | #define ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE |
---|
242 | |
---|
243 | ROAR_FATAL_ERROR_EOL |
---|
244 | }; |
---|
245 | |
---|
246 | #if __STDC_VERSION__ < 199901L |
---|
247 | #if __GNUC__ >= 2 |
---|
248 | #define __roar_func__ __FUNCTION__ |
---|
249 | #else |
---|
250 | #define __roar_func__ NULL |
---|
251 | #endif |
---|
252 | #else |
---|
253 | #define __roar_func__ __func__ |
---|
254 | #endif |
---|
255 | |
---|
256 | #define roar_panic(err,info) roar_panic_real((err), (info), __LINE__, __FILE__, ROAR_DBG_PREFIX, __roar_func__) |
---|
257 | void roar_panic_real(enum roar_fatal_error error, const char * info, |
---|
258 | unsigned long int line, const char * file, const char * prefix, const char * func); |
---|
259 | |
---|
260 | // version stuff: |
---|
261 | const char * roar_version_string(void); |
---|
262 | uint32_t roar_version_num(void); |
---|
263 | |
---|
264 | #endif |
---|
265 | |
---|
266 | //ll |
---|