[0] | 1 | //libroar.h: |
---|
| 2 | |
---|
[690] | 3 | /* |
---|
[5381] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012 |
---|
[690] | 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 |
---|
[3517] | 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
[690] | 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 | |
---|
[0] | 36 | #ifndef _LIBROAR_H_ |
---|
| 37 | #define _LIBROAR_H_ |
---|
| 38 | |
---|
[4299] | 39 | //#define ROAR_DBG_PREFIX "libroar" |
---|
[0] | 40 | |
---|
[474] | 41 | #include <roaraudio.h> |
---|
| 42 | |
---|
[1351] | 43 | #include <stdarg.h> |
---|
| 44 | |
---|
[1386] | 45 | #ifdef ROAR_HAVE_WAIT |
---|
[1254] | 46 | #include <sys/wait.h> |
---|
[1386] | 47 | #endif |
---|
[1254] | 48 | |
---|
[1425] | 49 | #ifdef ROAR_HAVE_H_FCNTL |
---|
[0] | 50 | #include <fcntl.h> |
---|
[1425] | 51 | #endif |
---|
[1374] | 52 | |
---|
[3056] | 53 | #ifdef ROAR_HAVE_H_SIGNAL |
---|
[1418] | 54 | #include <signal.h> |
---|
| 55 | #endif |
---|
| 56 | |
---|
[3611] | 57 | #ifdef ROAR_HAVE_SYSLOG |
---|
| 58 | #include <syslog.h> |
---|
| 59 | #endif |
---|
| 60 | |
---|
[1374] | 61 | #ifdef ROAR_HAVE_BSDSOCKETS |
---|
| 62 | |
---|
[1075] | 63 | #ifndef ROAR_TARGET_WIN32 |
---|
[4554] | 64 | #ifdef ROAR_HAVE_H_SYS_SOCKET |
---|
[322] | 65 | #include <sys/socket.h> |
---|
[4554] | 66 | #endif |
---|
[1374] | 67 | #ifdef ROAR_HAVE_IPV4 |
---|
[726] | 68 | #include <netinet/in_systm.h> |
---|
[322] | 69 | #include <netinet/in.h> |
---|
| 70 | #include <netinet/ip.h> |
---|
[1374] | 71 | #endif |
---|
[902] | 72 | #include <sys/uio.h> |
---|
[3805] | 73 | |
---|
| 74 | #ifdef ROAR_HAVE_UNIX |
---|
| 75 | #include <sys/un.h> |
---|
[1075] | 76 | #endif |
---|
[3805] | 77 | #endif |
---|
| 78 | |
---|
[501] | 79 | #ifdef ROAR_HAVE_LIBDNET |
---|
| 80 | #include <netdnet/dn.h> |
---|
| 81 | #include <netdnet/dnetdb.h> |
---|
| 82 | #endif |
---|
[3805] | 83 | |
---|
[529] | 84 | #ifdef ROAR_HAVE_IPX |
---|
[528] | 85 | #include <netipx/ipx.h> |
---|
| 86 | #endif |
---|
[0] | 87 | |
---|
[1374] | 88 | #endif /* ROAR_HAVE_BSDSOCKETS */ |
---|
| 89 | |
---|
[1322] | 90 | #ifdef ROAR_HAVE_LIBSSL |
---|
| 91 | #include <openssl/bio.h> |
---|
| 92 | #include <openssl/evp.h> |
---|
| 93 | #endif |
---|
| 94 | |
---|
[1996] | 95 | #ifdef ROAR_HAVE_LIBSLP |
---|
| 96 | #include <slp.h> |
---|
[3203] | 97 | #ifdef ROAR_HAVE_H_SYS_TIME |
---|
| 98 | #include <sys/time.h> |
---|
| 99 | #endif |
---|
[4943] | 100 | #endif |
---|
| 101 | |
---|
[3203] | 102 | #ifdef ROAR_HAVE_H_TIME |
---|
| 103 | #include <time.h> |
---|
| 104 | #endif |
---|
[1996] | 105 | |
---|
[5517] | 106 | #if defined(ROAR_HAVE_H_DLFCN) |
---|
[3297] | 107 | #include <dlfcn.h> |
---|
| 108 | #endif |
---|
| 109 | |
---|
[3371] | 110 | #ifdef ROAR_HAVE_LIBX11 |
---|
| 111 | #include <X11/Xlib.h> |
---|
| 112 | #include <X11/Xatom.h> |
---|
| 113 | #endif |
---|
| 114 | |
---|
[4597] | 115 | #include "roarfeatures.h" |
---|
[797] | 116 | #include "error.h" |
---|
[4779] | 117 | #include "trap.h" |
---|
[2477] | 118 | #include "config.h" |
---|
[4524] | 119 | #include "roarfloat.h" |
---|
[4585] | 120 | #include "crc.h" |
---|
[4586] | 121 | #include "base64.h" |
---|
[3376] | 122 | #include "keyval.h" |
---|
[5505] | 123 | #include "uuid.h" |
---|
[3958] | 124 | #include "env.h" |
---|
[3297] | 125 | #include "roardl.h" |
---|
[5317] | 126 | #include "plugincontainer.h" |
---|
[2648] | 127 | #include "debug.h" |
---|
[2976] | 128 | #include "memmgr.h" |
---|
[1280] | 129 | #include "stack.h" |
---|
[1297] | 130 | #include "buffer.h" |
---|
[4454] | 131 | #include "crypto.h" |
---|
[4446] | 132 | #include "random.h" |
---|
| 133 | #include "hash.h" |
---|
[4457] | 134 | #include "hash_tiger.h" |
---|
[2812] | 135 | #include "nnode.h" |
---|
[2058] | 136 | #include "vio_ctl.h" |
---|
[588] | 137 | #include "vio.h" |
---|
[3969] | 138 | #include "vio_buffer.h" |
---|
[3994] | 139 | #include "vio_buffer_store.h" |
---|
[1255] | 140 | #include "vio_cmd.h" |
---|
[4956] | 141 | #include "vio_zlib.h" |
---|
[1274] | 142 | #include "vio_ops.h" |
---|
[2060] | 143 | #include "vio_string.h" |
---|
[1274] | 144 | #include "vio_magic.h" |
---|
[1347] | 145 | #include "vio_bio.h" |
---|
[2059] | 146 | #include "vio_stdio.h" |
---|
[1347] | 147 | #include "vio_stack.h" |
---|
[2981] | 148 | #include "vio_jumbo.h" |
---|
[1300] | 149 | #include "vio_pipe.h" |
---|
[1331] | 150 | #include "vio_socket.h" |
---|
[3315] | 151 | #include "vio_winsock.h" |
---|
[1347] | 152 | #include "vio_proto.h" |
---|
[5367] | 153 | #include "vio_proxy.h" |
---|
[3272] | 154 | #include "vio_rtp.h" |
---|
[1506] | 155 | #include "vio_select.h" |
---|
[1326] | 156 | // dstr needs to have access to all other VIOs, so it must be included last |
---|
[1321] | 157 | #include "vio_dstr.h" |
---|
[3109] | 158 | #include "vio_tantalos.h" |
---|
[4533] | 159 | #include "vio_stdvios.h" |
---|
[4824] | 160 | #include "vio_misc.h" |
---|
[2812] | 161 | #include "client.h" |
---|
[0] | 162 | #include "basic.h" |
---|
[4426] | 163 | #include "serverinfo.h" |
---|
[0] | 164 | #include "stream.h" |
---|
| 165 | #include "simple.h" |
---|
[808] | 166 | #include "cdrom.h" |
---|
[4483] | 167 | #include "authfile.h" |
---|
[0] | 168 | #include "auth.h" |
---|
| 169 | #include "socket.h" |
---|
| 170 | #include "ctl.h" |
---|
[4497] | 171 | #include "caps.h" |
---|
[5031] | 172 | #include "roartime.h" |
---|
[94] | 173 | #include "meta.h" |
---|
[320] | 174 | #include "file.h" |
---|
[347] | 175 | #include "acl.h" |
---|
[1232] | 176 | #include "pinentry.h" |
---|
[1288] | 177 | #include "sshaskpass.h" |
---|
[4462] | 178 | #include "passwordapi.h" |
---|
[2000] | 179 | #include "roarslp.h" |
---|
[3632] | 180 | #include "display.h" |
---|
[3370] | 181 | #include "roarx11.h" |
---|
[3567] | 182 | #include "beep.h" |
---|
[4263] | 183 | #include "ltm.h" |
---|
[4172] | 184 | #include "vs.h" |
---|
[4300] | 185 | #include "enumdev.h" |
---|
[4302] | 186 | #include "notify.h" |
---|
[4314] | 187 | #include "notify_proxy.h" |
---|
[4341] | 188 | #include "asyncctl.h" |
---|
[5443] | 189 | #include "kstore.h" |
---|
[5619] | 190 | #include "watchdog.h" |
---|
[5692] | 191 | #include "scheduler.h" |
---|
[0] | 192 | |
---|
[2067] | 193 | // some basic macros: |
---|
| 194 | #define ROAR_MAX2(a,b) ((a) > (b) ? (a) : (b)) |
---|
| 195 | #define ROAR_MIN2(a,b) ((a) < (b) ? (a) : (b)) |
---|
| 196 | |
---|
| 197 | #define ROAR_MAX3(a,b,c) ROAR_MAX2(ROAR_MAX2(a,b),c) |
---|
| 198 | #define ROAR_MIN3(a,b,c) ROAR_MIN2(ROAR_MIN2(a,b),c) |
---|
| 199 | |
---|
| 200 | #define ROAR_MAX4(a,b,c,d) ROAR_MAX2(ROAR_MAX2(a,b),ROAR_MAX2(c,d)) |
---|
| 201 | #define ROAR_MIN4(a,b,c,d) ROAR_MIN2(ROAR_MIN2(a,b),ROAR_MIN2(c,d)) |
---|
| 202 | |
---|
| 203 | #define ROAR_MAX ROAR_MAX2 |
---|
| 204 | #define ROAR_MIN ROAR_MIN2 |
---|
| 205 | |
---|
[4913] | 206 | int roar_usleep(uint_least32_t t); |
---|
| 207 | int roar_sleep(int t); |
---|
[5373] | 208 | pid_t roar_fork(const struct roar_libroar_forkapi * api); |
---|
[4896] | 209 | |
---|
[4965] | 210 | // call this function after we fork/exec()ed or similar. |
---|
[5010] | 211 | enum roar_reset { |
---|
| 212 | ROAR_RESET_UNKNOWN = -1, |
---|
| 213 | #define ROAR_RESET_UNKNOWN ROAR_RESET_UNKNOWN |
---|
| 214 | ROAR_RESET_NONE = 0, |
---|
| 215 | #define ROAR_RESET_NONE ROAR_RESET_NONE |
---|
| 216 | ROAR_RESET_ON_FORK = 1, |
---|
| 217 | #define ROAR_RESET_ON_FORK ROAR_RESET_ON_FORK |
---|
| 218 | ROAR_RESET_ON_EXIT = 2, |
---|
| 219 | #define ROAR_RESET_ON_EXIT ROAR_RESET_ON_EXIT |
---|
| 220 | ROAR_RESET_ON_PRE_EXEC = 3, |
---|
| 221 | #define ROAR_RESET_ON_PRE_EXEC ROAR_RESET_ON_PRE_EXEC |
---|
| 222 | ROAR_RESET_MEMORY = 0x81, |
---|
| 223 | #define ROAR_RESET_MEMORY ROAR_RESET_MEMORY |
---|
| 224 | ROAR_RESET_CONFIG = 0x82, |
---|
| 225 | #define ROAR_RESET_CONFIG ROAR_RESET_CONFIG |
---|
| 226 | ROAR_RESET_RANDOMPOOL = 0x84, |
---|
| 227 | #define ROAR_RESET_RANDOMPOOL ROAR_RESET_RANDOMPOOL |
---|
| 228 | ROAR_RESET_EOL = -2 |
---|
| 229 | #define ROAR_RESET_EOL ROAR_RESET_EOL |
---|
| 230 | }; |
---|
| 231 | int roar_reset(enum roar_reset what); |
---|
[4965] | 232 | |
---|
[4970] | 233 | // fatal probelms: |
---|
| 234 | enum roar_fatal_error { |
---|
| 235 | ROAR_FATAL_ERROR_NONE = 0, // ??? |
---|
| 236 | ROAR_FATAL_ERROR_UNKNOWN, // Unknown error |
---|
[4998] | 237 | #define ROAR_FATAL_ERROR_UNKNOWN ROAR_FATAL_ERROR_UNKNOWN |
---|
[4970] | 238 | ROAR_FATAL_ERROR_MEMORY_CORRUPTION, // some structure has been corrupted |
---|
[4998] | 239 | #define ROAR_FATAL_ERROR_MEMORY_CORRUPTION ROAR_FATAL_ERROR_MEMORY_CORRUPTION |
---|
[4970] | 240 | ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD, // memory was corruppted but no data has been harmed (yet) |
---|
[4998] | 241 | #define ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD ROAR_FATAL_ERROR_MEMORY_CORRUPTION_GUARD |
---|
| 242 | ROAR_FATAL_ERROR_CPU_FAILURE, // CPU general CPU failure |
---|
| 243 | #define ROAR_FATAL_ERROR_CPU_FAILURE ROAR_FATAL_ERROR_CPU_FAILURE |
---|
| 244 | ROAR_FATAL_ERROR_CPU_FAILTURE = ROAR_FATAL_ERROR_CPU_FAILURE, |
---|
| 245 | ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE, |
---|
| 246 | #define ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE ROAR_FATAL_ERROR_MEMORY_USED_AFTER_FREE |
---|
| 247 | ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE, |
---|
| 248 | #define ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE ROAR_FATAL_ERROR_MEMORY_DOUBLE_FREE |
---|
[5619] | 249 | ROAR_FATAL_ERROR_WATCHDOG, |
---|
| 250 | #define ROAR_FATAL_ERROR_WATCHDOG ROAR_FATAL_ERROR_WATCHDOG |
---|
[4970] | 251 | |
---|
| 252 | ROAR_FATAL_ERROR_EOL |
---|
| 253 | }; |
---|
| 254 | |
---|
| 255 | #if __STDC_VERSION__ < 199901L |
---|
| 256 | #if __GNUC__ >= 2 |
---|
| 257 | #define __roar_func__ __FUNCTION__ |
---|
| 258 | #else |
---|
| 259 | #define __roar_func__ NULL |
---|
| 260 | #endif |
---|
| 261 | #else |
---|
| 262 | #define __roar_func__ __func__ |
---|
| 263 | #endif |
---|
| 264 | |
---|
| 265 | #define roar_panic(err,info) roar_panic_real((err), (info), __LINE__, __FILE__, ROAR_DBG_PREFIX, __roar_func__) |
---|
| 266 | void roar_panic_real(enum roar_fatal_error error, const char * info, |
---|
| 267 | unsigned long int line, const char * file, const char * prefix, const char * func); |
---|
| 268 | |
---|
[4976] | 269 | // version stuff: |
---|
| 270 | const char * roar_version_string(void); |
---|
| 271 | uint32_t roar_version_num(void); |
---|
| 272 | |
---|
[0] | 273 | #endif |
---|
| 274 | |
---|
| 275 | //ll |
---|