2
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#include <ortp/rtpsession.h>
31
#if !defined(_WIN32) && !defined(_WIN32_WCE)
34
#include <sys/types.h>
37
#define ORTP_FD_SET(d, s) FD_SET(d, s)
38
#define ORTP_FD_CLR(d, s) FD_CLR(d, s)
39
#define ORTP_FD_ISSET(d, s) FD_ISSET(d, s)
40
#define ORTP_FD_ZERO(s) FD_ZERO(s)
42
typedef fd_set ortp_fd_set;
48
#define ORTP_FD_ZERO(s) \
51
ortp_fd_set *__arr = (s); \
52
for (__i = 0; __i < sizeof (ortp_fd_set) / sizeof (ortp__fd_mask); ++__i) \
53
ORTP__FDS_BITS (__arr)[__i] = 0; \
55
#define ORTP_FD_SET(d, s) (ORTP__FDS_BITS (s)[ORTP__FDELT(d)] |= ORTP__FDMASK(d))
56
#define ORTP_FD_CLR(d, s) (ORTP__FDS_BITS (s)[ORTP__FDELT(d)] &= ~ORTP__FDMASK(d))
57
#define ORTP_FD_ISSET(d, s) ((ORTP__FDS_BITS (s)[ORTP__FDELT(d)] & ORTP__FDMASK(d)) != 0)
61
/* The fd_set member is required to be an array of longs. */
62
typedef long int ortp__fd_mask;
65
/* Number of bits per word of `fd_set' (some code assumes this is 32). */
66
#define ORTP__FD_SETSIZE 1024
68
/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
69
#define ORTP__NFDBITS (8 * sizeof (ortp__fd_mask))
70
#define ORTP__FDELT(d) ((d) / ORTP__NFDBITS)
71
#define ORTP__FDMASK(d) ((ortp__fd_mask) 1 << ((d) % ORTP__NFDBITS))
74
/* fd_set for select and pselect. */
77
ortp__fd_mask fds_bits[ORTP__FD_SETSIZE / ORTP__NFDBITS];
78
# define ORTP__FDS_BITS(set) ((set)->fds_bits)
90
typedef struct _SessionSet SessionSet;
92
SessionSet * session_set_new(void);
93
#define session_set_init(ss) ORTP_FD_ZERO(&(ss)->rtpset)
94
#define session_set_set(ss,rtpsession) ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)
95
#define session_set_is_set(ss,rtpsession) ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)
96
#define session_set_clr(ss,rtpsession) ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)
98
#define session_set_copy(dest,src) memcpy(&(dest)->rtpset,&(src)->rtpset,sizeof(ortp_fd_set))
100
void session_set_destroy(SessionSet *set);
103
int session_set_select(SessionSet *recvs, SessionSet *sends, SessionSet *errors);