52 destList(), destinationLock()
59 for (std::list<TransportAddress*>::iterator i =
destList.begin();
62 #ifdef CCXX_EXCEPTIONS
66 #ifdef CCXX_EXCEPTIONS
75 tpport_t data, tpport_t control)
86 tpport_t dataPort, tpport_t controlPort)
91 for (std::list<TransportAddress*>::iterator i =
destList.begin();
111 DestinationListHandlerIPV6::DestinationListHandlerIPV6() :
112 destListIPV6(), destinationLock()
115 DestinationListHandlerIPV6::~DestinationListHandlerIPV6()
117 TransportAddressIPV6* tmp = NULL;
118 writeLockDestinationListIPV6();
119 for (std::list<TransportAddressIPV6*>::iterator i = destListIPV6.begin();
120 destListIPV6.end() != i; i++) {
122 #ifdef CCXX_EXCEPTIONS
126 #ifdef CCXX_EXCEPTIONS
130 unlockDestinationListIPV6();
134 DestinationListHandlerIPV6::addDestinationToListIPV6(
const IPV6Address& ia,
135 tpport_t data, tpport_t control)
137 TransportAddressIPV6* addr =
new TransportAddressIPV6(ia,data,control);
138 writeLockDestinationListIPV6();
139 destListIPV6.push_back(addr);
140 unlockDestinationListIPV6();
145 DestinationListHandlerIPV6::removeDestinationFromListIPV6(
const IPV6Address& ia,
146 tpport_t dataPort, tpport_t controlPort)
149 writeLockDestinationListIPV6();
150 TransportAddressIPV6* tmp;
151 for (std::list<TransportAddressIPV6*>::iterator i = destListIPV6.begin();
152 destListIPV6.end() != i && !result; ) {
154 if ( ia == tmp->getNetworkAddress() &&
155 dataPort == tmp->getDataTransportPort() &&
156 controlPort == tmp->getControlTransportPort() ) {
159 destListIPV6.erase(i);
165 unlockDestinationListIPV6();
180 DestinationListHandlerIPV6(),
220 tpport_t dataPort, tpport_t controlPort)
222 if ( 0 == controlPort )
223 controlPort = dataPort + 1;
234 tpport_t dataPort, tpport_t controlPort)
236 if ( 0 == controlPort )
237 controlPort = dataPort + 1;
248 tpport_t dataPort, tpport_t controlPort)
250 if ( 0 == controlPort )
251 controlPort = dataPort + 1;
258 tpport_t dataPort, tpport_t controlPort)
260 if ( 0 == controlPort )
261 controlPort = dataPort + 1;
269 tpport_t dataPort, tpport_t controlPort)
271 if ( 0 == controlPort )
272 controlPort = dataPort + 1;
273 bool result = addDestinationToListIPV6(ia,dataPort,controlPort);
274 if ( result && isSingleDestinationIPV6() ) {
275 setDataPeerIPV6(ia,dataPort);
276 setControlPeerIPV6(ia,controlPort);
283 tpport_t dataPort, tpport_t controlPort)
285 if ( 0 == controlPort )
286 controlPort = dataPort + 1;
287 return DestinationListHandlerIPV6::
288 removeDestinationFromListIPV6(ia,dataPort,controlPort);
305 struct timeval send, now;
323 send.tv_sec = stamp / rate;
325 send.tv_usec = (1000ul*rem) / (rate/1000ul);
330 timeradd(&send,&(
sendInfo.overflowTime),&send);
331 SysTime::gettimeofday(&now, NULL);
346 if ( now.tv_sec - send.tv_sec > 5000) {
348 overflow.tv_sec =(~static_cast<uint32>(0)) / rate;
349 overflow.tv_usec = (~static_cast<uint32>(0)) % rate *
352 timeradd(&send,&overflow,&send);
353 timeradd(&(
sendInfo.overflowTime),&overflow,
355 }
while ( now.tv_sec - send.tv_sec > 5000 );
361 if ( send.tv_sec - now.tv_sec > 20000 ) {
363 overflow.tv_sec = (~static_cast<uint32>(0)) / rate;
364 overflow.tv_usec = (~static_cast<uint32>(0)) % rate *
366 timersub(&send,&overflow,&send);
370 if ( send.tv_sec - now.tv_sec > 3600 ) {
374 ((send.tv_sec - now.tv_sec) * 1000000ul) +
375 send.tv_usec - now.tv_usec;
406 if ( !data || !datalen )
409 size_t step = 0, offset = 0;
410 while ( offset < datalen ) {
413 size_t remainder = datalen - offset;
439 if ( (0 == offset) &&
getMark() ) {
466 if ( !data || !datalen )
469 size_t step = 0, offset = 0;
470 while ( offset < datalen ) {
473 size_t remainder = datalen - offset;
490 if ( (0 == offset) &&
getMark() ) {
516 for (std::list<TransportAddress*>::iterator i =
destList.begin();
destList.end() != i; i++) {
525 lockDestinationListIPV6();
526 if ( isSingleDestinationIPV6() ) {
527 TransportAddressIPV6* tmp6 = destListIPV6.front();
529 setDataPeerIPV6(tmp6->getNetworkAddress(),
530 tmp6->getDataTransportPort());
536 for (std::list<TransportAddressIPV6*>::iterator i6 = destListIPV6.begin(); destListIPV6.end() != i6; i6++) {
537 TransportAddressIPV6* dest6 = *i6;
538 setDataPeerIPV6(dest6->getNetworkAddress(),
539 dest6->getDataTransportPort());
544 unlockDestinationListIPV6();
582 size_t offset,
size_t max)
589 if ( pstamp > stamp ) {
592 }
else if ( pstamp == stamp ) {
596 packetLink = packetLink->
getNext();
610 memcpy((
unsigned char*)(packet->
getPayload()) + offset,
619 std::list<CryptoContext *>::iterator i;
625 if( (*i)->getSsrc() == cc->
getSsrc() ) {
638 std::list<CryptoContext *>::iterator i;
650 if( (*i)->getSsrc() == cc->
getSsrc() ) {
663 std::list<CryptoContext *>::iterator i;
667 if( (*i)->getSsrc() == ssrc) {
void setPrev(OutgoingRTPPktLink *p)
microtimeout_t getSchedulingTimeout()
This computes the timeout period for scheduling transmission of the next packet at the "head" of the ...
void setMarker(bool mark)
Specify the value of the marker bit.
void setMark(bool mark)
Set marker bit for the packet in which the next data provided will be send.
CryptoContext * getOutQueueCryptoContext(uint32 ssrc)
Get an output queue CryptoContext identified by SSRC.
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.
void writeLockDestinationList() const
uint32 microtimeout_t
Time interval expressed in microseconds.
void setOutQueueCryptoContext(CryptoContext *cc)
Set ouput queue CryptoContext.
std::list< TransportAddress * > destList
size_t getDefaultMaxSendSegmentSize()
OutgoingRTPPkt * getPacket()
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.
This class handles a list of destination addresses.
PayloadType getCurrentPayloadType() const
timeval getInitialTime() const
void lockDestinationList() const
void setSeqNum(uint16 seq)
Sets the sequence number in the header.
size_t setPartial(uint32 timestamp, unsigned char *data, size_t offset, size_t max)
Set partial data for an already queued packet.
Declaration of ccRTP internal stuff.
size_t dispatchDataPacket()
This function is used by the service thread to process the next outgoing packet pending in the sendin...
microtimeout_t getDefaultExpireTimeout() const
void dispatchImmediate(OutgoingRTPPkt *packet)
This is used to write the RTP data packet to one or more destinations.
void setSSRCNetwork(uint32 ssrc) const
Set synchronization source numeric identifier.
std::list< CryptoContext * > cryptoContexts
bool isSending() const
Determine if outgoing packets are waiting to send.
uint32 getInitialTimestamp()
virtual void onExpireSend(OutgoingRTPPkt &)
A hook to filter packets being sent that have been expired.
uint32 getTimestamp() const
bool addDestinationToList(const InetAddress &ia, tpport_t data, tpport_t control)
Locks the object before modifying it.
const uint8 *const getPayload() const
bool removeDestinationFromList(const InetAddress &ia, tpport_t dataPort, tpport_t controlPort)
Locks the object before modifying it.
bool forgetDestination(const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
Generic RTP output queues.
CryptoContext * newCryptoContextForSSRC(uint32 ssrc, int roc, int64 keyDerivRate)
Derive a new Crypto Context for use with a new SSRC.
OutgoingRTPPktLink * sendLast
~DestinationListHandler()
void purgeOutgoingQueue()
struct OutgoingDataQueue::@4 sendInfo
microtimeout_t getDefaultSchedulingTimeout() const
void setMaxSendSegmentSize(size_t size)
Set maximum payload segment size before fragmenting sends.
virtual void setControlPeer(const InetAddress &host, tpport_t port)
static const microtimeout_t defaultSchedulingTimeout
Schedule at 8 ms.
const unsigned char *const getRawPacket() const
Get the raw packet as it will be sent through the network.
size_t getMaxSendSegmentSize()
microtimeout_t schedulingTimeout
void setInitialTimestamp(uint32 ts)
uint32 getLocalSSRCNetwork() const
tpport_t getControlTransportPort() const
const InetAddress & getNetworkAddress() const
void removeOutQueueCryptoContext(CryptoContext *cc)
Remove output queue CryptoContext.
tpport_t getDataTransportPort() const
uint32 getPayloadSize() const
bool addDestination(const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
uint32 getLocalSSRC() const
void setTimestamp(uint32 pts)
void setPayloadType(PayloadType pt)
void deriveSrtpKeys(uint64 index)
Perform key derivation according to SRTP specification.
uint32 getSsrc() const
Get the SSRC of this SRTP Cryptograhic context.
OutgoingRTPPktLink * sendFirst
static const microtimeout_t defaultExpireTimeout
Packets unsent will expire after 40 ms.
uint32 getRawPacketSizeSrtp() const
uint32 getCurrentRTPClockRate() const
Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T).
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.
void setExpireTimeout(microtimeout_t to)
Set the "expired" timer for expiring packets pending in the send queue which have gone unsent and are...
void protect(uint32 ssrc, CryptoContext *pcc)
Called packet is setup.
virtual void setDataPeer(const InetAddress &host, tpport_t port)
bool isSingleDestination() const
Get whether there is only a destination in the list.
static const size_t defaultMaxSendSegmentSize
OutgoingRTPPktLink * getNext()
microtimeout_t getExpireTimeout() const
void unlockDestinationList() const