oRTP
0.20.0
Main Page
Data Structures
Files
File List
Globals
src
utils.h
1
/***************************************************************************
2
* utils.h
3
*
4
* Wed Feb 23 14:15:36 2005
5
* Copyright 2005 Simon Morlat
6
* Email simon.morlat@linphone.org
7
****************************************************************************/
8
/*
9
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
10
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
11
12
This library is free software; you can redistribute it and/or
13
modify it under the terms of the GNU Lesser General Public
14
License as published by the Free Software Foundation; either
15
version 2.1 of the License, or (at your option) any later version.
16
17
This library is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
Lesser General Public License for more details.
21
22
You should have received a copy of the GNU Lesser General Public
23
License along with this library; if not, write to the Free Software
24
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
*/
26
27
#ifndef UTILS_H
28
#define UTILS_H
29
30
#include "ortp/event.h"
31
32
struct
_OList
{
33
struct
_OList
*next;
34
struct
_OList
*prev;
35
void
*data;
36
};
37
38
typedef
struct
_OList
OList
;
39
40
41
#define o_list_next(elem) ((elem)->next)
42
43
OList
* o_list_append(
OList
*elem,
void
* data);
44
OList
* o_list_remove(
OList
*list,
void
*data);
45
OList
* o_list_free(
OList
*elem);
46
OList
*o_list_remove_link(
OList
*list,
OList
*elem);
47
48
#ifndef MIN
49
#define MIN(a,b) (((a)>(b)) ? (b) : (a))
50
#endif
51
#ifndef MAX
52
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
53
#endif
54
55
#define return_if_fail(expr) if (!(expr)) {printf("%s:%i- assertion"#expr "failed\n",__FILE__,__LINE__); return;}
56
#define return_val_if_fail(expr,ret) if (!(expr)) {printf("%s:%i- assertion" #expr "failed\n",__FILE__,__LINE__); return (ret);}
57
58
59
#define INT_TO_POINTER(truc) ((long)(long)(truc))
60
#define POINTER_TO_INT(truc) ((int)(long)(truc))
61
62
typedef
struct
_dwsplit_t
{
63
#ifdef ORTP_BIGENDIAN
64
uint16_t hi;
65
uint16_t lo;
66
#else
67
uint16_t lo;
68
uint16_t hi;
69
#endif
70
}
dwsplit_t
;
71
72
typedef
union
{
73
dwsplit_t
split;
74
uint32_t one;
75
}
poly32_t
;
76
77
#ifdef ORTP_BIGENDIAN
78
#define hton24(x) (x)
79
#else
80
#define hton24(x) ((( (x) & 0x00ff0000) >>16) | (( (x) & 0x000000ff) <<16) | ( (x) & 0x0000ff00) )
81
#endif
82
#define ntoh24(x) hton24(x)
83
84
#if defined(WIN32) || defined(_WIN32_WCE)
85
#define is_would_block_error(errnum) (errnum==WSAEWOULDBLOCK)
86
#else
87
#define is_would_block_error(errnum) (errnum==EWOULDBLOCK || errnum==EAGAIN)
88
#endif
89
90
void
ortp_ev_queue_put(
OrtpEvQueue
*q,
OrtpEvent
*ev);
91
92
uint64_t ortp_timeval_to_ntp(
const
struct
timeval *tv);
93
94
#endif
Generated on Sat Mar 22 2014 08:50:19 for oRTP by
1.8.1.2