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