1 // Copyright (C) 2001-2015 Federico Montesino Pouzols <fedemp@altern.org>.
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 Lesser General Public License
14 // along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // As a special exception, you may use this file as part of a free software
17 // library without restriction. Specifically, if other files instantiate
18 // templates or use macros or inline functions from this file, or you compile
19 // this file and link it with other files to produce an executable, this
20 // file does not by itself cause the resulting executable to be covered by
21 // the GNU General Public License. This exception does not however
22 // invalidate any other reasons why the executable file might be covered by
23 // the GNU General Public License.
24 //
25 // This exception applies only to the code released under the name GNU
26 // ccRTP. If you copy code from other releases into a copy of GNU
27 // ccRTP, as the General Public License permits, the exception does
28 // not apply to the code that you add in this way. To avoid misleading
29 // anyone as to the status of such modified files, you must delete
30 // this exception notice from them.
31 //
32 // If you write modifications of your own for GNU ccRTP, it is your choice
33 // whether to permit this exception to apply to your modifications.
34 // If you do not wish that, delete this exception notice.
35 //
36
43 #ifndef CCXX_RTP_SOURCES_H_
44 #define CCXX_RTP_SOURCES_H_
45
46 #include <string>
48
49 NAMESPACE_COMMONCPP
50
65 {
66 public:
67 const std::string&
69
70 inline const std::string&
73
74 void
76
77 inline void
80
81 protected:
83 { }
84
86 { }
87
88 private:
89 // SDES items for a participant.
90 // sdesItems[0] (== sdesItems[SDESItemTypeEND]) holds the prefix
91 // value for the PRIV item. The rest of entries hold the
92 // correponding SDES item value.
94 };
95
125 {
126 public:
139 const std::string&
142
150 inline const std::string&
153
160
162
163 private:
165
169 inline void
172
176 inline void
179 };
180
193 {
194 public:
228 stateActive,
231 stateInactive,
233 stateLeaving
236 } State;
238
244
246
247 State
249 { return state; }
250
255 { return activeSender; }
256
258 { return SSRC; }
259
269 { return participant; }
270
272 { return dataTransportPort; }
273
275 { return controlTransportPort; }
276
278 { return networkAddress; }
279
280 protected:
285
288
289 private:
291
292 inline void
294 { state = st; }
295
299 inline void
301 { activeSender = active; }
302
303 inline void
305 { participant = &p; }
306
308 { dataTransportPort = p; }
309
311 { controlTransportPort = p; }
312
314 { networkAddress = addr; }
315
316 inline void
318 { link = l; }
319
321 { return link; }
322
323 // validity state of this source
325 // 32-bit SSRC identifier.
327 // A valid source not always is active
329 // The corresponding participant.
331
332 // Network protocol address for data and control connection
333 // (both are assumed to be the same).
337
338 // Pointer to the SyncSourceLink or similar object in the
339 // service queue. Saves a lot of searches in the membership
340 // table.
342 };
343
365 {
366 private:
368
369 public:
378
380
381 inline void
384
385 inline void
388
389 const std::string&
392
393 inline const std::string&
396
402 {
403 public:
409
411 link(p)
412 { }
413
415 link(pi.link)
416 { }
417
419 { return *(link->getParticipant()); }
420
422 { return link->getParticipant(); }
423
425 link = link->getNext();
426 return *this;
427 }
428
431 ++(*this);
432 return result;
433 }
437
441 private:
443 };
444
447
450
452 getParticipant(const std::string& cname) const;
453
454 private:
456
460 participant(&p), next(l)
461 { }
470 };
471
472 void
474
475 void
477
482 void
483 findCNAME();
484
490 };
491
502 // sources
504
505 END_NAMESPACE
506
507 #endif //CCXX_RTP_SOURCES_H_
508
const Participant * pointer
friend bool operator!=(const ParticipantsIterator &l, const ParticipantsIterator &r)
void setPrev(ParticipantLink *l)
void setPRIVPrefix(const std::string &val)
ParticipantLink * lastPart
const std::string & getPRIVPrefix() const
const std::string & getItem(SDESItemType type) const
tpport_t getDataTransportPort() const
An RTP application, holding identifying RTCP SDES item values.
Synchronization source in an RTP session.
void setParticipant(Participant &p)
ParticipantsIterator operator++(int)
Participant * participant
void setControlTransportPort(tpport_t p)
No valid packet has been received.
ParticipantLink * getNext()
ParticipantsIterator begin()
ParticipantLink * getPrev()
InetAddress networkAddress
Participant * getParticipant()
ParticipantsIterator(ParticipantLink *p=NULL)
const Participant & reference
Participant objects modification methods.
std::forward_iterator_tag iterator_category
State
Synchronization source states during an RTP session.
Application objects modification methods.
A class of objects representing remote participants (RTP applications) in a multimedia session...
void setItem(SDESItemType item, const std::string &val)
ParticipantsIterator end()
tpport_t controlTransportPort
ParticipantsIterator(const ParticipantsIterator &pi)
virtual ~SDESItemsHolder()
Participant * getParticipant() const
Get the participant this synchronization source is asociated to.
void setSDESItem(SDESItemType item, const std::string &val)
reference operator*() const
const InetAddress & getNetworkAddress() const
Iterator through the list of participants in this session.
void setSender(bool active)
Mark this source as an active sender.
ParticipantLink(Participant &p, ParticipantLink *l)
tpport_t getControlTransportPort() const
bool isSender() const
Whether this source sends RTP data packets.
Holds the SDES items and related information from a participant in an RTP application.
const std::string & getPRIVPrefix() const
friend bool operator==(const ParticipantsIterator &l, const ParticipantsIterator &r)
tpport_t dataTransportPort
void setPRIVPrefix(const std::string &val)
Participant * participant
static const size_t defaultParticipantsNum
Hash table with sources of RTP and RTCP packets.
Participant ** participants
void setDataTransportPort(tpport_t p)
const std::string & getSDESItem(SDESItemType item) const
SyncSource objects modification methods.
pointer operator->() const
__EXPORT RTPApplication & defaultApplication()
Get the RTPApplication object for the "default" application (the only one used by common applications...
void setPRIVPrefix(const std::string val)
Set prefix value for the PRIV SDES item.
void setNext(ParticipantLink *l)
const std::string & getPRIVPrefix() const
Get the prefix value for the PRIV SDES item.
SDESItemType
SDES items that may be carried in a Source DEScription RTCP packet.
const std::string & getSDESItem(SDESItemType type) const
Get the value of an SDES item.
void setSDESItem(SDESItemType item, const std::string &val)
Set the value of a SDES item.
void setNetworkAddress(InetAddress addr)
std::ptrdiff_t difference_type
ParticipantsIterator & operator++()