oRTP 0.25.0

- Main Page
- Data Structures
- Files

- File List
- Globals

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 #include "ortp/rtpsession.h"
32
33 struct _OList {
34 struct _OList *next;
35 struct _OList *prev;
36 void *data;
37 };
38
39
40 #define o_list_next(elem) ((elem)->next)
41 #define o_list_prev(elem) ((elem)->prev)
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
49 #define ORTP_POINTER_TO_INT(p) ((int)(intptr_t)(p))
50 #define ORTP_INT_TO_POINTER(i) ((void *)(intptr_t)(i))
51
52
53 typedef struct _dwsplit_t{
54 #ifdef ORTP_BIGENDIAN
55 uint16_t hi;
56 uint16_t lo;
57 #else
58 uint16_t lo;
59 uint16_t hi;
60 #endif
61 } dwsplit_t;
62
63 typedef union{
64 dwsplit_t split;
65 uint32_t one;
66 } poly32_t;
67
68 #ifdef ORTP_BIGENDIAN
69 #define hton24(x) (x)
70 #else
71 #define hton24(x) ((( (x) & 0x00ff0000) >>16) | (( (x) & 0x000000ff) <<16) | ( (x) & 0x0000ff00) )
72 #endif
73 #define ntoh24(x) hton24(x)
74
75 #if defined(_WIN32) || defined(_WIN32_WCE)
76 #define is_would_block_error(errnum) (errnum==WSAEWOULDBLOCK)
77 #else
78 #define is_would_block_error(errnum) (errnum==EWOULDBLOCK || errnum==EAGAIN)
79 #endif
80
81 void ortp_ev_queue_put(OrtpEvQueue *q, OrtpEvent *ev);
82
83 uint64_t ortp_timeval_to_ntp(const struct timeval *tv);
84
85 bool_t ortp_stream_is_ipv6(OrtpStream *os);
86
87 int _rtp_session_sendto(RtpSession *session, bool_t is_rtp, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
88 int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
89 void _rtp_session_release_sockets(RtpSession *session, bool_t release_transports);
90 #endif
_dwsplit_t
Definition: utils.h:53
_RtpSession
Definition: rtpsession.h:354
msgb
Definition: str_utils.h:49
poly32_t
Definition: utils.h:63
OrtpEvQueue
Definition: event.h:87
_OList
Definition: utils.h:33
_OrtpStream
Definition: rtpsession.h:271
rtpsession.h
The RtpSession api.