oRTP  0.24.0
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 INT_TO_POINTER(truc) ((long)(long)(truc))
50 #define POINTER_TO_INT(truc) ((int)(long)(truc))
51 
52 typedef struct _dwsplit_t{
53 #ifdef ORTP_BIGENDIAN
54  uint16_t hi;
55  uint16_t lo;
56 #else
57  uint16_t lo;
58  uint16_t hi;
59 #endif
60 } dwsplit_t;
61 
62 typedef union{
63  dwsplit_t split;
64  uint32_t one;
65 } poly32_t;
66 
67 #ifdef ORTP_BIGENDIAN
68 #define hton24(x) (x)
69 #else
70 #define hton24(x) ((( (x) & 0x00ff0000) >>16) | (( (x) & 0x000000ff) <<16) | ( (x) & 0x0000ff00) )
71 #endif
72 #define ntoh24(x) hton24(x)
73 
74 #if defined(WIN32) || defined(_WIN32_WCE)
75 #define is_would_block_error(errnum) (errnum==WSAEWOULDBLOCK)
76 #else
77 #define is_would_block_error(errnum) (errnum==EWOULDBLOCK || errnum==EAGAIN)
78 #endif
79 
80 void ortp_ev_queue_put(OrtpEvQueue *q, OrtpEvent *ev);
81 
82 uint64_t ortp_timeval_to_ntp(const struct timeval *tv);
83 
84 bool_t ortp_stream_is_ipv6(OrtpStream *os);
85 
86 int _rtp_session_sendto(RtpSession *session, bool_t is_rtp, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
87 int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
88 #endif
Definition: utils.h:52
Definition: rtpsession.h:348
Definition: str_utils.h:49
Definition: utils.h:62
Definition: event.h:84
Definition: utils.h:33
Definition: rtpsession.h:265
The RtpSession api.