1 // Copyright (C) 2001,2002,2003,2004 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 General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // As a special exception, you may use this file as part of a free software
18 // library without restriction. Specifically, if other files instantiate
19 // templates or use macros or inline functions from this file, or you compile
20 // this file and link it with other files to produce an executable, this
21 // file does not by itself cause the resulting executable to be covered by
22 // the GNU General Public License. This exception does not however
23 // invalidate any other reasons why the executable file might be covered by
24 // the GNU General Public License.
25 //
26 // This exception applies only to the code released under the name GNU
27 // ccRTP. If you copy code from other releases into a copy of GNU
28 // ccRTP, as the General Public License permits, the exception does
29 // not apply to the code that you add in this way. To avoid misleading
30 // anyone as to the status of such modified files, you must delete
31 // this exception notice from them.
32 //
33 // If you write modifications of your own for GNU ccRTP, it is your choice
34 // whether to permit this exception to apply to your modifications.
35 // If you do not wish that, delete this exception notice.
36 //
37
44 #ifndef CCXX_RTP_SOURCES_H_
45 #define CCXX_RTP_SOURCES_H_
46
47 #include <string>
49
50 #ifdef CCXX_NAMESPACES
51 namespace ost {
52 #endif
53
68 {
69 public:
70 const std::string&
72
73 inline const std::string&
76
77 void
79
80 inline void
83
84 protected:
86 { }
87
89 { }
90
91 private:
92 // SDES items for a participant.
93 // sdesItems[0] (== sdesItems[SDESItemTypeEND]) holds the prefix
94 // value for the PRIV item. The rest of entries hold the
95 // correponding SDES item value.
97 };
98
128 {
129 public:
142 const std::string&
145
153 inline const std::string&
156
163
165
166 private:
168
172 inline void
175
179 inline void
182 };
183
196 {
197 public:
231 stateActive,
234 stateInactive,
236 stateLeaving
239 } State;
241
247
249
250 State
252 { return state; }
253
258 { return activeSender; }
259
261 { return SSRC; }
262
272 { return participant; }
273
275 { return dataTransportPort; }
276
278 { return controlTransportPort; }
279
281 { return networkAddress; }
282
283 protected:
288
291
292 private:
294
295 inline void
297 { state = st; }
298
302 inline void
304 { activeSender = active; }
305
306 inline void
308 { participant = &p; }
309
311 { dataTransportPort = p; }
312
314 { controlTransportPort = p; }
315
317 { networkAddress = addr; }
318
319 inline void
321 { link = l; }
322
324 { return link; }
325
326 // validity state of this source
328 // 32-bit SSRC identifier.
330 // A valid source not always is active
332 // The corresponding participant.
334
335 // Network protocol address for data and control connection
336 // (both are assumed to be the same).
340
341 // Pointer to the SyncSourceLink or similar object in the
342 // service queue. Saves a lot of searches in the membership
343 // table.
345 };
346
368 {
369 private:
371
372 public:
381
383
384 inline void
387
388 inline void
391
392 const std::string&
395
396 inline const std::string&
399
405 {
406 public:
412
414 link(p)
415 { }
416
418 link(pi.link)
419 { }
420
422 { return *(link->getParticipant()); }
423
425 { return link->getParticipant(); }
426
428 link = link->getNext();
429 return *this;
430 }
431
434 ++(*this);
435 return result;
436 }
440
444 private:
446 };
447
450
453
455 getParticipant(const std::string& cname) const;
456
457 private:
459
463 participant(&p), next(l)
464 { }
473 };
474
475 void
477
478 void
480
485 void
486 findCNAME();
487
493 };
494
505 // sources
507
508 #ifdef CCXX_NAMESPACES
509 }
510 #endif
511
512 #endif //CCXX_RTP_SOURCES_H_
513
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
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.
ptrdiff_t difference_type
ParticipantLink * getNext()
ParticipantsIterator begin()
unsigned short tpport_t
Transport Protocol Ports.
ParticipantLink * getPrev()
InetAddress networkAddress
Participant * getParticipant()
ParticipantsIterator(ParticipantLink *p=NULL)
const Participant & reference
Participant objects modification methods.
std::forward_iterator_tag iterator_category
const std::string & getItem(SDESItemType type) const
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)
ParticipantsIterator & operator++()