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
32struct _OList {
33 struct _OList *next;
34 struct _OList *prev;
35 void *data;
36};
37
38typedef struct _OList OList;
39
40
41#define o_list_next(elem) ((elem)->next)
42
43OList * o_list_append(OList *elem, void * data);
44OList * o_list_remove(OList *list, void *data);
45OList * o_list_free(OList *elem);
46OList *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
52typedef 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
62typedef 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
80void ortp_ev_queue_put(OrtpEvQueue *q, OrtpEvent *ev);
81
82uint64_t ortp_timeval_to_ntp(const struct timeval *tv);
83
84#endif
Definition: event.h:92
Definition: utils.h:32
Definition: utils.h:52
Definition: str_utils.h:50
Definition: utils.h:62