Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
identity.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_rtp/identity.h
10 //! @brief RTP participant identity.
11 
12 #ifndef ROC_RTP_IDENTITY_H_
13 #define ROC_RTP_IDENTITY_H_
14 
15 #include "roc_core/noncopyable.h"
16 #include "roc_core/uuid.h"
17 #include "roc_packet/units.h"
18 
19 namespace roc {
20 namespace rtp {
21 
22 //! RTP participant identity.
23 class Identity : public core::NonCopyable<> {
24 public:
25  //! Initialize.
27 
28  //! Check if was constructed successfully.
29  bool is_valid() const;
30 
31  //! Get generated CNAME.
32  //! Uniquely identifies participant across all RTP sessions.
33  //! It is expected that collisions are not practi cally possible.
34  const char* cname() const;
35 
36  //! Get generated SSRC.
37  //! Uniquely identifies participant within RTP session.
38  //! It is expected that collisions are possible and should be resolved.
40 
41  //! Regenerate SSRC.
42  //! Used in case of SSRC collision.
43  bool change_ssrc();
44 
45 private:
46  char cname_[core::UuidLen + 1];
48  bool valid_;
49 };
50 
51 } // namespace rtp
52 } // namespace roc
53 
54 #endif // ROC_RTP_IDENTITY_H_
Base class for non-copyable objects.
Definition: noncopyable.h:23
RTP participant identity.
Definition: identity.h:23
const char * cname() const
Get generated CNAME. Uniquely identifies participant across all RTP sessions. It is expected that col...
packet::stream_source_t ssrc() const
Get generated SSRC. Uniquely identifies participant within RTP session. It is expected that collision...
bool change_ssrc()
Regenerate SSRC. Used in case of SSRC collision.
Identity()
Initialize.
bool is_valid() const
Check if was constructed successfully.
@ UuidLen
Number of characters in UUID string.
Definition: uuid.h:22
uint32_t stream_source_t
Packet stream identifier.
Definition: units.h:27
Root namespace.
Non-copyable object.
Various units used in packets.
UUID generation.