44#ifndef CCXX_RTP_OQUEUE_H_
45#define CCXX_RTP_OQUEUE_H_
81 {
return (1 == destList.size()); }
84 {
return destList.front(); }
87 { destinationLock.readLock(); }
90 { destinationLock.unlock(); }
94 { destinationLock.writeLock(); }
108 tpport_t controlPort);
113 networkAddress(na), dataTransportPort(dtp),
114 controlTransportPort(ctp)
118 {
return networkAddress; }
121 {
return dataTransportPort; }
124 {
return controlTransportPort; }
131 mutable ThreadLock destinationLock;
143class __EXPORT DestinationListHandlerIPV6
146 struct TransportAddressIPV6;
147 std::list<TransportAddressIPV6*> destListIPV6;
150 DestinationListHandlerIPV6();
152 ~DestinationListHandlerIPV6();
157 inline bool isSingleDestinationIPV6()
const
158 {
return (1 == destListIPV6.size()); }
160 inline TransportAddressIPV6* getFirstDestinationIPV6()
const
161 {
return destListIPV6.front(); }
163 inline void lockDestinationListIPV6()
const
164 { destinationLock.readLock(); }
166 inline void unlockDestinationListIPV6()
const
167 { destinationLock.unlock(); }
170 inline void writeLockDestinationListIPV6()
const
171 { destinationLock.writeLock(); }
177 addDestinationToListIPV6(
const IPV6Address& ia, tpport_t data,
183 bool removeDestinationFromListIPV6(
const IPV6Address& ia,
185 tpport_t controlPort);
187 struct TransportAddressIPV6
189 TransportAddressIPV6(IPV6Address na, tpport_t dtp, tpport_t ctp) :
190 networkAddress(na), dataTransportPort(dtp),
191 controlTransportPort(ctp)
194 inline const IPV6Address& getNetworkAddress()
const
195 {
return networkAddress; }
197 inline tpport_t getDataTransportPort()
const
198 {
return dataTransportPort; }
200 inline tpport_t getControlTransportPort()
const
201 {
return controlTransportPort; }
203 IPV6Address networkAddress;
204 tpport_t dataTransportPort, controlTransportPort;
208 mutable ThreadLock destinationLock;
223 protected DestinationListHandlerIPV6,
230 addDestination(
const IPV6Address& ia,
232 tpport_t controlPort = 0);
235 forgetDestination(
const IPV6Address& ia,
237 tpport_t controlPort = 0);
244 tpport_t controlPort = 0);
249 tpport_t controlPort = 0);
254 tpport_t controlPort = 0);
259 tpport_t controlPort = 0);
297 putData(uint32 stamp,
const unsigned char* data = NULL,
size_t len = 0);
312 sendImmediate(uint32 stamp,
const unsigned char* data = NULL,
size_t len = 0);
322 { sendInfo.paddinglen = paddinglen; }
333 { sendInfo.marked = mark; }
339 {
return sendInfo.marked; }
352 setPartial(uint32 timestamp,
unsigned char* data,
size_t offset,
size_t max);
356 {
return defaultSchedulingTimeout; }
366 { schedulingTimeout = to; }
370 {
return defaultExpireTimeout; }
381 { expireTimeout = to; }
384 {
return expireTimeout; }
393 {
return sendInfo.packetCount; }
402 {
return sendInfo.octetCount; }
411 {
return sendInfo.sendSeq; }
457 packet(pkt), prev(p), next(n) { }
520 { sendInfo.sendSeq = seqNum; }
524 {
return sendInfo.sendSeq; }
530 { initialTimestamp = ts; }
536 {
return initialTimestamp; }
545 setControlPeerIPV6(
const IPV6Address &host, tpport_t port) {}
562 setDataPeer(
const InetAddress &host, tpport_t port) {}
566 setDataPeerIPV6(
const IPV6Address &host, tpport_t port) {}
579 sendData(
const unsigned char*
const buffer,
size_t len) {
return 0;}
583 sendDataIPV6(
const unsigned char*
const buffer,
size_t len) {
return 0;}
588 mutable ThreadLock sendLock;
590 OutgoingRTPPktLink* sendFirst, * sendLast;
591 uint32 initialTimestamp;
606 uint32 sendSources[16];
618 uint32 initialTimestamp;
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:68
const tpport_t DefaultRTPDataPort
registered default RTP data transport port
Definition: base.h:110
The implementation for a SRTP cryptographic context.
Definition: CryptoContext.h:83
This class handles a list of destination addresses.
Definition: oqueue.h:67
void writeLockDestinationList() const
Definition: oqueue.h:93
void unlockDestinationList() const
Definition: oqueue.h:89
~DestinationListHandler()
void lockDestinationList() const
Definition: oqueue.h:86
TransportAddress * getFirstDestination() const
Definition: oqueue.h:83
bool addDestinationToList(const InetAddress &ia, tpport_t data, tpport_t control)
Locks the object before modifying it.
std::list< TransportAddress * > destList
Definition: oqueue.h:70
bool isSingleDestination() const
Get whether there is only a destination in the list.
Definition: oqueue.h:80
bool removeDestinationFromList(const InetAddress &ia, tpport_t dataPort, tpport_t controlPort)
Locks the object before modifying it.
Definition: queuebase.h:257
A generic outgoing RTP data queue supporting multiple destinations.
Definition: oqueue.h:226
void setInitialTimestamp(uint32 ts)
Definition: oqueue.h:529
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:541
void addContributor(uint32 csrc)
Add csrc as the CSRC identifier of a new contributor.
uint32 getCurrentSeqNum(void)
Definition: oqueue.h:523
uint32 getInitialTimestamp()
Definition: oqueue.h:535
virtual ~OutgoingDataQueue()
Definition: oqueue.h:449
uint32 octetCount
Definition: oqueue.h:602
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:383
uint32 getSendPacketCount() const
Get the total number of packets sent so far.
Definition: oqueue.h:392
void purgeOutgoingQueue()
Mutex cryptoMutex
Definition: oqueue.h:549
uint32 getSendOctetCount() const
Get the total number of octets (payload only) sent so far.
Definition: oqueue.h:401
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:519
void setPadding(uint8 paddinglen)
Set padding.
Definition: oqueue.h:321
uint16 sendSeq
Definition: oqueue.h:604
microtimeout_t getDefaultExpireTimeout() const
Definition: oqueue.h:369
bool getMark() const
Get whether the mark bit will be set in the next packet.
Definition: oqueue.h:338
CryptoContext * getOutQueueCryptoContext(uint32 ssrc)
Get an output queue CryptoContext identified by SSRC.
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:355
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:365
uint16 getSequenceNumber() const
Get the sequence number of the next outgoing packet.
Definition: oqueue.h:410
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:616
uint8 paddinglen
Definition: oqueue.h:610
timeval overflowTime
Definition: oqueue.h:621
uint32 packetCount
Definition: oqueue.h:600
uint16 sendCC
Definition: oqueue.h:608
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:332
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:380
bool forgetDestination(const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
bool marked
Definition: oqueue.h:614
std::list< CryptoContext * > cryptoContexts
Definition: oqueue.h:550
void setOutQueueCryptoContext(CryptoContext *cc)
Set output 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:509
Base classes for RTP queues.
InetAddress networkAddress
Definition: oqueue.h:126
const InetAddress & getNetworkAddress() const
Definition: oqueue.h:117
TransportAddress(InetAddress na, tpport_t dtp, tpport_t ctp)
Definition: oqueue.h:112
tpport_t controlTransportPort
Definition: oqueue.h:127
tpport_t getDataTransportPort() const
Definition: oqueue.h:120
tpport_t getControlTransportPort() const
Definition: oqueue.h:123
void setPrev(OutgoingRTPPktLink *p)
Definition: oqueue.h:467
void setNext(OutgoingRTPPktLink *n)
Definition: oqueue.h:471
OutgoingRTPPkt * getPacket()
Definition: oqueue.h:461
~OutgoingRTPPktLink()
Definition: oqueue.h:459
OutgoingRTPPkt * packet
Definition: oqueue.h:474
OutgoingRTPPktLink * next
Definition: oqueue.h:476
OutgoingRTPPktLink * getPrev()
Definition: oqueue.h:465
void setPacket(OutgoingRTPPkt *pkt)
Definition: oqueue.h:463
OutgoingRTPPktLink(OutgoingRTPPkt *pkt, OutgoingRTPPktLink *p, OutgoingRTPPktLink *n)
Definition: oqueue.h:454
OutgoingRTPPktLink * getNext()
Definition: oqueue.h:469