oRTP
0.23.0
include
ortp
sessionset.h
Go to the documentation of this file.
1
/*
2
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
4
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.
9
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.
14
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
18
*/
24
#ifndef SESSIONSET_H
25
#define SESSIONSET_H
26
27
28
#include <
ortp/rtpsession.h
>
29
30
#ifdef __cplusplus
31
extern
"C"
{
32
#endif
33
34
35
#if !defined(_WIN32) && !defined(_WIN32_WCE)
36
/* UNIX */
37
#include <sys/time.h>
38
#include <sys/types.h>
39
#include <unistd.h>
40
41
#define ORTP_FD_SET(d, s) FD_SET(d, s)
42
#define ORTP_FD_CLR(d, s) FD_CLR(d, s)
43
#define ORTP_FD_ISSET(d, s) FD_ISSET(d, s)
44
#define ORTP_FD_ZERO(s) FD_ZERO(s)
45
46
typedef
fd_set ortp_fd_set;
47
48
49
#else
50
/* WIN32 */
51
52
#define ORTP_FD_ZERO(s) \
53
do { \
54
unsigned int __i; \
55
ortp_fd_set *__arr = (s); \
56
for (__i = 0; __i < sizeof (ortp_fd_set) / sizeof (ortp__fd_mask); ++__i) \
57
ORTP__FDS_BITS (__arr)[__i] = 0; \
58
} while (0)
59
#define ORTP_FD_SET(d, s) (ORTP__FDS_BITS (s)[ORTP__FDELT(d)] |= ORTP__FDMASK(d))
60
#define ORTP_FD_CLR(d, s) (ORTP__FDS_BITS (s)[ORTP__FDELT(d)] &= ~ORTP__FDMASK(d))
61
#define ORTP_FD_ISSET(d, s) ((ORTP__FDS_BITS (s)[ORTP__FDELT(d)] & ORTP__FDMASK(d)) != 0)
62
63
64
65
/* The fd_set member is required to be an array of longs. */
66
typedef
long
int
ortp__fd_mask;
67
68
69
/* Number of bits per word of `fd_set' (some code assumes this is 32). */
70
#define ORTP__FD_SETSIZE 1024
71
72
/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
73
#define ORTP__NFDBITS (8 * sizeof (ortp__fd_mask))
74
#define ORTP__FDELT(d) ((d) / ORTP__NFDBITS)
75
#define ORTP__FDMASK(d) ((ortp__fd_mask) 1 << ((d) % ORTP__NFDBITS))
76
77
78
/* fd_set for select and pselect. */
79
typedef
struct
80
{
81
ortp__fd_mask fds_bits[ORTP__FD_SETSIZE / ORTP__NFDBITS];
82
# define ORTP__FDS_BITS(set) ((set)->fds_bits)
83
} ortp_fd_set;
84
85
86
#endif
/*end WIN32*/
87
88
struct
_SessionSet
89
{
90
ortp_fd_set rtpset;
91
};
92
93
94
typedef
struct
_SessionSet
SessionSet
;
95
96
#define session_set_init(ss) ORTP_FD_ZERO(&(ss)->rtpset)
97
98
ORTP_PUBLIC
SessionSet
*
session_set_new
(
void
);
104
#define session_set_set(ss,rtpsession) ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)
105
112
#define session_set_is_set(ss,rtpsession) ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)
113
121
#define session_set_clr(ss,rtpsession) ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)
122
123
#define session_set_copy(dest,src) memcpy(&(dest)->rtpset,&(src)->rtpset,sizeof(ortp_fd_set))
124
125
129
ORTP_PUBLIC
void
session_set_destroy
(
SessionSet
*set);
130
131
132
ORTP_PUBLIC
int
session_set_select
(
SessionSet
*recvs,
SessionSet
*sends,
SessionSet
*errors);
133
ORTP_PUBLIC
int
session_set_timedselect(
SessionSet
*recvs,
SessionSet
*sends,
SessionSet
*errors,
struct
timeval *timeout);
134
135
#ifdef __cplusplus
136
}
137
#endif
138
139
#endif
session_set_select
ORTP_PUBLIC int session_set_select(SessionSet *recvs, SessionSet *sends, SessionSet *errors)
Definition:
sessionset.c:113
session_set_new
ORTP_PUBLIC SessionSet * session_set_new(void)
Definition:
sessionset.c:30
rtpsession.h
The RtpSession api.
session_set_destroy
ORTP_PUBLIC void session_set_destroy(SessionSet *set)
Definition:
sessionset.c:43
_SessionSet
Definition:
sessionset.h:88
Generated by
1.8.17