Adds further ext deps as-is binaries copies from customers env.
Qt6 Migration CI / migrate (push) Canceled after 0s
Qt6 Migration CI / migrate (push) Canceled after 0s
This commit is contained in:
3700 files changed
+2132394
No files matched your search
@@ -0,0 +1,64 @@
|
||||
// Copyright(c) 2006 to 2022 ZettaScale Technology and others
|
||||
// Copyright(c) 2021 Apex.AI, Inc
|
||||
//
|
||||
// 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
|
||||
|
||||
#ifndef _DDS_BASIC_TYPES_H_
|
||||
#define _DDS_BASIC_TYPES_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Handle to an entity
|
||||
* @ingroup entity
|
||||
*
|
||||
* A valid entity handle will always have a positive integer value.
|
||||
* Should the value be negative, it is one of the DDS_RETCODE_*
|
||||
* error codes.
|
||||
*/
|
||||
typedef int32_t dds_entity_t;
|
||||
|
||||
/**
|
||||
* @anchor DDS_MIN_PSEUDO_HANDLE
|
||||
* @ingroup internal
|
||||
* @brief Pseudo Handle origin
|
||||
*
|
||||
* Some handles in CycloneDDS are 'fake', most importantly the builtin topic handles.
|
||||
* These handles are derived from this constant.
|
||||
*/
|
||||
#define DDS_MIN_PSEUDO_HANDLE ((dds_entity_t)0x7fff0000)
|
||||
|
||||
/**
|
||||
* @anchor DDS_CYCLONEDDS_HANDLE
|
||||
* @ingroup internal
|
||||
* @brief Special handle representing the entity corresponding to the CycloneDDS library itself
|
||||
*/
|
||||
#define DDS_CYCLONEDDS_HANDLE ((dds_entity_t)(DDS_MIN_PSEUDO_HANDLE + 256))
|
||||
|
||||
/**
|
||||
* @brief Structure of a GUID in any builtin topic sample.
|
||||
* @ingroup builtintopic
|
||||
*/
|
||||
typedef struct dds_builtintopic_guid
|
||||
{
|
||||
uint8_t v[16]; /**< 16-byte unique identifier */
|
||||
}
|
||||
dds_builtintopic_guid_t;
|
||||
|
||||
/**
|
||||
* @brief Structure of a GUID in any builtin topic sample.
|
||||
* @ingroup builtintopic
|
||||
* @ref dds_builtintopic_guid_t is a bit of a weird name for what everyone just calls a GUID,
|
||||
* so let us try and switch to using the more logical one.
|
||||
*/
|
||||
typedef struct dds_builtintopic_guid dds_guid_t;
|
||||
|
||||
#endif /*_DDS_PUBLIC_TYPES_H_*/
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright(c) 2023 ZettaScale Technology 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
|
||||
|
||||
#ifndef DDS_DATA_TYPE_PROPERTIES_H
|
||||
#define DDS_DATA_TYPE_PROPERTIES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Flags that are used to indicate the types used in a data type
|
||||
*/
|
||||
#define DDS_DATA_TYPE_CONTAINS_UNION (0x1ull << 0)
|
||||
#define DDS_DATA_TYPE_CONTAINS_BITMASK (0x1ull << 1)
|
||||
#define DDS_DATA_TYPE_CONTAINS_ENUM (0x1ull << 2)
|
||||
#define DDS_DATA_TYPE_CONTAINS_STRUCT (0x1ull << 3)
|
||||
#define DDS_DATA_TYPE_CONTAINS_STRING (0x1ull << 4)
|
||||
#define DDS_DATA_TYPE_CONTAINS_BSTRING (0x1ull << 5)
|
||||
#define DDS_DATA_TYPE_CONTAINS_WSTRING (0x1ull << 6)
|
||||
#define DDS_DATA_TYPE_CONTAINS_SEQUENCE (0x1ull << 7)
|
||||
#define DDS_DATA_TYPE_CONTAINS_BSEQUENCE (0x1ull << 8)
|
||||
#define DDS_DATA_TYPE_CONTAINS_ARRAY (0x1ull << 9)
|
||||
#define DDS_DATA_TYPE_CONTAINS_OPTIONAL (0x1ull << 10)
|
||||
#define DDS_DATA_TYPE_CONTAINS_EXTERNAL (0x1ull << 11)
|
||||
#define DDS_DATA_TYPE_CONTAINS_KEY (0x1ull << 12)
|
||||
#define DDS_DATA_TYPE_CONTAINS_BWSTRING (0x1ull << 13)
|
||||
#define DDS_DATA_TYPE_CONTAINS_WCHAR (0x1ull << 14)
|
||||
|
||||
#define DDS_DATA_TYPE_IS_MEMCPY_SAFE (0x1ull << 63)
|
||||
|
||||
typedef uint64_t dds_data_type_properties_t;
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright(c) 2006 to 2020 ZettaScale Technology 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
|
||||
|
||||
// WARNING This file is only needed for the work around for https://github.com/eclipse-cyclonedds/cyclonedds/issues/74
|
||||
// Do not include this file in an application! Once issue #74 is solved this header file should be removed.
|
||||
|
||||
#ifndef DDS_INTERNAL_API_H
|
||||
#define DDS_INTERNAL_API_H
|
||||
|
||||
#include "dds/export.h"
|
||||
#include "dds/dds.h"
|
||||
#include "dds/cdr/dds_cdrstream.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Magic numbers match the set of internal flags we want to use but do not want to expose in the API.
|
||||
// The implementation contains static assert to ensure this is kept in sync.
|
||||
#define DDS_PARTICIPANT_FLAGS_NO_DISCOVERY (1u | 2u | 32u)
|
||||
|
||||
/**
|
||||
* @ingroup internal
|
||||
* @component topic
|
||||
* @unstable
|
||||
* @brief Gets a CDR stream serializer type descriptor from a topic descriptor
|
||||
*
|
||||
* @param[out] desc Pointer to the target struct that can be filled with the CDR stream topic descriptor
|
||||
* @param[in] topic_desc The source topic descriptor
|
||||
*
|
||||
*/
|
||||
DDS_EXPORT void
|
||||
dds_cdrstream_desc_from_topic_desc (struct dds_cdrstream_desc *desc, const dds_topic_descriptor_t *topic_desc);
|
||||
|
||||
/**
|
||||
* @ingroup internal
|
||||
* @component participant
|
||||
* @unstable
|
||||
* @brief Create a participant with the specified GUID
|
||||
*
|
||||
* @param[in] domain The domain in which to create the participant (can be DDS_DOMAIN_DEFAULT). DDS_DOMAIN_DEFAULT is for using the domain in the configuration.
|
||||
* @param[in] qos The QoS to set on the new participant (can be NULL).
|
||||
* @param[in] listener Any listener functions associated with the new participant (can be NULL).
|
||||
* @param[in] flags The flags to be used when creating the participant
|
||||
* @param[in] guid The GUID for the new participant
|
||||
*
|
||||
* @returns A valid participant handle or an error code. @see dds_create_participant for details
|
||||
*/
|
||||
DDS_EXPORT dds_entity_t
|
||||
dds_create_participant_guid (const dds_domainid_t domain, const dds_qos_t *qos, const dds_listener_t *listener, uint32_t flags, const dds_guid_t *guid);
|
||||
|
||||
/**
|
||||
* @ingroup internal
|
||||
* @component writer
|
||||
* @unstable
|
||||
* @brief Create a writer with the specified GUID
|
||||
*
|
||||
* @param[in] participant_or_publisher The participant or publisher on which the writer is being created.
|
||||
* @param[in] topic The topic to write.
|
||||
* @param[in] qos The QoS to set on the new writer (can be NULL).
|
||||
* @param[in] listener Any listener functions associated with the new writer (can be NULL).
|
||||
* @param[in] guid The GUID for the new writer
|
||||
*
|
||||
* @returns A valid writer handle or an error code. @see dds_create_writer for details
|
||||
*/
|
||||
DDS_EXPORT dds_entity_t
|
||||
dds_create_writer_guid (dds_entity_t participant_or_publisher, dds_entity_t topic, const dds_qos_t *qos, const dds_listener_t *listener, dds_guid_t *guid);
|
||||
|
||||
/**
|
||||
* @ingroup internal
|
||||
* @component reader
|
||||
* @unstable
|
||||
* @brief Create a reader with the specified GUID
|
||||
*
|
||||
* @param[in] participant_or_subscriber The participant or subscriber on which the reader is being created.
|
||||
* @param[in] topic The topic to read.
|
||||
* @param[in] qos The QoS to set on the new reader (can be NULL).
|
||||
* @param[in] listener Any listener functions associated with the new reader (can be NULL).
|
||||
* @param[in] guid The GUID for the new reader
|
||||
*
|
||||
* @returns A valid reader handle or an error code. @see dds_create_reader for details
|
||||
*/
|
||||
DDS_EXPORT dds_entity_t
|
||||
dds_create_reader_guid (dds_entity_t participant_or_subscriber, dds_entity_t topic, const dds_qos_t *qos, const dds_listener_t *listener, dds_guid_t *guid);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
// Copyright(c) 2021 to 2023 ZettaScale Technology
|
||||
// Copyright(c) 2021 Apex.AI, Inc
|
||||
//
|
||||
// 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
|
||||
|
||||
/**
|
||||
* @defgroup loaned_sample (Loaned samples)
|
||||
* @ingroup dds
|
||||
*/
|
||||
|
||||
#ifndef DDS_LOANED_SAMPLE_H
|
||||
#define DDS_LOANED_SAMPLE_H
|
||||
|
||||
#include "dds/export.h"
|
||||
#include "dds/ddsrt/retcode.h"
|
||||
#include "dds/ddsrt/atomics.h"
|
||||
#include "dds/ddsrt/time.h"
|
||||
#include "dds/ddsrt/attributes.h"
|
||||
#include "dds/ddsc/dds_basic_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct dds_loan_pool;
|
||||
struct dds_loaned_sample;
|
||||
struct dds_psmx_endpoint;
|
||||
|
||||
/**
|
||||
* @brief State of the data contained in a Loaned Sample
|
||||
* @ingroup loaned_sample
|
||||
*
|
||||
*/
|
||||
typedef enum dds_loaned_sample_state {
|
||||
DDS_LOANED_SAMPLE_STATE_UNITIALIZED, //!< state not set yet; not passed through PSMX interface
|
||||
DDS_LOANED_SAMPLE_STATE_RAW_KEY, //!< application representation, only key fields initialized
|
||||
DDS_LOANED_SAMPLE_STATE_RAW_DATA, //!< application representation, full sample initialized
|
||||
DDS_LOANED_SAMPLE_STATE_SERIALIZED_KEY, //!< CDR/XCDR1/XCDR2-serialized key value serialized
|
||||
DDS_LOANED_SAMPLE_STATE_SERIALIZED_DATA //!< CDR/XCDR1/XCDR2-serialized sample value serialized
|
||||
} dds_loaned_sample_state_t;
|
||||
|
||||
/**
|
||||
* @brief Identifier used to distinguish between raw data types (C/C++/Python/...) in a Loaned Sample
|
||||
* @ingroup loaned_sample
|
||||
*/
|
||||
typedef uint32_t dds_loan_data_type_t;
|
||||
|
||||
/**
|
||||
* @brief Definition for function to free a Loaned Sample
|
||||
* @ingroup loaned_sample
|
||||
*
|
||||
* @param[in] loaned_sample A loaned sample
|
||||
*/
|
||||
typedef void (*dds_loaned_sample_free_f) (struct dds_loaned_sample *loaned_sample)
|
||||
ddsrt_nonnull_all;
|
||||
|
||||
/**
|
||||
* @brief Container for implementation specific operations
|
||||
* @ingroup loaned_sample
|
||||
*/
|
||||
typedef struct dds_loaned_sample_ops {
|
||||
dds_loaned_sample_free_f free;
|
||||
} dds_loaned_sample_ops_t;
|
||||
|
||||
typedef enum dds_loaned_sample_origin_kind {
|
||||
DDS_LOAN_ORIGIN_KIND_HEAP, //!< Loaned sample allocated on the heap (and owned by Cyclone DDS)
|
||||
DDS_LOAN_ORIGIN_KIND_PSMX //!< Loaned sample owned by a PSMX Endpoint
|
||||
} dds_loaned_sample_origin_kind_t;
|
||||
|
||||
typedef struct dds_loaned_sample_origin {
|
||||
enum dds_loaned_sample_origin_kind origin_kind; //!< Whether on the HEAP or provided by a PSMX Endpoint
|
||||
struct dds_psmx_endpoint *psmx_endpoint; //!< Owning PSMX Endpoint, null if KIND_HEAP
|
||||
} dds_loaned_sample_origin_t;
|
||||
|
||||
/**
|
||||
* @brief The definition of a Loaned Sample
|
||||
* @ingroup loaned_sample
|
||||
*/
|
||||
typedef struct dds_loaned_sample {
|
||||
dds_loaned_sample_ops_t ops; //!< the implementation specific ops for this sample
|
||||
struct dds_loaned_sample_origin loan_origin; //!< the origin of the loan
|
||||
struct dds_psmx_metadata * metadata; //!< pointer to the associated metadata
|
||||
void * sample_ptr; //!< pointer to the loaned sample
|
||||
ddsrt_atomic_uint32_t refc; //!< the number of references to this loan
|
||||
} dds_loaned_sample_t;
|
||||
|
||||
/**
|
||||
* @brief Generic function to increase the refcount for a loaned sample
|
||||
* @ingroup loaned_sample
|
||||
*
|
||||
* @param[in] loaned_sample A loaned sample
|
||||
*/
|
||||
DDS_INLINE_EXPORT inline void ddsrt_nonnull_all dds_loaned_sample_ref (dds_loaned_sample_t *loaned_sample) {
|
||||
ddsrt_atomic_inc32 (&loaned_sample->refc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generic function to decrease the refcount for a loaned sample
|
||||
* @ingroup loaned_sample
|
||||
*
|
||||
* Calls the PSMX plugin specific free function once the reference count reaches 0.
|
||||
*
|
||||
* Loaned Samples are freed in the order in which their reference counts drop to 0.
|
||||
*
|
||||
* On the writing side, writing (or "returning") Loaned Samples in the order in which they
|
||||
* were requested will ensure that the "free" operations is also invoked in the that
|
||||
* order.
|
||||
*
|
||||
* On the reading side, the `serdata` constructed by `dds_reader_store_loaned_sample` may
|
||||
* or may not reference the Loaned Sample, and if not the Loaned Sample will be dropped
|
||||
* once the PSMX Plugin invokes `dds_loaned_sample_unref` on it.
|
||||
*
|
||||
* Otherwise, the Loaned Sample will be referenced by a sample in the reader history cache
|
||||
* and stay there until it gets dropped (and the PSMX Plugin also invokes
|
||||
* `dds_loaned_sample_unref` on it). If the reading application does not use loans in the
|
||||
* reads/takes, that will be once it is pushed out of the history or taken. If the
|
||||
* application uses `takecdr` or `take_with_collector`, then it is dependent on when the
|
||||
* application logic drops the serdata via `ddsi_serdata_unref`.
|
||||
*
|
||||
* If the application does use loans in reads/takes, and Cyclone DDS decides to hand the
|
||||
* data in the Loaned Sample to the application, the earliest time at which it can be
|
||||
* dropped is when it is removed from the reader history cache *and* the loan is returned
|
||||
* by the application using `dds_return_loan`.
|
||||
*
|
||||
* @param[in] loaned_sample A loaned sample
|
||||
*/
|
||||
DDS_INLINE_EXPORT inline void ddsrt_nonnull_all dds_loaned_sample_unref (dds_loaned_sample_t *loaned_sample) {
|
||||
if (ddsrt_atomic_dec32_ov (&loaned_sample->refc) == 1)
|
||||
loaned_sample->ops.free (loaned_sample);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief insert data from a loaned sample into the reader history cache
|
||||
* @ingroup reading
|
||||
*
|
||||
* Constructs a serdata of the reader's type from the loaned sample and stores it in the
|
||||
* reader's history cache. If the serdata references the loan, `dds_loaned_sample_ref` is
|
||||
* used to increment its reference count.
|
||||
*
|
||||
* If data is not from a known writer, this is a no-op.
|
||||
*
|
||||
* @param[in] reader The reader entity.
|
||||
* @param[in] data Pointer to the loaned sample of the entity received
|
||||
*
|
||||
* @returns A dds_return_t indicating success or failure.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The operation was successful.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more parameters are invalid.
|
||||
* @retval DDS_RETCODE_ILLEGAL_OPERATION
|
||||
* The operation is invoked on an inappropriate object.
|
||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||
* The reader entity has already been deleted.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_reader_store_loaned_sample (dds_entity_t reader, dds_loaned_sample_t *data)
|
||||
ddsrt_nonnull_all;
|
||||
|
||||
/**
|
||||
* @brief insert data from a loaned sample into the reader history cache using the provided writer meta-data
|
||||
* @ingroup reading
|
||||
*
|
||||
* Constructs a serdata of the reader's type from the loaned sample and stores it in the
|
||||
* reader's history cache. If the serdata references the loan, `dds_loaned_sample_ref` is
|
||||
* used to increment its reference count.
|
||||
*
|
||||
* It is equivalent to `dds_reader_store_loaned_sample`, except that for this function no
|
||||
* writer look-up takes place (it doesn't need to because the required information is
|
||||
* passed in directly) and data unknown writers is accepted.
|
||||
|
||||
* @param[in] reader The reader entity.
|
||||
* @param[in] data Pointer to the loaned sample of the entity received
|
||||
* @param[in] ownership_strength The ownership strength of the writer
|
||||
* @param[in] autodispose_unregistered_instances Writer setting for auto-disposing unregistered entities
|
||||
* @param[in] lifespan_duration Lifespan duration value configured for the writer
|
||||
*
|
||||
* @returns A dds_return_t indicating success or failure.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The operation was successful.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more parameters are invalid.
|
||||
* @retval DDS_RETCODE_ILLEGAL_OPERATION
|
||||
* The operation is invoked on an inappropriate object.
|
||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||
* The reader entity has already been deleted.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_reader_store_loaned_sample_wr_metadata (dds_entity_t reader, dds_loaned_sample_t *data, int32_t ownership_strength, bool autodispose_unregistered_instances, dds_duration_t lifespan_duration)
|
||||
ddsrt_nonnull_all;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDS_LOANED_SAMPLE_H */
|
||||
+676
@@ -0,0 +1,676 @@
|
||||
// Copyright(c) 2021 to 2022 ZettaScale Technology 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
|
||||
|
||||
#ifndef DDS_OPCODES_H
|
||||
#define DDS_OPCODES_H
|
||||
|
||||
#include "dds/ddsrt/align.h"
|
||||
#include "dds/ddsrt/static_assert.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup serialization (Serialization)
|
||||
* @ingroup dds
|
||||
*
|
||||
* Opcodes for (de)serialization of types generated by idlc. Isolated in a
|
||||
* separate header to share with idlc without the need to pull in the entire
|
||||
* Eclipse Cyclone DDS C language binding.
|
||||
*
|
||||
* One opcode is a uint32 and depending on which code it is can contain several uint32 arguments.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the OP
|
||||
*/
|
||||
#define DDS_OP_MASK 0xff000000
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_TYPE_FLAGS_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the OP type flags
|
||||
*/
|
||||
#define DDS_OP_TYPE_FLAGS_MASK 0x00800000
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_TYPE_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the OP type
|
||||
*/
|
||||
#define DDS_OP_TYPE_MASK 0x007f0000
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_SUBTYPE_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the OP subtype
|
||||
*/
|
||||
#define DDS_OP_SUBTYPE_MASK 0x0000ff00
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_JMP_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the OP jump
|
||||
*/
|
||||
#define DDS_OP_JMP_MASK 0x0000ffff
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAGS_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the OP flags
|
||||
*/
|
||||
#define DDS_OP_FLAGS_MASK 0x000000ff
|
||||
|
||||
/**
|
||||
* @anchor DDS_JEQ_TYPE_FLAGS_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the JEQ type flags
|
||||
*/
|
||||
#define DDS_JEQ_TYPE_FLAGS_MASK 0x00800000
|
||||
|
||||
/**
|
||||
* @anchor DDS_JEQ_TYPE_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the JEQ type
|
||||
*/
|
||||
#define DDS_JEQ_TYPE_MASK 0x007f0000
|
||||
|
||||
/**
|
||||
* @anchor DDS_PLM_FLAGS_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the PLM flags
|
||||
*/
|
||||
#define DDS_PLM_FLAGS_MASK 0x00ff0000
|
||||
|
||||
/**
|
||||
* @anchor DDS_KOF_OFFSET_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Mask for the KOF offset
|
||||
*/
|
||||
#define DDS_KOF_OFFSET_MASK 0x0000ffff
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP
|
||||
* @ingroup serialization
|
||||
* @brief Extract the DDS OP from a uint32 as a \ref dds_stream_opcode
|
||||
*/
|
||||
#define DDS_OP(o) ((enum dds_stream_opcode) ((o) & DDS_OP_MASK))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_TYPE
|
||||
* @ingroup serialization
|
||||
* @brief Extract the DDS OP_TYPE from a uint32 as a \ref dds_stream_typecode
|
||||
*/
|
||||
#define DDS_OP_TYPE(o) ((enum dds_stream_typecode) (((o) & DDS_OP_TYPE_MASK) >> 16))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_TYPE_FLAGS
|
||||
* @ingroup serialization
|
||||
* @brief Extract the DDS OP_TYPE_FLAGS from a uint32
|
||||
* DOC_TODO: possible values?
|
||||
*/
|
||||
#define DDS_OP_TYPE_FLAGS(o) ((o) & DDS_OP_TYPE_FLAGS_MASK)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_SUBTYPE
|
||||
* @ingroup serialization
|
||||
* @brief Extract the DDS OP_SUBTYPE from a uint32 as a \ref dds_stream_typecode
|
||||
* Used for collections, the OP_TYPE is array/sequence
|
||||
*/
|
||||
#define DDS_OP_SUBTYPE(o) ((enum dds_stream_typecode) (((o) & DDS_OP_SUBTYPE_MASK) >> 8))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAGS
|
||||
* @ingroup serialization
|
||||
* @brief Extract the DDS OP_FLAGS from a uint32
|
||||
* DOC_TODO: possible values?
|
||||
*/
|
||||
#define DDS_OP_FLAGS(o) ((o) & DDS_OP_FLAGS_MASK)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_ADR_JSR
|
||||
* @ingroup serialization
|
||||
* @brief Extract the ADR JSR from a uint32
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_OP_ADR_JSR(o) ((int16_t) ((o) & DDS_OP_JMP_MASK))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_ADR_PLM
|
||||
* @ingroup serialization
|
||||
* @brief Extract the ADR PLM from a uint32
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_OP_ADR_PLM(o) ((int16_t) ((o) & DDS_OP_JMP_MASK))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_LENGTH
|
||||
* @ingroup serialization
|
||||
* @brief Extract the LENGTH from a uint32
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_OP_LENGTH(o) ((uint16_t) ((o) & DDS_OP_JMP_MASK))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_JUMP
|
||||
* @ingroup serialization
|
||||
* @brief Extract the JUMP from a uint32
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_OP_JUMP(o) ((int16_t) ((o) & DDS_OP_JMP_MASK))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_ADR_JMP
|
||||
* @ingroup serialization
|
||||
* @brief Extract the ADR_JMP from a uint32
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_OP_ADR_JMP(o) ((o) >> 16)
|
||||
|
||||
/**
|
||||
* @anchor DDS_JEQ_TYPE
|
||||
* @ingroup serialization
|
||||
* @brief Extract the JEQ_TYPE from a uint32 as a \ref dds_stream_typecode
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_JEQ_TYPE(o) ((enum dds_stream_typecode) (((o) & DDS_JEQ_TYPE_MASK) >> 16))
|
||||
|
||||
/**
|
||||
* @anchor DDS_JEQ_TYPE_FLAGS
|
||||
* @ingroup serialization
|
||||
* @brief Extract the JEQ_TYPE_FLAGS from a uint32
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_JEQ_TYPE_FLAGS(o) ((o) & DDS_JEQ_TYPE_FLAGS_MASK)
|
||||
|
||||
/**
|
||||
* @anchor DDS_PLM_FLAGS
|
||||
* @ingroup serialization
|
||||
* @brief Extract the PLM_FLAGS from a uint32 as a \ref dds_stream_typecode
|
||||
* DOC_TODO: meaning?
|
||||
*/
|
||||
#define DDS_PLM_FLAGS(o) ((enum dds_stream_typecode) (((o) & DDS_PLM_FLAGS_MASK) >> 16))
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup serialization
|
||||
* @brief Topic encoding instruction types
|
||||
*/
|
||||
enum dds_stream_opcode {
|
||||
/** return from subroutine, exits top-level
|
||||
[RTS, 0, 0, 0] */
|
||||
DDS_OP_RTS = 0x00 << 24,
|
||||
|
||||
/** data field
|
||||
[ADR, nBY, 0, f] [offset]
|
||||
[ADR, BLN, 0, f] [offset]
|
||||
[ADR, WCHAR, 0, f] [offset]
|
||||
[ADR, ENU, 0, f] [offset] [max]
|
||||
[ADR, BMK, 0, f] [offset] [bits-high] [bits-low]
|
||||
[ADR, STR, 0, f] [offset]
|
||||
[ADR, WSTR, 0, f] [offset]
|
||||
[ADR, BST, 0, f] [offset] [max-size]
|
||||
[ADR, BWSTR, 0, f] [offset] [max-size]
|
||||
|
||||
[ADR, SEQ, nBY, f] [offset]
|
||||
[ADR, SEQ, BLN, f] [offset]
|
||||
[ADR, SEQ, WCHAR, f] [offset]
|
||||
[ADR, SEQ, ENU, f] [offset] [max]
|
||||
[ADR, SEQ, BMK, f] [offset] [bits-high] [bits-low]
|
||||
[ADR, SEQ, STR, f] [offset]
|
||||
[ADR, SEQ, WSTR, f] [offset]
|
||||
[ADR, SEQ, BST, f] [offset] [max-size]
|
||||
[ADR, SEQ, BWSTR, f] [offset] [max-size]
|
||||
[ADR, SEQ, s, f] [offset] [elem-size] [next-insn, elem-insn]
|
||||
where s = {SEQ,ARR,UNI,STU,BSQ}
|
||||
[ADR, SEQ, EXT, f] *** not supported
|
||||
|
||||
[ADR, BSQ, nBY, f] [offset] [sbound]
|
||||
[ADR, BSQ, BLN, f] [offset] [sbound]
|
||||
[ADR, BSQ, WCHAR, f] [offset] [sbound]
|
||||
[ADR, BSQ, ENU, f] [offset] [sbound] [max]
|
||||
[ADR, BSQ, BMK, f] [offset] [sbound] [bits-high] [bits-low]
|
||||
[ADR, BSQ, STR, f] [offset] [sbound]
|
||||
[ADR, BSQ, WSTR, f] [offset] [sbound]
|
||||
[ADR, BSQ, BST, f] [offset] [sbound] [max-size]
|
||||
[ADR, BSQ, BWSTR, f] [offset] [sbound] [max-size]
|
||||
[ADR, BSQ, s, f] [offset] [sbound] [elem-size] [next-insn, elem-insn]
|
||||
where s = {SEQ,ARR,UNI,STU,BSQ}
|
||||
[ADR, BSQ, EXT, f] *** not supported
|
||||
|
||||
[ADR, ARR, nBY, f] [offset] [alen]
|
||||
[ADR, ARR, BLN, f] [offset] [alen]
|
||||
[ADR, ARR, WCHAR, f] [offset] [alen]
|
||||
[ADR, ARR, ENU, f] [offset] [alen] [max]
|
||||
[ADR, ARR, BMK, f] [offset] [alen] [bits-high] [bits-low]
|
||||
[ADR, ARR, STR, f] [offset] [alen]
|
||||
[ADR, ARR, WSTR, f] [offset] [alen]
|
||||
[ADR, ARR, BST, f] [offset] [alen] [0] [max-size]
|
||||
[ADR, ARR, BWSTR, f] [offset] [alen] [0] [max-size]
|
||||
[ADR, ARR, s, f] [offset] [alen] [next-insn, elem-insn] [elem-size]
|
||||
where s = {SEQ,ARR,UNI,STU,BSQ}
|
||||
[ADR, ARR, EXT, f] *** not supported
|
||||
|
||||
[ADR, UNI, d, z] [offset] [alen] [next-insn, cases]
|
||||
[ADR, UNI, ENU, z] [offset] [alen] [next-insn, cases] [max]
|
||||
[ADR, UNI, EXT, f] *** not supported
|
||||
where
|
||||
d = discriminant type of {1BY,2BY,4BY,BLN}
|
||||
z = default present/not present (DDS_OP_FLAG_DEF)
|
||||
offset = discriminant offset
|
||||
max = max enum value
|
||||
followed by alen case labels: in JEQ format
|
||||
|
||||
[ADR, e | EXT, 0, f] [offset] [next-insn, elem-insn] [elem-size iff "external" flag e is set, or flag f has DDS_OP_FLAG_OPT]
|
||||
[ADR, STU, 0, f] *** not supported
|
||||
where
|
||||
s = subtype
|
||||
e = external: stored as external data (pointer) (DDS_OP_FLAG_EXT)
|
||||
f = flags:
|
||||
- key/not key (DDS_OP_FLAG_KEY)
|
||||
- base type member, used with EXT type (DDS_OP_FLAG_BASE)
|
||||
- optional (DDS_OP_FLAG_OPT)
|
||||
- must-understand (DDS_OP_FLAG_MU)
|
||||
- storage size, only for ENU and BMK (n << DDS_OP_FLAG_SZ_SHIFT)
|
||||
[offset] = field offset from start of element in memory
|
||||
[elem-size] = element size in memory (elem-size is only included in case 'external' flag is set)
|
||||
[max-size] = string bound + 1
|
||||
[max] = max enum value
|
||||
[bits-..] = identified bits in the bitmask, split into high and low 32 bits
|
||||
[alen] = array length, number of cases
|
||||
[sbound] = bounded sequence maximum number of elements
|
||||
[next-insn] = (unsigned 16 bits) offset to instruction for next field, from start of insn
|
||||
[elem-insn] = (unsigned 16 bits) offset to first instruction for element, from start of insn
|
||||
[cases] = (unsigned 16 bits) offset to first case label, from start of insn
|
||||
*/
|
||||
DDS_OP_ADR = 0x01 << 24,
|
||||
|
||||
/** jump-to-subroutine (e.g. used for recursive types and appendable unions)
|
||||
[JSR, 0, e]
|
||||
where
|
||||
e = (signed 16 bits) offset to first instruction in subroutine, from start of insn
|
||||
instruction sequence must end in RTS, execution resumes at instruction
|
||||
following JSR */
|
||||
DDS_OP_JSR = 0x02 << 24,
|
||||
|
||||
/** jump-if-equal, used for union cases:
|
||||
[JEQ, nBY, 0] [disc] [offset]
|
||||
[JEQ, BLN, 0] [disc] [offset]
|
||||
[JEQ, STR, 0] [disc] [offset]
|
||||
[JEQ, s, i] [disc] [offset]
|
||||
[JEQ4, e | nBY, 0] [disc] [offset] 0
|
||||
[JEQ4, e | STR, 0] [disc] [offset] 0
|
||||
[JEQ4, e | ENU, f] [disc] [offset] [max]
|
||||
[JEQ4, EXT, 0] *** not supported, use STU/UNI for external defined types
|
||||
[JEQ4, e | s, i] [disc] [offset] [elem-size iff "external" flag e is set, else 0]
|
||||
where
|
||||
e = external: stored as external data (pointer) (DDS_OP_FLAG_EXT)
|
||||
s = subtype other than {nBY,STR} for JEQ and {nBY,STR,ENU,EXT} for JEQ4
|
||||
(note that BMK cannot be inline, because it needs 2 additional instructions
|
||||
for the bits that are identified in the bitmask type)
|
||||
i = (unsigned 16 bits) offset to first instruction for case, from start of insn
|
||||
instruction sequence must end in RTS, at which point executes continues
|
||||
at the next field's instruction as specified by the union
|
||||
f = size flags for ENU instruction
|
||||
|
||||
Note that the JEQ instruction is deprecated and replaced by the JEQ4 instruction. The
|
||||
IDL compiler only generates JEQ4 for union cases, the JEQ instruction is included here
|
||||
for backwards compatibility (topic descriptors generated with a previous version of IDLC)
|
||||
*/
|
||||
DDS_OP_JEQ = 0x03 << 24,
|
||||
|
||||
/** XCDR2 delimited CDR (inserts DHEADER before type)
|
||||
[DLC, 0, 0]
|
||||
*/
|
||||
DDS_OP_DLC = 0x04 << 24,
|
||||
|
||||
/** XCDR2 parameter list CDR (inserts DHEADER before type and EMHEADER before each member)
|
||||
[PLC, 0, 0]
|
||||
followed by a list of JEQ instructions
|
||||
*/
|
||||
DDS_OP_PLC = 0x05 << 24,
|
||||
|
||||
/**
|
||||
[PLM, f, elem-insn] [member id]
|
||||
for members of aggregated mutable types (pl-cdr):
|
||||
where
|
||||
f = flags:
|
||||
- jump to base type (DDS_OP_FLAG_BASE)
|
||||
[elem-insn] = (unsigned 16 bits) offset to instruction for element, from start of insn
|
||||
when FLAG_BASE is set, this is the offset of the PLM list of the base type
|
||||
[member id] = id for this member (0 in case FLAG_BASE is set)
|
||||
*/
|
||||
DDS_OP_PLM = 0x06 << 24,
|
||||
|
||||
/** Key offset list
|
||||
[KOF, 0, n] [offset-1] ... [offset-n]
|
||||
where
|
||||
n = number of key offsets in following ops
|
||||
offset = Offset of the key field relative to the previous offset, repeated n times when key is
|
||||
in a nested struct. In case of inheritance of mutable structs, a single offset of
|
||||
the key member relative to the first op of the top-level type (index 0).
|
||||
*/
|
||||
DDS_OP_KOF = 0x07 << 24,
|
||||
|
||||
/** see comment for JEQ/JEQ4 above */
|
||||
DDS_OP_JEQ4 = 0x08 << 24
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup serialization
|
||||
* @brief datatypes as recognized by serialization VM.
|
||||
*/
|
||||
enum dds_stream_typecode {
|
||||
DDS_OP_VAL_1BY = 0x01, /**< one byte simple type (char, octet) */
|
||||
DDS_OP_VAL_2BY = 0x02, /**< two byte simple type ((unsigned) short) */
|
||||
DDS_OP_VAL_4BY = 0x03, /**< four byte simple type ((unsigned) long, float) */
|
||||
DDS_OP_VAL_8BY = 0x04, /**< eight byte simple type ((unsigned) long long, double) */
|
||||
DDS_OP_VAL_STR = 0x05, /**< string */
|
||||
DDS_OP_VAL_BST = 0x06, /**< bounded string */
|
||||
DDS_OP_VAL_SEQ = 0x07, /**< sequence */
|
||||
DDS_OP_VAL_ARR = 0x08, /**< array */
|
||||
DDS_OP_VAL_UNI = 0x09, /**< union */
|
||||
DDS_OP_VAL_STU = 0x0a, /**< struct */
|
||||
DDS_OP_VAL_BSQ = 0x0b, /**< bounded sequence */
|
||||
DDS_OP_VAL_ENU = 0x0c, /**< enumerated value (long) */
|
||||
DDS_OP_VAL_EXT = 0x0d, /**< field with external definition */
|
||||
DDS_OP_VAL_BLN = 0x0e, /**< boolean */
|
||||
DDS_OP_VAL_BMK = 0x0f, /**< bitmask */
|
||||
DDS_OP_VAL_WSTR = 0x10, /**< wstring (UTF-16) */
|
||||
DDS_OP_VAL_BWSTR = 0x11, /**< bounded wstring (UTF-16) */
|
||||
DDS_OP_VAL_WCHAR = 0x12 /**< wchar: UTF-16, no surrogates allowed */
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup serialization
|
||||
* @brief primary type code for DDS_OP_ADR, DDS_OP_JEQ
|
||||
* Convinience pre-bitshifted values.
|
||||
*/
|
||||
enum dds_stream_typecode_primary {
|
||||
DDS_OP_TYPE_1BY = DDS_OP_VAL_1BY << 16, /**< one byte simple type (char, octet) */
|
||||
DDS_OP_TYPE_2BY = DDS_OP_VAL_2BY << 16, /**< two byte simple type ((unsigned) short) */
|
||||
DDS_OP_TYPE_4BY = DDS_OP_VAL_4BY << 16, /**< four byte simple type ((unsigned) long, float) */
|
||||
DDS_OP_TYPE_8BY = DDS_OP_VAL_8BY << 16, /**< eight byte simple type ((unsigned) long long, double) */
|
||||
DDS_OP_TYPE_STR = DDS_OP_VAL_STR << 16, /**< string */
|
||||
DDS_OP_TYPE_BST = DDS_OP_VAL_BST << 16, /**< bounded string */
|
||||
DDS_OP_TYPE_SEQ = DDS_OP_VAL_SEQ << 16, /**< sequence */
|
||||
DDS_OP_TYPE_ARR = DDS_OP_VAL_ARR << 16, /**< array */
|
||||
DDS_OP_TYPE_UNI = DDS_OP_VAL_UNI << 16, /**< union */
|
||||
DDS_OP_TYPE_STU = DDS_OP_VAL_STU << 16, /**< struct */
|
||||
DDS_OP_TYPE_BSQ = DDS_OP_VAL_BSQ << 16, /**< bounded sequence */
|
||||
DDS_OP_TYPE_ENU = DDS_OP_VAL_ENU << 16, /**< enumerated value (long) */
|
||||
DDS_OP_TYPE_EXT = DDS_OP_VAL_EXT << 16, /**< field with external definition */
|
||||
DDS_OP_TYPE_BLN = DDS_OP_VAL_BLN << 16, /**< boolean */
|
||||
DDS_OP_TYPE_BMK = DDS_OP_VAL_BMK << 16, /**< bitmask */
|
||||
DDS_OP_TYPE_WSTR = DDS_OP_VAL_WSTR << 16, /**< wstring (UTF-16) */
|
||||
DDS_OP_TYPE_BWSTR = DDS_OP_VAL_BWSTR << 16, /**< bounded wstring (UTF-16) */
|
||||
DDS_OP_TYPE_WCHAR = DDS_OP_VAL_WCHAR << 16 /**< wchar: UTF-16, no surrogates allowed */
|
||||
};
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_EXT
|
||||
* @ingroup serialization
|
||||
* @brief This flag indicates that the type has external data
|
||||
* (i.e. a mapped to a pointer type), which can be the case because of (1) the \@external annotation
|
||||
* in idl or (2) the \@optional annotation (optional fields are also mapped to pointer types as described
|
||||
* in the XTypes spec). This flag is stored in the most-significant bit of the 'type' part of the
|
||||
* serializer instruction.
|
||||
*/
|
||||
#define DDS_OP_FLAG_EXT (1u << 23)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup serialization
|
||||
* @brief sub-type code
|
||||
* - encodes element type for DDS_OP_TYPE_{SEQ,ARR},
|
||||
* - discriminant type for DDS_OP_TYPE_UNI
|
||||
* Convinience pre-bitshifted values.
|
||||
*/
|
||||
enum dds_stream_typecode_subtype {
|
||||
DDS_OP_SUBTYPE_1BY = DDS_OP_VAL_1BY << 8, /**< one byte simple type (char, octet) */
|
||||
DDS_OP_SUBTYPE_2BY = DDS_OP_VAL_2BY << 8, /**< two byte simple type ((unsigned) short) */
|
||||
DDS_OP_SUBTYPE_4BY = DDS_OP_VAL_4BY << 8, /**< four byte simple type ((unsigned) long, float) */
|
||||
DDS_OP_SUBTYPE_8BY = DDS_OP_VAL_8BY << 8, /**< eight byte simple type ((unsigned) long long, double) */
|
||||
DDS_OP_SUBTYPE_STR = DDS_OP_VAL_STR << 8, /**< string */
|
||||
DDS_OP_SUBTYPE_BST = DDS_OP_VAL_BST << 8, /**< bounded string */
|
||||
DDS_OP_SUBTYPE_SEQ = DDS_OP_VAL_SEQ << 8, /**< sequence */
|
||||
DDS_OP_SUBTYPE_ARR = DDS_OP_VAL_ARR << 8, /**< array */
|
||||
DDS_OP_SUBTYPE_UNI = DDS_OP_VAL_UNI << 8, /**< union */
|
||||
DDS_OP_SUBTYPE_STU = DDS_OP_VAL_STU << 8, /**< struct */
|
||||
DDS_OP_SUBTYPE_BSQ = DDS_OP_VAL_BSQ << 8, /**< bounded sequence */
|
||||
DDS_OP_SUBTYPE_ENU = DDS_OP_VAL_ENU << 8, /**< enumerated value (long) */
|
||||
DDS_OP_SUBTYPE_BLN = DDS_OP_VAL_BLN << 8, /**< boolean */
|
||||
DDS_OP_SUBTYPE_BMK = DDS_OP_VAL_BMK << 8, /**< bitmask */
|
||||
DDS_OP_SUBTYPE_WSTR = DDS_OP_VAL_WSTR << 8, /**< wstring */
|
||||
DDS_OP_SUBTYPE_BWSTR = DDS_OP_VAL_BWSTR << 8, /**< bounded wstring */
|
||||
DDS_OP_SUBTYPE_WCHAR = DDS_OP_VAL_WCHAR << 8 /**< wchar: UTF-16, no surrogates allowed */
|
||||
};
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_KEY
|
||||
* @ingroup serialization
|
||||
* @brief mark field as key
|
||||
* applicable to {1,2,4,8}BY, STR, BST, ARR-of-{1,2,4,8}BY.
|
||||
* Note that when defining keys in nested types, the key flag should be set
|
||||
* on both the field(s) in the subtype and on the enclosing STU/EXT field.
|
||||
*/
|
||||
#define DDS_OP_FLAG_KEY (1u << 0)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_DEF
|
||||
* @ingroup serialization
|
||||
* @brief For a union:
|
||||
* -# the discriminator may be a key field;
|
||||
* -# there may be a default value;
|
||||
* -# and the discriminator can be an integral type (or enumerated - here treated as equivalent).
|
||||
* What it can't be is a floating-point type. So DEF and FP need never be set at the same time.
|
||||
* There are only a few flag bits, so saving one is not such a bad idea.
|
||||
*
|
||||
* union has a default case (for DDS_OP_ADR | DDS_OP_TYPE_UNI)
|
||||
*/
|
||||
#define DDS_OP_FLAG_DEF (1u << 1)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_FP
|
||||
* @ingroup serialization
|
||||
* @brief floating-point,
|
||||
* applicable to {4,8}BY and arrays, sequences of them
|
||||
*/
|
||||
#define DDS_OP_FLAG_FP (1u << 1)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_SGN
|
||||
* @ingroup serialization
|
||||
* @brief signed,
|
||||
* applicable to {1,2,4,8}BY and arrays, sequences of them
|
||||
*/
|
||||
#define DDS_OP_FLAG_SGN (1u << 2)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_MU
|
||||
* @ingroup serialization
|
||||
* @brief must-understand flag,
|
||||
* as defined by the XTypes spec.
|
||||
*/
|
||||
#define DDS_OP_FLAG_MU (1u << 3)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_BASE
|
||||
* @ingroup serialization
|
||||
* @brief jump to base type,
|
||||
* used with PLM in mutable types and for the TYPE_EXT 'parent' member
|
||||
* in final and appendable types
|
||||
*/
|
||||
#define DDS_OP_FLAG_BASE (1u << 4)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_OPT
|
||||
* @ingroup serialization
|
||||
* @brief optional flag,
|
||||
* used with struct members. For non-string types, an optional member
|
||||
* also gets the FLAG_EXT, see above.
|
||||
*/
|
||||
#define DDS_OP_FLAG_OPT (1u << 5)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_SZ_SHIFT
|
||||
* @ingroup serialization
|
||||
* @brief Enum and bitmask storage size (shift amount)
|
||||
*/
|
||||
#define DDS_OP_FLAG_SZ_SHIFT (6)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAG_SZ_MASK
|
||||
* @ingroup serialization
|
||||
* @brief Enum and bitmask storage size
|
||||
* -# 00 = 1 byte,
|
||||
* -# 01 = 2 bytes,
|
||||
* -# 10 = 4 bytes,
|
||||
* -# 11 = 8 bytes (bitmask only)
|
||||
*/
|
||||
#define DDS_OP_FLAG_SZ_MASK (3u << DDS_OP_FLAG_SZ_SHIFT)
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_FLAGS_SZ
|
||||
* @ingroup serialization
|
||||
* @brief Extract the Enum and Bitmask storage size from flags
|
||||
*/
|
||||
#define DDS_OP_FLAGS_SZ(f) (1u << (((f) & DDS_OP_FLAG_SZ_MASK) >> DDS_OP_FLAG_SZ_SHIFT))
|
||||
|
||||
/**
|
||||
* @anchor DDS_OP_TYPE_SZ
|
||||
* @ingroup serialization
|
||||
* @brief Extract the Enum and Bitmask storage size from an uint32
|
||||
*/
|
||||
#define DDS_OP_TYPE_SZ(o) DDS_OP_FLAGS_SZ(DDS_OP_FLAGS(o))
|
||||
|
||||
/**
|
||||
* @defgroup topic_flags (Topic flags)
|
||||
* @ingroup serialization
|
||||
* There are several flags that can be added to dds_topic_descriptor_t by the IDL compiler.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_NO_OPTIMIZE
|
||||
* @ingroup topic_flags
|
||||
* @brief Don't optimize the opcodes to quick memcpy's.
|
||||
* If a topic includes only plain types and directly nested structs,
|
||||
* it can be that a simple copy+optional byteswap can produce the right
|
||||
* C memory layout straight from CDR. If this flag is added it means that
|
||||
* there is pointer 'magic' involved in decoding the type and no shortcuts should be taken.
|
||||
* @deprecated Optimizability is determined runtime when creating the sertype_default
|
||||
* for the type, this flag is not used.
|
||||
*/
|
||||
#define DDS_TOPIC_NO_OPTIMIZE (1u << 0)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_FIXED_KEY
|
||||
* @ingroup topic_flags
|
||||
* @brief The XCDRV1 serialized key fits in 16 bytes.
|
||||
* If statically determined that a key always fits in 16 bytes
|
||||
* the spec specifies that the key of a sample is the resulting CDR.
|
||||
* If it is longer we must use MD5 to hash the resultant key CDR.
|
||||
*/
|
||||
#define DDS_TOPIC_FIXED_KEY (1u << 1)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_CONTAINS_UNION
|
||||
* @ingroup topic_flags
|
||||
* @deprecated reserved for backward compatibility
|
||||
* @brief ignored
|
||||
*/
|
||||
#define DDS_TOPIC_CONTAINS_UNION (1u << 2)
|
||||
|
||||
|
||||
// (1u << 3) unused, was used for DDS_TOPIC_DISABLE_TYPECHECK
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_FIXED_SIZE
|
||||
* @ingroup topic_flags
|
||||
* @brief The size in memory of a sample of this topic type is fully fixed.
|
||||
*/
|
||||
#define DDS_TOPIC_FIXED_SIZE (1u << 4)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_FIXED_KEY_XCDR2
|
||||
* @ingroup topic_flags
|
||||
* @brief The XCDRV2 serialized key fits in 16 bytes.
|
||||
* If statically determined that a key always fits in 16 bytes
|
||||
* the spec specifies that the key of a sample is the resulting CDR.
|
||||
* If it is longer we must use MD5 to hash the resultant key CDR.
|
||||
*
|
||||
* This is separate from the XCDRV1 version because it can differ due
|
||||
* to the change in alignment of 8byte types.
|
||||
*/
|
||||
#define DDS_TOPIC_FIXED_KEY_XCDR2 (1u << 5)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_XTYPES_METADATA
|
||||
* @ingroup topic_flags
|
||||
* @brief Set if XTypes meta-data is present for this topic
|
||||
*/
|
||||
#define DDS_TOPIC_XTYPES_METADATA (1u << 6)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_RESTRICT_DATA_REPRESENTATION
|
||||
* @ingroup topic_flags
|
||||
* @brief Set if data representation restrictions for the top-level type are present in the topic descriptor
|
||||
*/
|
||||
#define DDS_TOPIC_RESTRICT_DATA_REPRESENTATION (1u << 7)
|
||||
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_KEY_MUTABLE
|
||||
* @ingroup topic_flags
|
||||
* @brief Set if any of the key fields of a type is in a mutable aggregated type.
|
||||
*/
|
||||
#define DDS_TOPIC_KEY_MUTABLE (1u << 8)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_KEY_APPENDABLE
|
||||
* @ingroup topic_flags
|
||||
* @brief Set if any of the key fields of a type is in an appendable aggregated type.
|
||||
*/
|
||||
#define DDS_TOPIC_KEY_APPENDABLE (1u << 9)
|
||||
|
||||
/**
|
||||
* @anchor DDS_TOPIC_FIXED_KEY_XCDR2_KEYHASH
|
||||
* @ingroup topic_flags
|
||||
* @brief The XCDRV2 serialized key with field in member-id order fits
|
||||
* in 16 bytes. If statically determined that a serialized key that is
|
||||
* used to get the keyhash always fits in 16 bytes, the spec specifies
|
||||
* that the keyhash of a sample is the resulting CDR. If it is longer
|
||||
* we must use MD5 to hash the resultant key CDR.
|
||||
*
|
||||
* The XCDRV1 key-hash is calculated from the serialized key with the
|
||||
* fields in definition order, so DDS_TOPIC_FIXED_KEY can also be used
|
||||
* for key-hash for XCDR1.
|
||||
*/
|
||||
#define DDS_TOPIC_FIXED_KEY_XCDR2_KEYHASH (1u << 10)
|
||||
|
||||
/**
|
||||
* @anchor DDS_FIXED_KEY_MAX_SIZE
|
||||
* @ingroup topic_flags
|
||||
* @brief Max size of fixed key
|
||||
*/
|
||||
#define DDS_FIXED_KEY_MAX_SIZE (16)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDS_OPCODES_H */
|
||||
+690
@@ -0,0 +1,690 @@
|
||||
// Copyright(c) 2023 ZettaScale Technology 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
|
||||
|
||||
/**
|
||||
* @defgroup psmx (Publish Subscribe Message Exchange)
|
||||
* @ingroup dds
|
||||
*
|
||||
* OVERVIEW
|
||||
* ========
|
||||
*
|
||||
* The Publish Subscribe Message Exchange (PSMX) interface provides support for
|
||||
* off-loading data communication from the network stack of Cyclone to arbitrary pub-sub
|
||||
* transport implementations.[^1] This section provides an overview of the structure and
|
||||
* introduces some terminology, details on specific operations are provided at the
|
||||
* definitions of those operations.
|
||||
*
|
||||
* A Cyclone DDS Domain consists of a plurality of DDS Domain Entities, which are the
|
||||
* representations of the DDS Domain in a specific process.
|
||||
*
|
||||
* A PSMX Plugin provides an implementation of the PSMX interface, allowing the
|
||||
* instantiation of a PSMX Instance to establish a connection between a DDS Domain Entity
|
||||
* and a PSMX Domain. The PSMX Plugin is specified as a library and a PSMX Instance Name.
|
||||
* The library is loaded in the process and a constructor function provided by the library
|
||||
* is invoked to create and initialize a PSMX Instance given the PSMX Instance Name (and a
|
||||
* configuration string). In principle a specific library may be configured multiple
|
||||
* times in a single DDS Domain.
|
||||
*
|
||||
* The PSMX Instance Name is assumed to uniquely identify the PSMX Domain in the DDS
|
||||
* Domain. From the PSMX Instance Name, a numeric PSMX Instance ID is derived that
|
||||
* uniquely identifies the PSMX Domain within the DDS Domain Entity and is assumed to
|
||||
* uniquely identify the PSMX Domain in the DDS Domain.[^2]
|
||||
*
|
||||
* Each PSMX Instance chooses a 16-byte PSMX Locator[^3] such that any pair of instances
|
||||
* with the same PSMX Locator communicate, and any pair with different locators do not
|
||||
* communicate.[^4]
|
||||
*
|
||||
* DDS Topics, DDS Readers and DDS Writers are mapped to corresponding objects in PSMX
|
||||
* Instances. For DDS Readers and DDS Writers, the application can restrict the set of
|
||||
* PSMX Instances for which the mapping is created using the "PSMX Instances" QoS setting,
|
||||
* and the PSMX Instances can refuse mapping based on type and QoS information.
|
||||
*
|
||||
* DDS Topic Entities are representations of the topics in the DDS Domain, such that two
|
||||
* identical definitions of a topic in a DDS Domain Entity give rise to two
|
||||
* application-level DDS Topic Entities, but only to a single topic in the DDS Domain
|
||||
* Entity and thus also only one PSMX Topic object per PSMX Instance.
|
||||
*
|
||||
* Each DDS Reader/Writer is mapped to a set of PSMX Reader/Writer Endpoints, one for each
|
||||
* PSMX Instance in the "PSMX Instances" QoS that accepts the type and reader/writer QoS.
|
||||
* An associated set of PSMX Domains consisting of the PSMX Domains for which PSMX
|
||||
* Reader/Writer Endpoints have been created is assumed to exist.
|
||||
*
|
||||
* The PSMX Domain is assumed to deliver data published by the PSMX Writer associated with
|
||||
* DDS Writer X to all PSMX Readers associated with the DDS Readers Ys that match X[^5],
|
||||
* optionally excluding DDS Readers in the same Domain Entity as X. It is assumed to not
|
||||
* deliver data to other DDS Readers in the DDS Domain. It is assumed to do this with a
|
||||
* quality of service compatible with the DDS QoS.
|
||||
*
|
||||
* Readers associated with DDS Readers in the same DDS Domain Entity.
|
||||
*
|
||||
* If the intersection of the sets of PSMX Domains of a DDS Reader and a DDS Writer in a
|
||||
* DDS Domain:
|
||||
*
|
||||
* - is empty, off-loading data transfer to PSMX (for this pair) is not possible;
|
||||
*
|
||||
* - contains one instance, that PSMX Domain is eligible for off-loading data transfer;
|
||||
*
|
||||
* - contains multiple instances, the configuration is invalid.
|
||||
*
|
||||
* If an eligible PSMX Domain exists and the PSMX Locators for the corresponding two PSMX
|
||||
* Instances are the same, then PSMX is used to transfer data.
|
||||
*
|
||||
* The PSMX objects are represented in the interface as pointers to "dds_psmx",
|
||||
* "dds_psmx_topic", "dds_psmx_endpoint". The PSMX Plugin is responsible for allocating
|
||||
* and freeing these. It is expected that the PSMX Plugin internally uses an extended
|
||||
* version of these types to store any additional data it needs. E.g., a hypothetical
|
||||
* "weed" PSMX Plugin could do:
|
||||
*
|
||||
* struct psmx_weed {
|
||||
* struct dds_psmx c;
|
||||
* weed_root *x;
|
||||
* };
|
||||
*
|
||||
* The creator function mentioned above is required to be called NAME_create_psmx, where
|
||||
* NAME is the value of the "name" attribute of the PubSubMessageExchange interface
|
||||
* configuration element. It must have the following signature:
|
||||
*
|
||||
* dds_return_t NAME_create_psmx (
|
||||
* struct dds_psmx **psmx_instance,
|
||||
* dds_psmx_instance_id_t identifier,
|
||||
* const char *config)
|
||||
*
|
||||
* Where
|
||||
*
|
||||
* *psmx_instance must be set point to a new PSMX Instance on success and may be left
|
||||
* undefined on error
|
||||
* identifier contains the numeric PSMX Instance ID
|
||||
* config the PSMX configuration from the "config" attribute of the
|
||||
* PubSubMessageExchange interface configuration element.
|
||||
*
|
||||
* The "config" argument is a contiguous sequence of characters terminated by the first
|
||||
* double-\0. Each \0-terminated character sequence is a string that consists of
|
||||
* KEY=VALUE pairs, where each K-V pair is terminated by a semicolon.
|
||||
*
|
||||
* If the configuration string as set in Cyclone DDS configuration contains a
|
||||
* "INSTANCE_NAME" key, its value is used as the PSMX Instance Name. If the key is not
|
||||
* included, the value of the "name" attribute of the corresponding PubSubMessageExchange
|
||||
* element in configuration is used as the PSMX Instance Name. In all cases, looking up
|
||||
* the "INSTANCE_NAME" key in the configuration string using @ref
|
||||
* dds_psmx_get_config_option_value will return the PSMX Instance Name as its value.
|
||||
*
|
||||
* The behaviour of the constructor function is dependent on the interface version it
|
||||
* implements:
|
||||
*
|
||||
* - For version 0, it is responsible for setting:
|
||||
*
|
||||
* - ops to the addresses of the various functions implementing the operations
|
||||
* - instance_name to a "dds_alloc" allocated string
|
||||
* - instance_id to the "identifier" argument
|
||||
*
|
||||
* and for zero-initializing the other fields. At some point after this initialization,
|
||||
* and once it is prepared to handle the "get_node_id" operation, it must invoke the
|
||||
* "dds_psmx_init_generic" to complete the initialization.
|
||||
*
|
||||
* - For version 1, it is responsible for setting:
|
||||
*
|
||||
* - ops
|
||||
*
|
||||
* All other fields will be initialized by the Cyclone DDS after succesful return and
|
||||
* the "get_node_id" operation also will be invoked after the constructor returned.
|
||||
*
|
||||
* Whether the plugin implements version 0 or version 1 of the interface is controlled by
|
||||
* the function pointers in "dds_psmx_ops_t". If "create_topic" and "deinit" are
|
||||
* non-null, it is version 0; if both are null it is version 1. Neither
|
||||
* "create_topic_type" nor "delete_psmx" is touched by Cyclone DDS if the interface is
|
||||
* version 0, allowing for binary backwards compatibility.
|
||||
*
|
||||
* -- Footnotes: --
|
||||
*
|
||||
* [^1]: In particular including shared-memory based mechanisms.
|
||||
*
|
||||
* [^2]: Internally, the name is not used for anything other than the generation of the
|
||||
* numeric id.
|
||||
*
|
||||
* [^3]: Confusingly named "node identifier" in the interface, even though it has nothing
|
||||
* to do with the numeric PSMX Domain identifier.
|
||||
*
|
||||
* [^4]: This typically matches a machine when the transport is shared memory.
|
||||
*
|
||||
* [^5]: That is, the matching rules between Readers and Writers defined in the DDS
|
||||
* specification.
|
||||
*/
|
||||
#ifndef DDS_PSMX_H
|
||||
#define DDS_PSMX_H
|
||||
|
||||
#include "dds/export.h"
|
||||
#include "dds/dds.h"
|
||||
#include "dds/ddsc/dds_loaned_sample.h"
|
||||
#include "dds/ddsc/dds_data_type_properties.h"
|
||||
#include "dds/ddsrt/dynlib.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DDS_MAX_PSMX_INSTANCES 8 // No particular reason for this specific number, except that it's probably enough, usually.
|
||||
|
||||
struct dds_psmx;
|
||||
struct dds_psmx_topic;
|
||||
struct dds_psmx_endpoint;
|
||||
struct ddsi_type;
|
||||
|
||||
/** @brief Type of the PSMX endpoint
|
||||
* @ingroup psmx
|
||||
*
|
||||
* The PSMX interface distinguishes between readers and writers, and in some cases needs
|
||||
* to specify that an operation applies to both or neither (depending on context).
|
||||
* "Reader" and "writer" here are used as in DDS, outside the DDS context these often are
|
||||
* known as subscribers and publishers.
|
||||
*/
|
||||
typedef enum dds_psmx_endpoint_type {
|
||||
DDS_PSMX_ENDPOINT_TYPE_UNSET, /**< inapplicable or applies to both */
|
||||
DDS_PSMX_ENDPOINT_TYPE_READER, /**< applies to reader only */
|
||||
DDS_PSMX_ENDPOINT_TYPE_WRITER /**< applies to writer only */
|
||||
} dds_psmx_endpoint_type_t;
|
||||
|
||||
/** @brief The numeric PSMX Instance ID
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef uint32_t dds_psmx_instance_id_t;
|
||||
|
||||
/**
|
||||
* @brief Flags for identifying features supported by a PSMX implementation
|
||||
*/
|
||||
#define DDS_PSMX_FEATURE_SHARED_MEMORY 1ul << 0 /**< Uses shared memory */
|
||||
#define DDS_PSMX_FEATURE_ZERO_COPY 1ul << 1 /**< Supports zero-copy */
|
||||
typedef uint32_t dds_psmx_features_t;
|
||||
|
||||
/**
|
||||
* @brief Describes the data which is transferred in addition to the application data
|
||||
* @ingroup psmx
|
||||
*
|
||||
* All fields are filled in by Cyclone DDS during the write prior to handing it to the
|
||||
* PSMX plug-in. The plug-in is only required to pass the contents to Cyclone DDS on the
|
||||
* receiving side.
|
||||
*/
|
||||
typedef struct dds_psmx_metadata {
|
||||
dds_loaned_sample_state_t sample_state; /**< Representation of this sample/key */
|
||||
dds_loan_data_type_t data_type; /**< Reserved, must be 0 */
|
||||
dds_psmx_instance_id_t instance_id; /**< PSMX instance id for this sample */
|
||||
uint32_t sample_size; /**< Size of payload */
|
||||
dds_guid_t guid; /**< GUID of original writer */
|
||||
dds_time_t timestamp; /**< Source timestamp of DDS sample */
|
||||
uint32_t statusinfo; /**< DDSI status info (write/dispose/unregister) */
|
||||
uint16_t cdr_identifier; /**< CDR encoding (DDSI_RTPS_SAMPLE_NATIVE if not serialized) */
|
||||
uint16_t cdr_options; /**< CDR options field (0 if not serialized) */
|
||||
} dds_psmx_metadata_t;
|
||||
|
||||
/**
|
||||
* @brief PSMX Locator
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef struct dds_psmx_node_identifier {
|
||||
uint8_t x[16];
|
||||
} dds_psmx_node_identifier_t;
|
||||
|
||||
/**
|
||||
* @brief Definition of the function checking support for type and QoS
|
||||
* @ingroup psmx
|
||||
*
|
||||
* A PSMX Instance in the "PSMX Instances" QoS may accept or reject a given DDS
|
||||
* Topic/Reader/Writer based on information on the type and the QoS settings. PSMX
|
||||
* Instances not in the "PSMX Instances" QoS setting are not asked.
|
||||
*
|
||||
* @param[in] psmx_instance The PSMX Instance
|
||||
* @param[in] forwhat Whether for a topic/writer/reader (UNSET if topic)
|
||||
* @param[in] data_type_props Data type properties (see there)
|
||||
* @param[in] qos QoS of the DDS topic
|
||||
* @returns True if the PSMX Instance is willing to handle this DDS entity, false otherwise
|
||||
*/
|
||||
typedef bool (*dds_psmx_type_qos_supported_fn) (struct dds_psmx *psmx_instance, dds_psmx_endpoint_type_t forwhat, dds_data_type_properties_t data_type_props, const struct dds_qos *qos);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for creating a PSMX Topic (interface version 1)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Definition for a function that is called to construct a new PSMX Topic in a PSMX Instance
|
||||
* representing a new topic in the DDS Domain Entity.
|
||||
*
|
||||
* The PSMX Plugin is expected to represent a PSMX Topic using an extended version of the
|
||||
* `dds_psmx_topic` structure.
|
||||
*
|
||||
* If `type_definition` is not a null pointer, it points into the Cyclone type library. A
|
||||
* (default, C) serializer can be constructed using `ddsi_topic_descriptor_from_type`,
|
||||
* an XTypes TypeObject using `ddsi_type_get_typeobj`.
|
||||
*
|
||||
* If the function returns failure, creation of the DDS Entity fails.
|
||||
*
|
||||
* @param[in] psmx_instance The PSMX instance.
|
||||
* @param[in] topic_name The name of the topic to create
|
||||
* @param[in] type_name The name of the DDS data type for this topic
|
||||
* @param[in] data_type_props The data type properties for the topic's data type.
|
||||
* @param[in] type_definition Optional pointer to type definition in type library.
|
||||
* @param[in] sizeof_type In-memory size of a single instance of the type, 0 if unknown.
|
||||
* @returns A new PSMX Topic structure, or NULL on error
|
||||
*/
|
||||
typedef struct dds_psmx_topic * (*dds_psmx_create_topic_with_type_fn) (
|
||||
struct dds_psmx *psmx_instance,
|
||||
const char *topic_name,
|
||||
const char *type_name,
|
||||
dds_data_type_properties_t data_type_props,
|
||||
const struct ddsi_type *type_definition,
|
||||
uint32_t sizeof_type);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for destructing and freeing a PSMX Topic
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Definition for a function that is called on deleting the topic in the DDS Domain.
|
||||
* Called exactly once for each successful invocation of `dds_psmx_create_topic`/
|
||||
* `dds_psmx_create_topic_with_type`, all PSMX Endpoints related to this PSMX Topic will have
|
||||
* been destructed prior to calling this function.
|
||||
*
|
||||
* If the PSMX Topic was created using `dds_psmx_create_topic`, the PSMX Plugin is
|
||||
* required to call `dds_psmx_cleanup_topic_generic` and to do so prior to invalidating
|
||||
* the memory associated with the PSMX Topic and releasing any memory allocated for it
|
||||
* during construction.
|
||||
*
|
||||
* @param[in] psmx_topic The PSMX Topic to destruct
|
||||
* @returns A DDS return code, should be DDS_RETCODE_OK.
|
||||
*/
|
||||
typedef dds_return_t (*dds_psmx_delete_topic_fn) (struct dds_psmx_topic *psmx_topic);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for creating a PSMX Topic (interface version 0)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Equivalent to `dds_psmx_create_topic_type` with `type_definition` and `sizeof_type`
|
||||
* a null pointer and 0, respectively. It is required to initialize the generic fields using
|
||||
* `dds_psmx_topic_init_generic`.
|
||||
*
|
||||
* @param[in] psmx_instance The PSMX instance.
|
||||
* @param[in] topic_name The name of the topic to create
|
||||
* @param[in] type_name The name of the DDS data type for this topic
|
||||
* @param[in] data_type_props The data type properties for the topic's data type.
|
||||
* @returns A new PSMX Topic structure, or NULL on error
|
||||
*/
|
||||
typedef struct dds_psmx_topic * (*dds_psmx_create_topic_fn) (
|
||||
struct dds_psmx * psmx_instance,
|
||||
const char * topic_name,
|
||||
const char * type_name,
|
||||
dds_data_type_properties_t data_type_props);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for destructing and freeing a PSMX Instance (interface version 1)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Function called on shutdown of a DDS Domain Entity, before unloading the PSMX Plugin
|
||||
* and after all other operations have completed and all objects created in the PSMX
|
||||
* Instance have been destructed using the various "delete" functions.
|
||||
*
|
||||
* The PSMX Plugin is required to call `dds_psmx_fini` and to do so prior to
|
||||
* invalidating the memory associated with the PSMX Instance and releasing any memory
|
||||
* allocated for it during construction.
|
||||
*
|
||||
* @param[in] psmx_instance The PSMX Instance to de-initialize
|
||||
*/
|
||||
typedef void (*dds_psmx_delete_fn) (struct dds_psmx *psmx_instance);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for destructing and freeing a PSMX Instance (interface version 0)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Function called on shutdown of a DDS Domain Entity, before unloading the PSMX Plugin
|
||||
* and after all other operations have completed and all objects created in the PSMX
|
||||
* Instance have been destructed using the various "delete" functions.
|
||||
*
|
||||
* The PSMX Plugin is required to call `dds_psmx_cleanup_generic` and to do so prior to
|
||||
* invalidating the memory associated with the PSMX Instance and releasing any memory
|
||||
* allocated for it during construction.
|
||||
*
|
||||
* @param[in] psmx_instance The PSMX Instance to de-initialize
|
||||
* @returns A DDS return code, should be DDS_RETCODE_OK.
|
||||
*/
|
||||
typedef dds_return_t (*dds_psmx_deinit_fn) (struct dds_psmx *psmx_instance);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function returning the PSMX Locator
|
||||
* @ingroup psmx
|
||||
*
|
||||
* All PSMX Instances that can communicate must return the same PSMX Locator, PSMX
|
||||
* Instances that do not communicate must return different PSMX Locators.
|
||||
*
|
||||
* The function may be called by `dds_psmx_init_generic`.
|
||||
*
|
||||
* @param[in] psmx_instance A PSMX Instance
|
||||
* @returns The PSMX Locator for this PSMX Instance
|
||||
*/
|
||||
typedef dds_psmx_node_identifier_t (*dds_psmx_get_node_identifier_fn) (const struct dds_psmx *psmx_instance);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function to query the features supported by the PSMX Instance
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Returns an integer with the flags set for the features that are supported by the
|
||||
* provided PSMX Instance.
|
||||
*
|
||||
* @param[in] psmx_instance A PSMX instance
|
||||
* @returns The set of features supported by this PSMX instance
|
||||
*/
|
||||
typedef dds_psmx_features_t (*dds_psmx_supported_features_fn) (const struct dds_psmx *psmx_instance);
|
||||
|
||||
/**
|
||||
* @brief Table of pointers to functions operating on a PSMX Instance
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef struct dds_psmx_ops {
|
||||
dds_psmx_type_qos_supported_fn type_qos_supported;
|
||||
dds_psmx_create_topic_fn create_topic; /**< non-null for interface version 0, null for version 1 */
|
||||
dds_psmx_delete_topic_fn delete_topic;
|
||||
dds_psmx_deinit_fn deinit; /**< non-null for interface version 0, null for version 1 */
|
||||
dds_psmx_get_node_identifier_fn get_node_id;
|
||||
dds_psmx_supported_features_fn supported_features;
|
||||
dds_psmx_create_topic_with_type_fn create_topic_with_type; /**< undefined for interface version 0, non-null for version 1 */
|
||||
dds_psmx_delete_fn delete_psmx; /**< undefined for interface version 0, non-null for version 1 */
|
||||
} dds_psmx_ops_t;
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for constructing a PSMX Endpoint for a PSMX Topic
|
||||
* @ingroup psmx
|
||||
*
|
||||
* @param[in] psmx_topic The PSMX Topic to create the PSMX Endpoint for
|
||||
* @param[in] qos QoS of the corresponding DDS endpoint
|
||||
* @param[in] endpoint_type The type of endpoint to create, either READER or WRITER
|
||||
* @returns A new PSMX Endpoint or a null pointer on error
|
||||
*/
|
||||
typedef struct dds_psmx_endpoint * (*dds_psmx_create_endpoint_fn) (struct dds_psmx_topic *psmx_topic, const struct dds_qos *qos, dds_psmx_endpoint_type_t endpoint_type);
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for destructing a PSMX Endpoint
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Called after the last operation on the PSMX Endpoint has completed and no further
|
||||
* operations will be invoked; called prior to destructing the PSMX Topic.
|
||||
*
|
||||
* @param[in] psmx_endpoint The PSMX Endpoint to be destructed
|
||||
* @returns a DDS return code, should be DDS_RETCODE_OK
|
||||
*/
|
||||
typedef dds_return_t (*dds_psmx_delete_endpoint_fn) (struct dds_psmx_endpoint *psmx_endpoint);
|
||||
|
||||
/**
|
||||
* @brief Table of pointers to functions operating on a PSMX Topic
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef struct dds_psmx_topic_ops {
|
||||
dds_psmx_create_endpoint_fn create_endpoint;
|
||||
dds_psmx_delete_endpoint_fn delete_endpoint;
|
||||
} dds_psmx_topic_ops_t;
|
||||
|
||||
/**
|
||||
* @brief Definition of the function for requesting a loan from a PSMX Writer
|
||||
* @ingroup psmx
|
||||
*
|
||||
* The PSMX Instance is the owner of the loan and implements the allocation and the
|
||||
* freeing of the memory for the `dds_loaned_sample_t`, the `dds_psmx_metadata_t` it
|
||||
* references and the payload it references.
|
||||
*
|
||||
* The `dds_loaned_sample_t` is reference counted and the free function referenced through
|
||||
* the "ops" table is invoked once the reference count drops to 0.
|
||||
*
|
||||
* The PSMX Plugin is required to properly initialize all fields:
|
||||
*
|
||||
* - ops
|
||||
* - metadata, the contents of the memory it points to may be undefined
|
||||
* - sample_ptr, the contents of the memory it points to may be undefined
|
||||
*
|
||||
* The loan_origin and refc fields are set by Cyclone DDS following a succesful return.
|
||||
*
|
||||
* The `sample_ptr` in the Loaned Sample must point to a unique memory block of at least
|
||||
* `size_requested` bytes and be suitably aligned to directly store any of the types in
|
||||
* application-representation to which the various supported IDL types map.
|
||||
*
|
||||
* `size_requested` is equal to `sizeof_type` in the PSMX create topic call if:
|
||||
* - the loan is to be used for a raw sample (implies `IS_MEMCPY_SAFE` set in the type properties)
|
||||
* - `sizeof_type` was non-0 in the call to create the PSMX Topic
|
||||
*
|
||||
* @param[in] psmx_endpoint The PSMX Writer to borrow from
|
||||
* @param[in] size_requested The size of the loan requested in bytes
|
||||
* @returns A pointer to the Loaned Sample on success or a null pointer on failure
|
||||
*/
|
||||
typedef dds_loaned_sample_t * (*dds_psmx_endpoint_request_loan_fn) (struct dds_psmx_endpoint *psmx_endpoint, uint32_t size_requested);
|
||||
|
||||
/**
|
||||
* @brief Definition of function for writing data via a PSMX Writer
|
||||
* @ingroup psmx
|
||||
*
|
||||
* The PSMX Plugin is expected to publish the payload and the metadata of the Loaned
|
||||
* Sample via the PSMX Instance to its subscribers as described in the overview. The
|
||||
* Loaned Sample:
|
||||
*
|
||||
* - originated in a successful request for a loan from this PSMX Instance;
|
||||
* - has the metadata and payload set correctly;
|
||||
* - has a metadata state that is not `UNINITIALIZED`.
|
||||
*
|
||||
* Cyclone DDS assumes:
|
||||
*
|
||||
* - that the `dds_loaned_sample_t` outlives the PSMX write operation
|
||||
* - that the `sample_ptr` and `metadata` are invalidated by the PSMX write operation
|
||||
*
|
||||
* and will consequently not touch the `sample_ptr` and `metadata` after the operation and
|
||||
* only invoke the Loaned Sample's `free` function.
|
||||
*
|
||||
* If the operations fails and returns an error, the DDS write (or write-like) operation
|
||||
* that caused it will report an error to the application. It is unspecified whether or
|
||||
* not any other deliver paths may or may not have been provided with the data when this
|
||||
* happens.
|
||||
*
|
||||
* @param[in] psmx_endpoint The PSMX Writer to publish the data on
|
||||
* @param[in] data The Loaned Sample containing the data to publish
|
||||
* @param[in] keysz The size of the serialized key blob, 0 for keyless topics
|
||||
* @param[in] key The serialized key, a null pointer for keyless topics
|
||||
* @returns A DDS return code
|
||||
*/
|
||||
typedef dds_return_t (*dds_psmx_endpoint_write_with_key_fn) (struct dds_psmx_endpoint *psmx_endpoint, dds_loaned_sample_t *data, size_t keysz, const void *key);
|
||||
|
||||
/**
|
||||
* @brief Definition of function for writing data via a PSMX Writer
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Equivalent to `dds_psmx_endpoint_write_with_key_fn` with `keysz` = 0 and `key` = NULL
|
||||
*/
|
||||
typedef dds_return_t (*dds_psmx_endpoint_write_fn) (struct dds_psmx_endpoint *psmx_endpoint, dds_loaned_sample_t *data);
|
||||
|
||||
/**
|
||||
* @brief Definition of function for taking data from a PSMX Reader
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Return an unread sample available to the PSMX Reader and remove it from the set of
|
||||
* samples available to the PSMX Reader. It should ensure, firstly, that a sample for
|
||||
* each key value for which data is available shall eventually be returned, and, secondly,
|
||||
* that samples for a given key value are returned in the order of publication.
|
||||
*
|
||||
* The Loaned Sample shall be fully initialized on return, with a metadata sample state
|
||||
* different from `UNINITIALIZED`.
|
||||
*
|
||||
* (Currently not called.)
|
||||
*
|
||||
* @param[in] psmx_endpoint The PSMX Reader to take the data from
|
||||
* @returns a Loaned Sample for an unread sample, or a null pointer if none is available
|
||||
*/
|
||||
typedef dds_loaned_sample_t * (*dds_psmx_endpoint_take_fn) (struct dds_psmx_endpoint *psmx_endpoint);
|
||||
|
||||
/**
|
||||
* @brief Definition of function to request asynchronous delivery of new data by a PSMX Reader
|
||||
* @ingroup psmx
|
||||
*
|
||||
* The PSMX Plugin is requested to arrange for data arriving at the PSMX Reader to be
|
||||
* delivered to Cyclone DDS as if a background thread exists that contains a loop body:
|
||||
* ```
|
||||
* dds_loaned_sample_t *ls = dds_psmx_endpoint_ops.take(psmx_endpoint)
|
||||
* if (ls != NULL) {
|
||||
* dds_reader_store_loaned_sample(reader, ls);
|
||||
* }
|
||||
* dds_loaned_sample_unref(data)
|
||||
* ```
|
||||
* (alternatively calling `dds_reader_store_loaned_sample_wr_metadata` for each sample)
|
||||
*
|
||||
* @param[in] psmx_endpoint The PSMX Reader on which to enable asynchronous delivery
|
||||
* @param[in] reader The DDS Reader to which the data is to be delivered
|
||||
* @returns a DDS return code
|
||||
*/
|
||||
typedef dds_return_t (*dds_psmx_endpoint_on_data_available_fn) (struct dds_psmx_endpoint *psmx_endpoint, dds_entity_t reader);
|
||||
|
||||
/**
|
||||
* @brief Table of pointers to functions that are used on a PSMX Endpoint
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef struct dds_psmx_endpoint_ops {
|
||||
dds_psmx_endpoint_request_loan_fn request_loan;
|
||||
dds_psmx_endpoint_write_fn write; /**< write, not required if `write_key` is defined */
|
||||
dds_psmx_endpoint_take_fn take;
|
||||
dds_psmx_endpoint_on_data_available_fn on_data_available;
|
||||
dds_psmx_endpoint_write_with_key_fn write_with_key; /**< may be null for backwards compatibility if `write` is defined */
|
||||
} dds_psmx_endpoint_ops_t;
|
||||
|
||||
/**
|
||||
* @brief Type representing a PSMX Instance in a DDS Domain Entity
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Each PSMX Instance is represented in a DDS Domain Entity by a pointer to a `struct dds_psmx`.
|
||||
* The PSMX Plugin is responsible for allocating and constructing it on initialization in a constructor
|
||||
* as described in the overview.
|
||||
*/
|
||||
typedef struct dds_psmx {
|
||||
dds_psmx_ops_t ops; /**< operations on the PSMX Instance */
|
||||
const char *instance_name; /**< name of this PSMX Instance */
|
||||
int32_t priority; /**< priority for this interface */
|
||||
const struct ddsi_locator *locator; /**< PSMX Locator for this PSMX Instance */
|
||||
dds_psmx_instance_id_t instance_id; /**< Numeric PSMX Instance ID for this PSMX Instance */
|
||||
void *psmx_topics; /**< Reserved, must be 0 */
|
||||
} dds_psmx_t;
|
||||
|
||||
/**
|
||||
* @brief Type representing a PSMX Topic in a DDS Domain Entity
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef struct dds_psmx_topic {
|
||||
dds_psmx_topic_ops_t ops; /**< operations on the PSMX Topic */
|
||||
struct dds_psmx *psmx_instance; /**< PSMX Instance which created this PSMX Topic */
|
||||
const char *topic_name; /**< Topic name */
|
||||
const char *type_name; /**< Type name */
|
||||
dds_loan_data_type_t data_type; /**< Reserved, must be 0 */
|
||||
void *psmx_endpoints; /**< Reserved, must be 0 */
|
||||
dds_data_type_properties_t data_type_props; /**< Properties of the data type associated with this topic */
|
||||
} dds_psmx_topic_t;
|
||||
|
||||
/**
|
||||
* @brief Type representing a PSMX Endpoint in a DDS Domain Entity
|
||||
* @ingroup psmx
|
||||
*/
|
||||
typedef struct dds_psmx_endpoint {
|
||||
dds_psmx_endpoint_ops_t ops; /**< operations on the PSMX Endpoint */
|
||||
struct dds_psmx_topic *psmx_topic; /**< PSMX Topic for this endpoint */
|
||||
dds_psmx_endpoint_type_t endpoint_type; /**< Type of endpoint (READER or WRITER) */
|
||||
} dds_psmx_endpoint_t;
|
||||
|
||||
/**
|
||||
* @brief nop
|
||||
* @ingroup psmx
|
||||
*
|
||||
* does nothing, exists for backwards compatibility only
|
||||
*
|
||||
* @param[in] psmx_topic ignored
|
||||
* @param[in,out] list ignored
|
||||
* @return `DDS_RETCODE_OK`
|
||||
*/
|
||||
DDS_DEPRECATED_EXPORT dds_return_t dds_add_psmx_topic_to_list (struct dds_psmx_topic *psmx_topic, void **list);
|
||||
|
||||
/**
|
||||
* @brief nop
|
||||
* @ingroup psmx
|
||||
*
|
||||
* does nothing, exists for backwards compatibility only
|
||||
*
|
||||
* @param[in] psmx_endpoint ignored
|
||||
* @param[in,out] list ignored
|
||||
* @return `DDS_RETCODE_OK`
|
||||
*/
|
||||
DDS_DEPRECATED_EXPORT dds_return_t dds_add_psmx_endpoint_to_list (struct dds_psmx_endpoint *psmx_endpoint, void **list);
|
||||
|
||||
/**
|
||||
* @brief initialization function for PSMX instance (interface version 0)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Shall be called by a constructor function for a PSMX Plugin implementing interface
|
||||
* version 0 as described in the overview.
|
||||
*
|
||||
* @param[in] psmx The PSMX instance to initialize
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_psmx_init_generic (struct dds_psmx *psmx);
|
||||
|
||||
/**
|
||||
* @brief cleanup function for a PSMX instance (interface version 0)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Shall be called by the destructor function of PSMX Plugin implementing interface
|
||||
* version 0 as described in the documentation of "dds_psmx_deinit_fn".
|
||||
*
|
||||
* @param[in] psmx the PSMX instance to cleanup
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_psmx_cleanup_generic (struct dds_psmx *psmx);
|
||||
|
||||
/**
|
||||
* @brief init function for topic (interface version 0)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Shall be called by de topic constructor function for a PSMX Plugin implementing
|
||||
* interface version 0.
|
||||
*
|
||||
* @param[in] psmx_topic the topic to initialize
|
||||
* @param[in] ops vtable for this psmx_topic
|
||||
* @param[in] psmx the PSMX instance
|
||||
* @param[in] topic_name the topic name
|
||||
* @param[in] type_name the DDS type name for this topic
|
||||
* @param[in] data_type_props the data type's properties
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_psmx_topic_init_generic (struct dds_psmx_topic *psmx_topic, const dds_psmx_topic_ops_t *ops, const struct dds_psmx *psmx, const char *topic_name, const char *type_name, dds_data_type_properties_t data_type_props);
|
||||
|
||||
/**
|
||||
* @brief cleanup function for a topic (interface version 0)
|
||||
* @ingroup psmx
|
||||
*
|
||||
* Shall be called by de topic destructor function for a PSMX Plugin implementing
|
||||
* interface version 0 as described in the documentation of "dds_psmx_delete_topic_fn".
|
||||
*
|
||||
* @param[in] psmx_topic the topic to de-initialize
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_psmx_topic_cleanup_generic (struct dds_psmx_topic *psmx_topic);
|
||||
|
||||
/**
|
||||
* @brief Returns the string associated with the option_name in the PSMX config string.
|
||||
* @ingroup psmx
|
||||
*
|
||||
* The C string returned from this function should be freed by the user using `ddsrt_free`.
|
||||
*
|
||||
* The option "SERVICE_NAME" is treated as an alias for "INSTANCE_NAME".
|
||||
*
|
||||
* @param[in] conf a double-\0 terminated configuration string in the
|
||||
* same format as that passed to the PSMX Plugin's constructor
|
||||
* function (see the overview).
|
||||
* @param[in] option_name the option to look up
|
||||
* @return pointer to a newly allocated string on the heap if found, NULL if not found or out of memory.
|
||||
*/
|
||||
DDS_EXPORT char *dds_psmx_get_config_option_value (const char *conf, const char *option_name);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDS_PSMX_H */
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
// Copyright(c) 2006 to 2019 ZettaScale Technology 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;
|
||||
|
||||
DDS_EXPORT extern const struct dds_cdrstream_allocator dds_cdrstream_default_allocator;
|
||||
|
||||
/**
|
||||
* @anchor DDS_FREE_KEY_BIT
|
||||
* @ingroup alloc
|
||||
* @brief Instruction to free all keyfields in sample
|
||||
*/
|
||||
#define DDS_FREE_KEY_BIT 0x01
|
||||
|
||||
/**
|
||||
* @anchor DDS_FREE_CONTENTS_BIT
|
||||
* @ingroup alloc
|
||||
* @brief Instruction to free all non-keyfields in sample
|
||||
*/
|
||||
#define DDS_FREE_CONTENTS_BIT 0x02
|
||||
|
||||
/**
|
||||
* @anchor DDS_FREE_ALL_BIT
|
||||
* @ingroup alloc
|
||||
* @brief Instruction to free outer sample
|
||||
*/
|
||||
#define DDS_FREE_ALL_BIT 0x04
|
||||
|
||||
/**
|
||||
* @brief Freeing operation type
|
||||
* @ingroup alloc
|
||||
* What part of a sample to free
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DDS_FREE_ALL = DDS_FREE_KEY_BIT | DDS_FREE_CONTENTS_BIT | DDS_FREE_ALL_BIT, /**< free full sample */
|
||||
DDS_FREE_CONTENTS = DDS_FREE_KEY_BIT | DDS_FREE_CONTENTS_BIT, /**< free all sample contents, but leave sample pointer intact */
|
||||
DDS_FREE_KEY = DDS_FREE_KEY_BIT /**< free only the keyfields in a sample */
|
||||
}
|
||||
dds_free_op_t;
|
||||
|
||||
/**
|
||||
* @brief DDS Allocator
|
||||
* @ingroup alloc
|
||||
* C-Style allocator API
|
||||
*/
|
||||
typedef struct dds_allocator
|
||||
{
|
||||
void * (*malloc) (size_t size); /**< behave like C malloc */
|
||||
void * (*realloc) (void *ptr, size_t size); /**< behave like C realloc, may be null */
|
||||
void (*free) (void *ptr); /**< behave like C free */
|
||||
}
|
||||
dds_allocator_t;
|
||||
|
||||
/**
|
||||
* @brief Perform an alloc() with the default allocator.
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] size number of bytes
|
||||
* @returns new pointer or NULL if out of memory
|
||||
*/
|
||||
DDS_EXPORT void * dds_alloc (size_t size);
|
||||
|
||||
/**
|
||||
* @brief Perform a realloc() with the default allocator.
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] ptr previously alloc()'ed pointer
|
||||
* @param[in] size new size
|
||||
* @return new pointer or NULL if out of memory
|
||||
*/
|
||||
DDS_EXPORT void * dds_realloc (void * ptr, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Perform a realloc() with the default allocator. Zero out memory.
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] ptr previously alloc()'ed pointer
|
||||
* @param[in] size new size
|
||||
* @return new pointer or NULL if out of memory
|
||||
*/
|
||||
DDS_EXPORT void * dds_realloc_zero (void * ptr, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Perform a free() on a memory fragment allocated with the default allocator.
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] ptr previously alloc()'ed pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_free (void * ptr);
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef void * (*dds_alloc_fn_t) (size_t p);
|
||||
typedef void * (*dds_realloc_fn_t) (void * a, size_t b);
|
||||
typedef void (*dds_free_fn_t) (void *p);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
/**
|
||||
* @brief Allocated a string with size, accounting for the null terminator.
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] size number of characters
|
||||
* @returns newly allocated string or NULL if out of memory
|
||||
*/
|
||||
DDS_EXPORT char * dds_string_alloc (size_t size);
|
||||
|
||||
/**
|
||||
* @brief Duplicate a null-terminated string
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] str string to duplicate
|
||||
* @returns newly allocated duplicate string, or NULL if out of memory
|
||||
*/
|
||||
DDS_EXPORT char * dds_string_dup (const char * str);
|
||||
|
||||
/**
|
||||
* @brief Free a string, equivalent to dds_free
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] str string to free
|
||||
*/
|
||||
DDS_EXPORT void dds_string_free (char * str);
|
||||
|
||||
/**
|
||||
* @brief Free (parts of) a sample according to the \ref dds_free_op_t
|
||||
* @component memory_alloc
|
||||
*
|
||||
* @param[in] sample sample to free
|
||||
* @param[in] desc topic descriptor of the type this sample was created from.
|
||||
* @param[in] op Which parts of the sample to free.
|
||||
*/
|
||||
DDS_EXPORT void dds_sample_free (void * sample, const struct dds_topic_descriptor * desc, dds_free_op_t op);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,635 @@
|
||||
// Copyright(c) 2023 ZettaScale Technology 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
|
||||
|
||||
#ifndef DDS_DYNAMIC_TYPE_H
|
||||
#define DDS_DYNAMIC_TYPE_H
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef DDS_HAS_TYPELIB
|
||||
|
||||
struct ddsi_typeinfo;
|
||||
|
||||
/**
|
||||
* @defgroup dynamic_type (Dynamic Type API)
|
||||
* @ingroup dds
|
||||
* The Dynamic Type API to construct and manipulate data types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Representation of a dynamically created type. This struct has an opaque pointer
|
||||
* to the type in the type system. During construction of the type (setting properties
|
||||
* and adding members), the internal type has the state 'CONSTRUCTION'. Once the type
|
||||
* is registered, the state is updated to 'RESOLVED' and the type cannot be modified.
|
||||
*
|
||||
* The 'ret' member of this struct holds the return code of operations performed on
|
||||
* this type. In case this value is not DDS_RETCODE_OK, the type cannot be used for
|
||||
* further processing (e.g. adding members, registering the type, etc.).
|
||||
*
|
||||
*/
|
||||
typedef struct dds_dynamic_type {
|
||||
void * x[2];
|
||||
dds_return_t ret;
|
||||
} dds_dynamic_type_t;
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Invalid member ID: used when adding a member, to indicate that the member should get
|
||||
* the id (m+1) where m is the highest member id in the current set of members. A valid
|
||||
* member id has the 4 most significant bits set to 0 (because of usage in the EMHEADER),
|
||||
* so also when hashed-id are used, the hash member id will never be set to the invalid
|
||||
* member id.
|
||||
*/
|
||||
#define DDS_DYNAMIC_MEMBER_ID_INVALID 0xf000000u
|
||||
#define DDS_DYNAMIC_MEMBER_ID_AUTO DDS_DYNAMIC_MEMBER_ID_INVALID
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* When adding members, index 0 is used to indicate that a member should be inserted as
|
||||
* the first member. A value higher than the current maximum index can be used to indicate
|
||||
* that the member should be added after the other members
|
||||
*/
|
||||
#define DDS_DYNAMIC_MEMBER_INDEX_START 0u
|
||||
#define DDS_DYNAMIC_MEMBER_INDEX_END UINT32_MAX
|
||||
|
||||
/**
|
||||
* @brief Dynamic Type Kind
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Enumeration with the type kind values that can be used to create a dynamic type.
|
||||
*/
|
||||
typedef enum dds_dynamic_type_kind
|
||||
{
|
||||
DDS_DYNAMIC_NONE,
|
||||
DDS_DYNAMIC_BOOLEAN,
|
||||
DDS_DYNAMIC_BYTE,
|
||||
DDS_DYNAMIC_INT16,
|
||||
DDS_DYNAMIC_INT32,
|
||||
DDS_DYNAMIC_INT64,
|
||||
DDS_DYNAMIC_UINT16,
|
||||
DDS_DYNAMIC_UINT32,
|
||||
DDS_DYNAMIC_UINT64,
|
||||
DDS_DYNAMIC_FLOAT32,
|
||||
DDS_DYNAMIC_FLOAT64,
|
||||
DDS_DYNAMIC_FLOAT128,
|
||||
DDS_DYNAMIC_INT8,
|
||||
DDS_DYNAMIC_UINT8,
|
||||
DDS_DYNAMIC_CHAR8,
|
||||
DDS_DYNAMIC_CHAR16,
|
||||
DDS_DYNAMIC_STRING8,
|
||||
DDS_DYNAMIC_STRING16,
|
||||
DDS_DYNAMIC_ENUMERATION,
|
||||
DDS_DYNAMIC_BITMASK,
|
||||
DDS_DYNAMIC_ALIAS,
|
||||
DDS_DYNAMIC_ARRAY,
|
||||
DDS_DYNAMIC_SEQUENCE,
|
||||
DDS_DYNAMIC_MAP,
|
||||
DDS_DYNAMIC_STRUCTURE,
|
||||
DDS_DYNAMIC_UNION,
|
||||
DDS_DYNAMIC_BITSET
|
||||
} dds_dynamic_type_kind_t;
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Short notation for initializer of a dynamic type spec for non-primitive and primitive types.
|
||||
*/
|
||||
#define DDS_DYNAMIC_TYPE_SPEC(t) ((dds_dynamic_type_spec_t) { .kind = DDS_DYNAMIC_TYPE_KIND_DEFINITION, .type = { .type = (t) } })
|
||||
#define DDS_DYNAMIC_TYPE_SPEC_PRIM(p) ((dds_dynamic_type_spec_t) { .kind = DDS_DYNAMIC_TYPE_KIND_PRIMITIVE, .type = { .primitive = (p) } })
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Short notation for struct member descriptor with different sets of commonly used properties
|
||||
*/
|
||||
#define DDS_DYNAMIC_MEMBER_(member_type_spec,member_name,member_id,member_index) \
|
||||
((dds_dynamic_member_descriptor_t) { \
|
||||
.name = (member_name), \
|
||||
.id = (member_id), \
|
||||
.type = (member_type_spec), \
|
||||
.index = (member_index) \
|
||||
})
|
||||
#define DDS_DYNAMIC_MEMBER_ID(member_type,member_name,member_id) \
|
||||
DDS_DYNAMIC_MEMBER_ (DDS_DYNAMIC_TYPE_SPEC((member_type)),(member_name),(member_id),DDS_DYNAMIC_MEMBER_INDEX_END)
|
||||
#define DDS_DYNAMIC_MEMBER_ID_PRIM(member_prim_type,member_name,member_id) \
|
||||
DDS_DYNAMIC_MEMBER_(DDS_DYNAMIC_TYPE_SPEC_PRIM((member_prim_type)),(member_name),(member_id),DDS_DYNAMIC_MEMBER_INDEX_END)
|
||||
#define DDS_DYNAMIC_MEMBER(member_type,member_name) \
|
||||
DDS_DYNAMIC_MEMBER_ID((member_type),(member_name),DDS_DYNAMIC_MEMBER_ID_INVALID)
|
||||
#define DDS_DYNAMIC_MEMBER_PRIM(member_prim_type,member_name) \
|
||||
DDS_DYNAMIC_MEMBER_ID_PRIM((member_prim_type),(member_name),DDS_DYNAMIC_MEMBER_ID_INVALID)
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Short notation for union member descriptor with different sets of commonly used properties
|
||||
*/
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_(member_type_spec,member_name,member_id,member_index,member_num_labels,member_labels,member_is_default) \
|
||||
((dds_dynamic_member_descriptor_t) { \
|
||||
.name = (member_name), \
|
||||
.id = (member_id), \
|
||||
.type = (member_type_spec), \
|
||||
.index = (member_index), \
|
||||
.num_labels = (member_num_labels), \
|
||||
.labels = (member_labels), \
|
||||
.default_label = (member_is_default) \
|
||||
})
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_ID(member_type,member_name,member_id,member_num_labels,member_labels) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_(DDS_DYNAMIC_TYPE_SPEC((member_type)),(member_name),(member_id),DDS_DYNAMIC_MEMBER_INDEX_END,(member_num_labels),(member_labels),false)
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_ID_PRIM(member_prim_type,member_name,member_id,member_num_labels,member_labels) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_(DDS_DYNAMIC_TYPE_SPEC_PRIM((member_prim_type)),(member_name),(member_id),DDS_DYNAMIC_MEMBER_INDEX_END,(member_num_labels),(member_labels),false)
|
||||
#define DDS_DYNAMIC_UNION_MEMBER(member_type,member_name,member_num_labels,member_labels) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_ID((member_type),(member_name),DDS_DYNAMIC_MEMBER_ID_INVALID,(member_num_labels),(member_labels))
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_PRIM(member_prim_type,member_name,member_num_labels,member_labels) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_ID_PRIM((member_prim_type),(member_name),DDS_DYNAMIC_MEMBER_ID_INVALID,(member_num_labels),(member_labels))
|
||||
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_DEFAULT_ID(member_type,member_name,member_id) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_(DDS_DYNAMIC_TYPE_SPEC((member_type)),(member_name),(member_id),DDS_DYNAMIC_MEMBER_INDEX_END,0,NULL,true)
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_DEFAULT_ID_PRIM(member_prim_type,member_name,member_id) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_(DDS_DYNAMIC_TYPE_SPEC_PRIM((member_prim_type)),(member_name),(member_id),DDS_DYNAMIC_MEMBER_INDEX_END,0,NULL,true)
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_DEFAULT(member_type,member_name) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_DEFAULT_ID((member_type),(member_name),DDS_DYNAMIC_MEMBER_ID_INVALID)
|
||||
#define DDS_DYNAMIC_UNION_MEMBER_DEFAULT_PRIM(member_prim_type,member_name) \
|
||||
DDS_DYNAMIC_UNION_MEMBER_DEFAULT_ID_PRIM((member_prim_type),(member_name),DDS_DYNAMIC_MEMBER_ID_INVALID)
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Dynamic Type specification kind
|
||||
*/
|
||||
typedef enum dds_dynamic_type_spec_kind {
|
||||
DDS_DYNAMIC_TYPE_KIND_UNSET,
|
||||
DDS_DYNAMIC_TYPE_KIND_DEFINITION,
|
||||
DDS_DYNAMIC_TYPE_KIND_PRIMITIVE
|
||||
} dds_dynamic_type_spec_kind_t;
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Dynamic Type specification: a reference to dynamic type, which can be a primitive type
|
||||
* kind (just the type kind enumeration value), or a (primitive or non-primitive) dynamic
|
||||
* type reference.
|
||||
*/
|
||||
typedef struct dds_dynamic_type_spec {
|
||||
dds_dynamic_type_spec_kind_t kind;
|
||||
union {
|
||||
dds_dynamic_type_t type;
|
||||
dds_dynamic_type_kind_t primitive;
|
||||
} type;
|
||||
} dds_dynamic_type_spec_t;
|
||||
|
||||
/**
|
||||
* @brief Dynamic Type descriptor
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Structure that holds the properties for creating a Dynamic Type. For each type kind,
|
||||
* specific member fields are applicable and/or required.
|
||||
*/
|
||||
typedef struct dds_dynamic_type_descriptor {
|
||||
dds_dynamic_type_kind_t kind; /**< Type kind. Required for all types. */
|
||||
const char * name; /**< Type name. Required for struct, union, alias, enum, bitmask, array, sequence. */
|
||||
dds_dynamic_type_spec_t base_type; /**< Option base type for a struct, or (required) aliased type in case of an alias type. */
|
||||
dds_dynamic_type_spec_t discriminator_type; /**< Discriminator type for a union (required). */
|
||||
uint32_t num_bounds; /**< Number of bounds for array and sequence types. In case of sequence, this can be 0 (unbounded) or 1. */
|
||||
const uint32_t *bounds; /**< Bounds for array (0..num_bounds) and sequence (single value) */
|
||||
dds_dynamic_type_spec_t element_type; /**< Element type for array and sequence, required. */
|
||||
dds_dynamic_type_spec_t key_element_type; /**< Key element type for map type */
|
||||
} dds_dynamic_type_descriptor_t;
|
||||
|
||||
/**
|
||||
* @brief Dynamic Type Member descriptor
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Structure that holds the properities for adding a member to a dynamic type. Depending on
|
||||
* the member type, different fields apply and are required.
|
||||
*/
|
||||
typedef struct dds_dynamic_member_descriptor {
|
||||
const char * name; /**< Name of the member, required */
|
||||
uint32_t id; /**< Identifier of the member, applicable for struct and union members. DDS_DYNAMIC_MEMBER_ID_AUTO can be used to indicate the next available id (current max + 1) should be used. */
|
||||
dds_dynamic_type_spec_t type; /**< Member type, required for struct and union members. */
|
||||
char *default_value; /**< Default value for the member */
|
||||
uint32_t index; /**< Member index, applicable for struct and union members. DDS_DYNAMIC_MEMBER_INDEX_START and DDS_DYNAMIC_MEMBER_INDEX_END can be used to add a member as first or last member in the parent type. */
|
||||
uint32_t num_labels; /**< Number of labels, required for union members in case not default_label */
|
||||
int32_t *labels; /**< Labels for a union member, 1..n required for union members in case not default_label */
|
||||
bool default_label; /**< Is default union member */
|
||||
} dds_dynamic_member_descriptor_t;
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Dynamic Type extensibility
|
||||
*/
|
||||
enum dds_dynamic_type_extensibility {
|
||||
DDS_DYNAMIC_TYPE_EXT_FINAL,
|
||||
DDS_DYNAMIC_TYPE_EXT_APPENDABLE,
|
||||
DDS_DYNAMIC_TYPE_EXT_MUTABLE
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Dynamic Type automatic member ID kind
|
||||
*/
|
||||
enum dds_dynamic_type_autoid {
|
||||
DDS_DYNAMIC_TYPE_AUTOID_SEQUENTIAL, /**< The member ID are assigned sequential */
|
||||
DDS_DYNAMIC_TYPE_AUTOID_HASH /**< The member ID is the hash of the member's name */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Enum value kind
|
||||
*
|
||||
* see @ref dds_dynamic_enum_literal_value
|
||||
*/
|
||||
enum dds_dynamic_type_enum_value_kind {
|
||||
DDS_DYNAMIC_ENUM_LITERAL_VALUE_NEXT_AVAIL,
|
||||
DDS_DYNAMIC_ENUM_LITERAL_VALUE_EXPLICIT
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Dynamic Enumeration type literal value kind and value. Can be set to NEXT_AVAIL to indicate
|
||||
* that the current max value + 1 should be used for this member, or an explicit value can be
|
||||
* provided.
|
||||
*/
|
||||
typedef struct dds_dynamic_enum_literal_value {
|
||||
enum dds_dynamic_type_enum_value_kind value_kind;
|
||||
int32_t value;
|
||||
} dds_dynamic_enum_literal_value_t;
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Short notation for initializing a Dynamic Enum value struct.
|
||||
*/
|
||||
#define DDS_DYNAMIC_ENUM_LITERAL_VALUE_AUTO ((dds_dynamic_enum_literal_value_t) { DDS_DYNAMIC_ENUM_LITERAL_VALUE_NEXT_AVAIL, 0 })
|
||||
#define DDS_DYNAMIC_ENUM_LITERAL_VALUE(v) ((dds_dynamic_enum_literal_value_t) { DDS_DYNAMIC_ENUM_LITERAL_VALUE_EXPLICIT, (v) })
|
||||
|
||||
/**
|
||||
* @ingroup dynamic_type
|
||||
*
|
||||
* Used to indicate that the bitmask field should get the next available position (current maximum + 1)
|
||||
*/
|
||||
#define DDS_DYNAMIC_BITMASK_POSITION_AUTO (UINT16_MAX)
|
||||
|
||||
/**
|
||||
* @brief Create a new Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* Creates a new Dynamic Type, using the properties that are set in the type descriptor.
|
||||
* In case these properties include a base-type, element-type or discriminator type, the
|
||||
* ownership of these types is transferred to the newly created type.
|
||||
*
|
||||
* @param[in] entity A DDS entity (any entity, except the pseudo root entity identified by DDS_CYCLONEDDS_HANDLE). This entity is used to get the type library of the entity's domain, to add the type to.
|
||||
* @param[in] descriptor The Dynamic Type descriptor.
|
||||
*
|
||||
* @return dds_dynamic_type_t A Dynamic Type reference for the created type.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The type is created successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_UNSUPPORTED
|
||||
* The provided type kind is not supported.
|
||||
* @retval DDS_RETCODE_OUT_OF_RESOURCES
|
||||
* Not enough resources to create the type.
|
||||
*/
|
||||
DDS_EXPORT dds_dynamic_type_t dds_dynamic_type_create (dds_entity_t entity, dds_dynamic_type_descriptor_t descriptor);
|
||||
|
||||
/**
|
||||
* @brief Set the extensibility of a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type to set the extensibility for. This can be a structure, union, bitmask or enum type. This type must be in the CONSTRUCTING state and have no members added.
|
||||
* @param[in] extensibility The extensibility to set (@ref dds_dynamic_type_extensibility).
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The extensibility is set successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_set_extensibility (dds_dynamic_type_t *type, enum dds_dynamic_type_extensibility extensibility);
|
||||
|
||||
/**
|
||||
* @brief Set the bit-bound of a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type to set the bit-bound for. This can be a bitmask or enum type.
|
||||
* @param[in] bit_bound The bit-bound value to set, in the (including) range 1..32 for enum and 1..64 for bitmask.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The bit-bound is set successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_set_bit_bound (dds_dynamic_type_t *type, uint16_t bit_bound);
|
||||
|
||||
/**
|
||||
* @brief Set the nested flag of a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type to set the nested flag for. This can be a structure or union type.
|
||||
* @param[in] is_nested Whether the nested flag is set.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The flag is set successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_set_nested (dds_dynamic_type_t *type, bool is_nested);
|
||||
|
||||
/**
|
||||
* @brief Set the auto-id kind of a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type to set the auto-id kind for. This can be a structure or union type.
|
||||
* @param[in] value The auto-id kind, see @ref dds_dynamic_type_autoid.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The value is set successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_set_autoid (dds_dynamic_type_t *type, enum dds_dynamic_type_autoid value);
|
||||
|
||||
/**
|
||||
* @brief Add a member to a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* This function is used to add a member to a Dynamic Type. The parent type can be a structure,
|
||||
* union, enumeration or bitmask type. The parent type the member is added to takes over the
|
||||
* ownership of the member type and dereferences the member type when it is deleted.
|
||||
* (@see dds_dynamic_type_ref for re-using a type)
|
||||
*
|
||||
* @param[in,out] type The Dynamic type to add the member to.
|
||||
* @param[in] member_descriptor The member descriptor that has the properties of the member to add, @see dds_dynamic_member_descriptor.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The member is added successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type (non the member type) is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_add_member (dds_dynamic_type_t *type, dds_dynamic_member_descriptor_t member_descriptor);
|
||||
|
||||
/**
|
||||
* @brief Add a literal to a Dynamic Enum Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* This function is used to add a literal to a Dynamic Enum Type.
|
||||
*
|
||||
* @param[in,out] type The Dynamic enum type to add the member to.
|
||||
* @param[in] name The name of the literal to add.
|
||||
* @param[in] value The value for the literal (@see dds_dynamic_enum_literal_value).
|
||||
* @param[in] is_default Indicates if the literal if default for the enum.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The member is added successfully
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_add_enum_literal (dds_dynamic_type_t *type, const char *name, dds_dynamic_enum_literal_value_t value, bool is_default);
|
||||
|
||||
/**
|
||||
* @brief Add a field to a Dynamic bitmask Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* This function is used to add a field to a Dynamic bitmask Type.
|
||||
*
|
||||
* @param[in,out] type The Dynamic bitmask type to add the field to.
|
||||
* @param[in] name The name of the field to add.
|
||||
* @param[in] position The position for the field (@see DDS_DYNAMIC_BITMASK_POSITION_AUTO).
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The member is added successfully
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_add_bitmask_field (dds_dynamic_type_t *type, const char *name, uint16_t position);
|
||||
|
||||
/**
|
||||
* @brief Set the key flag for a Dynamic Type member
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type that contains the member to set the key flag for (must be a structure type).
|
||||
* @param[in] member_id The ID of the member to set the flag for.
|
||||
* @param[in] is_key Indicates whether the key flag should be set or cleared.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The flag is updated successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_member_set_key (dds_dynamic_type_t *type, uint32_t member_id, bool is_key);
|
||||
|
||||
/**
|
||||
* @brief Set the optional flag for a Dynamic Type member
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type that contains the member to set the optional flag for (must be a structure type).
|
||||
* @param[in] member_id The ID of the member to set the flag for.
|
||||
* @param[in] is_optional Indicates whether the optional flag should be set or cleared.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The flag is updated successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_member_set_optional (dds_dynamic_type_t *type, uint32_t member_id, bool is_optional);
|
||||
|
||||
/**
|
||||
* @brief Set the external flag for a Dynamic Type member
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type that contains the member to set the external flag for (must be a structure or union type).
|
||||
* @param[in] member_id The ID of the member to set the flag for.
|
||||
* @param[in] is_external Indicates whether the external flag should be set or cleared.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The flag is updated successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_member_set_external (dds_dynamic_type_t *type, uint32_t member_id, bool is_external);
|
||||
|
||||
/**
|
||||
* @brief Set the hash ID flag and hash field name for a Dynamic Type member
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type that contains the member to set the flag and hash-name for (must be a structure or union type).
|
||||
* @param[in] member_id The ID of the member to set the flag and hash-name for.
|
||||
* @param[in] hash_member_name The hash-name that should be used for calculating the member ID.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The flag is updated successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_member_set_hashid (dds_dynamic_type_t *type, uint32_t member_id, const char *hash_member_name);
|
||||
|
||||
/**
|
||||
* @brief Set the must-understand flag for a Dynamic Type member
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* @param[in,out] type Dynamic Type that contains the member to set the must-understand flag for (must be a structure type).
|
||||
* @param[in] member_id The ID of the member to set the flag for.
|
||||
* @param[in] is_must_understand Indicates whether the must-understand flag should be set or cleared.
|
||||
*
|
||||
* @return dds_return_t Return code. In case of an error, the return code field in the provided type is also set to this value.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The flag is updated successfully.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_member_set_must_understand (dds_dynamic_type_t *type, uint32_t member_id, bool is_must_understand);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Registers a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* This function registers a dynamic type, making it immutable and finalizing
|
||||
* its definition. A type that is registered, get the state 'RESOLVED' and is
|
||||
* stored in the type library.
|
||||
*
|
||||
* @param[in] type A pointer to the dynamic type to be registered.
|
||||
* @param[out] type_info A pointer to a pointer to a ddsi_typeinfo structure that holds information about the registered type.
|
||||
*
|
||||
* @return dds_return_t Return code.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The type was successfully registered.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
* @retval DDS_RETCODE_OUT_OF_RESOURCES
|
||||
* Not enough resources to create the type.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_register (dds_dynamic_type_t *type, struct ddsi_typeinfo **type_info);
|
||||
|
||||
/**
|
||||
* @brief Reference a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* References a Dynamic Type and increases the ref-count of the type. This
|
||||
* can e.g. be used to re-use a subtype when constructing a type.
|
||||
*
|
||||
* @param type Dynamic Type to reference
|
||||
*
|
||||
* @return dds_dynamic_type_t Dynamic Type with increased ref-count
|
||||
*/
|
||||
DDS_EXPORT dds_dynamic_type_t dds_dynamic_type_ref (dds_dynamic_type_t *type);
|
||||
|
||||
/**
|
||||
* @brief Unref a Dynamic Type
|
||||
*
|
||||
* @param type The Dynamic Type to dereference.
|
||||
*
|
||||
* @return dds_return_t Return code.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The type was successfully registered.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more of the provided parameters are invalid.
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* The provided type is not in the CONSTRUCTING state.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_dynamic_type_unref (dds_dynamic_type_t *type);
|
||||
|
||||
/**
|
||||
* @brief Duplicate a Dynamic Type
|
||||
* @ingroup dynamic_type
|
||||
* @component dynamic_type_api
|
||||
*
|
||||
* Duplicates a Dynamic Type. Dependencies of the type are not duplicated,
|
||||
* but their ref-count is increased.
|
||||
*
|
||||
* @param src The type to duplicate.
|
||||
*
|
||||
* @return dds_dynamic_type_t A duplicate of the source type.
|
||||
*/
|
||||
DDS_EXPORT dds_dynamic_type_t dds_dynamic_type_dup (const dds_dynamic_type_t *src);
|
||||
|
||||
|
||||
#endif /* DDS_HAS_TYPELIB */
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // DDS_DYNAMIC_TYPE_H
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
|
||||
|
||||
/* ** DEPRECATED ** */
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
/* 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)
|
||||
|
||||
/** Macro to extract line number */
|
||||
#define dds_err_line(e) (0)
|
||||
|
||||
/** Macro to extract file identifier */
|
||||
#define dds_err_file_id(e) (0)
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
// Copyright(c) 2006 to 2022 ZettaScale Technology 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "dds/export.h"
|
||||
#include "dds/features.h"
|
||||
#include "dds/ddsrt/align.h"
|
||||
#include "dds/ddsc/dds_public_alloc.h"
|
||||
#include "dds/ddsc/dds_opcodes.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup implementation (Public Implementation Details)
|
||||
* @ingroup dds
|
||||
* Miscellaneous types and functions that are required to be public, since they are
|
||||
* in the output of the IDL compiler, but are not intended for direct use.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup implementation
|
||||
* @brief Datastructure of a Sequence type
|
||||
* Container for a sequence of bytes. The general model of this type is also used in IDL output,
|
||||
* where the uint8_t * _buffer is replaced by the appropriate subtype of what is contained.
|
||||
*/
|
||||
typedef struct dds_sequence
|
||||
{
|
||||
uint32_t _maximum; /**< Allocated space in _buffer */
|
||||
uint32_t _length; /**< Used space in _buffer */
|
||||
uint8_t * _buffer; /**< Sequence of bytes */
|
||||
bool _release; /**< Whether a CycloneDDS _free method should free the contained buffer.
|
||||
if you put in your own allocated _buffer set this to false to avoid
|
||||
CycloneDDS calling free() on it. */
|
||||
}
|
||||
dds_sequence_t;
|
||||
|
||||
/**
|
||||
* @ingroup implementation
|
||||
* @brief Key Descriptor
|
||||
* Used to describe a named key field in a type with the offset from the start of a struct.
|
||||
*/
|
||||
typedef struct dds_key_descriptor
|
||||
{
|
||||
const char * m_name; /**< name of keyfield */
|
||||
uint32_t m_offset; /**< offset from pointer */
|
||||
uint32_t m_idx; /**< m_idx'th key of type */
|
||||
}
|
||||
dds_key_descriptor_t;
|
||||
|
||||
/**
|
||||
* @defgroup topic_definition (Topic Definition)
|
||||
* @ingroup implementation
|
||||
* Topic definitions are output by the IDL compiler and have an
|
||||
* implementation-private definition. The only thing exposed on the
|
||||
* API is a pointer to the "dds_topic_descriptor_t" struct type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup topic_definition
|
||||
* @brief Simple sized byte container to hold serialized type info
|
||||
* Holds XTypes information (TypeInformation, TypeMapping) for a
|
||||
* type
|
||||
*/
|
||||
struct dds_type_meta_ser
|
||||
{
|
||||
const unsigned char * data; /**< data pointer */
|
||||
uint32_t sz; /**< data size */
|
||||
};
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_XCDR1
|
||||
* @ingroup topic_definition
|
||||
* @brief Data representation XCDR1
|
||||
* Type can be represented using XCDR1
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_XCDR1 0
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_XML
|
||||
* @ingroup topic_definition
|
||||
* @brief Data representation XML
|
||||
* Type can be represented using XML
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_XML 1
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_XCDR2
|
||||
* @ingroup topic_definition
|
||||
* @brief Data representation XCDR2
|
||||
* Type can be represented using XCDR2
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_XCDR2 2
|
||||
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_FLAG_XCDR1
|
||||
* @ingroup topic_definition
|
||||
* @brief Data representation XCDR1 flag
|
||||
* Type can be represented using XCDR1, preshifted
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_FLAG_XCDR1 (1u << DDS_DATA_REPRESENTATION_XCDR1)
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_FLAG_XML
|
||||
* @ingroup topic_definition
|
||||
* @brief Data representation XML flag
|
||||
* Type can be represented using XML, preshifted
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_FLAG_XML (1u << DDS_DATA_REPRESENTATION_XML)
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_FLAG_XCDR2
|
||||
* @ingroup topic_definition
|
||||
* @brief Data representation XCDR2 flag
|
||||
* Type can be represented using XCDR2, preshifted
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_FLAG_XCDR2 (1u << DDS_DATA_REPRESENTATION_XCDR2)
|
||||
|
||||
/**
|
||||
* @anchor DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT
|
||||
* @ingroup topic_definition
|
||||
* @brief Default datarepresentation flag, XCDR1 and XCDR2 flags
|
||||
*/
|
||||
#define DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT (DDS_DATA_REPRESENTATION_FLAG_XCDR1 | DDS_DATA_REPRESENTATION_FLAG_XCDR2)
|
||||
|
||||
/**
|
||||
* @brief Topic Descriptor
|
||||
* @ingroup topic_definition
|
||||
* @warning Unstable/Private API
|
||||
* Contains all meta information about a type, usually produced by the IDL compiler
|
||||
* Since this type is not intended for public consumption it can change without warning.
|
||||
*/
|
||||
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 */
|
||||
struct dds_type_meta_ser type_information; /**< XCDR2 serialized TypeInformation, only present if flag DDS_TOPIC_XTYPES_METADATA is set */
|
||||
struct dds_type_meta_ser type_mapping; /**< XCDR2 serialized TypeMapping: maps type-id to type object and minimal to complete type id,
|
||||
only present if flag DDS_TOPIC_XTYPES_METADATA is set */
|
||||
const uint32_t restrict_data_representation; /**< restrictions on the data representations allowed for the top-level type for this topic,
|
||||
only present if flag DDS_TOPIC_RESTRICT_DATA_REPRESENTATION */
|
||||
}
|
||||
dds_topic_descriptor_t;
|
||||
|
||||
/**
|
||||
* @defgroup reading_masks (Reading Masks)
|
||||
* @ingroup conditions
|
||||
* Masks for read condition, read, take: there is only one mask here,
|
||||
* which combines the sample, view and instance states.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @anchor DDS_READ_SAMPLE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that were already returned once by a read/take operation
|
||||
*/
|
||||
#define DDS_READ_SAMPLE_STATE 1u
|
||||
|
||||
/**
|
||||
* @anchor DDS_NOT_READ_SAMPLE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that have not been returned by a read/take operation yet
|
||||
*/
|
||||
#define DDS_NOT_READ_SAMPLE_STATE 2u
|
||||
|
||||
/**
|
||||
* @anchor DDS_ANY_SAMPLE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples \ref DDS_READ_SAMPLE_STATE or \ref DDS_NOT_READ_SAMPLE_STATE
|
||||
*/
|
||||
#define DDS_ANY_SAMPLE_STATE (1u | 2u)
|
||||
|
||||
|
||||
/**
|
||||
* @anchor DDS_NEW_VIEW_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that belong to a new instance (unique key value)
|
||||
*/
|
||||
#define DDS_NEW_VIEW_STATE 4u
|
||||
|
||||
/**
|
||||
* @anchor DDS_NOT_NEW_VIEW_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that belong to an existing instance (previously received key value)
|
||||
*/
|
||||
#define DDS_NOT_NEW_VIEW_STATE 8u
|
||||
|
||||
/**
|
||||
* @anchor DDS_ANY_VIEW_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples \ref DDS_NEW_VIEW_STATE or \ref DDS_NOT_NEW_VIEW_STATE
|
||||
*/
|
||||
#define DDS_ANY_VIEW_STATE (4u | 8u)
|
||||
|
||||
|
||||
/**
|
||||
* @anchor DDS_ALIVE_INSTANCE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that belong to a write
|
||||
*/
|
||||
#define DDS_ALIVE_INSTANCE_STATE 16u
|
||||
|
||||
/**
|
||||
* @anchor DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that belong to a (write)dispose
|
||||
*/
|
||||
#define DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE 32u
|
||||
|
||||
/**
|
||||
* @anchor DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples that belong a writer that is gone
|
||||
*/
|
||||
#define DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE 64u
|
||||
|
||||
/**
|
||||
* @anchor DDS_ANY_INSTANCE_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Samples \ref DDS_ALIVE_INSTANCE_STATE, \ref DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE or \ref DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE
|
||||
*/
|
||||
#define DDS_ANY_INSTANCE_STATE (16u | 32u | 64u)
|
||||
|
||||
/**
|
||||
* @anchor DDS_ANY_STATE
|
||||
* @ingroup reading_masks
|
||||
* @brief Any and all samples
|
||||
* Equivalen to \ref DDS_ANY_SAMPLE_STATE | \ref DDS_ANY_VIEW_STATE | \ref DDS_ANY_INSTANCE_STATE
|
||||
*/
|
||||
#define DDS_ANY_STATE (DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE)
|
||||
|
||||
/**
|
||||
* @anchor DDS_DOMAIN_DEFAULT
|
||||
* @ingroup domain
|
||||
* @brief Select the default domain
|
||||
*/
|
||||
#define DDS_DOMAIN_DEFAULT ((uint32_t) 0xffffffffu)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
#define DDS_HANDLE_NIL 0
|
||||
#define DDS_ENTITY_NIL 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief DDS Entity Kind constants
|
||||
* @ingroup internal
|
||||
* @warning Unstable/Private API
|
||||
* Used throughout the library to indicate what entity is what.
|
||||
*/
|
||||
typedef enum dds_entity_kind
|
||||
{
|
||||
DDS_KIND_DONTCARE, /**< Retrieving any entity */
|
||||
DDS_KIND_TOPIC, /**< Topic entity */
|
||||
DDS_KIND_PARTICIPANT, /**< Domain Participant entity */
|
||||
DDS_KIND_READER, /**< Reader entity */
|
||||
DDS_KIND_WRITER, /**< Writer entity */
|
||||
DDS_KIND_SUBSCRIBER, /**< Subscriber entity */
|
||||
DDS_KIND_PUBLISHER, /**< Publisher entity */
|
||||
DDS_KIND_COND_READ, /**< ReadCondition entity */
|
||||
DDS_KIND_COND_QUERY, /**< QueryCondition entity */
|
||||
DDS_KIND_COND_GUARD, /**< GuardCondition entity */
|
||||
DDS_KIND_WAITSET, /**< WaitSet entity */
|
||||
DDS_KIND_DOMAIN, /**< Domain entity */
|
||||
DDS_KIND_CYCLONEDDS /**< CycloneDDS library entity */
|
||||
} dds_entity_kind_t;
|
||||
/**
|
||||
* @anchor DDS_KIND_MAX
|
||||
* @ingroup internal
|
||||
* @brief Max entity kind, used for loops.
|
||||
*/
|
||||
#define DDS_KIND_MAX DDS_KIND_CYCLONEDDS
|
||||
|
||||
/**
|
||||
* @ingroup internal
|
||||
* @warning Private API
|
||||
* @brief Instance handles are uint64_t behind the scenes
|
||||
*/
|
||||
typedef uint64_t dds_instance_handle_t;
|
||||
|
||||
/**
|
||||
* @ingroup domain
|
||||
* @brief Domain IDs are 32 bit unsigned integers.
|
||||
*/
|
||||
typedef uint32_t dds_domainid_t;
|
||||
|
||||
/**
|
||||
* @ingroup topic
|
||||
* @brief Scope for dds_find_topic()
|
||||
*/
|
||||
typedef enum dds_find_scope
|
||||
{
|
||||
DDS_FIND_SCOPE_GLOBAL, /**< locate the topic anywhere CycloneDDS knows about */
|
||||
DDS_FIND_SCOPE_LOCAL_DOMAIN, /**< locate the topic locally within domain boundaries */
|
||||
DDS_FIND_SCOPE_PARTICIPANT /**< locate the topic within the current participant */
|
||||
}
|
||||
dds_find_scope_t;
|
||||
|
||||
/**
|
||||
* @ingroup builtintopic
|
||||
* @brief Type identifier kind for getting endpoint type identifier
|
||||
*/
|
||||
typedef enum dds_typeid_kind
|
||||
{
|
||||
DDS_TYPEID_MINIMAL, /**< XTypes Minimal Type ID */
|
||||
DDS_TYPEID_COMPLETE /**< XTypes Complete Type ID */
|
||||
}
|
||||
dds_typeid_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Enable or disable write batching.
|
||||
* @component domain
|
||||
*
|
||||
* Overrides default configuration setting for write batching (Internal/WriteBatch).
|
||||
*
|
||||
* @param[in] enable Enables or disables write batching for all writers.
|
||||
*/
|
||||
DDS_DEPRECATED_EXPORT void dds_write_set_batch (bool enable);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,853 @@
|
||||
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
|
||||
|
||||
/**
|
||||
* @defgroup listener (Listener API)
|
||||
* @ingroup dds
|
||||
*
|
||||
* This 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);
|
||||
|
||||
/**
|
||||
* @anchor DDS_LUNSET
|
||||
* @ingroup internal
|
||||
* @brief Default initial value (nullptr) for listener functions.
|
||||
*/
|
||||
#define DDS_LUNSET 0
|
||||
|
||||
/**
|
||||
* @brief DDS Listener struct (opaque)
|
||||
* @ingroup listener
|
||||
*/
|
||||
struct dds_listener;
|
||||
|
||||
/**
|
||||
* @brief DDS Listener type (opaque)
|
||||
* @ingroup listener
|
||||
*/
|
||||
typedef struct dds_listener dds_listener_t;
|
||||
|
||||
/**
|
||||
* @ingroup listener
|
||||
* @component listener_obj
|
||||
* @brief Allocate memory and initializes to default values (@ref DDS_LUNSET) of a listener
|
||||
*
|
||||
* @param[in] arg optional pointer that will be passed on to the listener callbacks
|
||||
*
|
||||
* @returns Returns a pointer to the allocated memory for dds_listener_t structure.
|
||||
*/
|
||||
DDS_EXPORT dds_listener_t* dds_create_listener(void* arg);
|
||||
|
||||
/**
|
||||
* @ingroup listener
|
||||
* @component listener_obj
|
||||
* @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 *listener);
|
||||
|
||||
/**
|
||||
* @ingroup listener
|
||||
* @component listener_obj
|
||||
* @brief Reset the listener structure contents to @ref DDS_LUNSET
|
||||
*
|
||||
* @param[in,out] listener pointer to the listener struct to reset
|
||||
*/
|
||||
DDS_EXPORT void dds_reset_listener (dds_listener_t *listener);
|
||||
|
||||
/**
|
||||
* @ingroup listener
|
||||
* @component listener_obj
|
||||
* @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 *dst, const dds_listener_t *src);
|
||||
|
||||
/**
|
||||
* @ingroup listener
|
||||
* @component listener_obj
|
||||
* @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 *dst, const dds_listener_t *src);
|
||||
|
||||
/************************************************************************************************
|
||||
* Setters
|
||||
************************************************************************************************/
|
||||
|
||||
/**
|
||||
* @defgroup listener_setters (Setters)
|
||||
* @ingroup listener
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the data_available callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_data_available_arg (dds_listener_t *listener, dds_on_data_available_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the data_on_readers callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_data_on_readers_arg (dds_listener_t *listener, dds_on_data_on_readers_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the inconsistent_topic callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_inconsistent_topic_arg (dds_listener_t *listener, dds_on_inconsistent_topic_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the liveliness_changed callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_liveliness_changed_arg (dds_listener_t *listener, dds_on_liveliness_changed_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the liveliness_lost callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_liveliness_lost_arg (dds_listener_t *listener, dds_on_liveliness_lost_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the offered_deadline_missed callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_offered_deadline_missed_arg (dds_listener_t *listener, dds_on_offered_deadline_missed_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the offered_incompatible_qos callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_offered_incompatible_qos_arg (dds_listener_t *listener, dds_on_offered_incompatible_qos_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the publication_matched callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_publication_matched_arg (dds_listener_t *listener, dds_on_publication_matched_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the requested_deadline_missed callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_requested_deadline_missed_arg (dds_listener_t *listener, dds_on_requested_deadline_missed_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the requested_incompatible_qos callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_requested_incompatible_qos_arg (dds_listener_t *listener, dds_on_requested_incompatible_qos_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the sample_lost callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_sample_lost_arg (dds_listener_t *listener, dds_on_sample_lost_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the sample_rejected callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_sample_rejected_arg (dds_listener_t *listener, dds_on_sample_rejected_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the subscription_matched callback and argument in the listener structure.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
* @param[in] arg callback argument that is passed uninterpreted to the callback function
|
||||
* @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked
|
||||
*
|
||||
* @retval DDS_RETCODE_OK success
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lset_subscription_matched_arg (dds_listener_t *listener, dds_on_subscription_matched_fn callback, void *arg, bool reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the inconsistent_topic callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_inconsistent_topic_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_inconsistent_topic (dds_listener_t *listener, dds_on_inconsistent_topic_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the liveliness_lost callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_liveliness_lost_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_liveliness_lost (dds_listener_t *listener, dds_on_liveliness_lost_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the offered_deadline_missed callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_offered_deadline_missed_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_offered_deadline_missed (dds_listener_t *listener, dds_on_offered_deadline_missed_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the offered_incompatible_qos callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_offered_incompatible_qos_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_offered_incompatible_qos (dds_listener_t *listener, dds_on_offered_incompatible_qos_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the data_on_readers callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_data_on_readers_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_data_on_readers (dds_listener_t *listener, dds_on_data_on_readers_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the sample_lost callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_sample_lost_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_sample_lost (dds_listener_t *listener, dds_on_sample_lost_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the data_available callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_data_available_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_data_available (dds_listener_t *listener, dds_on_data_available_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the sample_rejected callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_sample_rejected_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_sample_rejected (dds_listener_t *listener, dds_on_sample_rejected_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the liveliness_changed callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_liveliness_changed_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_liveliness_changed (dds_listener_t *listener, dds_on_liveliness_changed_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the requested_deadline_missed callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_requested_deadline_missed_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_requested_deadline_missed (dds_listener_t *listener, dds_on_requested_deadline_missed_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the requested_incompatible_qos callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_requested_incompatible_qos_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_requested_incompatible_qos (dds_listener_t *listener, dds_on_requested_incompatible_qos_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the publication_matched callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_publication_matched_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_publication_matched (dds_listener_t *listener, dds_on_publication_matched_fn callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_setters
|
||||
* @component listener_obj
|
||||
* @brief Set the subscription_matched callback in the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lset_subscription_matched_arg with arg set to the argument passed in
|
||||
* dds_create_listener() and reset_on_invoke to true, and throwing away the result.
|
||||
*
|
||||
* @param[in,out] listener listener structure to update
|
||||
* @param[in] callback the callback to set or a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lset_subscription_matched (dds_listener_t *listener, dds_on_subscription_matched_fn callback);
|
||||
|
||||
|
||||
/************************************************************************************************
|
||||
* Getters
|
||||
************************************************************************************************/
|
||||
|
||||
/**
|
||||
* @defgroup listener_getters (Getters)
|
||||
* @ingroup listener
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_data_available_arg (const dds_listener_t *listener, dds_on_data_available_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_data_on_readers_arg (const dds_listener_t *listener, dds_on_data_on_readers_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_inconsistent_topic_arg (const dds_listener_t *listener, dds_on_inconsistent_topic_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_liveliness_changed_arg (const dds_listener_t *listener, dds_on_liveliness_changed_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_liveliness_lost_arg (const dds_listener_t *listener, dds_on_liveliness_lost_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_offered_deadline_missed_arg (const dds_listener_t *listener, dds_on_offered_deadline_missed_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_offered_incompatible_qos_arg (const dds_listener_t *listener, dds_on_offered_incompatible_qos_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_publication_matched_arg (const dds_listener_t *listener, dds_on_publication_matched_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the subscription_matched callback from the listener structure.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_requested_deadline_missed_arg (const dds_listener_t *listener, dds_on_requested_deadline_missed_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_requested_incompatible_qos_arg (const dds_listener_t *listener, dds_on_requested_incompatible_qos_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_sample_lost_arg (const dds_listener_t *listener, dds_on_sample_lost_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @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[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_sample_rejected_arg (const dds_listener_t *listener, dds_on_sample_rejected_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the subscription_matched callback from the listener structure.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
* @param[out] arg Callback argument pointer; may be a null pointer
|
||||
* @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer
|
||||
*
|
||||
* @retval DDS_RETCODE_OK if successful
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_lget_subscription_matched_arg (const dds_listener_t *listener, dds_on_subscription_matched_fn *callback, void **arg, bool *reset_on_invoke);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the inconsistent_topic callback from the listener structure
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_inconsistent_topic_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_inconsistent_topic (const dds_listener_t *listener, dds_on_inconsistent_topic_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the liveliness_lost callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_liveliness_lost_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_liveliness_lost (const dds_listener_t *listener, dds_on_liveliness_lost_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the offered_deadline_missed callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_offered_deadline_missed_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_offered_deadline_missed (const dds_listener_t *listener, dds_on_offered_deadline_missed_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the offered_incompatible_qos callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_offered_incompatible_qos_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_offered_incompatible_qos (const dds_listener_t *listener, dds_on_offered_incompatible_qos_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the data_on_readers callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_data_on_readers_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_data_on_readers (const dds_listener_t *listener, dds_on_data_on_readers_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the sample_lost callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_sample_lost_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_sample_lost (const dds_listener_t *listener, dds_on_sample_lost_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the data_available callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_data_available_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_data_available (const dds_listener_t *listener, dds_on_data_available_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the sample_rejected callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_sample_rejected_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_sample_rejected (const dds_listener_t *listener, dds_on_sample_rejected_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the liveliness_changed callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_liveliness_changed_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_liveliness_changed (const dds_listener_t *listener, dds_on_liveliness_changed_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the requested_deadline_missed callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_requested_deadline_missed_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_requested_deadline_missed (const dds_listener_t *listener, dds_on_requested_deadline_missed_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the requested_incompatible_qos callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_requested_incompatible_qos_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_requested_incompatible_qos (const dds_listener_t *listener, dds_on_requested_incompatible_qos_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the publication_matched callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_publication_matched_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_publication_matched (const dds_listener_t *listener, dds_on_publication_matched_fn *callback);
|
||||
|
||||
/**
|
||||
* @ingroup listener_getters
|
||||
* @component listener_obj
|
||||
* @brief Get the subscription_matched callback from the listener structure.
|
||||
*
|
||||
* Equivalent to calling @ref dds_lget_subscription_matched_arg with arg and reset_on_invoke set to a null pointer and throwing away the result.
|
||||
*
|
||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||
* @param[out] callback Callback function; may be a null pointer
|
||||
*/
|
||||
DDS_EXPORT void dds_lget_subscription_matched (const dds_listener_t *listener, dds_on_subscription_matched_fn *callback);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_DDS_PUBLIC_LISTENER_H_*/
|
||||
@@ -0,0 +1,172 @@
|
||||
// Copyright(c) 2021 ZettaScale Technology
|
||||
// Copyright(c) 2021 Apex.AI, Inc
|
||||
//
|
||||
// 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
|
||||
|
||||
// API extension
|
||||
// defines functions needed for loaning and shared memory usage
|
||||
|
||||
#ifndef DDS_PUBLIC_LOAN_API_H
|
||||
#define DDS_PUBLIC_LOAN_API_H
|
||||
|
||||
#include "dds/ddsc/dds_basic_types.h"
|
||||
#include "dds/ddsrt/retcode.h"
|
||||
#include "dds/export.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup loan (Loans API)
|
||||
* @ingroup dds
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Request a loan from an entity.
|
||||
* @ingroup loan
|
||||
*
|
||||
* Borrow a sample from the entity, which currently must be a writer. This sample
|
||||
* can then be returned using @ref dds_return_loan or can be used to publish data
|
||||
* using @ref dds_write or @ref dds_writedispose.
|
||||
*
|
||||
* If the topic type has a fixed size (and so no internal pointers) and a PSMX interface is configured,
|
||||
* the memory will be borrowed from the PSMX implementation, which allows Cyclone to avoid copies
|
||||
* and/or serialization if there is no need for sending the data over a network interface or storing it
|
||||
* in the WHC.
|
||||
*
|
||||
* @param[in] entity The entity to request loans from.
|
||||
* @param[out] sample Where to store the address of the loaned sample.
|
||||
*
|
||||
* @returns A dds_return_t indicating success or failure.
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* The operation was successful.
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* One or more parameters are invalid.
|
||||
* @retval DDS_RETCODE_ILLEGAL_OPERATION
|
||||
* The operation is invoked on an inappropriate object.
|
||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||
* The entity has already been deleted.
|
||||
* @retval DDS_RETCODE_ERROR
|
||||
* An unfortunate incident occurred.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_request_loan (dds_entity_t entity, void **sample);
|
||||
|
||||
/**
|
||||
* @brief Return loaned samples to a reader or writer
|
||||
* @ingroup loan
|
||||
* @component read_data
|
||||
*
|
||||
* Used to release middleware-owned samples returned by a read/take operation and samples
|
||||
* borrowed from the writer using @ref dds_request_loan.
|
||||
*
|
||||
* For reader loans, the @ref dds_read and @ref dds_take operations implicitly return
|
||||
* outstanding loans referenced by the sample array passed in. Looping until no data is
|
||||
* returned therefore often eliminates the need for calling this function.
|
||||
*
|
||||
* For writer loans, a @ref dds_write operation takes over the loan. Consequently, this
|
||||
* function is only needed in the exceptional case where a loan is taken but ultimately
|
||||
* not used to publish data.
|
||||
*
|
||||
* @param[in] entity The entity that the loan(s) belong to. If a read or query condition is passed in for the entity, the reader for that condition is used.
|
||||
* @param[in,out] buf An array of (pointers to) samples, some or all of which will be set to null pointers.
|
||||
* @param[in] bufsz The size of the buffer.
|
||||
*
|
||||
* @returns A dds_return_t indicating success or failure
|
||||
* @retval DDS_RETCODE_OK
|
||||
* - the operation was successful
|
||||
* - a no-op if bufsz <= 0, otherwise
|
||||
* - buf[0] .. buf[k-1] were successfully returned loans, k = bufsz or buf[k] = null
|
||||
* - buf[0] is set to a null pointer, buf[k > 0] undefined
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* - the entity parameter is not a valid parameter
|
||||
* - buf is null, or bufsz > 0 and buf[0] = null
|
||||
* - a non-loan was encountered (all loans are still returned)
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* - bufsz > 0 and buf[0] != null but not a loan, nothing done
|
||||
* @retval DDS_RETCODE_UNSUPPORTED
|
||||
* - (for writer loans) invoked on a writer not supporting loans.
|
||||
* @retval DDS_RETCODE_ILLEGAL_OPERATION
|
||||
* - the operation is invoked on an inappropriate object.
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_return_loan (dds_entity_t entity, void **buf, int32_t bufsz);
|
||||
|
||||
/**
|
||||
* @ingroup loan
|
||||
* @component read_data
|
||||
* @brief Check if a shared memory is available to reader/writer.
|
||||
*
|
||||
* @note dds_request_loan_of_size can be used if and only if
|
||||
* dds_is_shared_memory_available returns true.
|
||||
*
|
||||
* @param[in] entity the handle of the entity
|
||||
*
|
||||
* @returns true if shared memory is available, false otherwise
|
||||
*/
|
||||
DDS_EXPORT bool dds_is_shared_memory_available (const dds_entity_t entity);
|
||||
|
||||
/**
|
||||
* @brief Request a loan of a specified size from an entity.
|
||||
* @ingroup loan
|
||||
*
|
||||
* Borrow a sample of a specified size from the entity, which currently must be a
|
||||
* writer. This sample can then be returned using @ref dds_return_loan or can be
|
||||
* used to publish data using @ref dds_write or @ref dds_writedispose.
|
||||
*
|
||||
* @note The function can only be used if dds_is_shared_memory_available is
|
||||
* true for the writer.
|
||||
*
|
||||
* @param[in] writer The entity to request loans from.
|
||||
* @param[in] size the requested loan size
|
||||
* @param[out] sample Where to store the address of the loaned sample.
|
||||
*
|
||||
* @returns DDS_RETCODE_OK if successful, DDS_RETCODE_ERROR otherwise
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_request_loan_of_size (dds_entity_t writer, size_t size, void **sample);
|
||||
|
||||
/**
|
||||
* @ingroup deprecated
|
||||
* @component read_data
|
||||
* @brief Check if a Loan is available to reader/writer
|
||||
* @deprecated Use @ref dds_request_loan instead, returns 0 if loan is not available
|
||||
*
|
||||
* The loan is available if the shared memory is enabled and all the constraints
|
||||
* to enable shared memory are met and the type is fixed
|
||||
* @note dds_loan_sample can be used if and only if
|
||||
* dds_is_loan_available returns true.
|
||||
*
|
||||
* @param[in] entity the handle of the entity
|
||||
*
|
||||
* @returns loan available or not
|
||||
*/
|
||||
DDS_DEPRECATED_EXPORT bool dds_is_loan_available (const dds_entity_t entity);
|
||||
|
||||
/**
|
||||
* @ingroup deprecated
|
||||
* @component read_data
|
||||
* @brief Loan a sample from the writer.
|
||||
* @deprecated Use @ref dds_request_loan
|
||||
* @note This function is to be used with dds_write to publish the loaned
|
||||
* sample.
|
||||
* @note The function can only be used if dds_is_loan_available is
|
||||
* true for the writer.
|
||||
*
|
||||
* @param[in] writer the writer to loan the buffer from
|
||||
* @param[out] sample the loaned sample
|
||||
*
|
||||
* @returns DDS_RETCODE_OK if successful, DDS_RETCODE_ERROR otherwise
|
||||
*/
|
||||
DDS_DEPRECATED_EXPORT dds_return_t dds_loan_sample (dds_entity_t writer, void **sample);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDS_PUBLIC_LOAN_API_H */
|
||||
+1133
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,121 @@
|
||||
// Copyright(c) 2024 ZettaScale Technology 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
|
||||
#ifndef DDS_QOS_PROVIDER_H
|
||||
#define DDS_QOS_PROVIDER_H
|
||||
|
||||
#include "dds/export.h"
|
||||
#include "dds/ddsrt/retcode.h"
|
||||
#include "dds/ddsc/dds_public_qosdefs.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef DDS_HAS_QOS_PROVIDER
|
||||
|
||||
/**
|
||||
* @defgroup qos_provider (QosProvider)
|
||||
* @ingroup dds
|
||||
* The Qos Provider API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief All kind of entities for which qos can be stored in Profile.
|
||||
* @ingroup qos_provider
|
||||
* @component qos_provider_api
|
||||
*/
|
||||
enum dds_qos_kind
|
||||
{
|
||||
DDS_PARTICIPANT_QOS,
|
||||
DDS_PUBLISHER_QOS,
|
||||
DDS_SUBSCRIBER_QOS,
|
||||
DDS_TOPIC_QOS,
|
||||
DDS_READER_QOS,
|
||||
DDS_WRITER_QOS
|
||||
};
|
||||
typedef enum dds_qos_kind dds_qos_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Sample structure of the Qos Provider.
|
||||
* @ingroup qos_provider
|
||||
* @component qos_provider_api
|
||||
*/
|
||||
struct dds_qos_provider;
|
||||
typedef struct dds_qos_provider dds_qos_provider_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize Qos Provider.
|
||||
* @ingroup qos_provider
|
||||
* @component qos_provider_api
|
||||
*
|
||||
* Create dds_qos_provider with provided system definition file path.
|
||||
*
|
||||
* @param[in] path - String that contains system definition inself or path to system defenition file.
|
||||
* @param[in,out] provider - Pointer to the Qos Provider structure.
|
||||
*
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t
|
||||
dds_create_qos_provider (const char *path, dds_qos_provider_t **provider);
|
||||
|
||||
/**
|
||||
* @brief Initialize Qos Provider with certain scope.
|
||||
* @ingroup qos_provider
|
||||
* @component qos_provider_api
|
||||
*
|
||||
* Create dds_qos_provider with provided system definition file path and scope.
|
||||
*
|
||||
* @param[in] path - String that contains system definition inself or path to system defenition file.
|
||||
* @param[in,out] provider - Pointer to the Qos Provider structure.
|
||||
* @param[in] key - String that contains pattern of interested qos from `path` in format '<library name>::<profile name>::<entity name>'.
|
||||
*
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t
|
||||
dds_create_qos_provider_scope (const char *path, dds_qos_provider_t **provider,
|
||||
const char *key);
|
||||
|
||||
/**
|
||||
* @brief Get Qos from Qos Provider.
|
||||
* @ingroup qos_provider
|
||||
* @component qos_provider_api
|
||||
*
|
||||
* Provide access to dds_qos_t from dds_qos_provider by full key and type of qos entity.
|
||||
*
|
||||
* @param[in] provider - Pointer to the Qos Provider structure.
|
||||
* @param[in] type - Type of entity which Qos to get.
|
||||
* @param[in] key - Full qualify name of Qos to get in format '<library name>::<profile name>::<entity name>'.
|
||||
* @param[in,out] qos - Pointer to the Qos structure.
|
||||
*
|
||||
* @return a DDS return code
|
||||
*/
|
||||
DDS_EXPORT dds_return_t
|
||||
dds_qos_provider_get_qos (const dds_qos_provider_t *provider, dds_qos_kind_t type,
|
||||
const char *key, const dds_qos_t **qos);
|
||||
|
||||
/**
|
||||
* @brief Finalize Qos Provider.
|
||||
* @ingroup qos_provider
|
||||
* @component qos_provider_api
|
||||
*
|
||||
* Release resources allocated by dds_qos_provider.
|
||||
*
|
||||
* @param[in] provider - Pointer to the Qos Provider structure.
|
||||
*/
|
||||
DDS_EXPORT void
|
||||
dds_delete_qos_provider (dds_qos_provider_t *provider);
|
||||
|
||||
#endif /* DDS_HAS_QOS_PROVIDER */
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // DDS_QOS_PROVIDER_H
|
||||
@@ -0,0 +1,182 @@
|
||||
// Copyright(c) 2006 to 2022 ZettaScale Technology 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
|
||||
|
||||
#ifndef DDS_QOSDEFS_H
|
||||
#define DDS_QOSDEFS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @anchor DDS_LENGTH_UNLIMITED
|
||||
* @ingroup qos
|
||||
* @brief Used for indicating unlimited length in dds_qset_resource_limits()
|
||||
*/
|
||||
#define DDS_LENGTH_UNLIMITED -1
|
||||
|
||||
/**
|
||||
* @brief Qos Policy IDs
|
||||
* @ingroup internal
|
||||
* Used internally to mark the QoS policy type
|
||||
*/
|
||||
typedef enum dds_qos_policy_id {
|
||||
DDS_INVALID_QOS_POLICY_ID, /**< Invalid Policy */
|
||||
DDS_USERDATA_QOS_POLICY_ID, /**< Userdata policy dds_qset_userdata() */
|
||||
DDS_DURABILITY_QOS_POLICY_ID, /**< Durability policy dds_qset_durability() */
|
||||
DDS_PRESENTATION_QOS_POLICY_ID, /**< Presentation policy dds_qset_presentation() */
|
||||
DDS_DEADLINE_QOS_POLICY_ID, /**< Deadline policy dds_qset_deadline() */
|
||||
DDS_LATENCYBUDGET_QOS_POLICY_ID, /**< LatencyBudget policy dds_qset_latency_budget() */
|
||||
DDS_OWNERSHIP_QOS_POLICY_ID, /**< Ownership policy dds_qset_ownership() */
|
||||
DDS_OWNERSHIPSTRENGTH_QOS_POLICY_ID, /**< OwnershipStrength policy dds_qset_ownership_strength() */
|
||||
DDS_LIVELINESS_QOS_POLICY_ID, /**< Liveliness policy dds_qset_liveliness() */
|
||||
DDS_TIMEBASEDFILTER_QOS_POLICY_ID, /**< TimeBasedFilter policy dds_qset_time_based_filter() */
|
||||
DDS_PARTITION_QOS_POLICY_ID, /**< Partition policy dds_qset_partition() */
|
||||
DDS_RELIABILITY_QOS_POLICY_ID, /**< Reliability policy dds_qset_reliability() */
|
||||
DDS_DESTINATIONORDER_QOS_POLICY_ID, /**< DestinationOrder policy dds_qset_destination_order() */
|
||||
DDS_HISTORY_QOS_POLICY_ID, /**< History policy dds_qset_history() */
|
||||
DDS_RESOURCELIMITS_QOS_POLICY_ID, /**< ResourceLimits policy dds_qset_resource_limits() */
|
||||
DDS_ENTITYFACTORY_QOS_POLICY_ID, /**< EntityFactory policy */
|
||||
DDS_WRITERDATALIFECYCLE_QOS_POLICY_ID, /**< WriterDataLifecycle policy dds_qset_writer_data_lifecycle() */
|
||||
DDS_READERDATALIFECYCLE_QOS_POLICY_ID, /**< ReaderDataLifecycle policy dds_qset_reader_data_lifecycle() */
|
||||
DDS_TOPICDATA_QOS_POLICY_ID, /**< Topicdata policy dds_qset_topicdata() */
|
||||
DDS_GROUPDATA_QOS_POLICY_ID, /**< Groupdata policy dds_qset_groupdata() */
|
||||
DDS_TRANSPORTPRIORITY_QOS_POLICY_ID, /**< TransportPriority policy dds_qset_transport_priority() */
|
||||
DDS_LIFESPAN_QOS_POLICY_ID, /**< Livespan policy dds_qset_lifespan() */
|
||||
DDS_DURABILITYSERVICE_QOS_POLICY_ID, /**< DurabilityService policy dds_qset_durability_service() */
|
||||
DDS_PROPERTY_QOS_POLICY_ID, /**< Property policy dds_qset_property() */
|
||||
DDS_TYPE_CONSISTENCY_ENFORCEMENT_QOS_POLICY_ID, /**< TypeConsistencyEnforcement policy dds_qset_type_consistency_enforcements() */
|
||||
DDS_DATA_REPRESENTATION_QOS_POLICY_ID /**< DataRepresentation policy dds_qset_data_representation() */
|
||||
} dds_qos_policy_id_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief QoS datatype
|
||||
* @ingroup qos
|
||||
* QoS structure is opaque
|
||||
*/
|
||||
typedef struct dds_qos dds_qos_t;
|
||||
|
||||
/**
|
||||
* @brief Durability QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_durability_kind
|
||||
{
|
||||
DDS_DURABILITY_VOLATILE, /**< Volatile durability */
|
||||
DDS_DURABILITY_TRANSIENT_LOCAL, /**< Transient Local durability */
|
||||
DDS_DURABILITY_TRANSIENT, /**< Transient durability */
|
||||
DDS_DURABILITY_PERSISTENT /**< Persistent durability */
|
||||
}
|
||||
dds_durability_kind_t;
|
||||
|
||||
/**
|
||||
* @brief History QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_history_kind
|
||||
{
|
||||
DDS_HISTORY_KEEP_LAST, /**< Keep Last history */
|
||||
DDS_HISTORY_KEEP_ALL /**< Keep All history */
|
||||
}
|
||||
dds_history_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Ownership QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_ownership_kind
|
||||
{
|
||||
DDS_OWNERSHIP_SHARED, /**< Shared Ownership */
|
||||
DDS_OWNERSHIP_EXCLUSIVE /**< Exclusive Ownership */
|
||||
}
|
||||
dds_ownership_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Liveliness QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_liveliness_kind
|
||||
{
|
||||
DDS_LIVELINESS_AUTOMATIC, /**< Automatic liveliness */
|
||||
DDS_LIVELINESS_MANUAL_BY_PARTICIPANT, /**< Manual by Participant liveliness */
|
||||
DDS_LIVELINESS_MANUAL_BY_TOPIC /**< Manual by Topic liveliness */
|
||||
}
|
||||
dds_liveliness_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Reliability QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_reliability_kind
|
||||
{
|
||||
DDS_RELIABILITY_BEST_EFFORT, /**< Best Effort reliability */
|
||||
DDS_RELIABILITY_RELIABLE /**< Reliable reliability */
|
||||
}
|
||||
dds_reliability_kind_t;
|
||||
|
||||
/**
|
||||
* @brief DestinationOrder QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_destination_order_kind
|
||||
{
|
||||
DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP, /**< order by reception timestamp */
|
||||
DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP /**< order by source timestamp */
|
||||
}
|
||||
dds_destination_order_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Presentation QoS: Applies to Publisher, Subscriber
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_presentation_access_scope_kind
|
||||
{
|
||||
DDS_PRESENTATION_INSTANCE, /**< presentation scope per instance */
|
||||
DDS_PRESENTATION_TOPIC, /**< presentation scope per topic */
|
||||
DDS_PRESENTATION_GROUP /**< presentation scope per group */
|
||||
}
|
||||
dds_presentation_access_scope_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Ignore-local QoS: Applies to DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_ignorelocal_kind
|
||||
{
|
||||
DDS_IGNORELOCAL_NONE, /**< Don't ignore local data */
|
||||
DDS_IGNORELOCAL_PARTICIPANT, /**< Ignore local data from same participant */
|
||||
DDS_IGNORELOCAL_PROCESS /**< Ignore local data from same process */
|
||||
}
|
||||
dds_ignorelocal_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Type-consistency QoS: Applies to DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef enum dds_type_consistency_kind
|
||||
{
|
||||
DDS_TYPE_CONSISTENCY_DISALLOW_TYPE_COERCION, /**< Do not allow type coercion */
|
||||
DDS_TYPE_CONSISTENCY_ALLOW_TYPE_COERCION /**< Allow type coercion */
|
||||
}
|
||||
dds_type_consistency_kind_t;
|
||||
|
||||
/**
|
||||
* @brief Data Representation QoS: Applies to Topic, DataReader, DataWriter
|
||||
* @ingroup qos
|
||||
*/
|
||||
typedef int16_t dds_data_representation_id_t;
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+521
@@ -0,0 +1,521 @@
|
||||
// Copyright(c) 2006 to 2019 ZettaScale Technology 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
|
||||
|
||||
/**
|
||||
* @defgroup dcps_status (DDS C Communication Status API)
|
||||
* @ingroup dds
|
||||
* This defines the public API of the Communication Status in the
|
||||
* Eclipse Cyclone DDS C language binding. Listeners are implemented
|
||||
* as structs containing callback functions that take listener status types
|
||||
* as arguments.
|
||||
*/
|
||||
#ifndef DDS_STATUS_H
|
||||
#define DDS_STATUS_H
|
||||
|
||||
#include "dds/export.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_OfferedDeadlineMissed
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_offered_deadline_missed_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
dds_instance_handle_t last_instance_handle; /**< DOC_TODO */
|
||||
}
|
||||
dds_offered_deadline_missed_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_OfferedIncompatibleQoS
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_offered_incompatible_qos_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
uint32_t last_policy_id; /**< DOC_TODO */
|
||||
}
|
||||
dds_offered_incompatible_qos_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_PublicationMatched
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_publication_matched_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
uint32_t current_count; /**< DOC_TODO */
|
||||
int32_t current_count_change; /**< DOC_TODO */
|
||||
dds_instance_handle_t last_subscription_handle; /**< DOC_TODO */
|
||||
}
|
||||
dds_publication_matched_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_LivelinessLost
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_liveliness_lost_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
}
|
||||
dds_liveliness_lost_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_SubscriptionMatched
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_subscription_matched_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
uint32_t current_count; /**< DOC_TODO */
|
||||
int32_t current_count_change; /**< DOC_TODO */
|
||||
dds_instance_handle_t last_publication_handle; /**< DOC_TODO */
|
||||
}
|
||||
dds_subscription_matched_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief Rejected Status
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DDS_NOT_REJECTED, /**< DOC_TODO */
|
||||
DDS_REJECTED_BY_INSTANCES_LIMIT, /**< DOC_TODO */
|
||||
DDS_REJECTED_BY_SAMPLES_LIMIT, /**< DOC_TODO */
|
||||
DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT /**< DOC_TODO */
|
||||
}
|
||||
dds_sample_rejected_status_kind;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_SampleRejected
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_sample_rejected_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
dds_sample_rejected_status_kind last_reason; /**< DOC_TODO */
|
||||
dds_instance_handle_t last_instance_handle; /**< DOC_TODO */
|
||||
}
|
||||
dds_sample_rejected_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_LivelinessChanged
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_liveliness_changed_status
|
||||
{
|
||||
uint32_t alive_count; /**< DOC_TODO */
|
||||
uint32_t not_alive_count; /**< DOC_TODO */
|
||||
int32_t alive_count_change; /**< DOC_TODO */
|
||||
int32_t not_alive_count_change; /**< DOC_TODO */
|
||||
dds_instance_handle_t last_publication_handle; /**< DOC_TODO */
|
||||
}
|
||||
dds_liveliness_changed_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_RequestedDeadlineMissed
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_requested_deadline_missed_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
dds_instance_handle_t last_instance_handle; /**< DOC_TODO */
|
||||
}
|
||||
dds_requested_deadline_missed_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_RequestedIncompatibleQoS
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_requested_incompatible_qos_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
uint32_t last_policy_id; /**< DOC_TODO */
|
||||
}
|
||||
dds_requested_incompatible_qos_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_SampleLost
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_sample_lost_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
}
|
||||
dds_sample_lost_status_t;
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status
|
||||
* @brief DCPS_Status_InconsistentTopic
|
||||
* DOC_TODO
|
||||
*/
|
||||
typedef struct dds_inconsistent_topic_status
|
||||
{
|
||||
uint32_t total_count; /**< DOC_TODO */
|
||||
int32_t total_count_change; /**< DOC_TODO */
|
||||
}
|
||||
dds_inconsistent_topic_status_t;
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup dcps_status_getters (DCPS Status Getters)
|
||||
* @ingroup dcps_status
|
||||
* get_<status> APIs return the status of an entity and resets the status
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 topic entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_inconsistent_topic_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 writer entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_publication_matched_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 writer entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_liveliness_lost_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 writer entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_offered_deadline_missed_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 dds_offered_incompatible_qos_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 dds_subscription_matched_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 reader entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_liveliness_changed_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 reader entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_sample_rejected_status_t to get the status
|
||||
*
|
||||
* @returns 0 - Success
|
||||
* @returns <0 - Failure
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 reader entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_sample_lost_status_t 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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 reader entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_requested_deadline_missed_status_t 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);
|
||||
|
||||
/**
|
||||
* @ingroup dcps_status_getters
|
||||
* @component entity_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 reader entity to get the status
|
||||
* @param[out] status The pointer to @ref dds_requested_incompatible_qos_status_t 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
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
// Copyright(c) 2006 to 2021 ZettaScale Technology 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
|
||||
|
||||
#ifndef _DDS_RHC_H_
|
||||
#define _DDS_RHC_H_
|
||||
|
||||
#include "dds/dds.h"
|
||||
#include "dds/ddsrt/static_assert.h"
|
||||
#include "dds/ddsi/ddsi_rhc.h"
|
||||
|
||||
#define DDS_RHC_NO_STATE_MASK_SET (DDS_ANY_STATE + 1)
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct dds_rhc;
|
||||
struct dds_readcond;
|
||||
struct dds_reader;
|
||||
struct ddsi_tkmap;
|
||||
|
||||
typedef dds_return_t (*dds_rhc_associate_t) (struct dds_rhc *rhc, struct dds_reader *reader, const struct ddsi_sertype *type, struct ddsi_tkmap *tkmap);
|
||||
typedef int32_t (*dds_rhc_read_take_t) (struct dds_rhc *rhc, int32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond, dds_read_with_collector_fn_t collect_sample, void *collect_sample_arg);
|
||||
|
||||
typedef bool (*dds_rhc_add_readcondition_t) (struct dds_rhc *rhc, struct dds_readcond *cond);
|
||||
typedef void (*dds_rhc_remove_readcondition_t) (struct dds_rhc *rhc, struct dds_readcond *cond);
|
||||
|
||||
struct dds_rhc_ops {
|
||||
/* A copy of DDSI rhc ops comes first so we can use either interface without
|
||||
additional indirections */
|
||||
struct ddsi_rhc_ops rhc_ops;
|
||||
dds_rhc_read_take_t peek;
|
||||
dds_rhc_read_take_t read;
|
||||
dds_rhc_read_take_t take;
|
||||
dds_rhc_add_readcondition_t add_readcondition;
|
||||
dds_rhc_remove_readcondition_t remove_readcondition;
|
||||
dds_rhc_associate_t associate;
|
||||
};
|
||||
|
||||
struct dds_rhc {
|
||||
union {
|
||||
const struct dds_rhc_ops *ops;
|
||||
struct ddsi_rhc rhc;
|
||||
} common;
|
||||
};
|
||||
|
||||
DDSRT_STATIC_ASSERT (offsetof (struct dds_rhc, common.ops) == offsetof (struct ddsi_rhc, ops));
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline dds_return_t dds_rhc_associate (struct dds_rhc *rhc, struct dds_reader *reader, const struct ddsi_sertype *type, struct ddsi_tkmap *tkmap) {
|
||||
return rhc->common.ops->associate (rhc, reader, type, tkmap);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline bool dds_rhc_store (struct dds_rhc *rhc, const struct ddsi_writer_info *wr_info, struct ddsi_serdata *sample, struct ddsi_tkmap_instance *tk) {
|
||||
return rhc->common.ops->rhc_ops.store (&rhc->common.rhc, wr_info, sample, tk);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline void dds_rhc_unregister_wr (struct dds_rhc *rhc, const struct ddsi_writer_info *wr_info) {
|
||||
rhc->common.ops->rhc_ops.unregister_wr (&rhc->common.rhc, wr_info);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline void dds_rhc_relinquish_ownership (struct dds_rhc *rhc, const uint64_t wr_iid) {
|
||||
rhc->common.ops->rhc_ops.relinquish_ownership (&rhc->common.rhc, wr_iid);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline void dds_rhc_set_qos (struct dds_rhc *rhc, const struct dds_qos *qos) {
|
||||
rhc->common.ops->rhc_ops.set_qos (&rhc->common.rhc, qos);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline void dds_rhc_free (struct dds_rhc *rhc) {
|
||||
rhc->common.ops->rhc_ops.free (&rhc->common.rhc);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline int32_t dds_rhc_peek (struct dds_rhc *rhc, int32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond, dds_read_with_collector_fn_t collect_sample, void *collect_sample_arg) {
|
||||
return (rhc->common.ops->peek) (rhc, max_samples, mask, handle, cond, collect_sample, collect_sample_arg);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline int32_t dds_rhc_read (struct dds_rhc *rhc, int32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond, dds_read_with_collector_fn_t collect_sample, void *collect_sample_arg) {
|
||||
return (rhc->common.ops->read) (rhc, max_samples, mask, handle, cond, collect_sample, collect_sample_arg);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline int32_t dds_rhc_take (struct dds_rhc *rhc, int32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond, dds_read_with_collector_fn_t collect_sample, void *collect_sample_arg) {
|
||||
return rhc->common.ops->take (rhc, max_samples, mask, handle, cond, collect_sample, collect_sample_arg);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline bool dds_rhc_add_readcondition (struct dds_rhc *rhc, struct dds_readcond *cond) {
|
||||
return rhc->common.ops->add_readcondition (rhc, cond);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_INLINE_EXPORT inline void dds_rhc_remove_readcondition (struct dds_rhc *rhc, struct dds_readcond *cond) {
|
||||
rhc->common.ops->remove_readcondition (rhc, cond);
|
||||
}
|
||||
|
||||
/** @component rhc */
|
||||
DDS_EXPORT void dds_reader_data_available_cb (struct dds_reader *rd);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
// Copyright(c) 2020 ZettaScale Technology 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
|
||||
|
||||
#ifndef DDS_STATISTICS_H
|
||||
#define DDS_STATISTICS_H
|
||||
|
||||
/**
|
||||
* @defgroup statistics (DDS Statistics)
|
||||
* @ingroup dds
|
||||
* @warning Unstable API
|
||||
*
|
||||
* A quick-and-dirty provisional interface
|
||||
*/
|
||||
|
||||
#include "dds/dds.h"
|
||||
#include "dds/ddsrt/attributes.h"
|
||||
#include "dds/export.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Kind of statistical value
|
||||
* @ingroup statistics
|
||||
*/
|
||||
enum dds_stat_kind {
|
||||
DDS_STAT_KIND_UINT32, /**< value is a 32-bit unsigned integer */
|
||||
DDS_STAT_KIND_UINT64, /**< value is a 64-bit unsigned integer */
|
||||
DDS_STAT_KIND_LENGTHTIME /**< value is integral(length(t) dt) */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief KeyValue statistics entry
|
||||
* @ingroup statistics
|
||||
*/
|
||||
struct dds_stat_keyvalue {
|
||||
const char *name; /**< name, memory owned by library */
|
||||
enum dds_stat_kind kind; /**< value type */
|
||||
union {
|
||||
uint32_t u32; /**< used if kind == DDS_STAT_KIND_UINT32 */
|
||||
uint64_t u64; /**< used if kind == DDS_STAT_KIND_UINT64 */
|
||||
uint64_t lengthtime; /**< used if kind == DDS_STAT_KIND_LENGTHTIME */
|
||||
} u; /**< value */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Statistics container
|
||||
* @ingroup statistics
|
||||
*/
|
||||
struct dds_statistics {
|
||||
dds_entity_t entity; /**< handle of entity to which this set of values applies */
|
||||
uint64_t opaque; /**< internal data */
|
||||
dds_time_t time; /**< time stamp of latest call to dds_refresh_statistics() */
|
||||
size_t count; /**< number of key-value pairs */
|
||||
struct dds_stat_keyvalue kv[]; /**< data */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Allocate a new statistics object for entity
|
||||
* @ingroup statistics
|
||||
* @component statistics
|
||||
* @unstable
|
||||
*
|
||||
* This allocates and populates a newly allocated `struct dds_statistics` for the
|
||||
* specified entity.
|
||||
*
|
||||
* @param[in] entity the handle of the entity
|
||||
*
|
||||
* @returns a newly allocated and populated statistics structure or NULL if entity is
|
||||
* invalid or doesn't support any statistics.
|
||||
*/
|
||||
DDS_EXPORT struct dds_statistics *dds_create_statistics (dds_entity_t entity);
|
||||
|
||||
/**
|
||||
* @brief Update a previously created statistics structure with current values
|
||||
* @ingroup statistics
|
||||
* @component statistics
|
||||
* @unstable
|
||||
*
|
||||
* Only the time stamp and the values (and "opaque") may change. The set of keys and the
|
||||
* types of the values do not change.
|
||||
*
|
||||
* @param[in,out] stat statistics structure to update the values of
|
||||
*
|
||||
* @returns success or an error indication
|
||||
*
|
||||
* @retval DDS_RETCODE_OK
|
||||
* the data was successfully updated
|
||||
* @retval DDS_RETCODE_BAD_PARAMETER
|
||||
* stats is a null pointer or the referenced entity no longer exists
|
||||
* @retval DDS_RETCODE_PRECONDITION_NOT_MET
|
||||
* library was deinitialized
|
||||
*/
|
||||
DDS_EXPORT dds_return_t dds_refresh_statistics (struct dds_statistics *stat);
|
||||
|
||||
/**
|
||||
* @brief Free a previously created statistics object
|
||||
* @ingroup statistics
|
||||
* @component statistics
|
||||
* @unstable
|
||||
*
|
||||
* This frees the statistics object. Passing a null pointer is a no-op. The operation
|
||||
* succeeds also if the referenced entity no longer exists.
|
||||
*
|
||||
* @param[in] stat statistics object to free
|
||||
*/
|
||||
DDS_EXPORT void dds_delete_statistics (struct dds_statistics *stat);
|
||||
|
||||
/**
|
||||
* @brief Lookup a specific value by name
|
||||
* @ingroup statistics
|
||||
* @component statistics
|
||||
* @unstable
|
||||
*
|
||||
* This looks up the specified name in the list of keys in `stat` and returns the address
|
||||
* of the key-value pair if present, a null pointer if not. If `stat` is a null pointer,
|
||||
* it returns a null pointer.
|
||||
*
|
||||
* @param[in] stat statistics object to lookup a name in (or NULL)
|
||||
* @param[in] name name to look for
|
||||
*
|
||||
* @returns The address of the key-value pair inside `stat`, or NULL if `stat` is NULL or
|
||||
* `name` does not match a key in `stat.
|
||||
*/
|
||||
DDS_EXPORT const struct dds_stat_keyvalue *dds_lookup_statistic (const struct dds_statistics *stat, const char *name)
|
||||
ddsrt_nonnull ((2));
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user