oRTP  0.23.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 
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 
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 #endif
rtp_session_create_telephone_event_packet
ORTP_PUBLIC mblk_t * rtp_session_create_telephone_event_packet(RtpSession *session, int start)
Definition: telephonyevents.c:96
_queue
Definition: str_utils.h:75
session_set_select
ORTP_PUBLIC int session_set_select(SessionSet *recvs, SessionSet *sends, SessionSet *errors)
Definition: sessionset.c:113
StunMessage
Definition: stun.h:308
StunAtrHdr
Definition: stun.h:196
rtp_session_read_telephone_event
ORTP_PUBLIC int rtp_session_read_telephone_event(RtpSession *session, mblk_t *packet, telephone_event_t **tab)
Definition: telephonyevents.c:304
_OList
Definition: utils.h:32
StunAddress4
Definition: stun.h:202
datab
Definition: str_utils.h:67
_telephone_event
Definition: telephonyevents.h:33
IceAtrIceControll
Definition: stun.h:282
session_set_new
ORTP_PUBLIC SessionSet * session_set_new(void)
Definition: sessionset.c:30
ortp.h
General purpose library functions.
TurnAtrReservationToken
Definition: stun.h:260
rtp_session_send_telephone_events_supported
ORTP_PUBLIC int rtp_session_send_telephone_events_supported(RtpSession *session)
Definition: telephonyevents.c:61
StunServerInfo
Definition: stun.h:424
IceAtrPriority
Definition: stun.h:277
msgb
Definition: str_utils.h:49
rtp_session_sendm_with_ts
ORTP_PUBLIC int rtp_session_sendm_with_ts(RtpSession *session, mblk_t *mp, uint32_t userts)
Definition: rtpsession.c:952
StunMediaRelay
Definition: stun.h:416
StunMsgHdr
Definition: stun.h:187
TurnAtrRequestedTransport
Definition: stun.h:252
StunAtrUnknown
Definition: stun.h:229
StunAtrString
Definition: stun.h:271
TurnAtrChannelNumber
Definition: stun.h:235
_PayloadType
Definition: payloadtype.h:53
_RtpScheduler
Definition: scheduler.h:28
rtp_session_add_telephone_event
ORTP_PUBLIC int rtp_session_add_telephone_event(RtpSession *session, mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration)
Definition: telephonyevents.c:137
sessionset.h
Sending and receiving multiple streams together with only one thread.
rtp_session_send_dtmf2
ORTP_PUBLIC int rtp_session_send_dtmf2(RtpSession *session, char dtmf, uint32_t userts, int duration)
Definition: telephonyevents.c:187
_msgb_allocator
Definition: str_utils.h:149
telephonyevents.h
Receiving and sending telephone events (RFC2833)
_RtpSession
Definition: rtpsession.h:201
rtp_session_telephone_events_supported
ORTP_PUBLIC int rtp_session_telephone_events_supported(RtpSession *session)
Definition: telephonyevents.c:44
poly32_t
Definition: utils.h:62
_OrtpEventData
Definition: event.h:44
StunAtrFingerprint
Definition: stun.h:265
OrtpEvQueue
Definition: event.h:92
TurnAtrData
Definition: stun.h:246
TurnAtrLifetime
Definition: stun.h:241
session_set_destroy
ORTP_PUBLIC void session_set_destroy(SessionSet *set)
Definition: sessionset.c:43
StunAtrAddress4
Definition: stun.h:208
rtp_session_send_dtmf
ORTP_PUBLIC int rtp_session_send_dtmf(RtpSession *session, char dtmf, uint32_t userts)
Definition: telephonyevents.c:173
_dwsplit_t
Definition: utils.h:52
StunAtrChangeRequest
Definition: stun.h:215
rtp_session_recv_telephone_events_supported
ORTP_PUBLIC int rtp_session_recv_telephone_events_supported(RtpSession *session)
Definition: telephonyevents.c:75
_SessionSet
Definition: sessionset.h:88
rtp_header
Definition: rtp.h:37
StunAtrIntegrity
Definition: stun.h:287
StunAtrError
Definition: stun.h:220