Rearrange and fixup abstraction layer

- Replace os_result by dds_retcode_t and move DDS return code defines down.
  Eliminates the need to convert between different return code types.

- Move dds_time_t down and remove os_time.
  Eliminates the need to convert between different time representations and
  reduces code duplication.

- Remove use of Microsoft source-code annotation language (SAL).
  SAL annotations are Microsoft specific and not very well documented. This
  makes it very difficult for contributers to write.

- Rearrange the abstraction layer to be feature-based. The previous layout
  falsely assumed that the operating system dictates which implementation is
  best suited. For general purpose operating systems this is mostly true, but
  embedded targets require a slightly different approach and may not even offer
  all features. The new layout makes it possible to mix-and-match feature
  implementations and allows for features to not be implemented at all.

- Replace the os prefix by ddsrt to avoid name collisions.

- Remove various portions of unused and unwanted code.

- Export thread names on all supported platforms.

- Return native thread identifier on POSIX compatible platforms.

- Add timed wait for condition variables that takes an absolute time.

- Remove system abstraction for errno. The os_getErrno and os_setErrno were
  incorrect. Functions that might fail now simply return a DDS return code
  instead.

- Remove thread-specific memory abstraction. os_threadMemGet and accompanying
  functions were a mess and their use has been eliminated by other changes in
  this commit.

