Initial contribution

This commit is contained in:
Michiel Beemster 2018-04-10 17:03:59 +02:00
parent 7b5cc4fa59
commit 11d9ce37aa
580 changed files with 155133 additions and 162 deletions

File diff suppressed because it is too large Load diff

View file

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

View file

@ -0,0 +1,155 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Error API
*
* This header file defines the public API of error values and convenience
* functions in the CycloneDDS C language binding.
*/
#ifndef DDS_ERROR_H
#define DDS_ERROR_H
#include "os/os_public.h"
#include "ddsc/dds_export.h"
#if defined (__cplusplus)
extern "C" {
#endif
/* Error masks for returned status values */
#define DDS_ERR_NR_MASK 0x000000ff
#define DDS_ERR_LINE_MASK 0x003fff00
#define DDS_ERR_FILE_ID_MASK 0x7fc00000
/*
State is unchanged following a function call returning an error
other than UNSPECIFIED, OUT_OF_RESOURCES and ALREADY_DELETED.
Error handling functions. Three components to returned int status value.
1 - The DDS_ERR_xxx error number
2 - The file identifier
3 - The line number
All functions return >= 0 on success, < 0 on error
*/
/** @name Return codes
@{**/
#define DDS_RETCODE_OK 0 /**< Success */
#define DDS_RETCODE_ERROR 1 /**< Non specific error */
#define DDS_RETCODE_UNSUPPORTED 2 /**< Feature unsupported */
#define DDS_RETCODE_BAD_PARAMETER 3 /**< Bad parameter value */
#define DDS_RETCODE_PRECONDITION_NOT_MET 4 /**< Precondition for operation not met */
#define DDS_RETCODE_OUT_OF_RESOURCES 5 /**< When an operation fails because of a lack of resources */
#define DDS_RETCODE_NOT_ENABLED 6 /**< When a configurable feature is not enabled */
#define DDS_RETCODE_IMMUTABLE_POLICY 7 /**< When an attempt is made to modify an immutable policy */
#define DDS_RETCODE_INCONSISTENT_POLICY 8 /**< When a policy is used with inconsistent values */
#define DDS_RETCODE_ALREADY_DELETED 9 /**< When an attempt is made to delete something more than once */
#define DDS_RETCODE_TIMEOUT 10 /**< When a timeout has occurred */
#define DDS_RETCODE_NO_DATA 11 /**< When expected data is not provided */
#define DDS_RETCODE_ILLEGAL_OPERATION 12 /**< When a function is called when it should not be */
#define DDS_RETCODE_NOT_ALLOWED_BY_SECURITY 13 /**< When credentials are not enough to use the function */
/** @}*/
/* For backwards compatability */
#define DDS_SUCCESS DDS_RETCODE_OK
/** @name DDS_Error_Type
@{**/
#define DDS_CHECK_REPORT 0x01
#define DDS_CHECK_FAIL 0x02
#define DDS_CHECK_EXIT 0x04
/** @}*/
/* Error code handling functions */
/** @name Macros for error handling
@{**/
#define DDS_TO_STRING(n) #n
#define DDS_INT_TO_STRING(n) DDS_TO_STRING(n)
/** @}*/
/** Macro to extract error number */
#define dds_err_nr(e) ((-(e)) & DDS_ERR_NR_MASK)
/** Macro to extract line number */
#define dds_err_line(e) (((-(e)) & DDS_ERR_LINE_MASK) >> 8)
/** Macro to extract file identifier */
#define dds_err_file_id(e) (((-(e)) & DDS_ERR_FILE_ID_MASK) >> 22)
/**
* @brief Takes the error value and outputs a string corresponding to it.
*
* @param[in] err Error value to be converted to a string
* @returns String corresponding to the error value
*/
DDS_EXPORT const char * dds_err_str (dds_return_t err);
/**
* @brief Takes the error number, error type and filename and line number and formats it to
* a string which can be used for debugging.
*
* @param[in] err Error value
* @param[in] flags Indicates Fail, Exit or Report
* @param[in] where File and line number
* @returns true - True
* @returns false - False
*/
DDS_EXPORT bool dds_err_check (dds_return_t err, unsigned flags, const char * where);
/** Macro that defines dds_err_check function */
#define DDS_ERR_CHECK(e, f) (dds_err_check ((e), (f), __FILE__ ":" DDS_INT_TO_STRING(__LINE__)))
/* Failure handling */
/** Failure handler */
typedef void (*dds_fail_fn) (const char *, const char *);
/** Macro that defines dds_fail function */
#define DDS_FAIL(m) (dds_fail (m, __FILE__ ":" DDS_INT_TO_STRING (__LINE__)))
/**
* @brief Set the failure function
*
* @param[in] fn Function to invoke on failure
*/
DDS_EXPORT void dds_fail_set (dds_fail_fn fn);
/**
* @brief Get the failure function
*
* @returns Failure function
*/
DDS_EXPORT dds_fail_fn dds_fail_get (void);
/**
* @brief Handles failure through an installed failure handler
*
* @params[in] msg String containing failure message
* @params[in] where String containing file and location
*/
DDS_EXPORT void dds_fail (const char * msg, const char * where);
#if defined (__cplusplus)
}
#endif
#endif

