[0] | 1 | //roaraudio.h: |
---|
| 2 | |
---|
| 3 | #ifndef _ROARAUDIO_H_ |
---|
| 4 | #define _ROARAUDIO_H_ |
---|
| 5 | |
---|
| 6 | #include <stdlib.h> |
---|
| 7 | #include <unistd.h> |
---|
| 8 | #include <stdio.h> |
---|
| 9 | #include <string.h> |
---|
| 10 | #include <errno.h> |
---|
| 11 | #include <sys/types.h> |
---|
| 12 | #include <limits.h> |
---|
[57] | 13 | #include <sys/mman.h> |
---|
[0] | 14 | |
---|
[60] | 15 | // TODO: can we move the next block into roard specific includes? |
---|
| 16 | #include <grp.h> |
---|
| 17 | #include <pwd.h> |
---|
| 18 | #include <sys/stat.h> |
---|
| 19 | |
---|
[0] | 20 | #include <arpa/inet.h> |
---|
| 21 | |
---|
| 22 | #include <sys/socket.h> |
---|
| 23 | #include <netinet/in.h> |
---|
| 24 | #include <netinet/tcp.h> |
---|
| 25 | #include <sys/un.h> |
---|
| 26 | |
---|
| 27 | #include <netdb.h> |
---|
| 28 | |
---|
| 29 | #include <roaraudio/config.h> |
---|
| 30 | |
---|
| 31 | // NOTE: we need this macro in some of our header files. |
---|
| 32 | #if INT_MAX >= 32767 |
---|
| 33 | #define roar_intm16 int |
---|
| 34 | #define roar_uintm16 unsigned int |
---|
| 35 | #else |
---|
| 36 | #define roar_intm16 int16_t |
---|
| 37 | #define roar_uintm16 uint16_t |
---|
| 38 | #endif |
---|
| 39 | |
---|
| 40 | #include <roaraudio/proto.h> |
---|
| 41 | #include <roaraudio/audio.h> |
---|
| 42 | #include <roaraudio/stream.h> |
---|
| 43 | #include <roaraudio/client.h> |
---|
| 44 | #include <roaraudio/sample.h> |
---|
[87] | 45 | #include <roaraudio/meta.h> |
---|
[0] | 46 | |
---|
| 47 | #include <libroar/libroar.h> |
---|
| 48 | |
---|
| 49 | #define ROAR_DEFAULT_PORT 16002 |
---|
| 50 | #define ROAR_DEFAULT_HOST "localhost" |
---|
| 51 | |
---|
| 52 | #define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar" |
---|
| 53 | #define ROAR_DEFAULT_SOCK_USER ".roar" |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | //some basic macros: |
---|
| 57 | #define ROAR_STDIN 0 |
---|
| 58 | #define ROAR_STDOUT 1 |
---|
| 59 | #define ROAR_STDERR 2 |
---|
| 60 | |
---|
| 61 | #define ROAR_DEBUG_OUTFH stderr |
---|
| 62 | |
---|
| 63 | #ifdef ROAR_DBG_PREFIX |
---|
| 64 | #undef ROAR_DBG_PREFIX |
---|
| 65 | #endif |
---|
| 66 | #define ROAR_DBG_PREFIX "roaraudio" |
---|
| 67 | |
---|
| 68 | #define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): " |
---|
| 69 | |
---|
| 70 | #ifdef DEBUG |
---|
| 71 | #define ROAR_DBG(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args) |
---|
| 72 | #else |
---|
| 73 | #define ROAR_DBG(format, args...) |
---|
| 74 | #endif |
---|
| 75 | |
---|
| 76 | #define ROAR_ERR(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: " format "\n", __LINE__, ## args) |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | #ifdef ROAR_HAVE_SAFE_OVERFLOW |
---|
| 80 | #define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b)) |
---|
| 81 | #else |
---|
| 82 | #define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b)) |
---|
| 83 | #endif |
---|
| 84 | |
---|
[56] | 85 | #ifdef ROAR_HAVE_MLOCK |
---|
[57] | 86 | #define ROAR_MLOCK(p,s) mlock((p), (s)) |
---|
[56] | 87 | #endif |
---|
[0] | 88 | |
---|
| 89 | |
---|
| 90 | #if BYTE_ORDER == BIG_ENDIAN |
---|
| 91 | |
---|
| 92 | #define ROAR_NET2HOST32(x) (x) |
---|
| 93 | #define ROAR_HOST2NET32(x) (x) |
---|
| 94 | #define ROAR_NET2HOST16(x) (x) |
---|
| 95 | #define ROAR_HOST2NET16(x) (x) |
---|
| 96 | |
---|
| 97 | //#elif BYTE_ORDER == LITTLE_ENDIAN |
---|
| 98 | #else |
---|
| 99 | |
---|
| 100 | #define ROAR_NET2HOST32(x) ntohl((x)) |
---|
| 101 | #define ROAR_HOST2NET32(x) htonl((x)) |
---|
| 102 | #define ROAR_NET2HOST16(x) ntohs((x)) |
---|
| 103 | #define ROAR_HOST2NET16(x) htons((x)) |
---|
| 104 | |
---|
| 105 | #endif |
---|
| 106 | |
---|
| 107 | #endif |
---|
| 108 | |
---|
| 109 | //ll |
---|