ccRTP
rtp.h
Go to the documentation of this file.
1 // Copyright (C) 1999-2005 Open Source Telecom Corporation.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // As a special exception, you may use this file as part of a free software
17 // library without restriction. Specifically, if other files instantiate
18 // templates or use macros or inline functions from this file, or you compile
19 // this file and link it with other files to produce an executable, this
20 // file does not by itself cause the resulting executable to be covered by
21 // the GNU General Public License. This exception does not however
22 // invalidate any other reasons why the executable file might be covered by
23 // the GNU General Public License.
24 //
25 // This exception applies only to the code released under the name GNU
26 // ccRTP. If you copy code from other releases into a copy of GNU
27 // ccRTP, as the General Public License permits, the exception does
28 // not apply to the code that you add in this way. To avoid misleading
29 // anyone as to the status of such modified files, you must delete
30 // this exception notice from them.
31 //
32 // If you write modifications of your own for GNU ccRTP, it is your choice
33 // whether to permit this exception to apply to your modifications.
34 // If you do not wish that, delete this exception notice.
35 //
36 
48 #ifndef CCXX_RTP_RTP_H_
49 #define CCXX_RTP_RTP_H_
50 
51 #include <ccrtp/cqueue.h>
52 #include <ccrtp/channel.h>
53 
54 NAMESPACE_COMMONCPP
55 
82  template <class RTPDataChannel = DualRTPUDPIPv4Channel,
83  class RTCPChannel = DualRTPUDPIPv4Channel,
84  class ServiceQueue = AVPQueue>
85  class __EXPORT TRTPSessionBase : public ServiceQueue
86  {
87  public:
97  TRTPSessionBase(const InetHostAddress& ia, tpport_t dataPort,
98  tpport_t controlPort, uint32 membersSize,
99  RTPApplication& app) :
100  ServiceQueue(membersSize,app)
101  { build(ia,dataPort,controlPort); }
102 
114  TRTPSessionBase(uint32 ssrc,
115  const InetHostAddress& ia,
116  tpport_t dataPort, tpport_t controlPort,
117  uint32 membersSize, RTPApplication& app):
118  ServiceQueue(ssrc,membersSize,app)
119  { build(ia,dataPort,controlPort); }
120 
133  TRTPSessionBase(const InetMcastAddress& ia, tpport_t dataPort,
134  tpport_t controlPort, uint32 membersSize,
135  RTPApplication& app, uint32 iface) :
136  ServiceQueue(membersSize,app)
137  { build(ia,dataPort,controlPort,iface); }
138 
153  TRTPSessionBase(uint32 ssrc,
154  const InetMcastAddress& ia, tpport_t dataPort,
155  tpport_t controlPort, uint32 membersSize,
156  RTPApplication& app, uint32 iface) :
157  ServiceQueue(ssrc,membersSize,app)
158  { build(ia,dataPort,controlPort,iface); }
159 
160  virtual size_t dispatchBYE(const std::string &str)
161  {
162  return QueueRTCPManager::dispatchBYE(str);
163  }
164 
171  inline Socket::Error
172  setMcastTTL(uint8 ttl)
173  {
174  Socket::Error error = dso->setMulticast(true);
175  if ( error ) return error;
176  error = dso->setTimeToLive(ttl);
177  if ( error ) return error;
178  error = cso->setMulticast(true);
179  if ( error ) return error;
180  return cso->setTimeToLive(ttl);
181  }
182 
183  inline virtual
185  {
186  endSocket();
187  }
188 
189  inline RTPDataChannel *getDSO(void)
190  {return dso;}
191 
192  protected:
196  inline bool
198  { return dso->isPendingRecv(timeout); }
199 
200  InetHostAddress
201  getDataSender(tpport_t *port = NULL) const
202  { return dso->getSender(port); }
203 
204  inline size_t
206  { return dso->getNextPacketSize(); }
207 
217  inline size_t
218  recvData(unsigned char* buffer, size_t len,
219  InetHostAddress& na, tpport_t& tp)
220  { na = dso->getSender(tp); return dso->recv(buffer, len); }
221 
222  inline void
223  setDataPeer(const InetAddress &host, tpport_t port)
224  { dso->setPeer(host,port); }
225 
226 
231  inline size_t
232  sendData(const unsigned char* const buffer, size_t len)
233  { return dso->send(buffer, len); }
234 
235  inline SOCKET getDataRecvSocket() const
236  { return dso->getRecvSocket(); }
237 
242  inline bool
244  { return cso->isPendingRecv(timeout); }
245 
246  InetHostAddress
247  getControlSender(tpport_t *port = NULL) const
248  { return cso->getSender(port); }
249 
259  inline size_t
260  recvControl(unsigned char *buffer, size_t len,
261  InetHostAddress& na, tpport_t& tp)
262  { na = cso->getSender(tp); return cso->recv(buffer,len); }
263 
264  inline void
265  setControlPeer(const InetAddress &host, tpport_t port)
266  { cso->setPeer(host,port); }
267 
273  inline size_t
274  sendControl(const unsigned char* const buffer, size_t len)
275  { return cso->send(buffer,len); }
276 
277  inline SOCKET getControlRecvSocket() const
278  { return cso->getRecvSocket(); }
279 
286  inline Socket::Error
287  joinGroup(const InetMcastAddress& ia, uint32 iface)
288  {
289  Socket::Error error = dso->setMulticast(true);
290  if ( error ) return error;
291  error = dso->join(ia,iface);
292  if ( error ) return error;
293  error = cso->setMulticast(true);
294  if ( error ) {
295  dso->drop(ia);
296  return error;
297  }
298  error = cso->join(ia,iface);
299  if ( error ) {
300  dso->drop(ia);
301  return error;
302  }
303  return Socket::errSuccess;
304  }
305 
312  inline Socket::Error
313  leaveGroup(const InetMcastAddress& ia)
314  {
315  Socket::Error error = dso->setMulticast(false);
316  if ( error ) return error;
317  error = dso->leaveGroup(ia);
318  if ( error ) return error;
319  error = cso->setMulticast(false);
320  if ( error ) return error;
321  return cso->leaveGroup(ia);
322  }
323 
324  inline void
326  {
327  if (dso) {
328  dso->endSocket();
329  delete dso;
330  }
331  dso = NULL;
332  if (cso) {
333  cso->endSocket();
334  delete cso;
335  }
336  cso = NULL;
337  }
338 
339  private:
340  void
341  build(const InetHostAddress& ia, tpport_t dataPort,
342  tpport_t controlPort)
343  {
344  if ( 0 == controlPort ) {
345  dataBasePort = even_port(dataPort);
346  controlBasePort = dataBasePort + 1;
347  } else {
348  dataBasePort = dataPort;
349  controlBasePort = controlPort;
350  }
351  dso = new RTPDataChannel(ia,dataBasePort);
352  cso = new RTCPChannel(ia,controlBasePort);
353  }
354 
355  void
356  build(const InetMcastAddress& ia, tpport_t dataPort,
357  tpport_t controlPort, uint32 iface)
358  {
359  if ( 0 == controlPort ) {
360  dataBasePort = even_port(dataPort);
361  controlBasePort = dataBasePort + 1;
362  } else {
363  dataBasePort = dataPort;
364  controlBasePort = controlPort;
365  }
366  dso = new RTPDataChannel(InetHostAddress("0.0.0.0"),dataBasePort);
367  cso = new RTCPChannel(InetHostAddress("0.0.0.0"),controlBasePort);
368  joinGroup(ia,iface);
369  }
370 
378  inline tpport_t
379  odd_port(tpport_t port)
380  { return (port & 0x01)? (port) : (port - 1); }
381 
389  inline tpport_t
390  even_port(tpport_t port)
391  { return (port & 0x01)? (port - 1) : (port); }
392 
393  tpport_t dataBasePort;
394  tpport_t controlBasePort;
395 
396  protected:
397  RTPDataChannel* dso;
398  RTCPChannel* cso;
399  friend class RTPSessionBaseHandler;
400  };
401 
412  template
413  <class RTPDataChannel = DualRTPUDPIPv4Channel,
414  class RTCPChannel = DualRTPUDPIPv4Channel,
415  class ServiceQueue = AVPQueue>
416  class __EXPORT SingleThreadRTPSession :
417  protected Thread,
418  public TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>
419  {
420  public:
421  SingleThreadRTPSession(const InetHostAddress& ia,
422  tpport_t dataPort = DefaultRTPDataPort,
423  tpport_t controlPort = 0,
424  int pri = 0,
425  uint32 memberssize =
428 #if defined(_MSC_VER) && _MSC_VER >= 1300
429  );
430 #else
431  ):
432  Thread(pri),
434  (ia,dataPort,controlPort,memberssize,app)
435  { }
436 #endif
437 
438  SingleThreadRTPSession(uint32 ssrc, const InetHostAddress& ia,
439  tpport_t dataPort = DefaultRTPDataPort,
440  tpport_t controlPort = 0,
441  int pri = 0,
442  uint32 memberssize =
445 #if defined(_MSC_VER) && _MSC_VER >= 1300
446  );
447 #else
448  ):
449  Thread(pri),
451  (ssrc, ia,dataPort,controlPort,memberssize,app)
452 { }
453 #endif
454 
455 SingleThreadRTPSession(const InetMcastAddress& ia,
456  tpport_t dataPort = DefaultRTPDataPort,
457  tpport_t controlPort = 0,
458  int pri = 0,
459  uint32 memberssize =
462  uint32 iface = 0
463 #if defined(_MSC_VER) && _MSC_VER >= 1300
464  );
465 #else
466  ):
467  Thread(pri),
469  (ia,dataPort,controlPort,memberssize,app,iface)
470  { }
471 #endif
472 
473 SingleThreadRTPSession(uint32 ssrc, const InetMcastAddress& ia,
474  tpport_t dataPort = DefaultRTPDataPort,
475  tpport_t controlPort = 0,
476  int pri = 0,
477  uint32 memberssize =
480  uint32 iface = 0
481 #if defined(_MSC_VER) && _MSC_VER >= 1300
482  );
483 #else
484  ):
485  Thread(pri),
487  (ssrc,ia,dataPort,controlPort,memberssize,app,iface)
488 { }
489 #endif
490 
491 
493 {
494  if (isRunning()) {
495  disableStack(); Thread::join();
496  }
497 }
498 
499 #if defined(_MSC_VER) && _MSC_VER >= 1300
500 virtual void startRunning();
501 #else
502 
505 void
507 { enableStack(); Thread::start(); }
508 #endif
509 
510 
511 protected:
512 inline void disableStack(void)
514 
515 inline void enableStack(void)
517 
520 
521 inline void controlReceptionService(void)
523 
524 inline void controlTransmissionService(void)
526 
527 inline timeval getRTCPCheckInterval(void)
529 
530 inline size_t dispatchDataPacket(void)
532 
533 #if defined(_MSC_VER) && _MSC_VER >= 1300
534 virtual void run(void);
535 
536 virtual void timerTick(void);
537 
538 virtual bool isPendingData(microtimeout_t timeout);
539 #else
540 
541 virtual void timerTick(void)
542 {return;}
543 
544 virtual bool isPendingData(microtimeout_t timeout)
546 
551 virtual void run(void)
552 {
553  microtimeout_t timeout = 0;
554  while ( ServiceQueue::isActive() ) {
555  if ( timeout < 1000 ){ // !(timeout/1000)
556  timeout = getSchedulingTimeout();
557  }
558  controlReceptionService();
559  controlTransmissionService();
560  microtimeout_t maxWait =
561  timeval2microtimeout(getRTCPCheckInterval());
562  // make sure the scheduling timeout is
563  // <= the check interval for RTCP
564  // packets
565  timeout = (timeout > maxWait)? maxWait : timeout;
566  if ( timeout < 1000 ) { // !(timeout/1000)
567  dispatchDataPacket();
568  timerTick();
569  } else {
570  if ( isPendingData(timeout/1000) ) {
571  if (ServiceQueue::isActive()) { // take in only if active
572  takeInDataPacket();
573  }
574  }
575  timeout = 0;
576  }
577  }
578  dispatchBYE("GNU ccRTP stack finishing.");
579 // Thread::exit();
580 }
581 
582 #endif
583 
584 inline size_t takeInDataPacket(void)
586 
587 inline size_t dispatchBYE(const std::string &str)
589 };
590 
600 
606 typedef RTPSession RTPSocket;
607 
617  SymmetricRTPChannel> SymmetricRTPSession;
618 
619 #ifdef CCXX_IPV6
620 
642 template <class RTPDataChannel = DualRTPUDPIPv6Channel,
643  class RTCPChannel = DualRTPUDPIPv6Channel,
644  class ServiceQueue = AVPQueue>
645 class __EXPORT TRTPSessionBaseIPV6 : public ServiceQueue
646 {
647 public:
657 TRTPSessionBaseIPV6(const IPV6Host& ia, tpport_t dataPort,
658  tpport_t controlPort, uint32 membersSize,
659  RTPApplication& app) :
660  ServiceQueue(membersSize,app)
661 { build(ia,dataPort,controlPort); }
662 
674  TRTPSessionBaseIPV6(uint32 ssrc,
675  const IPV6Host& ia,
676  tpport_t dataPort, tpport_t controlPort,
677  uint32 membersSize, RTPApplication& app):
678  ServiceQueue(ssrc,membersSize,app)
679  { build(ia,dataPort,controlPort); }
680 
693  TRTPSessionBaseIPV6(const IPV6Multicast& ia, tpport_t dataPort,
694  tpport_t controlPort, uint32 membersSize,
695  RTPApplication& app, uint32 iface) :
696  ServiceQueue(membersSize,app)
697  { build(ia,dataPort,controlPort,iface); }
698 
713  TRTPSessionBaseIPV6(uint32 ssrc,
714  const IPV6Multicast& ia, tpport_t dataPort,
715  tpport_t controlPort, uint32 membersSize,
716  RTPApplication& app, uint32 iface) :
717  ServiceQueue(ssrc,membersSize,app)
718  { build(ia,dataPort,controlPort,iface); }
719 
720  virtual size_t dispatchBYE(const std::string &str)
721  {
722  return QueueRTCPManager::dispatchBYE(str);
723  }
724 
725  inline virtual
726  ~TRTPSessionBaseIPV6()
727  {
728  endSocket();
729  }
730 
731  inline RTPDataChannel *getDSO(void)
732  {return dso;}
733 
734 protected:
738  inline bool
739  isPendingData(microtimeout_t timeout)
740  { return dso->isPendingRecv(timeout); }
741 
742  inline IPV6Host
743  getDataSender(tpport_t *port = NULL) const
744  { return dso->getSender(port); }
745 
746  inline size_t
747  getNextDataPacketSize() const
748  { return dso->getNextPacketSize(); }
749 
759  inline size_t
760  recvData(unsigned char* buffer, size_t len,
761  IPV6Host& na, tpport_t& tp)
762  { na = dso->getSender(tp); return dso->recv(buffer, len); }
763 
764  inline void
765  setDataPeerIPV6(const IPV6Host &host, tpport_t port)
766  { dso->setPeer(host,port); }
767 
772  inline size_t
773  sendDataIPV6(const unsigned char* const buffer, size_t len)
774  { return dso->send(buffer, len); }
775 
776  inline SOCKET getDataRecvSocket() const
777  { return dso->getRecvSocket(); }
778 
783  inline bool
784  isPendingControl(microtimeout_t timeout)
785  { return cso->isPendingRecv(timeout); }
786 
787  inline IPV6Host
788  getControlSender(tpport_t *port = NULL) const
789  { return cso->getSender(port); }
790 
800  inline size_t
801  recvControl(unsigned char *buffer, size_t len,
802  IPV6Host& na, tpport_t& tp)
803  { na = cso->getSender(tp); return cso->recv(buffer,len); }
804 
805  inline void
806  setControlPeerIPV6(const IPV6Host &host, tpport_t port)
807  { cso->setPeer(host,port); }
808 
814  inline size_t
815  sendControl(const unsigned char* const buffer, size_t len)
816  { return cso->send(buffer,len); }
817 
818  inline SOCKET getControlRecvSocket() const
819  { return cso->getRecvSocket(); }
820 
821  inline void
822  endSocket()
823  {
824  dso->endSocket();
825  cso->endSocket();
826  if (dso) delete dso;
827  dso = NULL;
828  if (cso) delete cso;
829  cso = NULL;
830  }
831 
832 private:
833  void
834  build(const IPV6Host& ia, tpport_t dataPort,
835  tpport_t controlPort)
836  {
837  if ( 0 == controlPort ) {
838  dataBasePort = even_port(dataPort);
839  controlBasePort = dataBasePort + 1;
840  } else {
841  dataBasePort = dataPort;
842  controlBasePort = controlPort;
843  }
844  dso = new RTPDataChannel(ia,dataBasePort);
845  cso = new RTCPChannel(ia,controlBasePort);
846  }
847 
848  void
849  build(const IPV6Multicast& ia, tpport_t dataPort,
850  tpport_t controlPort, uint32 iface)
851  {
852  if ( 0 == controlPort ) {
853  dataBasePort = even_port(dataPort);
854  controlBasePort = dataBasePort + 1;
855  } else {
856  dataBasePort = dataPort;
857  controlBasePort = controlPort;
858  }
859  dso = new RTPDataChannel(IPV6Host("0.0.0.0"),dataBasePort);
860  cso = new RTCPChannel(IPV6Host("0.0.0.0"),controlBasePort);
861  joinGroup(ia,iface);
862  }
863 
870  inline Socket::Error
871  joinGroup(const IPV6Multicast& ia, uint32 iface)
872  {
873  Socket::Error error = dso->setMulticast(true);
874  if ( error ) return error;
875  error = dso->join(ia,iface);
876  if ( error ) return error;
877  error = cso->setMulticast(true);
878  if ( error ) {
879  dso->drop(ia);
880  return error;
881  }
882  error = cso->join(ia,iface);
883  if ( error ) {
884  dso->drop(ia);
885  return error;
886  }
887  return Socket::errSuccess;
888  }
889 
896  inline Socket::Error
897  leaveGroup(const IPV6Multicast& ia)
898  {
899  Socket::Error error = dso->setMulticast(false);
900  if ( error ) return error;
901  error = dso->leaveGroup(ia);
902  if ( error ) return error;
903  error = cso->setMulticast(false);
904  if ( error ) return error;
905  return cso->leaveGroup(ia);
906  }
907 
914  inline Socket::Error
915  setMcastTTL(uint8 ttl)
916  {
917  Socket::Error error = dso->setMulticast(true);
918  if ( error ) return error;
919  error = dso->setTimeToLive(ttl);
920  if ( error ) return error;
921  error = cso->setMulticast(true);
922  if ( error ) return error;
923  return cso->setTimeToLive(ttl);
924  }
925 
933  inline tpport_t
934  odd_port(tpport_t port)
935  { return (port & 0x01)? (port) : (port - 1); }
936 
944  inline tpport_t
945  even_port(tpport_t port)
946  { return (port & 0x01)? (port - 1) : (port); }
947 
948  tpport_t dataBasePort;
949  tpport_t controlBasePort;
950 
951 protected:
952  RTPDataChannel* dso;
953  RTCPChannel* cso;
954  friend class RTPSessionBaseHandler;
955 };
956 
967 template
968 <class RTPDataChannel = DualRTPUDPIPv6Channel,
969  class RTCPChannel = DualRTPUDPIPv6Channel,
970  class ServiceQueue = AVPQueue>
971 class __EXPORT SingleThreadRTPSessionIPV6 :
972  protected Thread,
973  public TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>
974 {
975 public:
976  SingleThreadRTPSessionIPV6(const IPV6Host& ia,
977  tpport_t dataPort = DefaultRTPDataPort,
978  tpport_t controlPort = 0,
979  int pri = 0,
980  uint32 memberssize =
983 #if defined(_MSC_VER) && _MSC_VER >= 1300
984  );
985 #else
986  ):
987  Thread(pri),
988  TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>
989  (ia,dataPort,controlPort,memberssize,app)
990 { }
991 #endif
992 
993 SingleThreadRTPSessionIPV6(const IPV6Multicast& ia,
994  tpport_t dataPort = DefaultRTPDataPort,
995  tpport_t controlPort = 0,
996  int pri = 0,
997  uint32 memberssize =
1000  uint32 iface = 0
1001 #if defined(_MSC_VER) && _MSC_VER >= 1300
1002  );
1003 #else
1004  ):
1005  Thread(pri),
1006  TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>
1007  (ia,dataPort,controlPort,memberssize,app,iface)
1008 { }
1009 #endif
1010 
1011 ~SingleThreadRTPSessionIPV6()
1012 {
1013  if (isRunning()) {
1014  disableStack(); Thread::join();
1015  }
1016 }
1017 
1018 #if defined(_MSC_VER) && _MSC_VER >= 1300
1019 virtual void startRunning();
1020 #else
1021 
1024 void
1025 startRunning()
1026 { enableStack(); Thread::start(); }
1027 #endif
1028 
1029 
1030 protected:
1031 inline void enableStack(void)
1032 {TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::enableStack();}
1033 
1034 inline void disableStack(void)
1035 {TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::disableStack();}
1036 
1037 inline microtimeout_t getSchedulingTimeout(void)
1038 {return TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::getSchedulingTimeout();}
1039 
1040 inline void controlReceptionService(void)
1041 {TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::controlReceptionService();}
1042 
1043 inline void controlTransmissionService(void)
1044 {TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::controlTransmissionService();}
1045 
1046 inline timeval getRTCPCheckInterval(void)
1047 {return TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::getRTCPCheckInterval();}
1048 
1049 inline size_t dispatchDataPacket(void)
1050 {return TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::dispatchDataPacket();}
1051 
1052 #if defined(_MSC_VER) && _MSC_VER >= 1300
1053 virtual void run(void);
1054 
1055 virtual void timerTick(void);
1056 
1057 virtual bool isPendingData(microtimeout_t timeout);
1058 #else
1059 
1060 virtual void timerTick(void)
1061 {return;}
1062 
1063 virtual bool isPendingData(microtimeout_t timeout)
1064 {return TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::isPendingData(timeout);}
1065 
1070 virtual void run(void)
1071 {
1072  microtimeout_t timeout = 0;
1073  while ( ServiceQueue::isActive() ) {
1074  if ( timeout < 1000 ){ // !(timeout/1000)
1075  timeout = getSchedulingTimeout();
1076  }
1077  controlReceptionService();
1078  controlTransmissionService();
1079  microtimeout_t maxWait =
1080  timeval2microtimeout(getRTCPCheckInterval());
1081  // make sure the scheduling timeout is
1082  // <= the check interval for RTCP
1083  // packets
1084  timeout = (timeout > maxWait)? maxWait : timeout;
1085  if ( timeout < 1000 ) { // !(timeout/1000)
1086  dispatchDataPacket();
1087  timerTick();
1088  } else {
1089  if ( isPendingData(timeout/1000) ) {
1090  takeInDataPacket();
1091  }
1092  timeout = 0;
1093  }
1094  }
1095  dispatchBYE("GNU ccRTP stack finishing.");
1096  Thread::exit();
1097 }
1098 
1099 #endif
1100 
1101 inline size_t takeInDataPacket(void)
1102 {return TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::takeInDataPacket();}
1103 
1104 inline size_t dispatchBYE(const std::string &str)
1105 {return TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue>::dispatchBYE(str);}
1106 };
1107 
1116 typedef SingleThreadRTPSessionIPV6<> RTPSessionIPV6;
1117 
1123 typedef RTPSessionIPV6 RTPSocketIPV6;
1124 
1133  typedef SingleThreadRTPSessionIPV6<SymmetricRTPChannelIPV6,
1134  SymmetricRTPChannelIPV6> SymmetricRTPSessionIPV6;
1135 
1136 
1137 #endif
1138  // sessions
1140 
1141 END_NAMESPACE
1142 
1143 #endif //CCXX_RTP_RTP_H_
1144 
virtual bool isPendingData(microtimeout_t timeout)
Definition: rtp.h:544
bool isPendingData(microtimeout_t timeout)
Definition: rtp.h:197
SingleThreadRTPSession(const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0, int pri=0, uint32 memberssize=MembershipBookkeeping::defaultMembersHashSize, RTPApplication &app=defaultApplication(), uint32 iface=0)
Definition: rtp.h:455
virtual size_t dispatchBYE(const std::string &str)
Definition: rtp.h:160
RTPSession RTPSocket
Alias for RTPSession.
Definition: rtp.h:606
Socket::Error setMcastTTL(uint8 ttl)
Set the value of the TTL field in the sent packets.
Definition: rtp.h:172
DualRTPChannel< RTPBaseUDPIPv4Socket > DualRTPUDPIPv4Channel
Definition: channel.h:444
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:67
size_t dispatchDataPacket(void)
Definition: rtp.h:530
virtual void run(void)
Single runnable method for this RTP stacks, schedules outgoing and incoming RTP data and RTCP packets...
Definition: rtp.h:551
TRTPSessionBase(const InetMcastAddress &ia, tpport_t dataPort, tpport_t controlPort, uint32 membersSize, RTPApplication &app, uint32 iface)
Builds a session waiting for packets in a multicast address.
Definition: rtp.h:133
microtimeout_t timeval2microtimeout(const timeval &t)
Convert a time interval, expressed as a timeval value into a microseconds counter.
Definition: base.h:90
RTCPChannel * cso
Definition: rtp.h:398
void controlReceptionService(void)
Definition: rtp.h:521
size_t takeInDataPacket(void)
Definition: rtp.h:584
This template class adds the threading aspect to the RTPSessionBase template in one of the many possi...
Definition: rtp.h:416
SingleRTPChannel SymmetricRTPChannel
Actually, RTP with a single channel can be called &#39;Symmetric RTP&#39;.
Definition: channel.h:455
virtual void timerTick(void)
Definition: rtp.h:541
void enableStack(void)
Definition: rtp.h:515
TRTPSessionBase(const InetHostAddress &ia, tpport_t dataPort, tpport_t controlPort, uint32 membersSize, RTPApplication &app)
Builds a session waiting for packets in a host address.
Definition: rtp.h:97
This class, an RTP/RTCP queue, adds audio/video profile (AVP) specific methods to the generic RTCP se...
Definition: cqueue.h:708
size_t getNextDataPacketSize() const
Definition: rtp.h:205
InetHostAddress getDataSender(tpport_t *port=NULL) const
Definition: rtp.h:201
Definition: pool.h:53
void controlTransmissionService(void)
Definition: rtp.h:524
Definition of socket classes for different underlying transport and/or network protocols that can be ...
RTPDataChannel * dso
Definition: rtp.h:397
void setControlPeer(const InetAddress &host, tpport_t port)
Definition: rtp.h:265
InetHostAddress getControlSender(tpport_t *port=NULL) const
Definition: rtp.h:247
timeval getRTCPCheckInterval(void)
Definition: rtp.h:527
SingleThreadRTPSession RTPSession
Uses two pairs of sockets for RTP data and RTCP transmission/reception.
Definition: rtp.h:599
SOCKET getControlRecvSocket() const
Definition: rtp.h:277
size_t dispatchBYE(const std::string &reason)
This method is used to send an RTCP BYE packet.
void disableStack(void)
Definition: rtp.h:512
size_t sendControl(const unsigned char *const buffer, size_t len)
Definition: rtp.h:274
Generic RTCP control queues.
An RTP application, holding identifying RTCP SDES item values.
Definition: sources.h:364
const tpport_t DefaultRTPDataPort
registered default RTP data transport port
Definition: base.h:109
static const size_t defaultMembersHashSize
Definition: iqueue.h:854
Socket::Error joinGroup(const InetMcastAddress &ia, uint32 iface)
Join a multicast group.
Definition: rtp.h:287
size_t sendData(const unsigned char *const buffer, size_t len)
Definition: rtp.h:232
TRTPSessionBase(uint32 ssrc, const InetHostAddress &ia, tpport_t dataPort, tpport_t controlPort, uint32 membersSize, RTPApplication &app)
Builds a session with the specified ssrc identifier for the local source.
Definition: rtp.h:114
RTPDataChannel * getDSO(void)
Definition: rtp.h:189
Socket::Error leaveGroup(const InetMcastAddress &ia)
Leave a multicast group.
Definition: rtp.h:313
size_t recvData(unsigned char *buffer, size_t len, InetHostAddress &na, tpport_t &tp)
Receive data from the data channel/socket.
Definition: rtp.h:218
size_t dispatchBYE(const std::string &str)
Definition: rtp.h:587
size_t recvControl(unsigned char *buffer, size_t len, InetHostAddress &na, tpport_t &tp)
Receive data from the control channel/socket.
Definition: rtp.h:260
SingleThreadRTPSession(uint32 ssrc, const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0, int pri=0, uint32 memberssize=MembershipBookkeeping::defaultMembersHashSize, RTPApplication &app=defaultApplication(), uint32 iface=0)
Definition: rtp.h:473
SingleThreadRTPSession< SymmetricRTPChannel, SymmetricRTPChannel > SymmetricRTPSession
Uses one pair of sockets, (1) for RTP data and (2) for RTCP transmission/reception.
Definition: rtp.h:617
SingleThreadRTPSession(uint32 ssrc, const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0, int pri=0, uint32 memberssize=MembershipBookkeeping::defaultMembersHashSize, RTPApplication &app=defaultApplication())
Definition: rtp.h:438
SOCKET getDataRecvSocket() const
Definition: rtp.h:235
microtimeout_t getSchedulingTimeout(void)
Definition: rtp.h:518
Definition: rtp.h:85
void endSocket()
Definition: rtp.h:325
TRTPSessionBase(uint32 ssrc, const InetMcastAddress &ia, tpport_t dataPort, tpport_t controlPort, uint32 membersSize, RTPApplication &app, uint32 iface)
Builds a session waiting for packets in a multicast address, with the specified ssrc identifier for t...
Definition: rtp.h:153
void startRunning()
Activate stack and start service thread.
Definition: rtp.h:506
__EXPORT RTPApplication & defaultApplication()
Get the RTPApplication object for the "default" application (the only one used by common applications...
virtual ~TRTPSessionBase()
Definition: rtp.h:184
void setDataPeer(const InetAddress &host, tpport_t port)
Definition: rtp.h:223
~SingleThreadRTPSession()
Definition: rtp.h:492
bool isPendingControl(microtimeout_t timeout)
Definition: rtp.h:243
SingleThreadRTPSession(const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0, int pri=0, uint32 memberssize=MembershipBookkeeping::defaultMembersHashSize, RTPApplication &app=defaultApplication())
Definition: rtp.h:421