View file

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

View file

@ -0,0 +1,323 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Listener API
*
* This header file defines the public API of listeners in the
* CycloneDDS C language binding.
*/
#ifndef _DDS_PUBLIC_LISTENER_H_
#define _DDS_PUBLIC_LISTENER_H_
#include "ddsc/dds_export.h"
#include "ddsc/dds_public_impl.h"
#include "ddsc/dds_public_status.h"
#include "os/os_public.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);
#if 0
/* TODO: Why use (*dds_on_any_fn) (); and DDS_LUNSET? Why not just set the callbacks to NULL? */
typedef void (*dds_on_any_fn) (); /**< Empty parameter list on purpose; should be assignable without cast to all of the above. @todo check with an actual compiler; I'm a sloppy compiler */
#define DDS_LUNSET ((dds_on_any_fn)1) /**< Callback indicating a callback isn't set */
#else
#define DDS_LUNSET (NULL)
#endif
struct c_listener;
typedef struct c_listener dds_listener_t;
/**
* @brief Allocate memory and initializes to default values (::DDS_LUNSET) of a listener
*
* @param[in] arg optional pointer that will be passed on to the listener callbacks
*
* @return Returns a pointer to the allocated memory for dds_listener_t structure.
*/
_Ret_notnull_
DDS_EXPORT dds_listener_t* dds_listener_create (_In_opt_ void* arg);
/**
* @brief Delete the memory allocated to listener structure
*
* @param[in] listener pointer to the listener struct to delete
*/
DDS_EXPORT void dds_listener_delete (_In_ _Post_invalid_ dds_listener_t * __restrict listener);
/**
* @brief Reset the listener structure contents to ::DDS_LUNSET
*
* @param[in,out] listener pointer to the listener struct to reset
*/
DDS_EXPORT void dds_listener_reset (_Out_ dds_listener_t * __restrict listener);
/**
* @brief Copy the listener callbacks from source to destination
*
* @param[in,out] dst The pointer to the destination listener structure, where the content is to copied
* @param[in] src The pointer to the source listener structure to be copied
*/
DDS_EXPORT void dds_listener_copy (_Out_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
/**
* @brief Copy the listener callbacks from source to destination, unless already set
*
* Any listener callbacks already set in @p dst (including NULL) are skipped, only
* those set to DDS_LUNSET are copied from @p src.
*
* @param[in,out] dst The pointer to the destination listener structure, where the content is merged
* @param[in] src The pointer to the source listener structure to be copied
*/
DDS_EXPORT void dds_listener_merge (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
/************************************************************************************************
* Setters
************************************************************************************************/
/**
* @brief Set the inconsistent_topic callback in the listener structure.
*
* @param listener The pointer to the listener structure, where the callback will be set
* @param callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_inconsistent_topic (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_inconsistent_topic_fn callback);
/**
* @brief Set the liveliness_lost callback in the listener structure.
*
* @param[out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_liveliness_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_liveliness_lost_fn callback);
/**
* @brief Set the offered_deadline_missed callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_offered_deadline_missed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_offered_deadline_missed_fn callback);
/**
* @brief Set the offered_incompatible_qos callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_offered_incompatible_qos (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_offered_incompatible_qos_fn callback);
/**
* @brief Set the data_on_readers callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_data_on_readers (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_data_on_readers_fn callback);
/**
* @brief Set the sample_lost callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_sample_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_sample_lost_fn callback);
/**
* @brief Set the data_available callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_data_available (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_data_available_fn callback);
/**
* @brief Set the sample_rejected callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_sample_rejected (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_sample_rejected_fn callback);
/**
* @brief Set the liveliness_changed callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_liveliness_changed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_liveliness_changed_fn callback);
/**
* @brief Set the requested_deadline_missed callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_requested_deadline_missed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_requested_deadline_missed_fn callback);
/**
* @brief Set the requested_incompatible_qos callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_requested_incompatible_qos (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_requested_incompatible_qos_fn callback);
/**
* @brief Set the publication_matched callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_publication_matched (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_publication_matched_fn callback);
/**
* @brief Set the subscription_matched callback in the listener structure.
*
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lset_subscription_matched (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_subscription_matched_fn callback);
/************************************************************************************************
* Getters
************************************************************************************************/
/**
* @brief Get the inconsistent_topic callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_inconsistent_topic (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_inconsistent_topic_fn *callback);
/**
* @brief Get the liveliness_lost callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_liveliness_lost (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_lost_fn *callback);
/**
* @brief Get the offered_deadline_missed callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_offered_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_deadline_missed_fn *callback);
/**
* @brief Get the offered_incompatible_qos callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_offered_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_incompatible_qos_fn *callback);
/**
* @brief Get the data_on_readers callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_data_on_readers_fn *callback);
/**
* @brief Get the sample_lost callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_sample_lost (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_lost_fn *callback);
/**
* @brief Get the data_available callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_data_available (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_data_available_fn *callback);
/**
* @brief Get the sample_rejected callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_sample_rejected (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_rejected_fn *callback);
/**
* @brief Get the liveliness_changed callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_liveliness_changed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_changed_fn *callback);
/**
* @brief Get the requested_deadline_missed callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_requested_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_deadline_missed_fn *callback);
/**
* @brief Get the requested_incompatible_qos callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_requested_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_incompatible_qos_fn *callback);
/**
* @brief Get the publication_matched callback from the listener structure.
*
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
*/
DDS_EXPORT void dds_lget_publication_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_publication_matched_fn *callback);
/**
* @brief Get the subscription_matched callback from the listener structure.
*
* @param[in] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
* @param[in,out] listener The pointer to the listener structure, where the callback will be retrieved from
*/
DDS_EXPORT void dds_lget_subscription_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_subscription_matched_fn *callback);
#if defined (__cplusplus)
}
#endif
#endif /*_DDS_PUBLIC_LISTENER_H_*/

