43 #ifndef CCXX_RTP_OQUEUE_H_
44 #define CCXX_RTP_OQUEUE_H_
69 std::list<TransportAddress*>
destList;
80 {
return (1 == destList.size()); }
83 {
return destList.front(); }
86 { destinationLock.readLock(); }
89 { destinationLock.unlock(); }
93 { destinationLock.writeLock(); }
99 addDestinationToList(
const InetAddress& ia, tpport_t data,
105 bool removeDestinationFromList(
const InetAddress& ia,
107 tpport_t controlPort);
112 networkAddress(na), dataTransportPort(dtp),
113 controlTransportPort(ctp)
117 {
return networkAddress; }
120 {
return dataTransportPort; }
123 {
return controlTransportPort; }
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);
241 addDestination(
const InetHostAddress& ia,
243 tpport_t controlPort = 0);
246 addDestination(
const InetMcastAddress& ia,
248 tpport_t controlPort = 0);
251 forgetDestination(
const InetHostAddress& ia,
253 tpport_t controlPort = 0);
256 forgetDestination(
const InetMcastAddress& ia,
258 tpport_t controlPort = 0);
266 addContributor(uint32 csrc);
272 removeContributor(uint32 csrc);
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; }
442 getOutQueueCryptoContext(uint32 ssrc);
456 packet(pkt), prev(p), next(n) { }
498 getSchedulingTimeout();
507 dispatchDataPacket();
519 { sendInfo.sendSeq = seqNum; }
523 {
return sendInfo.sendSeq; }
529 { initialTimestamp = ts; }
535 {
return initialTimestamp; }
537 void purgeOutgoingQueue();
544 setControlPeerIPV6(
const IPV6Address &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;}
605 uint32 sendSources[16];
617 uint32 initialTimestamp;
628 #endif //CCXX_RTP_OQUEUE_H_
uint32 getSendPacketCount() const
Get the total number of packets sent so far.
uint32 getSendOctetCount() const
Get the total number of octets (payload only) sent so far.
void setPrev(OutgoingRTPPktLink *p)
void setMark(bool mark)
Set marker bit for the packet in which the next data provided will be send.
virtual size_t sendData(const unsigned char *const buffer, size_t len)
This function performs the physical I/O for writing a packet to the destination.
void setSchedulingTimeout(microtimeout_t to)
Set the default scheduling timeout to use when no data packets are waiting to be sent.
void setNext(OutgoingRTPPktLink *n)
bool getMark() const
Get wheter the mark bit will be set in the next packet.
The implementation for a SRTP cryptographic context.
ThreadLock destinationLock
void writeLockDestinationList() const
uint32 microtimeout_t
Time interval expressed in microseconds.
uint32 getCurrentSeqNum(void)
tpport_t dataTransportPort
std::list< TransportAddress * > destList
microtimeout_t expireTimeout
OutgoingRTPPkt * getPacket()
This class handles a list of destination addresses.
void lockDestinationList() const
microtimeout_t getDefaultExpireTimeout() const
void setNextSeqNum(uint32 seqNum)
For thoses cases in which the application requires a method to set the sequence number for the outgoi...
std::list< CryptoContext * > cryptoContexts
OutgoingRTPPktLink * getPrev()
TransportAddress * getFirstDestination() const
uint32 getInitialTimestamp()
virtual void onExpireSend(OutgoingRTPPkt &)
A hook to filter packets being sent that have been expired.
OutgoingRTPPktLink(OutgoingRTPPkt *pkt, OutgoingRTPPktLink *p, OutgoingRTPPktLink *n)
void setPadding(uint8 paddinglen)
Set padding.
OutgoingRTPPktLink * sendLast
Base classes for RTP queues.
microtimeout_t getDefaultSchedulingTimeout() const
InetAddress networkAddress
virtual void setControlPeer(const InetAddress &host, tpport_t port)
static const microtimeout_t defaultSchedulingTimeout
Schedule at 8 ms.
const tpport_t DefaultRTPDataPort
registered default RTP data transport port
microtimeout_t schedulingTimeout
void setInitialTimestamp(uint32 ts)
tpport_t getControlTransportPort() const
const InetAddress & getNetworkAddress() const
uint16 getSequenceNumber() const
Get the sequence number of the next outgoing packet.
tpport_t getDataTransportPort() const
virtual ~OutgoingDataQueue()
static const microtimeout_t defaultExpireTimeout
Packets unsent will expire after 40 ms.
TransportAddress(InetAddress na, tpport_t dtp, tpport_t ctp)
void setExpireTimeout(microtimeout_t to)
Set the "expired" timer for expiring packets pending in the send queue which have gone unsent and are...
virtual void setDataPeer(const InetAddress &host, tpport_t port)
bool isSingleDestination() const
Get whether there is only a destination in the list.
OutgoingRTPPktLink * prev
void setPacket(OutgoingRTPPkt *pkt)
A generic outgoing RTP data queue supporting multiple destinations.
OutgoingRTPPktLink * getNext()
microtimeout_t getExpireTimeout() const
void unlockDestinationList() const