- Replace attribute (re)defines by ddsrt_ prefixed equivalents to avoid name
  collisions and problems with faulty __nonnull__ attributes.

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2019-01-18 14:10:19 +01:00
parent 318968f40f
commit cd6742ee12
439 changed files with 22117 additions and 28782 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,88 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/* TODO: do we really need to expose this as an API? */
/** @file
*
* @brief DDS C Allocation API
*
* This header file defines the public API of allocation convenience functions
* in the Eclipse Cyclone DDS C language binding.
*/
#ifndef DDS_ALLOC_H
#define DDS_ALLOC_H
#include <stddef.h>
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct dds_topic_descriptor;
struct dds_sequence;
#define DDS_FREE_KEY_BIT 0x01
#define DDS_FREE_CONTENTS_BIT 0x02
#define DDS_FREE_ALL_BIT 0x04
typedef enum
{
DDS_FREE_ALL = DDS_FREE_KEY_BIT | DDS_FREE_CONTENTS_BIT | DDS_FREE_ALL_BIT,
DDS_FREE_CONTENTS = DDS_FREE_KEY_BIT | DDS_FREE_CONTENTS_BIT,
DDS_FREE_KEY = DDS_FREE_KEY_BIT
}
dds_free_op_t;
typedef struct dds_allocator
{
/* Behaviour as C library malloc, realloc and free */
void * (*malloc) (size_t size);
void * (*realloc) (void *ptr, size_t size); /* if needed */
void (*free) (void *ptr);
}
dds_allocator_t;
DDS_EXPORT void dds_set_allocator (const dds_allocator_t * __restrict n, dds_allocator_t * __restrict o);
typedef struct dds_aligned_allocator
{
/* size is a multiple of align, align is a power of 2 no less than
the machine's page size, returned pointer MUST be aligned to at
least align. */
void * (*alloc) (size_t size, size_t align);
void (*free) (size_t size, void *ptr);
}
dds_aligned_allocator_t;
DDS_EXPORT void dds_set_aligned_allocator (const dds_aligned_allocator_t * __restrict n, dds_aligned_allocator_t * __restrict o);
DDS_EXPORT void * dds_alloc (size_t size);
DDS_EXPORT void * dds_realloc (void * ptr, size_t size);
DDS_EXPORT void * dds_realloc_zero (void * ptr, size_t size);
DDS_EXPORT void dds_free (void * ptr);
typedef void * (*dds_alloc_fn_t) (size_t);
typedef void * (*dds_realloc_fn_t) (void *, size_t);
typedef void (*dds_free_fn_t) (void *);
DDS_EXPORT char * dds_string_alloc (size_t size);
DDS_EXPORT char * dds_string_dup (const char * str);
DDS_EXPORT void dds_string_free (char * str);
DDS_EXPORT void dds_sample_free (void * sample, const struct dds_topic_descriptor * desc, dds_free_op_t op);
#if defined (__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,51 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Error API
*
* This header file defines the public API of error values and convenience
* functions in the CycloneDDS C language binding.
*/
#ifndef DDS_ERROR_H
#define DDS_ERROR_H
#include "dds/export.h"
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/retcode.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* Error masks for returned status values */
#define DDS_ERR_NR_MASK 0x000000ff
#define DDS_ERR_LINE_MASK 0x003fff00
#define DDS_ERR_FILE_ID_MASK 0x7fc00000
/* Error code handling functions */
/** Macro to extract error number */
#define dds_err_nr(e) ((-(e)) & DDS_ERR_NR_MASK)
/** Macro to extract line number */
#define dds_err_line(e) (((-(e)) & DDS_ERR_LINE_MASK) >> 8)
/** Macro to extract file identifier */
#define dds_err_file_id(e) (((-(e)) & DDS_ERR_FILE_ID_MASK) >> 22)
#if defined (__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,210 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/* TODO: do we really need to expose all of this as an API? maybe some, but all? */
/** @file
*
* @brief DDS C Implementation API
*
* This header file defines the public API for all kinds of things in the
* Eclipse Cyclone DDS C language binding.
*/
#ifndef DDS_IMPL_H
#define DDS_IMPL_H
#include "dds/export.h"
#include "dds/ddsc/dds_public_alloc.h"
#include "dds/ddsc/dds_public_stream.h"
#if defined (__cplusplus)
extern "C" {
#endif
typedef struct dds_sequence
{
uint32_t _maximum;
uint32_t _length;
uint8_t * _buffer;
bool _release;
}
dds_sequence_t;
#define DDS_LENGTH_UNLIMITED -1
typedef struct dds_key_descriptor
{
const char * m_name;
uint32_t m_index;
}
dds_key_descriptor_t;
/*
Topic definitions are output by a preprocessor and have an
implementation-private definition. The only thing exposed on the
API is a pointer to the "topic_descriptor_t" struct type.
*/
typedef struct dds_topic_descriptor
{
const uint32_t m_size; /* Size of topic type */
const uint32_t m_align; /* Alignment of topic type */
const uint32_t m_flagset; /* Flags */
const uint32_t m_nkeys; /* Number of keys (can be 0) */
const char * m_typename; /* Type name */
const dds_key_descriptor_t * m_keys; /* Key descriptors (NULL iff m_nkeys 0) */
const uint32_t m_nops; /* Number of ops in m_ops */
const uint32_t * m_ops; /* Marshalling meta data */
const char * m_meta; /* XML topic description meta data */
}
dds_topic_descriptor_t;
/* Topic descriptor flag values */
#define DDS_TOPIC_NO_OPTIMIZE 0x0001
#define DDS_TOPIC_FIXED_KEY 0x0002
/*
Masks for read condition, read, take: there is only one mask here,
which combines the sample, view and instance states.
*/
#define DDS_READ_SAMPLE_STATE 1u
#define DDS_NOT_READ_SAMPLE_STATE 2u
#define DDS_ANY_SAMPLE_STATE (1u | 2u)
#define DDS_NEW_VIEW_STATE 4u
#define DDS_NOT_NEW_VIEW_STATE 8u
#define DDS_ANY_VIEW_STATE (4u | 8u)
#define DDS_ALIVE_INSTANCE_STATE 16u
#define DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE 32u
#define DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE 64u
#define DDS_ANY_INSTANCE_STATE (16u | 32u | 64u)
#define DDS_ANY_STATE (DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE)
#define DDS_DOMAIN_DEFAULT -1
#define DDS_HANDLE_NIL 0
#define DDS_ENTITY_NIL 0
#define DDS_ENTITY_KIND_MASK (0x7F000000) /* Should be same as UT_HANDLE_KIND_MASK. */
typedef enum dds_entity_kind
{
DDS_KIND_DONTCARE = 0x00000000,
DDS_KIND_TOPIC = 0x01000000,
DDS_KIND_PARTICIPANT = 0x02000000,
DDS_KIND_READER = 0x03000000,
DDS_KIND_WRITER = 0x04000000,
DDS_KIND_SUBSCRIBER = 0x05000000,
DDS_KIND_PUBLISHER = 0x06000000,
DDS_KIND_COND_READ = 0x07000000,
DDS_KIND_COND_QUERY = 0x08000000,
DDS_KIND_COND_GUARD = 0x09000000,
DDS_KIND_WAITSET = 0x0A000000,
DDS_KIND_INTERNAL = 0x0B000000,
}
dds_entity_kind_t;
/* Handles are opaque pointers to implementation types */
typedef uint64_t dds_instance_handle_t;
typedef int32_t dds_domainid_t;
/* Topic encoding instruction types */
#define DDS_OP_RTS 0x00000000
#define DDS_OP_ADR 0x01000000
#define DDS_OP_JSR 0x02000000
#define DDS_OP_JEQ 0x03000000
/* Core type flags
1BY : One byte simple type
2BY : Two byte simple type
4BY : Four byte simple type
8BY : Eight byte simple type
STR : String
BST : Bounded string
SEQ : Sequence
ARR : Array
UNI : Union
STU : Struct
*/
#define DDS_OP_VAL_1BY 0x01
#define DDS_OP_VAL_2BY 0x02
#define DDS_OP_VAL_4BY 0x03
#define DDS_OP_VAL_8BY 0x04
#define DDS_OP_VAL_STR 0x05
#define DDS_OP_VAL_BST 0x06
#define DDS_OP_VAL_SEQ 0x07
#define DDS_OP_VAL_ARR 0x08
#define DDS_OP_VAL_UNI 0x09
#define DDS_OP_VAL_STU 0x0a
#define DDS_OP_TYPE_1BY (DDS_OP_VAL_1BY << 16)
#define DDS_OP_TYPE_2BY (DDS_OP_VAL_2BY << 16)
#define DDS_OP_TYPE_4BY (DDS_OP_VAL_4BY << 16)
#define DDS_OP_TYPE_8BY (DDS_OP_VAL_8BY << 16)
#define DDS_OP_TYPE_STR (DDS_OP_VAL_STR << 16)
#define DDS_OP_TYPE_SEQ (DDS_OP_VAL_SEQ << 16)
#define DDS_OP_TYPE_ARR (DDS_OP_VAL_ARR << 16)
#define DDS_OP_TYPE_UNI (DDS_OP_VAL_UNI << 16)
#define DDS_OP_TYPE_STU (DDS_OP_VAL_STU << 16)
#define DDS_OP_TYPE_BST (DDS_OP_VAL_BST << 16)
#define DDS_OP_TYPE_BOO DDS_OP_TYPE_1BY
#define DDS_OP_SUBTYPE_BOO DDS_OP_SUBTYPE_1BY
#define DDS_OP_SUBTYPE_1BY (DDS_OP_VAL_1BY << 8)
#define DDS_OP_SUBTYPE_2BY (DDS_OP_VAL_2BY << 8)
#define DDS_OP_SUBTYPE_4BY (DDS_OP_VAL_4BY << 8)
#define DDS_OP_SUBTYPE_8BY (DDS_OP_VAL_8BY << 8)
#define DDS_OP_SUBTYPE_STR (DDS_OP_VAL_STR << 8)
#define DDS_OP_SUBTYPE_SEQ (DDS_OP_VAL_SEQ << 8)
#define DDS_OP_SUBTYPE_ARR (DDS_OP_VAL_ARR << 8)
#define DDS_OP_SUBTYPE_UNI (DDS_OP_VAL_UNI << 8)
#define DDS_OP_SUBTYPE_STU (DDS_OP_VAL_STU << 8)
#define DDS_OP_SUBTYPE_BST (DDS_OP_VAL_BST << 8)
#define DDS_OP_FLAG_KEY 0x01
#define DDS_OP_FLAG_DEF 0x02
/**
* Description : Enable or disable write batching. Overrides default configuration
* setting for write batching (DDSI2E/Internal/WriteBatch).
*
* Arguments :
* -# enable Enables or disables write batching for all writers.
*/
DDS_EXPORT void dds_write_set_batch (bool enable);
/**
* Description : Install tcp/ssl and encryption support. Depends on openssl.
*
* Arguments :
* -# None
*/
DDS_EXPORT void dds_ssl_plugin (void);
/**
* Description : Install client durability support. Depends on OSPL server.
*
* Arguments :
* -# None
*/
DDS_EXPORT void dds_durability_plugin (void);
#if defined (__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,318 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Listener API
*
* This header file defines the public API of listeners in the
* Eclipse Cyclone DDS C language binding.
*/
#ifndef _DDS_PUBLIC_LISTENER_H_
#define _DDS_PUBLIC_LISTENER_H_
#include "dds/export.h"
#include "dds/ddsc/dds_public_impl.h"
#include "dds/ddsc/dds_public_status.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* Listener callbacks */
typedef void (*dds_on_inconsistent_topic_fn) (dds_entity_t topic, const dds_inconsistent_topic_status_t status, void* arg);
typedef void (*dds_on_liveliness_lost_fn) (dds_entity_t writer, const dds_liveliness_lost_status_t status, void* arg);
typedef void (*dds_on_offered_deadline_missed_fn) (dds_entity_t writer, const dds_offered_deadline_missed_status_t status, void* arg);
typedef void (*dds_on_offered_incompatible_qos_fn) (dds_entity_t writer, const dds_offered_incompatible_qos_status_t status, void* arg);
typedef void (*dds_on_data_on_readers_fn) (dds_entity_t subscriber, void* arg);
typedef void (*dds_on_sample_lost_fn) (dds_entity_t reader, const dds_sample_lost_status_t status, void* arg);
typedef void (*dds_on_data_available_fn) (dds_entity_t reader, void* arg);
typedef void (*dds_on_sample_rejected_fn) (dds_entity_t reader, const dds_sample_rejected_status_t status, void* arg);
typedef void (*dds_on_liveliness_changed_fn) (dds_entity_t reader, const dds_liveliness_changed_status_t status, void* arg);
typedef void (*dds_on_requested_deadline_missed_fn) (dds_entity_t reader, const dds_requested_deadline_missed_status_t status, void* arg);
typedef void (*dds_on_requested_incompatible_qos_fn) (dds_entity_t reader, const dds_requested_incompatible_qos_status_t status, void* arg);
typedef void (*dds_on_publication_matched_fn) (dds_entity_t writer, const dds_publication_matched_status_t status, void* arg);
typedef void (*dds_on_subscription_matched_fn) (dds_entity_t reader, const dds_subscription_matched_status_t status, void* arg);
#define DDS_LUNSET 0
struct dds_listener;
typedef struct dds_listener dds_listener_t;
/**
* @brief Allocate memory and initializes to default values (::DDS_LUNSET) of a listener
*
* @param[in] arg optional pointer that will be passed on to the listener callbacks
*
* @return Returns a pointer to the allocated memory for dds_listener_t structure.
*/
DDS_EXPORT dds_listener_t* dds_create_listener (void* arg);
DDS_DEPRECATED_EXPORT dds_listener_t* dds_listener_create (void* arg);
/**
* @brief Delete the memory allocated to listener structure
*
* @param[in] listener pointer to the listener struct to delete
*/
DDS_EXPORT void dds_delete_listener (dds_listener_t * __restrict listener);
DDS_DEPRECATED_EXPORT void dds_listener_delete (dds_listener_t * __restrict listener);
/**
* @brief Reset the listener structure contents to ::DDS_LUNSET
*
* @param[in,out] listener pointer to the listener struct to reset
*/
DDS_EXPORT void dds_reset_listener (dds_listener_t * __restrict listener);
DDS_DEPRECATED_EXPORT void dds_listener_reset (dds_listener_t * __restrict listener);
/**
* @brief Copy the listener callbacks from source to destination
*
* @param[in,out] dst The pointer to the destination listener structure, where the content is to copied
* @param[in] src The pointer to the source listener structure to be copied
*/
DDS_EXPORT void dds_copy_listener (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
DDS_DEPRECATED_EXPORT void dds_listener_copy (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
/**
* @brief Copy the listener callbacks from source to destination, unless already set
*
* Any listener callbacks already set in @p dst (including NULL) are skipped, only
* those set to DDS_LUNSET are copied from @p src.
*
* @param[in,out] dst The pointer to the destination listener structure, where the content is merged
* @param[in] src The pointer to the source listener structure to be copied
*/
DDS_EXPORT void dds_merge_listener (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
DDS_DEPRECATED_EXPORT void dds_listener_merge (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
/************************************************************************************************
* Setters
************************************************************************************************/
/**
* @brief Set the inconsistent_topic callback in the listener structure.
*
* @param listener The pointer to the listener structure, where the callback will be set
* @param callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_inconsistent_topic (dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn callback);
/**
* @brief Set the liveliness_lost callback in the listener structure.
*
* @param[out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_liveliness_lost (dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn callback);
/**
* @brief Set the offered_deadline_missed callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_offered_deadline_missed (dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn callback);
/**
* @brief Set the offered_incompatible_qos callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_offered_incompatible_qos (dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn callback);
/**
* @brief Set the data_on_readers callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_data_on_readers (dds_listener_t * __restrict listener, dds_on_data_on_readers_fn callback);
/**
* @brief Set the sample_lost callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_sample_lost (dds_listener_t * __restrict listener, dds_on_sample_lost_fn callback);
/**
* @brief Set the data_available callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_data_available (dds_listener_t * __restrict listener, dds_on_data_available_fn callback);
/**
* @brief Set the sample_rejected callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_sample_rejected (dds_listener_t * __restrict listener, dds_on_sample_rejected_fn callback);
/**
* @brief Set the liveliness_changed callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_liveliness_changed (dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn callback);
/**
* @brief Set the requested_deadline_missed callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_requested_deadline_missed (dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn callback);
/**
* @brief Set the requested_incompatible_qos callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_requested_incompatible_qos (dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn callback);
/**
* @brief Set the publication_matched callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_publication_matched (dds_listener_t * __restrict listener, dds_on_publication_matched_fn callback);
/**
* @brief Set the subscription_matched callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_subscription_matched (dds_listener_t * __restrict listener, dds_on_subscription_matched_fn callback);
/************************************************************************************************
* Getters
************************************************************************************************/
/**
* @brief Get the inconsistent_topic callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_inconsistent_topic (const dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn *callback);
/**
* @brief Get the liveliness_lost callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_liveliness_lost (const dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn *callback);
/**
* @brief Get the offered_deadline_missed callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_offered_deadline_missed (const dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn *callback);
/**
* @brief Get the offered_incompatible_qos callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_offered_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn *callback);
/**
* @brief Get the data_on_readers callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_data_on_readers (const dds_listener_t * __restrict listener, dds_on_data_on_readers_fn *callback);
/**
* @brief Get the sample_lost callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_sample_lost (const dds_listener_t *__restrict listener, dds_on_sample_lost_fn *callback);
/**
* @brief Get the data_available callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_data_available (const dds_listener_t *__restrict listener, dds_on_data_available_fn *callback);
/**
* @brief Get the sample_rejected callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_sample_rejected (const dds_listener_t *__restrict listener, dds_on_sample_rejected_fn *callback);
/**
* @brief Get the liveliness_changed callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_liveliness_changed (const dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn *callback);
/**
* @brief Get the requested_deadline_missed callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_requested_deadline_missed (const dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn *callback);
/**
* @brief Get the requested_incompatible_qos callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_requested_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn *callback);
/**
* @brief Get the publication_matched callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_publication_matched (const dds_listener_t * __restrict listener, dds_on_publication_matched_fn *callback);
/**
* @brief Get the subscription_matched callback from the listener structure.
*
* @param[in] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
* @param[in,out] listener The pointer to the listener structure, where the callback will be retrieved from
*/
DDS_EXPORT void dds_lget_subscription_matched (const dds_listener_t * __restrict listener, dds_on_subscription_matched_fn *callback);
#if defined (__cplusplus)
}
#endif
#endif /*_DDS_PUBLIC_LISTENER_H_*/

View file

@ -0,0 +1,759 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C QoS API
*
* This header file defines the public API of QoS and Policies in the
* Eclipse Cyclone DDS C language binding.
*/
#ifndef DDS_QOS_H
#define DDS_QOS_H
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* QoS identifiers */
/** @name QoS identifiers
@{**/
#define DDS_INVALID_QOS_POLICY_ID 0
#define DDS_USERDATA_QOS_POLICY_ID 1
#define DDS_DURABILITY_QOS_POLICY_ID 2
#define DDS_PRESENTATION_QOS_POLICY_ID 3
#define DDS_DEADLINE_QOS_POLICY_ID 4
#define DDS_LATENCYBUDGET_QOS_POLICY_ID 5
#define DDS_OWNERSHIP_QOS_POLICY_ID 6
#define DDS_OWNERSHIPSTRENGTH_QOS_POLICY_ID 7
#define DDS_LIVELINESS_QOS_POLICY_ID 8
#define DDS_TIMEBASEDFILTER_QOS_POLICY_ID 9
#define DDS_PARTITION_QOS_POLICY_ID 10
#define DDS_RELIABILITY_QOS_POLICY_ID 11
#define DDS_DESTINATIONORDER_QOS_POLICY_ID 12
#define DDS_HISTORY_QOS_POLICY_ID 13
#define DDS_RESOURCELIMITS_QOS_POLICY_ID 14
#define DDS_ENTITYFACTORY_QOS_POLICY_ID 15
#define DDS_WRITERDATALIFECYCLE_QOS_POLICY_ID 16
#define DDS_READERDATALIFECYCLE_QOS_POLICY_ID 17
#define DDS_TOPICDATA_QOS_POLICY_ID 18
#define DDS_GROUPDATA_QOS_POLICY_ID 19
#define DDS_TRANSPORTPRIORITY_QOS_POLICY_ID 20
#define DDS_LIFESPAN_QOS_POLICY_ID 21
#define DDS_DURABILITYSERVICE_QOS_POLICY_ID 22
/** @}*/
/* QoS structure is opaque */
/** QoS structure */
typedef struct nn_xqos dds_qos_t;
/** Durability QoS: Applies to Topic, DataReader, DataWriter */
typedef enum dds_durability_kind
{
DDS_DURABILITY_VOLATILE,
DDS_DURABILITY_TRANSIENT_LOCAL,
DDS_DURABILITY_TRANSIENT,
DDS_DURABILITY_PERSISTENT
}
dds_durability_kind_t;
/** History QoS: Applies to Topic, DataReader, DataWriter */
typedef enum dds_history_kind
{
DDS_HISTORY_KEEP_LAST,
DDS_HISTORY_KEEP_ALL
}
dds_history_kind_t;
/** Ownership QoS: Applies to Topic, DataReader, DataWriter */
typedef enum dds_ownership_kind
{
DDS_OWNERSHIP_SHARED,
DDS_OWNERSHIP_EXCLUSIVE
}
dds_ownership_kind_t;
/** Liveliness QoS: Applies to Topic, DataReader, DataWriter */
typedef enum dds_liveliness_kind
{
DDS_LIVELINESS_AUTOMATIC,
DDS_LIVELINESS_MANUAL_BY_PARTICIPANT,
DDS_LIVELINESS_MANUAL_BY_TOPIC
}
dds_liveliness_kind_t;
/** Reliability QoS: Applies to Topic, DataReader, DataWriter */
typedef enum dds_reliability_kind
{
DDS_RELIABILITY_BEST_EFFORT,
DDS_RELIABILITY_RELIABLE
}
dds_reliability_kind_t;
/** DestinationOrder QoS: Applies to Topic, DataReader, DataWriter */
typedef enum dds_destination_order_kind
{
DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP,
DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP
}
dds_destination_order_kind_t;
/** History QoS: Applies to Topic, DataReader, DataWriter */
typedef struct dds_history_qospolicy
{
dds_history_kind_t kind;
int32_t depth;
}
dds_history_qospolicy_t;
/** ResourceLimits QoS: Applies to Topic, DataReader, DataWriter */
typedef struct dds_resource_limits_qospolicy
{
int32_t max_samples;
int32_t max_instances;
int32_t max_samples_per_instance;
}
dds_resource_limits_qospolicy_t;
/** Presentation QoS: Applies to Publisher, Subscriber */
typedef enum dds_presentation_access_scope_kind
{
DDS_PRESENTATION_INSTANCE,
DDS_PRESENTATION_TOPIC,
DDS_PRESENTATION_GROUP
}
dds_presentation_access_scope_kind_t;
/**
* @brief Allocate memory and initialize default QoS-policies
*
* @returns - Pointer to the initialized dds_qos_t structure, NULL if unsuccessful.
*/
DDS_EXPORT
dds_qos_t * dds_create_qos (void);
DDS_DEPRECATED_EXPORT
dds_qos_t * dds_qos_create (void);
/**
* @brief Delete memory allocated to QoS-policies structure
*
* @param[in] qos - Pointer to dds_qos_t structure
*/
DDS_EXPORT void
dds_delete_qos (dds_qos_t * __restrict qos);
DDS_DEPRECATED_EXPORT void
dds_qos_delete (dds_qos_t * __restrict qos);
/**
* @brief Reset a QoS-policies structure to default values
*
* @param[in,out] qos - Pointer to the dds_qos_t structure
*/
DDS_EXPORT void
dds_reset_qos(dds_qos_t * __restrict qos);
DDS_DEPRECATED_EXPORT
void dds_qos_reset (dds_qos_t * __restrict qos
);
/**
* @brief Copy all QoS-policies from one structure to another
*
* @param[in,out] dst - Pointer to the destination dds_qos_t structure
* @param[in] src - Pointer to the source dds_qos_t structure
*
* @returns - Return-code indicating success or failure
*/
DDS_EXPORT dds_return_t
dds_copy_qos (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
DDS_DEPRECATED_EXPORT dds_return_t
dds_qos_copy (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
/**
* @brief Copy all QoS-policies from one structure to another, unless already set
*
* Policies are copied from src to dst, unless src already has the policy set to a non-default value.
*
* @param[in,out] dst - Pointer to the destination qos structure
* @param[in] src - Pointer to the source qos structure
*/
DDS_EXPORT void
dds_merge_qos (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
DDS_DEPRECATED_EXPORT void
dds_qos_merge (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
/**
* @brief Copy all QoS-policies from one structure to another, unless already set
*
* Policies are copied from src to dst, unless src already has the policy set to a non-default value.
*
* @param[in,out] dst - Pointer to the destination qos structure
* @param[in] src - Pointer to the source qos structure
*/
DDS_EXPORT bool
dds_qos_equal (const dds_qos_t * __restrict a, const dds_qos_t * __restrict b);
/**
* @brief Set the userdata of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the userdata
* @param[in] value - Pointer to the userdata
* @param[in] sz - Size of userdata stored in value
*/
DDS_EXPORT void
dds_qset_userdata (
dds_qos_t * __restrict qos,
const void * __restrict value,
size_t sz);
/**
* @brief Set the topicdata of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the topicdata
* @param[in] value - Pointer to the topicdata
* @param[in] sz - Size of the topicdata stored in value
*/
DDS_EXPORT void
dds_qset_topicdata (
dds_qos_t * __restrict qos,
const void * __restrict value,
size_t sz);
/**
* @brief Set the groupdata of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the groupdata
* @param[in] value - Pointer to the group data
* @param[in] sz - Size of groupdata stored in value
*/
DDS_EXPORT void
dds_qset_groupdata (
dds_qos_t * __restrict qos,
const void * __restrict value,
size_t sz);
/**
* @brief Set the durability policy of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] kind - Durability kind value \ref DCPS_QoS_Durability
*/
DDS_EXPORT void
dds_qset_durability (dds_qos_t * __restrict qos, dds_durability_kind_t kind);
/**
* @brief Set the history policy of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] kind - History kind value \ref DCPS_QoS_History
* @param[in] depth - History depth value \ref DCPS_QoS_History
*/
DDS_EXPORT void
dds_qset_history (
dds_qos_t * __restrict qos,
dds_history_kind_t kind,
int32_t depth);
/**
* @brief Set the resource limits policy of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] max_samples - Number of samples resource-limit value
* @param[in] max_instances - Number of instances resource-limit value
* @param[in] max_samples_per_instance - Number of samples per instance resource-limit value
*/
DDS_EXPORT void
dds_qset_resource_limits (
dds_qos_t * __restrict qos,
int32_t max_samples,
int32_t max_instances,
int32_t max_samples_per_instance);
/**
* @brief Set the presentation policy of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] access_scope - Access-scope kind
* @param[in] coherent_access - Coherent access enable value
* @param[in] ordered_access - Ordered access enable value
*/
DDS_EXPORT void
dds_qset_presentation (
dds_qos_t * __restrict qos,
dds_presentation_access_scope_kind_t access_scope,
bool coherent_access,
bool ordered_access);
/**
* @brief Set the lifespan policy of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] lifespan - Lifespan duration (expiration time relative to source timestamp of a sample)
*/
DDS_EXPORT void
dds_qset_lifespan (
dds_qos_t * __restrict qos,
dds_duration_t lifespan);
/**
* @brief Set the deadline policy of a qos structure.
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] deadline - Deadline duration
*/
DDS_EXPORT void
dds_qset_deadline (
dds_qos_t * __restrict qos,
dds_duration_t deadline);
/**
* @brief Set the latency-budget policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] duration - Latency budget duration
*/
DDS_EXPORT void
dds_qset_latency_budget (
dds_qos_t * __restrict qos,
dds_duration_t duration);
/**
* @brief Set the ownership policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] kind - Ownership kind
*/
DDS_EXPORT void
dds_qset_ownership (
dds_qos_t * __restrict qos,
dds_ownership_kind_t kind);
/**
* @brief Set the ownership strength policy of a qos structure
*
* param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* param[in] value - Ownership strength value
*/
DDS_EXPORT void
dds_qset_ownership_strength (dds_qos_t * __restrict qos, int32_t value);
/**
* @brief Set the liveliness policy of a qos structure
*
* param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* param[in] kind - Liveliness kind
* param[in[ lease_duration - Lease duration
*/
DDS_EXPORT void
dds_qset_liveliness (
dds_qos_t * __restrict qos,
dds_liveliness_kind_t kind,
dds_duration_t lease_duration);
/**
* @brief Set the time-based filter policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] minimum_separation - Minimum duration between sample delivery for an instance
*/
DDS_EXPORT void
dds_qset_time_based_filter (
dds_qos_t * __restrict qos,
dds_duration_t minimum_separation);
/**
* @brief Set the partition policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] n - Number of partitions stored in ps
* @param[in[ ps - Pointer to string(s) storing partition name(s)
*/
DDS_EXPORT void
dds_qset_partition (
dds_qos_t * __restrict qos,
uint32_t n,
const char ** __restrict ps);
/**
* @brief Set the reliability policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] kind - Reliability kind
* @param[in] max_blocking_time - Max blocking duration applied when kind is reliable.
*/
DDS_EXPORT void
dds_qset_reliability (
dds_qos_t * __restrict qos,
dds_reliability_kind_t kind,
dds_duration_t max_blocking_time);
/**
* @brief Set the transport-priority policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] value - Priority value
*/
DDS_EXPORT void
dds_qset_transport_priority (dds_qos_t * __restrict qos, int32_t value);
/**
* @brief Set the destination-order policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] kind - Destination-order kind
*/
DDS_EXPORT void
dds_qset_destination_order (
dds_qos_t * __restrict qos,
dds_destination_order_kind_t kind);
/**
* @brief Set the writer data-lifecycle policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] autodispose_unregistered_instances - Automatic disposal of unregistered instances
*/
DDS_EXPORT void
dds_qset_writer_data_lifecycle (dds_qos_t * __restrict qos, bool autodispose);
/**
* @brief Set the reader data-lifecycle policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] autopurge_nowriter_samples_delay - Delay for purging of samples from instances in a no-writers state
* @param[in] autopurge_disposed_samples_delay - Delay for purging of samples from disposed instances
*/
DDS_EXPORT void
dds_qset_reader_data_lifecycle (
dds_qos_t * __restrict qos,
dds_duration_t autopurge_nowriter_samples_delay,
dds_duration_t autopurge_disposed_samples_delay);
/**
* @brief Set the durability-service policy of a qos structure
*
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
* @param[in] service_cleanup_delay - Delay for purging of abandoned instances from the durability service
* @param[in] history_kind - History policy kind applied by the durability service
* @param[in] history_depth - History policy depth applied by the durability service
* @param[in] max_samples - Number of samples resource-limit policy applied by the durability service
* @param[in] max_instances - Number of instances resource-limit policy applied by the durability service
* @param[in] max_samples_per_instance - Number of samples per instance resource-limit policy applied by the durability service
*/
DDS_EXPORT void
dds_qset_durability_service (
dds_qos_t * __restrict qos,
dds_duration_t service_cleanup_delay,
dds_history_kind_t history_kind,
int32_t history_depth,
int32_t max_samples,
int32_t max_instances,
int32_t max_samples_per_instance);
/**
* @brief Get the userdata from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the userdata
* @param[in,out] sz - Pointer that will store the size of userdata
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool dds_qget_userdata (const dds_qos_t * __restrict qos, void **value, size_t *sz);
/**
* @brief Get the topicdata from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the topicdata
* @param[in,out] sz - Pointer that will store the size of topicdata
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool dds_qget_topicdata (const dds_qos_t * __restrict qos, void **value, size_t *sz);
/**
* @brief Get the groupdata from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the groupdata
* @param[in,out] sz - Pointer that will store the size of groupdata
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool dds_qget_groupdata (const dds_qos_t * __restrict qos, void **value, size_t *sz);
/**
* @brief Get the durability policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the durability kind
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool dds_qget_durability (const dds_qos_t * __restrict qos, dds_durability_kind_t *kind);
/**
* @brief Get the history policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the history kind (optional)
* @param[in,out] depth - Pointer that will store the history depth (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool dds_qget_history (const dds_qos_t * __restrict qos, dds_history_kind_t *kind, int32_t *depth);
/**
* @brief Get the resource-limits policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] max_samples - Pointer that will store the number of samples resource-limit (optional)
* @param[in,out] max_instances - Pointer that will store the number of instances resource-limit (optional)
* @param[in,out] max_samples_per_instance - Pointer that will store the number of samples per instance resource-limit (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_resource_limits (
const dds_qos_t * __restrict qos,
int32_t *max_samples,
int32_t *max_instances,
int32_t *max_samples_per_instance);
/**
* @brief Get the presentation policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] access_scope - Pointer that will store access scope kind (optional)
* @param[in,out] coherent_access - Pointer that will store coherent access enable value (optional)
* @param[in,out] ordered_access - Pointer that will store orderede access enable value (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_presentation (
const dds_qos_t * __restrict qos,
dds_presentation_access_scope_kind_t *access_scope,
bool *coherent_access,
bool *ordered_access);
/**
* @brief Get the lifespan policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] lifespan - Pointer that will store lifespan duration
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_lifespan (
const dds_qos_t * __restrict qos,
dds_duration_t *lifespan);
/**
* @brief Get the deadline policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] deadline - Pointer that will store deadline duration
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_deadline (
const dds_qos_t * __restrict qos,
dds_duration_t *deadline);
/**
* @brief Get the latency-budget policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] duration - Pointer that will store latency-budget duration
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_latency_budget (
const dds_qos_t * __restrict qos,
dds_duration_t *duration);
/**
* @brief Get the ownership policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the ownership kind
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_ownership (
const dds_qos_t * __restrict qos,
dds_ownership_kind_t *kind);
/**
* @brief Get the ownership strength qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the ownership strength value
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_ownership_strength (
const dds_qos_t * __restrict qos,
int32_t *value);
/**
* @brief Get the liveliness qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the liveliness kind (optional)
* @param[in,out] lease_duration - Pointer that will store the liveliness lease duration (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_liveliness (
const dds_qos_t * __restrict qos,
dds_liveliness_kind_t *kind,
dds_duration_t *lease_duration);
/**
* @brief Get the time-based filter qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] minimum_separation - Pointer that will store the minimum separation duration (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_time_based_filter (
const dds_qos_t * __restrict qos,
dds_duration_t *minimum_separation);
/**
* @brief Get the partition qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] n - Pointer that will store the number of partitions (optional)
* @param[in,out] ps - Pointer that will store the string(s) containing partition name(s) (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_partition (
const dds_qos_t * __restrict qos,
uint32_t *n,
char ***ps);
/**
* @brief Get the reliability qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the reliability kind (optional)
* @param[in,out] max_blocking_time - Pointer that will store the max blocking time for reliable reliability (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_reliability (
const dds_qos_t * __restrict qos,
dds_reliability_kind_t *kind,
dds_duration_t *max_blocking_time);
/**
* @brief Get the transport priority qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the transport priority value
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_transport_priority (
const dds_qos_t * __restrict qos,
int32_t *value);
/**
* @brief Get the destination-order qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the destination-order kind
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_destination_order (
const dds_qos_t * __restrict qos,
dds_destination_order_kind_t *kind);
/**
* @brief Get the writer data-lifecycle qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] autodispose_unregistered_instances - Pointer that will store the autodispose unregistered instances enable value
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_writer_data_lifecycle (
const dds_qos_t * __restrict qos,
bool *autodispose);
/**
* @brief Get the reader data-lifecycle qos policy
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] autopurge_nowriter_samples_delay - Pointer that will store the delay for auto-purging samples from instances in a no-writer state (optional)
* @param[in,out] autopurge_disposed_samples_delay - Pointer that will store the delay for auto-purging of disposed instances (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_reader_data_lifecycle (
const dds_qos_t * __restrict qos,
dds_duration_t *autopurge_nowriter_samples_delay,
dds_duration_t *autopurge_disposed_samples_delay);
/**
* @brief Get the durability-service qos policy values.
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] service_cleanup_delay - Pointer that will store the delay for purging of abandoned instances from the durability service (optional)
* @param[in,out] history_kind - Pointer that will store history policy kind applied by the durability service (optional)
* @param[in,out] history_depth - Pointer that will store history policy depth applied by the durability service (optional)
* @param[in,out] max_samples - Pointer that will store number of samples resource-limit policy applied by the durability service (optional)
* @param[in,out] max_instances - Pointer that will store number of instances resource-limit policy applied by the durability service (optional)
* @param[in,out] max_samples_per_instance - Pointer that will store number of samples per instance resource-limit policy applied by the durability service (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool
dds_qget_durability_service (
const dds_qos_t * __restrict qos,
dds_duration_t *service_cleanup_delay,
dds_history_kind_t *history_kind,
int32_t *history_depth,
int32_t *max_samples,
int32_t *max_instances,
int32_t *max_samples_per_instance);
#if defined (__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,480 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Communication Status API
*
* This header file defines the public API of the Communication Status in the
* Eclipse Cyclone DDS C language binding.
*/
#ifndef DDS_STATUS_H
#define DDS_STATUS_H
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
/*
Listeners implemented as structs containing callback functions
that take listener status types as arguments.
*/
/* Listener status types */
/**
* \ref DCPS_Status_OfferedDeadlineMissed
*/
typedef struct dds_offered_deadline_missed_status
{
uint32_t total_count;
int32_t total_count_change;
dds_instance_handle_t last_instance_handle;
}
dds_offered_deadline_missed_status_t;
/**
* \ref DCPS_Status_OfferedIncompatibleQoS
*/
typedef struct dds_offered_incompatible_qos_status
{
uint32_t total_count;
int32_t total_count_change;
uint32_t last_policy_id;
}
dds_offered_incompatible_qos_status_t;
/**
* \ref DCPS_Status_PublicationMatched
*/
typedef struct dds_publication_matched_status
{
uint32_t total_count;
int32_t total_count_change;
uint32_t current_count;
int32_t current_count_change;
dds_instance_handle_t last_subscription_handle;
}
dds_publication_matched_status_t;
/**
* \ref DCPS_Status_LivelinessLost
*/
typedef struct dds_liveliness_lost_status
{
uint32_t total_count;
int32_t total_count_change;
}
dds_liveliness_lost_status_t;
/**
* \ref DCPS_Status_SubscriptionMatched
*/
typedef struct dds_subscription_matched_status
{
uint32_t total_count;
int32_t total_count_change;
uint32_t current_count;
int32_t current_count_change;
dds_instance_handle_t last_publication_handle;
}
dds_subscription_matched_status_t;
/**
* dds_sample_rejected_status_kind
*/
typedef enum
{
DDS_NOT_REJECTED,
DDS_REJECTED_BY_INSTANCES_LIMIT,
DDS_REJECTED_BY_SAMPLES_LIMIT,
DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT
}
dds_sample_rejected_status_kind;
/**
* \ref DCPS_Status_SampleRejected
*/
typedef struct dds_sample_rejected_status
{
uint32_t total_count;
int32_t total_count_change;
dds_sample_rejected_status_kind last_reason;
dds_instance_handle_t last_instance_handle;
}
dds_sample_rejected_status_t;
/**
* \ref DCPS_Status_LivelinessChanged
*/
typedef struct dds_liveliness_changed_status
{
uint32_t alive_count;
uint32_t not_alive_count;
int32_t alive_count_change;
int32_t not_alive_count_change;
dds_instance_handle_t last_publication_handle;
}
dds_liveliness_changed_status_t;
/**
* \ref DCPS_Status_RequestedDeadlineMissed
*/
typedef struct dds_requested_deadline_missed_status
{
uint32_t total_count;
int32_t total_count_change;
dds_instance_handle_t last_instance_handle;
}
dds_requested_deadline_missed_status_t;
/**
* \ref DCPS_Status_RequestedIncompatibleQoS
*/
typedef struct dds_requested_incompatible_qos_status
{
uint32_t total_count;
int32_t total_count_change;
uint32_t last_policy_id;
}
dds_requested_incompatible_qos_status_t;
/**
* \ref DCPS_Status_SampleLost
*/
typedef struct dds_sample_lost_status
{
uint32_t total_count;
int32_t total_count_change;
}
dds_sample_lost_status_t;
/**
* \ref DCPS_Status_InconsistentTopic
*/
typedef struct dds_inconsistent_topic_status
{
uint32_t total_count;
int32_t total_count_change;
}
dds_inconsistent_topic_status_t;
/*
get_<status> APIs return the status of an entity and resets the status
*/
/**
* @brief Get INCONSISTENT_TOPIC status
*
* This operation gets the status value corresponding to INCONSISTENT_TOPIC
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] topic The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_InconsistentTopic to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_inconsistent_topic_status (
dds_entity_t topic,
dds_inconsistent_topic_status_t * status);
/**
* @brief Get PUBLICATION_MATCHED status
*
* This operation gets the status value corresponding to PUBLICATION_MATCHED
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] writer The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_PublicationMatched to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_publication_matched_status (
dds_entity_t writer,
dds_publication_matched_status_t * status);
/**
* @brief Get LIVELINESS_LOST status
*
* This operation gets the status value corresponding to LIVELINESS_LOST
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] writer The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_LivelinessLost to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_liveliness_lost_status (
dds_entity_t writer,
dds_liveliness_lost_status_t * status);
/**
* @brief Get OFFERED_DEADLINE_MISSED status
*
* This operation gets the status value corresponding to OFFERED_DEADLINE_MISSED
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] writer The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_OfferedDeadlineMissed to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_offered_deadline_missed_status(
dds_entity_t writer,
dds_offered_deadline_missed_status_t *status);
/**
* @brief Get OFFERED_INCOMPATIBLE_QOS status
*
* This operation gets the status value corresponding to OFFERED_INCOMPATIBLE_QOS
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] writer The writer entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_OfferedIncompatibleQoS to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_offered_incompatible_qos_status (
dds_entity_t writer,
dds_offered_incompatible_qos_status_t * status);
/**
* @brief Get SUBSCRIPTION_MATCHED status
*
* This operation gets the status value corresponding to SUBSCRIPTION_MATCHED
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] reader The reader entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_SubscriptionMatched to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_subscription_matched_status (
dds_entity_t reader,
dds_subscription_matched_status_t * status);
/**
* @brief Get LIVELINESS_CHANGED status
*
* This operation gets the status value corresponding to LIVELINESS_CHANGED
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] reader The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_LivelinessChanged to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_liveliness_changed_status (
dds_entity_t reader,
dds_liveliness_changed_status_t * status);
/**
* @brief Get SAMPLE_REJECTED status
*
* This operation gets the status value corresponding to SAMPLE_REJECTED
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] reader The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_SampleRejected to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_sample_rejected_status (
dds_entity_t reader,
dds_sample_rejected_status_t * status);
/**
* @brief Get SAMPLE_LOST status
*
* This operation gets the status value corresponding to SAMPLE_LOST
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] reader The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_SampleLost to get the status
*
* @returns A dds_return_t indicating success or failure
*
* @retval DDS_RETCODE_OK
* Success
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_sample_lost_status (
dds_entity_t reader,
dds_sample_lost_status_t * status);
/**
* @brief Get REQUESTED_DEADLINE_MISSED status
*
* This operation gets the status value corresponding to REQUESTED_DEADLINE_MISSED
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] reader The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_RequestedDeadlineMissed to get the status
*
* @returns A dds_return_t indicating success or failure
*
* @retval DDS_RETCODE_OK
* Success
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_requested_deadline_missed_status (
dds_entity_t reader,
dds_requested_deadline_missed_status_t * status);
/**
* @brief Get REQUESTED_INCOMPATIBLE_QOS status
*
* This operation gets the status value corresponding to REQUESTED_INCOMPATIBLE_QOS
* and reset the status. The value can be obtained, only if the status is enabled for an entity.
* NULL value for status is allowed and it will reset the trigger value when status is enabled.
*
* @param[in] reader The entity to get the status
* @param[out] status The pointer to \ref DCPS_Status_RequestedIncompatibleQoS to get the status
*
* @returns A dds_return_t indicating success or failure
*
* @retval DDS_RETCODE_OK
* Success
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
* @retval DDS_RETCODE_BAD_PARAMETER
* One of the given arguments is not valid.
* @retval DDS_RETCODE_ILLEGAL_OPERATION
* The operation is invoked on an inappropriate object.
* @retval DDS_RETCODE_ALREADY_DELETED
* The entity has already been deleted.
*/
DDS_EXPORT dds_return_t
dds_get_requested_incompatible_qos_status (
dds_entity_t reader,
dds_requested_incompatible_qos_status_t * status);
#if defined (__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,108 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Stream API
*
* This header file defines the public API of the Streams in the
* Eclipse Cyclone DDS C language binding.
*/
#ifndef DDS_STREAM_H
#define DDS_STREAM_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "dds/export.h"
#if defined (__cplusplus)
extern "C" {
#endif
struct dds_sequence;
typedef union
{
uint8_t * p8;
uint16_t * p16;
uint32_t * p32;
uint64_t * p64;
float * pf;
double * pd;
void * pv;
}
dds_uptr_t;
typedef struct dds_stream
{
dds_uptr_t m_buffer; /* Union of pointers to start of buffer */
uint32_t m_size; /* Buffer size */
uint32_t m_index; /* Read/write offset from start of buffer */
bool m_endian; /* Endian: big (false) or little (true) */
bool m_failed; /* Attempt made to read beyond end of buffer */
}
dds_stream_t;
#define DDS_STREAM_BE false
#define DDS_STREAM_LE true
DDS_EXPORT dds_stream_t * dds_stream_create (uint32_t size);
DDS_EXPORT dds_stream_t * dds_stream_from_buffer (const void *buf, size_t sz, int bswap);
DDS_EXPORT void dds_stream_delete (dds_stream_t * st);
DDS_EXPORT void dds_stream_fini (dds_stream_t * st);
DDS_EXPORT void dds_stream_reset (dds_stream_t * st);
DDS_EXPORT void dds_stream_init (dds_stream_t * st, uint32_t size);
DDS_EXPORT void dds_stream_grow (dds_stream_t * st, uint32_t size);
DDS_EXPORT bool dds_stream_endian (void);
struct dds_topic_descriptor;
DDS_EXPORT void dds_stream_read_sample_w_desc (dds_stream_t * is, void * data, const struct dds_topic_descriptor * desc);
DDS_EXPORT bool dds_stream_read_bool (dds_stream_t * is);
DDS_EXPORT uint8_t dds_stream_read_uint8 (dds_stream_t * is);
DDS_EXPORT uint16_t dds_stream_read_uint16 (dds_stream_t * is);
DDS_EXPORT uint32_t dds_stream_read_uint32 (dds_stream_t * is);
DDS_EXPORT uint64_t dds_stream_read_uint64 (dds_stream_t * is);
DDS_EXPORT float dds_stream_read_float (dds_stream_t * is);
DDS_EXPORT double dds_stream_read_double (dds_stream_t * is);
DDS_EXPORT char * dds_stream_read_string (dds_stream_t * is);
DDS_EXPORT void dds_stream_read_buffer (dds_stream_t * is, uint8_t * buffer, uint32_t len);
inline char dds_stream_read_char (dds_stream_t *is) { return (char) dds_stream_read_uint8 (is); }
inline int8_t dds_stream_read_int8 (dds_stream_t *is) { return (int8_t) dds_stream_read_uint8 (is); }
inline int16_t dds_stream_read_int16 (dds_stream_t *is) { return (int16_t) dds_stream_read_uint16 (is); }
inline int32_t dds_stream_read_int32 (dds_stream_t *is) { return (int32_t) dds_stream_read_uint32 (is); }
inline int64_t dds_stream_read_int64 (dds_stream_t *is) { return (int64_t) dds_stream_read_uint64 (is); }
DDS_EXPORT void dds_stream_write_bool (dds_stream_t * os, bool val);
DDS_EXPORT void dds_stream_write_uint8 (dds_stream_t * os, uint8_t val);
DDS_EXPORT void dds_stream_write_uint16 (dds_stream_t * os, uint16_t val);
DDS_EXPORT void dds_stream_write_uint32 (dds_stream_t * os, uint32_t val);
DDS_EXPORT void dds_stream_write_uint64 (dds_stream_t * os, uint64_t val);
DDS_EXPORT void dds_stream_write_float (dds_stream_t * os, float val);
DDS_EXPORT void dds_stream_write_double (dds_stream_t * os, double val);
DDS_EXPORT void dds_stream_write_string (dds_stream_t * os, const char * val);
DDS_EXPORT void dds_stream_write_buffer (dds_stream_t * os, uint32_t len, const uint8_t * buffer);
DDS_EXPORT void *dds_stream_address (dds_stream_t * s);
DDS_EXPORT void *dds_stream_alignto (dds_stream_t * s, uint32_t a);
inline void dds_stream_write_char (dds_stream_t * os, char val) { dds_stream_write_uint8 (os, (uint8_t) val); }
inline void dds_stream_write_int8 (dds_stream_t * os, int8_t val) { dds_stream_write_uint8 (os, (uint8_t) val); }
inline void dds_stream_write_int16 (dds_stream_t * os, int16_t val) { dds_stream_write_uint16 (os, (uint16_t) val); }
inline void dds_stream_write_int32 (dds_stream_t * os, int32_t val) { dds_stream_write_uint32 (os, (uint32_t) val); }
inline void dds_stream_write_int64 (dds_stream_t * os, int64_t val) { dds_stream_write_uint64 (os, (uint64_t) val); }
#if defined (__cplusplus)
}
#endif
#endif