oRTP: /usr/obj/ports_mfs/ortp-0.24.2/ortp-0.24.2/include/ortp/sessionset.h File Reference

oRTP 0.24.2

- Main Page
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions
sessionset.h File Reference

Sending and receiving multiple streams together with only one thread. More...

`#include <ortp/rtpsession.h>`
`#include <sys/time.h>`
`#include <sys/types.h>`
`#include <unistd.h>`

Go to the source code of this file.

## Data Structures
struct | _SessionSet

## Macros
#define | ORTP_FD_SET(d, s) FD_SET(d, s)
#define | ORTP_FD_CLR(d, s) FD_CLR(d, s)
#define | ORTP_FD_ISSET(d, s) FD_ISSET(d, s)
#define | ORTP_FD_ZERO(s) FD_ZERO(s)
#define | session_set_init(ss) ORTP_FD_ZERO(&(ss)->rtpset)
#define | session_set_set(ss, rtpsession) ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)
#define | session_set_is_set(ss, rtpsession) ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)
#define | session_set_clr(ss, rtpsession) ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)
#define | session_set_copy(dest, src) memcpy(&(dest)->rtpset,&(src)->rtpset,sizeof(ortp_fd_set))

## Typedefs
typedef fd_set | ortp_fd_set
typedef struct _SessionSet | SessionSet

## Functions
ORTP_PUBLIC SessionSet * | session_set_new (void)
ORTP_PUBLIC void | session_set_destroy (SessionSet *set)
ORTP_PUBLIC int | session_set_select (SessionSet *recvs, SessionSet *sends, SessionSet *errors)
ORTP_PUBLIC int | session_set_timedselect (SessionSet *recvs, SessionSet *sends, SessionSet *errors, struct timeval *timeout)

## Detailed Description

Sending and receiving multiple streams together with only one thread.

## Macro Definition Documentation

#define session_set_clr | ( |  | ss,
|  |  | rtpsession
| ) |  | ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)

Removes the session from the set.

Parameters

  ss | a set of sessions.
  rtpsession | a rtp session.

Referenced by rtp_session_create_packet_in_place(), and rtp_session_recvm_with_ts().

#define session_set_is_set | ( |  | ss,
|  |  | rtpsession
| ) |  | ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)

This macro tests if the session is part of the set. 1 is returned if true, 0 else.

Parameters

  ss | a set (#SessionSet object)
  rtpsession | a rtp session

#define session_set_set | ( |  | ss,
|  |  | rtpsession
| ) |  | ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)

This macro adds the rtp session to the set.

Parameters

  ss | a set (SessionSet object)
  rtpsession | a RtpSession

Referenced by rtp_session_create_packet_in_place(), rtp_session_get_last_recv_time(), and rtp_session_recvm_with_ts().

## Function Documentation

ORTP_PUBLIC void session_set_destroy | ( | SessionSet * | set | ) |

Frees a SessionSet.

Destroys a session set.

ORTP_PUBLIC SessionSet* session_set_new | ( | void |  | ) |

Allocates and initialize a new empty session set.

Returns
  the empty session set.

ORTP_PUBLIC int session_set_select | ( | SessionSet * | recvs,
|  | SessionSet * | sends,
|  | SessionSet * | errors
| ) |  |

This function performs similarly as libc select() function, but performs on #RtpSession instead of file descriptors. session_set_select() suspends the calling process until some events arrive on one of the three sets passed in argument. Two of the sets can be NULL. The first set is interpreted as a set of RtpSession waiting for receive events: a new buffer (perhaps empty) is availlable on one or more sessions of the set, or the last receive operation with rtp_session_recv_with_ts() would have finished if it were in blocking mode. The second set is interpreted as a set of RtpSession waiting for send events, i.e. the last rtp_session_send_with_ts() call on a session would have finished if it were in blocking mode.

When some events arrived on some of sets, then the function returns and sets are changed to indicate the sessions where events happened. Sessions can be added to sets using session_set_set(), a session has to be tested to be part of a set using session_set_is_set().

Parameters

  recvs | a set of rtp sessions to be watched for read events
  sends | a set of rtp sessions to be watched for write events
  errors | a set of rtp sessions to be watched for errors

Returns
  : the number of sessions on which the selected events happened.