Scouting

template<class C, class D>
void zenoh::scout(Config &&config, C &&on_hello, D &&on_drop, ScoutOptions &&options = ScoutOptions::create_default(), ZResult *err = nullptr)

Scout for zenoh entities in the network.

Parameters:
  • configConfig to use for scouting.

  • on_hello – the callable to process each received Hellomessage.

  • on_drop – the callable that will be called once all Hello messages are received.

class Hello : public zenoh::Owned<::z_owned_hello_t>

Hello message returned by a zenoh entity as a reply to a “scout” message.

Methods

inline Id get_id() const

Get Id of the entity.

Returns:

Id of the entity.

inline WhatAmI get_whatami() const

Get the type of the entity.

Returns:

zenoh::WhatAmI of the entity.

inline std::vector<std::string_view> get_locators() const

Get the array of locators of the entity.

Returns:

the array of locators of the entity.

inline Hello(const Hello &other)

Copy constructor.

Hello(Hello &&other) = default

Move constructor.

Operators

inline Hello &operator=(const Hello &other)

Assignment operator.

Hello &operator=(Hello &&other) = default

Move assignment operator.

struct ScoutOptions

Options to be passed to scout operation.

Fields

size_t timeout_ms = 1000

The maximum duration in ms the scouting can take.

What what = What::Z_WHAT_ROUTER_PEER

Type of entities to scout for.

Methods

static inline ScoutOptions create_default()

Create default option settings.