MQTT-SN Gateway Library
Library that allows implementation of MQTT-SN gateway.
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
cc_mqttsn_gateway::Config Class Reference

Detailed Description

Interface for Config entity.

The responsibility of the Config object is to to provide a common way to parse the configuration file and provide a convenient interface to retrieve any configuration values, which can later be applied to the Gateway and/or Session objects.

Classes

struct  AuthInfo
 Authentication info for single client. More...
 
struct  PredefinedTopicInfo
 Info about single predefined topic. More...
 

Public Types

enum  ClientConnectionType { ClientConnectionType_Udp , ClientConnectionType_ValuesLimit }
 Client I/O socket connection type. More...
 
enum  BrokerConnectionType { BrokerConnectionType_Tcp , BrokerConnectionType_ValuesLimit }
 Broker I/O socket connection type. More...
 
using ConfigMap = std::multimap< std::string, std::string >
 Full configuration map.
 
using BinaryData = std::vector< std::uint8_t >
 Type of buffer that contains binary data.
 
using PredefinedTopicsList = std::vector< PredefinedTopicInfo >
 Type of list containing predefined topics.
 
using AuthInfosList = std::vector< AuthInfo >
 Type of list containing authentication information for multiple clients.
 
using TopicIdsRange = std::pair< std::uint16_t, std::uint16_t >
 Range of topic IDs.
 

Public Member Functions

 Config ()
 Constructor.
 
 ~Config ()
 Destructor.
 
void read (std::istream &stream)
 Read configuration from input stream.
 
const ConfigMapconfigMap () const
 Get access to the full configuration map.
 
std::uint8_t gatewayId () const
 Get gateway numeric ID.
 
std::uint16_t advertisePeriod () const
 Get advertise period.
 
unsigned retryPeriod () const
 Get retry period.
 
unsigned retryCount () const
 Get number of retry attempts.
 
const std::string & defaultClientId () const
 Get default client ID.
 
std::uint16_t pubOnlyKeepAlive () const
 Get keep alive period for publish only clients.
 
std::size_t sleepingClientMsgLimit () const
 Get limit for max number of messages to accumulate for sleeping clients.
 
const PredefinedTopicsListpredefinedTopics () const
 Get access to the list of predefined topics.
 
const AuthInfosListauthInfos () const
 Get access to list of authentication informations.
 
TopicIdsRange topicIdAllocRange () const
 Get range of allowed topic IDs for allocation.
 
const std::string & brokerTcpHostAddress () const
 Get TCP/IP address of the broker.
 
std::uint16_t brokerTcpHostPort () const
 Get TCP/IP port of the broker.
 
const std::string & logFile () const
 Get log file.
 
ClientConnectionType clientConnectionType () const
 Get client side I/O socket connection type.
 
BrokerConnectionType brokerConnectionType () const
 Get broker side I/O socket connection type.
 

Member Typedef Documentation

◆ ConfigMap

using cc_mqttsn_gateway::Config::ConfigMap = std::multimap<std::string, std::string>

Full configuration map.

The key is the first word in the configuration line, and the value is rest of the string until the end of the line. NOTE, that the type is multimap, which allows multiple entries with the same key.

◆ TopicIdsRange

using cc_mqttsn_gateway::Config::TopicIdsRange = std::pair<std::uint16_t, std::uint16_t>

Range of topic IDs.

First element of the pair is minimal ID, and second element of the pair is maximal ID.

Member Enumeration Documentation

◆ BrokerConnectionType

Broker I/O socket connection type.

Enumerator
BrokerConnectionType_Tcp 

TCP/IP.

BrokerConnectionType_ValuesLimit 

Limit to available values, must be last.

◆ ClientConnectionType

Client I/O socket connection type.

Enumerator
ClientConnectionType_Udp 

UDP/IP.

ClientConnectionType_ValuesLimit 

Limit to available values, must be last.

Member Function Documentation

◆ advertisePeriod()

std::uint16_t cc_mqttsn_gateway::Config::advertisePeriod ( ) const

Get advertise period.

Default value is 900 seconds (15 minutes).

Returns
Advertise period in seconds.

◆ brokerConnectionType()

BrokerConnectionType cc_mqttsn_gateway::Config::brokerConnectionType ( ) const

Get broker side I/O socket connection type.

Default value is BrokerConnectionType_Tcp

◆ brokerTcpHostAddress()

const std::string & cc_mqttsn_gateway::Config::brokerTcpHostAddress ( ) const

Get TCP/IP address of the broker.

Default address is 127.0.0.1

◆ brokerTcpHostPort()

std::uint16_t cc_mqttsn_gateway::Config::brokerTcpHostPort ( ) const

Get TCP/IP port of the broker.

Default value is 1883

◆ clientConnectionType()

ClientConnectionType cc_mqttsn_gateway::Config::clientConnectionType ( ) const

Get client side I/O socket connection type.

Default value is ClientConnectionType_Udp

◆ defaultClientId()

const std::string & cc_mqttsn_gateway::Config::defaultClientId ( ) const

Get default client ID.

Default value is empty string.

Returns
Default client ID.

◆ gatewayId()

std::uint8_t cc_mqttsn_gateway::Config::gatewayId ( ) const

Get gateway numeric ID.

Default value is 0.

Returns
Numeric gateway ID.

◆ logFile()

const std::string & cc_mqttsn_gateway::Config::logFile ( ) const

Get log file.

Expected to be an aboslute file path or one of the special values: "stdout", "stderr". Defaults to "stdout"

◆ pubOnlyKeepAlive()

std::uint16_t cc_mqttsn_gateway::Config::pubOnlyKeepAlive ( ) const

Get keep alive period for publish only clients.

Default value is 60 seconds.

Returns
Keep alive period for publish only clients.

◆ read()

void cc_mqttsn_gateway::Config::read ( std::istream &  stream)

Read configuration from input stream.

Updates the default values with values read from the stream.

Parameters
[in]streamInput stream.

◆ retryCount()

unsigned cc_mqttsn_gateway::Config::retryCount ( ) const

Get number of retry attempts.

Default value is 3.

Returns
Number of retry attempts

◆ retryPeriod()

unsigned cc_mqttsn_gateway::Config::retryPeriod ( ) const

Get retry period.

Default value is 10 seconds.

Returns
Retry period in seconds

◆ sleepingClientMsgLimit()

std::size_t cc_mqttsn_gateway::Config::sleepingClientMsgLimit ( ) const

Get limit for max number of messages to accumulate for sleeping clients.

Default value is equivalent to std::numeric_limits<std::size_t>::max() seconds.

Returns
Max number of accumulated messages for sleeping clients.

◆ topicIdAllocRange()

TopicIdsRange cc_mqttsn_gateway::Config::topicIdAllocRange ( ) const

Get range of allowed topic IDs for allocation.

Default range is [1, 0xfffe]


The documentation for this class was generated from the following file: