Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
protocol_map.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 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_address/protocol_map.h
10//! @brief Protocol attributes map.
11
12#ifndef ROC_ADDRESS_PROTOCOL_MAP_H_
13#define ROC_ADDRESS_PROTOCOL_MAP_H_
14
18#include "roc_core/singleton.h"
19#include "roc_core/stddefs.h"
20#include "roc_packet/fec.h"
21
22namespace roc {
23namespace address {
24
25//! Protocol attributes.
27 //! Protocol ID.
29
30 //! Endpoint type.
32
33 //! Scheme name in URI.
34 const char* scheme_name;
35
36 //! Whether path is supported in URI.
38
39 //! Default port number of -1 if not specified.
41
42 //! FEC scheme associated wit the protocol, if any.
44
48 , scheme_name(NULL)
49 , path_supported(false)
50 , default_port(-1)
51 , fec_scheme(packet::FEC_None) {
52 }
53};
54
55//! Protocol attributes map.
57public:
58 //! Get instance.
61 }
62
63 //! Get protocol attributes by ID.
65
66 //! Get protocol attributes by scheme name.
67 const ProtocolAttrs* find_proto_by_scheme(const char* scheme) const;
68
69private:
70 friend class core::Singleton<ProtocolMap>;
71
72 enum { MaxProtos = 8 };
73
75
76 void add_proto_(const ProtocolAttrs&);
77
78 ProtocolAttrs protos_[MaxProtos];
79};
80
81} // namespace address
82} // namespace roc
83
84#endif // ROC_ADDRESS_PROTOCOL_MAP_H_
Protocol attributes map.
Definition: protocol_map.h:56
static ProtocolMap & instance()
Get instance.
Definition: protocol_map.h:59
const ProtocolAttrs * find_proto_by_id(Protocol proto) const
Get protocol attributes by ID.
const ProtocolAttrs * find_proto_by_scheme(const char *scheme) const
Get protocol attributes by scheme name.
Base class for non-copyable objects.
Definition: noncopyable.h:23
static T & instance()
Get singleton instance.
Definition: singleton.h:29
FEC packet.
Interface ID.
Interface
Interface ID.
Definition: interface.h:19
@ Iface_Invalid
Invalid interface.
Definition: interface.h:21
Protocol
Protocol ID.
Definition: protocol.h:19
@ Proto_None
Protocol is not set.
Definition: protocol.h:21
FecScheme
FECFRAME scheme.
Definition: fec.h:23
Root namespace.
Non-copyable object.
Protocol ID.
Singleton.
Commonly used types and functions.
Protocol attributes.
Definition: protocol_map.h:26
Protocol protocol
Protocol ID.
Definition: protocol_map.h:28
Interface iface
Endpoint type.
Definition: protocol_map.h:31
const char * scheme_name
Scheme name in URI.
Definition: protocol_map.h:34
packet::FecScheme fec_scheme
FEC scheme associated wit the protocol, if any.
Definition: protocol_map.h:43
bool path_supported
Whether path is supported in URI.
Definition: protocol_map.h:37
int default_port
Default port number of -1 if not specified.
Definition: protocol_map.h:40