Program Listing for File discovery_options.h

Return to documentation for file (include/rmw/discovery_options.h)

// Copyright 2022 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW__DISCOVERY_OPTIONS_H_
#define RMW__DISCOVERY_OPTIONS_H_

#include "rcutils/allocator.h"

#include "rmw/macros.h"
#include "rmw/ret_types.h"
#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

typedef enum RMW_PUBLIC_TYPE rmw_automatic_discovery_range_e
{
  RMW_AUTOMATIC_DISCOVERY_RANGE_NOT_SET = 0,
  RMW_AUTOMATIC_DISCOVERY_RANGE_OFF = 1,
  RMW_AUTOMATIC_DISCOVERY_RANGE_LOCALHOST = 2,
  RMW_AUTOMATIC_DISCOVERY_RANGE_SUBNET = 3,
  RMW_AUTOMATIC_DISCOVERY_RANGE_SYSTEM_DEFAULT = 4,
} rmw_automatic_discovery_range_t;

#define RMW_DISCOVERY_OPTIONS_STATIC_PEERS_MAX_LENGTH 256

typedef struct rmw_peer_address_s
{
  char peer_address[RMW_DISCOVERY_OPTIONS_STATIC_PEERS_MAX_LENGTH];
} rmw_peer_address_t;

typedef struct RMW_PUBLIC_TYPE rmw_discovery_options_s
{

  rmw_automatic_discovery_range_t automatic_discovery_range;


  rmw_peer_address_t * static_peers;

  size_t static_peers_count;

  rcutils_allocator_t allocator;
} rmw_discovery_options_t;

RMW_PUBLIC
RMW_WARN_UNUSED
rmw_discovery_options_t
rmw_get_zero_initialized_discovery_options(void);


RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_discovery_options_init(
  rmw_discovery_options_t * discovery_options,
  size_t size,
  rcutils_allocator_t * allocator);


RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_discovery_options_equal(
  const rmw_discovery_options_t * const left,
  const rmw_discovery_options_t * const right,
  bool * result);


RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_discovery_options_copy(
  const rmw_discovery_options_t * src,
  rcutils_allocator_t * allocator,
  rmw_discovery_options_t * dst);


RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_discovery_options_fini(
  rmw_discovery_options_t * discovery_options);
#ifdef __cplusplus
}
#endif

#endif  // RMW__DISCOVERY_OPTIONS_H_