43 #ifndef CCXX_RTP_OQUEUE_H_
44 #define CCXX_RTP_OQUEUE_H_
80 {
return (1 == destList.size()); }
83 {
return destList.front(); }
86 { destinationLock.readLock(); }
89 { destinationLock.unlock(); }
93 { destinationLock.writeLock(); }
107 tpport_t controlPort);
112 networkAddress(na), dataTransportPort(dtp),
113 controlTransportPort(ctp)
117 {
return networkAddress; }
120 {
return dataTransportPort; }
123 {
return controlTransportPort; }
130 mutable ThreadLock destinationLock;
142 class __EXPORT DestinationListHandlerIPV6
145 struct TransportAddressIPV6;
146 std::list<TransportAddressIPV6*> destListIPV6;
149 DestinationListHandlerIPV6();
151 ~DestinationListHandlerIPV6();
156 inline bool isSingleDestinationIPV6()
const
157 {
return (1 == destListIPV6.size()); }
159 inline TransportAddressIPV6* getFirstDestinationIPV6()
const
160 {
return destListIPV6.front(); }
162 inline void lockDestinationListIPV6()
const
163 { destinationLock.readLock(); }
165 inline void unlockDestinationListIPV6()
const
166 { destinationLock.unlock(); }
169 inline void writeLockDestinationListIPV6()
const
170 { destinationLock.writeLock(); }
176 addDestinationToListIPV6(
const IPV6Address& ia, tpport_t data,
182 bool removeDestinationFromListIPV6(
const IPV6Address& ia,
184 tpport_t controlPort);
186 struct TransportAddressIPV6
188 TransportAddressIPV6(IPV6Address na, tpport_t dtp, tpport_t ctp) :
189 networkAddress(na), dataTransportPort(dtp),
190 controlTransportPort(ctp)
193 inline const IPV6Address& getNetworkAddress()
const
194 {
return networkAddress; }
196 inline tpport_t getDataTransportPort()
const
197 {
return dataTransportPort; }
199 inline tpport_t getControlTransportPort()
const
200 {
return controlTransportPort; }
202 IPV6Address networkAddress;
203 tpport_t dataTransportPort, controlTransportPort;
207 mutable ThreadLock destinationLock;
222 protected DestinationListHandlerIPV6,
229 addDestination(
const IPV6Address& ia,
231 tpport_t controlPort = 0);
234 forgetDestination(
const IPV6Address& ia,
236 tpport_t controlPort = 0);
243 tpport_t controlPort = 0);
248 tpport_t controlPort = 0);
253 tpport_t controlPort = 0);
258 tpport_t controlPort = 0);
296 putData(uint32 stamp,
const unsigned char* data = NULL,
size_t len = 0);
311 sendImmediate(uint32 stamp,
const unsigned char* data = NULL,
size_t len = 0);
321 { sendInfo.paddinglen = paddinglen; }
332 { sendInfo.marked = mark; }
338 {
return sendInfo.marked; }
351 setPartial(uint32 timestamp,
unsigned char* data,
size_t offset,
size_t max);
355 {
return defaultSchedulingTimeout; }
365 { schedulingTimeout = to; }
369 {
return defaultExpireTimeout; }
380 { expireTimeout = to; }
383 {
return expireTimeout; }
392 {
return sendInfo.packetCount; }
401 {
return sendInfo.octetCount; }
410 {
return sendInfo.sendSeq; }
456 packet(pkt), prev(p), next(n) { }
519 { sendInfo.sendSeq = seqNum; }
523 {
return sendInfo.sendSeq; }
529 { initialTimestamp = ts; }
535 {
return initialTimestamp; }
544 setControlPeerIPV6(
const IPV6Address &host, tpport_t port) {}
561 setDataPeer(
const InetAddress &host, tpport_t port) {}
565 setDataPeerIPV6(
const IPV6Address &host, tpport_t port) {}
578 sendData(
const unsigned char*
const buffer,
size_t len) {
return 0;}
582 sendDataIPV6(
const unsigned char*
const buffer,
size_t len) {
return 0;}
587 mutable ThreadLock sendLock;
589 OutgoingRTPPktLink* sendFirst, * sendLast;
590 uint32 initialTimestamp;
605 uint32 sendSources[16];
617 uint32 initialTimestamp;
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:67
const tpport_t DefaultRTPDataPort
registered default RTP data transport port
Definition: base.h:109
The implementation for a SRTP cryptographic context.
Definition: CryptoContext.h:82
This class handles a list of destination addresses.
Definition: oqueue.h:66
void writeLockDestinationList() const
Definition: oqueue.h:92
void unlockDestinationList() const
Definition: oqueue.h:88
~DestinationListHandler()
void lockDestinationList() const
Definition: oqueue.h:85
bool addDestinationToList(const InetAddress &ia, tpport_t data, tpport_t control)
Locks the object before modifying it.
std::list< TransportAddress * > destList
Definition: oqueue.h:68
TransportAddress * getFirstDestination() const
Definition: oqueue.h:82
bool isSingleDestination() const
Get whether there is only a destination in the list.
Definition: oqueue.h:79
bool removeDestinationFromList(const InetAddress &ia, tpport_t dataPort, tpport_t controlPort)
Locks the object before modifying it.
Definition: queuebase.h:256
A generic outgoing RTP data queue supporting multiple destinations.
Definition: oqueue.h:225
void setInitialTimestamp(uint32 ts)
Definition: oqueue.h:528
bool isSending() const
Determine if outgoing packets are waiting to send.
microtimeout_t getSchedulingTimeout()
This computes the timeout period for scheduling transmission of the next packet at the "head" of the ...
virtual void setControlPeer(const InetAddress &host, tpport_t port)
Definition: oqueue.h:540
void addContributor(uint32 csrc)
Add csrc as the CSRC identifier of a new contributor.
uint32 getCurrentSeqNum(void)
Definition: oqueue.h:522
uint32 getInitialTimestamp()
Definition: oqueue.h:534
virtual ~OutgoingDataQueue()
Definition: oqueue.h:448
uint32 octetCount
Definition: oqueue.h:601
bool forgetDestination(const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
bool removeContributor(uint32 csrc)
Remove CSRC from the list of contributors.
microtimeout_t getExpireTimeout() const
Definition: oqueue.h:382
uint32 getSendPacketCount() const
Get the total number of packets sent so far.
Definition: oqueue.h:391
void purgeOutgoingQueue()
CryptoContext * getOutQueueCryptoContext(uint32 ssrc)
Get an output queue CryptoContext identified by SSRC.
Mutex cryptoMutex
Definition: oqueue.h:548
uint32 getSendOctetCount() const
Get the total number of octets (payload only) sent so far.
Definition: oqueue.h:400
void dispatchImmediate(OutgoingRTPPkt *packet)
This is used to write the RTP data packet to one or more destinations.
void setNextSeqNum(uint32 seqNum)
For thoses cases in which the application requires a method to set the sequence number for the outgoi...
Definition: oqueue.h:518
void setPadding(uint8 paddinglen)
Set padding.
Definition: oqueue.h:320
uint16 sendSeq
Definition: oqueue.h:603
microtimeout_t getDefaultExpireTimeout() const
Definition: oqueue.h:368
bool getMark() const
Get wheter the mark bit will be set in the next packet.
Definition: oqueue.h:337
size_t dispatchDataPacket()
This function is used by the service thread to process the next outgoing packet pending in the sendin...
microtimeout_t getDefaultSchedulingTimeout() const
Definition: oqueue.h:354
bool addDestination(const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
void setSchedulingTimeout(microtimeout_t to)
Set the default scheduling timeout to use when no data packets are waiting to be sent.
Definition: oqueue.h:364
uint16 getSequenceNumber() const
Get the sequence number of the next outgoing packet.
Definition: oqueue.h:409
size_t setPartial(uint32 timestamp, unsigned char *data, size_t offset, size_t max)
Set partial data for an already queued packet.
bool complete
Definition: oqueue.h:615
uint8 paddinglen
Definition: oqueue.h:609
timeval overflowTime
Definition: oqueue.h:620
uint32 packetCount
Definition: oqueue.h:599
uint16 sendCC
Definition: oqueue.h:607
bool addDestination(const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
void putData(uint32 stamp, const unsigned char *data=NULL, size_t len=0)
This is used to create a data packet in the send queue.
void removeOutQueueCryptoContext(CryptoContext *cc)
Remove output queue CryptoContext.
void setMark(bool mark)
Set marker bit for the packet in which the next data provided will be send.
Definition: oqueue.h:331
void setExpireTimeout(microtimeout_t to)
Set the "expired" timer for expiring packets pending in the send queue which have gone unsent and are...
Definition: oqueue.h:379
bool forgetDestination(const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
bool marked
Definition: oqueue.h:613
std::list< CryptoContext * > cryptoContexts
Definition: oqueue.h:549
void setOutQueueCryptoContext(CryptoContext *cc)
Set ouput queue CryptoContext.
void sendImmediate(uint32 stamp, const unsigned char *data=NULL, size_t len=0)
This is used to create a data packet and send it immediately.
RTP packets being sent.
Definition: rtppkt.h:508
Base classes for RTP queues.
const InetAddress & getNetworkAddress() const
Definition: oqueue.h:116
InetAddress networkAddress
Definition: oqueue.h:125
TransportAddress(InetAddress na, tpport_t dtp, tpport_t ctp)
Definition: oqueue.h:111
tpport_t controlTransportPort
Definition: oqueue.h:126
tpport_t getDataTransportPort() const
Definition: oqueue.h:119
tpport_t getControlTransportPort() const
Definition: oqueue.h:122
void setPrev(OutgoingRTPPktLink *p)
Definition: oqueue.h:466
void setNext(OutgoingRTPPktLink *n)
Definition: oqueue.h:470
~OutgoingRTPPktLink()
Definition: oqueue.h:458
OutgoingRTPPkt * packet
Definition: oqueue.h:473
OutgoingRTPPktLink * getNext()
Definition: oqueue.h:468
OutgoingRTPPktLink * next
Definition: oqueue.h:475
OutgoingRTPPkt * getPacket()
Definition: oqueue.h:460
void setPacket(OutgoingRTPPkt *pkt)
Definition: oqueue.h:462
OutgoingRTPPktLink * getPrev()
Definition: oqueue.h:464
OutgoingRTPPktLink(OutgoingRTPPkt *pkt, OutgoingRTPPktLink *p, OutgoingRTPPktLink *n)
Definition: oqueue.h:453