source: roaraudio/include/roaraudio.h @ 57:b3abe3c77d41

Last change on this file since 57:b3abe3c77d41 was 57:b3abe3c77d41, checked in by phi, 16 years ago

added some more mlock support

File size: 2.1 KB
Line 
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>
13#include <sys/mman.h>
14
15#include <arpa/inet.h>
16
17#include <sys/socket.h>
18#include <netinet/in.h>
19#include <netinet/tcp.h>
20#include <sys/un.h>
21
22#include <netdb.h>
23
24#include <roaraudio/config.h>
25
26// NOTE: we need this macro in some of our header files.
27#if INT_MAX >= 32767
28#define roar_intm16  int
29#define roar_uintm16 unsigned int
30#else
31#define roar_intm16  int16_t
32#define roar_uintm16 uint16_t
33#endif
34
35#include <roaraudio/proto.h>
36#include <roaraudio/audio.h>
37#include <roaraudio/stream.h>
38#include <roaraudio/client.h>
39#include <roaraudio/sample.h>
40
41#include <libroar/libroar.h>
42
43#define ROAR_DEFAULT_PORT        16002
44#define ROAR_DEFAULT_HOST        "localhost"
45
46#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
47#define ROAR_DEFAULT_SOCK_USER   ".roar"
48
49
50//some basic macros:
51#define ROAR_STDIN  0
52#define ROAR_STDOUT 1
53#define ROAR_STDERR 2
54
55#define ROAR_DEBUG_OUTFH stderr
56
57#ifdef ROAR_DBG_PREFIX
58#undef ROAR_DBG_PREFIX
59#endif
60#define ROAR_DBG_PREFIX "roaraudio"
61
62#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
63
64#ifdef DEBUG
65 #define ROAR_DBG(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args)
66#else
67 #define ROAR_DBG(format, args...)
68#endif
69
70#define ROAR_ERR(format, args...)   fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: " format "\n", __LINE__, ## args)
71
72
73#ifdef ROAR_HAVE_SAFE_OVERFLOW
74#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
75#else
76#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
77#endif
78
79#ifdef ROAR_HAVE_MLOCK
80#define ROAR_MLOCK(p,s) mlock((p), (s))
81#endif
82
83
84#if BYTE_ORDER == BIG_ENDIAN
85
86#define ROAR_NET2HOST32(x) (x)
87#define ROAR_HOST2NET32(x) (x)
88#define ROAR_NET2HOST16(x) (x)
89#define ROAR_HOST2NET16(x) (x)
90
91//#elif BYTE_ORDER == LITTLE_ENDIAN
92#else
93
94#define ROAR_NET2HOST32(x) ntohl((x))
95#define ROAR_HOST2NET32(x) htonl((x))
96#define ROAR_NET2HOST16(x) ntohs((x))
97#define ROAR_HOST2NET16(x) htons((x))
98
99#endif
100
101#endif
102
103//ll
Note: See TracBrowser for help on using the repository browser.