View file

@ -0,0 +1,39 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/* TODO: do we really need to expose this as an API? */
/** @file
*
* @brief DDS C Logging API
*
* This header file defines the public API for logging in the
* CycloneDDS C language binding.
*/
#ifndef DDS_LOG_H
#define DDS_LOG_H
#include "os/os_public.h"
#include "ddsc/dds_export.h"
#if defined (__cplusplus)
extern "C" {
#endif
DDS_EXPORT void dds_log_info (const char * fmt, ...);
DDS_EXPORT void dds_log_warn (const char * fmt, ...);
DDS_EXPORT void dds_log_error (const char * fmt, ...);
DDS_EXPORT void dds_log_fatal (const char * fmt, ...);
#if defined (__cplusplus)
}
#endif
#endif

View file

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

View file

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

View file

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

View file

@ -0,0 +1,96 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/** @file
*
* @brief DDS C Time support API
*
* This header file defines the public API of the in the
* CycloneDDS C language binding.
*/
#ifndef DDS_TIME_H
#define DDS_TIME_H
#include "os/os_public.h"
#include "ddsc/dds_export.h"
#if defined (__cplusplus)
extern "C" {
#endif
/*
Times are represented using a 64-bit signed integer, encoding
nanoseconds since the epoch. Considering the nature of these
systems, one would best use TAI, International Atomic Time, rather
than something UTC, but availability may be limited.
Valid times are non-negative and times up to 2**63-2 can be
represented. 2**63-1 is defined to represent, essentially, "never".
This is good enough for a couple of centuries.
*/
/** Absolute Time definition */
typedef int64_t dds_time_t;
/** Relative Time definition */
typedef int64_t dds_duration_t;
/** @name Macro definition for time units in nanoseconds.
@{**/
#define DDS_NSECS_IN_SEC 1000000000LL
#define DDS_NSECS_IN_MSEC 1000000LL
#define DDS_NSECS_IN_USEC 1000LL
/** @}*/
/** @name Infinite timeout for indicate absolute time */
#define DDS_NEVER ((dds_time_t) INT64_MAX)
/** @name Infinite timeout for relative time */
#define DDS_INFINITY ((dds_duration_t) INT64_MAX)
/** @name Macro definition for time conversion from nanoseconds
@{**/
#define DDS_SECS(n) ((n) * DDS_NSECS_IN_SEC)
#define DDS_MSECS(n) ((n) * DDS_NSECS_IN_MSEC)
#define DDS_USECS(n) ((n) * DDS_NSECS_IN_USEC)
/** @}*/
/**
* Description : This operation returns the current time (in nanoseconds)
*
* Arguments :
* -# Returns current time
*/
DDS_EXPORT dds_time_t dds_time (void);
/**
* Description : This operation blocks the calling thread until the relative time
* n has elapsed
*
* Arguments :
* -# n Relative Time to block a thread
*/
DDS_EXPORT void dds_sleepfor (dds_duration_t n);
/**
* Description : This operation blocks the calling thread until the absolute time
* n has elapsed
*
* Arguments :
* -# n absolute Time to block a thread
*/
DDS_EXPORT void dds_sleepuntil (dds_time_t n);
#if defined (__cplusplus)
}
#endif
#endif

File diff suppressed because it is too large Load diff