Configuration

The classes which defines network configuration parameters

Builder functions

inline zenoh::Config zenoh::config_peer()

Create the default configuration for “peer” mode.

Returns:

the Config object

Note

zenoh-c only

std::variant<zenoh::Config, ErrorMessage> zenoh::config_from_file(const char *path)

Create the configuration from the JSON file.

Parameters:

path – path to the file

Returns:

the Config object

Note

zenoh-c only

std::variant<zenoh::Config, ErrorMessage> zenoh::config_client(const zenoh::StrArrayView &peers)

Create the configuration for “client” mode.

Parameters:

peers – the array of peers

Returns:

the Config object

Note

zenoh-c only

std::variant<zenoh::Config, ErrorMessage> zenoh::config_client(const std::initializer_list<const char*> &peers)

Create the configuration for “client” mode.

Parameters:

peers – the array of peers

Returns:

the Config object

Note

zenoh-c only

Configuration classes

class Config : public zenohcxx::Owned<::z_owned_config_t>

Zenoh config.

Constructors

inline Config()

Create the default configuration.

inline zenoh::Str get(const char *key) const

Get config parameter by the string key.

Parameters:

key – the key

Returns:

the Str value of the config parameter

Note

zenoh-c only

inline zenoh::Str to_string() const

Get the whole config as a JSON string.

Returns:

the JSON string in Str

Note

zenoh-c only

inline bool insert_json(const char *key, const char *value)

Insert a config parameter by the string key.

Parameters:
  • key – the key

  • value – the JSON string value

Returns:

true if the parameter was inserted

Note

zenoh-c only

inline const char *get(uint8_t key) const

Get config parameter by it’s numeric ID.

Parameters:

key – the key

Returns:

pointer to the null-terminated string value of the config parameter

Note

zenoh-pico only

bool insert(uint8_t key, const char *value)

Insert a config parameter by it’s numeric ID.

Parameters:
  • key – the key

  • value – the null-terminated string value

Returns:

true if the parameter was inserted

Note

zenoh-pico only

bool insert(uint8_t key, const char *value, ErrNo &error)

Insert a config parameter by it’s numeric ID.

Parameters:
  • key – the key

  • value – the null-terminated string value

  • error – the error code

Returns:

true if the parameter was inserted

Note

zenoh-pico only

zenoh::ScoutingConfig create_scouting_config()

Create ScoutingConfig from the config.

Returns:

the ScoutingConfig object

class ScoutingConfig : public zenohcxx::Owned<::z_owned_scouting_config_t>

Configuration for a zenoh::scout operation. This configuration can be created by Config::create_scouting_config method.

Constructors

inline ScoutingConfig()

Create a default ScoutingConfig