~ubuntu-branches/ubuntu/quantal/linphone/quantal

« back to all changes in this revision

Viewing changes to oRTP/include/ortp/sessionset.h

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-11-15 10:34:50 UTC
  • mfrom: (1.2.1 upstream) (2.1.8 feisty)
  • Revision ID: james.westby@ubuntu.com-20061115103450-qgafwcks2lkhctlj
* New upstream release.
* Enable video support.
* Fix mismatched #endif in mscommon.h, closes: #398307.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
*/
 
19
 
 
20
#ifndef SESSIONSET_H
 
21
#define SESSIONSET_H
 
22
 
 
23
 
 
24
#include <ortp/rtpsession.h>
 
25
 
 
26
#ifdef __cplusplus
 
27
extern "C"{
 
28
#endif
 
29
 
 
30
 
 
31
#if     !defined(_WIN32) && !defined(_WIN32_WCE)
 
32
/* UNIX */
 
33
#include <sys/time.h>
 
34
#include <sys/types.h>
 
35
#include <unistd.h>
 
36
 
 
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)
 
41
 
 
42
typedef fd_set ortp_fd_set;
 
43
 
 
44
 
 
45
#else
 
46
/* WIN32 */
 
47
 
 
48
#define ORTP_FD_ZERO(s) \
 
49
  do {                                                                        \
 
50
    unsigned int __i;                                                         \
 
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;                                        \
 
54
  } while (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)
 
58
 
 
59
 
 
60
 
 
61
/* The fd_set member is required to be an array of longs.  */
 
62
typedef long int ortp__fd_mask;
 
63
 
 
64
 
 
65
/* Number of bits per word of `fd_set' (some code assumes this is 32).  */
 
66
#define ORTP__FD_SETSIZE 1024
 
67
 
 
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))
 
72
 
 
73
 
 
74
/* fd_set for select and pselect.  */
 
75
typedef struct
 
76
  {
 
77
    ortp__fd_mask fds_bits[ORTP__FD_SETSIZE / ORTP__NFDBITS];
 
78
# define ORTP__FDS_BITS(set) ((set)->fds_bits)
 
79
  } ortp_fd_set;
 
80
 
 
81
 
 
82
#endif /*end WIN32*/
 
83
 
 
84
struct _SessionSet
 
85
{
 
86
        ortp_fd_set rtpset;
 
87
};
 
88
 
 
89
 
 
90
typedef struct _SessionSet SessionSet;
 
91
 
 
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)
 
97
 
 
98
#define session_set_copy(dest,src)              memcpy(&(dest)->rtpset,&(src)->rtpset,sizeof(ortp_fd_set))
 
99
 
 
100
void session_set_destroy(SessionSet *set);
 
101
 
 
102
        
 
103
int session_set_select(SessionSet *recvs, SessionSet *sends, SessionSet *errors);
 
104
 
 
105
 
 
106
#ifdef __cplusplus
 
107
}
 
108
#endif
 
109
        
 
110
#endif