4
* Unix specific definitions and includes
9
* Copyright (c) 1995-2000 University College London
10
* All rights reserved.
12
* Redistribution and use in source and binary forms, with or without
13
* modification, is permitted provided that the following conditions
15
* 1. Redistributions of source code must retain the above copyright
16
* notice, this list of conditions and the following disclaimer.
17
* 2. Redistributions in binary form must reproduce the above copyright
18
* notice, this list of conditions and the following disclaimer in the
19
* documentation and/or other materials provided with the distribution.
20
* 3. All advertising materials mentioning features or use of this software
21
* must display the following acknowledgement:
22
* This product includes software developed by the Computer Science
23
* Department at University College London
24
* 4. Neither the name of the University nor of the Department may be used
25
* to endorse or promote products derived from this software without
26
* specific prior written permission.
27
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
28
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
31
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41
#ifndef _CONFIG_UNIX_H
42
#define _CONFIG_UNIX_H
44
//#include "../../include/mpeg4ip_version.h"
46
#include <sys/types.h>
47
#if TIME_WITH_SYS_TIME
57
#include <sys/resource.h>
68
#include <stdlib.h> /* abs() */
71
#include <sys/types.h>
72
#include <sys/socket.h>
75
#include <netinet/in.h>
77
#include <sys/param.h>
78
#include <sys/fcntl.h>
79
#include <sys/ioctl.h>
81
#include <arpa/inet.h>
86
#define lrand48 rand() * rand
89
#ifdef HAVE_SYS_WAIT_H
93
#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
96
#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
103
#ifdef HAVE_INTTYPES_H
104
#include <inttypes.h>
107
#ifdef HAVE_STROPTS_H
109
#endif /* HAVE_STROPTS_H */
111
#ifdef HAVE_SYS_FILIO_H
112
#include <sys/filio.h>
113
#endif /* HAVE_SYS_FILIO_H */
117
#ifdef HAVE_NETINET6_IN6_H
118
/* Expect IPV6_{JOIN,LEAVE}_GROUP in in6.h, otherwise expect */
119
/* IPV_{ADD,DROP}_MEMBERSHIP in in.h */
120
#include <netinet6/in6.h>
122
#ifdef HAVE_NETINET_IP6_H
123
#include <netinet/ip6.h>
125
#include <netinet/in.h>
127
#endif /* HAVE_NETINET_IN6_H */
129
#ifndef IPV6_ADD_MEMBERSHIP
130
#ifdef IPV6_JOIN_GROUP
131
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
133
#error No definition of IPV6_ADD_MEMBERSHIP, please report to mm-tools@cs.ucl.ac.uk.
134
#endif /* IPV6_JOIN_GROUP */
135
#endif /* IPV6_ADD_MEMBERSHIP */
137
#ifndef IPV6_DROP_MEMBERSHIP
138
#ifdef IPV6_LEAVE_GROUP
139
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
141
#error No definition of IPV6_LEAVE_GROUP, please report to mm-tools@cs.ucl.ac.uk.
142
#endif /* IPV6_LEAVE_GROUP */
143
#endif /* IPV6_DROP_MEMBERSHIP */
145
#endif /* HAVE_IPv6 */
149
#ifndef HAVE_SOCKLEN_T
150
typedef unsigned int socklen_t;
153
typedef u_char ttl_t;
163
#define USERNAMELEN 8
166
#define max(a, b) (((a) > (b))? (a): (b))
169
#define min(a, b) (((a) < (b))? (a): (b))
173
#define ASSERT(x) if ((x) == 0) fprintf(stderr, "%s:%u: failed assertion\n", __FILE__, __LINE__)
176
#define ASSERT assert
183
int gettimeofday(struct timeval *tp, void * );
184
int gethostname(char *name, int namelen);
191
#define EXIT_SUCCESS 0
192
#endif /* EXIT_SUCCESS */
195
#define EXIT_FAILURE 7
196
#endif /* EXIT_FAILURE */
198
#endif /* _CONFIG_UNIX_H_ */