Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
cname.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_rtcp/cname.h
10 //! @brief CNAME utilities.
11 
12 #ifndef ROC_RTCP_CNAME_H_
13 #define ROC_RTCP_CNAME_H_
14 
15 #include "roc_core/noncopyable.h"
16 #include "roc_rtcp/headers.h"
17 
18 namespace roc {
19 namespace rtcp {
20 
21 //! Maximum allowed CNAME length.
22 static const size_t MaxCnameLen = header::MaxTextLen;
23 
24 //! Get printable representation of CNAME.
25 class cname_to_str : public core::NonCopyable<> {
26 public:
27  //! Construct from custom error code.
28  explicit cname_to_str(const char* cname);
29 
30  //! Get error message.
31  const char* c_str() const {
32  return buffer_;
33  }
34 
35 private:
36  char buffer_[MaxCnameLen * 3 + 4];
37 };
38 
39 } // namespace rtcp
40 } // namespace roc
41 
42 #endif // ROC_RTCP_CNAME_H_
Base class for non-copyable objects.
Definition: noncopyable.h:23
Get printable representation of CNAME.
Definition: cname.h:25
const char * c_str() const
Get error message.
Definition: cname.h:31
cname_to_str(const char *cname)
Construct from custom error code.
Root namespace.
Non-copyable object.
RTCP headers.